All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] be2iscsi: Fix retreving MCCQ_WRB in non-embedded Mbox path
@ 2014-03-23 22:10 Jayamohan Kallickal
  2014-03-23 22:10 ` [PATCH 2/4] be2iscsi: relinquishing control after processing 512 CQE Jayamohan Kallickal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jayamohan Kallickal @ 2014-03-23 22:10 UTC (permalink / raw)
  To: jbottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal, John Soni Jose

 Getting WRB for MCCQ posting was done before looking if tag is
 available or not. This lead to increase phba->ctrl.mcc_obj.q.used
 variable and the WARN_ON message was coming from wrb_from_mccq().
 Moved getting wrb from mccq after checking for the tag.

 In wrb_from_mccq(), memset is done before returning wrb ptr.
 Removed memset of mccq wrb from all other functions.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
 drivers/scsi/be2iscsi/be_mgmt.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 088bdf7..712911f 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -447,8 +447,8 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
 					 struct be_dma_mem *nonemb_cmd)
 {
 	struct be_cmd_resp_hdr *resp;
-	struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
-	struct be_sge *mcc_sge = nonembedded_sgl(wrb);
+	struct be_mcc_wrb *wrb;
+	struct be_sge *mcc_sge;
 	unsigned int tag = 0;
 	struct iscsi_bsg_request *bsg_req = job->request;
 	struct be_bsg_vendor_cmd *req = nonemb_cmd->va;
@@ -465,7 +465,6 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
 	req->sector = sector;
 	req->offset = offset;
 	spin_lock(&ctrl->mbox_lock);
-	memset(wrb, 0, sizeof(*wrb));
 
 	switch (bsg_req->rqst_data.h_vendor.vendor_cmd[0]) {
 	case BEISCSI_WRITE_FLASH:
@@ -495,6 +494,8 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
 		return tag;
 	}
 
+	wrb = wrb_from_mccq(phba);
+	mcc_sge = nonembedded_sgl(wrb);
 	be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false,
 			   job->request_payload.sg_cnt);
 	mcc_sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
@@ -525,7 +526,6 @@ int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num)
 	int status = 0;
 
 	spin_lock(&ctrl->mbox_lock);
-	memset(wrb, 0, sizeof(*wrb));
 
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
@@ -702,7 +702,6 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
 		return tag;
 	}
 	wrb = wrb_from_mccq(phba);
-	memset(wrb, 0, sizeof(*wrb));
 	sge = nonembedded_sgl(wrb);
 
 	req = nonemb_cmd->va;
@@ -804,7 +803,7 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
 				int resp_buf_len)
 {
 	struct be_ctrl_info *ctrl = &phba->ctrl;
-	struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
+	struct be_mcc_wrb *wrb;
 	struct be_sge *sge;
 	unsigned int tag;
 	int rc = 0;
@@ -816,7 +815,8 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
 		rc = -ENOMEM;
 		goto free_cmd;
 	}
-	memset(wrb, 0, sizeof(*wrb));
+
+	wrb = wrb_from_mccq(phba);
 	wrb->tag0 |= tag;
 	sge = nonembedded_sgl(wrb);
 
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/4] be2iscsi: relinquishing control after processing 512 CQE
  2014-03-23 22:10 [PATCH 1/4] be2iscsi: Fix retreving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
@ 2014-03-23 22:10 ` Jayamohan Kallickal
  2014-03-23 22:10 ` [PATCH 3/4] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete Jayamohan Kallickal
  2014-03-23 22:10 ` [PATCH 4/4] be2iscsi: Bump the driver version Jayamohan Kallickal
  2 siblings, 0 replies; 4+ messages in thread
From: Jayamohan Kallickal @ 2014-03-23 22:10 UTC (permalink / raw)
  To: jbottomley, linux-scsi, michaelc
  Cc: Jayamohan Kallickal, Minh Tran, John Soni Jose

 stuck in IO poll for a long time. In such cases driver
 did not rearm which could lead to unprocessed eq.Change
 sched iopoll once then check for valid bit of eqe from
 eq in be_iopoll.

Signed-off-by: Minh Tran <minhduc.tran@emulex.com>
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
 drivers/scsi/be2iscsi/be_main.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 9380b55..d5901a7 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -63,6 +63,7 @@
 #define BE2_SGE			32
 #define BE2_DEFPDU_HDR_SZ	64
 #define BE2_DEFPDU_DATA_SZ	8192
