diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 060f5f2352ec..31012d58cfb7 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -30,7 +30,7 @@ static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len, | |||
30 | dump->offset = offset; | 30 | dump->offset = offset; |
31 | dump->size = min(from_len - offset, room); | 31 | dump->size = min(from_len - offset, room); |
32 | memcpy(dump->data, from + offset, dump->size); | 32 | memcpy(dump->data, from + offset, dump->size); |
33 | debug_event(dbf, level, dump, dump->size); | 33 | debug_event(dbf, level, dump, dump->size + sizeof(*dump)); |
34 | } | 34 | } |
35 | } | 35 | } |
36 | 36 | ||
@@ -108,7 +108,7 @@ static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view, | |||
108 | t.tv_sec, t.tv_nsec); | 108 | t.tv_sec, t.tv_nsec); |
109 | zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid); | 109 | zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid); |
110 | } else { | 110 | } else { |
111 | zfcp_dbf_outd(&p, NULL, dump->data, dump->size, dump->offset, | 111 | zfcp_dbf_outd(&p, "", dump->data, dump->size, dump->offset, |
112 | dump->total_size); | 112 | dump->total_size); |
113 | if ((dump->offset + dump->size) == dump->total_size) | 113 | if ((dump->offset + dump->size) == dump->total_size) |
114 | p += sprintf(p, "\n"); | 114 | p += sprintf(p, "\n"); |
@@ -366,6 +366,7 @@ static void zfcp_hba_dbf_view_response(char **p, | |||
366 | break; | 366 | break; |
367 | zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", r->u.fcp.cmnd); | 367 | zfcp_dbf_out(p, "scsi_cmnd", "0x%0Lx", r->u.fcp.cmnd); |
368 | zfcp_dbf_out(p, "scsi_serial", "0x%016Lx", r->u.fcp.serial); | 368 | zfcp_dbf_out(p, "scsi_serial", "0x%016Lx", r->u.fcp.serial); |
369 | p += sprintf(*p, "\n"); | ||
369 | break; | 370 | break; |
370 | 371 | ||
371 | case FSF_QTCB_OPEN_PORT_WITH_DID: | 372 | case FSF_QTCB_OPEN_PORT_WITH_DID: |
@@ -465,7 +466,8 @@ static int zfcp_hba_dbf_view_format(debug_info_t *id, struct debug_view *view, | |||
465 | else if (strncmp(r->tag, "berr", ZFCP_DBF_TAG_SIZE) == 0) | 466 | else if (strncmp(r->tag, "berr", ZFCP_DBF_TAG_SIZE) == 0) |
466 | zfcp_hba_dbf_view_berr(&p, &r->u.berr); | 467 | zfcp_hba_dbf_view_berr(&p, &r->u.berr); |
467 | 468 | ||
468 | p += sprintf(p, "\n"); | 469 | if (strncmp(r->tag, "resp", ZFCP_DBF_TAG_SIZE) != 0) |
470 | p += sprintf(p, "\n"); | ||
469 | return p - out_buf; | 471 | return p - out_buf; |
470 | } | 472 | } |
471 | 473 | ||
@@ -880,6 +882,7 @@ void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req) | |||
880 | struct ct_hdr *hdr = sg_virt(ct->req); | 882 | struct ct_hdr *hdr = sg_virt(ct->req); |
881 | struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; | 883 | struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; |
882 | struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req; | 884 | struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req; |
885 | int level = 3; | ||
883 | unsigned long flags; | 886 | unsigned long flags; |
884 | 887 | ||
885 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); | 888 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); |
@@ -896,9 +899,10 @@ void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req) | |||
896 | oct->options = hdr->options; | 899 | oct->options = hdr->options; |
897 | oct->max_res_size = hdr->max_res_size; | 900 | oct->max_res_size = hdr->max_res_size; |
898 | oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr), | 901 | oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr), |
899 | ZFCP_DBF_CT_PAYLOAD); | 902 | ZFCP_DBF_SAN_MAX_PAYLOAD); |
900 | memcpy(oct->payload, (void *)hdr + sizeof(struct ct_hdr), oct->len); | 903 | debug_event(adapter->san_dbf, level, r, sizeof(*r)); |
901 | debug_event(adapter->san_dbf, 3, r, sizeof(*r)); | 904 | zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level, |
905 | (void *)hdr + sizeof(struct ct_hdr), oct->len); | ||
902 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | 906 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); |
903 | } | 907 | } |
904 | 908 | ||
@@ -914,6 +918,7 @@ void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req) | |||
914 | struct ct_hdr *hdr = sg_virt(ct->resp); | 918 | struct ct_hdr *hdr = sg_virt(ct->resp); |
915 | struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; | 919 | struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; |
916 | struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp; | 920 | struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp; |
921 | int level = 3; | ||
917 | unsigned long flags; | 922 | unsigned long flags; |
918 | 923 | ||
919 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); | 924 | spin_lock_irqsave(&adapter->san_dbf_lock, flags); |
@@ -929,9 +934,10 @@ void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req) | |||
929 | rct->expl = hdr->reason_code_expl; | 934 | rct->expl = hdr->reason_code_expl; |
930 | rct->vendor_unique = hdr->vendor_unique; | 935 | rct->vendor_unique = hdr->vendor_unique; |
931 | rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr), | 936 | rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr), |
932 | ZFCP_DBF_CT_PAYLOAD); | 937 | ZFCP_DBF_SAN_MAX_PAYLOAD); |
933 | memcpy(rct->payload, (void *)hdr + sizeof(struct ct_hdr), rct->len); | 938 | debug_event(adapter->san_dbf, level, r, sizeof(*r)); |
934 | debug_event(adapter->san_dbf, 3, r, sizeof(*r)); | 939 | zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level, |
940 | (void *)hdr + sizeof(struct ct_hdr), rct->len); | ||
935 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | 941 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); |
936 | } | 942 | } |
937 | 943 | ||
@@ -954,7 +960,7 @@ static void zfcp_san_dbf_event_els(const char *tag, int level, | |||
954 | rec->u.els.ls_code = ls_code; | 960 | rec->u.els.ls_code = ls_code; |
955 | debug_event(adapter->san_dbf, level, rec, sizeof(*rec)); | 961 | debug_event(adapter->san_dbf, level, rec, sizeof(*rec)); |
956 | zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level, | 962 | zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level, |
957 | buffer, min(buflen, ZFCP_DBF_ELS_MAX_PAYLOAD)); | 963 | buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD)); |
958 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | 964 | spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); |
959 | } | 965 | } |
960 | 966 | ||
@@ -1008,8 +1014,6 @@ static int zfcp_san_dbf_view_format(debug_info_t *id, struct debug_view *view, | |||
1008 | char *out_buf, const char *in_buf) | 1014 | char *out_buf, const char *in_buf) |
1009 | { | 1015 | { |
1010 | struct zfcp_san_dbf_record *r = (struct zfcp_san_dbf_record *)in_buf; | 1016 | struct zfcp_san_dbf_record *r = (struct zfcp_san_dbf_record *)in_buf; |
1011 | char *buffer = NULL; | ||
1012 | int buflen = 0, total = 0; | ||
1013 | char *p = out_buf; | 1017 | char *p = out_buf; |
1014 | 1018 | ||
1015 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) | 1019 | if (strncmp(r->tag, "dump", ZFCP_DBF_TAG_SIZE) == 0) |
@@ -1029,9 +1033,6 @@ static int zfcp_san_dbf_view_format(debug_info_t *id, struct debug_view *view, | |||
1029 | zfcp_dbf_out(&p, "gs_subtype", "0x%02x", ct->gs_subtype); | 1033 | zfcp_dbf_out(&p, "gs_subtype", "0x%02x", ct->gs_subtype); |
1030 | zfcp_dbf_out(&p, "options", "0x%02x", ct->options); | 1034 | zfcp_dbf_out(&p, "options", "0x%02x", ct->options); |
1031 | zfcp_dbf_out(&p, "max_res_size", "0x%04x", ct->max_res_size); | 1035 | zfcp_dbf_out(&p, "max_res_size", "0x%04x", ct->max_res_size); |
1032 | total = ct->len; | ||
1033 | buffer = ct->payload; | ||
1034 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); | ||
1035 | } else if (strncmp(r->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { | 1036 | } else if (strncmp(r->tag, "rctc", ZFCP_DBF_TAG_SIZE) == 0) { |
1036 | struct zfcp_san_dbf_record_ct_response *ct = &r->u.ct_resp; | 1037 | struct zfcp_san_dbf_record_ct_response *ct = &r->u.ct_resp; |
1037 | zfcp_dbf_out(&p, "cmd_rsp_code", "0x%04x", ct->cmd_rsp_code); | 1038 | zfcp_dbf_out(&p, "cmd_rsp_code", "0x%04x", ct->cmd_rsp_code); |
@@ -1039,23 +1040,12 @@ static int zfcp_san_dbf_view_format(debug_info_t *id, struct debug_view *view, | |||
1039 | zfcp_dbf_out(&p, "reason_code", "0x%02x", ct->reason_code); | 1040 | zfcp_dbf_out(&p, "reason_code", "0x%02x", ct->reason_code); |
1040 | zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", ct->expl); | 1041 | zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", ct->expl); |
1041 | zfcp_dbf_out(&p, "vendor_unique", "0x%02x", ct->vendor_unique); | 1042 | zfcp_dbf_out(&p, "vendor_unique", "0x%02x", ct->vendor_unique); |
1042 | total = ct->len; | ||
1043 | buffer = ct->payload; | ||
1044 | buflen = min(total, ZFCP_DBF_CT_PAYLOAD); | ||
1045 | } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || | 1043 | } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || |
1046 | strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || | 1044 | strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || |
1047 | strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { | 1045 | strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { |
1048 | struct zfcp_san_dbf_record_els *els = &r->u.els; | 1046 | struct zfcp_san_dbf_record_els *els = &r->u.els; |
1049 | zfcp_dbf_out(&p, "ls_code", "0x%02x", els->ls_code); | 1047 | zfcp_dbf_out(&p, "ls_code", "0x%02x", els->ls_code); |
1050 | total = els->len; | ||
1051 | buffer = els->payload; | ||
1052 | buflen = min(total, ZFCP_DBF_ELS_PAYLOAD); | ||
1053 | } | 1048 | } |
1054 | |||
1055 | zfcp_dbf_outd(&p, "payload", buffer, buflen, 0, total); | ||
1056 | if (buflen == total) | ||
1057 | p += sprintf(p, "\n"); | ||
1058 | |||
1059 | return p - out_buf; | 1049 | return p - out_buf; |
1060 | } | 1050 | } |
1061 | 1051 | ||