[SCSI] be2iscsi: Fix connection offload to support Dual Chute.
authorJayamohan Kallickal <jayamohank@gmail.com>
Sat, 28 Sep 2013 22:35:50 +0000 (15:35 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 25 Oct 2013 08:58:08 +0000 (09:58 +0100)
The connection is offload to each chute in a round-robin manner
if both the chute is loaded with iSCSI protocol

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/be2iscsi/be_iscsi.c
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/be2iscsi/be_main.h
drivers/scsi/be2iscsi/be_mgmt.c

index 63b2be0f58a8ff97f91e3e6254a931efdb5d15ef..a7cd92c3c383add421a0dc280ed96d68f12d546e 100644 (file)
@@ -194,6 +194,8 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
        struct beiscsi_conn *beiscsi_conn = conn->dd_data;
        struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
        struct beiscsi_hba *phba = iscsi_host_priv(shost);
+       struct hwi_controller *phwi_ctrlr = phba->phwi_ctrlr;
+       struct hwi_wrb_context *pwrb_context;
        struct beiscsi_endpoint *beiscsi_ep;
        struct iscsi_endpoint *ep;
 
@@ -214,9 +216,13 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session,
                return -EEXIST;
        }
 
+       pwrb_context = &phwi_ctrlr->wrb_context[BE_GET_CRI_FROM_CID(
+                                               beiscsi_ep->ep_cid)];
+
        beiscsi_conn->beiscsi_conn_cid = beiscsi_ep->ep_cid;
        beiscsi_conn->ep = beiscsi_ep;
        beiscsi_ep->conn = beiscsi_conn;
+       beiscsi_conn->doorbell_offset = pwrb_context->doorbell_offset;
 
        beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
                    "BS_%d : beiscsi_conn=%p conn=%p ep_cid=%d\n",
index b57e5bd6201885e2199381f927a189dfce81f108..d539b17e4a806ef48a2bd5d58e6e739052fc84e3 100644 (file)
@@ -4585,8 +4585,8 @@ beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn,
        doorbell |= (pwrb_handle->wrb_index & DB_DEF_PDU_WRB_INDEX_MASK)
                             << DB_DEF_PDU_WRB_INDEX_SHIFT;
        doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
-
-       iowrite32(doorbell, phba->db_va + DB_TXULP0_OFFSET);
+       iowrite32(doorbell, phba->db_va +
+                 beiscsi_conn->doorbell_offset);
 }
 
 static void beiscsi_parse_pdu(struct iscsi_conn *conn, itt_t itt,
@@ -4811,7 +4811,8 @@ int beiscsi_iotask_v2(struct iscsi_task *task, struct scatterlist *sg,
                     DB_DEF_PDU_WRB_INDEX_MASK) <<
                     DB_DEF_PDU_WRB_INDEX_SHIFT;
        doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
-       iowrite32(doorbell, phba->db_va + DB_TXULP0_OFFSET);
+       iowrite32(doorbell, phba->db_va +
+                 beiscsi_conn->doorbell_offset);
        return 0;
 }
 
@@ -4866,7 +4867,8 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
                     DB_DEF_PDU_WRB_INDEX_MASK) << DB_DEF_PDU_WRB_INDEX_SHIFT;
        doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
 
-       iowrite32(doorbell, phba->db_va + DB_TXULP0_OFFSET);
+       iowrite32(doorbell, phba->db_va +
+                 beiscsi_conn->doorbell_offset);
        return 0;
 }
 
@@ -4968,7 +4970,8 @@ static int beiscsi_mtask(struct iscsi_task *task)
        doorbell |= (io_task->pwrb_handle->wrb_index &
                     DB_DEF_PDU_WRB_INDEX_MASK) << DB_DEF_PDU_WRB_INDEX_SHIFT;
        doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
-       iowrite32(doorbell, phba->db_va + DB_TXULP0_OFFSET);
+       iowrite32(doorbell, phba->db_va +
+                 beiscsi_conn->doorbell_offset);
        return 0;
 }
 
index e5e0d7e32f04b4bc5aa3d945100eb724c9f84e6a..3fa1e819f42d1765f0126d58443b7aee7763e7c6 100644 (file)
@@ -425,6 +425,7 @@ struct beiscsi_conn {
        struct iscsi_conn *conn;
        struct beiscsi_hba *phba;
        u32 exp_statsn;
+       u32 doorbell_offset;
        u32 beiscsi_conn_cid;
        struct beiscsi_endpoint *ep;
        unsigned short login_in_progress;
index fcb9976e5ec61be6d2f0972a35680283300aaad9..bcddc9fb23a2859a0da676325eb10545dd71eed2 100644 (file)
@@ -628,6 +628,16 @@ unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
        return tag;
 }
 
+/**
+ * mgmt_open_connection()- Establish a TCP CXN
+ * @dst_addr: Destination Address
+ * @beiscsi_ep: ptr to device endpoint struct
+ * @nonemb_cmd: ptr to memory allocated for command
+ *
+ * return
+ *     Success: Tag number of the MBX Command issued
+ *     Failure: Error code
+ **/
 int mgmt_open_connection(struct beiscsi_hba *phba,
                         struct sockaddr *dst_addr,
                         struct beiscsi_endpoint *beiscsi_ep,
@@ -645,14 +655,17 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
        struct phys_addr template_address = { 0, 0 };
        struct phys_addr *ptemplate_address;
        unsigned int tag = 0;
-       unsigned int i;
+       unsigned int i, ulp_num;
        unsigned short cid = beiscsi_ep->ep_cid;
        struct be_sge *sge;
 
        phwi_ctrlr = phba->phwi_ctrlr;
        phwi_context = phwi_ctrlr->phwi_ctxt;
-       def_hdr_id = (unsigned short)HWI_GET_DEF_HDRQ_ID(phba, 0);
-       def_data_id = (unsigned short)HWI_GET_DEF_BUFQ_ID(phba, 0);
+
+       ulp_num = phwi_ctrlr->wrb_context[BE_GET_CRI_FROM_CID(cid)].ulp_num;
+
+       def_hdr_id = (unsigned short)HWI_GET_DEF_HDRQ_ID(phba, ulp_num);
+       def_data_id = (unsigned short)HWI_GET_DEF_BUFQ_ID(phba, ulp_num);
 
        ptemplate_address = &template_address;
        ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address);