]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/s390-03-06-zfcp-hexdump.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / s390-03-06-zfcp-hexdump.patch
CommitLineData
2cb7cef9
BS
1From: Gerald Schaefer <geraldsc@de.ibm.com>
2Subject: zfcp: fix hexdump data in s390dbf traces
3References: bnc#440610
4
5Symptom: Hexdump data in s390dbf traces is incomplete
6Problem: The length of the data traced was wrong and the SAN payload
7 was read from a different place then it was written to.
8Solution: Fix the mentioned problems, now we have complete RSCN
9 traces (up to 1024 bytes)
10
11Acked-by: John Jolly <jjolly@suse.de>
12---
13
14 drivers/s390/scsi/zfcp_dbf.c | 42 ++++++++++++++++--------------------------
15 drivers/s390/scsi/zfcp_dbf.h | 8 ++------
16 2 files changed, 18 insertions(+), 32 deletions(-)
17
18diff -urpN linux-2.6/drivers/s390/scsi/zfcp_dbf.c linux-2.6-patched/drivers/s390/scsi/zfcp_dbf.c
19--- linux-2.6/drivers/s390/scsi/zfcp_dbf.c 2008-11-04 09:46:57.000000000 +0100
20+++ linux-2.6-patched/drivers/s390/scsi/zfcp_dbf.c 2008-11-04 09:47:18.000000000 +0100
21@@ -32,7 +32,7 @@ static void zfcp_dbf_hexdump(debug_info_
22 dump->offset = offset;
23 dump->size = min(from_len - offset, room);
24 memcpy(dump->data, from + offset, dump->size);
25- debug_event(dbf, level, dump, dump->size);
26+ debug_event(dbf, level, dump, dump->size + sizeof(*dump));
27 }
28 }
29
30@@ -110,7 +110,7 @@ static int zfcp_dbf_view_header(debug_in
31 t.tv_sec, t.tv_nsec);
32 zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid);
33 } else {
34- zfcp_dbf_outd(&p, NULL, dump->data, dump->size, dump->offset,
35+ zfcp_dbf_outd(&p, "", dump->data, dump->size, dump->offset,
36 dump->total_size);
37 if ((dump->offset + dump->size) == dump->total_size)
38 p += sprintf(p, "\n");
39@@ -368,6 +368,7 @@ static void zfcp_hba_dbf_view_response(c
40 break;
41 zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", r->u.fcp.cmnd);
42 zfcp_dbf_out(p, "scsi_serial", "0x%016Lx", r->u.fcp.serial);
43+ p += sprintf(*p, "\n");
44 break;
45
46 case FSF_QTCB_OPEN_PORT_WITH_DID:
47@@ -467,7 +468,8 @@ static int zfcp_hba_dbf_view_format(debu
48 else if (strncmp(r->tag, "berr", ZFCP_DBF_TAG_SIZE) == 0)
49 zfcp_hba_dbf_view_berr(&p, &r->u.berr);
50
51- p += sprintf(p, "\n");
52+ if (strncmp(r->tag, "resp", ZFCP_DBF_TAG_SIZE) != 0)
53+ p += sprintf(p, "\n");
54 return p - out_buf;
55 }
56
57@@ -882,6 +884,7 @@ void zfcp_san_dbf_event_ct_request(struc
58 struct ct_hdr *hdr = sg_virt(ct->req);
59 struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf;
60 struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req;
61+ int level = 3;
62 unsigned long flags;
63
64 spin_lock_irqsave(&adapter->san_dbf_lock, flags);
65@@ -898,9 +901,10 @@ void zfcp_san_dbf_event_ct_request(struc
66 oct->options = hdr->options;
67 oct->max_res_size = hdr->max_res_size;
68 oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr),
69- ZFCP_DBF_CT_PAYLOAD);
70- memcpy(oct->payload, (void *)hdr + sizeof(struct ct_hdr), oct->len);
71- debug_event(adapter->san_dbf, 3, r, sizeof(*r));
72+ ZFCP_DBF_SAN_MAX_PAYLOAD);
73+ debug_event(adapter->san_dbf, level, r, sizeof(*r));
74+ zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level,
75+ (void *)hdr + sizeof(struct ct_hdr), oct->len);
76 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
77 }
78
79@@ -916,6 +920,7 @@ void zfcp_san_dbf_event_ct_response(stru
80 struct ct_hdr *hdr = sg_virt(ct->resp);
81 struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf;
82 struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp;
83+ int level = 3;
84 unsigned long flags;
85
86 spin_lock_irqsave(&adapter->san_dbf_lock, flags);
87@@ -931,9 +936,10 @@ void zfcp_san_dbf_event_ct_response(stru
88 rct->expl = hdr->reason_code_expl;
89 rct->vendor_unique = hdr->vendor_unique;
90 rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr),
91- ZFCP_DBF_CT_PAYLOAD);
92- memcpy(rct->payload, (void *)hdr + sizeof(struct ct_hdr), rct->len);
93- debug_event(adapter->san_dbf, 3, r, sizeof(*r));
94+ ZFCP_DBF_SAN_MAX_PAYLOAD);
95+ debug_event(adapter->san_dbf, level, r, sizeof(*r));
96+ zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level,
97+ (void *)hdr + sizeof(struct ct_hdr), rct->len);
98 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
99 }
100
101@@ -956,7 +962,7 @@ static void zfcp_san_dbf_event_els(const
102 rec->u.els.ls_code = ls_code;
103 debug_event(adapter->san_dbf, level, rec, sizeof(*rec));
104 zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level,
105- buffer, min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD));
106+ buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD));
107 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
108 }
109
110@@ -1010,8 +1016,6 @@ static int zfcp_san_dbf_view_format(debu
111 char *out_buf, const char *in_buf)
112 {
113 struct zfcp_san_dbf_record *r = (struct zfcp_san_dbf_record *)in_buf;
114- char *buffer = NULL;
115- int buflen = 0, total = 0;
116 char *p = out_buf;
117
118 if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0)
119@@ -1031,9 +1035,6 @@ static int zfcp_san_dbf_view_format(debu
120 zfcp_dbf_out(&p, "gs_subtype", "0x%02x", ct->gs_subtype);
121 zfcp_dbf_out(&p, "options", "0x%02x", ct->options);
122 zfcp_dbf_out(&p, "max_res_size", "0x%04x", ct->max_res_size);
123- total = ct->len;
124- buffer = ct->payload;
125- buflen = min(total, ZFCP_DBF_CT_PAYLOAD);
126 } else if (strncmp(r->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) {
127 struct zfcp_san_dbf_record_ct_response *ct = &r->u.ct_resp;
128 zfcp_dbf_out(&p, "cmd_rsp_code", "0x%04x", ct->cmd_rsp_code);
129@@ -1041,23 +1042,12 @@ static int zfcp_san_dbf_view_format(debu
130 zfcp_dbf_out(&p, "reason_code", "0x%02x", ct->reason_code);
131 zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", ct->expl);
132 zfcp_dbf_out(&p, "vendor_unique", "0x%02x", ct->vendor_unique);
133- total = ct->len;
134- buffer = ct->payload;
135- buflen = min(total, ZFCP_DBF_CT_PAYLOAD);
136 } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 ||
137 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 ||
138 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) {
139 struct zfcp_san_dbf_record_els *els = &r->u.els;
140 zfcp_dbf_out(&p, "ls_code", "0x%02x", els->ls_code);
141- total = els->len;
142- buffer = els->payload;
143- buflen = min(total, ZFCP_DBF_ELS_PAYLOAD);
144 }
145-
146- zfcp_dbf_outd(&p, "payload", buffer, buflen, 0, total);
147- if (buflen == total)
148- p += sprintf(p, "\n");
149-
150 return p - out_buf;
151 }
152
153diff -urpN linux-2.6/drivers/s390/scsi/zfcp_dbf.h linux-2.6-patched/drivers/s390/scsi/zfcp_dbf.h
154--- linux-2.6/drivers/s390/scsi/zfcp_dbf.h 2008-11-04 09:46:30.000000000 +0100
155+++ linux-2.6-patched/drivers/s390/scsi/zfcp_dbf.h 2008-11-04 09:47:18.000000000 +0100
156@@ -163,8 +163,6 @@ struct zfcp_san_dbf_record_ct_request {
157 u8 options;
158 u16 max_res_size;
159 u32 len;
160-#define ZFCP_DBF_CT_PAYLOAD 24
161- u8 payload[ZFCP_DBF_CT_PAYLOAD];
162 } __attribute__ ((packed));
163
164 struct zfcp_san_dbf_record_ct_response {
165@@ -174,15 +172,11 @@ struct zfcp_san_dbf_record_ct_response {
166 u8 expl;
167 u8 vendor_unique;
168 u32 len;
169- u8 payload[ZFCP_DBF_CT_PAYLOAD];
170 } __attribute__ ((packed));
171
172 struct zfcp_san_dbf_record_els {
173 u8 ls_code;
174 u32 len;
175-#define ZFCP_DBF_ELS_PAYLOAD 32
176-#define ZFCP_DBF_ELS_MAX_PAYLOAD 1024
177- u8 payload[ZFCP_DBF_ELS_PAYLOAD];
178 } __attribute__ ((packed));
179
180 struct zfcp_san_dbf_record {
181@@ -196,6 +190,8 @@ struct zfcp_san_dbf_record {
182 struct zfcp_san_dbf_record_ct_response ct_resp;
183 struct zfcp_san_dbf_record_els els;
184 } u;
185+#define ZFCP_DBF_SAN_MAX_PAYLOAD 1024
186+ u8 payload[32];
187 } __attribute__ ((packed));
188
189 struct zfcp_scsi_dbf_record {