aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2i/bnx2i_hwi.c
diff options
context:
space:
mode:
authorEddie Wai <eddie.wai@broadcom.com>2010-11-23 18:29:29 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:24:14 -0500
commitbee348770dcaeafa57bbd32129ce0cb16a4342d6 (patch)
treea25e1730b3652b47963176778c4c67f184fd6c3e /drivers/scsi/bnx2i/bnx2i_hwi.c
parent842158d7b7bc3b1a49c31f43ac20414234c33a8d (diff)
[SCSI] bnx2i: Added return code check for chip kwqe submission request
Added the handling for cases when a chip request is made to the CNIC module but the hardware is not ready to accept. This would lead to many unnecessary wait timeouts. This code adds check in the connect establishment and destruction path. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bnx2i/bnx2i_hwi.c')
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c54
1 files changed, 40 insertions, 14 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 0d40daefd572..6d99040747d6 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -701,10 +701,11 @@ void bnx2i_send_cmd_cleanup_req(struct bnx2i_hba *hba, struct bnx2i_cmd *cmd)
701 * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE to initiate 701 * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE to initiate
702 * iscsi connection context clean-up process 702 * iscsi connection context clean-up process
703 */ 703 */
704void bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) 704int bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
705{ 705{
706 struct kwqe *kwqe_arr[2]; 706 struct kwqe *kwqe_arr[2];
707 struct iscsi_kwqe_conn_destroy conn_cleanup; 707 struct iscsi_kwqe_conn_destroy conn_cleanup;
708 int rc = -EINVAL;
708 709
709 memset(&conn_cleanup, 0x00, sizeof(struct iscsi_kwqe_conn_destroy)); 710 memset(&conn_cleanup, 0x00, sizeof(struct iscsi_kwqe_conn_destroy));
710 711
@@ -721,7 +722,9 @@ void bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
721 722
722 kwqe_arr[0] = (struct kwqe *) &conn_cleanup; 723 kwqe_arr[0] = (struct kwqe *) &conn_cleanup;
723 if (hba->cnic && hba->cnic->submit_kwqes) 724 if (hba->cnic && hba->cnic->submit_kwqes)
724 hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, 1); 725 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, 1);
726
727 return rc;
725} 728}
726 729
727 730
@@ -732,8 +735,8 @@ void bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
732 * 735 *
733 * 5706/5708/5709 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE 736 * 5706/5708/5709 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
734 */ 737 */
735static void bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba, 738static int bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba,
736 struct bnx2i_endpoint *ep) 739 struct bnx2i_endpoint *ep)
737{ 740{
738 struct kwqe *kwqe_arr[2]; 741 struct kwqe *kwqe_arr[2];
739 struct iscsi_kwqe_conn_offload1 ofld_req1; 742 struct iscsi_kwqe_conn_offload1 ofld_req1;
@@ -741,6 +744,7 @@ static void bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba,
741 dma_addr_t dma_addr; 744 dma_addr_t dma_addr;
742 int num_kwqes = 2; 745 int num_kwqes = 2;
743 u32 *ptbl; 746 u32 *ptbl;
747 int rc = -EINVAL;
744 748
745 ofld_req1.hdr.op_code = ISCSI_KWQE_OPCODE_OFFLOAD_CONN1; 749 ofld_req1.hdr.op_code = ISCSI_KWQE_OPCODE_OFFLOAD_CONN1;
746 ofld_req1.hdr.flags = 750 ofld_req1.hdr.flags =
@@ -778,7 +782,9 @@ static void bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba,
778 ofld_req2.num_additional_wqes = 0; 782 ofld_req2.num_additional_wqes = 0;
779 783
780 if (hba->cnic && hba->cnic->submit_kwqes) 784 if (hba->cnic && hba->cnic->submit_kwqes)
781 hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); 785 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes);
786
787 return rc;
782} 788}
783 789
784 790
@@ -789,8 +795,8 @@ static void bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba,
789 * 795 *
790 * 57710 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE 796 * 57710 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
791 */ 797 */
792static void bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba, 798static int bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba,
793 struct bnx2i_endpoint *ep) 799 struct bnx2i_endpoint *ep)
794{ 800{
795 struct kwqe *kwqe_arr[5]; 801 struct kwqe *kwqe_arr[5];
796 struct iscsi_kwqe_conn_offload1 ofld_req1; 802 struct iscsi_kwqe_conn_offload1 ofld_req1;
@@ -799,6 +805,7 @@ static void bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba,
799 dma_addr_t dma_addr; 805 dma_addr_t dma_addr;
800 int num_kwqes = 2; 806 int num_kwqes = 2;
801 u32 *ptbl; 807 u32 *ptbl;
808 int rc = -EINVAL;
802 809
803 ofld_req1.hdr.op_code = ISCSI_KWQE_OPCODE_OFFLOAD_CONN1; 810 ofld_req1.hdr.op_code = ISCSI_KWQE_OPCODE_OFFLOAD_CONN1;
804 ofld_req1.hdr.flags = 811 ofld_req1.hdr.flags =
@@ -844,7 +851,9 @@ static void bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba,
844 num_kwqes += 1; 851 num_kwqes += 1;
845 852
846 if (hba->cnic && hba->cnic->submit_kwqes) 853 if (hba->cnic && hba->cnic->submit_kwqes)
847 hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); 854 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes);
855
856 return rc;
848} 857}
849 858
850/** 859/**
@@ -855,12 +864,16 @@ static void bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba,
855 * 864 *
856 * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE 865 * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE
857 */ 866 */
858void bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) 867int bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
859{ 868{
869 int rc;
870
860 if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) 871 if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type))
861 bnx2i_5771x_send_conn_ofld_req(hba, ep); 872 rc = bnx2i_5771x_send_conn_ofld_req(hba, ep);
862 else 873 else
863 bnx2i_570x_send_conn_ofld_req(hba, ep); 874 rc = bnx2i_570x_send_conn_ofld_req(hba, ep);
875
876 return rc;
864} 877}
865 878
866 879
@@ -2165,11 +2178,24 @@ static void bnx2i_process_ofld_cmpl(struct bnx2i_hba *hba,
2165 } 2178 }
2166 2179
2167 if (ofld_kcqe->completion_status) { 2180 if (ofld_kcqe->completion_status) {
2181 ep->state = EP_STATE_OFLD_FAILED;
2168 if (ofld_kcqe->completion_status == 2182 if (ofld_kcqe->completion_status ==
2169 ISCSI_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE) 2183 ISCSI_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE)
2170 printk(KERN_ALERT "bnx2i: unable to allocate" 2184 printk(KERN_ALERT "bnx2i (%s): ofld1 cmpl - unable "
2171 " iSCSI context resources\n"); 2185 "to allocate iSCSI context resources\n",
2172 ep->state = EP_STATE_OFLD_FAILED; 2186 hba->netdev->name);
2187 else if (ofld_kcqe->completion_status ==
2188 ISCSI_KCQE_COMPLETION_STATUS_INVALID_OPCODE)
2189 printk(KERN_ALERT "bnx2i (%s): ofld1 cmpl - invalid "
2190 "opcode\n", hba->netdev->name);
2191 else if (ofld_kcqe->completion_status ==
2192 ISCSI_KCQE_COMPLETION_STATUS_CID_BUSY)
2193 /* error status code valid only for 5771x chipset */
2194 ep->state = EP_STATE_OFLD_FAILED_CID_BUSY;
2195 else
2196 printk(KERN_ALERT "bnx2i (%s): ofld1 cmpl - invalid "
2197 "error code %d\n", hba->netdev->name,
2198 ofld_kcqe->completion_status);
2173 } else { 2199 } else {
2174 ep->state = EP_STATE_OFLD_COMPL; 2200 ep->state = EP_STATE_OFLD_COMPL;
2175 cid_addr = ofld_kcqe->iscsi_conn_context_id; 2201 cid_addr = ofld_kcqe->iscsi_conn_context_id;