aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/bnx2i/bnx2i.h9
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c54
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c17
3 files changed, 60 insertions, 20 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 2c34e22493d3..866a22c4413d 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -649,6 +649,7 @@ enum {
649 EP_STATE_OFLD_FAILED = 0x8000000, 649 EP_STATE_OFLD_FAILED = 0x8000000,
650 EP_STATE_CONNECT_FAILED = 0x10000000, 650 EP_STATE_CONNECT_FAILED = 0x10000000,
651 EP_STATE_DISCONN_TIMEDOUT = 0x20000000, 651 EP_STATE_DISCONN_TIMEDOUT = 0x20000000,
652 EP_STATE_OFLD_FAILED_CID_BUSY = 0x80000000,
652}; 653};
653 654
654/** 655/**
@@ -758,11 +759,11 @@ extern int bnx2i_send_iscsi_logout(struct bnx2i_conn *conn,
758 struct iscsi_task *mtask); 759 struct iscsi_task *mtask);
759extern void bnx2i_send_cmd_cleanup_req(struct bnx2i_hba *hba, 760extern void bnx2i_send_cmd_cleanup_req(struct bnx2i_hba *hba,
760 struct bnx2i_cmd *cmd); 761 struct bnx2i_cmd *cmd);
761extern void bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba, 762extern int bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba,
762 struct bnx2i_endpoint *ep);
763extern void bnx2i_update_iscsi_conn(struct iscsi_conn *conn);
764extern void bnx2i_send_conn_destroy(struct bnx2i_hba *hba,
765 struct bnx2i_endpoint *ep); 763 struct bnx2i_endpoint *ep);
764extern void bnx2i_update_iscsi_conn(struct iscsi_conn *conn);
765extern int bnx2i_send_conn_destroy(struct bnx2i_hba *hba,
766 struct bnx2i_endpoint *ep);
766 767
767extern int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, 768extern int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba,
768 struct bnx2i_endpoint *ep); 769 struct bnx2i_endpoint *ep);
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;
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index ac60c4c29e9a..f622e89041cd 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -1682,7 +1682,9 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba,
1682 bnx2i_ep_destroy_list_add(hba, ep); 1682 bnx2i_ep_destroy_list_add(hba, ep);
1683 1683
1684 /* destroy iSCSI context, wait for it to complete */ 1684 /* destroy iSCSI context, wait for it to complete */
1685 bnx2i_send_conn_destroy(hba, ep); 1685 if (bnx2i_send_conn_destroy(hba, ep))
1686 ep->state = EP_STATE_CLEANUP_CMPL;
1687
1686 wait_event_interruptible(ep->ofld_wait, 1688 wait_event_interruptible(ep->ofld_wait,
1687 (ep->state != EP_STATE_CLEANUP_START)); 1689 (ep->state != EP_STATE_CLEANUP_START));
1688 1690
@@ -1781,7 +1783,18 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
1781 bnx2i_ep->ofld_timer.data = (unsigned long) bnx2i_ep; 1783 bnx2i_ep->ofld_timer.data = (unsigned long) bnx2i_ep;
1782 add_timer(&bnx2i_ep->ofld_timer); 1784 add_timer(&bnx2i_ep->ofld_timer);
1783 1785
1784 bnx2i_send_conn_ofld_req(hba, bnx2i_ep); 1786 if (bnx2i_send_conn_ofld_req(hba, bnx2i_ep)) {
1787 if (bnx2i_ep->state == EP_STATE_OFLD_FAILED_CID_BUSY) {
1788 printk(KERN_ALERT "bnx2i (%s): iscsi cid %d is busy\n",
1789 hba->netdev->name, bnx2i_ep->ep_iscsi_cid);
1790 rc = -EBUSY;
1791 } else
1792 rc = -ENOSPC;
1793 printk(KERN_ALERT "bnx2i (%s): unable to send conn offld kwqe"
1794 "\n", hba->netdev->name);
1795 bnx2i_ep_ofld_list_del(hba, bnx2i_ep);
1796 goto conn_failed;
1797 }
1785 1798
1786 /* Wait for CNIC hardware to setup conn context and return 'cid' */ 1799 /* Wait for CNIC hardware to setup conn context and return 'cid' */
1787 wait_event_interruptible(bnx2i_ep->ofld_wait, 1800 wait_event_interruptible(bnx2i_ep->ofld_wait,