File s390-tools-sles11sp3-zfcpdbf-offset-length-fields-trace-records.patch of Package s390-tools

Subject: [PATCH] [BZ 91793] zfcpdbf: fix offset and length of fields in trace records
From: Steffen Maier <maier@linux.vnet.ibm.com>

Description:  zfcpdbf: fix offset and length of fields in trace records
Symptom:      "SRB D_ID" always starts with 0x00 and last byte is missing.
              Output after "FCP response   : " is too short by 1 byte.
Problem:      Length to take from record hexdump for "SRB D_ID" is
              too small by 2 hex digits.
              Offset into record hexdump for "FCP response"
              is too large by 2 hex digits.
Solution:     crash> struct -o -d zfcp_dbf_hba_uss
              struct zfcp_dbf_hba_uss {
                 [0] u32 status_type;
                 [4] u32 status_subtype;
                 [8] u32 d_id; /* <=== */
                [12] u64 lun;
                [20] u64 queue_designator;
              }
              SIZE: 28
              SRB D_ID is filled in by zfcp via assignment of ntoh24's
              return value so the highest byte is always zero. Simply
              output the full u32 including any preceding zeros as we
              already do for all other D_ID fields in other contexts.
              crash> struct zfcp_dbf_scsi -o -d
              struct zfcp_dbf_scsi {
                 [0] u8 id;
                 [1] char tag[7];
                 [8] u32 scsi_id;
                [12] u32 scsi_lun;
                [16] u32 scsi_result;
                [20] u8 scsi_retries;
                [21] u8 scsi_allowed;
                [22] u8 fcp_rsp_info;
                [23] u8 scsi_opcode[16];
                [39] u64 fsf_req_id;
                [47] u64 host_scribble;
                [55] u16 pl_len;
                [57] struct fcp_resp_with_ext fcp_rsp; /* <=== */
              }
              SIZE: 81
              Offsets (and lengths) are given in number of hex digits,
              so fcp_rsp is at 2*57=114.
Reproduction: Run zfcpdbf with input having at least one record in the SCSI
              trace area, or run zfcpdbf with input having at least one SRB
              record in the HBA area. Ensure not to ignore the respective
              area with command line options.
Upstream-ID:  -
Problem-ID:   91793

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
---
 scripts/zfcpdbf |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/scripts/zfcpdbf
+++ b/scripts/zfcpdbf
@@ -345,7 +345,7 @@ sub _print_hba_id2
 
 	print "SRB stat type  : 0x", substr($rec, 0, 8), "\n";
 	print "SRB stat sub   : 0x", substr($rec, 8, 8), "\n";
-	print "SRB D_ID       : 0x", substr($rec, 16, 6), "\n";
+	print "SRB D_ID       : 0x", substr($rec, 16, 8), "\n";
 	print "SRB LUN        : 0x", substr($rec, 24, 16), "\n";
 	print "SRB q-design.  : 0x", substr($rec, 40, 16), "\n";
 
@@ -489,7 +489,7 @@ sub print_scsi_common
 	print "SCSI scribble  : 0x", substr($rec->[2], 94, 16), "\n";
 	print "SCSI opcode    : ", payload_format(substr($rec->[2], 46, 32));
 	print "FCP resp. info : 0x", substr($rec->[2], 44, 2), "\n";
-	print "FCP response   : ", payload_format(substr($rec->[2], 116, 48));
+	print "FCP response   : ", payload_format(substr($rec->[2], 114, 48));
 
 	print_payload($payload_length, $pay_rec) if ($payload_length);
 	print "\n";
openSUSE Build Service is sponsored by