aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMartin Peschke <mp3@de.ibm.com>2008-03-31 05:15:29 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:10 -0400
commit6bc473dd324237acbaa7a4c5e73d00dd5fc389ec (patch)
tree3708bd5d55c9b4e85912369fe0a1aaeb757d36ca /drivers
parent2b604c9b909ce1c98e51208eee2f70ee3e604079 (diff)
[SCSI] zfcp: Shorten excessive names in debug trace.
Saving on line breaks, improving readability, by shortening excessive function names and identifiers, by simplifying some functions call chains, and by simplifying nesting of some data structure. Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c305
-rw-r--r--drivers/s390/scsi/zfcp_dbf.h74
2 files changed, 170 insertions, 209 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 0ab985c037fe..a39a3e33a5b6 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -144,12 +144,12 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
144 struct zfcp_unit *unit; 144 struct zfcp_unit *unit;
145 struct zfcp_send_els *send_els; 145 struct zfcp_send_els *send_els;
146 struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; 146 struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
147 struct zfcp_hba_dbf_record_response *response = &rec->type.response; 147 struct zfcp_hba_dbf_record_response *response = &rec->u.response;
148 int level; 148 int level;
149 unsigned long flags; 149 unsigned long flags;
150 150
151 spin_lock_irqsave(&adapter->hba_dbf_lock, flags); 151 spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
152 memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); 152 memset(rec, 0, sizeof(*rec));
153 strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE); 153 strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE);
154 154
155 if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) && 155 if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
@@ -193,11 +193,9 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
193 if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) 193 if (fsf_req->status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)
194 break; 194 break;
195 scsi_cmnd = (struct scsi_cmnd *)fsf_req->data; 195 scsi_cmnd = (struct scsi_cmnd *)fsf_req->data;
196 if (scsi_cmnd != NULL) { 196 if (scsi_cmnd) {
197 response->data.send_fcp.scsi_cmnd 197 response->u.fcp.cmnd = (unsigned long)scsi_cmnd;
198 = (unsigned long)scsi_cmnd; 198 response->u.fcp.serial = scsi_cmnd->serial_number;
199 response->data.send_fcp.scsi_serial
200 = scsi_cmnd->serial_number;
201 } 199 }
202 break; 200 break;
203 201
@@ -205,25 +203,25 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
205 case FSF_QTCB_CLOSE_PORT: 203 case FSF_QTCB_CLOSE_PORT:
206 case FSF_QTCB_CLOSE_PHYSICAL_PORT: 204 case FSF_QTCB_CLOSE_PHYSICAL_PORT:
207 port = (struct zfcp_port *)fsf_req->data; 205 port = (struct zfcp_port *)fsf_req->data;
208 response->data.port.wwpn = port->wwpn; 206 response->u.port.wwpn = port->wwpn;
209 response->data.port.d_id = port->d_id; 207 response->u.port.d_id = port->d_id;
210 response->data.port.port_handle = qtcb->header.port_handle; 208 response->u.port.port_handle = qtcb->header.port_handle;
211 break; 209 break;
212 210
213 case FSF_QTCB_OPEN_LUN: 211 case FSF_QTCB_OPEN_LUN:
214 case FSF_QTCB_CLOSE_LUN: 212 case FSF_QTCB_CLOSE_LUN:
215 unit = (struct zfcp_unit *)fsf_req->data; 213 unit = (struct zfcp_unit *)fsf_req->data;
216 port = unit->port; 214 port = unit->port;
217 response->data.unit.wwpn = port->wwpn; 215 response->u.unit.wwpn = port->wwpn;
218 response->data.unit.fcp_lun = unit->fcp_lun; 216 response->u.unit.fcp_lun = unit->fcp_lun;
219 response->data.unit.port_handle = qtcb->header.port_handle; 217 response->u.unit.port_handle = qtcb->header.port_handle;
220 response->data.unit.lun_handle = qtcb->header.lun_handle; 218 response->u.unit.lun_handle = qtcb->header.lun_handle;
221 break; 219 break;
222 220
223 case FSF_QTCB_SEND_ELS: 221 case FSF_QTCB_SEND_ELS:
224 send_els = (struct zfcp_send_els *)fsf_req->data; 222 send_els = (struct zfcp_send_els *)fsf_req->data;
225 response->data.send_els.d_id = qtcb->bottom.support.d_id; 223 response->u.els.d_id = qtcb->bottom.support.d_id;
226 response->data.send_els.ls_code = send_els->ls_code >> 24; 224 response->u.els.ls_code = send_els->ls_code >> 24;
227 break; 225 break;
228 226
229 case FSF_QTCB_ABORT_FCP_CMND: 227 case FSF_QTCB_ABORT_FCP_CMND:
@@ -235,8 +233,7 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
235 break; 233 break;
236 } 234 }
237 235
238 debug_event(adapter->hba_dbf, level, 236 debug_event(adapter->hba_dbf, level, rec, sizeof(*rec));
239 rec, sizeof(struct zfcp_hba_dbf_record));
240 237
241 /* have fcp channel microcode fixed to use as little as possible */ 238 /* have fcp channel microcode fixed to use as little as possible */
242 if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) { 239 if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) {
@@ -259,26 +256,26 @@ zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
259 unsigned long flags; 256 unsigned long flags;
260 257
261 spin_lock_irqsave(&adapter->hba_dbf_lock, flags); 258 spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
262 memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); 259 memset(rec, 0, sizeof(*rec));
263 strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE); 260 strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE);
264 strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE); 261 strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE);
265 262
266 rec->type.status.failed = adapter->status_read_failed; 263 rec->u.status.failed = adapter->status_read_failed;
267 if (status_buffer != NULL) { 264 if (status_buffer != NULL) {
268 rec->type.status.status_type = status_buffer->status_type; 265 rec->u.status.status_type = status_buffer->status_type;
269 rec->type.status.status_subtype = status_buffer->status_subtype; 266 rec->u.status.status_subtype = status_buffer->status_subtype;
270 memcpy(&rec->type.status.queue_designator, 267 memcpy(&rec->u.status.queue_designator,
271 &status_buffer->queue_designator, 268 &status_buffer->queue_designator,
272 sizeof(struct fsf_queue_designator)); 269 sizeof(struct fsf_queue_designator));
273 270
274 switch (status_buffer->status_type) { 271 switch (status_buffer->status_type) {
275 case FSF_STATUS_READ_SENSE_DATA_AVAIL: 272 case FSF_STATUS_READ_SENSE_DATA_AVAIL:
276 rec->type.status.payload_size = 273 rec->u.status.payload_size =
277 ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL; 274 ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL;
278 break; 275 break;
279 276
280 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: 277 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
281 rec->type.status.payload_size = 278 rec->u.status.payload_size =
282 ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD; 279 ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD;
283 break; 280 break;
284 281
@@ -286,22 +283,21 @@ zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
286 switch (status_buffer->status_subtype) { 283 switch (status_buffer->status_subtype) {
287 case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: 284 case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK:
288 case FSF_STATUS_READ_SUB_FDISC_FAILED: 285 case FSF_STATUS_READ_SUB_FDISC_FAILED:
289 rec->type.status.payload_size = 286 rec->u.status.payload_size =
290 sizeof(struct fsf_link_down_info); 287 sizeof(struct fsf_link_down_info);
291 } 288 }
292 break; 289 break;
293 290
294 case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: 291 case FSF_STATUS_READ_FEATURE_UPDATE_ALERT:
295 rec->type.status.payload_size = 292 rec->u.status.payload_size =
296 ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT; 293 ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT;
297 break; 294 break;
298 } 295 }
299 memcpy(&rec->type.status.payload, 296 memcpy(&rec->u.status.payload,
300 &status_buffer->payload, rec->type.status.payload_size); 297 &status_buffer->payload, rec->u.status.payload_size);
301 } 298 }
302 299
303 debug_event(adapter->hba_dbf, 2, 300 debug_event(adapter->hba_dbf, 2, rec, sizeof(*rec));
304 rec, sizeof(struct zfcp_hba_dbf_record));
305 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); 301 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
306} 302}
307 303
@@ -310,19 +306,18 @@ zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status,
310 unsigned int qdio_error, unsigned int siga_error, 306 unsigned int qdio_error, unsigned int siga_error,
311 int sbal_index, int sbal_count) 307 int sbal_index, int sbal_count)
312{ 308{
313 struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; 309 struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf;
314 unsigned long flags; 310 unsigned long flags;
315 311
316 spin_lock_irqsave(&adapter->hba_dbf_lock, flags); 312 spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
317 memset(rec, 0, sizeof(struct zfcp_hba_dbf_record)); 313 memset(r, 0, sizeof(*r));
318 strncpy(rec->tag, "qdio", ZFCP_DBF_TAG_SIZE); 314 strncpy(r->tag, "qdio", ZFCP_DBF_TAG_SIZE);
319 rec->type.qdio.status = status; 315 r->u.qdio.status = status;
320 rec->type.qdio.qdio_error = qdio_error; 316 r->u.qdio.qdio_error = qdio_error;
321 rec->type.qdio.siga_error = siga_error; 317 r->u.qdio.siga_error = siga_error;
322 rec->type.qdio.sbal_index = sbal_index; 318 r->u.qdio.sbal_index = sbal_index;
323 rec->type.qdio.sbal_count = sbal_count; 319 r->u.qdio.sbal_count = sbal_count;
324 debug_event(adapter->hba_dbf, 0, 320 debug_event(adapter->hba_dbf, 0, r, sizeof(*r));
325 rec, sizeof(struct zfcp_hba_dbf_record));
326 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); 321 spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
327} 322}
328 323
@@ -352,34 +347,29 @@ static void zfcp_hba_dbf_view_response(char **p,
352 case FSF_QTCB_FCP_CMND: 347 case FSF_QTCB_FCP_CMND:
353 if (r->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) 348 if (r->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT)
354 break; 349 break;
355 zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", 350 zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", r->u.fcp.cmnd);
356 r->data.send_fcp.scsi_cmnd); 351 zfcp_dbf_out(p, "scsi_serial", "0x%016Lx", r->u.fcp.serial);
357 zfcp_dbf_out(p, "scsi_serial", "0x%016Lx",
358 r->data.send_fcp.scsi_serial);
359 break; 352 break;
360 353
361 case FSF_QTCB_OPEN_PORT_WITH_DID: 354 case FSF_QTCB_OPEN_PORT_WITH_DID:
362 case FSF_QTCB_CLOSE_PORT: 355 case FSF_QTCB_CLOSE_PORT:
363 case FSF_QTCB_CLOSE_PHYSICAL_PORT: 356 case FSF_QTCB_CLOSE_PHYSICAL_PORT:
364 zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->data.port.wwpn); 357 zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->u.port.wwpn);
365 zfcp_dbf_out(p, "d_id", "0x%06x", r->data.port.d_id); 358 zfcp_dbf_out(p, "d_id", "0x%06x", r->u.port.d_id);
366 zfcp_dbf_out(p, "port_handle", "0x%08x", 359 zfcp_dbf_out(p, "port_handle", "0x%08x", r->u.port.port_handle);
367 r->data.port.port_handle);
368 break; 360 break;
369 361
370 case FSF_QTCB_OPEN_LUN: 362 case FSF_QTCB_OPEN_LUN:
371 case FSF_QTCB_CLOSE_LUN: 363 case FSF_QTCB_CLOSE_LUN:
372 zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->data.unit.wwpn); 364 zfcp_dbf_out(p, "wwpn", "0x%016Lx", r->u.unit.wwpn);
373 zfcp_dbf_out(p, "fcp_lun", "0x%016Lx", r->data.unit.fcp_lun); 365 zfcp_dbf_out(p, "fcp_lun", "0x%016Lx", r->u.unit.fcp_lun);
374 zfcp_dbf_out(p, "port_handle", "0x%08x", 366 zfcp_dbf_out(p, "port_handle", "0x%08x", r->u.unit.port_handle);
375 r->data.unit.port_handle); 367 zfcp_dbf_out(p, "lun_handle", "0x%08x", r->u.unit.lun_handle);
376 zfcp_dbf_out(p, "lun_handle", "0x%08x",
377 r->data.unit.lun_handle);
378 break; 368 break;
379 369
380 case FSF_QTCB_SEND_ELS: 370 case FSF_QTCB_SEND_ELS:
381 zfcp_dbf_out(p, "d_id", "0x%06x", r->data.send_els.d_id); 371 zfcp_dbf_out(p, "d_id", "0x%06x", r->u.els.d_id);
382 zfcp_dbf_out(p, "ls_code", "0x%02x", r->data.send_els.ls_code); 372 zfcp_dbf_out(p, "ls_code", "0x%02x", r->u.els.ls_code);
383 break; 373 break;
384 374
385 case FSF_QTCB_ABORT_FCP_CMND: 375 case FSF_QTCB_ABORT_FCP_CMND:
@@ -428,11 +418,11 @@ static int zfcp_hba_dbf_view_format(debug_info_t *id, struct debug_view *view,
428 zfcp_dbf_tag(&p, "tag2", r->tag2); 418 zfcp_dbf_tag(&p, "tag2", r->tag2);
429 419
430 if (strncmp(r->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0) 420 if (strncmp(r->tag, "resp", ZFCP_DBF_TAG_SIZE) == 0)
431 zfcp_hba_dbf_view_response(&p, &r->type.response); 421 zfcp_hba_dbf_view_response(&p, &r->u.response);
432 else if (strncmp(r->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0) 422 else if (strncmp(r->tag, "stat", ZFCP_DBF_TAG_SIZE) == 0)
433 zfcp_hba_dbf_view_status(&p, &r->type.status); 423 zfcp_hba_dbf_view_status(&p, &r->u.status);
434 else if (strncmp(r->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0) 424 else if (strncmp(r->tag, "qdio", ZFCP_DBF_TAG_SIZE) == 0)
435 zfcp_hba_dbf_view_qdio(&p, &r->type.qdio); 425 zfcp_hba_dbf_view_qdio(&p, &r->u.qdio);
436 426
437 p += sprintf(p, "\n"); 427 p += sprintf(p, "\n");
438 return p - out_buf; 428 return p - out_buf;
@@ -823,57 +813,34 @@ void zfcp_rec_dbf_event_action(u8 id2, struct zfcp_erp_action *erp_action)
823 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); 813 spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
824} 814}
825 815
826static void
827_zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req,
828 u32 s_id, u32 d_id, void *buffer, int buflen)
829{
830 struct zfcp_send_ct *send_ct = (struct zfcp_send_ct *)fsf_req->data;
831 struct zfcp_port *port = send_ct->port;
832 struct zfcp_adapter *adapter = port->adapter;
833 struct ct_hdr *header = (struct ct_hdr *)buffer;
834 struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf;
835 struct zfcp_san_dbf_record_ct *ct = &rec->type.ct;
836 unsigned long flags;
837
838 spin_lock_irqsave(&adapter->san_dbf_lock, flags);
839 memset(rec, 0, sizeof(struct zfcp_san_dbf_record));
840 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
841 rec->fsf_reqid = (unsigned long)fsf_req;
842 rec->fsf_seqno = fsf_req->seq_no;
843 rec->s_id = s_id;
844 rec->d_id = d_id;
845 if (strncmp(tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) {
846 ct->type.request.cmd_req_code = header->cmd_rsp_code;
847 ct->type.request.revision = header->revision;
848 ct->type.request.gs_type = header->gs_type;
849 ct->type.request.gs_subtype = header->gs_subtype;
850 ct->type.request.options = header->options;
851 ct->type.request.max_res_size = header->max_res_size;
852 } else if (strncmp(tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) {
853 ct->type.response.cmd_rsp_code = header->cmd_rsp_code;
854 ct->type.response.revision = header->revision;
855 ct->type.response.reason_code = header->reason_code;
856 ct->type.response.reason_code_expl = header->reason_code_expl;
857 ct->type.response.vendor_unique = header->vendor_unique;
858 }
859 ct->payload_size =
860 min(buflen - (int)sizeof(struct ct_hdr), ZFCP_DBF_CT_PAYLOAD);
861 memcpy(ct->payload, buffer + sizeof(struct ct_hdr), ct->payload_size);
862 debug_event(adapter->san_dbf, 3,
863 rec, sizeof(struct zfcp_san_dbf_record));
864 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
865}
866
867void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req) 816void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req)
868{ 817{
869 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; 818 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
870 struct zfcp_port *port = ct->port; 819 struct zfcp_port *port = ct->port;
871 struct zfcp_adapter *adapter = port->adapter; 820 struct zfcp_adapter *adapter = port->adapter;
821 struct ct_hdr *hdr = zfcp_sg_to_address(ct->req);
822 struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf;
823 struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req;
824 unsigned long flags;
872 825
873 _zfcp_san_dbf_event_common_ct("octc", fsf_req, 826 spin_lock_irqsave(&adapter->san_dbf_lock, flags);
874 fc_host_port_id(adapter->scsi_host), 827 memset(r, 0, sizeof(*r));
875 port->d_id, zfcp_sg_to_address(ct->req), 828 strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE);
876 ct->req->length); 829 r->fsf_reqid = (unsigned long)fsf_req;
830 r->fsf_seqno = fsf_req->seq_no;
831 r->s_id = fc_host_port_id(adapter->scsi_host);
832 r->d_id = port->d_id;
833 oct->cmd_req_code = hdr->cmd_rsp_code;
834 oct->revision = hdr->revision;
835 oct->gs_type = hdr->gs_type;
836 oct->gs_subtype = hdr->gs_subtype;
837 oct->options = hdr->options;
838 oct->max_res_size = hdr->max_res_size;
839 oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr),
840 ZFCP_DBF_CT_PAYLOAD);
841 memcpy(oct->payload, (void *)hdr + sizeof(struct ct_hdr), oct->len);
842 debug_event(adapter->san_dbf, 3, r, sizeof(*r));
843 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
877} 844}
878 845
879void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req) 846void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req)
@@ -881,11 +848,28 @@ void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req)
881 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; 848 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
882 struct zfcp_port *port = ct->port; 849 struct zfcp_port *port = ct->port;
883 struct zfcp_adapter *adapter = port->adapter; 850 struct zfcp_adapter *adapter = port->adapter;
851 struct ct_hdr *hdr = zfcp_sg_to_address(ct->resp);
852 struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf;
853 struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp;
854 unsigned long flags;
884 855
885 _zfcp_san_dbf_event_common_ct("rctc", fsf_req, port->d_id, 856 spin_lock_irqsave(&adapter->san_dbf_lock, flags);
886 fc_host_port_id(adapter->scsi_host), 857 memset(r, 0, sizeof(*r));
887 zfcp_sg_to_address(ct->resp), 858 strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE);
888 ct->resp->length); 859 r->fsf_reqid = (unsigned long)fsf_req;
860 r->fsf_seqno = fsf_req->seq_no;
861 r->s_id = port->d_id;
862 r->d_id = fc_host_port_id(adapter->scsi_host);
863 rct->cmd_rsp_code = hdr->cmd_rsp_code;
864 rct->revision = hdr->revision;
865 rct->reason_code = hdr->reason_code;
866 rct->expl = hdr->reason_code_expl;
867 rct->vendor_unique = hdr->vendor_unique;
868 rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr),
869 ZFCP_DBF_CT_PAYLOAD);
870 memcpy(rct->payload, (void *)hdr + sizeof(struct ct_hdr), rct->len);
871 debug_event(adapter->san_dbf, 3, r, sizeof(*r));
872 spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
889} 873}
890 874
891static void 875static void
@@ -898,13 +882,13 @@ _zfcp_san_dbf_event_common_els(const char *tag, int level,
898 unsigned long flags; 882 unsigned long flags;
899 883
900 spin_lock_irqsave(&adapter->san_dbf_lock, flags); 884 spin_lock_irqsave(&adapter->san_dbf_lock, flags);
901 memset(rec, 0, sizeof(struct zfcp_san_dbf_record)); 885 memset(rec, 0, sizeof(*rec));
902 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); 886 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
903 rec->fsf_reqid = (unsigned long)fsf_req; 887 rec->fsf_reqid = (unsigned long)fsf_req;
904 rec->fsf_seqno = fsf_req->seq_no; 888 rec->fsf_seqno = fsf_req->seq_no;
905 rec->s_id = s_id; 889 rec->s_id = s_id;
906 rec->d_id = d_id; 890 rec->d_id = d_id;
907 rec->type.els.ls_code = ls_code; 891 rec->u.els.ls_code = ls_code;
908 debug_event(adapter->san_dbf, level, rec, sizeof(*rec)); 892 debug_event(adapter->san_dbf, level, rec, sizeof(*rec));
909 zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level, 893 zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level,
910 buffer, min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD)); 894 buffer, min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD));
@@ -967,42 +951,33 @@ zfcp_san_dbf_view_format(debug_info_t * id, struct debug_view *view,
967 zfcp_dbf_out(&p, "d_id", "0x%06x", r->d_id); 951 zfcp_dbf_out(&p, "d_id", "0x%06x", r->d_id);
968 952
969 if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { 953 if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) {
970 /* FIXME: struct zfcp_dbf_ct_req *ct = ...; */ 954 struct zfcp_san_dbf_record_ct_request *ct = &r->u.ct_req;
971 zfcp_dbf_out(&p, "cmd_req_code", "0x%04x", 955 zfcp_dbf_out(&p, "cmd_req_code", "0x%04x", ct->cmd_req_code);
972 r->type.ct.type.request.cmd_req_code); 956 zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision);
973 zfcp_dbf_out(&p, "revision", "0x%02x", 957 zfcp_dbf_out(&p, "gs_type", "0x%02x", ct->gs_type);
974 r->type.ct.type.request.revision); 958 zfcp_dbf_out(&p, "gs_subtype", "0x%02x", ct->gs_subtype);
975 zfcp_dbf_out(&p, "gs_type", "0x%02x", 959 zfcp_dbf_out(&p, "options", "0x%02x", ct->options);
976 r->type.ct.type.request.gs_type); 960 zfcp_dbf_out(&p, "max_res_size", "0x%04x", ct->max_res_size);
977 zfcp_dbf_out(&p, "gs_subtype", "0x%02x", 961 total = ct->len;
978 r->type.ct.type.request.gs_subtype); 962 buffer = ct->payload;
979 zfcp_dbf_out(&p, "options", "0x%02x",
980 r->type.ct.type.request.options);
981 zfcp_dbf_out(&p, "max_res_size", "0x%04x",
982 r->type.ct.type.request.max_res_size);
983 total = r->type.ct.payload_size;
984 buffer = r->type.ct.payload;
985 buflen = min(total, ZFCP_DBF_CT_PAYLOAD); 963 buflen = min(total, ZFCP_DBF_CT_PAYLOAD);
986 } else if (strncmp(r->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { 964 } else if (strncmp(r->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) {
987 zfcp_dbf_out(&p, "cmd_rsp_code", "0x%04x", 965 struct zfcp_san_dbf_record_ct_response *ct = &r->u.ct_resp;
988 r->type.ct.type.response.cmd_rsp_code); 966 zfcp_dbf_out(&p, "cmd_rsp_code", "0x%04x", ct->cmd_rsp_code);
989 zfcp_dbf_out(&p, "revision", "0x%02x", 967 zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision);
990 r->type.ct.type.response.revision); 968 zfcp_dbf_out(&p, "reason_code", "0x%02x", ct->reason_code);
991 zfcp_dbf_out(&p, "reason_code", "0x%02x", 969 zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", ct->expl);
992 r->type.ct.type.response.reason_code); 970 zfcp_dbf_out(&p, "vendor_unique", "0x%02x", ct->vendor_unique);
993 zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", 971 total = ct->len;
994 r->type.ct.type.response.reason_code_expl); 972 buffer = ct->payload;
995 zfcp_dbf_out(&p, "vendor_unique", "0x%02x",
996 r->type.ct.type.response.vendor_unique);
997 total = r->type.ct.payload_size;
998 buffer = r->type.ct.payload;
999 buflen = min(total, ZFCP_DBF_CT_PAYLOAD); 973 buflen = min(total, ZFCP_DBF_CT_PAYLOAD);
1000 } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || 974 } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 ||
1001 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || 975 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 ||
1002 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { 976 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) {
1003 zfcp_dbf_out(&p, "ls_code", "0x%02x", r->type.els.ls_code); 977 struct zfcp_san_dbf_record_els *els = &r->u.els;
1004 total = r->type.els.payload_size; 978 zfcp_dbf_out(&p, "ls_code", "0x%02x", els->ls_code);
1005 buffer = r->type.els.payload; 979 total = els->len;
980 buffer = els->payload;
1006 buflen = min(total, ZFCP_DBF_ELS_PAYLOAD); 981 buflen = min(total, ZFCP_DBF_ELS_PAYLOAD);
1007 } 982 }
1008 983
@@ -1038,7 +1013,7 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
1038 1013
1039 spin_lock_irqsave(&adapter->scsi_dbf_lock, flags); 1014 spin_lock_irqsave(&adapter->scsi_dbf_lock, flags);
1040 do { 1015 do {
1041 memset(rec, 0, sizeof(struct zfcp_scsi_dbf_record)); 1016 memset(rec, 0, sizeof(*rec));
1042 if (offset == 0) { 1017 if (offset == 0) {
1043 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); 1018 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
1044 strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE); 1019 strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE);
@@ -1064,20 +1039,16 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
1064 fcp_sns_info = 1039 fcp_sns_info =
1065 zfcp_get_fcp_sns_info_ptr(fcp_rsp); 1040 zfcp_get_fcp_sns_info_ptr(fcp_rsp);
1066 1041
1067 rec->type.fcp.rsp_validity = 1042 rec->rsp_validity = fcp_rsp->validity.value;
1068 fcp_rsp->validity.value; 1043 rec->rsp_scsi_status = fcp_rsp->scsi_status;
1069 rec->type.fcp.rsp_scsi_status = 1044 rec->rsp_resid = fcp_rsp->fcp_resid;
1070 fcp_rsp->scsi_status;
1071 rec->type.fcp.rsp_resid = fcp_rsp->fcp_resid;
1072 if (fcp_rsp->validity.bits.fcp_rsp_len_valid) 1045 if (fcp_rsp->validity.bits.fcp_rsp_len_valid)
1073 rec->type.fcp.rsp_code = 1046 rec->rsp_code = *(fcp_rsp_info + 3);
1074 *(fcp_rsp_info + 3);
1075 if (fcp_rsp->validity.bits.fcp_sns_len_valid) { 1047 if (fcp_rsp->validity.bits.fcp_sns_len_valid) {
1076 buflen = min((int)fcp_rsp->fcp_sns_len, 1048 buflen = min((int)fcp_rsp->fcp_sns_len,
1077 ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO); 1049 ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO);
1078 rec->type.fcp.sns_info_len = buflen; 1050 rec->sns_info_len = buflen;
1079 memcpy(rec->type.fcp.sns_info, 1051 memcpy(rec->sns_info, fcp_sns_info,
1080 fcp_sns_info,
1081 min(buflen, 1052 min(buflen,
1082 ZFCP_DBF_SCSI_FCP_SNS_INFO)); 1053 ZFCP_DBF_SCSI_FCP_SNS_INFO));
1083 offset += min(buflen, 1054 offset += min(buflen,
@@ -1088,7 +1059,7 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
1088 rec->fsf_seqno = fsf_req->seq_no; 1059 rec->fsf_seqno = fsf_req->seq_no;
1089 rec->fsf_issued = fsf_req->issued; 1060 rec->fsf_issued = fsf_req->issued;
1090 } 1061 }
1091 rec->type.old_fsf_reqid = old_req_id; 1062 rec->old_fsf_reqid = old_req_id;
1092 } else { 1063 } else {
1093 strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); 1064 strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE);
1094 dump->total_size = buflen; 1065 dump->total_size = buflen;
@@ -1100,8 +1071,7 @@ _zfcp_scsi_dbf_event_common(const char *tag, const char *tag2, int level,
1100 memcpy(dump->data, fcp_sns_info + offset, dump->size); 1071 memcpy(dump->data, fcp_sns_info + offset, dump->size);
1101 offset += dump->size; 1072 offset += dump->size;
1102 } 1073 }
1103 debug_event(adapter->scsi_dbf, level, 1074 debug_event(adapter->scsi_dbf, level, rec, sizeof(*rec));
1104 rec, sizeof(struct zfcp_scsi_dbf_record));
1105 } while (offset < buflen); 1075 } while (offset < buflen);
1106 spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags); 1076 spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags);
1107} 1077}
@@ -1159,28 +1129,23 @@ zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view,
1159 zfcp_dbf_out(&p, "scsi_retries", "0x%02x", r->scsi_retries); 1129 zfcp_dbf_out(&p, "scsi_retries", "0x%02x", r->scsi_retries);
1160 zfcp_dbf_out(&p, "scsi_allowed", "0x%02x", r->scsi_allowed); 1130 zfcp_dbf_out(&p, "scsi_allowed", "0x%02x", r->scsi_allowed);
1161 if (strncmp(r->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) 1131 if (strncmp(r->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0)
1162 zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", 1132 zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", r->old_fsf_reqid);
1163 r->type.old_fsf_reqid);
1164 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); 1133 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
1165 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); 1134 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno);
1166 zfcp_dbf_timestamp(r->fsf_issued, &t); 1135 zfcp_dbf_timestamp(r->fsf_issued, &t);
1167 zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); 1136 zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec);
1168 1137
1169 if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { 1138 if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) {
1170 zfcp_dbf_out(&p, "fcp_rsp_validity", "0x%02x", 1139 zfcp_dbf_out(&p, "fcp_rsp_validity", "0x%02x", r->rsp_validity);
1171 r->type.fcp.rsp_validity); 1140 zfcp_dbf_out(&p, "fcp_rsp_scsi_status", "0x%02x",
1172 zfcp_dbf_out(&p, "fcp_rsp_scsi_status", 1141 r->rsp_scsi_status);
1173 "0x%02x", r->type.fcp.rsp_scsi_status); 1142 zfcp_dbf_out(&p, "fcp_rsp_resid", "0x%08x", r->rsp_resid);
1174 zfcp_dbf_out(&p, "fcp_rsp_resid", "0x%08x", 1143 zfcp_dbf_out(&p, "fcp_rsp_code", "0x%08x", r->rsp_code);
1175 r->type.fcp.rsp_resid); 1144 zfcp_dbf_out(&p, "fcp_sns_info_len", "0x%08x", r->sns_info_len);
1176 zfcp_dbf_out(&p, "fcp_rsp_code", "0x%08x", 1145 zfcp_dbf_outd(&p, "fcp_sns_info", r->sns_info,
1177 r->type.fcp.rsp_code); 1146 min((int)r->sns_info_len,
1178 zfcp_dbf_out(&p, "fcp_sns_info_len", "0x%08x",
1179 r->type.fcp.sns_info_len);
1180 zfcp_dbf_outd(&p, "fcp_sns_info", r->type.fcp.sns_info,
1181 min((int)r->type.fcp.sns_info_len,
1182 ZFCP_DBF_SCSI_FCP_SNS_INFO), 0, 1147 ZFCP_DBF_SCSI_FCP_SNS_INFO), 0,
1183 r->type.fcp.sns_info_len); 1148 r->sns_info_len);
1184 } 1149 }
1185 p += sprintf(p, "\n"); 1150 p += sprintf(p, "\n");
1186 return p - out_buf; 1151 return p - out_buf;
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index 5d88c01d5981..732a5ba1bea9 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -104,9 +104,9 @@ struct zfcp_hba_dbf_record_response {
104 u64 erp_action; 104 u64 erp_action;
105 union { 105 union {
106 struct { 106 struct {
107 u64 scsi_cmnd; 107 u64 cmnd;
108 u64 scsi_serial; 108 u64 serial;
109 } send_fcp; 109 } fcp;
110 struct { 110 struct {
111 u64 wwpn; 111 u64 wwpn;
112 u32 d_id; 112 u32 d_id;
@@ -121,8 +121,8 @@ struct zfcp_hba_dbf_record_response {
121 struct { 121 struct {
122 u32 d_id; 122 u32 d_id;
123 u8 ls_code; 123 u8 ls_code;
124 } send_els; 124 } els;
125 } data; 125 } u;
126} __attribute__ ((packed)); 126} __attribute__ ((packed));
127 127
128struct zfcp_hba_dbf_record_status { 128struct zfcp_hba_dbf_record_status {
@@ -154,35 +154,34 @@ struct zfcp_hba_dbf_record {
154 struct zfcp_hba_dbf_record_response response; 154 struct zfcp_hba_dbf_record_response response;
155 struct zfcp_hba_dbf_record_status status; 155 struct zfcp_hba_dbf_record_status status;
156 struct zfcp_hba_dbf_record_qdio qdio; 156 struct zfcp_hba_dbf_record_qdio qdio;
157 } type; 157 } u;
158} __attribute__ ((packed)); 158} __attribute__ ((packed));
159 159
160struct zfcp_san_dbf_record_ct { 160struct zfcp_san_dbf_record_ct_request {
161 union { 161 u16 cmd_req_code;
162 struct { 162 u8 revision;
163 u16 cmd_req_code; 163 u8 gs_type;
164 u8 revision; 164 u8 gs_subtype;
165 u8 gs_type; 165 u8 options;
166 u8 gs_subtype; 166 u16 max_res_size;
167 u8 options; 167 u32 len;
168 u16 max_res_size;
169 } request;
170 struct {
171 u16 cmd_rsp_code;
172 u8 revision;
173 u8 reason_code;
174 u8 reason_code_expl;
175 u8 vendor_unique;
176 } response;
177 } type;
178 u32 payload_size;
179#define ZFCP_DBF_CT_PAYLOAD 24 168#define ZFCP_DBF_CT_PAYLOAD 24
180 u8 payload[ZFCP_DBF_CT_PAYLOAD]; 169 u8 payload[ZFCP_DBF_CT_PAYLOAD];
181} __attribute__ ((packed)); 170} __attribute__ ((packed));
182 171
172struct zfcp_san_dbf_record_ct_response {
173 u16 cmd_rsp_code;
174 u8 revision;
175 u8 reason_code;
176 u8 expl;
177 u8 vendor_unique;
178 u32 len;
179 u8 payload[ZFCP_DBF_CT_PAYLOAD];
180} __attribute__ ((packed));
181
183struct zfcp_san_dbf_record_els { 182struct zfcp_san_dbf_record_els {
184 u8 ls_code; 183 u8 ls_code;
185 u32 payload_size; 184 u32 len;
186#define ZFCP_DBF_ELS_PAYLOAD 32 185#define ZFCP_DBF_ELS_PAYLOAD 32
187#define ZFCP_DBF_ELS_MAX_PAYLOAD 1024 186#define ZFCP_DBF_ELS_MAX_PAYLOAD 1024
188 u8 payload[ZFCP_DBF_ELS_PAYLOAD]; 187 u8 payload[ZFCP_DBF_ELS_PAYLOAD];
@@ -195,9 +194,10 @@ struct zfcp_san_dbf_record {
195 u32 s_id; 194 u32 s_id;
196 u32 d_id; 195 u32 d_id;
197 union { 196 union {
198 struct zfcp_san_dbf_record_ct ct; 197 struct zfcp_san_dbf_record_ct_request ct_req;
198 struct zfcp_san_dbf_record_ct_response ct_resp;
199 struct zfcp_san_dbf_record_els els; 199 struct zfcp_san_dbf_record_els els;
200 } type; 200 } u;
201} __attribute__ ((packed)); 201} __attribute__ ((packed));
202 202
203struct zfcp_scsi_dbf_record { 203struct zfcp_scsi_dbf_record {
@@ -215,19 +215,15 @@ struct zfcp_scsi_dbf_record {
215 u64 fsf_reqid; 215 u64 fsf_reqid;
216 u32 fsf_seqno; 216 u32 fsf_seqno;
217 u64 fsf_issued; 217 u64 fsf_issued;
218 union { 218 u64 old_fsf_reqid;
219 u64 old_fsf_reqid; 219 u8 rsp_validity;
220 struct { 220 u8 rsp_scsi_status;
221 u8 rsp_validity; 221 u32 rsp_resid;
222 u8 rsp_scsi_status; 222 u8 rsp_code;
223 u32 rsp_resid;
224 u8 rsp_code;
225#define ZFCP_DBF_SCSI_FCP_SNS_INFO 16 223#define ZFCP_DBF_SCSI_FCP_SNS_INFO 16
226#define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256 224#define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256
227 u32 sns_info_len; 225 u32 sns_info_len;
228 u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; 226 u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO];
229 } fcp;
230 } type;
231} __attribute__ ((packed)); 227} __attribute__ ((packed));
232 228
233#endif /* ZFCP_DBF_H */ 229#endif /* ZFCP_DBF_H */