Skip to contentSkip to conversation

be2iscsi: Bug Fixes for starting with Non-Zero cid etc

PATCH In review Jayamohan Kallickal 2 participants 2 messages Nov 3, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 be2iscsi: Bug Fixes for starting with Non-Zero cid etc

This patch contains fixes for condition where the first
cid is Non-Zero as well as other bugs.

---
 drivers/scsi/be2iscsi/be_iscsi.c |   11 ++-
 drivers/scsi/be2iscsi/be_main.c  |  164 ++++++++++++++++++++------------------
 drivers/scsi/be2iscsi/be_main.h  |   16 ++--
 drivers/scsi/be2iscsi/be_mgmt.c  |   13 +++-
 drivers/scsi/be2iscsi/be_mgmt.h  |    4 -
 5 files changed, 113 insertions(+), 95 deletions(-)
drivers/scsi/be2iscsi/be_iscsi.c +6 -5
index d587b03..ef11683 100644
@@ -431,9 +431,10 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
 	}
 	SE_DEBUG(DBG_LVL_8, "In beiscsi_open_conn, ep_cid=%d ",
 		 beiscsi_ep->ep_cid);
-	phba->ep_array[beiscsi_ep->ep_cid] = ep;
-	if (beiscsi_ep->ep_cid >
-	    (phba->fw_config.iscsi_cid_start + phba->params.cxns_per_ctrl)) {
+	phba->ep_array[beiscsi_ep->ep_cid -
+		       phba->fw_config.iscsi_cid_start] = ep;
+	if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start +
+				  phba->params.cxns_per_ctrl * 2)) {
 		SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n");
 		return ret;
 	}
@@ -497,7 +498,7 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
 
 	if (phba->state) {
 		ret = -EBUSY;
-		SE_DEBUG(DBG_LVL_1, "The Adapet state is Not UP \n");
+		SE_DEBUG(DBG_LVL_1, "The Adapter state is Not UP \n");
 		return ERR_PTR(ret);
 	}
 
@@ -511,7 +512,7 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,
 	beiscsi_ep->phba = phba;
 
 	if (beiscsi_open_conn(ep, NULL, dst_addr, non_blocking)) {
-		SE_DEBUG(DBG_LVL_1, "Failed in allocate iscsi cid\n");
+		SE_DEBUG(DBG_LVL_1, "Failed in beiscsi_open_conn \n");
 		ret = -ENOMEM;
 		goto free_ep;
 	}
drivers/scsi/be2iscsi/be_main.c +88 -76

435 lines not on this page · raw message

drivers/scsi/be2iscsi/be_main.h +8 -8
index 25e6b20..a82297c 100644
@@ -27,6 +27,7 @@
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_device.h>
+#include <scsi/scsi_netlink.h>
 #include <scsi/scsi_host.h>
 #include <scsi/iscsi_proto.h>
 #include <scsi/libiscsi.h>
@@ -46,23 +47,18 @@
 #define OC_DEVICE_ID3		0x712
 #define OC_DEVICE_ID4		0x222
 
-#define BE2_MAX_SESSIONS	64
+#define BE2_IO_DEPTH		1024
+#define BE2_MAX_SESSIONS	256
 #define BE2_CMDS_PER_CXN	128
-#define BE2_LOGOUTS		BE2_MAX_SESSIONS
 #define BE2_TMFS		16
 #define BE2_NOPOUT_REQ		16
-#define BE2_ASYNCPDUS		BE2_MAX_SESSIONS
-#define BE2_MAX_ICDS		2048
 #define BE2_SGE			32
 #define BE2_DEFPDU_HDR_SZ	64
 #define BE2_DEFPDU_DATA_SZ	8192
-#define BE2_IO_DEPTH \
-	(BE2_MAX_ICDS / 2 - (BE2_LOGOUTS + BE2_TMFS + BE2_NOPOUT_REQ))
 
 #define MAX_CPUS		31
 #define BEISCSI_SGLIST_ELEMENTS	BE2_SGE
 
