aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_dbf.c
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-11-24 10:54:13 -0500
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 13:02:15 -0500
commit7c7dc196814b9e1d5cc254dc579a5fa78ae524f7 (patch)
treeefe4800a456fa97e1f10876840fbde0983264b18 /drivers/s390/scsi/zfcp_dbf.c
parent800c0cad962dcf630cabf3efdc5983619e73d4c9 (diff)
[SCSI] zfcp: Simplify handling of ct and els requests
Remove some redundancies in FC related code and trace: - drop redundant data from SAN trace (local s_id that only changes during link down, ls_code that is already part of payload, d_id in ct response trace that is always the same as in ct request trace) - use one common fsf struct to hold zfcp data for ct and els requests - leverage common fsf struct for FC passthrough job data, allocate it with dd_bsg_data for passthrough requests and unify common code for ct and els passthrough request - simplify callback handling in zfcp_fc Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c56
1 files changed, 21 insertions, 35 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 517f196b4c52..84450955ae11 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -179,7 +179,6 @@ void _zfcp_dbf_hba_fsf_response(const char *tag2, int level,
179 case FSF_QTCB_SEND_ELS: 179 case FSF_QTCB_SEND_ELS:
180 send_els = (struct zfcp_send_els *)fsf_req->data; 180 send_els = (struct zfcp_send_els *)fsf_req->data;
181 response->u.els.d_id = ntoh24(qtcb->bottom.support.d_id); 181 response->u.els.d_id = ntoh24(qtcb->bottom.support.d_id);
182 response->u.els.ls_code = send_els->ls_code >> 24;
183 break; 182 break;
184 183
185 case FSF_QTCB_ABORT_FCP_CMND: 184 case FSF_QTCB_ABORT_FCP_CMND:
@@ -349,7 +348,6 @@ static void zfcp_dbf_hba_view_response(char **p,
349 348
350 case FSF_QTCB_SEND_ELS: 349 case FSF_QTCB_SEND_ELS:
351 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);
352 zfcp_dbf_out(p, "ls_code", "0x%02x", r->u.els.ls_code);
353 break; 351 break;
354 352
355 case FSF_QTCB_ABORT_FCP_CMND: 353 case FSF_QTCB_ABORT_FCP_CMND:
@@ -678,12 +676,12 @@ void zfcp_dbf_rec_action(char *id2, struct zfcp_erp_action *erp_action)
678/** 676/**
679 * zfcp_dbf_san_ct_request - trace event for issued CT request 677 * zfcp_dbf_san_ct_request - trace event for issued CT request
680 * @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
681 */ 680 */
682void 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)
683{ 682{
684 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;
685 struct zfcp_fc_wka_port *wka_port = ct->wka_port; 684 struct zfcp_adapter *adapter = fsf_req->adapter;
686 struct zfcp_adapter *adapter = wka_port->adapter;
687 struct zfcp_dbf *dbf = adapter->dbf; 685 struct zfcp_dbf *dbf = adapter->dbf;
688 struct fc_ct_hdr *hdr = sg_virt(ct->req); 686 struct fc_ct_hdr *hdr = sg_virt(ct->req);
689 struct zfcp_dbf_san_record *r = &dbf->san_buf; 687 struct zfcp_dbf_san_record *r = &dbf->san_buf;
@@ -696,8 +694,7 @@ void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req)
696 strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE); 694 strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE);
697 r->fsf_reqid = fsf_req->req_id; 695 r->fsf_reqid = fsf_req->req_id;
698 r->fsf_seqno = fsf_req->seq_no; 696 r->fsf_seqno = fsf_req->seq_no;
699 r->s_id = fc_host_port_id(adapter->scsi_host); 697 oct->d_id = d_id;
700 r->d_id = wka_port->d_id;
701 oct->cmd_req_code = hdr->ct_cmd; 698 oct->cmd_req_code = hdr->ct_cmd;
702 oct->revision = hdr->ct_rev; 699 oct->revision = hdr->ct_rev;
703 oct->gs_type = hdr->ct_fs_type; 700 oct->gs_type = hdr->ct_fs_type;
@@ -718,9 +715,8 @@ void zfcp_dbf_san_ct_request(struct zfcp_fsf_req *fsf_req)
718 */ 715 */
719void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req) 716void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req)
720{ 717{
721 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;
722 struct zfcp_fc_wka_port *wka_port = ct->wka_port; 719 struct zfcp_adapter *adapter = fsf_req->adapter;
723 struct zfcp_adapter *adapter = wka_port->adapter;
724 struct fc_ct_hdr *hdr = sg_virt(ct->resp); 720 struct fc_ct_hdr *hdr = sg_virt(ct->resp);
725 struct zfcp_dbf *dbf = adapter->dbf; 721 struct zfcp_dbf *dbf = adapter->dbf;
726 struct zfcp_dbf_san_record *r = &dbf->san_buf; 722 struct zfcp_dbf_san_record *r = &dbf->san_buf;
@@ -733,8 +729,6 @@ void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req)
733 strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE); 729 strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE);
734 r->fsf_reqid = fsf_req->req_id; 730 r->fsf_reqid = fsf_req->req_id;
735 r->fsf_seqno = fsf_req->seq_no; 731 r->fsf_seqno = fsf_req->seq_no;
736 r->s_id = wka_port->d_id;
737 r->d_id = fc_host_port_id(adapter->scsi_host);
738 rct->cmd_rsp_code = hdr->ct_cmd; 732 rct->cmd_rsp_code = hdr->ct_cmd;
739 rct->revision = hdr->ct_rev; 733 rct->revision = hdr->ct_rev;
740 rct->reason_code = hdr->ct_reason; 734 rct->reason_code = hdr->ct_reason;
@@ -750,8 +744,8 @@ void zfcp_dbf_san_ct_response(struct zfcp_fsf_req *fsf_req)
750} 744}
751 745
752static void zfcp_dbf_san_els(const char *tag, int level, 746static void zfcp_dbf_san_els(const char *tag, int level,
753 struct zfcp_fsf_req *fsf_req, u32 s_id, u32 d_id, 747 struct zfcp_fsf_req *fsf_req, u32 d_id,
754 u8 ls_code, void *buffer, int buflen) 748 void *buffer, int buflen)
755{ 749{
756 struct zfcp_adapter *adapter = fsf_req->adapter; 750 struct zfcp_adapter *adapter = fsf_req->adapter;
757 struct zfcp_dbf *dbf = adapter->dbf; 751 struct zfcp_dbf *dbf = adapter->dbf;
@@ -763,9 +757,7 @@ static void zfcp_dbf_san_els(const char *tag, int level,
763 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); 757 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
764 rec->fsf_reqid = fsf_req->req_id; 758 rec->fsf_reqid = fsf_req->req_id;
765 rec->fsf_seqno = fsf_req->seq_no; 759 rec->fsf_seqno = fsf_req->seq_no;
766 rec->s_id = s_id; 760 rec->u.els.d_id = d_id;
767 rec->d_id = d_id;
768 rec->u.els.ls_code = ls_code;
769 debug_event(dbf->san, level, rec, sizeof(*rec)); 761 debug_event(dbf->san, level, rec, sizeof(*rec));
770 zfcp_dbf_hexdump(dbf->san, rec, sizeof(*rec), level, 762 zfcp_dbf_hexdump(dbf->san, rec, sizeof(*rec), level,
771 buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD)); 763 buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD));
@@ -778,12 +770,11 @@ static void zfcp_dbf_san_els(const char *tag, int level,
778 */ 770 */
779void zfcp_dbf_san_els_request(struct zfcp_fsf_req *fsf_req) 771void zfcp_dbf_san_els_request(struct zfcp_fsf_req *fsf_req)
780{ 772{
781 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);
782 775
783 zfcp_dbf_san_els("oels", 2, fsf_req, 776 zfcp_dbf_san_els("oels", 2, fsf_req, d_id,
784 fc_host_port_id(els->adapter->scsi_host), 777 sg_virt(els->req), els->req->length);
785 els->d_id, *(u8 *) sg_virt(els->req),
786 sg_virt(els->req), els->req->length);
787} 778}
788 779
789/** 780/**
@@ -792,12 +783,11 @@ void zfcp_dbf_san_els_request(struct zfcp_fsf_req *fsf_req)
792 */ 783 */
793void zfcp_dbf_san_els_response(struct zfcp_fsf_req *fsf_req) 784void zfcp_dbf_san_els_response(struct zfcp_fsf_req *fsf_req)
794{ 785{
795 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);
796 788
797 zfcp_dbf_san_els("rels", 2, fsf_req, els->d_id, 789 zfcp_dbf_san_els("rels", 2, fsf_req, d_id,
798 fc_host_port_id(els->adapter->scsi_host), 790 sg_virt(els->resp), els->resp->length);
799 *(u8 *)sg_virt(els->req), sg_virt(els->resp),
800 els->resp->length);
801} 791}
802 792
803/** 793/**
@@ -806,16 +796,13 @@ void zfcp_dbf_san_els_response(struct zfcp_fsf_req *fsf_req)
806 */ 796 */
807void zfcp_dbf_san_incoming_els(struct zfcp_fsf_req *fsf_req) 797void zfcp_dbf_san_incoming_els(struct zfcp_fsf_req *fsf_req)
808{ 798{
809 struct zfcp_adapter *adapter = fsf_req->adapter;
810 struct fsf_status_read_buffer *buf = 799 struct fsf_status_read_buffer *buf =
811 (struct fsf_status_read_buffer *)fsf_req->data; 800 (struct fsf_status_read_buffer *)fsf_req->data;
812 int length = (int)buf->length - 801 int length = (int)buf->length -
813 (int)((void *)&buf->payload - (void *)buf); 802 (int)((void *)&buf->payload - (void *)buf);
814 803
815 zfcp_dbf_san_els("iels", 1, fsf_req, ntoh24(buf->d_id), 804 zfcp_dbf_san_els("iels", 1, fsf_req, ntoh24(buf->d_id),
816 fc_host_port_id(adapter->scsi_host), 805 (void *)buf->payload.data, length);
817 buf->payload.data[0], (void *)buf->payload.data,
818 length);
819} 806}
820 807
821static 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,
@@ -830,11 +817,10 @@ static int zfcp_dbf_san_view_format(debug_info_t *id, struct debug_view *view,
830 zfcp_dbf_tag(&p, "tag", r->tag); 817 zfcp_dbf_tag(&p, "tag", r->tag);
831 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid); 818 zfcp_dbf_out(&p, "fsf_reqid", "0x%0Lx", r->fsf_reqid);
832 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno); 819 zfcp_dbf_out(&p, "fsf_seqno", "0x%08x", r->fsf_seqno);
833 zfcp_dbf_out(&p, "s_id", "0x%06x", r->s_id);
834 zfcp_dbf_out(&p, "d_id", "0x%06x", r->d_id);
835 820
836 if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) { 821 if (strncmp(r->tag, "octc", ZFCP_DBF_TAG_SIZE) == 0) {
837 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);
838 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);
839 zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision); 825 zfcp_dbf_out(&p, "revision", "0x%02x", ct->revision);
840 zfcp_dbf_out(&p, "gs_type", "0x%02x", ct->gs_type); 826 zfcp_dbf_out(&p, "gs_type", "0x%02x", ct->gs_type);
@@ -853,7 +839,7 @@ static int zfcp_dbf_san_view_format(debug_info_t *id, struct debug_view *view,
853 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || 839 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 ||
854 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { 840 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) {
855 struct zfcp_dbf_san_record_els *els = &r->u.els; 841 struct zfcp_dbf_san_record_els *els = &r->u.els;
856 zfcp_dbf_out(&p, "ls_code", "0x%02x", els->ls_code); 842 zfcp_dbf_out(&p, "d_id", "0x%06x", els->d_id);
857 } 843 }
858 return p - out_buf; 844 return p - out_buf;
859} 845}