diff options
-rw-r--r-- | drivers/s390/scsi/zfcp_fc.c | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index ac5e3b7a3576..81d4375aa50e 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c | |||
@@ -677,6 +677,44 @@ static void zfcp_fc_ct_els_job_handler(void *data) | |||
677 | job->job_done(job); | 677 | job->job_done(job); |
678 | } | 678 | } |
679 | 679 | ||
680 | static struct zfcp_fc_wka_port *zfcp_fc_job_wka_port(struct fc_bsg_job *job) | ||
681 | { | ||
682 | u32 preamble_word1; | ||
683 | u8 gs_type; | ||
684 | struct zfcp_adapter *adapter; | ||
685 | |||
686 | preamble_word1 = job->request->rqst_data.r_ct.preamble_word1; | ||
687 | gs_type = (preamble_word1 & 0xff000000) >> 24; | ||
688 | |||
689 | adapter = (struct zfcp_adapter *) job->shost->hostdata[0]; | ||
690 | |||
691 | switch (gs_type) { | ||
692 | case FC_FST_ALIAS: | ||
693 | return &adapter->gs->as; | ||
694 | case FC_FST_MGMT: | ||
695 | return &adapter->gs->ms; | ||
696 | case FC_FST_TIME: | ||
697 | return &adapter->gs->ts; | ||
698 | break; | ||
699 | case FC_FST_DIR: | ||
700 | return &adapter->gs->ds; | ||
701 | break; | ||
702 | default: | ||
703 | return NULL; | ||
704 | } | ||
705 | } | ||
706 | |||
707 | static void zfcp_fc_ct_job_handler(void *data) | ||
708 | { | ||
709 | struct fc_bsg_job *job = data; | ||
710 | struct zfcp_fc_wka_port *wka_port; | ||
711 | |||
712 | wka_port = zfcp_fc_job_wka_port(job); | ||
713 | zfcp_fc_wka_port_put(wka_port); | ||
714 | |||
715 | zfcp_fc_ct_els_job_handler(data); | ||
716 | } | ||
717 | |||
680 | static int zfcp_fc_exec_els_job(struct fc_bsg_job *job, | 718 | static int zfcp_fc_exec_els_job(struct fc_bsg_job *job, |
681 | struct zfcp_adapter *adapter) | 719 | struct zfcp_adapter *adapter) |
682 | { | 720 | { |
@@ -695,6 +733,7 @@ static int zfcp_fc_exec_els_job(struct fc_bsg_job *job, | |||
695 | } else | 733 | } else |
696 | d_id = ntoh24(job->request->rqst_data.h_els.port_id); | 734 | d_id = ntoh24(job->request->rqst_data.h_els.port_id); |
697 | 735 | ||
736 | els->handler = zfcp_fc_ct_els_job_handler; | ||
698 | return zfcp_fsf_send_els(adapter, d_id, els); | 737 | return zfcp_fsf_send_els(adapter, d_id, els); |
699 | } | 738 | } |
700 | 739 | ||
@@ -702,35 +741,18 @@ static int zfcp_fc_exec_ct_job(struct fc_bsg_job *job, | |||
702 | struct zfcp_adapter *adapter) | 741 | struct zfcp_adapter *adapter) |
703 | { | 742 | { |
704 | int ret; | 743 | int ret; |
705 | u8 gs_type; | ||
706 | struct zfcp_fsf_ct_els *ct = job->dd_data; | 744 | struct zfcp_fsf_ct_els *ct = job->dd_data; |
707 | struct zfcp_fc_wka_port *wka_port; | 745 | struct zfcp_fc_wka_port *wka_port; |
708 | u32 preamble_word1; | ||
709 | 746 | ||
710 | preamble_word1 = job->request->rqst_data.r_ct.preamble_word1; | 747 | wka_port = zfcp_fc_job_wka_port(job); |
711 | gs_type = (preamble_word1 & 0xff000000) >> 24; | 748 | if (!wka_port) |
712 | 749 | return -EINVAL; | |
713 | switch (gs_type) { | ||
714 | case FC_FST_ALIAS: | ||
715 | wka_port = &adapter->gs->as; | ||
716 | break; | ||
717 | case FC_FST_MGMT: | ||
718 | wka_port = &adapter->gs->ms; | ||
719 | break; | ||
720 | case FC_FST_TIME: | ||
721 | wka_port = &adapter->gs->ts; | ||
722 | break; | ||
723 | case FC_FST_DIR: | ||
724 | wka_port = &adapter->gs->ds; | ||
725 | break; | ||
726 | default: | ||
727 | return -EINVAL; /* no such service */ | ||
728 | } | ||
729 | 750 | ||
730 | ret = zfcp_fc_wka_port_get(wka_port); | 751 | ret = zfcp_fc_wka_port_get(wka_port); |
731 | if (ret) | 752 | if (ret) |
732 | return ret; | 753 | return ret; |
733 | 754 | ||
755 | ct->handler = zfcp_fc_ct_job_handler; | ||
734 | ret = zfcp_fsf_send_ct(wka_port, ct, NULL); | 756 | ret = zfcp_fsf_send_ct(wka_port, ct, NULL); |
735 | if (ret) | 757 | if (ret) |
736 | zfcp_fc_wka_port_put(wka_port); | 758 | zfcp_fc_wka_port_put(wka_port); |
@@ -752,7 +774,6 @@ int zfcp_fc_exec_bsg_job(struct fc_bsg_job *job) | |||
752 | 774 | ||
753 | ct_els->req = job->request_payload.sg_list; | 775 | ct_els->req = job->request_payload.sg_list; |
754 | ct_els->resp = job->reply_payload.sg_list; | 776 | ct_els->resp = job->reply_payload.sg_list; |
755 | ct_els->handler = zfcp_fc_ct_els_job_handler; | ||
756 | ct_els->handler_data = job; | 777 | ct_els->handler_data = job; |
757 | 778 | ||
758 | switch (job->request->msgcode) { | 779 | switch (job->request->msgcode) { |