aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_dbf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c134
1 files changed, 63 insertions, 71 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 215b70749e95..84450955ae11 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -13,6 +13,7 @@
13#include <asm/debug.h> 13#include <asm/debug.h>
14#include "zfcp_dbf.h" 14#include "zfcp_dbf.h"
15#include "zfcp_ext.h" 15#include "zfcp_ext.h"
16#include "zfcp_fc.h"
16 17
17static u32 dbfsize = 4; 18static u32 dbfsize = 4;
18 19
@@ -177,8 +178,7 @@ void _zfcp_dbf_hba_fsf_response(const char *tag2, int level,
177 178
178 case FSF_QTCB_SEND_ELS: 179 case FSF_QTCB_SEND_ELS:
179 send_els = (struct zfcp_send_els *)fsf_req->data; 180 send_els = (struct zfcp_send_els *)fsf_req->data;
180 response->u.els.d_id = qtcb->bottom.support.d_id; 181 response->u.els.d_id = ntoh24(qtcb->bottom.support.d_id);
181 response->u.els.ls_code = send_els->ls_code >> 24;
182 break; 182 break;
183 183
184 case FSF_QTCB_ABORT_FCP_CMND: 184 case FSF_QTCB_ABORT_FCP_CMND:
@@ -348,7 +348,6 @@ static void zfcp_dbf_hba_view_response(char **p,
348 348
349 case FSF_QTCB_SEND_ELS: 349 case FSF_QTCB_SEND_ELS:
350 zfcp_dbf_out(p, "d_id", "0x%06x", r->u.els.d_id); 350 zfcp_dbf_out(p, "d_id", "0x%06x", r->u.els.d_id);
351 zfcp_dbf_out(p, "ls_code", "0x%02x", r->u.els.ls_code);
352 break; 351 break;
353 352
354 case FSF_QTCB_ABORT_FCP_CMND: 353 case FSF_QTCB_ABORT_FCP_CMND:
@@ -677,14 +676,14 @@ void zfcp_dbf_rec_action(char *id2, struct zfcp_erp_action *erp_action)
677/** 676/**
678 * zfcp_dbf_san_ct_request - trace event for issued CT request 677 * zfcp_dbf_san_ct_request - trace event for issued CT request
679 * @fsf_req: request containing issued CT data 678 * @fsf_req: request containing issued CT data
679 * @d_id: destination id where ct request is sent to
680 */ 680 */
681void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req) 681void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req, u32 d_id)
682{ 682{
683 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; 683 struct zfcp_fsf_ct_els *ct = (struct zfcp_fsf_ct_els *)fsf_req->data;
684 struct zfcp_wka_port *wka_port = ct->wka_port; 684 struct zfcp_adapter *adapter = fsf_req->adapter;
685 struct zfcp_adapter *adapter = wka_port->adapter;
686 struct zfcp_dbf *dbf = adapter->dbf; 685 struct zfcp_dbf *dbf = adapter->dbf;
687 struct ct_hdr *hdr = sg_virt(ct->req); 686 struct fc_ct_hdr *hdr = sg_virt(ct->req);
688 struct zfcp_dbf_san_record *r = &dbf->san_buf; 687 struct zfcp_dbf_san_record *r = &dbf->san_buf;
689 struct zfcp_dbf_san_record_ct_request *oct = &r->u.ct_req; 688 struct zfcp_dbf_san_record_ct_request *oct = &r->u.ct_req;
690 int level = 3; 689 int level = 3;
@@ -695,19 +694,18 @@ void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req)
695 strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE); 694 strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE);
696 r->fsf_reqid = fsf_req->req_id; 695 r->fsf_reqid = fsf_req->req_id;
697 r->fsf_seqno = fsf_req->seq_no; 696 r->fsf_seqno = fsf_req->seq_no;
698 r->s_id = fc_host_port_id(adapter->scsi_host); 697 oct->d_id = d_id;
699 r->d_id = wka_port->d_id; 698 oct->cmd_req_code = hdr->ct_cmd;
700 oct->cmd_req_code = hdr->cmd_rsp_code; 699 oct->revision = hdr->ct_rev;
701 oct->revision = hdr->revision; 700 oct->gs_type = hdr->ct_fs_type;
702 oct->gs_type = hdr->gs_type; 701 oct->gs_subtype = hdr->ct_fs_subtype;
703 oct->gs_subtype = hdr->gs_subtype; 702 oct->options = hdr->ct_options;
704 oct->options = hdr->options; 703 oct->max_res_size = hdr->ct_mr_size;
705 oct->max_res_size = hdr->max_res_size; 704 oct->len = min((int)ct->req->length - (int)sizeof(struct fc_ct_hdr),
706 oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr),
707 ZFCP_DBF_SAN_MAX_PAYLOAD); 705 ZFCP_DBF_SAN_MAX_PAYLOAD);
708 debug_event(dbf->san, level, r, sizeof(*r)); 706 debug_event(dbf->san, level, r, sizeof(*r));
709 zfcp_dbf_hexdump(dbf->san, r, sizeof(*r), level, 707 zfcp_dbf_hexdump(dbf->san, r, sizeof(*r), level,
710 (void *)hdr + sizeof(struct ct_hdr), oct->len); 708 (void *)hdr + sizeof(struct fc_ct_hdr), oct->len);
711 spin_unlock_irqrestore(&dbf->san_lock, flags); 709 spin_unlock_irqrestore(&dbf->san_lock, flags);
712} 710}
713 711
@@ -717,10 +715,9 @@ void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req)
717 */ 715 */
718void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req) 716void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req)
719{ 717{
720 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; 718 struct zfcp_fsf_ct_els *ct = (struct zfcp_fsf_ct_els *)fsf_req->data;
721 struct zfcp_wka_port *wka_port = ct->wka_port; 719 struct zfcp_adapter *adapter = fsf_req->adapter;
722 struct zfcp_adapter *adapter = wka_port->adapter; 720 struct fc_ct_hdr *hdr = sg_virt(ct->resp);
723 struct ct_hdr *hdr = sg_virt(ct->resp);
724 struct zfcp_dbf *dbf = adapter->dbf; 721 struct zfcp_dbf *dbf = adapter->dbf;
725 struct zfcp_dbf_san_record *r = &dbf->san_buf; 722 struct zfcp_dbf_san_record *r = &dbf->san_buf;
726 struct zfcp_dbf_san_record_ct_response *rct = &r->u.ct_resp; 723 struct zfcp_dbf_san_record_ct_response *rct = &r->u.ct_resp;
@@ -732,25 +729,23 @@ void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req)
732 strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE); 729 strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE);
733 r->fsf_reqid = fsf_req->req_id; 730 r->fsf_reqid = fsf_req->req_id;
734 r->fsf_seqno = fsf_req->seq_no; 731 r->fsf_seqno = fsf_req->seq_no;
735 r->s_id = wka_port->d_id; 732 rct->cmd_rsp_code = hdr->ct_cmd;
736 r->d_id = fc_host_port_id(adapter->scsi_host); 733 rct->revision = hdr->ct_rev;
737 rct->cmd_rsp_code = hdr->cmd_rsp_code; 734 rct->reason_code = hdr->ct_reason;
738 rct->revision = hdr->revision; 735 rct->expl = hdr->ct_explan;
739 rct->reason_code = hdr->reason_code; 736 rct->vendor_unique = hdr->ct_vendor;
740 rct->expl = hdr->reason_code_expl; 737 rct->max_res_size = hdr->ct_mr_size;
741 rct->vendor_unique = hdr->vendor_unique; 738 rct->len = min((int)ct->resp->length - (int)sizeof(struct fc_ct_hdr),
742 rct->max_res_size = hdr->max_res_size;
743 rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr),
744 ZFCP_DBF_SAN_MAX_PAYLOAD); 739 ZFCP_DBF_SAN_MAX_PAYLOAD);
745 debug_event(dbf->san, level, r, sizeof(*r)); 740 debug_event(dbf->san, level, r, sizeof(*r));
746 zfcp_dbf_hexdump(dbf->san, r, sizeof(*r), level, 741 zfcp_dbf_hexdump(dbf->san, r, sizeof(*r), level,
747 (void *)hdr + sizeof(struct ct_hdr), rct->len); 742 (void *)hdr + sizeof(struct fc_ct_hdr), rct->len);
748 spin_unlock_irqrestore(&dbf->san_lock, flags); 743 spin_unlock_irqrestore(&dbf->san_lock, flags);
749} 744}
750 745
751static void zfcp_dbf_san_els(const char *tag, int level, 746static void zfcp_dbf_san_els(const char *tag, int level,
752 struct zfcp_fsf_req *fsf_req, u32 s_id, u32 d_id, 747 struct zfcp_fsf_req *fsf_req, u32 d_id,
753 u8 ls_code, void *buffer, int buflen) 748 void *buffer, int buflen)
754{ 749{
755 struct zfcp_adapter *adapter = fsf_req->adapter; 750 struct zfcp_adapter *adapter = fsf_req->adapter;
756 struct zfcp_dbf *dbf = adapter->dbf; 751 struct zfcp_dbf *dbf = adapter->dbf;
@@ -762,9 +757,7 @@ static void zfcp_dbf_san_els(const char *tag, int level,
762 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); 757 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
763 rec->fsf_reqid = fsf_req->req_id; 758 rec->fsf_reqid = fsf_req->req_id;
764 rec->fsf_seqno = fsf_req->seq_no; 759 rec->fsf_seqno = fsf_req->seq_no;
765 rec->s_id = s_id; 760 rec->u.els.d_id = d_id;
766 rec->d_id = d_id;
767 rec->u.els.ls_code = ls_code;
768 debug_event(dbf->san, level, rec, sizeof(*rec)); 761 debug_event(dbf->san, level, rec, sizeof(*rec));
769 zfcp_dbf_hexdump(dbf->san, rec, sizeof(*rec), level, 762 zfcp_dbf_hexdump(dbf->san, rec, sizeof(*rec), level,
770 buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD)); 763 buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD));
@@ -777,12 +770,11 @@ static void zfcp_dbf_san_els(const char *tag, int level,
777 */ 770 */
778void zfcp_dbf_san_els_request(struct zfcp_fsf_req *fsf_req) 771void zfcp_dbf_san_els_request(struct zfcp_fsf_req *fsf_req)
779{ 772{
780 struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; 773 struct zfcp_fsf_ct_els *els = (struct zfcp_fsf_ct_els *)fsf_req->data;
774 u32 d_id = ntoh24(fsf_req->qtcb->bottom.support.d_id);
781 775
782 zfcp_dbf_san_els("oels", 2, fsf_req, 776 zfcp_dbf_san_els("oels", 2, fsf_req, d_id,
783 fc_host_port_id(els->adapter->scsi_host), 777 sg_virt(els->req), els->req->length);
784 els->d_id, *(u8 *) sg_virt(els->req),
785 sg_virt(els->req), els->req->length);
786} 778}
787 779
788/** 780/**
@@ -791,12 +783,11 @@ void zfcp_dbf_san_els_request(struct zfcp_fsf_req *fsf_req)
791 */ 783 */
792void zfcp_dbf_san_els_response(struct zfcp_fsf_req *fsf_req) 784void zfcp_dbf_san_els_response(struct zfcp_fsf_req *fsf_req)
793{ 785{
794 struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data; 786 struct zfcp_fsf_ct_els *els = (struct zfcp_fsf_ct_els *)fsf_req->data;
787 u32 d_id = ntoh24(fsf_req->qtcb->bottom.support.d_id);
795 788
796 zfcp_dbf_san_els("rels", 2, fsf_req, els->d_id, 789 zfcp_dbf_san_els("rels", 2, fsf_req, d_id,
797 fc_host_port_id(els->adapter->scsi_host), 790 sg_virt(els->resp), els->resp->length);
798 *(u8 *)sg_virt(els->req), sg_virt(els->resp),
799 els->resp->length);
800} 791}
801 792
802/** 793/**
@@ -805,16 +796,13 @@ void zfcp_dbf_san_els_response(struct zfcp_fsf_req *fsf_req)
805 */ 796 */
806void zfcp_dbf_san_incoming_els(struct zfcp_fsf_req *fsf_req) 797void zfcp_dbf_san_incoming_els(struct zfcp_fsf_req *fsf_req)
807{ 798{
808 struct zfcp_adapter *adapter = fsf_req->adapter;
809 struct fsf_status_read_buffer *buf = 799 struct fsf_status_read_buffer *buf =
810 (struct fsf_status_read_buffer *)fsf_req->data; 800 (struct fsf_status_read_buffer *)fsf_req->data;
811 int length = (int)buf->length - 801 int length = (int)buf->length -
812 (int)((void *)&buf->payload - (void *)buf); 802 (int)((void *)&buf->payload - (void *)buf);
813 803
814 zfcp_dbf_san_els("iels", 1, fsf_req, buf->d_id, 804 zfcp_dbf_san_els("iels", 1, fsf_req, ntoh24(buf->d_id),
815 fc_host_port_id(adapter->scsi_host), 805 (void *)buf->payload.data, length);
816 buf->payload.data[0], (void *)buf->payload.data,
817 length);
818} 806}
819 807
820static int zfcp_dbf_san_view_format(debug_info_t *id, struct debug_view *view, 808static int zfcp_dbf_san_view_format(debug_info_t *id, struct debug_view *view,
@@ -829,11 +817,10 @@ static int zfcp_dbf_san_view_format(debug_info_t *id, struct debug_view *view,
829 zfcp_dbf_tag(&p, "tag", r->tag); 817 zfcp_dbf_tag(&p, "tag", r->tag);
830 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); 818 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
831 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); 819 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno);
832 zfcp_dbf_out(&p, "s_id", "0x%06x", r->s_id);
833 zfcp_dbf_out(&p, "d_id", "0x%06x", r->d_id);
834 820
835 if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { 821 if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) {
836 struct zfcp_dbf_san_record_ct_request *ct = &r->u.ct_req; 822 struct zfcp_dbf_san_record_ct_request *ct = &r->u.ct_req;
823 zfcp_dbf_out(&p, "d_id", "0x%06x", ct->d_id);
837 zfcp_dbf_out(&p, "cmd_req_code", "0x%04x", ct->cmd_req_code); 824 zfcp_dbf_out(&p, "cmd_req_code", "0x%04x", ct->cmd_req_code);
838 zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision); 825 zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision);
839 zfcp_dbf_out(&p, "gs_type", "0x%02x", ct->gs_type); 826 zfcp_dbf_out(&p, "gs_type", "0x%02x", ct->gs_type);
@@ -852,7 +839,7 @@ static int zfcp_dbf_san_view_format(debug_info_t *id, struct debug_view *view,
852 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || 839 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 ||
853 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { 840 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) {
854 struct zfcp_dbf_san_record_els *els = &r->u.els; 841 struct zfcp_dbf_san_record_els *els = &r->u.els;
855 zfcp_dbf_out(&p, "ls_code", "0x%02x", els->ls_code); 842 zfcp_dbf_out(&p, "d_id", "0x%06x", els->d_id);
856 } 843 }
857 return p - out_buf; 844 return p - out_buf;
858} 845}
@@ -870,8 +857,9 @@ void _zfcp_dbf_scsi(const char *tag, const char *tag2, int level,
870 struct zfcp_dbf_scsi_record *rec = &dbf->scsi_buf; 857 struct zfcp_dbf_scsi_record *rec = &dbf->scsi_buf;
871 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; 858 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec;
872 unsigned long flags; 859 unsigned long flags;
873 struct fcp_rsp_iu *fcp_rsp; 860 struct fcp_resp_with_ext *fcp_rsp;
874 char *fcp_rsp_info = NULL, *fcp_sns_info = NULL; 861 struct fcp_resp_rsp_info *fcp_rsp_info = NULL;
862 char *fcp_sns_info = NULL;
875 int offset = 0, buflen = 0; 863 int offset = 0, buflen = 0;
876 864
877 spin_lock_irqsave(&dbf->scsi_lock, flags); 865 spin_lock_irqsave(&dbf->scsi_lock, flags);
@@ -895,20 +883,22 @@ void _zfcp_dbf_scsi(const char *tag, const char *tag2, int level,
895 rec->scsi_allowed = scsi_cmnd->allowed; 883 rec->scsi_allowed = scsi_cmnd->allowed;
896 } 884 }
897 if (fsf_req != NULL) { 885 if (fsf_req != NULL) {
898 fcp_rsp = (struct fcp_rsp_iu *) 886 fcp_rsp = (struct fcp_resp_with_ext *)
899 &(fsf_req->qtcb->bottom.io.fcp_rsp); 887 &(fsf_req->qtcb->bottom.io.fcp_rsp);
900 fcp_rsp_info = (unsigned char *) &fcp_rsp[1]; 888 fcp_rsp_info = (struct fcp_resp_rsp_info *)
901 fcp_sns_info = 889 &fcp_rsp[1];
902 zfcp_get_fcp_sns_info_ptr(fcp_rsp); 890 fcp_sns_info = (char *) &fcp_rsp[1];
903 891 if (fcp_rsp->resp.fr_flags & FCP_RSP_LEN_VAL)
904 rec->rsp_validity = fcp_rsp->validity.value; 892 fcp_sns_info += fcp_rsp->ext.fr_sns_len;
905 rec->rsp_scsi_status = fcp_rsp->scsi_status; 893
906 rec->rsp_resid = fcp_rsp->fcp_resid; 894 rec->rsp_validity = fcp_rsp->resp.fr_flags;
907 if (fcp_rsp->validity.bits.fcp_rsp_len_valid) 895 rec->rsp_scsi_status = fcp_rsp->resp.fr_status;
908 rec->rsp_code = *(fcp_rsp_info + 3); 896 rec->rsp_resid = fcp_rsp->ext.fr_resid;
909 if (fcp_rsp->validity.bits.fcp_sns_len_valid) { 897 if (fcp_rsp->resp.fr_flags & FCP_RSP_LEN_VAL)
910 buflen = min((int)fcp_rsp->fcp_sns_len, 898 rec->rsp_code = fcp_rsp_info->rsp_code;
911 ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO); 899 if (fcp_rsp->resp.fr_flags & FCP_SNS_LEN_VAL) {
900 buflen = min(fcp_rsp->ext.fr_sns_len,
901 (u32)ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO);
912 rec->sns_info_len = buflen; 902 rec->sns_info_len = buflen;
913 memcpy(rec->sns_info, fcp_sns_info, 903 memcpy(rec->sns_info, fcp_sns_info,
914 min(buflen, 904 min(buflen,
@@ -1067,6 +1057,8 @@ err_out:
1067 */ 1057 */
1068void zfcp_dbf_adapter_unregister(struct zfcp_dbf *dbf) 1058void zfcp_dbf_adapter_unregister(struct zfcp_dbf *dbf)
1069{ 1059{
1060 if (!dbf)
1061 return;
1070 debug_unregister(dbf->scsi); 1062 debug_unregister(dbf->scsi);
1071 debug_unregister(dbf->san); 1063 debug_unregister(dbf->san);
1072 debug_unregister(dbf->hba); 1064 debug_unregister(dbf->hba);