File s390-tools-sles15sp2-04-zfcpdbf-print-HBA-FC-Endpoint-Security-trace-records.patch of Package s390-tools.17983

Subject: [PATCH] [FEAT SAN1810] zfcpdbf: print HBA FC Endpoint Security trace records
From: Fedor Loshakov <loshakov@linux.ibm.com>

Summary:     zdev: report FC Endpoint Security of zfcp devices
Description: Report FC Endpoint Security of zfcp devices, which
             includes:
             1. Add support to report Fibre Channel (FC)
             Endpoint Security related information for zfcp-host
             and zfcp-lun devices.
             2. Format and print HBA FC Endpoint Security trace
             records
Upstream-ID: fbf8513d43656fddeecd844bbcdf468dd3cbd4cb
Problem-ID:  SAN1810

Upstream-Description:

             zfcpdbf: print HBA FC Endpoint Security trace records

             Format and print HBA FC Endpoint Security trace records with a record ID
             of ZFCP_DBF_HBA_FCES (5). Align output to the one of FSF response trace
             records for readability. Note that the FSF protocol status is most likely
             FSF_PROT_GOOD (0x00000001).

             Signed-off-by: Jens Remus <jremus@linux.ibm.com>
             Reviewed-by: Steffen Maier <maier@linux.ibm.com>
             Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>


Signed-off-by: Fedor Loshakov <loshakov@linux.ibm.com>
---
 scripts/zfcpdbf |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

--- a/scripts/zfcpdbf
+++ b/scripts/zfcpdbf
@@ -2,7 +2,7 @@
 #
 # zfcpdbf - Tool to interpret the information from logging/tracing sources
 #
-# Copyright IBM Corp. 2010, 2017
+# Copyright IBM Corp. 2010, 2020
 #
 # s390-tools is free software; you can redistribute it and/or modify
 # it under the terms of the MIT license. See LICENSE for details.
@@ -652,6 +652,47 @@ sub _print_hba_id3
 	}
 }
 
+sub _print_hba_id5
+{
+	my $fsf_req_id = shift();
+	my $rec = shift();
+	my $payload_length = shift();
+	my $rec_received = shift();
+	my $rec_issued;
+
+	$rec_issued  = stck_to_timeval(substr($rec, 0, 16));
+
+	if (defined $timediff) { # do we want to see delayed responses ?
+		my @t_arr = split(/[-:]/, $rec_received);
+
+		my $ts1 = mktime($t_arr[5], $t_arr[4], $t_arr[3],
+				 $t_arr[2], $t_arr[1] - 1, $t_arr[0] - 1900);
+
+		my ($ts2, $us2) = split(/:/, $rec_issued);
+
+		my $ts_received = $ts1 . "." . $t_arr[6];
+		my $ts_issued = $ts2 . "." . $us2;
+
+		if (($ts_received - $ts_issued) >= $timediff) {
+			print "WARNING: delayed response above ",
+			      "skip level of $timediff seconds.\n";
+		}
+	}
+
+	print "FSF issued     : ",str_timestamp($rec_issued),"\n";
+	print "FSF stat       : 0x", substr($rec, 16, 8), "\n";
+	print "FSF stat qual  : n/a\n";
+	print "Prot stat      : n/a\n";
+	print "Prot stat qual : n/a\n";
+
+	print "Port handle    : 0x", substr($rec, 24, 8), "\n";
+	print "LUN handle     : n/a\n";
+
+	print "WWPN           : 0x", substr($rec, 32, 16), "\n";
+	print "FCES old       : 0x", substr($rec, 48, 8), "\n";
+	print "FCES new       : 0x", substr($rec, 56, 8), "\n";
+}
+
 sub print_deferr_common
 {
 	my $rec = shift();
@@ -854,6 +895,7 @@ sub assign_callback_subs
 	$print_hba_id[1] = \&_print_hba_id1;
 	$print_hba_id[2] = \&_print_hba_id2;
 	$print_hba_id[3] = \&_print_hba_id3;
+	$print_hba_id[5] = \&_print_hba_id5;
 
 	$print_rec_id[1] = \&_print_rec_id1;
 	$print_rec_id[2] = \&_print_rec_id2;
openSUSE Build Service is sponsored by