+#define BE2_MAX_NUM_CQ_PROC	512
 
 #define MAX_CPUS		64
 #define BEISCSI_MAX_NUM_CPUS	7
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/4] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete
  2014-03-23 22:10 [PATCH 1/4] be2iscsi: Fix retreving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
  2014-03-23 22:10 ` [PATCH 2/4] be2iscsi: relinquishing control after processing 512 CQE Jayamohan Kallickal
@ 2014-03-23 22:10 ` Jayamohan Kallickal
  2014-03-23 22:10 ` [PATCH 4/4] be2iscsi: Bump the driver version Jayamohan Kallickal
  2 siblings, 0 replies; 4+ messages in thread
From: Jayamohan Kallickal @ 2014-03-23 22:10 UTC (permalink / raw)
  To: jbottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal, John Soni Jose

 Even before probe for function was completed, iSCSI Daemon had initiated login
 to target while OS was coming up. The targets which had node.startup=automatic,
 login process was initiated.Since function specific initialization was still in
 progress this lead to kernel panic.
 The reson was MCCQ was not yet created and login Mbx_Cmd was sent on MCCQ.
 wrb_from_mccq() failed with kernel-panic access.

 In this fix, we check  alloc_mcc_tag() if driver initialization is complete or not.
 Based on the result driver continues or return with an Error.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
 drivers/scsi/be2iscsi/be_main.c | 75 +++++++++++++++++++++++++----------------
 drivers/scsi/be2iscsi/be_main.h |  1 +
 2 files changed, 47 insertions(+), 29 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 9be818f..317deee 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -598,6 +598,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev)
 	phba->pcidev = pci_dev_get(pcidev);
 	pci_set_drvdata(pcidev, phba);
 	phba->interface_handle = 0xFFFFFFFF;
+	phba->state = BE_ADAPTER_INIT_PHASE;
 
 	if (iscsi_host_add(shost, &phba->pcidev->dev))
 		goto free_devices;
@@ -895,45 +896,37 @@ static irqreturn_t be_isr_msix(int irq, void *dev_id)
 	struct beiscsi_hba *phba;
 	struct be_eq_entry *eqe = NULL;
 	struct be_queue_info *eq;
-	struct be_queue_info *cq;
 	unsigned int num_eq_processed;
 	struct be_eq_obj *pbe_eq;
 	unsigned long flags;
 
 	pbe_eq = dev_id;
 	eq = &pbe_eq->q;
-	cq = pbe_eq->cq;
-	eqe = queue_tail_node(eq);
 
 	phba = pbe_eq->phba;
-	num_eq_processed = 0;
 	if (blk_iopoll_enabled) {
-		while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
-					& EQE_VALID_MASK) {
-			if (!blk_iopoll_sched_prep(&pbe_eq->iopoll))
-				blk_iopoll_sched(&pbe_eq->iopoll);
-
-			AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
-			queue_tail_inc(eq);
-			eqe = queue_tail_node(eq);
-			num_eq_processed++;
-		}
-	} else {
-		while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
-						& EQE_VALID_MASK) {
-			spin_lock_irqsave(&phba->isr_lock, flags);
-			pbe_eq->todo_cq = true;
-			spin_unlock_irqrestore(&phba->isr_lock, flags);
-			AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
-			queue_tail_inc(eq);
-			eqe = queue_tail_node(eq);
-			num_eq_processed++;
-		}
+		hwi_ring_eq_db(phba, eq->id, 1,	0, 1, 1);
+		if (!blk_iopoll_sched_prep(&pbe_eq->iopoll))
+			blk_iopoll_sched(&pbe_eq->iopoll);
+		return IRQ_HANDLED;
+	}
 
-		if (pbe_eq->todo_cq)
-			queue_work(phba->wq, &pbe_eq->work_cqs);
+	num_eq_processed = 0;
+	eqe = queue_tail_node(eq);
+	while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
+					& EQE_VALID_MASK) {
+		spin_lock_irqsave(&phba->isr_lock, flags);
+		pbe_eq->todo_cq = true;
+		spin_unlock_irqrestore(&phba->isr_lock, flags);
+		AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
+		queue_tail_inc(eq);
+		eqe = queue_tail_node(eq);
+		num_eq_processed++;
 	}
 
+	if (pbe_eq->todo_cq)
+		queue_work(phba->wq, &pbe_eq->work_cqs);
+
 	if (num_eq_processed)
 		hwi_ring_eq_db(phba, eq->id, 1,	num_eq_processed, 0, 1);
 
@@ -2281,6 +2274,10 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
 		queue_tail_inc(cq);
 		sol = queue_tail_node(cq);
 		num_processed++;
+
+		/* we want to relinquish control to other tasks */
+		if (tot_nump >= BE2_MAX_NUM_CQ_PROC)
+			break;
 	}
 
 	if (num_processed > 0) {
@@ -2323,14 +2320,33 @@ void beiscsi_process_all_cqs(struct work_struct *work)
 
 static int be_iopoll(struct blk_iopoll *iop, int budget)
 {
-	unsigned int ret;
+	unsigned int ret, num_eq_processed;
 	struct beiscsi_hba *phba;
 	struct be_eq_obj *pbe_eq;
+	struct be_eq_entry *eqe = NULL;
+	struct be_queue_info *eq;
 
+	num_eq_processed = 0;
 	pbe_eq = container_of(iop, struct be_eq_obj, iopoll);
+	phba = pbe_eq->phba;
+	eq = &pbe_eq->q;
+	eqe = queue_tail_node(eq);
+
+	hwi_ring_eq_db(phba, eq->id, 1, num_eq_processed, 0, 1);
+
+	while (eqe->dw[offsetof(struct amap_eq_entry, valid) / 32]
+			& EQE_VALID_MASK) {
+
+		AMAP_SET_BITS(struct amap_eq_entry, valid, eqe, 0);
+		queue_tail_inc(eq);
+		eqe = queue_tail_node(eq);
+		num_eq_processed++;
+	}
+
+	hwi_ring_eq_db(phba, eq->id, 1, num_eq_processed, 0, 1);
+
 	ret = beiscsi_process_cq(pbe_eq);
 	if (ret < budget) {
-		phba = pbe_eq->phba;
 		blk_iopoll_complete(iop);
 		beiscsi_log(phba, KERN_INFO,
 			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_IO,
@@ -5699,6 +5715,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
 		goto free_blkenbld;
 	}
 	hwi_enable_intr(phba);
+	phba->state &= ~BE_ADAPTER_INIT_PHASE;
 
 	if (beiscsi_setup_boot_info(phba))
 		/*
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index d5901a7..581ebdb 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -105,6 +105,7 @@
 #define BE_ADAPTER_LINK_DOWN	0x002
 #define BE_ADAPTER_PCI_ERR	0x004
 #define BE_ADAPTER_STATE_SHUTDOWN	0x008
+#define BE_ADAPTER_INIT_PHASE	0x8000
 
 
 #define BEISCSI_CLEAN_UNLOAD	0x01
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 4/4] be2iscsi: Bump the driver version
  2014-03-23 22:10 [PATCH 1/4] be2iscsi: Fix retreving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
  2014-03-23 22:10 ` [PATCH 2/4] be2iscsi: relinquishing control after processing 512 CQE Jayamohan Kallickal
  2014-03-23 22:10 ` [PATCH 3/4] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete Jayamohan Kallickal
@ 2014-03-23 22:10 ` Jayamohan Kallickal
  2 siblings, 0 replies; 4+ messages in thread
From: Jayamohan Kallickal @ 2014-03-23 22:10 UTC (permalink / raw)
  To: jbottomley, linux-scsi, michaelc; +Cc: Jayamohan Kallickal, John Soni Jose

	Bumping the driver version

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>
---
 drivers/scsi/be2iscsi/be_main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 581ebdb..cd781bb 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -36,7 +36,7 @@
 #include <scsi/scsi_transport_iscsi.h>
 
 #define DRV_NAME		"be2iscsi"
-#define BUILD_STR		"10.2.125.0"
+#define BUILD_STR		"10.2.214.0"
 #define BE_NAME			"Emulex OneConnect" \
 				"Open-iSCSI Driver version" BUILD_STR
 #define DRV_DESC		BE_NAME " " "Driver"
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-23 22:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-23 22:10 [PATCH 1/4] be2iscsi: Fix retreving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
2014-03-23 22:10 ` [PATCH 2/4] be2iscsi: relinquishing control after processing 512 CQE Jayamohan Kallickal
2014-03-23 22:10 ` [PATCH 3/4] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete Jayamohan Kallickal
2014-03-23 22:10 ` [PATCH 4/4] be2iscsi: Bump the driver version Jayamohan Kallickal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.