diff options
author | Swen Schillig <swen@vnet.ibm.com> | 2009-08-18 09:43:19 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-05 09:49:27 -0400 |
commit | 564e1c86c810f9ccfe4300afa402815e3db4886d (patch) | |
tree | ecb88038c443d6486e9df352c79b3c78be5454ef /drivers/s390/scsi/zfcp_fsf.c | |
parent | 42428f747a8a0db9c6de03e105932316defad65d (diff) |
[SCSI] zfcp: Move qdio related data out of zfcp_adapter
The zfcp_adapter structure was growing over time to a size of almost
one memory page. To reduce the size of the data structure and to
seperate different layers, put all qdio related data in the new
zfcp_qdio data structure.
Signed-off-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_fsf.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 299 |
1 files changed, 154 insertions, 145 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index e88b7804780b..b9a16e4b48b4 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -637,33 +637,34 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req) | |||
637 | } | 637 | } |
638 | } | 638 | } |
639 | 639 | ||
640 | static int zfcp_fsf_sbal_check(struct zfcp_adapter *adapter) | 640 | static int zfcp_fsf_sbal_check(struct zfcp_qdio *qdio) |
641 | { | 641 | { |
642 | struct zfcp_qdio_queue *req_q = &adapter->req_q; | 642 | struct zfcp_qdio_queue *req_q = &qdio->req_q; |
643 | 643 | ||
644 | spin_lock_bh(&adapter->req_q_lock); | 644 | spin_lock_bh(&qdio->req_q_lock); |
645 | if (atomic_read(&req_q->count)) | 645 | if (atomic_read(&req_q->count)) |
646 | return 1; | 646 | return 1; |
647 | spin_unlock_bh(&adapter->req_q_lock); | 647 | spin_unlock_bh(&qdio->req_q_lock); |
648 | return 0; | 648 | return 0; |
649 | } | 649 | } |
650 | 650 | ||
651 | static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter) | 651 | static int zfcp_fsf_req_sbal_get(struct zfcp_qdio *qdio) |
652 | { | 652 | { |
653 | struct zfcp_adapter *adapter = qdio->adapter; | ||
653 | long ret; | 654 | long ret; |
654 | 655 | ||
655 | spin_unlock_bh(&adapter->req_q_lock); | 656 | spin_unlock_bh(&qdio->req_q_lock); |
656 | ret = wait_event_interruptible_timeout(adapter->request_wq, | 657 | ret = wait_event_interruptible_timeout(qdio->req_q_wq, |
657 | zfcp_fsf_sbal_check(adapter), 5 * HZ); | 658 | zfcp_fsf_sbal_check(qdio), 5 * HZ); |
658 | if (ret > 0) | 659 | if (ret > 0) |
659 | return 0; | 660 | return 0; |
660 | if (!ret) { | 661 | if (!ret) { |
661 | atomic_inc(&adapter->qdio_outb_full); | 662 | atomic_inc(&qdio->req_q_full); |
662 | /* assume hanging outbound queue, try queue recovery */ | 663 | /* assume hanging outbound queue, try queue recovery */ |
663 | zfcp_erp_adapter_reopen(adapter, 0, "fsrsg_1", NULL); | 664 | zfcp_erp_adapter_reopen(adapter, 0, "fsrsg_1", NULL); |
664 | } | 665 | } |
665 | 666 | ||
666 | spin_lock_bh(&adapter->req_q_lock); | 667 | spin_lock_bh(&qdio->req_q_lock); |
667 | return -EIO; | 668 | return -EIO; |
668 | } | 669 | } |
669 | 670 | ||
@@ -700,11 +701,12 @@ static struct fsf_qtcb *zfcp_qtcb_alloc(mempool_t *pool) | |||
700 | return qtcb; | 701 | return qtcb; |
701 | } | 702 | } |
702 | 703 | ||
703 | static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_adapter *adapter, | 704 | static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio, |
704 | u32 fsf_cmd, mempool_t *pool) | 705 | u32 fsf_cmd, mempool_t *pool) |
705 | { | 706 | { |
706 | struct qdio_buffer_element *sbale; | 707 | struct qdio_buffer_element *sbale; |
707 | struct zfcp_qdio_queue *req_q = &adapter->req_q; | 708 | struct zfcp_qdio_queue *req_q = &qdio->req_q; |
709 | struct zfcp_adapter *adapter = qdio->adapter; | ||
708 | struct zfcp_fsf_req *req = zfcp_fsf_alloc(pool); | 710 | struct zfcp_fsf_req *req = zfcp_fsf_alloc(pool); |
709 | 711 | ||
710 | if (unlikely(!req)) | 712 | if (unlikely(!req)) |
@@ -725,7 +727,7 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_adapter *adapter, | |||
725 | req->queue_req.sbal_last = req_q->first; | 727 | req->queue_req.sbal_last = req_q->first; |
726 | req->queue_req.sbale_curr = 1; | 728 | req->queue_req.sbale_curr = 1; |
727 | 729 | ||
728 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 730 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
729 | sbale[0].addr = (void *) req->req_id; | 731 | sbale[0].addr = (void *) req->req_id; |
730 | sbale[0].flags |= SBAL_FLAGS0_COMMAND; | 732 | sbale[0].flags |= SBAL_FLAGS0_COMMAND; |
731 | 733 | ||
@@ -740,7 +742,7 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_adapter *adapter, | |||
740 | return ERR_PTR(-ENOMEM); | 742 | return ERR_PTR(-ENOMEM); |
741 | } | 743 | } |
742 | 744 | ||
743 | req->qtcb->prefix.req_seq_no = req->adapter->fsf_req_seq_no; | 745 | req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no; |
744 | req->qtcb->prefix.req_id = req->req_id; | 746 | req->qtcb->prefix.req_id = req->req_id; |
745 | req->qtcb->prefix.ulp_info = 26; | 747 | req->qtcb->prefix.ulp_info = 26; |
746 | req->qtcb->prefix.qtcb_type = fsf_qtcb_type[req->fsf_command]; | 748 | req->qtcb->prefix.qtcb_type = fsf_qtcb_type[req->fsf_command]; |
@@ -764,6 +766,7 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_adapter *adapter, | |||
764 | static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) | 766 | static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) |
765 | { | 767 | { |
766 | struct zfcp_adapter *adapter = req->adapter; | 768 | struct zfcp_adapter *adapter = req->adapter; |
769 | struct zfcp_qdio *qdio = adapter->qdio; | ||
767 | unsigned long flags; | 770 | unsigned long flags; |
768 | int idx; | 771 | int idx; |
769 | int with_qtcb = (req->qtcb != NULL); | 772 | int with_qtcb = (req->qtcb != NULL); |
@@ -774,9 +777,9 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) | |||
774 | list_add_tail(&req->list, &adapter->req_list[idx]); | 777 | list_add_tail(&req->list, &adapter->req_list[idx]); |
775 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); | 778 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); |
776 | 779 | ||
777 | req->queue_req.qdio_outb_usage = atomic_read(&adapter->req_q.count); | 780 | req->queue_req.qdio_outb_usage = atomic_read(&qdio->req_q.count); |
778 | req->issued = get_clock(); | 781 | req->issued = get_clock(); |
779 | if (zfcp_qdio_send(adapter, &req->queue_req)) { | 782 | if (zfcp_qdio_send(qdio, &req->queue_req)) { |
780 | del_timer(&req->timer); | 783 | del_timer(&req->timer); |
781 | spin_lock_irqsave(&adapter->req_list_lock, flags); | 784 | spin_lock_irqsave(&adapter->req_list_lock, flags); |
782 | /* lookup request again, list might have changed */ | 785 | /* lookup request again, list might have changed */ |
@@ -801,25 +804,26 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) | |||
801 | * @req_flags: request flags | 804 | * @req_flags: request flags |
802 | * Returns: 0 on success, ERROR otherwise | 805 | * Returns: 0 on success, ERROR otherwise |
803 | */ | 806 | */ |
804 | int zfcp_fsf_status_read(struct zfcp_adapter *adapter) | 807 | int zfcp_fsf_status_read(struct zfcp_qdio *qdio) |
805 | { | 808 | { |
809 | struct zfcp_adapter *adapter = qdio->adapter; | ||
806 | struct zfcp_fsf_req *req; | 810 | struct zfcp_fsf_req *req; |
807 | struct fsf_status_read_buffer *sr_buf; | 811 | struct fsf_status_read_buffer *sr_buf; |
808 | struct qdio_buffer_element *sbale; | 812 | struct qdio_buffer_element *sbale; |
809 | int retval = -EIO; | 813 | int retval = -EIO; |
810 | 814 | ||
811 | spin_lock_bh(&adapter->req_q_lock); | 815 | spin_lock_bh(&qdio->req_q_lock); |
812 | if (zfcp_fsf_req_sbal_get(adapter)) | 816 | if (zfcp_fsf_req_sbal_get(qdio)) |
813 | goto out; | 817 | goto out; |
814 | 818 | ||
815 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_UNSOLICITED_STATUS, | 819 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_UNSOLICITED_STATUS, |
816 | adapter->pool.status_read_req); | 820 | adapter->pool.status_read_req); |
817 | if (IS_ERR(req)) { | 821 | if (IS_ERR(req)) { |
818 | retval = PTR_ERR(req); | 822 | retval = PTR_ERR(req); |
819 | goto out; | 823 | goto out; |
820 | } | 824 | } |
821 | 825 | ||
822 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 826 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
823 | sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY; | 827 | sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY; |
824 | req->queue_req.sbale_curr = 2; | 828 | req->queue_req.sbale_curr = 2; |
825 | 829 | ||
@@ -830,7 +834,7 @@ int zfcp_fsf_status_read(struct zfcp_adapter *adapter) | |||
830 | } | 834 | } |
831 | memset(sr_buf, 0, sizeof(*sr_buf)); | 835 | memset(sr_buf, 0, sizeof(*sr_buf)); |
832 | req->data = sr_buf; | 836 | req->data = sr_buf; |
833 | sbale = zfcp_qdio_sbale_curr(adapter, &req->queue_req); | 837 | sbale = zfcp_qdio_sbale_curr(qdio, &req->queue_req); |
834 | sbale->addr = (void *) sr_buf; | 838 | sbale->addr = (void *) sr_buf; |
835 | sbale->length = sizeof(*sr_buf); | 839 | sbale->length = sizeof(*sr_buf); |
836 | 840 | ||
@@ -846,7 +850,7 @@ failed_buf: | |||
846 | zfcp_fsf_req_free(req); | 850 | zfcp_fsf_req_free(req); |
847 | zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL); | 851 | zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL); |
848 | out: | 852 | out: |
849 | spin_unlock_bh(&adapter->req_q_lock); | 853 | spin_unlock_bh(&qdio->req_q_lock); |
850 | return retval; | 854 | return retval; |
851 | } | 855 | } |
852 | 856 | ||
@@ -913,13 +917,13 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id, | |||
913 | { | 917 | { |
914 | struct qdio_buffer_element *sbale; | 918 | struct qdio_buffer_element *sbale; |
915 | struct zfcp_fsf_req *req = NULL; | 919 | struct zfcp_fsf_req *req = NULL; |
916 | struct zfcp_adapter *adapter = unit->port->adapter; | 920 | struct zfcp_qdio *qdio = unit->port->adapter->qdio; |
917 | 921 | ||
918 | spin_lock_bh(&adapter->req_q_lock); | 922 | spin_lock_bh(&qdio->req_q_lock); |
919 | if (zfcp_fsf_req_sbal_get(adapter)) | 923 | if (zfcp_fsf_req_sbal_get(qdio)) |
920 | goto out; | 924 | goto out; |
921 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, | 925 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND, |
922 | adapter->pool.scsi_abort); | 926 | qdio->adapter->pool.scsi_abort); |
923 | if (IS_ERR(req)) { | 927 | if (IS_ERR(req)) { |
924 | req = NULL; | 928 | req = NULL; |
925 | goto out; | 929 | goto out; |
@@ -929,7 +933,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id, | |||
929 | ZFCP_STATUS_COMMON_UNBLOCKED))) | 933 | ZFCP_STATUS_COMMON_UNBLOCKED))) |
930 | goto out_error_free; | 934 | goto out_error_free; |
931 | 935 | ||
932 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 936 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
933 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 937 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
934 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 938 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
935 | 939 | ||
@@ -947,7 +951,7 @@ out_error_free: | |||
947 | zfcp_fsf_req_free(req); | 951 | zfcp_fsf_req_free(req); |
948 | req = NULL; | 952 | req = NULL; |
949 | out: | 953 | out: |
950 | spin_unlock_bh(&adapter->req_q_lock); | 954 | spin_unlock_bh(&qdio->req_q_lock); |
951 | return req; | 955 | return req; |
952 | } | 956 | } |
953 | 957 | ||
@@ -1024,7 +1028,7 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req, | |||
1024 | int max_sbals) | 1028 | int max_sbals) |
1025 | { | 1029 | { |
1026 | struct zfcp_adapter *adapter = req->adapter; | 1030 | struct zfcp_adapter *adapter = req->adapter; |
1027 | struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(adapter, | 1031 | struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(adapter->qdio, |
1028 | &req->queue_req); | 1032 | &req->queue_req); |
1029 | u32 feat = adapter->adapter_features; | 1033 | u32 feat = adapter->adapter_features; |
1030 | int bytes; | 1034 | int bytes; |
@@ -1043,7 +1047,7 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req, | |||
1043 | return 0; | 1047 | return 0; |
1044 | } | 1048 | } |
1045 | 1049 | ||
1046 | bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req, | 1050 | bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->queue_req, |
1047 | SBAL_FLAGS0_TYPE_WRITE_READ, | 1051 | SBAL_FLAGS0_TYPE_WRITE_READ, |
1048 | sg_req, max_sbals); | 1052 | sg_req, max_sbals); |
1049 | if (bytes <= 0) | 1053 | if (bytes <= 0) |
@@ -1051,7 +1055,7 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req, | |||
1051 | req->qtcb->bottom.support.req_buf_length = bytes; | 1055 | req->qtcb->bottom.support.req_buf_length = bytes; |
1052 | req->queue_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL; | 1056 | req->queue_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL; |
1053 | 1057 | ||
1054 | bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req, | 1058 | bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->queue_req, |
1055 | SBAL_FLAGS0_TYPE_WRITE_READ, | 1059 | SBAL_FLAGS0_TYPE_WRITE_READ, |
1056 | sg_resp, max_sbals); | 1060 | sg_resp, max_sbals); |
1057 | if (bytes <= 0) | 1061 | if (bytes <= 0) |
@@ -1071,15 +1075,15 @@ int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool, | |||
1071 | struct zfcp_erp_action *erp_action) | 1075 | struct zfcp_erp_action *erp_action) |
1072 | { | 1076 | { |
1073 | struct zfcp_wka_port *wka_port = ct->wka_port; | 1077 | struct zfcp_wka_port *wka_port = ct->wka_port; |
1074 | struct zfcp_adapter *adapter = wka_port->adapter; | 1078 | struct zfcp_qdio *qdio = wka_port->adapter->qdio; |
1075 | struct zfcp_fsf_req *req; | 1079 | struct zfcp_fsf_req *req; |
1076 | int ret = -EIO; | 1080 | int ret = -EIO; |
1077 | 1081 | ||
1078 | spin_lock_bh(&adapter->req_q_lock); | 1082 | spin_lock_bh(&qdio->req_q_lock); |
1079 | if (zfcp_fsf_req_sbal_get(adapter)) | 1083 | if (zfcp_fsf_req_sbal_get(qdio)) |
1080 | goto out; | 1084 | goto out; |
1081 | 1085 | ||
1082 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC, pool); | 1086 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_GENERIC, pool); |
1083 | 1087 | ||
1084 | if (IS_ERR(req)) { | 1088 | if (IS_ERR(req)) { |
1085 | ret = PTR_ERR(req); | 1089 | ret = PTR_ERR(req); |
@@ -1118,7 +1122,7 @@ failed_send: | |||
1118 | if (erp_action) | 1122 | if (erp_action) |
1119 | erp_action->fsf_req = NULL; | 1123 | erp_action->fsf_req = NULL; |
1120 | out: | 1124 | out: |
1121 | spin_unlock_bh(&adapter->req_q_lock); | 1125 | spin_unlock_bh(&qdio->req_q_lock); |
1122 | return ret; | 1126 | return ret; |
1123 | } | 1127 | } |
1124 | 1128 | ||
@@ -1181,15 +1185,15 @@ skip_fsfstatus: | |||
1181 | int zfcp_fsf_send_els(struct zfcp_send_els *els) | 1185 | int zfcp_fsf_send_els(struct zfcp_send_els *els) |
1182 | { | 1186 | { |
1183 | struct zfcp_fsf_req *req; | 1187 | struct zfcp_fsf_req *req; |
1184 | struct zfcp_adapter *adapter = els->adapter; | 1188 | struct zfcp_qdio *qdio = els->adapter->qdio; |
1185 | struct fsf_qtcb_bottom_support *bottom; | 1189 | struct fsf_qtcb_bottom_support *bottom; |
1186 | int ret = -EIO; | 1190 | int ret = -EIO; |
1187 | 1191 | ||
1188 | spin_lock_bh(&adapter->req_q_lock); | 1192 | spin_lock_bh(&qdio->req_q_lock); |
1189 | if (zfcp_fsf_req_sbal_get(adapter)) | 1193 | if (zfcp_fsf_req_sbal_get(qdio)) |
1190 | goto out; | 1194 | goto out; |
1191 | 1195 | ||
1192 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS, NULL); | 1196 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_ELS, NULL); |
1193 | 1197 | ||
1194 | if (IS_ERR(req)) { | 1198 | if (IS_ERR(req)) { |
1195 | ret = PTR_ERR(req); | 1199 | ret = PTR_ERR(req); |
@@ -1221,7 +1225,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els) | |||
1221 | failed_send: | 1225 | failed_send: |
1222 | zfcp_fsf_req_free(req); | 1226 | zfcp_fsf_req_free(req); |
1223 | out: | 1227 | out: |
1224 | spin_unlock_bh(&adapter->req_q_lock); | 1228 | spin_unlock_bh(&qdio->req_q_lock); |
1225 | return ret; | 1229 | return ret; |
1226 | } | 1230 | } |
1227 | 1231 | ||
@@ -1229,15 +1233,15 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) | |||
1229 | { | 1233 | { |
1230 | struct qdio_buffer_element *sbale; | 1234 | struct qdio_buffer_element *sbale; |
1231 | struct zfcp_fsf_req *req; | 1235 | struct zfcp_fsf_req *req; |
1232 | struct zfcp_adapter *adapter = erp_action->adapter; | 1236 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; |
1233 | int retval = -EIO; | 1237 | int retval = -EIO; |
1234 | 1238 | ||
1235 | spin_lock_bh(&adapter->req_q_lock); | 1239 | spin_lock_bh(&qdio->req_q_lock); |
1236 | if (zfcp_fsf_req_sbal_get(adapter)) | 1240 | if (zfcp_fsf_req_sbal_get(qdio)) |
1237 | goto out; | 1241 | goto out; |
1238 | 1242 | ||
1239 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, | 1243 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, |
1240 | adapter->pool.erp_req); | 1244 | qdio->adapter->pool.erp_req); |
1241 | 1245 | ||
1242 | if (IS_ERR(req)) { | 1246 | if (IS_ERR(req)) { |
1243 | retval = PTR_ERR(req); | 1247 | retval = PTR_ERR(req); |
@@ -1245,7 +1249,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) | |||
1245 | } | 1249 | } |
1246 | 1250 | ||
1247 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 1251 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
1248 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1252 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1249 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1253 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1250 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1254 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1251 | 1255 | ||
@@ -1265,29 +1269,29 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) | |||
1265 | erp_action->fsf_req = NULL; | 1269 | erp_action->fsf_req = NULL; |
1266 | } | 1270 | } |
1267 | out: | 1271 | out: |
1268 | spin_unlock_bh(&adapter->req_q_lock); | 1272 | spin_unlock_bh(&qdio->req_q_lock); |
1269 | return retval; | 1273 | return retval; |
1270 | } | 1274 | } |
1271 | 1275 | ||
1272 | int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter, | 1276 | int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio, |
1273 | struct fsf_qtcb_bottom_config *data) | 1277 | struct fsf_qtcb_bottom_config *data) |
1274 | { | 1278 | { |
1275 | struct qdio_buffer_element *sbale; | 1279 | struct qdio_buffer_element *sbale; |
1276 | struct zfcp_fsf_req *req = NULL; | 1280 | struct zfcp_fsf_req *req = NULL; |
1277 | int retval = -EIO; | 1281 | int retval = -EIO; |
1278 | 1282 | ||
1279 | spin_lock_bh(&adapter->req_q_lock); | 1283 | spin_lock_bh(&qdio->req_q_lock); |
1280 | if (zfcp_fsf_req_sbal_get(adapter)) | 1284 | if (zfcp_fsf_req_sbal_get(qdio)) |
1281 | goto out_unlock; | 1285 | goto out_unlock; |
1282 | 1286 | ||
1283 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, NULL); | 1287 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, NULL); |
1284 | 1288 | ||
1285 | if (IS_ERR(req)) { | 1289 | if (IS_ERR(req)) { |
1286 | retval = PTR_ERR(req); | 1290 | retval = PTR_ERR(req); |
1287 | goto out_unlock; | 1291 | goto out_unlock; |
1288 | } | 1292 | } |
1289 | 1293 | ||
1290 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1294 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1291 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1295 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1292 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1296 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1293 | req->handler = zfcp_fsf_exchange_config_data_handler; | 1297 | req->handler = zfcp_fsf_exchange_config_data_handler; |
@@ -1303,7 +1307,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter, | |||
1303 | 1307 | ||
1304 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 1308 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
1305 | retval = zfcp_fsf_req_send(req); | 1309 | retval = zfcp_fsf_req_send(req); |
1306 | spin_unlock_bh(&adapter->req_q_lock); | 1310 | spin_unlock_bh(&qdio->req_q_lock); |
1307 | if (!retval) | 1311 | if (!retval) |
1308 | wait_for_completion(&req->completion); | 1312 | wait_for_completion(&req->completion); |
1309 | 1313 | ||
@@ -1311,7 +1315,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter, | |||
1311 | return retval; | 1315 | return retval; |
1312 | 1316 | ||
1313 | out_unlock: | 1317 | out_unlock: |
1314 | spin_unlock_bh(&adapter->req_q_lock); | 1318 | spin_unlock_bh(&qdio->req_q_lock); |
1315 | return retval; | 1319 | return retval; |
1316 | } | 1320 | } |
1317 | 1321 | ||
@@ -1322,20 +1326,20 @@ out_unlock: | |||
1322 | */ | 1326 | */ |
1323 | int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) | 1327 | int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) |
1324 | { | 1328 | { |
1329 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; | ||
1325 | struct qdio_buffer_element *sbale; | 1330 | struct qdio_buffer_element *sbale; |
1326 | struct zfcp_fsf_req *req; | 1331 | struct zfcp_fsf_req *req; |
1327 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
1328 | int retval = -EIO; | 1332 | int retval = -EIO; |
1329 | 1333 | ||
1330 | if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) | 1334 | if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) |
1331 | return -EOPNOTSUPP; | 1335 | return -EOPNOTSUPP; |
1332 | 1336 | ||
1333 | spin_lock_bh(&adapter->req_q_lock); | 1337 | spin_lock_bh(&qdio->req_q_lock); |
1334 | if (zfcp_fsf_req_sbal_get(adapter)) | 1338 | if (zfcp_fsf_req_sbal_get(qdio)) |
1335 | goto out; | 1339 | goto out; |
1336 | 1340 | ||
1337 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, | 1341 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, |
1338 | adapter->pool.erp_req); | 1342 | qdio->adapter->pool.erp_req); |
1339 | 1343 | ||
1340 | if (IS_ERR(req)) { | 1344 | if (IS_ERR(req)) { |
1341 | retval = PTR_ERR(req); | 1345 | retval = PTR_ERR(req); |
@@ -1343,7 +1347,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) | |||
1343 | } | 1347 | } |
1344 | 1348 | ||
1345 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 1349 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
1346 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1350 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1347 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1351 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1348 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1352 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1349 | 1353 | ||
@@ -1358,31 +1362,31 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) | |||
1358 | erp_action->fsf_req = NULL; | 1362 | erp_action->fsf_req = NULL; |
1359 | } | 1363 | } |
1360 | out: | 1364 | out: |
1361 | spin_unlock_bh(&adapter->req_q_lock); | 1365 | spin_unlock_bh(&qdio->req_q_lock); |
1362 | return retval; | 1366 | return retval; |
1363 | } | 1367 | } |
1364 | 1368 | ||
1365 | /** | 1369 | /** |
1366 | * zfcp_fsf_exchange_port_data_sync - request information about local port | 1370 | * zfcp_fsf_exchange_port_data_sync - request information about local port |
1367 | * @adapter: pointer to struct zfcp_adapter | 1371 | * @qdio: pointer to struct zfcp_qdio |
1368 | * @data: pointer to struct fsf_qtcb_bottom_port | 1372 | * @data: pointer to struct fsf_qtcb_bottom_port |
1369 | * Returns: 0 on success, error otherwise | 1373 | * Returns: 0 on success, error otherwise |
1370 | */ | 1374 | */ |
1371 | int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter, | 1375 | int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio, |
1372 | struct fsf_qtcb_bottom_port *data) | 1376 | struct fsf_qtcb_bottom_port *data) |
1373 | { | 1377 | { |
1374 | struct qdio_buffer_element *sbale; | 1378 | struct qdio_buffer_element *sbale; |
1375 | struct zfcp_fsf_req *req = NULL; | 1379 | struct zfcp_fsf_req *req = NULL; |
1376 | int retval = -EIO; | 1380 | int retval = -EIO; |
1377 | 1381 | ||
1378 | if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) | 1382 | if (!(qdio->adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) |
1379 | return -EOPNOTSUPP; | 1383 | return -EOPNOTSUPP; |
1380 | 1384 | ||
1381 | spin_lock_bh(&adapter->req_q_lock); | 1385 | spin_lock_bh(&qdio->req_q_lock); |
1382 | if (zfcp_fsf_req_sbal_get(adapter)) | 1386 | if (zfcp_fsf_req_sbal_get(qdio)) |
1383 | goto out_unlock; | 1387 | goto out_unlock; |
1384 | 1388 | ||
1385 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, NULL); | 1389 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, NULL); |
1386 | 1390 | ||
1387 | if (IS_ERR(req)) { | 1391 | if (IS_ERR(req)) { |
1388 | retval = PTR_ERR(req); | 1392 | retval = PTR_ERR(req); |
@@ -1392,14 +1396,14 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter, | |||
1392 | if (data) | 1396 | if (data) |
1393 | req->data = data; | 1397 | req->data = data; |
1394 | 1398 | ||
1395 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1399 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1396 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1400 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1397 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1401 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1398 | 1402 | ||
1399 | req->handler = zfcp_fsf_exchange_port_data_handler; | 1403 | req->handler = zfcp_fsf_exchange_port_data_handler; |
1400 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 1404 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
1401 | retval = zfcp_fsf_req_send(req); | 1405 | retval = zfcp_fsf_req_send(req); |
1402 | spin_unlock_bh(&adapter->req_q_lock); | 1406 | spin_unlock_bh(&qdio->req_q_lock); |
1403 | 1407 | ||
1404 | if (!retval) | 1408 | if (!retval) |
1405 | wait_for_completion(&req->completion); | 1409 | wait_for_completion(&req->completion); |
@@ -1409,7 +1413,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter, | |||
1409 | return retval; | 1413 | return retval; |
1410 | 1414 | ||
1411 | out_unlock: | 1415 | out_unlock: |
1412 | spin_unlock_bh(&adapter->req_q_lock); | 1416 | spin_unlock_bh(&qdio->req_q_lock); |
1413 | return retval; | 1417 | return retval; |
1414 | } | 1418 | } |
1415 | 1419 | ||
@@ -1495,17 +1499,17 @@ out: | |||
1495 | int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | 1499 | int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) |
1496 | { | 1500 | { |
1497 | struct qdio_buffer_element *sbale; | 1501 | struct qdio_buffer_element *sbale; |
1498 | struct zfcp_adapter *adapter = erp_action->adapter; | 1502 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; |
1499 | struct zfcp_fsf_req *req; | ||
1500 | struct zfcp_port *port = erp_action->port; | 1503 | struct zfcp_port *port = erp_action->port; |
1504 | struct zfcp_fsf_req *req; | ||
1501 | int retval = -EIO; | 1505 | int retval = -EIO; |
1502 | 1506 | ||
1503 | spin_lock_bh(&adapter->req_q_lock); | 1507 | spin_lock_bh(&qdio->req_q_lock); |
1504 | if (zfcp_fsf_req_sbal_get(adapter)) | 1508 | if (zfcp_fsf_req_sbal_get(qdio)) |
1505 | goto out; | 1509 | goto out; |
1506 | 1510 | ||
1507 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_OPEN_PORT_WITH_DID, | 1511 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, |
1508 | adapter->pool.erp_req); | 1512 | qdio->adapter->pool.erp_req); |
1509 | 1513 | ||
1510 | if (IS_ERR(req)) { | 1514 | if (IS_ERR(req)) { |
1511 | retval = PTR_ERR(req); | 1515 | retval = PTR_ERR(req); |
@@ -1513,7 +1517,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | |||
1513 | } | 1517 | } |
1514 | 1518 | ||
1515 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 1519 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
1516 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1520 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1517 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1521 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1518 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1522 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1519 | 1523 | ||
@@ -1532,7 +1536,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | |||
1532 | zfcp_port_put(port); | 1536 | zfcp_port_put(port); |
1533 | } | 1537 | } |
1534 | out: | 1538 | out: |
1535 | spin_unlock_bh(&adapter->req_q_lock); | 1539 | spin_unlock_bh(&qdio->req_q_lock); |
1536 | return retval; | 1540 | return retval; |
1537 | } | 1541 | } |
1538 | 1542 | ||
@@ -1566,16 +1570,16 @@ static void zfcp_fsf_close_port_handler(struct zfcp_fsf_req *req) | |||
1566 | int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) | 1570 | int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) |
1567 | { | 1571 | { |
1568 | struct qdio_buffer_element *sbale; | 1572 | struct qdio_buffer_element *sbale; |
1569 | struct zfcp_adapter *adapter = erp_action->adapter; | 1573 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; |
1570 | struct zfcp_fsf_req *req; | 1574 | struct zfcp_fsf_req *req; |
1571 | int retval = -EIO; | 1575 | int retval = -EIO; |
1572 | 1576 | ||
1573 | spin_lock_bh(&adapter->req_q_lock); | 1577 | spin_lock_bh(&qdio->req_q_lock); |
1574 | if (zfcp_fsf_req_sbal_get(adapter)) | 1578 | if (zfcp_fsf_req_sbal_get(qdio)) |
1575 | goto out; | 1579 | goto out; |
1576 | 1580 | ||
1577 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PORT, | 1581 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, |
1578 | adapter->pool.erp_req); | 1582 | qdio->adapter->pool.erp_req); |
1579 | 1583 | ||
1580 | if (IS_ERR(req)) { | 1584 | if (IS_ERR(req)) { |
1581 | retval = PTR_ERR(req); | 1585 | retval = PTR_ERR(req); |
@@ -1583,7 +1587,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) | |||
1583 | } | 1587 | } |
1584 | 1588 | ||
1585 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 1589 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
1586 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1590 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1587 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1591 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1588 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1592 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1589 | 1593 | ||
@@ -1600,7 +1604,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) | |||
1600 | erp_action->fsf_req = NULL; | 1604 | erp_action->fsf_req = NULL; |
1601 | } | 1605 | } |
1602 | out: | 1606 | out: |
1603 | spin_unlock_bh(&adapter->req_q_lock); | 1607 | spin_unlock_bh(&qdio->req_q_lock); |
1604 | return retval; | 1608 | return retval; |
1605 | } | 1609 | } |
1606 | 1610 | ||
@@ -1643,16 +1647,16 @@ out: | |||
1643 | int zfcp_fsf_open_wka_port(struct zfcp_wka_port *wka_port) | 1647 | int zfcp_fsf_open_wka_port(struct zfcp_wka_port *wka_port) |
1644 | { | 1648 | { |
1645 | struct qdio_buffer_element *sbale; | 1649 | struct qdio_buffer_element *sbale; |
1646 | struct zfcp_adapter *adapter = wka_port->adapter; | 1650 | struct zfcp_qdio *qdio = wka_port->adapter->qdio; |
1647 | struct zfcp_fsf_req *req; | 1651 | struct zfcp_fsf_req *req; |
1648 | int retval = -EIO; | 1652 | int retval = -EIO; |
1649 | 1653 | ||
1650 | spin_lock_bh(&adapter->req_q_lock); | 1654 | spin_lock_bh(&qdio->req_q_lock); |
1651 | if (zfcp_fsf_req_sbal_get(adapter)) | 1655 | if (zfcp_fsf_req_sbal_get(qdio)) |
1652 | goto out; | 1656 | goto out; |
1653 | 1657 | ||
1654 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_OPEN_PORT_WITH_DID, | 1658 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, |
1655 | adapter->pool.erp_req); | 1659 | qdio->adapter->pool.erp_req); |
1656 | 1660 | ||
1657 | if (unlikely(IS_ERR(req))) { | 1661 | if (unlikely(IS_ERR(req))) { |
1658 | retval = PTR_ERR(req); | 1662 | retval = PTR_ERR(req); |
@@ -1660,7 +1664,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_wka_port *wka_port) | |||
1660 | } | 1664 | } |
1661 | 1665 | ||
1662 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 1666 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
1663 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1667 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1664 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1668 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1665 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1669 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1666 | 1670 | ||
@@ -1673,7 +1677,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_wka_port *wka_port) | |||
1673 | if (retval) | 1677 | if (retval) |
1674 | zfcp_fsf_req_free(req); | 1678 | zfcp_fsf_req_free(req); |
1675 | out: | 1679 | out: |
1676 | spin_unlock_bh(&adapter->req_q_lock); | 1680 | spin_unlock_bh(&qdio->req_q_lock); |
1677 | return retval; | 1681 | return retval; |
1678 | } | 1682 | } |
1679 | 1683 | ||
@@ -1698,16 +1702,16 @@ static void zfcp_fsf_close_wka_port_handler(struct zfcp_fsf_req *req) | |||
1698 | int zfcp_fsf_close_wka_port(struct zfcp_wka_port *wka_port) | 1702 | int zfcp_fsf_close_wka_port(struct zfcp_wka_port *wka_port) |
1699 | { | 1703 | { |
1700 | struct qdio_buffer_element *sbale; | 1704 | struct qdio_buffer_element *sbale; |
1701 | struct zfcp_adapter *adapter = wka_port->adapter; | 1705 | struct zfcp_qdio *qdio = wka_port->adapter->qdio; |
1702 | struct zfcp_fsf_req *req; | 1706 | struct zfcp_fsf_req *req; |
1703 | int retval = -EIO; | 1707 | int retval = -EIO; |
1704 | 1708 | ||
1705 | spin_lock_bh(&adapter->req_q_lock); | 1709 | spin_lock_bh(&qdio->req_q_lock); |
1706 | if (zfcp_fsf_req_sbal_get(adapter)) | 1710 | if (zfcp_fsf_req_sbal_get(qdio)) |
1707 | goto out; | 1711 | goto out; |
1708 | 1712 | ||
1709 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PORT, | 1713 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, |
1710 | adapter->pool.erp_req); | 1714 | qdio->adapter->pool.erp_req); |
1711 | 1715 | ||
1712 | if (unlikely(IS_ERR(req))) { | 1716 | if (unlikely(IS_ERR(req))) { |
1713 | retval = PTR_ERR(req); | 1717 | retval = PTR_ERR(req); |
@@ -1715,7 +1719,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_wka_port *wka_port) | |||
1715 | } | 1719 | } |
1716 | 1720 | ||
1717 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 1721 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
1718 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1722 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1719 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1723 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1720 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1724 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1721 | 1725 | ||
@@ -1728,7 +1732,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_wka_port *wka_port) | |||
1728 | if (retval) | 1732 | if (retval) |
1729 | zfcp_fsf_req_free(req); | 1733 | zfcp_fsf_req_free(req); |
1730 | out: | 1734 | out: |
1731 | spin_unlock_bh(&adapter->req_q_lock); | 1735 | spin_unlock_bh(&qdio->req_q_lock); |
1732 | return retval; | 1736 | return retval; |
1733 | } | 1737 | } |
1734 | 1738 | ||
@@ -1790,16 +1794,16 @@ static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req) | |||
1790 | int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) | 1794 | int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) |
1791 | { | 1795 | { |
1792 | struct qdio_buffer_element *sbale; | 1796 | struct qdio_buffer_element *sbale; |
1793 | struct zfcp_adapter *adapter = erp_action->adapter; | 1797 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; |
1794 | struct zfcp_fsf_req *req; | 1798 | struct zfcp_fsf_req *req; |
1795 | int retval = -EIO; | 1799 | int retval = -EIO; |
1796 | 1800 | ||
1797 | spin_lock_bh(&adapter->req_q_lock); | 1801 | spin_lock_bh(&qdio->req_q_lock); |
1798 | if (zfcp_fsf_req_sbal_get(adapter)) | 1802 | if (zfcp_fsf_req_sbal_get(qdio)) |
1799 | goto out; | 1803 | goto out; |
1800 | 1804 | ||
1801 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PHYSICAL_PORT, | 1805 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PHYSICAL_PORT, |
1802 | adapter->pool.erp_req); | 1806 | qdio->adapter->pool.erp_req); |
1803 | 1807 | ||
1804 | if (IS_ERR(req)) { | 1808 | if (IS_ERR(req)) { |
1805 | retval = PTR_ERR(req); | 1809 | retval = PTR_ERR(req); |
@@ -1807,7 +1811,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) | |||
1807 | } | 1811 | } |
1808 | 1812 | ||
1809 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 1813 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
1810 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1814 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1811 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1815 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1812 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1816 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1813 | 1817 | ||
@@ -1824,7 +1828,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) | |||
1824 | erp_action->fsf_req = NULL; | 1828 | erp_action->fsf_req = NULL; |
1825 | } | 1829 | } |
1826 | out: | 1830 | out: |
1827 | spin_unlock_bh(&adapter->req_q_lock); | 1831 | spin_unlock_bh(&qdio->req_q_lock); |
1828 | return retval; | 1832 | return retval; |
1829 | } | 1833 | } |
1830 | 1834 | ||
@@ -1964,14 +1968,15 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) | |||
1964 | { | 1968 | { |
1965 | struct qdio_buffer_element *sbale; | 1969 | struct qdio_buffer_element *sbale; |
1966 | struct zfcp_adapter *adapter = erp_action->adapter; | 1970 | struct zfcp_adapter *adapter = erp_action->adapter; |
1971 | struct zfcp_qdio *qdio = adapter->qdio; | ||
1967 | struct zfcp_fsf_req *req; | 1972 | struct zfcp_fsf_req *req; |
1968 | int retval = -EIO; | 1973 | int retval = -EIO; |
1969 | 1974 | ||
1970 | spin_lock_bh(&adapter->req_q_lock); | 1975 | spin_lock_bh(&qdio->req_q_lock); |
1971 | if (zfcp_fsf_req_sbal_get(adapter)) | 1976 | if (zfcp_fsf_req_sbal_get(qdio)) |
1972 | goto out; | 1977 | goto out; |
1973 | 1978 | ||
1974 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_OPEN_LUN, | 1979 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_LUN, |
1975 | adapter->pool.erp_req); | 1980 | adapter->pool.erp_req); |
1976 | 1981 | ||
1977 | if (IS_ERR(req)) { | 1982 | if (IS_ERR(req)) { |
@@ -1980,7 +1985,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) | |||
1980 | } | 1985 | } |
1981 | 1986 | ||
1982 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 1987 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
1983 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 1988 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
1984 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 1989 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1985 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 1990 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1986 | 1991 | ||
@@ -2001,7 +2006,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) | |||
2001 | erp_action->fsf_req = NULL; | 2006 | erp_action->fsf_req = NULL; |
2002 | } | 2007 | } |
2003 | out: | 2008 | out: |
2004 | spin_unlock_bh(&adapter->req_q_lock); | 2009 | spin_unlock_bh(&qdio->req_q_lock); |
2005 | return retval; | 2010 | return retval; |
2006 | } | 2011 | } |
2007 | 2012 | ||
@@ -2050,16 +2055,16 @@ static void zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *req) | |||
2050 | int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) | 2055 | int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) |
2051 | { | 2056 | { |
2052 | struct qdio_buffer_element *sbale; | 2057 | struct qdio_buffer_element *sbale; |
2053 | struct zfcp_adapter *adapter = erp_action->adapter; | 2058 | struct zfcp_qdio *qdio = erp_action->adapter->qdio; |
2054 | struct zfcp_fsf_req *req; | 2059 | struct zfcp_fsf_req *req; |
2055 | int retval = -EIO; | 2060 | int retval = -EIO; |
2056 | 2061 | ||
2057 | spin_lock_bh(&adapter->req_q_lock); | 2062 | spin_lock_bh(&qdio->req_q_lock); |
2058 | if (zfcp_fsf_req_sbal_get(adapter)) | 2063 | if (zfcp_fsf_req_sbal_get(qdio)) |
2059 | goto out; | 2064 | goto out; |
2060 | 2065 | ||
2061 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_LUN, | 2066 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_LUN, |
2062 | adapter->pool.erp_req); | 2067 | qdio->adapter->pool.erp_req); |
2063 | 2068 | ||
2064 | if (IS_ERR(req)) { | 2069 | if (IS_ERR(req)) { |
2065 | retval = PTR_ERR(req); | 2070 | retval = PTR_ERR(req); |
@@ -2067,7 +2072,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) | |||
2067 | } | 2072 | } |
2068 | 2073 | ||
2069 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; | 2074 | req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; |
2070 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 2075 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
2071 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 2076 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
2072 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 2077 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
2073 | 2078 | ||
@@ -2085,7 +2090,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) | |||
2085 | erp_action->fsf_req = NULL; | 2090 | erp_action->fsf_req = NULL; |
2086 | } | 2091 | } |
2087 | out: | 2092 | out: |
2088 | spin_unlock_bh(&adapter->req_q_lock); | 2093 | spin_unlock_bh(&qdio->req_q_lock); |
2089 | return retval; | 2094 | return retval; |
2090 | } | 2095 | } |
2091 | 2096 | ||
@@ -2353,18 +2358,19 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit, | |||
2353 | unsigned int sbtype = SBAL_FLAGS0_TYPE_READ; | 2358 | unsigned int sbtype = SBAL_FLAGS0_TYPE_READ; |
2354 | int real_bytes, retval = -EIO; | 2359 | int real_bytes, retval = -EIO; |
2355 | struct zfcp_adapter *adapter = unit->port->adapter; | 2360 | struct zfcp_adapter *adapter = unit->port->adapter; |
2361 | struct zfcp_qdio *qdio = adapter->qdio; | ||
2356 | 2362 | ||
2357 | if (unlikely(!(atomic_read(&unit->status) & | 2363 | if (unlikely(!(atomic_read(&unit->status) & |
2358 | ZFCP_STATUS_COMMON_UNBLOCKED))) | 2364 | ZFCP_STATUS_COMMON_UNBLOCKED))) |
2359 | return -EBUSY; | 2365 | return -EBUSY; |
2360 | 2366 | ||
2361 | spin_lock(&adapter->req_q_lock); | 2367 | spin_lock(&qdio->req_q_lock); |
2362 | if (atomic_read(&adapter->req_q.count) <= 0) { | 2368 | if (atomic_read(&qdio->req_q.count) <= 0) { |
2363 | atomic_inc(&adapter->qdio_outb_full); | 2369 | atomic_inc(&qdio->req_q_full); |
2364 | goto out; | 2370 | goto out; |
2365 | } | 2371 | } |
2366 | 2372 | ||
2367 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, | 2373 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, |
2368 | adapter->pool.scsi_req); | 2374 | adapter->pool.scsi_req); |
2369 | 2375 | ||
2370 | if (IS_ERR(req)) { | 2376 | if (IS_ERR(req)) { |
@@ -2424,7 +2430,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit, | |||
2424 | req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) + | 2430 | req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) + |
2425 | fcp_cmnd_iu->add_fcp_cdb_length + sizeof(u32); | 2431 | fcp_cmnd_iu->add_fcp_cdb_length + sizeof(u32); |
2426 | 2432 | ||
2427 | real_bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req, sbtype, | 2433 | real_bytes = zfcp_qdio_sbals_from_sg(qdio, &req->queue_req, sbtype, |
2428 | scsi_sglist(scsi_cmnd), | 2434 | scsi_sglist(scsi_cmnd), |
2429 | FSF_MAX_SBALS_PER_REQ); | 2435 | FSF_MAX_SBALS_PER_REQ); |
2430 | if (unlikely(real_bytes < 0)) { | 2436 | if (unlikely(real_bytes < 0)) { |
@@ -2453,7 +2459,7 @@ failed_scsi_cmnd: | |||
2453 | zfcp_fsf_req_free(req); | 2459 | zfcp_fsf_req_free(req); |
2454 | scsi_cmnd->host_scribble = NULL; | 2460 | scsi_cmnd->host_scribble = NULL; |
2455 | out: | 2461 | out: |
2456 | spin_unlock(&adapter->req_q_lock); | 2462 | spin_unlock(&qdio->req_q_lock); |
2457 | return retval; | 2463 | return retval; |
2458 | } | 2464 | } |
2459 | 2465 | ||
@@ -2468,18 +2474,18 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags) | |||
2468 | struct qdio_buffer_element *sbale; | 2474 | struct qdio_buffer_element *sbale; |
2469 | struct zfcp_fsf_req *req = NULL; | 2475 | struct zfcp_fsf_req *req = NULL; |
2470 | struct fcp_cmnd_iu *fcp_cmnd_iu; | 2476 | struct fcp_cmnd_iu *fcp_cmnd_iu; |
2471 | struct zfcp_adapter *adapter = unit->port->adapter; | 2477 | struct zfcp_qdio *qdio = unit->port->adapter->qdio; |
2472 | 2478 | ||
2473 | if (unlikely(!(atomic_read(&unit->status) & | 2479 | if (unlikely(!(atomic_read(&unit->status) & |
2474 | ZFCP_STATUS_COMMON_UNBLOCKED))) | 2480 | ZFCP_STATUS_COMMON_UNBLOCKED))) |
2475 | return NULL; | 2481 | return NULL; |
2476 | 2482 | ||
2477 | spin_lock_bh(&adapter->req_q_lock); | 2483 | spin_lock_bh(&qdio->req_q_lock); |
2478 | if (zfcp_fsf_req_sbal_get(adapter)) | 2484 | if (zfcp_fsf_req_sbal_get(qdio)) |
2479 | goto out; | 2485 | goto out; |
2480 | 2486 | ||
2481 | req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, | 2487 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, |
2482 | adapter->pool.scsi_req); | 2488 | qdio->adapter->pool.scsi_req); |
2483 | 2489 | ||
2484 | if (IS_ERR(req)) { | 2490 | if (IS_ERR(req)) { |
2485 | req = NULL; | 2491 | req = NULL; |
@@ -2496,7 +2502,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags) | |||
2496 | req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) + | 2502 | req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) + |
2497 | sizeof(u32); | 2503 | sizeof(u32); |
2498 | 2504 | ||
2499 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 2505 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
2500 | sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE; | 2506 | sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE; |
2501 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 2507 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
2502 | 2508 | ||
@@ -2511,7 +2517,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags) | |||
2511 | zfcp_fsf_req_free(req); | 2517 | zfcp_fsf_req_free(req); |
2512 | req = NULL; | 2518 | req = NULL; |
2513 | out: | 2519 | out: |
2514 | spin_unlock_bh(&adapter->req_q_lock); | 2520 | spin_unlock_bh(&qdio->req_q_lock); |
2515 | return req; | 2521 | return req; |
2516 | } | 2522 | } |
2517 | 2523 | ||
@@ -2529,6 +2535,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
2529 | struct zfcp_fsf_cfdc *fsf_cfdc) | 2535 | struct zfcp_fsf_cfdc *fsf_cfdc) |
2530 | { | 2536 | { |
2531 | struct qdio_buffer_element *sbale; | 2537 | struct qdio_buffer_element *sbale; |
2538 | struct zfcp_qdio *qdio = adapter->qdio; | ||
2532 | struct zfcp_fsf_req *req = NULL; | 2539 | struct zfcp_fsf_req *req = NULL; |
2533 | struct fsf_qtcb_bottom_support *bottom; | 2540 | struct fsf_qtcb_bottom_support *bottom; |
2534 | int direction, retval = -EIO, bytes; | 2541 | int direction, retval = -EIO, bytes; |
@@ -2547,11 +2554,11 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
2547 | return ERR_PTR(-EINVAL); | 2554 | return ERR_PTR(-EINVAL); |
2548 | } | 2555 | } |
2549 | 2556 | ||
2550 | spin_lock_bh(&adapter->req_q_lock); | 2557 | spin_lock_bh(&qdio->req_q_lock); |
2551 | if (zfcp_fsf_req_sbal_get(adapter)) | 2558 | if (zfcp_fsf_req_sbal_get(qdio)) |
2552 | goto out; | 2559 | goto out; |
2553 | 2560 | ||
2554 | req = zfcp_fsf_req_create(adapter, fsf_cfdc->command, NULL); | 2561 | req = zfcp_fsf_req_create(qdio, fsf_cfdc->command, NULL); |
2555 | if (IS_ERR(req)) { | 2562 | if (IS_ERR(req)) { |
2556 | retval = -EPERM; | 2563 | retval = -EPERM; |
2557 | goto out; | 2564 | goto out; |
@@ -2559,15 +2566,16 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
2559 | 2566 | ||
2560 | req->handler = zfcp_fsf_control_file_handler; | 2567 | req->handler = zfcp_fsf_control_file_handler; |
2561 | 2568 | ||
2562 | sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | 2569 | sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req); |
2563 | sbale[0].flags |= direction; | 2570 | sbale[0].flags |= direction; |
2564 | 2571 | ||
2565 | bottom = &req->qtcb->bottom.support; | 2572 | bottom = &req->qtcb->bottom.support; |
2566 | bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE; | 2573 | bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE; |
2567 | bottom->option = fsf_cfdc->option; | 2574 | bottom->option = fsf_cfdc->option; |
2568 | 2575 | ||
2569 | bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req, direction, | 2576 | bytes = zfcp_qdio_sbals_from_sg(qdio, &req->queue_req, |
2570 | fsf_cfdc->sg, FSF_MAX_SBALS_PER_REQ); | 2577 | direction, fsf_cfdc->sg, |
2578 | FSF_MAX_SBALS_PER_REQ); | ||
2571 | if (bytes != ZFCP_CFDC_MAX_SIZE) { | 2579 | if (bytes != ZFCP_CFDC_MAX_SIZE) { |
2572 | zfcp_fsf_req_free(req); | 2580 | zfcp_fsf_req_free(req); |
2573 | goto out; | 2581 | goto out; |
@@ -2576,7 +2584,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
2576 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); | 2584 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
2577 | retval = zfcp_fsf_req_send(req); | 2585 | retval = zfcp_fsf_req_send(req); |
2578 | out: | 2586 | out: |
2579 | spin_unlock_bh(&adapter->req_q_lock); | 2587 | spin_unlock_bh(&qdio->req_q_lock); |
2580 | 2588 | ||
2581 | if (!retval) { | 2589 | if (!retval) { |
2582 | wait_for_completion(&req->completion); | 2590 | wait_for_completion(&req->completion); |
@@ -2590,9 +2598,10 @@ out: | |||
2590 | * @adapter: pointer to struct zfcp_adapter | 2598 | * @adapter: pointer to struct zfcp_adapter |
2591 | * @sbal_idx: response queue index of SBAL to be processed | 2599 | * @sbal_idx: response queue index of SBAL to be processed |
2592 | */ | 2600 | */ |
2593 | void zfcp_fsf_reqid_check(struct zfcp_adapter *adapter, int sbal_idx) | 2601 | void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx) |
2594 | { | 2602 | { |
2595 | struct qdio_buffer *sbal = adapter->resp_q.sbal[sbal_idx]; | 2603 | struct zfcp_adapter *adapter = qdio->adapter; |
2604 | struct qdio_buffer *sbal = qdio->resp_q.sbal[sbal_idx]; | ||
2596 | struct qdio_buffer_element *sbale; | 2605 | struct qdio_buffer_element *sbale; |
2597 | struct zfcp_fsf_req *fsf_req; | 2606 | struct zfcp_fsf_req *fsf_req; |
2598 | unsigned long flags, req_id; | 2607 | unsigned long flags, req_id; |
@@ -2618,7 +2627,7 @@ void zfcp_fsf_reqid_check(struct zfcp_adapter *adapter, int sbal_idx) | |||
2618 | 2627 | ||
2619 | fsf_req->queue_req.sbal_response = sbal_idx; | 2628 | fsf_req->queue_req.sbal_response = sbal_idx; |
2620 | fsf_req->queue_req.qdio_inb_usage = | 2629 | fsf_req->queue_req.qdio_inb_usage = |
2621 | atomic_read(&adapter->resp_q.count); | 2630 | atomic_read(&qdio->resp_q.count); |
2622 | zfcp_fsf_req_complete(fsf_req); | 2631 | zfcp_fsf_req_complete(fsf_req); |
2623 | 2632 | ||
2624 | if (likely(sbale->flags & SBAL_FLAGS_LAST_ENTRY)) | 2633 | if (likely(sbale->flags & SBAL_FLAGS_LAST_ENTRY)) |