diff options
author | Martin Peschke <mp3@de.ibm.com> | 2008-03-31 05:15:24 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-07 13:19:09 -0400 |
commit | b634fff743be5e6010c5cbe36ea1e68ff56a6aee (patch) | |
tree | d7518c8237b1604445eea14579dac456f9c4440d /drivers/s390/scsi | |
parent | 8fc5af168753239d7bf77ccca831196bcdffbfbe (diff) |
[SCSI] zfcp: Cleanup debug trace view functions.
Improve readability of code by using more convenient output function.
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/s390/scsi')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 382 |
1 files changed, 162 insertions, 220 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index edd93533db40..15b534206b34 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -139,25 +139,21 @@ zfcp_dbf_view_header(debug_info_t * id, struct debug_view *view, int area, | |||
139 | debug_entry_t * entry, char *out_buf) | 139 | debug_entry_t * entry, char *out_buf) |
140 | { | 140 | { |
141 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); | 141 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); |
142 | int len = 0; | ||
143 | struct timespec t; | 142 | struct timespec t; |
143 | char *p = out_buf; | ||
144 | 144 | ||
145 | if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { | 145 | if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { |
146 | zfcp_dbf_timestamp(entry->id.stck, &t); | 146 | zfcp_dbf_timestamp(entry->id.stck, &t); |
147 | len += zfcp_dbf_view(out_buf + len, "timestamp", "%011lu:%06lu", | 147 | zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu", |
148 | t.tv_sec, t.tv_nsec); | 148 | t.tv_sec, t.tv_nsec); |
149 | len += zfcp_dbf_view(out_buf + len, "cpu", "%02i", | 149 | zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid); |
150 | entry->id.fields.cpuid); | 150 | } else { |
151 | } else { | 151 | p += zfcp_dbf_view_dump(p, NULL, dump->data, dump->size, |
152 | len += zfcp_dbf_view_dump(out_buf + len, NULL, | 152 | dump->offset, dump->total_size); |
153 | dump->data, | ||
154 | dump->size, | ||
155 | dump->offset, dump->total_size); | ||
156 | if ((dump->offset + dump->size) == dump->total_size) | 153 | if ((dump->offset + dump->size) == dump->total_size) |
157 | len += sprintf(out_buf + len, "\n"); | 154 | p += sprintf(p, "\n"); |
158 | } | 155 | } |
159 | 156 | return p - out_buf; | |
160 | return len; | ||
161 | } | 157 | } |
162 | 158 | ||
163 | void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | 159 | void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) |
@@ -354,82 +350,65 @@ zfcp_hba_dbf_event_qdio(struct zfcp_adapter *adapter, unsigned int status, | |||
354 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | 350 | spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); |
355 | } | 351 | } |
356 | 352 | ||
357 | static int | 353 | static int zfcp_hba_dbf_view_response(char *buf, |
358 | zfcp_hba_dbf_view_response(char *out_buf, | 354 | struct zfcp_hba_dbf_record_response *r) |
359 | struct zfcp_hba_dbf_record_response *rec) | ||
360 | { | 355 | { |
361 | int len = 0; | ||
362 | struct timespec t; | 356 | struct timespec t; |
357 | char *p = buf; | ||
363 | 358 | ||
364 | len += zfcp_dbf_view(out_buf + len, "fsf_command", "0x%08x", | 359 | zfcp_dbf_out(&p, "fsf_command", "0x%08x", r->fsf_command); |
365 | rec->fsf_command); | 360 | zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
366 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 361 | zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
367 | rec->fsf_reqid); | 362 | zfcp_dbf_timestamp(r->fsf_issued, &t); |
368 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 363 | zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); |
369 | rec->fsf_seqno); | 364 | zfcp_dbf_out(&p, "fsf_prot_status", "0x%08x", r->fsf_prot_status); |
370 | zfcp_dbf_timestamp(rec->fsf_issued, &t); | 365 | zfcp_dbf_out(&p, "fsf_status", "0x%08x", r->fsf_status); |
371 | len += zfcp_dbf_view(out_buf + len, "fsf_issued", "%011lu:%06lu", | 366 | p += zfcp_dbf_view_dump(p, "fsf_prot_status_qual", |
372 | t.tv_sec, t.tv_nsec); | 367 | r->fsf_prot_status_qual, |
373 | len += zfcp_dbf_view(out_buf + len, "fsf_prot_status", "0x%08x", | 368 | FSF_PROT_STATUS_QUAL_SIZE, |
374 | rec->fsf_prot_status); | 369 | 0, FSF_PROT_STATUS_QUAL_SIZE); |
375 | len += zfcp_dbf_view(out_buf + len, "fsf_status", "0x%08x", | 370 | p += zfcp_dbf_view_dump(p, "fsf_status_qual", |
376 | rec->fsf_status); | 371 | r->fsf_status_qual, |
377 | len += zfcp_dbf_view_dump(out_buf + len, "fsf_prot_status_qual", | 372 | FSF_STATUS_QUALIFIER_SIZE, |
378 | rec->fsf_prot_status_qual, | 373 | 0, FSF_STATUS_QUALIFIER_SIZE); |
379 | FSF_PROT_STATUS_QUAL_SIZE, | 374 | zfcp_dbf_out(&p, "fsf_req_status", "0x%08x", r->fsf_req_status); |
380 | 0, FSF_PROT_STATUS_QUAL_SIZE); | 375 | zfcp_dbf_out(&p, "sbal_first", "0x%02x", r->sbal_first); |
381 | len += zfcp_dbf_view_dump(out_buf + len, "fsf_status_qual", | 376 | zfcp_dbf_out(&p, "sbal_curr", "0x%02x", r->sbal_curr); |
382 | rec->fsf_status_qual, | 377 | zfcp_dbf_out(&p, "sbal_last", "0x%02x", r->sbal_last); |
383 | FSF_STATUS_QUALIFIER_SIZE, | 378 | zfcp_dbf_out(&p, "pool", "0x%02x", r->pool); |
384 | 0, FSF_STATUS_QUALIFIER_SIZE); | 379 | |
385 | len += zfcp_dbf_view(out_buf + len, "fsf_req_status", "0x%08x", | 380 | switch (r->fsf_command) { |
386 | rec->fsf_req_status); | ||
387 | len += zfcp_dbf_view(out_buf + len, "sbal_first", "0x%02x", | ||
388 | rec->sbal_first); | ||
389 | len += zfcp_dbf_view(out_buf + len, "sbal_curr", "0x%02x", | ||
390 | rec->sbal_curr); | ||
391 | len += zfcp_dbf_view(out_buf + len, "sbal_last", "0x%02x", | ||
392 | rec->sbal_last); | ||
393 | len += zfcp_dbf_view(out_buf + len, "pool", "0x%02x", rec->pool); | ||
394 | |||
395 | switch (rec->fsf_command) { | ||
396 | case FSF_QTCB_FCP_CMND: | 381 | case FSF_QTCB_FCP_CMND: |
397 | if (rec->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) | 382 | if (r->fsf_req_status & ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT) |
398 | break; | 383 | break; |
399 | len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx", | 384 | zfcp_dbf_out(&p, "scsi_cmnd", "0x%0Lx", |
400 | rec->data.send_fcp.scsi_cmnd); | 385 | r->data.send_fcp.scsi_cmnd); |
401 | len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx", | 386 | zfcp_dbf_out(&p, "scsi_serial", "0x%016Lx", |
402 | rec->data.send_fcp.scsi_serial); | 387 | r->data.send_fcp.scsi_serial); |
403 | break; | 388 | break; |
404 | 389 | ||
405 | case FSF_QTCB_OPEN_PORT_WITH_DID: | 390 | case FSF_QTCB_OPEN_PORT_WITH_DID: |
406 | case FSF_QTCB_CLOSE_PORT: | 391 | case FSF_QTCB_CLOSE_PORT: |
407 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: | 392 | case FSF_QTCB_CLOSE_PHYSICAL_PORT: |
408 | len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx", | 393 | zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->data.port.wwpn); |
409 | rec->data.port.wwpn); | 394 | zfcp_dbf_out(&p, "d_id", "0x%06x", r->data.port.d_id); |
410 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", | 395 | zfcp_dbf_out(&p, "port_handle", "0x%08x", |
411 | rec->data.port.d_id); | 396 | r->data.port.port_handle); |
412 | len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x", | ||
413 | rec->data.port.port_handle); | ||
414 | break; | 397 | break; |
415 | 398 | ||
416 | case FSF_QTCB_OPEN_LUN: | 399 | case FSF_QTCB_OPEN_LUN: |
417 | case FSF_QTCB_CLOSE_LUN: | 400 | case FSF_QTCB_CLOSE_LUN: |
418 | len += zfcp_dbf_view(out_buf + len, "wwpn", "0x%016Lx", | 401 | zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->data.unit.wwpn); |
419 | rec->data.unit.wwpn); | 402 | zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->data.unit.fcp_lun); |
420 | len += zfcp_dbf_view(out_buf + len, "fcp_lun", "0x%016Lx", | 403 | zfcp_dbf_out(&p, "port_handle", "0x%08x", |
421 | rec->data.unit.fcp_lun); | 404 | r->data.unit.port_handle); |
422 | len += zfcp_dbf_view(out_buf + len, "port_handle", "0x%08x", | 405 | zfcp_dbf_out(&p, "lun_handle", "0x%08x", |
423 | rec->data.unit.port_handle); | 406 | r->data.unit.lun_handle); |
424 | len += zfcp_dbf_view(out_buf + len, "lun_handle", "0x%08x", | ||
425 | rec->data.unit.lun_handle); | ||
426 | break; | 407 | break; |
427 | 408 | ||
428 | case FSF_QTCB_SEND_ELS: | 409 | case FSF_QTCB_SEND_ELS: |
429 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", | 410 | zfcp_dbf_out(&p, "d_id", "0x%06x", r->data.send_els.d_id); |
430 | rec->data.send_els.d_id); | 411 | zfcp_dbf_out(&p, "ls_code", "0x%02x", r->data.send_els.ls_code); |
431 | len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x", | ||
432 | rec->data.send_els.ls_code); | ||
433 | break; | 412 | break; |
434 | 413 | ||
435 | case FSF_QTCB_ABORT_FCP_CMND: | 414 | case FSF_QTCB_ABORT_FCP_CMND: |
@@ -440,47 +419,36 @@ zfcp_hba_dbf_view_response(char *out_buf, | |||
440 | case FSF_QTCB_UPLOAD_CONTROL_FILE: | 419 | case FSF_QTCB_UPLOAD_CONTROL_FILE: |
441 | break; | 420 | break; |
442 | } | 421 | } |
443 | 422 | return p - buf; | |
444 | return len; | ||
445 | } | 423 | } |
446 | 424 | ||
447 | static int | 425 | static int zfcp_hba_dbf_view_status(char *buf, |
448 | zfcp_hba_dbf_view_status(char *out_buf, struct zfcp_hba_dbf_record_status *rec) | 426 | struct zfcp_hba_dbf_record_status *r) |
449 | { | 427 | { |
450 | int len = 0; | 428 | char *p = buf; |
451 | |||
452 | len += zfcp_dbf_view(out_buf + len, "failed", "0x%02x", rec->failed); | ||
453 | len += zfcp_dbf_view(out_buf + len, "status_type", "0x%08x", | ||
454 | rec->status_type); | ||
455 | len += zfcp_dbf_view(out_buf + len, "status_subtype", "0x%08x", | ||
456 | rec->status_subtype); | ||
457 | len += zfcp_dbf_view_dump(out_buf + len, "queue_designator", | ||
458 | (char *)&rec->queue_designator, | ||
459 | sizeof(struct fsf_queue_designator), | ||
460 | 0, sizeof(struct fsf_queue_designator)); | ||
461 | len += zfcp_dbf_view_dump(out_buf + len, "payload", | ||
462 | (char *)&rec->payload, | ||
463 | rec->payload_size, 0, rec->payload_size); | ||
464 | 429 | ||
465 | return len; | 430 | zfcp_dbf_out(&p, "failed", "0x%02x", r->failed); |
431 | zfcp_dbf_out(&p, "status_type", "0x%08x", r->status_type); | ||
432 | zfcp_dbf_out(&p, "status_subtype", "0x%08x", r->status_subtype); | ||
433 | p += zfcp_dbf_view_dump(p, "queue_designator", | ||
434 | (char *)&r->queue_designator, | ||
435 | sizeof(struct fsf_queue_designator), | ||
436 | 0, sizeof(struct fsf_queue_designator)); | ||
437 | p += zfcp_dbf_view_dump(p, "payload", (char *)&r->payload, | ||
438 | r->payload_size, 0, r->payload_size); | ||
439 | return p - buf; | ||
466 | } | 440 | } |
467 | 441 | ||
468 | static int | 442 | static int zfcp_hba_dbf_view_qdio(char *buf, struct zfcp_hba_dbf_record_qdio *r) |
469 | zfcp_hba_dbf_view_qdio(char *out_buf, struct zfcp_hba_dbf_record_qdio *rec) | ||
470 | { | 443 | { |
471 | int len = 0; | 444 | char *p = buf; |
472 | |||
473 | len += zfcp_dbf_view(out_buf + len, "status", "0x%08x", rec->status); | ||
474 | len += zfcp_dbf_view(out_buf + len, "qdio_error", "0x%08x", | ||
475 | rec->qdio_error); | ||
476 | len += zfcp_dbf_view(out_buf + len, "siga_error", "0x%08x", | ||
477 | rec->siga_error); | ||
478 | len += zfcp_dbf_view(out_buf + len, "sbal_index", "0x%02x", | ||
479 | rec->sbal_index); | ||
480 | len += zfcp_dbf_view(out_buf + len, "sbal_count", "0x%02x", | ||
481 | rec->sbal_count); | ||
482 | 445 | ||
483 | return len; | 446 | zfcp_dbf_out(&p, "status", "0x%08x", r->status); |
447 | zfcp_dbf_out(&p, "qdio_error", "0x%08x", r->qdio_error); | ||
448 | zfcp_dbf_out(&p, "siga_error", "0x%08x", r->siga_error); | ||
449 | zfcp_dbf_out(&p, "sbal_index", "0x%02x", r->sbal_index); | ||
450 | zfcp_dbf_out(&p, "sbal_count", "0x%02x", r->sbal_count); | ||
451 | return p - buf; | ||
484 | } | 452 | } |
485 | 453 | ||
486 | static int | 454 | static int |
@@ -720,8 +688,8 @@ static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, | |||
720 | zfcp_dbf_out(&p, "step", "0x%08Lx", r->u.action.step); | 688 | zfcp_dbf_out(&p, "step", "0x%08Lx", r->u.action.step); |
721 | break; | 689 | break; |
722 | } | 690 | } |
723 | sprintf(p, "\n"); | 691 | p += sprintf(p, "\n"); |
724 | return (p - buf) + 1; | 692 | return p - buf; |
725 | } | 693 | } |
726 | 694 | ||
727 | static struct debug_view zfcp_rec_dbf_view = { | 695 | static struct debug_view zfcp_rec_dbf_view = { |
@@ -1024,71 +992,65 @@ static int | |||
1024 | zfcp_san_dbf_view_format(debug_info_t * id, struct debug_view *view, | 992 | zfcp_san_dbf_view_format(debug_info_t * id, struct debug_view *view, |
1025 | char *out_buf, const char *in_buf) | 993 | char *out_buf, const char *in_buf) |
1026 | { | 994 | { |
1027 | struct zfcp_san_dbf_record *rec = (struct zfcp_san_dbf_record *)in_buf; | 995 | struct zfcp_san_dbf_record *r = (struct zfcp_san_dbf_record *)in_buf; |
1028 | char *buffer = NULL; | 996 | char *buffer = NULL; |
1029 | int buflen = 0, total = 0; | 997 | int buflen = 0, total = 0; |
1030 | int len = 0; | 998 | char *p = out_buf; |
1031 | 999 | ||
1032 | if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 1000 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
1033 | return 0; | 1001 | return 0; |
1034 | 1002 | ||
1035 | len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); | 1003 | p += zfcp_dbf_tag(p, "tag", r->tag); |
1036 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 1004 | zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
1037 | rec->fsf_reqid); | 1005 | zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
1038 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 1006 | zfcp_dbf_out(&p, "s_id", "0x%06x", r->s_id); |
1039 | rec->fsf_seqno); | 1007 | zfcp_dbf_out(&p, "d_id", "0x%06x", r->d_id); |
1040 | len += zfcp_dbf_view(out_buf + len, "s_id", "0x%06x", rec->s_id); | 1008 | |
1041 | len += zfcp_dbf_view(out_buf + len, "d_id", "0x%06x", rec->d_id); | 1009 | if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { |
1042 | 1010 | /* FIXME: struct zfcp_dbf_ct_req *ct = ...; */ | |
1043 | if (strncmp(rec->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { | 1011 | zfcp_dbf_out(&p, "cmd_req_code", "0x%04x", |
1044 | len += zfcp_dbf_view(out_buf + len, "cmd_req_code", "0x%04x", | 1012 | r->type.ct.type.request.cmd_req_code); |
1045 | rec->type.ct.type.request.cmd_req_code); | 1013 | zfcp_dbf_out(&p, "revision", "0x%02x", |
1046 | len += zfcp_dbf_view(out_buf + len, "revision", "0x%02x", | 1014 | r->type.ct.type.request.revision); |
1047 | rec->type.ct.type.request.revision); | 1015 | zfcp_dbf_out(&p, "gs_type", "0x%02x", |
1048 | len += zfcp_dbf_view(out_buf + len, "gs_type", "0x%02x", | 1016 | r->type.ct.type.request.gs_type); |
1049 | rec->type.ct.type.request.gs_type); | 1017 | zfcp_dbf_out(&p, "gs_subtype", "0x%02x", |
1050 | len += zfcp_dbf_view(out_buf + len, "gs_subtype", "0x%02x", | 1018 | r->type.ct.type.request.gs_subtype); |
1051 | rec->type.ct.type.request.gs_subtype); | 1019 | zfcp_dbf_out(&p, "options", "0x%02x", |
1052 | len += zfcp_dbf_view(out_buf + len, "options", "0x%02x", | 1020 | r->type.ct.type.request.options); |
1053 | rec->type.ct.type.request.options); | 1021 | zfcp_dbf_out(&p, "max_res_size", "0x%04x", |
1054 | len += zfcp_dbf_view(out_buf + len, "max_res_size", "0x%04x", | 1022 | r->type.ct.type.request.max_res_size); |
1055 | rec->type.ct.type.request.max_res_size); | 1023 | total = r->type.ct.payload_size; |
1056 | total = rec->type.ct.payload_size; | 1024 | buffer = r->type.ct.payload; |
1057 | buffer = rec->type.ct.payload; | ||
1058 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); | 1025 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); |
1059 | } else if (strncmp(rec->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { | 1026 | } else if (strncmp(r->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { |
1060 | len += zfcp_dbf_view(out_buf + len, "cmd_rsp_code", "0x%04x", | 1027 | zfcp_dbf_out(&p, "cmd_rsp_code", "0x%04x", |
1061 | rec->type.ct.type.response.cmd_rsp_code); | 1028 | r->type.ct.type.response.cmd_rsp_code); |
1062 | len += zfcp_dbf_view(out_buf + len, "revision", "0x%02x", | 1029 | zfcp_dbf_out(&p, "revision", "0x%02x", |
1063 | rec->type.ct.type.response.revision); | 1030 | r->type.ct.type.response.revision); |
1064 | len += zfcp_dbf_view(out_buf + len, "reason_code", "0x%02x", | 1031 | zfcp_dbf_out(&p, "reason_code", "0x%02x", |
1065 | rec->type.ct.type.response.reason_code); | 1032 | r->type.ct.type.response.reason_code); |
1066 | len += | 1033 | zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", |
1067 | zfcp_dbf_view(out_buf + len, "reason_code_expl", "0x%02x", | 1034 | r->type.ct.type.response.reason_code_expl); |
1068 | rec->type.ct.type.response.reason_code_expl); | 1035 | zfcp_dbf_out(&p, "vendor_unique", "0x%02x", |
1069 | len += | 1036 | r->type.ct.type.response.vendor_unique); |
1070 | zfcp_dbf_view(out_buf + len, "vendor_unique", "0x%02x", | 1037 | total = r->type.ct.payload_size; |
1071 | rec->type.ct.type.response.vendor_unique); | 1038 | buffer = r->type.ct.payload; |
1072 | total = rec->type.ct.payload_size; | ||
1073 | buffer = rec->type.ct.payload; | ||
1074 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); | 1039 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); |
1075 | } else if (strncmp(rec->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || | 1040 | } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || |
1076 | strncmp(rec->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || | 1041 | strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || |
1077 | strncmp(rec->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { | 1042 | strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { |
1078 | len += zfcp_dbf_view(out_buf + len, "ls_code", "0x%02x", | 1043 | zfcp_dbf_out(&p, "ls_code", "0x%02x", r->type.els.ls_code); |
1079 | rec->type.els.ls_code); | 1044 | total = r->type.els.payload_size; |
1080 | total = rec->type.els.payload_size; | 1045 | buffer = r->type.els.payload; |
1081 | buffer = rec->type.els.payload; | ||
1082 | buflen = min(total, ZFCP_DBF_ELS_PAYLOAD); | 1046 | buflen = min(total, ZFCP_DBF_ELS_PAYLOAD); |
1083 | } | 1047 | } |
1084 | 1048 | ||
1085 | len += zfcp_dbf_view_dump(out_buf + len, "payload", | 1049 | p += zfcp_dbf_view_dump(p, "payload", buffer, buflen, 0, total); |
1086 | buffer, buflen, 0, total); | ||
1087 | |||
1088 | if (buflen == total) | 1050 | if (buflen == total) |
1089 | len += sprintf(out_buf + len, "\n"); | 1051 | p += sprintf(p, "\n"); |
1090 | 1052 | ||
1091 | return len; | 1053 | return p - out_buf; |
1092 | } | 1054 | } |
1093 | 1055 | ||
1094 | static struct debug_view zfcp_san_dbf_view = { | 1056 | static struct debug_view zfcp_san_dbf_view = { |
@@ -1218,71 +1180,51 @@ static int | |||
1218 | zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view, | 1180 | zfcp_scsi_dbf_view_format(debug_info_t * id, struct debug_view *view, |
1219 | char *out_buf, const char *in_buf) | 1181 | char *out_buf, const char *in_buf) |
1220 | { | 1182 | { |
1221 | struct zfcp_scsi_dbf_record *rec = | 1183 | struct zfcp_scsi_dbf_record *r = (struct zfcp_scsi_dbf_record *)in_buf; |
1222 | (struct zfcp_scsi_dbf_record *)in_buf; | ||
1223 | int len = 0; | ||
1224 | struct timespec t; | 1184 | struct timespec t; |
1185 | char *p = out_buf; | ||
1225 | 1186 | ||
1226 | if (strncmp(rec->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 1187 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
1227 | return 0; | 1188 | return 0; |
1228 | 1189 | ||
1229 | len += zfcp_dbf_tag(out_buf + len, "tag", rec->tag); | 1190 | p += zfcp_dbf_tag(p, "tag", r->tag); |
1230 | len += zfcp_dbf_tag(out_buf + len, "tag2", rec->tag2); | 1191 | p += zfcp_dbf_tag(p, "tag2", r->tag2); |
1231 | len += zfcp_dbf_view(out_buf + len, "scsi_id", "0x%08x", rec->scsi_id); | 1192 | zfcp_dbf_out(&p, "scsi_id", "0x%08x", r->scsi_id); |
1232 | len += zfcp_dbf_view(out_buf + len, "scsi_lun", "0x%08x", | 1193 | zfcp_dbf_out(&p, "scsi_lun", "0x%08x", r->scsi_lun); |
1233 | rec->scsi_lun); | 1194 | zfcp_dbf_out(&p, "scsi_result", "0x%08x", r->scsi_result); |
1234 | len += zfcp_dbf_view(out_buf + len, "scsi_result", "0x%08x", | 1195 | zfcp_dbf_out(&p, "scsi_cmnd", "0x%0Lx", r->scsi_cmnd); |
1235 | rec->scsi_result); | 1196 | zfcp_dbf_out(&p, "scsi_serial", "0x%016Lx", r->scsi_serial); |
1236 | len += zfcp_dbf_view(out_buf + len, "scsi_cmnd", "0x%0Lx", | 1197 | p += zfcp_dbf_view_dump(p, "scsi_opcode", r->scsi_opcode, |
1237 | rec->scsi_cmnd); | 1198 | ZFCP_DBF_SCSI_OPCODE, 0, ZFCP_DBF_SCSI_OPCODE); |
1238 | len += zfcp_dbf_view(out_buf + len, "scsi_serial", "0x%016Lx", | 1199 | zfcp_dbf_out(&p, "scsi_retries", "0x%02x", r->scsi_retries); |
1239 | rec->scsi_serial); | 1200 | zfcp_dbf_out(&p, "scsi_allowed", "0x%02x", r->scsi_allowed); |
1240 | len += zfcp_dbf_view_dump(out_buf + len, "scsi_opcode", | 1201 | if (strncmp(r->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) |
1241 | rec->scsi_opcode, | 1202 | zfcp_dbf_out(&p, "old_fsf_reqid", "0x%0Lx", |
1242 | ZFCP_DBF_SCSI_OPCODE, | 1203 | r->type.old_fsf_reqid); |
1243 | 0, ZFCP_DBF_SCSI_OPCODE); | 1204 | zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); |
1244 | len += zfcp_dbf_view(out_buf + len, "scsi_retries", "0x%02x", | 1205 | zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); |
1245 | rec->scsi_retries); | 1206 | zfcp_dbf_timestamp(r->fsf_issued, &t); |
1246 | len += zfcp_dbf_view(out_buf + len, "scsi_allowed", "0x%02x", | 1207 | zfcp_dbf_out(&p, "fsf_issued", "%011lu:%06lu", t.tv_sec, t.tv_nsec); |
1247 | rec->scsi_allowed); | 1208 | |
1248 | if (strncmp(rec->tag, "abrt", ZFCP_DBF_TAG_SIZE) == 0) { | 1209 | if (strncmp(r->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { |
1249 | len += zfcp_dbf_view(out_buf + len, "old_fsf_reqid", "0x%0Lx", | 1210 | zfcp_dbf_out(&p, "fcp_rsp_validity", "0x%02x", |
1250 | rec->type.old_fsf_reqid); | 1211 | r->type.fcp.rsp_validity); |
1251 | } | 1212 | zfcp_dbf_out(&p, "fcp_rsp_scsi_status", |
1252 | len += zfcp_dbf_view(out_buf + len, "fsf_reqid", "0x%0Lx", | 1213 | "0x%02x", r->type.fcp.rsp_scsi_status); |
1253 | rec->fsf_reqid); | 1214 | zfcp_dbf_out(&p, "fcp_rsp_resid", "0x%08x", |
1254 | len += zfcp_dbf_view(out_buf + len, "fsf_seqno", "0x%08x", | 1215 | r->type.fcp.rsp_resid); |
1255 | rec->fsf_seqno); | 1216 | zfcp_dbf_out(&p, "fcp_rsp_code", "0x%08x", |
1256 | zfcp_dbf_timestamp(rec->fsf_issued, &t); | 1217 | r->type.fcp.rsp_code); |
1257 | len += zfcp_dbf_view(out_buf + len, "fsf_issued", "%011lu:%06lu", | 1218 | zfcp_dbf_out(&p, "fcp_sns_info_len", "0x%08x", |
1258 | t.tv_sec, t.tv_nsec); | 1219 | r->type.fcp.sns_info_len); |
1259 | if (strncmp(rec->tag, "rslt", ZFCP_DBF_TAG_SIZE) == 0) { | 1220 | p += zfcp_dbf_view_dump(p, "fcp_sns_info", |
1260 | len += | 1221 | r->type.fcp.sns_info, |
1261 | zfcp_dbf_view(out_buf + len, "fcp_rsp_validity", "0x%02x", | 1222 | min((int)r->type.fcp.sns_info_len, |
1262 | rec->type.fcp.rsp_validity); | 1223 | ZFCP_DBF_SCSI_FCP_SNS_INFO), 0, |
1263 | len += | 1224 | r->type.fcp.sns_info_len); |
1264 | zfcp_dbf_view(out_buf + len, "fcp_rsp_scsi_status", | ||
1265 | "0x%02x", rec->type.fcp.rsp_scsi_status); | ||
1266 | len += | ||
1267 | zfcp_dbf_view(out_buf + len, "fcp_rsp_resid", "0x%08x", | ||
1268 | rec->type.fcp.rsp_resid); | ||
1269 | len += | ||
1270 | zfcp_dbf_view(out_buf + len, "fcp_rsp_code", "0x%08x", | ||
1271 | rec->type.fcp.rsp_code); | ||
1272 | len += | ||
1273 | zfcp_dbf_view(out_buf + len, "fcp_sns_info_len", "0x%08x", | ||
1274 | rec->type.fcp.sns_info_len); | ||
1275 | len += | ||
1276 | zfcp_dbf_view_dump(out_buf + len, "fcp_sns_info", | ||
1277 | rec->type.fcp.sns_info, | ||
1278 | min((int)rec->type.fcp.sns_info_len, | ||
1279 | ZFCP_DBF_SCSI_FCP_SNS_INFO), 0, | ||
1280 | rec->type.fcp.sns_info_len); | ||
1281 | } | 1225 | } |
1282 | 1226 | p += sprintf(p, "\n"); | |
1283 | len += sprintf(out_buf + len, "\n"); | 1227 | return p - out_buf; |
1284 | |||
1285 | return len; | ||
1286 | } | 1228 | } |
1287 | 1229 | ||
1288 | static struct debug_view zfcp_scsi_dbf_view = { | 1230 | static struct debug_view zfcp_scsi_dbf_view = { |