-#define BEISCSI_MAX_CMNDS	1024	/* Max IO's per Ctrlr sht->can_queue */
 #define BEISCSI_CMD_PER_LUN	128	/* scsi_host->cmd_per_lun */
 #define BEISCSI_MAX_SECTORS	2048	/* scsi_host->max_sectors */
 
@@ -79,6 +75,11 @@
 #define MAX_CMD_SZ			65536
 #define IIOC_SCSI_DATA                  0x05	/* Write Operation */
 
+/* vendor ID used in SCSI netlink calls */
+#define PCI_VENDOR_ID_SERVERENGINES 0x19a2
+#define BEISCSI_VENDOR_ID (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_SERVERENGINES)
+
+
 #define DBG_LVL				0x00000001
 #define DBG_LVL_1			0x00000001
 #define DBG_LVL_2			0x00000002
@@ -802,7 +803,6 @@ struct hwi_controller {
 	struct be_ring default_pdu_hdr;
 	struct be_ring default_pdu_data;
 	struct hwi_context_memory *phwi_ctxt;
-	unsigned short cq_errors[CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN];
 };
 
 enum hwh_type_enum {
drivers/scsi/be2iscsi/be_mgmt.c +11 -2
index 79c2bd5..8bfb574 100644
@@ -20,6 +20,7 @@
 
 #include "be_mgmt.h"
 #include "be_iscsi.h"
+#include <scsi/scsi_transport_iscsi.h>
 
 unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl,
 				struct beiscsi_hba *phba)
@@ -48,6 +49,14 @@ unsigned char mgmt_get_fw_config(struct be_ctrl_info *ctrl,
 					pfw_cfg->ulp[0].sq_base;
 		phba->fw_config.iscsi_cid_count =
 					pfw_cfg->ulp[0].sq_count;
+		if (phba->fw_config.iscsi_cid_count > (BE2_MAX_SESSIONS / 2)) {
+			status = 1;
+			shost_printk(KERN_WARNING, phba->shost,
+			     "FW reported MAX CXNS as %d \t"
+			     "Max Supported = %d. Failing to load \n",
+					phba->fw_config.iscsi_cid_count,
+					BE2_MAX_SESSIONS);
+		}
 	} else {
 		shost_printk(KERN_WARNING, phba->shost,
 			     "Failed in mgmt_get_fw_config \n");
@@ -108,7 +117,6 @@ unsigned char mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
 	return status;
 }
 
-
 unsigned char mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short chute)
 {
 	struct be_ctrl_info *ctrl = &phba->ctrl;
@@ -317,7 +325,8 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
 		struct tcp_connect_and_offload_out *ptcpcnct_out =
 							embedded_payload(wrb);
 
-		ep = phba->ep_array[ptcpcnct_out->cid];
+		ep = phba->ep_array[ptcpcnct_out->cid -
+				    phba->fw_config.iscsi_cid_start];
 		beiscsi_ep = ep->dd_data;
 		beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
 		beiscsi_ep->cid_vld = 1;
drivers/scsi/be2iscsi/be_mgmt.h +0 -4
index 24eaff9..b97c3cd 100644
@@ -248,8 +248,4 @@ unsigned char mgmt_invalidate_connection(struct beiscsi_hba *phba,
 					 unsigned short cid,
 					 unsigned short issue_reset,
 					 unsigned short savecfg_flag);
-
-unsigned char mgmt_fw_cmd(struct be_ctrl_info *ctrl,
-			  struct beiscsi_hba *phba,
-			  char *buf, unsigned int len);
 #endif
Signature · 1 line
1.6.4
#1 lore raw
Quoted 2 lines · Jayamohan Kallickal

This patch contains fixes for condition where the first cid is Non-Zero as well as other bugs.

So traditionally one patch per bug fix, please (and fully described).

Also traditionally bug fixes go in the scsi-rc-fixes-2.6 tree for immediate inclusion ... you've got this paired with an enhancement that would go through scsi-misc-2.6.

James