All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0
@ 2016-02-01 10:12 Jitendra Bhivare
  2016-02-01 10:12 ` [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock Jitendra Bhivare
                   ` (11 more replies)
  0 siblings, 12 replies; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

This driver update has critical fixes for following issues:
- Management tasks with incorrect ExpStatSn
- WRB allocation failures in IO path
- MCC WRB leak

Jitendra Bhivare (12):
  be2iscsi: Remove unused mcc_cq_lock
  be2iscsi: Use macros for MCC WRB and CQE fields
  be2iscsi: Remove redundant MCC processing code
  be2iscsi: Rename MCC and BMBX processing functions
  be2iscsi: Remove be_mbox_notify_wait function
  be2iscsi: Fix be_mcc_compl_poll to use tag_state
  be2iscsi: Cleanup processing of BMBX completion
  be2iscsi: Fix MCC WRB leak in open_connection
  be2iscsi: Couple MCC tag and WRB alloc and free
  be2iscsi: Fix ExpStatSn in management tasks
  be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock
  be2iscsi: Add lock to protect WRB alloc and free

 drivers/scsi/be2iscsi/be.h       |  11 +-
 drivers/scsi/be2iscsi/be_cmds.c  | 522 +++++++++++++++++----------------------
 drivers/scsi/be2iscsi/be_cmds.h  |  32 +--
 drivers/scsi/be2iscsi/be_iscsi.c |   8 +-
 drivers/scsi/be2iscsi/be_main.c  |  73 +++---
 drivers/scsi/be2iscsi/be_main.h  |   2 +
 drivers/scsi/be2iscsi/be_mgmt.c  | 167 +++++--------
 7 files changed, 355 insertions(+), 460 deletions(-)

-- 
2.5.0


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

* [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 11:10   ` Johannes Thumshirn
  2016-02-01 11:15   ` James Bottomley
  2016-02-01 10:12 ` [PATCH 02/12] be2iscsi: Use macros for MCC WRB and CQE fields Jitendra Bhivare
                   ` (10 subsequent siblings)
  11 siblings, 2 replies; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

mcc_cq_lock spin_lock is used only in beiscsi_process_mcc which is called
only when all interrupts are disabled from mgmt_epfw_cleanup during
unloading of driver. There is no other context where there can be
contention for the processing of CQ.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be.h      | 1 -
 drivers/scsi/be2iscsi/be_cmds.c | 2 --
 drivers/scsi/be2iscsi/be_main.c | 1 -
 3 files changed, 4 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index 7d425af..1524fe4 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -132,7 +132,6 @@ struct be_ctrl_info {
 	/* MCC Rings */
 	struct be_mcc_obj mcc_obj;
 	spinlock_t mcc_lock;	/* For serializing mcc cmds to BE card */
-	spinlock_t mcc_cq_lock;
 
 	wait_queue_head_t mcc_wait[MAX_MCC_CMD + 1];
 	unsigned int mcc_tag[MAX_MCC_CMD];
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 34c33d4..e8e9d22 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -532,7 +532,6 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
 	int num = 0, status = 0;
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 
-	spin_lock_bh(&phba->ctrl.mcc_cq_lock);
 	while ((compl = be_mcc_compl_get(phba))) {
 		if (compl->flags & CQE_FLAGS_ASYNC_MASK) {
 			beiscsi_process_async_event(phba, compl);
@@ -547,7 +546,6 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
 	if (num)
 		hwi_ring_cq_db(phba, phba->ctrl.mcc_obj.cq.id, num, 1);
 
-	spin_unlock_bh(&phba->ctrl.mcc_cq_lock);
 	return status;
 }
 
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 70179e1..314fd2c 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -730,7 +730,6 @@ static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev)
 	memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox));
 	mutex_init(&ctrl->mbox_lock);
 	spin_lock_init(&phba->ctrl.mcc_lock);
-	spin_lock_init(&phba->ctrl.mcc_cq_lock);
 
 	return status;
 }
-- 
2.5.0


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

* [PATCH 02/12] be2iscsi: Use macros for MCC WRB and CQE fields
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
  2016-02-01 10:12 ` [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 11:13   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 03/12] be2iscsi: Remove redundant MCC processing code Jitendra Bhivare
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

Rename mcc_numtag to mcc_tag_status.
MCC CQE status is processed using macros already defined in be_cmds.h.

Add MCC_Q_WRB_ and MCC_Q_CMD_TAG_MASK macros to map to already defined
CQE_STATUS_ macros to be consistent when posting MCC.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be.h      |  8 +++++++-
 drivers/scsi/be2iscsi/be_cmds.c | 40 +++++++++++++++++++++-------------------
 drivers/scsi/be2iscsi/be_cmds.h | 13 +++++++------
 drivers/scsi/be2iscsi/be_main.c | 11 ++++++-----
 4 files changed, 41 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index 1524fe4..da1d87a 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -135,7 +135,7 @@ struct be_ctrl_info {
 
 	wait_queue_head_t mcc_wait[MAX_MCC_CMD + 1];
 	unsigned int mcc_tag[MAX_MCC_CMD];
-	unsigned int mcc_numtag[MAX_MCC_CMD + 1];
+	unsigned int mcc_tag_status[MAX_MCC_CMD + 1];
 	unsigned short mcc_alloc_index;
 	unsigned short mcc_free_index;
 	unsigned int mcc_tag_available;
@@ -145,6 +145,12 @@ struct be_ctrl_info {
 
 #include "be_cmds.h"
 
+/* WRB index mask for MCC_Q_LEN queue entries */
+#define MCC_Q_WRB_IDX_MASK	CQE_STATUS_WRB_MASK
+#define MCC_Q_WRB_IDX_SHIFT	CQE_STATUS_WRB_SHIFT
+/* TAG is from 1...MAX_MCC_CMD, MASK includes MAX_MCC_CMD */
+#define MCC_Q_CMD_TAG_MASK	((MAX_MCC_CMD << 1) - 1)
+
 #define PAGE_SHIFT_4K 12
 #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
 #define mcc_timeout		120000 /* 12s timeout */
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index e8e9d22..c5e7739 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -125,7 +125,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
 	if (phba->ctrl.mcc_tag_available) {
 		tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index];
 		phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0;
-		phba->ctrl.mcc_numtag[tag] = 0;
+		phba->ctrl.mcc_tag_status[tag] = 0;
 		phba->ctrl.ptag_state[tag].tag_state = 0;
 	}
 	if (tag) {
@@ -157,7 +157,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
 		struct be_dma_mem *mbx_cmd_mem)
 {
 	int rc = 0;
-	uint32_t mcc_tag_response;
+	uint32_t mcc_tag_status;
 	uint16_t status = 0, addl_status = 0, wrb_num = 0;
 	struct be_mcc_wrb *temp_wrb;
 	struct be_cmd_req_hdr *mbx_hdr;
@@ -172,7 +172,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
 	/* wait for the mccq completion */
 	rc = wait_event_interruptible_timeout(
 				phba->ctrl.mcc_wait[tag],
-				phba->ctrl.mcc_numtag[tag],
+				phba->ctrl.mcc_tag_status[tag],
 				msecs_to_jiffies(
 				BEISCSI_HOST_MBX_TIMEOUT));
 	/**
@@ -209,15 +209,15 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
 	}
 
 	rc = 0;
-	mcc_tag_response = phba->ctrl.mcc_numtag[tag];
-	status = (mcc_tag_response & CQE_STATUS_MASK);
-	addl_status = ((mcc_tag_response & CQE_STATUS_ADDL_MASK) >>
+	mcc_tag_status = phba->ctrl.mcc_tag_status[tag];
+	status = (mcc_tag_status & CQE_STATUS_MASK);
+	addl_status = ((mcc_tag_status & CQE_STATUS_ADDL_MASK) >>
 			CQE_STATUS_ADDL_SHIFT);
 
 	if (mbx_cmd_mem) {
 		mbx_hdr = (struct be_cmd_req_hdr *)mbx_cmd_mem->va;
 	} else {
-		wrb_num = (mcc_tag_response & CQE_STATUS_WRB_MASK) >>
+		wrb_num = (mcc_tag_status & CQE_STATUS_WRB_MASK) >>
 			   CQE_STATUS_WRB_SHIFT;
 		temp_wrb = (struct be_mcc_wrb *)queue_get_wrb(mccq, wrb_num);
 		mbx_hdr = embedded_payload(temp_wrb);
@@ -257,7 +257,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
 void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
 {
 	spin_lock(&ctrl->mcc_lock);
-	tag = tag & 0x000000FF;
+	tag = tag & MCC_Q_CMD_TAG_MASK;
 	ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
 	if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
 		ctrl->mcc_free_index = 0;
@@ -334,10 +334,11 @@ int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
 	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
 	u16 compl_status, extd_status;
 	struct be_dma_mem *tag_mem;
-	unsigned short tag;
+	unsigned int tag, wrb_idx;
 
 	be_dws_le_to_cpu(compl, 4);
-	tag = (compl->tag0 & 0x000000FF);
+	tag = (compl->tag0 & MCC_Q_CMD_TAG_MASK);
+	wrb_idx = (compl->tag0 & CQE_STATUS_WRB_MASK) >> CQE_STATUS_WRB_SHIFT;
 
 	if (!test_bit(MCC_TAG_STATE_RUNNING,
 		      &ctrl->ptag_state[tag].tag_state)) {
@@ -366,17 +367,18 @@ int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
 	}
 
 	compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
-					CQE_STATUS_COMPL_MASK;
-	/* The ctrl.mcc_numtag[tag] is filled with
+		       CQE_STATUS_COMPL_MASK;
+	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
+		      CQE_STATUS_EXTD_MASK;
+	/* The ctrl.mcc_tag_status[tag] is filled with
 	 * [31] = valid, [30:24] = Rsvd, [23:16] = wrb, [15:8] = extd_status,
 	 * [7:0] = compl_status
 	 */
-	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
-					CQE_STATUS_EXTD_MASK;
-	ctrl->mcc_numtag[tag]  = 0x80000000;
-	ctrl->mcc_numtag[tag] |= (compl->tag0 & 0x00FF0000);
-	ctrl->mcc_numtag[tag] |= (extd_status & 0x000000FF) << 8;
-	ctrl->mcc_numtag[tag] |= (compl_status & 0x000000FF);
+	ctrl->mcc_tag_status[tag] = CQE_VALID_MASK;
+	ctrl->mcc_tag_status[tag] |= (wrb_idx << CQE_STATUS_WRB_SHIFT);
+	ctrl->mcc_tag_status[tag] |= (extd_status << CQE_STATUS_ADDL_SHIFT) &
+				     CQE_STATUS_ADDL_MASK;
+	ctrl->mcc_tag_status[tag] |= (compl_status & CQE_STATUS_MASK);
 
 	/* write ordering implied in wake_up_interruptible */
 	clear_bit(MCC_TAG_STATE_RUNNING, &ctrl->ptag_state[tag].tag_state);
@@ -844,7 +846,7 @@ struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba)
 	WARN_ON(atomic_read(&mccq->used) >= mccq->len);
 	wrb = queue_head_node(mccq);
 	memset(wrb, 0, sizeof(*wrb));
-	wrb->tag0 = (mccq->head & 0x000000FF) << 16;
+	wrb->tag0 = (mccq->head << MCC_Q_WRB_IDX_SHIFT) & MCC_Q_WRB_IDX_MASK;
 	queue_head_inc(mccq);
 	atomic_inc(&mccq->used);
 	return wrb;
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 7caf585..adafd9c 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -58,15 +58,16 @@ struct be_mcc_wrb {
 #define MCC_STATUS_ILLEGAL_FIELD 0x3
 #define MCC_STATUS_INSUFFICIENT_BUFFER 0x4
 
-#define CQE_STATUS_COMPL_MASK 0xFFFF
-#define CQE_STATUS_COMPL_SHIFT 0	/* bits 0 - 15 */
-#define CQE_STATUS_EXTD_MASK 0xFFFF
-#define CQE_STATUS_EXTD_SHIFT 16		/* bits 0 - 15 */
+#define CQE_STATUS_COMPL_MASK	0xFFFF
+#define CQE_STATUS_COMPL_SHIFT	0		/* bits 0 - 15 */
+#define CQE_STATUS_EXTD_MASK	0xFFFF
+#define CQE_STATUS_EXTD_SHIFT	16		/* bits 31 - 16 */
 #define CQE_STATUS_ADDL_MASK	0xFF00
-#define CQE_STATUS_MASK	0xFF
-#define CQE_STATUS_ADDL_SHIFT	0x08
+#define CQE_STATUS_ADDL_SHIFT	8
+#define CQE_STATUS_MASK		0xFF
 #define CQE_STATUS_WRB_MASK	0xFF0000
 #define CQE_STATUS_WRB_SHIFT	16
+
 #define BEISCSI_HOST_MBX_TIMEOUT (110 * 1000)
 #define BEISCSI_FW_MBX_TIMEOUT	100
 
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 314fd2c..aaf39d4 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5241,11 +5241,12 @@ static int beiscsi_bsg_request(struct bsg_job *job)
 
 		rc = wait_event_interruptible_timeout(
 					phba->ctrl.mcc_wait[tag],
-					phba->ctrl.mcc_numtag[tag],
+					phba->ctrl.mcc_tag_status[tag],
 					msecs_to_jiffies(
 					BEISCSI_HOST_MBX_TIMEOUT));
-		extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
-		status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
+		extd_status = (phba->ctrl.mcc_tag_status[tag] &
+			       CQE_STATUS_ADDL_MASK) >> CQE_STATUS_ADDL_SHIFT;
+		status = phba->ctrl.mcc_tag_status[tag] & CQE_STATUS_MASK;
 		free_mcc_tag(&phba->ctrl, tag);
 		resp = (struct be_cmd_resp_hdr *)nonemb_cmd.va;
 		sg_copy_from_buffer(job->reply_payload.sg_list,
@@ -5580,7 +5581,7 @@ static void beiscsi_eeh_resume(struct pci_dev *pdev)
 	for (i = 0; i < MAX_MCC_CMD; i++) {
 		init_waitqueue_head(&phba->ctrl.mcc_wait[i + 1]);
 		phba->ctrl.mcc_tag[i] = i + 1;
-		phba->ctrl.mcc_numtag[i + 1] = 0;
+		phba->ctrl.mcc_tag_status[i + 1] = 0;
 		phba->ctrl.mcc_tag_available++;
 	}
 
@@ -5739,7 +5740,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
 	for (i = 0; i < MAX_MCC_CMD; i++) {
 		init_waitqueue_head(&phba->ctrl.mcc_wait[i + 1]);
 		phba->ctrl.mcc_tag[i] = i + 1;
-		phba->ctrl.mcc_numtag[i + 1] = 0;
+		phba->ctrl.mcc_tag_status[i + 1] = 0;
 		phba->ctrl.mcc_tag_available++;
 		memset(&phba->ctrl.ptag_state[i].tag_mem_state, 0,
 		       sizeof(struct be_dma_mem));
-- 
2.5.0


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

* [PATCH 03/12] be2iscsi: Remove redundant MCC processing code
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
  2016-02-01 10:12 ` [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock Jitendra Bhivare
  2016-02-01 10:12 ` [PATCH 02/12] be2iscsi: Use macros for MCC WRB and CQE fields Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 11:17   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions Jitendra Bhivare
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

be_mcc_compl_process_isr is removed.
MCC CQ processing is done only in beiscsi_process_mcc_cq and MCC CQE
processing is done only in beiscsi_process_mcc_compl.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_cmds.c | 164 ++++++++++++++--------------------------
 drivers/scsi/be2iscsi/be_cmds.h |   7 +-
 drivers/scsi/be2iscsi/be_main.c |   8 +-
 drivers/scsi/be2iscsi/be_main.h |   1 +
 drivers/scsi/be2iscsi/be_mgmt.c |   3 +-
 5 files changed, 68 insertions(+), 115 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index c5e7739..fa010ac 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -328,76 +328,6 @@ static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
 	return 0;
 }
 
-int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
-				    struct be_mcc_compl *compl)
-{
-	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
-	u16 compl_status, extd_status;
-	struct be_dma_mem *tag_mem;
-	unsigned int tag, wrb_idx;
-
-	be_dws_le_to_cpu(compl, 4);
-	tag = (compl->tag0 & MCC_Q_CMD_TAG_MASK);
-	wrb_idx = (compl->tag0 & CQE_STATUS_WRB_MASK) >> CQE_STATUS_WRB_SHIFT;
-
-	if (!test_bit(MCC_TAG_STATE_RUNNING,
-		      &ctrl->ptag_state[tag].tag_state)) {
-		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_MBOX |
-			    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
-			    "BC_%d : MBX cmd completed but not posted\n");
-		return 0;
-	}
-
-	if (test_bit(MCC_TAG_STATE_TIMEOUT,
-		     &ctrl->ptag_state[tag].tag_state)) {
-		beiscsi_log(phba, KERN_WARNING,
-			    BEISCSI_LOG_MBOX | BEISCSI_LOG_INIT |
-			    BEISCSI_LOG_CONFIG,
-			    "BC_%d : MBX Completion for timeout Command from FW\n");
-		/**
-		 * Check for the size before freeing resource.
-		 * Only for non-embedded cmd, PCI resource is allocated.
-		 **/
-		tag_mem = &ctrl->ptag_state[tag].tag_mem_state;
-		if (tag_mem->size)
-			pci_free_consistent(ctrl->pdev, tag_mem->size,
-					tag_mem->va, tag_mem->dma);
-		free_mcc_tag(ctrl, tag);
-		return 0;
-	}
-
-	compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
-		       CQE_STATUS_COMPL_MASK;
-	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
-		      CQE_STATUS_EXTD_MASK;
-	/* The ctrl.mcc_tag_status[tag] is filled with
-	 * [31] = valid, [30:24] = Rsvd, [23:16] = wrb, [15:8] = extd_status,
-	 * [7:0] = compl_status
-	 */
-	ctrl->mcc_tag_status[tag] = CQE_VALID_MASK;
-	ctrl->mcc_tag_status[tag] |= (wrb_idx << CQE_STATUS_WRB_SHIFT);
-	ctrl->mcc_tag_status[tag] |= (extd_status << CQE_STATUS_ADDL_SHIFT) &
-				     CQE_STATUS_ADDL_MASK;
-	ctrl->mcc_tag_status[tag] |= (compl_status & CQE_STATUS_MASK);
-
-	/* write ordering implied in wake_up_interruptible */
-	clear_bit(MCC_TAG_STATE_RUNNING, &ctrl->ptag_state[tag].tag_state);
-	wake_up_interruptible(&ctrl->mcc_wait[tag]);
-	return 0;
-}
-
-static struct be_mcc_compl *be_mcc_compl_get(struct beiscsi_hba *phba)
-{
-	struct be_queue_info *mcc_cq = &phba->ctrl.mcc_obj.cq;
-	struct be_mcc_compl *compl = queue_tail_node(mcc_cq);
-
-	if (be_mcc_compl_is_new(compl)) {
-		queue_tail_inc(mcc_cq);
-		return compl;
-	}
-	return NULL;
-}
-
 /**
  * beiscsi_fail_session(): Closing session with appropriate error
  * @cls_session: ptr to session
@@ -528,27 +458,65 @@ void beiscsi_process_async_event(struct beiscsi_hba *phba,
 		    evt_code, compl->status, compl->flags);
 }
 
-int beiscsi_process_mcc(struct beiscsi_hba *phba)
+int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
+			      struct be_mcc_compl *compl)
 {
-	struct be_mcc_compl *compl;
-	int num = 0, status = 0;
-	struct be_ctrl_info *ctrl = &phba->ctrl;
+	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
+	u16 compl_status, extd_status;
+	struct be_dma_mem *tag_mem;
+	unsigned int tag, wrb_idx;
 
-	while ((compl = be_mcc_compl_get(phba))) {
-		if (compl->flags & CQE_FLAGS_ASYNC_MASK) {
-			beiscsi_process_async_event(phba, compl);
-		} else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
-			status = be_mcc_compl_process(ctrl, compl);
-			atomic_dec(&phba->ctrl.mcc_obj.q.used);
-		}
-		be_mcc_compl_use(compl);
-		num++;
+	/**
+	 * Just swap the status to host endian; mcc tag is opaquely copied
+	 * from mcc_wrb
+	 */
+	be_dws_le_to_cpu(compl, 4);
+	tag = (compl->tag0 & MCC_Q_CMD_TAG_MASK);
+	wrb_idx = (compl->tag0 & CQE_STATUS_WRB_MASK) >> CQE_STATUS_WRB_SHIFT;
+
+	if (!test_bit(MCC_TAG_STATE_RUNNING,
+		      &ctrl->ptag_state[tag].tag_state)) {
+		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_MBOX |
+			    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
+			    "BC_%d : MBX cmd completed but not posted\n");
+		return 0;
 	}
 
-	if (num)
-		hwi_ring_cq_db(phba, phba->ctrl.mcc_obj.cq.id, num, 1);
+	if (test_bit(MCC_TAG_STATE_TIMEOUT, &ctrl->ptag_state[tag].tag_state)) {
+		beiscsi_log(phba, KERN_WARNING,
+			    BEISCSI_LOG_MBOX | BEISCSI_LOG_INIT |
+			    BEISCSI_LOG_CONFIG,
+			    "BC_%d : MBX Completion for timeout Command from FW\n");
+		/**
+		 * Check for the size before freeing resource.
+		 * Only for non-embedded cmd, PCI resource is allocated.
+		 **/
+		tag_mem = &ctrl->ptag_state[tag].tag_mem_state;
+		if (tag_mem->size)
+			pci_free_consistent(ctrl->pdev, tag_mem->size,
+					tag_mem->va, tag_mem->dma);
+		free_mcc_tag(ctrl, tag);
+		return 0;
+	}
 
-	return status;
+	compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
+		       CQE_STATUS_COMPL_MASK;
+	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
+		      CQE_STATUS_EXTD_MASK;
+	/* The ctrl.mcc_tag_status[tag] is filled with
+	 * [31] = valid, [30:24] = Rsvd, [23:16] = wrb, [15:8] = extd_status,
+	 * [7:0] = compl_status
+	 */
+	ctrl->mcc_tag_status[tag] = CQE_VALID_MASK;
+	ctrl->mcc_tag_status[tag] |= (wrb_idx << CQE_STATUS_WRB_SHIFT);
+	ctrl->mcc_tag_status[tag] |= (extd_status << CQE_STATUS_ADDL_SHIFT) &
+				     CQE_STATUS_ADDL_MASK;
+	ctrl->mcc_tag_status[tag] |= (compl_status & CQE_STATUS_MASK);
+
+	/* write ordering forced in wake_up_interruptible */
+	clear_bit(MCC_TAG_STATE_RUNNING, &ctrl->ptag_state[tag].tag_state);
+	wake_up_interruptible(&ctrl->mcc_wait[tag]);
+	return 0;
 }
 
 /*
@@ -562,16 +530,15 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
  * Failure: Non-Zero
  *
  **/
-static int be_mcc_wait_compl(struct beiscsi_hba *phba)
+int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
 {
-	int i, status;
+	int i;
+
 	for (i = 0; i < mcc_timeout; i++) {
 		if (beiscsi_error(phba))
 			return -EIO;
 
-		status = beiscsi_process_mcc(phba);
-		if (status)
-			return status;
+		beiscsi_process_mcc_cq(phba);
 
 		if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0)
 			break;
@@ -589,21 +556,6 @@ static int be_mcc_wait_compl(struct beiscsi_hba *phba)
 }
 
 /*
- * be_mcc_notify_wait()- Notify and wait for Compl
- * @phba: driver private structure
- *
- * Notify MCC requests and wait for completion
- *
- * return
- * Success: 0
- * Failure: Non-Zero
- **/
-int be_mcc_notify_wait(struct beiscsi_hba *phba, unsigned int tag)
-{
-	be_mcc_notify(phba, tag);
-	return be_mcc_wait_compl(phba);
-}
-
 /*
  * be_mbox_db_ready_wait()- Check ready status
  * @ctrl: Function specific MBX data structure
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index adafd9c..f50b32ac 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -741,13 +741,14 @@ int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
 
 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
 struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
-int be_mcc_notify_wait(struct beiscsi_hba *phba, unsigned int tag);
+int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag);
 void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag);
 unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
 void beiscsi_process_async_event(struct beiscsi_hba *phba,
 				struct be_mcc_compl *compl);
-int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
-				    struct be_mcc_compl *compl);
+int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
+			      struct be_mcc_compl *compl);
+
 
 int be_mbox_notify(struct be_ctrl_info *ctrl);
 
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index aaf39d4..8b9d01a 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2028,7 +2028,7 @@ static void hwi_process_default_pdu_ring(struct beiscsi_conn *beiscsi_conn,
 			       phwi_ctrlr, cri_index));
 }
 
-static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
+void beiscsi_process_mcc_cq(struct beiscsi_hba *phba)
 {
 	struct be_queue_info *mcc_cq;
 	struct  be_mcc_compl *mcc_compl;
@@ -2038,7 +2038,6 @@ static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
 	mcc_compl = queue_tail_node(mcc_cq);
 	mcc_compl->flags = le32_to_cpu(mcc_compl->flags);
 	while (mcc_compl->flags & CQE_FLAGS_VALID_MASK) {
-
 		if (num_processed >= 32) {
 			hwi_ring_cq_db(phba, mcc_cq->id,
 					num_processed, 0);
@@ -2047,7 +2046,7 @@ static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
 		if (mcc_compl->flags & CQE_FLAGS_ASYNC_MASK) {
 			beiscsi_process_async_event(phba, mcc_compl);
 		} else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) {
-			be_mcc_compl_process_isr(&phba->ctrl, mcc_compl);
+			beiscsi_process_mcc_compl(&phba->ctrl, mcc_compl);
 			atomic_dec(&phba->ctrl.mcc_obj.q.used);
 		}
 
@@ -2060,7 +2059,6 @@ static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
 
 	if (num_processed > 0)
 		hwi_ring_cq_db(phba, mcc_cq->id, num_processed, 1);
-
 }
 
 /**
@@ -2269,7 +2267,7 @@ void beiscsi_process_all_cqs(struct work_struct *work)
 		spin_lock_irqsave(&phba->isr_lock, flags);
 		pbe_eq->todo_mcc_cq = false;
 		spin_unlock_irqrestore(&phba->isr_lock, flags);
-		beiscsi_process_mcc_isr(phba);
+		beiscsi_process_mcc_cq(phba);
 	}
 
 	if (pbe_eq->todo_cq) {
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 16a6fd0..5ded3fa 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -853,6 +853,7 @@ void hwi_ring_cq_db(struct beiscsi_hba *phba,
 		     unsigned char rearm);
 
 unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq, int budget);
+void beiscsi_process_mcc_cq(struct beiscsi_hba *phba);
 
 static inline bool beiscsi_error(struct beiscsi_hba *phba)
 {
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index da040e7..a88e636 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -678,7 +678,8 @@ int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num)
 	req->hdr_ring_id = cpu_to_le16(HWI_GET_DEF_HDRQ_ID(phba, ulp_num));
 	req->data_ring_id = cpu_to_le16(HWI_GET_DEF_BUFQ_ID(phba, ulp_num));
 
-	status = be_mcc_notify_wait(phba, tag);
+	be_mcc_notify(phba, tag);
+	status = be_mcc_compl_poll(phba, tag);
 	if (status)
 		beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
 			    "BG_%d : mgmt_epfw_cleanup , FAILED\n");
-- 
2.5.0


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

* [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (2 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 03/12] be2iscsi: Remove redundant MCC processing code Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 11:26   ` Johannes Thumshirn
  2016-02-01 12:26   ` kbuild test robot
  2016-02-01 10:12 ` [PATCH 05/12] be2iscsi: Remove be_mbox_notify_wait function Jitendra Bhivare
                   ` (7 subsequent siblings)
  11 siblings, 2 replies; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

beiscsi_mccq_compl -> beiscsi_mccq_compl_wait - indicate blocking call.
be_mcc_wait_compl -> be_mcc_compl_poll - indicate polling for completion.
be_mbox_db_ready_wait -> be_mbox_db_ready_poll - indicate polling for RDY.
be_mcc_compl_process -> beiscsi_process_mbox_compl - indicate BMBX compl.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_cmds.c  | 35 +++++++++++++++++------------------
 drivers/scsi/be2iscsi/be_cmds.h  |  6 +++---
 drivers/scsi/be2iscsi/be_iscsi.c |  8 ++++----
 drivers/scsi/be2iscsi/be_main.c  |  8 ++++----
 drivers/scsi/be2iscsi/be_mgmt.c  | 12 ++++++------
 5 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index fa010ac..8dd8521 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -140,7 +140,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
 }
 
 /*
- * beiscsi_mccq_compl()- Wait for completion of MBX
+ * beiscsi_mccq_compl_wait()- Process completion in MCC CQ
  * @phba: Driver private structure
  * @tag: Tag for the MBX Command
  * @wrb: the WRB used for the MBX Command
@@ -152,9 +152,9 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
  * Success: 0
  * Failure: Non-Zero
  **/
-int beiscsi_mccq_compl(struct beiscsi_hba *phba,
-		uint32_t tag, struct be_mcc_wrb **wrb,
-		struct be_dma_mem *mbx_cmd_mem)
+int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
+			    uint32_t tag, struct be_mcc_wrb **wrb,
+			    struct be_dma_mem *mbx_cmd_mem)
 {
 	int rc = 0;
 	uint32_t mcc_tag_status;
@@ -283,7 +283,7 @@ static inline void be_mcc_compl_use(struct be_mcc_compl *compl)
 }
 
 /*
- * be_mcc_compl_process()- Check the MBX comapletion status
+ * beiscsi_process_mbox_compl()- Check the MBX completion status
  * @ctrl: Function specific MBX data structure
  * @compl: Completion status of MBX Command
  *
@@ -293,8 +293,8 @@ static inline void be_mcc_compl_use(struct be_mcc_compl *compl)
  * Success: Zero
  * Failure: Non-Zero
  **/
-static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
-				struct be_mcc_compl *compl)
+static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl,
+				      struct be_mcc_compl *compl)
 {
 	u16 compl_status, extd_status;
 	struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
@@ -520,7 +520,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
 }
 
 /*
- * be_mcc_wait_compl()- Wait for MBX completion
+ * be_mcc_compl_poll()- Wait for MBX completion
  * @phba: driver private structure
  *
  * Wait till no more pending mcc requests are present
@@ -556,8 +556,7 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
 }
 
 /*
-/*
- * be_mbox_db_ready_wait()- Check ready status
+ * be_mbox_db_ready_poll()- Check ready status
  * @ctrl: Function specific MBX data structure
  *
  * Check for the ready status of FW to send BMBX
@@ -567,7 +566,7 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
  * Success: 0
  * Failure: Non-Zero
  **/
-static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl)
+static int be_mbox_db_ready_poll(struct be_ctrl_info *ctrl)
 {
 	/* wait 30s for generic non-flash MBOX operation */
 #define BEISCSI_MBX_RDY_BIT_TIMEOUT	30000
@@ -629,7 +628,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
 	struct be_mcc_compl *compl = &mbox->compl;
 	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
 
-	status = be_mbox_db_ready_wait(ctrl);
+	status = be_mbox_db_ready_poll(ctrl);
 	if (status)
 		return status;
 
@@ -638,7 +637,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
 	val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
 	iowrite32(val, db);
 
-	status = be_mbox_db_ready_wait(ctrl);
+	status = be_mbox_db_ready_poll(ctrl);
 	if (status)
 		return status;
 
@@ -648,7 +647,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
 	val |= (u32) (mbox_mem->dma >> 4) << 2;
 	iowrite32(val, db);
 
-	status = be_mbox_db_ready_wait(ctrl);
+	status = be_mbox_db_ready_poll(ctrl);
 	if (status)
 		return status;
 
@@ -656,7 +655,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
 	udelay(1);
 
 	if (be_mcc_compl_is_new(compl)) {
-		status = be_mcc_compl_process(ctrl, &mbox->compl);
+		status = beiscsi_process_mbox_compl(ctrl, compl);
 		be_mcc_compl_use(compl);
 		if (status) {
 			beiscsi_log(phba, KERN_ERR,
@@ -689,7 +688,7 @@ static int be_mbox_notify_wait(struct beiscsi_hba *phba)
 	struct be_mcc_compl *compl = &mbox->compl;
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 
-	status = be_mbox_db_ready_wait(ctrl);
+	status = be_mbox_db_ready_poll(ctrl);
 	if (status)
 		return status;
 
@@ -699,7 +698,7 @@ static int be_mbox_notify_wait(struct beiscsi_hba *phba)
 	iowrite32(val, db);
 
 	/* wait for ready to be set */
-	status = be_mbox_db_ready_wait(ctrl);
+	status = be_mbox_db_ready_poll(ctrl);
 	if (status != 0)
 		return status;
 
@@ -708,7 +707,7 @@ static int be_mbox_notify_wait(struct beiscsi_hba *phba)
 	val |= (u32)(mbox_mem->dma >> 4) << 2;
 	iowrite32(val, db);
 
-	status = be_mbox_db_ready_wait(ctrl);
+	status = be_mbox_db_ready_poll(ctrl);
 	if (status != 0)
 		return status;
 
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index f50b32ac..b14ac01 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -732,9 +732,9 @@ void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
 
 int be_cmd_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *,
 			    int num);
-int beiscsi_mccq_compl(struct beiscsi_hba *phba,
-			uint32_t tag, struct be_mcc_wrb **wrb,
-			struct be_dma_mem *mbx_cmd_mem);
+int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
+			    uint32_t tag, struct be_mcc_wrb **wrb,
+			    struct be_dma_mem *mbx_cmd_mem);
 /*ISCSI Functuions */
 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
 int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 633257b..09f89a3 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -735,7 +735,7 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
 		return -EBUSY;
 	}
 
-	rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
+	rc = beiscsi_mccq_compl_wait(phba, tag, &wrb, NULL);
 	if (rc) {
 		beiscsi_log(phba, KERN_ERR,
 			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
@@ -1143,7 +1143,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
 		return -EAGAIN;
 	}
 
-	ret = beiscsi_mccq_compl(phba, tag, NULL, &nonemb_cmd);
+	ret = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
 	if (ret) {
 		beiscsi_log(phba, KERN_ERR,
 			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
@@ -1302,7 +1302,7 @@ static int beiscsi_close_conn(struct  beiscsi_endpoint *beiscsi_ep, int flag)
 		ret = -EAGAIN;
 	}
 
-	ret = beiscsi_mccq_compl(phba, tag, NULL, NULL);
+	ret = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
 
 	/* Flush the CQ entries */
 	beiscsi_flush_cq(phba);
@@ -1377,7 +1377,7 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
 			    beiscsi_ep->ep_cid);
 	}
 
-	beiscsi_mccq_compl(phba, tag, NULL, NULL);
+	beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
 	beiscsi_close_conn(beiscsi_ep, tcp_upload_flag);
 free_ep:
 	msleep(BEISCSI_LOGOUT_SYNC_DELAY);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 8b9d01a..dfc2ee9 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -286,7 +286,7 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)
 		return FAILED;
 	}
 
-	rc = beiscsi_mccq_compl(phba, tag, NULL, &nonemb_cmd);
+	rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
 	if (rc != -EBUSY)
 		pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
 				    nonemb_cmd.va, nonemb_cmd.dma);
@@ -367,7 +367,7 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)
 		return FAILED;
 	}
 
-	rc = beiscsi_mccq_compl(phba, tag, NULL, &nonemb_cmd);
+	rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
 	if (rc != -EBUSY)
 		pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
 				    nonemb_cmd.va, nonemb_cmd.dma);
@@ -4394,7 +4394,7 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
 		goto boot_freemem;
 	}
 
-	ret = beiscsi_mccq_compl(phba, tag, NULL, &nonemb_cmd);
+	ret = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
 	if (ret) {
 		beiscsi_log(phba, KERN_ERR,
 			    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
@@ -5424,7 +5424,7 @@ static void be_eqd_update(struct beiscsi_hba *phba)
 	if (num) {
 		tag = be_cmd_modify_eq_delay(phba, set_eqd, num);
 		if (tag)
-			beiscsi_mccq_compl(phba, tag, NULL, NULL);
+			beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
 	}
 }
 
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index a88e636..85044b8 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -942,7 +942,7 @@ unsigned int mgmt_get_all_if_id(struct beiscsi_hba *phba)
 	be_mcc_notify(phba, tag);
 	mutex_unlock(&ctrl->mbox_lock);
 
-	status = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
+	status = beiscsi_mccq_compl_wait(phba, tag, &wrb, NULL);
 	if (status) {
 		beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
 			    "BG_%d : Failed in mgmt_get_all_if_id\n");
@@ -993,7 +993,7 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
 	be_mcc_notify(phba, tag);
 	mutex_unlock(&ctrl->mbox_lock);
 
-	rc = beiscsi_mccq_compl(phba, tag, NULL, nonemb_cmd);
+	rc = beiscsi_mccq_compl_wait(phba, tag, NULL, nonemb_cmd);
 
 	if (resp_buf)
 		memcpy(resp_buf, nonemb_cmd->va, resp_buf_len);
@@ -1427,7 +1427,7 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
 			return -EAGAIN;
 		}
 
-		rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
+		rc = beiscsi_mccq_compl_wait(phba, tag, &wrb, NULL);
 		if (rc) {
 			beiscsi_log(phba, KERN_ERR,
 				    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
@@ -1461,7 +1461,7 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
 			return -EAGAIN;
 		}
 
-		rc = beiscsi_mccq_compl(phba, tag, NULL, NULL);
+		rc = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
 		if (rc) {
 			beiscsi_log(phba, KERN_ERR,
 				    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
@@ -1503,7 +1503,7 @@ int mgmt_set_vlan(struct beiscsi_hba *phba,
 		return -EBUSY;
 	}
 
-	rc = beiscsi_mccq_compl(phba, tag, NULL, NULL);
+	rc = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
 	if (rc) {
 		beiscsi_log(phba, KERN_ERR,
 			    (BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX),
@@ -1869,7 +1869,7 @@ int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
 	be_mcc_notify(phba, tag);
 	mutex_unlock(&ctrl->mbox_lock);
 
-	rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
+	rc = beiscsi_mccq_compl_wait(phba, tag, &wrb, NULL);
 	if (rc) {
 		beiscsi_log(phba, KERN_ERR,
 			    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
-- 
2.5.0


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

* [PATCH 05/12] be2iscsi: Remove be_mbox_notify_wait function
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (3 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 11:27   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state Jitendra Bhivare
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

be_mbox_notify_wait does exactly same thing as be_mbox_notify.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_cmds.c | 79 +++--------------------------------------
 1 file changed, 4 insertions(+), 75 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 8dd8521..12b60dd 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -625,8 +625,6 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
 	void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET;
 	struct be_dma_mem *mbox_mem = &ctrl->mbox_mem;
 	struct be_mcc_mailbox *mbox = mbox_mem->va;
-	struct be_mcc_compl *compl = &mbox->compl;
-	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
 
 	status = be_mbox_db_ready_poll(ctrl);
 	if (status)
@@ -654,77 +652,8 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
 	/* RDY is set; small delay before CQE read. */
 	udelay(1);
 
-	if (be_mcc_compl_is_new(compl)) {
-		status = beiscsi_process_mbox_compl(ctrl, compl);
-		be_mcc_compl_use(compl);
-		if (status) {
-			beiscsi_log(phba, KERN_ERR,
-				    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
-				    "BC_%d : After be_mcc_compl_process\n");
-
-			return status;
-		}
-	} else {
-		beiscsi_log(phba, KERN_ERR,
-			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
-			    "BC_%d : Invalid Mailbox Completion\n");
-
-		return -EBUSY;
-	}
-	return 0;
-}
-
-/*
- * Insert the mailbox address into the doorbell in two steps
- * Polls on the mbox doorbell till a command completion (or a timeout) occurs
- */
-static int be_mbox_notify_wait(struct beiscsi_hba *phba)
-{
-	int status;
-	u32 val = 0;
-	void __iomem *db = phba->ctrl.db + MPU_MAILBOX_DB_OFFSET;
-	struct be_dma_mem *mbox_mem = &phba->ctrl.mbox_mem;
-	struct be_mcc_mailbox *mbox = mbox_mem->va;
-	struct be_mcc_compl *compl = &mbox->compl;
-	struct be_ctrl_info *ctrl = &phba->ctrl;
-
-	status = be_mbox_db_ready_poll(ctrl);
-	if (status)
-		return status;
-
-	val |= MPU_MAILBOX_DB_HI_MASK;
-	/* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */
-	val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
-	iowrite32(val, db);
-
-	/* wait for ready to be set */
-	status = be_mbox_db_ready_poll(ctrl);
-	if (status != 0)
-		return status;
-
-	val = 0;
-	/* at bits 2 - 31 place mbox dma addr lsb bits 4 - 33 */
-	val |= (u32)(mbox_mem->dma >> 4) << 2;
-	iowrite32(val, db);
-
-	status = be_mbox_db_ready_poll(ctrl);
-	if (status != 0)
-		return status;
-
-	/* A cq entry has been made now */
-	if (be_mcc_compl_is_new(compl)) {
-		status = be_mcc_compl_process(ctrl, &mbox->compl);
-		be_mcc_compl_use(compl);
-		if (status)
-			return status;
-	} else {
-		beiscsi_log(phba, KERN_ERR,
-			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
-			    "BC_%d : invalid mailbox completion\n");
-
-		return -EBUSY;
-	}
-	return 0;
+	status = beiscsi_process_mbox_compl(ctrl, &mbox->compl);
+	return status;
 }
 
 void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
@@ -1039,7 +968,7 @@ int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
 
 	be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
 
-	status = be_mbox_notify_wait(phba);
+	status = be_mbox_notify(ctrl);
 	if (!status) {
 		struct be_cmd_resp_mcc_create *resp = embedded_payload(wrb);
 		mccq->id = le16_to_cpu(resp->id);
@@ -1381,7 +1310,7 @@ int beiscsi_cmd_reset_function(struct beiscsi_hba  *phba)
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
 			   OPCODE_COMMON_FUNCTION_RESET, sizeof(*req));
-	status = be_mbox_notify_wait(phba);
+	status = be_mbox_notify(ctrl);
 
 	mutex_unlock(&ctrl->mbox_lock);
 	return status;
-- 
2.5.0


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

* [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (4 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 05/12] be2iscsi: Remove be_mbox_notify_wait function Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 11:29   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 07/12] be2iscsi: Cleanup processing of BMBX completion Jitendra Bhivare
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

be_mcc_compl_poll waits till 'used' count of MCC WRBQ is zero. This is to
determine the completion of an MCC sent.

Change function to poll for the tag of MCC sent, instead, and wait till
its tag_state is cleared.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_cmds.c | 92 +++++++++++++++++++++--------------------
 1 file changed, 47 insertions(+), 45 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 12b60dd..60db2de 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -104,19 +104,6 @@ int be_chk_reset_complete(struct beiscsi_hba *phba)
 	return 0;
 }
 
-void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
-{
-	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
-	u32 val = 0;
-
-	set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state);
-	val |= mccq->id & DB_MCCQ_RING_ID_MASK;
-	val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
-	/* ring doorbell after all of request and state is written */
-	wmb();
-	iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
-}
-
 unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
 {
 	unsigned int tag = 0;
@@ -139,6 +126,28 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
 	return tag;
 }
 
+void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
+{
+	spin_lock_bh(&ctrl->mcc_lock);
+	tag = tag & MCC_Q_CMD_TAG_MASK;
+	ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
+	if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
+		ctrl->mcc_free_index = 0;
+	else
+		ctrl->mcc_free_index++;
+	ctrl->mcc_tag_available++;
+	spin_unlock_bh(&ctrl->mcc_lock);
+}
+
+/**
+ * beiscsi_fail_session(): Closing session with appropriate error
+ * @cls_session: ptr to session
+ **/
+void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
+{
+	iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
+}
+
 /*
  * beiscsi_mccq_compl_wait()- Process completion in MCC CQ
  * @phba: Driver private structure
@@ -254,19 +263,6 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
 	return rc;
 }
 
-void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
-{
-	spin_lock(&ctrl->mcc_lock);
-	tag = tag & MCC_Q_CMD_TAG_MASK;
-	ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
-	if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
-		ctrl->mcc_free_index = 0;
-	else
-		ctrl->mcc_free_index++;
-	ctrl->mcc_tag_available++;
-	spin_unlock(&ctrl->mcc_lock);
-}
-
 static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
 {
 	if (compl->flags != 0) {
@@ -328,15 +324,6 @@ static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl,
 	return 0;
 }
 
-/**
- * beiscsi_fail_session(): Closing session with appropriate error
- * @cls_session: ptr to session
- **/
-void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
-{
-	iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
-}
-
 static void beiscsi_process_async_link(struct beiscsi_hba *phba,
 				       struct be_mcc_compl *compl)
 {
@@ -532,6 +519,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
  **/
 int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
 {
+	struct be_ctrl_info *ctrl = &phba->ctrl;
 	int i;
 
 	for (i = 0; i < mcc_timeout; i++) {
@@ -540,19 +528,33 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
 
 		beiscsi_process_mcc_cq(phba);
 
-		if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0)
+		if (!test_bit(MCC_TAG_STATE_RUNNING,
+			      &ctrl->ptag_state[tag].tag_state))
 			break;
 		udelay(100);
 	}
-	if (i == mcc_timeout) {
-		beiscsi_log(phba, KERN_ERR,
-			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
-			    "BC_%d : FW Timed Out\n");
-		phba->fw_timeout = true;
-		beiscsi_ue_detect(phba);
-		return -EBUSY;
-	}
-	return 0;
+
+	if (i < mcc_timeout)
+		return 0;
+
+	beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
+		    "BC_%d : FW Timed Out\n");
+	phba->fw_timeout = true;
+	beiscsi_ue_detect(phba);
+	return -EBUSY;
+}
+
+void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
+{
+	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
+	u32 val = 0;
+
+	set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state);
+	val |= mccq->id & DB_MCCQ_RING_ID_MASK;
+	val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
+	/* make request available for DMA */
+	wmb();
+	iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
 }
 
 /*
-- 
2.5.0


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

* [PATCH 07/12] be2iscsi: Cleanup processing of BMBX completion
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (5 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 11:41   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection Jitendra Bhivare
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

Remove confusingly named be_mcc_compl_is_new and be_mcc_compl_use functions
in processing of BMBX. Rearrange beiscsi_process_mbox_compl function.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_cmds.c | 75 ++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 60db2de..728aa133 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -263,21 +263,6 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
 	return rc;
 }
 
-static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
-{
-	if (compl->flags != 0) {
-		compl->flags = le32_to_cpu(compl->flags);
-		WARN_ON((compl->flags & CQE_FLAGS_VALID_MASK) == 0);
-		return true;
-	} else
-		return false;
-}
-
-static inline void be_mcc_compl_use(struct be_mcc_compl *compl)
-{
-	compl->flags = 0;
-}
-
 /*
  * beiscsi_process_mbox_compl()- Check the MBX completion status
  * @ctrl: Function specific MBX data structure
@@ -298,30 +283,46 @@ static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl,
 	struct be_cmd_req_hdr *hdr = embedded_payload(wrb);
 	struct be_cmd_resp_hdr *resp_hdr;
 
-	be_dws_le_to_cpu(compl, 4);
+	/**
+	 * To check if valid bit is set, check the entire word as we don't know
+	 * the endianness of the data (old entry is host endian while a new
+	 * entry is little endian)
+	 */
+	if (!compl->flags) {
+		beiscsi_log(phba, KERN_ERR,
+				BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
+				"BC_%d : BMBX busy, no completion\n");
+		return -EBUSY;
+	}
+	compl->flags = le32_to_cpu(compl->flags);
+	WARN_ON((compl->flags & CQE_FLAGS_VALID_MASK) == 0);
 
+	/**
+	 * Just swap the status to host endian;
+	 * mcc tag is opaquely copied from mcc_wrb.
+	 */
+	be_dws_le_to_cpu(compl, 4);
 	compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
-					CQE_STATUS_COMPL_MASK;
-	if (compl_status != MCC_STATUS_SUCCESS) {
-		extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
-						CQE_STATUS_EXTD_MASK;
+		CQE_STATUS_COMPL_MASK;
+	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
+		CQE_STATUS_EXTD_MASK;
+	/* Need to reset the entire word that houses the valid bit */
+	compl->flags = 0;
 
-		beiscsi_log(phba, KERN_ERR,
-			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
-			    "BC_%d : error in cmd completion: "
-			    "Subsystem : %d Opcode : %d "
-			    "status(compl/extd)=%d/%d\n",
-			    hdr->subsystem, hdr->opcode,
-			    compl_status, extd_status);
-
-		if (compl_status == MCC_STATUS_INSUFFICIENT_BUFFER) {
-			resp_hdr = (struct be_cmd_resp_hdr *) hdr;
-			if (resp_hdr->response_length)
-				return 0;
-		}
-		return -EINVAL;
+	if (compl_status == MCC_STATUS_SUCCESS)
+		return 0;
+
+	beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
+		    "BC_%d : error in cmd completion: Subsystem : %d Opcode : %d status(compl/extd)=%d/%d\n",
+		    hdr->subsystem, hdr->opcode, compl_status, extd_status);
+
+	if (compl_status == MCC_STATUS_INSUFFICIENT_BUFFER) {
+		/* if status is insufficient buffer, check the length */
+		resp_hdr = (struct be_cmd_resp_hdr *) hdr;
+		if (resp_hdr->response_length)
+			return 0;
 	}
-	return 0;
+	return -EINVAL;
 }
 
 static void beiscsi_process_async_link(struct beiscsi_hba *phba,
@@ -453,10 +454,6 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
 	struct be_dma_mem *tag_mem;
 	unsigned int tag, wrb_idx;
 
-	/**
-	 * Just swap the status to host endian; mcc tag is opaquely copied
-	 * from mcc_wrb
-	 */
 	be_dws_le_to_cpu(compl, 4);
 	tag = (compl->tag0 & MCC_Q_CMD_TAG_MASK);
 	wrb_idx = (compl->tag0 & CQE_STATUS_WRB_MASK) >> CQE_STATUS_WRB_SHIFT;
-- 
2.5.0


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

* [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (6 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 07/12] be2iscsi: Cleanup processing of BMBX completion Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 11:45   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 09/12] be2iscsi: Couple MCC tag and WRB alloc and free Jitendra Bhivare
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

In open with IP of unknown address family, only tag is freed and error
returned. MCC WRB allocated for the operation is not freed.

Added check for supported family of IP in the beginning before
allocating the tag and WRB.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_mgmt.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 85044b8..ccac1d7 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -829,6 +829,13 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
 	unsigned short cid = beiscsi_ep->ep_cid;
 	struct be_sge *sge;
 
+	if (dst_addr->sa_family != PF_INET && dst_addr->sa_family != PF_INET6) {
+		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
+			    "BG_%d : unknown addr family %d\n",
+			    dst_addr->sa_family);
+		return -EINVAL;
+	}
+
 	phwi_ctrlr = phba->phwi_ctrlr;
 	phwi_context = phwi_ctrlr->phwi_ctxt;
 
@@ -868,7 +875,8 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
 		beiscsi_ep->dst_addr = daddr_in->sin_addr.s_addr;
 		beiscsi_ep->dst_tcpport = ntohs(daddr_in->sin_port);
 		beiscsi_ep->ip_type = BE2_IPV4;
-	} else if (dst_addr->sa_family == PF_INET6) {
+	} else {
+		/* else its PF_INET6 family */
 		req->ip_address.ip_type = BE2_IPV6;
 		memcpy(&req->ip_address.addr,
 		       &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
@@ -877,14 +885,6 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
 		memcpy(&beiscsi_ep->dst6_addr,
 		       &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
 		beiscsi_ep->ip_type = BE2_IPV6;
-	} else{
-		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
-			    "BG_%d : unknown addr family %d\n",
-			    dst_addr->sa_family);
-		mutex_unlock(&ctrl->mbox_lock);
-		free_mcc_tag(&phba->ctrl, tag);
-		return -EINVAL;
-
 	}
 	req->cid = cid;
 	i = phba->nxt_cqid++;
-- 
2.5.0


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

* [PATCH 09/12] be2iscsi: Couple MCC tag and WRB alloc and free
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (7 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 12:14   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks Jitendra Bhivare
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

WARN_ON(atomic_read(&mccq->used) >= mccq->len) seen when FW gets into UE.

MCCQ overflow is happening because driver discards any new request and
frees up the tag. The tag allocation controls the number of MCC WRB posted.
It is being replenished but WRBs are not hence the WARN_ON.

Allocation and freeing of WRB and tags for MCC is now done in one place.
This helps to achieve proper accounting of WRB indices and MCC tags.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be.h      |   2 +-
 drivers/scsi/be2iscsi/be_cmds.c | 103 +++++++++++++++++++++---------
 drivers/scsi/be2iscsi/be_cmds.h |   6 +-
 drivers/scsi/be2iscsi/be_main.c |   3 +-
 drivers/scsi/be2iscsi/be_mgmt.c | 134 +++++++++++++++-------------------------
 5 files changed, 130 insertions(+), 118 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index da1d87a..ee5ace8 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -42,7 +42,7 @@ struct be_queue_info {
 	u16 id;
 	u16 tail, head;
 	bool created;
-	atomic_t used;		/* Number of valid elements in the queue */
+	u16 used;		/* Number of valid elements in the queue */
 };
 
 static inline u32 MODULO(u16 val, u16 limit)
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 728aa133..a55eaee 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -126,8 +126,62 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
 	return tag;
 }
 
-void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
+struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba,
+				 unsigned int *ref_tag)
 {
+	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
+	struct be_mcc_wrb *wrb = NULL;
+	unsigned int tag;
+
+	spin_lock_bh(&phba->ctrl.mcc_lock);
+	if (mccq->used == mccq->len) {
+		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT |
+			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
+			    "BC_%d : MCC queue full: WRB used %u tag avail %u\n",
+			    mccq->used, phba->ctrl.mcc_tag_available);
+		goto alloc_failed;
+	}
+
+	if (!phba->ctrl.mcc_tag_available)
+		goto alloc_failed;
+
+	tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index];
+	if (!tag) {
+		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT |
+			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
+			    "BC_%d : MCC tag 0 allocated: tag avail %u alloc index %u\n",
+			    phba->ctrl.mcc_tag_available,
+			    phba->ctrl.mcc_alloc_index);
+		goto alloc_failed;
+	}
+
+	/* return this tag for further reference */
+	*ref_tag = tag;
+	phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0;
+	phba->ctrl.mcc_tag_status[tag] = 0;
+	phba->ctrl.ptag_state[tag].tag_state = 0;
+	phba->ctrl.mcc_tag_available--;
+	if (phba->ctrl.mcc_alloc_index == (MAX_MCC_CMD - 1))
+		phba->ctrl.mcc_alloc_index = 0;
+	else
+		phba->ctrl.mcc_alloc_index++;
+
+	wrb = queue_head_node(mccq);
+	memset(wrb, 0, sizeof(*wrb));
+	wrb->tag0 = tag;
+	wrb->tag0 |= (mccq->head << MCC_Q_WRB_IDX_SHIFT) & MCC_Q_WRB_IDX_MASK;
+	queue_head_inc(mccq);
+	mccq->used++;
+
+alloc_failed:
+	spin_unlock_bh(&phba->ctrl.mcc_lock);
+	return wrb;
+}
+
+void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag)
+{
+	struct be_queue_info *mccq = &ctrl->mcc_obj.q;
+
 	spin_lock_bh(&ctrl->mcc_lock);
 	tag = tag & MCC_Q_CMD_TAG_MASK;
 	ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
@@ -136,6 +190,7 @@ void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
 	else
 		ctrl->mcc_free_index++;
 	ctrl->mcc_tag_available++;
+	mccq->used--;
 	spin_unlock_bh(&ctrl->mcc_lock);
 }
 
@@ -173,10 +228,8 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
 	struct be_cmd_resp_hdr *mbx_resp_hdr;
 	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
 
-	if (beiscsi_error(phba)) {
-		free_mcc_tag(&phba->ctrl, tag);
+	if (beiscsi_error(phba))
 		return -EPERM;
-	}
 
 	/* wait for the mccq completion */
 	rc = wait_event_interruptible_timeout(
@@ -259,7 +312,7 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
 		}
 	}
 
-	free_mcc_tag(&phba->ctrl, tag);
+	free_mcc_wrb(&phba->ctrl, tag);
 	return rc;
 }
 
@@ -479,7 +532,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
 		if (tag_mem->size)
 			pci_free_consistent(ctrl->pdev, tag_mem->size,
 					tag_mem->va, tag_mem->dma);
-		free_mcc_tag(ctrl, tag);
+		free_mcc_wrb(ctrl, tag);
 		return 0;
 	}
 
@@ -519,15 +572,24 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 	int i;
 
+	if (!test_bit(MCC_TAG_STATE_RUNNING,
+		      &ctrl->ptag_state[tag].tag_state)) {
+		beiscsi_log(phba, KERN_ERR,
+			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
+			    "BC_%d: tag %u state not running\n", tag);
+		return 0;
+	}
 	for (i = 0; i < mcc_timeout; i++) {
 		if (beiscsi_error(phba))
 			return -EIO;
 
 		beiscsi_process_mcc_cq(phba);
-
+		/* after polling, wrb and tag need to be released */
 		if (!test_bit(MCC_TAG_STATE_RUNNING,
-			      &ctrl->ptag_state[tag].tag_state))
+			      &ctrl->ptag_state[tag].tag_state)) {
+			free_mcc_wrb(ctrl, tag);
 			break;
+		}
 		udelay(100);
 	}
 
@@ -717,21 +779,6 @@ struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem)
 	return &((struct be_mcc_mailbox *)(mbox_mem->va))->wrb;
 }
 
-struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba)
-{
-	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
-	struct be_mcc_wrb *wrb;
-
-	WARN_ON(atomic_read(&mccq->used) >= mccq->len);
-	wrb = queue_head_node(mccq);
-	memset(wrb, 0, sizeof(*wrb));
-	wrb->tag0 = (mccq->head << MCC_Q_WRB_IDX_SHIFT) & MCC_Q_WRB_IDX_MASK;
-	queue_head_inc(mccq);
-	atomic_inc(&mccq->used);
-	return wrb;
-}
-
-
 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
 			  struct be_queue_info *eq, int eq_delay)
 {
@@ -1328,22 +1375,20 @@ int beiscsi_cmd_reset_function(struct beiscsi_hba  *phba)
 int be_cmd_set_vlan(struct beiscsi_hba *phba,
 		     uint16_t vlan_tag)
 {
-	unsigned int tag = 0;
+	unsigned int tag;
 	struct be_mcc_wrb *wrb;
 	struct be_cmd_set_vlan_req *req;
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 
 	if (mutex_lock_interruptible(&ctrl->mbox_lock))
 		return 0;
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
 
-	wrb = wrb_from_mccq(phba);
 	req = embedded_payload(wrb);
-	wrb->tag0 |= tag;
 	be_wrb_hdr_prepare(wrb, sizeof(*wrb), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
 			   OPCODE_COMMON_ISCSI_NTWK_SET_VLAN,
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index b14ac01..deeb951 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -728,7 +728,7 @@ int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
 				      struct beiscsi_hba *phba);
 unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
 
-void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
+void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag);
 
 int be_cmd_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *,
 			    int num);
@@ -740,10 +740,10 @@ int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
 int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
 
 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
-struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
 int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag);
 void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag);
-unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
+struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba,
+				 unsigned int *ref_tag);
 void beiscsi_process_async_event(struct beiscsi_hba *phba,
 				struct be_mcc_compl *compl);
 int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index dfc2ee9..3f08a11 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2047,7 +2047,6 @@ void beiscsi_process_mcc_cq(struct beiscsi_hba *phba)
 			beiscsi_process_async_event(phba, mcc_compl);
 		} else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) {
 			beiscsi_process_mcc_compl(&phba->ctrl, mcc_compl);
-			atomic_dec(&phba->ctrl.mcc_obj.q.used);
 		}
 
 		mcc_compl->flags = 0;
@@ -5245,7 +5244,7 @@ static int beiscsi_bsg_request(struct bsg_job *job)
 		extd_status = (phba->ctrl.mcc_tag_status[tag] &
 			       CQE_STATUS_ADDL_MASK) >> CQE_STATUS_ADDL_SHIFT;
 		status = phba->ctrl.mcc_tag_status[tag] & CQE_STATUS_MASK;
-		free_mcc_tag(&phba->ctrl, tag);
+		free_mcc_wrb(&phba->ctrl, tag);
 		resp = (struct be_cmd_resp_hdr *)nonemb_cmd.va;
 		sg_copy_from_buffer(job->reply_payload.sg_list,
 				    job->reply_payload.sg_cnt,
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index ccac1d7..83926e2 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -161,20 +161,17 @@ int be_cmd_modify_eq_delay(struct beiscsi_hba *phba,
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 	struct be_mcc_wrb *wrb;
 	struct be_cmd_req_modify_eq_delay *req;
-	unsigned int tag = 0;
+	unsigned int tag;
 	int i;
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
 
-	wrb = wrb_from_mccq(phba);
 	req = embedded_payload(wrb);
-
-	wrb->tag0 |= tag;
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
 		OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req));
@@ -209,22 +206,20 @@ unsigned int mgmt_reopen_session(struct beiscsi_hba *phba,
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 	struct be_mcc_wrb *wrb;
 	struct be_cmd_reopen_session_req *req;
-	unsigned int tag = 0;
+	unsigned int tag;
 
 	beiscsi_log(phba, KERN_INFO,
 		    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
 		    "BG_%d : In bescsi_get_boot_target\n");
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
 
-	wrb = wrb_from_mccq(phba);
 	req = embedded_payload(wrb);
-	wrb->tag0 |= tag;
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
 			   OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS,
@@ -244,22 +239,20 @@ unsigned int mgmt_get_boot_target(struct beiscsi_hba *phba)
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 	struct be_mcc_wrb *wrb;
 	struct be_cmd_get_boot_target_req *req;
-	unsigned int tag = 0;
+	unsigned int tag;
 
 	beiscsi_log(phba, KERN_INFO,
 		    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
 		    "BG_%d : In bescsi_get_boot_target\n");
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
 
-	wrb = wrb_from_mccq(phba);
 	req = embedded_payload(wrb);
-	wrb->tag0 |= tag;
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
 			   OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET,
@@ -276,7 +269,7 @@ unsigned int mgmt_get_session_info(struct beiscsi_hba *phba,
 {
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 	struct be_mcc_wrb *wrb;
-	unsigned int tag = 0;
+	unsigned int tag;
 	struct  be_cmd_get_session_req *req;
 	struct be_cmd_get_session_resp *resp;
 	struct be_sge *sge;
@@ -286,21 +279,16 @@ unsigned int mgmt_get_session_info(struct beiscsi_hba *phba,
 		    "BG_%d : In beiscsi_get_session_info\n");
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
 
 	nonemb_cmd->size = sizeof(*resp);
 	req = nonemb_cmd->va;
 	memset(req, 0, sizeof(*req));
-	wrb = wrb_from_mccq(phba);
 	sge = nonembedded_sgl(wrb);
-	wrb->tag0 |= tag;
-
-
-	wrb->tag0 |= tag;
 	be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
 			   OPCODE_ISCSI_INI_SESSION_GET_A_SESSION,
@@ -624,20 +612,18 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
 		return -ENOSYS;
 	}
 
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
 
-	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));
 	mcc_sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
 	mcc_sge->len = cpu_to_le32(nonemb_cmd->size);
-	wrb->tag0 |= tag;
 
 	be_mcc_notify(phba, tag);
 
@@ -657,22 +643,22 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
 int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num)
 {
 	struct be_ctrl_info *ctrl = &phba->ctrl;
-	struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
-	struct iscsi_cleanup_req *req = embedded_payload(wrb);
+	struct be_mcc_wrb *wrb;
+	struct iscsi_cleanup_req *req;
 	unsigned int tag;
 	int status;
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
 		return -EBUSY;
 	}
 
+	req = embedded_payload(wrb);
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
 			   OPCODE_COMMON_ISCSI_CLEANUP, sizeof(*req));
-	wrb->tag0 |= tag;
 
 	req->chute = (1 << ulp_num);
 	req->hdr_ring_id = cpu_to_le16(HWI_GET_DEF_HDRQ_ID(phba, ulp_num));
@@ -697,20 +683,18 @@ unsigned int  mgmt_invalidate_icds(struct beiscsi_hba *phba,
 	struct be_mcc_wrb *wrb;
 	struct be_sge *sge;
 	struct invalidate_commands_params_in *req;
-	unsigned int i, tag = 0;
+	unsigned int i, tag;
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
 
 	req = nonemb_cmd->va;
 	memset(req, 0, sizeof(*req));
-	wrb = wrb_from_mccq(phba);
 	sge = nonembedded_sgl(wrb);
-	wrb->tag0 |= tag;
 
 	be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
@@ -745,15 +729,13 @@ unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba,
 	unsigned int tag = 0;
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
-	wrb = wrb_from_mccq(phba);
-	wrb->tag0 |= tag;
-	req = embedded_payload(wrb);
 
+	req = embedded_payload(wrb);
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
 			   OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION,
@@ -776,18 +758,16 @@ unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 	struct be_mcc_wrb *wrb;
 	struct tcp_upload_params_in *req;
-	unsigned int tag = 0;
+	unsigned int tag;
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
-	wrb = wrb_from_mccq(phba);
-	req = embedded_payload(wrb);
-	wrb->tag0 |= tag;
 
+	req = embedded_payload(wrb);
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_COMMON_TCP_UPLOAD,
 			   OPCODE_COMMON_TCP_UPLOAD, sizeof(*req));
@@ -848,17 +828,15 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
 	ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address);
 	if (mutex_lock_interruptible(&ctrl->mbox_lock))
 		return 0;
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
-	wrb = wrb_from_mccq(phba);
-	sge = nonembedded_sgl(wrb);
 
+	sge = nonembedded_sgl(wrb);
 	req = nonemb_cmd->va;
 	memset(req, 0, sizeof(*req));
-	wrb->tag0 |= tag;
 
 	be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
@@ -925,16 +903,13 @@ unsigned int mgmt_get_all_if_id(struct beiscsi_hba *phba)
 
 	if (mutex_lock_interruptible(&ctrl->mbox_lock))
 		return -EINTR;
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
 		return -ENOMEM;
 	}
 
-	wrb = wrb_from_mccq(phba);
 	req = embedded_payload(wrb);
-	wrb->tag0 |= tag;
-
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
 			   OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID,
@@ -974,17 +949,14 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
 	int rc = 0;
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
 		rc = -ENOMEM;
 		goto free_cmd;
 	}
 
-	wrb = wrb_from_mccq(phba);
-	wrb->tag0 |= tag;
 	sge = nonembedded_sgl(wrb);
-
 	be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1);
 	sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
 	sge->pa_lo = cpu_to_le32(lower_32_bits(nonemb_cmd->dma));
@@ -1368,22 +1340,20 @@ int mgmt_get_nic_conf(struct beiscsi_hba *phba,
 
 unsigned int be_cmd_get_initname(struct beiscsi_hba *phba)
 {
-	unsigned int tag = 0;
+	unsigned int tag;
 	struct be_mcc_wrb *wrb;
 	struct be_cmd_hba_name *req;
 	struct be_ctrl_info *ctrl = &phba->ctrl;
 
 	if (mutex_lock_interruptible(&ctrl->mbox_lock))
 		return 0;
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
-		return tag;
+		return 0;
 	}
 
-	wrb = wrb_from_mccq(phba);
 	req = embedded_payload(wrb);
-	wrb->tag0 |= tag;
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
 			OPCODE_ISCSI_INI_CFG_GET_HBA_NAME,
@@ -1847,8 +1817,8 @@ int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
 		    "BG_%d : In bescsi_logout_fwboot_sess\n");
 
 	mutex_lock(&ctrl->mbox_lock);
-	tag = alloc_mcc_tag(phba);
-	if (!tag) {
+	wrb = alloc_mcc_wrb(phba, &tag);
+	if (!wrb) {
 		mutex_unlock(&ctrl->mbox_lock);
 		beiscsi_log(phba, KERN_INFO,
 			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
@@ -1856,9 +1826,7 @@ int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
 		return -EINVAL;
 	}
 
-	wrb = wrb_from_mccq(phba);
 	req = embedded_payload(wrb);
-	wrb->tag0 |= tag;
 	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
 			   OPCODE_ISCSI_INI_SESSION_LOGOUT_TARGET,
-- 
2.5.0


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

* [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (8 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 09/12] be2iscsi: Couple MCC tag and WRB alloc and free Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 12:24   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 11/12] be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock Jitendra Bhivare
  2016-02-01 10:12 ` [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free Jitendra Bhivare
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

Connection resets observed from some targets when NOP-Out with wrong
ExpStatSn is sent.

FW keeps track of StatSn and fills up ExpStatSn accordingly.
The header filled up by the stack needs to be modified by driver to clear
ExpStatSn. If the field is not cleared, FW recalculates ExpStatSn and
wrong offset'ed ExpStatSn is seen in the wire trace.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_main.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 3f08a11..03265b6 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4926,7 +4926,6 @@ int beiscsi_iotask_v2(struct iscsi_task *task, struct scatterlist *sg,
 
 	pwrb = io_task->pwrb_handle->pwrb;
 
-	io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
 	io_task->bhs_len = sizeof(struct be_cmd_bhs);
 
 	if (writedir) {
@@ -4987,7 +4986,6 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
 	unsigned int doorbell = 0;
 
 	pwrb = io_task->pwrb_handle->pwrb;
-	io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
 	io_task->bhs_len = sizeof(struct be_cmd_bhs);
 
 	if (writedir) {
@@ -5159,23 +5157,21 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
 {
 	struct beiscsi_io_task *io_task = task->dd_data;
 	struct scsi_cmnd *sc = task->sc;
-	struct beiscsi_hba *phba = NULL;
+	struct beiscsi_hba *phba;
 	struct scatterlist *sg;
 	int num_sg;
 	unsigned int  writedir = 0, xferlen = 0;
 
-	phba = ((struct beiscsi_conn *)task->conn->dd_data)->phba;
+	if (!io_task->conn->login_in_progress)
+		task->hdr->exp_statsn = 0;
 
 	if (!sc)
 		return beiscsi_mtask(task);
 
 	io_task->scsi_cmnd = sc;
 	num_sg = scsi_dma_map(sc);
+	phba = io_task->conn->phba;
 	if (num_sg < 0) {
-		struct iscsi_conn *conn = task->conn;
-		struct beiscsi_hba *phba = NULL;
-
-		phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
 		beiscsi_log(phba, KERN_ERR,
 			    BEISCSI_LOG_IO | BEISCSI_LOG_ISCSI,
 			    "BM_%d : scsi_dma_map Failed "
-- 
2.5.0


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

* [PATCH 11/12] be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (9 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 12:26   ` Johannes Thumshirn
  2016-02-01 10:12 ` [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free Jitendra Bhivare
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

Processing of mgmt and IO tasks are done in process context and sofitrqs.

Allocation and freeing of sgl_handles needs to be done under
spin_lock_bh/spin_unlock_bh and move the locks to the routines.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_main.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 03265b6..fa2b589 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1132,6 +1132,7 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba)
 {
 	struct sgl_handle *psgl_handle;
 
+	spin_lock_bh(&phba->io_sgl_lock);
 	if (phba->io_sgl_hndl_avbl) {
 		beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO,
 			    "BM_%d : In alloc_io_sgl_handle,"
@@ -1149,12 +1150,14 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba)
 			phba->io_sgl_alloc_index++;
 	} else
 		psgl_handle = NULL;
+	spin_unlock_bh(&phba->io_sgl_lock);
 	return psgl_handle;
 }
 
 static void
 free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
 {
+	spin_lock_bh(&phba->io_sgl_lock);
 	beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO,
 		    "BM_%d : In free_,io_sgl_free_index=%d\n",
 		    phba->io_sgl_free_index);
@@ -1169,6 +1172,7 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
 			     "value there=%p\n", phba->io_sgl_free_index,
 			     phba->io_sgl_hndl_base
 			     [phba->io_sgl_free_index]);
+		 spin_unlock_bh(&phba->io_sgl_lock);
 		return;
 	}
 	phba->io_sgl_hndl_base[phba->io_sgl_free_index] = psgl_handle;
@@ -1177,6 +1181,7 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
 		phba->io_sgl_free_index = 0;
 	else
 		phba->io_sgl_free_index++;
+	spin_unlock_bh(&phba->io_sgl_lock);
 }
 
 static inline struct wrb_handle *
@@ -1257,6 +1262,7 @@ static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba)
 {
 	struct sgl_handle *psgl_handle;
 
+	spin_lock_bh(&phba->mgmt_sgl_lock);
 	if (phba->eh_sgl_hndl_avbl) {
 		psgl_handle = phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index];
 		phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index] = NULL;
@@ -1274,13 +1280,14 @@ static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba)
 			phba->eh_sgl_alloc_index++;
 	} else
 		psgl_handle = NULL;
+	spin_unlock_bh(&phba->mgmt_sgl_lock);
 	return psgl_handle;
 }
 
 void
 free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
 {
-
+	spin_lock_bh(&phba->mgmt_sgl_lock);
 	beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
 		    "BM_%d : In  free_mgmt_sgl_handle,"
 		    "eh_sgl_free_index=%d\n",
@@ -1295,6 +1302,7 @@ free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
 			    "BM_%d : Double Free in eh SGL ,"
 			    "eh_sgl_free_index=%d\n",
 			    phba->eh_sgl_free_index);
+		spin_unlock_bh(&phba->mgmt_sgl_lock);
 		return;
 	}
 	phba->eh_sgl_hndl_base[phba->eh_sgl_free_index] = psgl_handle;
@@ -1304,6 +1312,7 @@ free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
 		phba->eh_sgl_free_index = 0;
 	else
 		phba->eh_sgl_free_index++;
+	spin_unlock_bh(&phba->mgmt_sgl_lock);
 }
 
 static void
@@ -4616,11 +4625,9 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn,
 	}
 
 	if (io_task->psgl_handle) {
-		spin_lock_bh(&phba->mgmt_sgl_lock);
 		free_mgmt_sgl_handle(phba,
 				     io_task->psgl_handle);
 		io_task->psgl_handle = NULL;
-		spin_unlock_bh(&phba->mgmt_sgl_lock);
 	}
 
 	if (io_task->mtask_addr) {
@@ -4666,9 +4673,7 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
 		}
 
 		if (io_task->psgl_handle) {
-			spin_lock(&phba->io_sgl_lock);
 			free_io_sgl_handle(phba, io_task->psgl_handle);
-			spin_unlock(&phba->io_sgl_lock);
 			io_task->psgl_handle = NULL;
 		}
 
@@ -4784,9 +4789,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
 	io_task->pwrb_handle = NULL;
 
 	if (task->sc) {
-		spin_lock(&phba->io_sgl_lock);
 		io_task->psgl_handle = alloc_io_sgl_handle(phba);
-		spin_unlock(&phba->io_sgl_lock);
 		if (!io_task->psgl_handle) {
 			beiscsi_log(phba, KERN_ERR,
 				    BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
@@ -4811,10 +4814,8 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
 		if ((opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) {
 			beiscsi_conn->task = task;
 			if (!beiscsi_conn->login_in_progress) {
-				spin_lock(&phba->mgmt_sgl_lock);
 				io_task->psgl_handle = (struct sgl_handle *)
 						alloc_mgmt_sgl_handle(phba);
-				spin_unlock(&phba->mgmt_sgl_lock);
 				if (!io_task->psgl_handle) {
 					beiscsi_log(phba, KERN_ERR,
 						    BEISCSI_LOG_IO |
@@ -4853,9 +4854,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
 						beiscsi_conn->plogin_wrb_handle;
 			}
 		} else {
-			spin_lock(&phba->mgmt_sgl_lock);
 			io_task->psgl_handle = alloc_mgmt_sgl_handle(phba);
-			spin_unlock(&phba->mgmt_sgl_lock);
 			if (!io_task->psgl_handle) {
 				beiscsi_log(phba, KERN_ERR,
 					    BEISCSI_LOG_IO |
@@ -4890,15 +4889,11 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
 	return 0;
 
 free_io_hndls:
-	spin_lock(&phba->io_sgl_lock);
 	free_io_sgl_handle(phba, io_task->psgl_handle);
-	spin_unlock(&phba->io_sgl_lock);
 	goto free_hndls;
 free_mgmt_hndls:
-	spin_lock(&phba->mgmt_sgl_lock);
 	free_mgmt_sgl_handle(phba, io_task->psgl_handle);
 	io_task->psgl_handle = NULL;
-	spin_unlock(&phba->mgmt_sgl_lock);
 free_hndls:
 	phwi_ctrlr = phba->phwi_ctrlr;
 	cri_index = BE_GET_CRI_FROM_CID(
-- 
2.5.0


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

* [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free
  2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
                   ` (10 preceding siblings ...)
  2016-02-01 10:12 ` [PATCH 11/12] be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock Jitendra Bhivare
@ 2016-02-01 10:12 ` Jitendra Bhivare
  2016-02-01 12:27   ` Johannes Thumshirn
  11 siblings, 1 reply; 28+ messages in thread
From: Jitendra Bhivare @ 2016-02-01 10:12 UTC (permalink / raw)
  To: linux-scsi, michaelc; +Cc: Jitendra Bhivare

FW got into UE after running IO stress test

With kernel change to split session lock in frwd_lock and back_lock for tx
and rx path correspondingly, in the IO path, common resource used in driver
such as WRB was left unprotected.

Add wrb_lock spinlock to protect allocation and freeing of WRB.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
---
 drivers/scsi/be2iscsi/be_main.c | 5 +++++
 drivers/scsi/be2iscsi/be_main.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index fa2b589..0892ee2 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1190,12 +1190,14 @@ beiscsi_get_wrb_handle(struct hwi_wrb_context *pwrb_context,
 {
 	struct wrb_handle *pwrb_handle;
 
+	spin_lock_bh(&pwrb_context->wrb_lock);
 	pwrb_handle = pwrb_context->pwrb_handle_base[pwrb_context->alloc_index];
 	pwrb_context->wrb_handles_available--;
 	if (pwrb_context->alloc_index == (wrbs_per_cxn - 1))
 		pwrb_context->alloc_index = 0;
 	else
 		pwrb_context->alloc_index++;
+	spin_unlock_bh(&pwrb_context->wrb_lock);
 
 	return pwrb_handle;
 }
@@ -1227,12 +1229,14 @@ beiscsi_put_wrb_handle(struct hwi_wrb_context *pwrb_context,
 		       struct wrb_handle *pwrb_handle,
 		       unsigned int wrbs_per_cxn)
 {
+	spin_lock_bh(&pwrb_context->wrb_lock);
 	pwrb_context->pwrb_handle_base[pwrb_context->free_index] = pwrb_handle;
 	pwrb_context->wrb_handles_available++;
 	if (pwrb_context->free_index == (wrbs_per_cxn - 1))
 		pwrb_context->free_index = 0;
 	else
 		pwrb_context->free_index++;
+	spin_unlock_bh(&pwrb_context->wrb_lock);
 }
 
 /**
@@ -2920,6 +2924,7 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
 			}
 			num_cxn_wrbh--;
 		}
+		spin_lock_init(&pwrb_context->wrb_lock);
 	}
 	idx = 0;
 	for (index = 0; index < phba->params.cxns_per_ctrl; index++) {
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 5ded3fa..30a4606 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -304,6 +304,7 @@ struct invalidate_command_table {
 #define BEISCSI_GET_ULP_FROM_CRI(phwi_ctrlr, cri) \
 	(phwi_ctrlr->wrb_context[cri].ulp_num)
 struct hwi_wrb_context {
+	spinlock_t wrb_lock;
 	struct list_head wrb_handle_list;
 	struct list_head wrb_handle_drvr_list;
 	struct wrb_handle **pwrb_handle_base;
-- 
2.5.0


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

* Re: [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock
  2016-02-01 10:12 ` [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock Jitendra Bhivare
@ 2016-02-01 11:10   ` Johannes Thumshirn
  2016-02-01 11:15   ` James Bottomley
  1 sibling, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 11:10 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:40PM +0530, Jitendra Bhivare wrote:
> mcc_cq_lock spin_lock is used only in beiscsi_process_mcc which is called
> only when all interrupts are disabled from mgmt_epfw_cleanup during
> unloading of driver. There is no other context where there can be
> contention for the processing of CQ.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be.h      | 1 -
>  drivers/scsi/be2iscsi/be_cmds.c | 2 --
>  drivers/scsi/be2iscsi/be_main.c | 1 -
>  3 files changed, 4 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
> index 7d425af..1524fe4 100644
> --- a/drivers/scsi/be2iscsi/be.h
> +++ b/drivers/scsi/be2iscsi/be.h
> @@ -132,7 +132,6 @@ struct be_ctrl_info {
>  	/* MCC Rings */
>  	struct be_mcc_obj mcc_obj;
>  	spinlock_t mcc_lock;	/* For serializing mcc cmds to BE card */
> -	spinlock_t mcc_cq_lock;
>  
>  	wait_queue_head_t mcc_wait[MAX_MCC_CMD + 1];
>  	unsigned int mcc_tag[MAX_MCC_CMD];
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index 34c33d4..e8e9d22 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -532,7 +532,6 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
>  	int num = 0, status = 0;
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  
> -	spin_lock_bh(&phba->ctrl.mcc_cq_lock);
>  	while ((compl = be_mcc_compl_get(phba))) {
>  		if (compl->flags & CQE_FLAGS_ASYNC_MASK) {
>  			beiscsi_process_async_event(phba, compl);
> @@ -547,7 +546,6 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
>  	if (num)
>  		hwi_ring_cq_db(phba, phba->ctrl.mcc_obj.cq.id, num, 1);
>  
> -	spin_unlock_bh(&phba->ctrl.mcc_cq_lock);
>  	return status;
>  }
>  
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 70179e1..314fd2c 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -730,7 +730,6 @@ static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev)
>  	memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox));
>  	mutex_init(&ctrl->mbox_lock);
>  	spin_lock_init(&phba->ctrl.mcc_lock);
> -	spin_lock_init(&phba->ctrl.mcc_cq_lock);
>  
>  	return status;
>  }
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 02/12] be2iscsi: Use macros for MCC WRB and CQE fields
  2016-02-01 10:12 ` [PATCH 02/12] be2iscsi: Use macros for MCC WRB and CQE fields Jitendra Bhivare
@ 2016-02-01 11:13   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 11:13 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:41PM +0530, Jitendra Bhivare wrote:
> Rename mcc_numtag to mcc_tag_status.
> MCC CQE status is processed using macros already defined in be_cmds.h.
> 
> Add MCC_Q_WRB_ and MCC_Q_CMD_TAG_MASK macros to map to already defined
> CQE_STATUS_ macros to be consistent when posting MCC.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be.h      |  8 +++++++-
>  drivers/scsi/be2iscsi/be_cmds.c | 40 +++++++++++++++++++++-------------------
>  drivers/scsi/be2iscsi/be_cmds.h | 13 +++++++------
>  drivers/scsi/be2iscsi/be_main.c | 11 ++++++-----
>  4 files changed, 41 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
> index 1524fe4..da1d87a 100644
> --- a/drivers/scsi/be2iscsi/be.h
> +++ b/drivers/scsi/be2iscsi/be.h
> @@ -135,7 +135,7 @@ struct be_ctrl_info {
>  
>  	wait_queue_head_t mcc_wait[MAX_MCC_CMD + 1];
>  	unsigned int mcc_tag[MAX_MCC_CMD];
> -	unsigned int mcc_numtag[MAX_MCC_CMD + 1];
> +	unsigned int mcc_tag_status[MAX_MCC_CMD + 1];
>  	unsigned short mcc_alloc_index;
>  	unsigned short mcc_free_index;
>  	unsigned int mcc_tag_available;
> @@ -145,6 +145,12 @@ struct be_ctrl_info {
>  
>  #include "be_cmds.h"
>  
> +/* WRB index mask for MCC_Q_LEN queue entries */
> +#define MCC_Q_WRB_IDX_MASK	CQE_STATUS_WRB_MASK
> +#define MCC_Q_WRB_IDX_SHIFT	CQE_STATUS_WRB_SHIFT
> +/* TAG is from 1...MAX_MCC_CMD, MASK includes MAX_MCC_CMD */
> +#define MCC_Q_CMD_TAG_MASK	((MAX_MCC_CMD << 1) - 1)
> +
>  #define PAGE_SHIFT_4K 12
>  #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
>  #define mcc_timeout		120000 /* 12s timeout */
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index e8e9d22..c5e7739 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -125,7 +125,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
>  	if (phba->ctrl.mcc_tag_available) {
>  		tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index];
>  		phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0;
> -		phba->ctrl.mcc_numtag[tag] = 0;
> +		phba->ctrl.mcc_tag_status[tag] = 0;
>  		phba->ctrl.ptag_state[tag].tag_state = 0;
>  	}
>  	if (tag) {
> @@ -157,7 +157,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
>  		struct be_dma_mem *mbx_cmd_mem)
>  {
>  	int rc = 0;
> -	uint32_t mcc_tag_response;
> +	uint32_t mcc_tag_status;
>  	uint16_t status = 0, addl_status = 0, wrb_num = 0;
>  	struct be_mcc_wrb *temp_wrb;
>  	struct be_cmd_req_hdr *mbx_hdr;
> @@ -172,7 +172,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
>  	/* wait for the mccq completion */
>  	rc = wait_event_interruptible_timeout(
>  				phba->ctrl.mcc_wait[tag],
> -				phba->ctrl.mcc_numtag[tag],
> +				phba->ctrl.mcc_tag_status[tag],
>  				msecs_to_jiffies(
>  				BEISCSI_HOST_MBX_TIMEOUT));
>  	/**
> @@ -209,15 +209,15 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
>  	}
>  
>  	rc = 0;
> -	mcc_tag_response = phba->ctrl.mcc_numtag[tag];
> -	status = (mcc_tag_response & CQE_STATUS_MASK);
> -	addl_status = ((mcc_tag_response & CQE_STATUS_ADDL_MASK) >>
> +	mcc_tag_status = phba->ctrl.mcc_tag_status[tag];
> +	status = (mcc_tag_status & CQE_STATUS_MASK);
> +	addl_status = ((mcc_tag_status & CQE_STATUS_ADDL_MASK) >>
>  			CQE_STATUS_ADDL_SHIFT);
>  
>  	if (mbx_cmd_mem) {
>  		mbx_hdr = (struct be_cmd_req_hdr *)mbx_cmd_mem->va;
>  	} else {
> -		wrb_num = (mcc_tag_response & CQE_STATUS_WRB_MASK) >>
> +		wrb_num = (mcc_tag_status & CQE_STATUS_WRB_MASK) >>
>  			   CQE_STATUS_WRB_SHIFT;
>  		temp_wrb = (struct be_mcc_wrb *)queue_get_wrb(mccq, wrb_num);
>  		mbx_hdr = embedded_payload(temp_wrb);
> @@ -257,7 +257,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
>  void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
>  {
>  	spin_lock(&ctrl->mcc_lock);
> -	tag = tag & 0x000000FF;
> +	tag = tag & MCC_Q_CMD_TAG_MASK;
>  	ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
>  	if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
>  		ctrl->mcc_free_index = 0;
> @@ -334,10 +334,11 @@ int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
>  	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
>  	u16 compl_status, extd_status;
>  	struct be_dma_mem *tag_mem;
> -	unsigned short tag;
> +	unsigned int tag, wrb_idx;
>  
>  	be_dws_le_to_cpu(compl, 4);
> -	tag = (compl->tag0 & 0x000000FF);
> +	tag = (compl->tag0 & MCC_Q_CMD_TAG_MASK);
> +	wrb_idx = (compl->tag0 & CQE_STATUS_WRB_MASK) >> CQE_STATUS_WRB_SHIFT;
>  
>  	if (!test_bit(MCC_TAG_STATE_RUNNING,
>  		      &ctrl->ptag_state[tag].tag_state)) {
> @@ -366,17 +367,18 @@ int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
>  	}
>  
>  	compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
> -					CQE_STATUS_COMPL_MASK;
> -	/* The ctrl.mcc_numtag[tag] is filled with
> +		       CQE_STATUS_COMPL_MASK;
> +	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
> +		      CQE_STATUS_EXTD_MASK;
> +	/* The ctrl.mcc_tag_status[tag] is filled with
>  	 * [31] = valid, [30:24] = Rsvd, [23:16] = wrb, [15:8] = extd_status,
>  	 * [7:0] = compl_status
>  	 */
> -	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
> -					CQE_STATUS_EXTD_MASK;
> -	ctrl->mcc_numtag[tag]  = 0x80000000;
> -	ctrl->mcc_numtag[tag] |= (compl->tag0 & 0x00FF0000);
> -	ctrl->mcc_numtag[tag] |= (extd_status & 0x000000FF) << 8;
> -	ctrl->mcc_numtag[tag] |= (compl_status & 0x000000FF);
> +	ctrl->mcc_tag_status[tag] = CQE_VALID_MASK;
> +	ctrl->mcc_tag_status[tag] |= (wrb_idx << CQE_STATUS_WRB_SHIFT);
> +	ctrl->mcc_tag_status[tag] |= (extd_status << CQE_STATUS_ADDL_SHIFT) &
> +				     CQE_STATUS_ADDL_MASK;
> +	ctrl->mcc_tag_status[tag] |= (compl_status & CQE_STATUS_MASK);
>  
>  	/* write ordering implied in wake_up_interruptible */
>  	clear_bit(MCC_TAG_STATE_RUNNING, &ctrl->ptag_state[tag].tag_state);
> @@ -844,7 +846,7 @@ struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba)
>  	WARN_ON(atomic_read(&mccq->used) >= mccq->len);
>  	wrb = queue_head_node(mccq);
>  	memset(wrb, 0, sizeof(*wrb));
> -	wrb->tag0 = (mccq->head & 0x000000FF) << 16;
> +	wrb->tag0 = (mccq->head << MCC_Q_WRB_IDX_SHIFT) & MCC_Q_WRB_IDX_MASK;
>  	queue_head_inc(mccq);
>  	atomic_inc(&mccq->used);
>  	return wrb;
> diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
> index 7caf585..adafd9c 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.h
> +++ b/drivers/scsi/be2iscsi/be_cmds.h
> @@ -58,15 +58,16 @@ struct be_mcc_wrb {
>  #define MCC_STATUS_ILLEGAL_FIELD 0x3
>  #define MCC_STATUS_INSUFFICIENT_BUFFER 0x4
>  
> -#define CQE_STATUS_COMPL_MASK 0xFFFF
> -#define CQE_STATUS_COMPL_SHIFT 0	/* bits 0 - 15 */
> -#define CQE_STATUS_EXTD_MASK 0xFFFF
> -#define CQE_STATUS_EXTD_SHIFT 16		/* bits 0 - 15 */
> +#define CQE_STATUS_COMPL_MASK	0xFFFF
> +#define CQE_STATUS_COMPL_SHIFT	0		/* bits 0 - 15 */
> +#define CQE_STATUS_EXTD_MASK	0xFFFF
> +#define CQE_STATUS_EXTD_SHIFT	16		/* bits 31 - 16 */
>  #define CQE_STATUS_ADDL_MASK	0xFF00
> -#define CQE_STATUS_MASK	0xFF
> -#define CQE_STATUS_ADDL_SHIFT	0x08
> +#define CQE_STATUS_ADDL_SHIFT	8
> +#define CQE_STATUS_MASK		0xFF
>  #define CQE_STATUS_WRB_MASK	0xFF0000
>  #define CQE_STATUS_WRB_SHIFT	16
> +
>  #define BEISCSI_HOST_MBX_TIMEOUT (110 * 1000)
>  #define BEISCSI_FW_MBX_TIMEOUT	100
>  
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 314fd2c..aaf39d4 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -5241,11 +5241,12 @@ static int beiscsi_bsg_request(struct bsg_job *job)
>  
>  		rc = wait_event_interruptible_timeout(
>  					phba->ctrl.mcc_wait[tag],
> -					phba->ctrl.mcc_numtag[tag],
> +					phba->ctrl.mcc_tag_status[tag],
>  					msecs_to_jiffies(
>  					BEISCSI_HOST_MBX_TIMEOUT));
> -		extd_status = (phba->ctrl.mcc_numtag[tag] & 0x0000FF00) >> 8;
> -		status = phba->ctrl.mcc_numtag[tag] & 0x000000FF;
> +		extd_status = (phba->ctrl.mcc_tag_status[tag] &
> +			       CQE_STATUS_ADDL_MASK) >> CQE_STATUS_ADDL_SHIFT;
> +		status = phba->ctrl.mcc_tag_status[tag] & CQE_STATUS_MASK;
>  		free_mcc_tag(&phba->ctrl, tag);
>  		resp = (struct be_cmd_resp_hdr *)nonemb_cmd.va;
>  		sg_copy_from_buffer(job->reply_payload.sg_list,
> @@ -5580,7 +5581,7 @@ static void beiscsi_eeh_resume(struct pci_dev *pdev)
>  	for (i = 0; i < MAX_MCC_CMD; i++) {
>  		init_waitqueue_head(&phba->ctrl.mcc_wait[i + 1]);
>  		phba->ctrl.mcc_tag[i] = i + 1;
> -		phba->ctrl.mcc_numtag[i + 1] = 0;
> +		phba->ctrl.mcc_tag_status[i + 1] = 0;
>  		phba->ctrl.mcc_tag_available++;
>  	}
>  
> @@ -5739,7 +5740,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
>  	for (i = 0; i < MAX_MCC_CMD; i++) {
>  		init_waitqueue_head(&phba->ctrl.mcc_wait[i + 1]);
>  		phba->ctrl.mcc_tag[i] = i + 1;
> -		phba->ctrl.mcc_numtag[i + 1] = 0;
> +		phba->ctrl.mcc_tag_status[i + 1] = 0;
>  		phba->ctrl.mcc_tag_available++;
>  		memset(&phba->ctrl.ptag_state[i].tag_mem_state, 0,
>  		       sizeof(struct be_dma_mem));
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock
  2016-02-01 10:12 ` [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock Jitendra Bhivare
  2016-02-01 11:10   ` Johannes Thumshirn
@ 2016-02-01 11:15   ` James Bottomley
  2016-02-02  1:44     ` Martin K. Petersen
  1 sibling, 1 reply; 28+ messages in thread
From: James Bottomley @ 2016-02-01 11:15 UTC (permalink / raw)
  To: Jitendra Bhivare, linux-scsi, michaelc

On Mon, 2016-02-01 at 15:42 +0530, Jitendra Bhivare wrote:
> mcc_cq_lock spin_lock is used only in beiscsi_process_mcc which is
> called
> only when all interrupts are disabled from mgmt_epfw_cleanup during
> unloading of driver. There is no other context where there can be
> contention for the processing of CQ.

Removing a lock is not a bug fix unless it's causing a user visible
problem, so this patch (and quite a lot of others in this series)
should go through the merge window process.

For things that cause user visible problems, we need a description of
the problem in the changelog and a cc to stable unless it was a
regression in the 4.4+ merge window.

Thanks,

James


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

* Re: [PATCH 03/12] be2iscsi: Remove redundant MCC processing code
  2016-02-01 10:12 ` [PATCH 03/12] be2iscsi: Remove redundant MCC processing code Jitendra Bhivare
@ 2016-02-01 11:17   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 11:17 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:42PM +0530, Jitendra Bhivare wrote:
> be_mcc_compl_process_isr is removed.
> MCC CQ processing is done only in beiscsi_process_mcc_cq and MCC CQE
> processing is done only in beiscsi_process_mcc_compl.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_cmds.c | 164 ++++++++++++++--------------------------
>  drivers/scsi/be2iscsi/be_cmds.h |   7 +-
>  drivers/scsi/be2iscsi/be_main.c |   8 +-
>  drivers/scsi/be2iscsi/be_main.h |   1 +
>  drivers/scsi/be2iscsi/be_mgmt.c |   3 +-
>  5 files changed, 68 insertions(+), 115 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index c5e7739..fa010ac 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -328,76 +328,6 @@ static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
>  	return 0;
>  }
>  
> -int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
> -				    struct be_mcc_compl *compl)
> -{
> -	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
> -	u16 compl_status, extd_status;
> -	struct be_dma_mem *tag_mem;
> -	unsigned int tag, wrb_idx;
> -
> -	be_dws_le_to_cpu(compl, 4);
> -	tag = (compl->tag0 & MCC_Q_CMD_TAG_MASK);
> -	wrb_idx = (compl->tag0 & CQE_STATUS_WRB_MASK) >> CQE_STATUS_WRB_SHIFT;
> -
> -	if (!test_bit(MCC_TAG_STATE_RUNNING,
> -		      &ctrl->ptag_state[tag].tag_state)) {
> -		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_MBOX |
> -			    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
> -			    "BC_%d : MBX cmd completed but not posted\n");
> -		return 0;
> -	}
> -
> -	if (test_bit(MCC_TAG_STATE_TIMEOUT,
> -		     &ctrl->ptag_state[tag].tag_state)) {
> -		beiscsi_log(phba, KERN_WARNING,
> -			    BEISCSI_LOG_MBOX | BEISCSI_LOG_INIT |
> -			    BEISCSI_LOG_CONFIG,
> -			    "BC_%d : MBX Completion for timeout Command from FW\n");
> -		/**
> -		 * Check for the size before freeing resource.
> -		 * Only for non-embedded cmd, PCI resource is allocated.
> -		 **/
> -		tag_mem = &ctrl->ptag_state[tag].tag_mem_state;
> -		if (tag_mem->size)
> -			pci_free_consistent(ctrl->pdev, tag_mem->size,
> -					tag_mem->va, tag_mem->dma);
> -		free_mcc_tag(ctrl, tag);
> -		return 0;
> -	}
> -
> -	compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
> -		       CQE_STATUS_COMPL_MASK;
> -	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
> -		      CQE_STATUS_EXTD_MASK;
> -	/* The ctrl.mcc_tag_status[tag] is filled with
> -	 * [31] = valid, [30:24] = Rsvd, [23:16] = wrb, [15:8] = extd_status,
> -	 * [7:0] = compl_status
> -	 */
> -	ctrl->mcc_tag_status[tag] = CQE_VALID_MASK;
> -	ctrl->mcc_tag_status[tag] |= (wrb_idx << CQE_STATUS_WRB_SHIFT);
> -	ctrl->mcc_tag_status[tag] |= (extd_status << CQE_STATUS_ADDL_SHIFT) &
> -				     CQE_STATUS_ADDL_MASK;
> -	ctrl->mcc_tag_status[tag] |= (compl_status & CQE_STATUS_MASK);
> -
> -	/* write ordering implied in wake_up_interruptible */
> -	clear_bit(MCC_TAG_STATE_RUNNING, &ctrl->ptag_state[tag].tag_state);
> -	wake_up_interruptible(&ctrl->mcc_wait[tag]);
> -	return 0;
> -}
> -
> -static struct be_mcc_compl *be_mcc_compl_get(struct beiscsi_hba *phba)
> -{
> -	struct be_queue_info *mcc_cq = &phba->ctrl.mcc_obj.cq;
> -	struct be_mcc_compl *compl = queue_tail_node(mcc_cq);
> -
> -	if (be_mcc_compl_is_new(compl)) {
> -		queue_tail_inc(mcc_cq);
> -		return compl;
> -	}
> -	return NULL;
> -}
> -
>  /**
>   * beiscsi_fail_session(): Closing session with appropriate error
>   * @cls_session: ptr to session
> @@ -528,27 +458,65 @@ void beiscsi_process_async_event(struct beiscsi_hba *phba,
>  		    evt_code, compl->status, compl->flags);
>  }
>  
> -int beiscsi_process_mcc(struct beiscsi_hba *phba)
> +int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
> +			      struct be_mcc_compl *compl)
>  {
> -	struct be_mcc_compl *compl;
> -	int num = 0, status = 0;
> -	struct be_ctrl_info *ctrl = &phba->ctrl;
> +	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
> +	u16 compl_status, extd_status;
> +	struct be_dma_mem *tag_mem;
> +	unsigned int tag, wrb_idx;
>  
> -	while ((compl = be_mcc_compl_get(phba))) {
> -		if (compl->flags & CQE_FLAGS_ASYNC_MASK) {
> -			beiscsi_process_async_event(phba, compl);
> -		} else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) {
> -			status = be_mcc_compl_process(ctrl, compl);
> -			atomic_dec(&phba->ctrl.mcc_obj.q.used);
> -		}
> -		be_mcc_compl_use(compl);
> -		num++;
> +	/**
> +	 * Just swap the status to host endian; mcc tag is opaquely copied
> +	 * from mcc_wrb
> +	 */
> +	be_dws_le_to_cpu(compl, 4);
> +	tag = (compl->tag0 & MCC_Q_CMD_TAG_MASK);
> +	wrb_idx = (compl->tag0 & CQE_STATUS_WRB_MASK) >> CQE_STATUS_WRB_SHIFT;
> +
> +	if (!test_bit(MCC_TAG_STATE_RUNNING,
> +		      &ctrl->ptag_state[tag].tag_state)) {
> +		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_MBOX |
> +			    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
> +			    "BC_%d : MBX cmd completed but not posted\n");
> +		return 0;
>  	}
>  
> -	if (num)
> -		hwi_ring_cq_db(phba, phba->ctrl.mcc_obj.cq.id, num, 1);
> +	if (test_bit(MCC_TAG_STATE_TIMEOUT, &ctrl->ptag_state[tag].tag_state)) {
> +		beiscsi_log(phba, KERN_WARNING,
> +			    BEISCSI_LOG_MBOX | BEISCSI_LOG_INIT |
> +			    BEISCSI_LOG_CONFIG,
> +			    "BC_%d : MBX Completion for timeout Command from FW\n");
> +		/**
> +		 * Check for the size before freeing resource.
> +		 * Only for non-embedded cmd, PCI resource is allocated.
> +		 **/
> +		tag_mem = &ctrl->ptag_state[tag].tag_mem_state;
> +		if (tag_mem->size)
> +			pci_free_consistent(ctrl->pdev, tag_mem->size,
> +					tag_mem->va, tag_mem->dma);
> +		free_mcc_tag(ctrl, tag);
> +		return 0;
> +	}
>  
> -	return status;
> +	compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
> +		       CQE_STATUS_COMPL_MASK;
> +	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
> +		      CQE_STATUS_EXTD_MASK;
> +	/* The ctrl.mcc_tag_status[tag] is filled with
> +	 * [31] = valid, [30:24] = Rsvd, [23:16] = wrb, [15:8] = extd_status,
> +	 * [7:0] = compl_status
> +	 */
> +	ctrl->mcc_tag_status[tag] = CQE_VALID_MASK;
> +	ctrl->mcc_tag_status[tag] |= (wrb_idx << CQE_STATUS_WRB_SHIFT);
> +	ctrl->mcc_tag_status[tag] |= (extd_status << CQE_STATUS_ADDL_SHIFT) &
> +				     CQE_STATUS_ADDL_MASK;
> +	ctrl->mcc_tag_status[tag] |= (compl_status & CQE_STATUS_MASK);
> +
> +	/* write ordering forced in wake_up_interruptible */
> +	clear_bit(MCC_TAG_STATE_RUNNING, &ctrl->ptag_state[tag].tag_state);
> +	wake_up_interruptible(&ctrl->mcc_wait[tag]);
> +	return 0;
>  }
>  
>  /*
> @@ -562,16 +530,15 @@ int beiscsi_process_mcc(struct beiscsi_hba *phba)
>   * Failure: Non-Zero
>   *
>   **/
> -static int be_mcc_wait_compl(struct beiscsi_hba *phba)
> +int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
>  {
> -	int i, status;
> +	int i;
> +
>  	for (i = 0; i < mcc_timeout; i++) {
>  		if (beiscsi_error(phba))
>  			return -EIO;
>  
> -		status = beiscsi_process_mcc(phba);
> -		if (status)
> -			return status;
> +		beiscsi_process_mcc_cq(phba);
>  
>  		if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0)
>  			break;
> @@ -589,21 +556,6 @@ static int be_mcc_wait_compl(struct beiscsi_hba *phba)
>  }
>  
>  /*
> - * be_mcc_notify_wait()- Notify and wait for Compl
> - * @phba: driver private structure
> - *
> - * Notify MCC requests and wait for completion
> - *
> - * return
> - * Success: 0
> - * Failure: Non-Zero
> - **/
> -int be_mcc_notify_wait(struct beiscsi_hba *phba, unsigned int tag)
> -{
> -	be_mcc_notify(phba, tag);
> -	return be_mcc_wait_compl(phba);
> -}
> -
>  /*
>   * be_mbox_db_ready_wait()- Check ready status
>   * @ctrl: Function specific MBX data structure
> diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
> index adafd9c..f50b32ac 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.h
> +++ b/drivers/scsi/be2iscsi/be_cmds.h
> @@ -741,13 +741,14 @@ int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
>  
>  struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
>  struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
> -int be_mcc_notify_wait(struct beiscsi_hba *phba, unsigned int tag);
> +int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag);
>  void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag);
>  unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
>  void beiscsi_process_async_event(struct beiscsi_hba *phba,
>  				struct be_mcc_compl *compl);
> -int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl,
> -				    struct be_mcc_compl *compl);
> +int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
> +			      struct be_mcc_compl *compl);
> +
>  
>  int be_mbox_notify(struct be_ctrl_info *ctrl);
>  
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index aaf39d4..8b9d01a 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -2028,7 +2028,7 @@ static void hwi_process_default_pdu_ring(struct beiscsi_conn *beiscsi_conn,
>  			       phwi_ctrlr, cri_index));
>  }
>  
> -static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
> +void beiscsi_process_mcc_cq(struct beiscsi_hba *phba)
>  {
>  	struct be_queue_info *mcc_cq;
>  	struct  be_mcc_compl *mcc_compl;
> @@ -2038,7 +2038,6 @@ static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
>  	mcc_compl = queue_tail_node(mcc_cq);
>  	mcc_compl->flags = le32_to_cpu(mcc_compl->flags);
>  	while (mcc_compl->flags & CQE_FLAGS_VALID_MASK) {
> -
>  		if (num_processed >= 32) {
>  			hwi_ring_cq_db(phba, mcc_cq->id,
>  					num_processed, 0);
> @@ -2047,7 +2046,7 @@ static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
>  		if (mcc_compl->flags & CQE_FLAGS_ASYNC_MASK) {
>  			beiscsi_process_async_event(phba, mcc_compl);
>  		} else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) {
> -			be_mcc_compl_process_isr(&phba->ctrl, mcc_compl);
> +			beiscsi_process_mcc_compl(&phba->ctrl, mcc_compl);
>  			atomic_dec(&phba->ctrl.mcc_obj.q.used);
>  		}
>  
> @@ -2060,7 +2059,6 @@ static void  beiscsi_process_mcc_isr(struct beiscsi_hba *phba)
>  
>  	if (num_processed > 0)
>  		hwi_ring_cq_db(phba, mcc_cq->id, num_processed, 1);
> -
>  }
>  
>  /**
> @@ -2269,7 +2267,7 @@ void beiscsi_process_all_cqs(struct work_struct *work)
>  		spin_lock_irqsave(&phba->isr_lock, flags);
>  		pbe_eq->todo_mcc_cq = false;
>  		spin_unlock_irqrestore(&phba->isr_lock, flags);
> -		beiscsi_process_mcc_isr(phba);
> +		beiscsi_process_mcc_cq(phba);
>  	}
>  
>  	if (pbe_eq->todo_cq) {
> diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
> index 16a6fd0..5ded3fa 100644
> --- a/drivers/scsi/be2iscsi/be_main.h
> +++ b/drivers/scsi/be2iscsi/be_main.h
> @@ -853,6 +853,7 @@ void hwi_ring_cq_db(struct beiscsi_hba *phba,
>  		     unsigned char rearm);
>  
>  unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq, int budget);
> +void beiscsi_process_mcc_cq(struct beiscsi_hba *phba);
>  
>  static inline bool beiscsi_error(struct beiscsi_hba *phba)
>  {
> diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
> index da040e7..a88e636 100644
> --- a/drivers/scsi/be2iscsi/be_mgmt.c
> +++ b/drivers/scsi/be2iscsi/be_mgmt.c
> @@ -678,7 +678,8 @@ int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num)
>  	req->hdr_ring_id = cpu_to_le16(HWI_GET_DEF_HDRQ_ID(phba, ulp_num));
>  	req->data_ring_id = cpu_to_le16(HWI_GET_DEF_BUFQ_ID(phba, ulp_num));
>  
> -	status = be_mcc_notify_wait(phba, tag);
> +	be_mcc_notify(phba, tag);
> +	status = be_mcc_compl_poll(phba, tag);
>  	if (status)
>  		beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
>  			    "BG_%d : mgmt_epfw_cleanup , FAILED\n");
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions
  2016-02-01 10:12 ` [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions Jitendra Bhivare
@ 2016-02-01 11:26   ` Johannes Thumshirn
  2016-02-01 12:26   ` kbuild test robot
  1 sibling, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 11:26 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:43PM +0530, Jitendra Bhivare wrote:
> beiscsi_mccq_compl -> beiscsi_mccq_compl_wait - indicate blocking call.
> be_mcc_wait_compl -> be_mcc_compl_poll - indicate polling for completion.
> be_mbox_db_ready_wait -> be_mbox_db_ready_poll - indicate polling for RDY.
> be_mcc_compl_process -> beiscsi_process_mbox_compl - indicate BMBX compl.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_cmds.c  | 35 +++++++++++++++++------------------
>  drivers/scsi/be2iscsi/be_cmds.h  |  6 +++---
>  drivers/scsi/be2iscsi/be_iscsi.c |  8 ++++----
>  drivers/scsi/be2iscsi/be_main.c  |  8 ++++----
>  drivers/scsi/be2iscsi/be_mgmt.c  | 12 ++++++------
>  5 files changed, 34 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index fa010ac..8dd8521 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -140,7 +140,7 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
>  }
>  
>  /*
> - * beiscsi_mccq_compl()- Wait for completion of MBX
> + * beiscsi_mccq_compl_wait()- Process completion in MCC CQ
>   * @phba: Driver private structure
>   * @tag: Tag for the MBX Command
>   * @wrb: the WRB used for the MBX Command
> @@ -152,9 +152,9 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
>   * Success: 0
>   * Failure: Non-Zero
>   **/
> -int beiscsi_mccq_compl(struct beiscsi_hba *phba,
> -		uint32_t tag, struct be_mcc_wrb **wrb,
> -		struct be_dma_mem *mbx_cmd_mem)
> +int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
> +			    uint32_t tag, struct be_mcc_wrb **wrb,
> +			    struct be_dma_mem *mbx_cmd_mem)
>  {
>  	int rc = 0;
>  	uint32_t mcc_tag_status;
> @@ -283,7 +283,7 @@ static inline void be_mcc_compl_use(struct be_mcc_compl *compl)
>  }
>  
>  /*
> - * be_mcc_compl_process()- Check the MBX comapletion status
> + * beiscsi_process_mbox_compl()- Check the MBX completion status
>   * @ctrl: Function specific MBX data structure
>   * @compl: Completion status of MBX Command
>   *
> @@ -293,8 +293,8 @@ static inline void be_mcc_compl_use(struct be_mcc_compl *compl)
>   * Success: Zero
>   * Failure: Non-Zero
>   **/
> -static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
> -				struct be_mcc_compl *compl)
> +static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl,
> +				      struct be_mcc_compl *compl)
>  {
>  	u16 compl_status, extd_status;
>  	struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
> @@ -520,7 +520,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
>  }
>  
>  /*
> - * be_mcc_wait_compl()- Wait for MBX completion
> + * be_mcc_compl_poll()- Wait for MBX completion
>   * @phba: driver private structure
>   *
>   * Wait till no more pending mcc requests are present
> @@ -556,8 +556,7 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
>  }
>  
>  /*
> -/*
> - * be_mbox_db_ready_wait()- Check ready status
> + * be_mbox_db_ready_poll()- Check ready status
>   * @ctrl: Function specific MBX data structure
>   *
>   * Check for the ready status of FW to send BMBX
> @@ -567,7 +566,7 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
>   * Success: 0
>   * Failure: Non-Zero
>   **/
> -static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl)
> +static int be_mbox_db_ready_poll(struct be_ctrl_info *ctrl)
>  {
>  	/* wait 30s for generic non-flash MBOX operation */
>  #define BEISCSI_MBX_RDY_BIT_TIMEOUT	30000
> @@ -629,7 +628,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
>  	struct be_mcc_compl *compl = &mbox->compl;
>  	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
>  
> -	status = be_mbox_db_ready_wait(ctrl);
> +	status = be_mbox_db_ready_poll(ctrl);
>  	if (status)
>  		return status;
>  
> @@ -638,7 +637,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
>  	val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
>  	iowrite32(val, db);
>  
> -	status = be_mbox_db_ready_wait(ctrl);
> +	status = be_mbox_db_ready_poll(ctrl);
>  	if (status)
>  		return status;
>  
> @@ -648,7 +647,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
>  	val |= (u32) (mbox_mem->dma >> 4) << 2;
>  	iowrite32(val, db);
>  
> -	status = be_mbox_db_ready_wait(ctrl);
> +	status = be_mbox_db_ready_poll(ctrl);
>  	if (status)
>  		return status;
>  
> @@ -656,7 +655,7 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
>  	udelay(1);
>  
>  	if (be_mcc_compl_is_new(compl)) {
> -		status = be_mcc_compl_process(ctrl, &mbox->compl);
> +		status = beiscsi_process_mbox_compl(ctrl, compl);
>  		be_mcc_compl_use(compl);
>  		if (status) {
>  			beiscsi_log(phba, KERN_ERR,
> @@ -689,7 +688,7 @@ static int be_mbox_notify_wait(struct beiscsi_hba *phba)
>  	struct be_mcc_compl *compl = &mbox->compl;
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  
> -	status = be_mbox_db_ready_wait(ctrl);
> +	status = be_mbox_db_ready_poll(ctrl);
>  	if (status)
>  		return status;
>  
> @@ -699,7 +698,7 @@ static int be_mbox_notify_wait(struct beiscsi_hba *phba)
>  	iowrite32(val, db);
>  
>  	/* wait for ready to be set */
> -	status = be_mbox_db_ready_wait(ctrl);
> +	status = be_mbox_db_ready_poll(ctrl);
>  	if (status != 0)
>  		return status;
>  
> @@ -708,7 +707,7 @@ static int be_mbox_notify_wait(struct beiscsi_hba *phba)
>  	val |= (u32)(mbox_mem->dma >> 4) << 2;
>  	iowrite32(val, db);
>  
> -	status = be_mbox_db_ready_wait(ctrl);
> +	status = be_mbox_db_ready_poll(ctrl);
>  	if (status != 0)
>  		return status;
>  
> diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
> index f50b32ac..b14ac01 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.h
> +++ b/drivers/scsi/be2iscsi/be_cmds.h
> @@ -732,9 +732,9 @@ void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
>  
>  int be_cmd_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *,
>  			    int num);
> -int beiscsi_mccq_compl(struct beiscsi_hba *phba,
> -			uint32_t tag, struct be_mcc_wrb **wrb,
> -			struct be_dma_mem *mbx_cmd_mem);
> +int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
> +			    uint32_t tag, struct be_mcc_wrb **wrb,
> +			    struct be_dma_mem *mbx_cmd_mem);
>  /*ISCSI Functuions */
>  int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
>  int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
> diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
> index 633257b..09f89a3 100644
> --- a/drivers/scsi/be2iscsi/be_iscsi.c
> +++ b/drivers/scsi/be2iscsi/be_iscsi.c
> @@ -735,7 +735,7 @@ static int beiscsi_get_initname(char *buf, struct beiscsi_hba *phba)
>  		return -EBUSY;
>  	}
>  
> -	rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
> +	rc = beiscsi_mccq_compl_wait(phba, tag, &wrb, NULL);
>  	if (rc) {
>  		beiscsi_log(phba, KERN_ERR,
>  			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> @@ -1143,7 +1143,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
>  		return -EAGAIN;
>  	}
>  
> -	ret = beiscsi_mccq_compl(phba, tag, NULL, &nonemb_cmd);
> +	ret = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
>  	if (ret) {
>  		beiscsi_log(phba, KERN_ERR,
>  			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> @@ -1302,7 +1302,7 @@ static int beiscsi_close_conn(struct  beiscsi_endpoint *beiscsi_ep, int flag)
>  		ret = -EAGAIN;
>  	}
>  
> -	ret = beiscsi_mccq_compl(phba, tag, NULL, NULL);
> +	ret = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
>  
>  	/* Flush the CQ entries */
>  	beiscsi_flush_cq(phba);
> @@ -1377,7 +1377,7 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
>  			    beiscsi_ep->ep_cid);
>  	}
>  
> -	beiscsi_mccq_compl(phba, tag, NULL, NULL);
> +	beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
>  	beiscsi_close_conn(beiscsi_ep, tcp_upload_flag);
>  free_ep:
>  	msleep(BEISCSI_LOGOUT_SYNC_DELAY);
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 8b9d01a..dfc2ee9 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -286,7 +286,7 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc)
>  		return FAILED;
>  	}
>  
> -	rc = beiscsi_mccq_compl(phba, tag, NULL, &nonemb_cmd);
> +	rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
>  	if (rc != -EBUSY)
>  		pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
>  				    nonemb_cmd.va, nonemb_cmd.dma);
> @@ -367,7 +367,7 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc)
>  		return FAILED;
>  	}
>  
> -	rc = beiscsi_mccq_compl(phba, tag, NULL, &nonemb_cmd);
> +	rc = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
>  	if (rc != -EBUSY)
>  		pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
>  				    nonemb_cmd.va, nonemb_cmd.dma);
> @@ -4394,7 +4394,7 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
>  		goto boot_freemem;
>  	}
>  
> -	ret = beiscsi_mccq_compl(phba, tag, NULL, &nonemb_cmd);
> +	ret = beiscsi_mccq_compl_wait(phba, tag, NULL, &nonemb_cmd);
>  	if (ret) {
>  		beiscsi_log(phba, KERN_ERR,
>  			    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
> @@ -5424,7 +5424,7 @@ static void be_eqd_update(struct beiscsi_hba *phba)
>  	if (num) {
>  		tag = be_cmd_modify_eq_delay(phba, set_eqd, num);
>  		if (tag)
> -			beiscsi_mccq_compl(phba, tag, NULL, NULL);
> +			beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
>  	}
>  }
>  
> diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
> index a88e636..85044b8 100644
> --- a/drivers/scsi/be2iscsi/be_mgmt.c
> +++ b/drivers/scsi/be2iscsi/be_mgmt.c
> @@ -942,7 +942,7 @@ unsigned int mgmt_get_all_if_id(struct beiscsi_hba *phba)
>  	be_mcc_notify(phba, tag);
>  	mutex_unlock(&ctrl->mbox_lock);
>  
> -	status = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
> +	status = beiscsi_mccq_compl_wait(phba, tag, &wrb, NULL);
>  	if (status) {
>  		beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
>  			    "BG_%d : Failed in mgmt_get_all_if_id\n");
> @@ -993,7 +993,7 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
>  	be_mcc_notify(phba, tag);
>  	mutex_unlock(&ctrl->mbox_lock);
>  
> -	rc = beiscsi_mccq_compl(phba, tag, NULL, nonemb_cmd);
> +	rc = beiscsi_mccq_compl_wait(phba, tag, NULL, nonemb_cmd);
>  
>  	if (resp_buf)
>  		memcpy(resp_buf, nonemb_cmd->va, resp_buf_len);
> @@ -1427,7 +1427,7 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
>  			return -EAGAIN;
>  		}
>  
> -		rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
> +		rc = beiscsi_mccq_compl_wait(phba, tag, &wrb, NULL);
>  		if (rc) {
>  			beiscsi_log(phba, KERN_ERR,
>  				    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
> @@ -1461,7 +1461,7 @@ int be_mgmt_get_boot_shandle(struct beiscsi_hba *phba,
>  			return -EAGAIN;
>  		}
>  
> -		rc = beiscsi_mccq_compl(phba, tag, NULL, NULL);
> +		rc = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
>  		if (rc) {
>  			beiscsi_log(phba, KERN_ERR,
>  				    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
> @@ -1503,7 +1503,7 @@ int mgmt_set_vlan(struct beiscsi_hba *phba,
>  		return -EBUSY;
>  	}
>  
> -	rc = beiscsi_mccq_compl(phba, tag, NULL, NULL);
> +	rc = beiscsi_mccq_compl_wait(phba, tag, NULL, NULL);
>  	if (rc) {
>  		beiscsi_log(phba, KERN_ERR,
>  			    (BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX),
> @@ -1869,7 +1869,7 @@ int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
>  	be_mcc_notify(phba, tag);
>  	mutex_unlock(&ctrl->mbox_lock);
>  
> -	rc = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
> +	rc = beiscsi_mccq_compl_wait(phba, tag, &wrb, NULL);
>  	if (rc) {
>  		beiscsi_log(phba, KERN_ERR,
>  			    BEISCSI_LOG_INIT | BEISCSI_LOG_CONFIG,
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 05/12] be2iscsi: Remove be_mbox_notify_wait function
  2016-02-01 10:12 ` [PATCH 05/12] be2iscsi: Remove be_mbox_notify_wait function Jitendra Bhivare
@ 2016-02-01 11:27   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 11:27 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:44PM +0530, Jitendra Bhivare wrote:
> be_mbox_notify_wait does exactly same thing as be_mbox_notify.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_cmds.c | 79 +++--------------------------------------
>  1 file changed, 4 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index 8dd8521..12b60dd 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -625,8 +625,6 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
>  	void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET;
>  	struct be_dma_mem *mbox_mem = &ctrl->mbox_mem;
>  	struct be_mcc_mailbox *mbox = mbox_mem->va;
> -	struct be_mcc_compl *compl = &mbox->compl;
> -	struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
>  
>  	status = be_mbox_db_ready_poll(ctrl);
>  	if (status)
> @@ -654,77 +652,8 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
>  	/* RDY is set; small delay before CQE read. */
>  	udelay(1);
>  
> -	if (be_mcc_compl_is_new(compl)) {
> -		status = beiscsi_process_mbox_compl(ctrl, compl);
> -		be_mcc_compl_use(compl);
> -		if (status) {
> -			beiscsi_log(phba, KERN_ERR,
> -				    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> -				    "BC_%d : After be_mcc_compl_process\n");
> -
> -			return status;
> -		}
> -	} else {
> -		beiscsi_log(phba, KERN_ERR,
> -			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> -			    "BC_%d : Invalid Mailbox Completion\n");
> -
> -		return -EBUSY;
> -	}
> -	return 0;
> -}
> -
> -/*
> - * Insert the mailbox address into the doorbell in two steps
> - * Polls on the mbox doorbell till a command completion (or a timeout) occurs
> - */
> -static int be_mbox_notify_wait(struct beiscsi_hba *phba)
> -{
> -	int status;
> -	u32 val = 0;
> -	void __iomem *db = phba->ctrl.db + MPU_MAILBOX_DB_OFFSET;
> -	struct be_dma_mem *mbox_mem = &phba->ctrl.mbox_mem;
> -	struct be_mcc_mailbox *mbox = mbox_mem->va;
> -	struct be_mcc_compl *compl = &mbox->compl;
> -	struct be_ctrl_info *ctrl = &phba->ctrl;
> -
> -	status = be_mbox_db_ready_poll(ctrl);
> -	if (status)
> -		return status;
> -
> -	val |= MPU_MAILBOX_DB_HI_MASK;
> -	/* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */
> -	val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
> -	iowrite32(val, db);
> -
> -	/* wait for ready to be set */
> -	status = be_mbox_db_ready_poll(ctrl);
> -	if (status != 0)
> -		return status;
> -
> -	val = 0;
> -	/* at bits 2 - 31 place mbox dma addr lsb bits 4 - 33 */
> -	val |= (u32)(mbox_mem->dma >> 4) << 2;
> -	iowrite32(val, db);
> -
> -	status = be_mbox_db_ready_poll(ctrl);
> -	if (status != 0)
> -		return status;
> -
> -	/* A cq entry has been made now */
> -	if (be_mcc_compl_is_new(compl)) {
> -		status = be_mcc_compl_process(ctrl, &mbox->compl);
> -		be_mcc_compl_use(compl);
> -		if (status)
> -			return status;
> -	} else {
> -		beiscsi_log(phba, KERN_ERR,
> -			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> -			    "BC_%d : invalid mailbox completion\n");
> -
> -		return -EBUSY;
> -	}
> -	return 0;
> +	status = beiscsi_process_mbox_compl(ctrl, &mbox->compl);
> +	return status;
>  }
>  
>  void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
> @@ -1039,7 +968,7 @@ int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba,
>  
>  	be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
>  
> -	status = be_mbox_notify_wait(phba);
> +	status = be_mbox_notify(ctrl);
>  	if (!status) {
>  		struct be_cmd_resp_mcc_create *resp = embedded_payload(wrb);
>  		mccq->id = le16_to_cpu(resp->id);
> @@ -1381,7 +1310,7 @@ int beiscsi_cmd_reset_function(struct beiscsi_hba  *phba)
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
>  			   OPCODE_COMMON_FUNCTION_RESET, sizeof(*req));
> -	status = be_mbox_notify_wait(phba);
> +	status = be_mbox_notify(ctrl);
>  
>  	mutex_unlock(&ctrl->mbox_lock);
>  	return status;
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state
  2016-02-01 10:12 ` [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state Jitendra Bhivare
@ 2016-02-01 11:29   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 11:29 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:45PM +0530, Jitendra Bhivare wrote:
> be_mcc_compl_poll waits till 'used' count of MCC WRBQ is zero. This is to
> determine the completion of an MCC sent.
> 
> Change function to poll for the tag of MCC sent, instead, and wait till
> its tag_state is cleared.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_cmds.c | 92 +++++++++++++++++++++--------------------
>  1 file changed, 47 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index 12b60dd..60db2de 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -104,19 +104,6 @@ int be_chk_reset_complete(struct beiscsi_hba *phba)
>  	return 0;
>  }
>  
> -void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
> -{
> -	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
> -	u32 val = 0;
> -
> -	set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state);
> -	val |= mccq->id & DB_MCCQ_RING_ID_MASK;
> -	val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
> -	/* ring doorbell after all of request and state is written */
> -	wmb();
> -	iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
> -}
> -
>  unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
>  {
>  	unsigned int tag = 0;
> @@ -139,6 +126,28 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
>  	return tag;
>  }
>  
> +void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
> +{
> +	spin_lock_bh(&ctrl->mcc_lock);
> +	tag = tag & MCC_Q_CMD_TAG_MASK;
> +	ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
> +	if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
> +		ctrl->mcc_free_index = 0;
> +	else
> +		ctrl->mcc_free_index++;
> +	ctrl->mcc_tag_available++;
> +	spin_unlock_bh(&ctrl->mcc_lock);
> +}
> +
> +/**
> + * beiscsi_fail_session(): Closing session with appropriate error
> + * @cls_session: ptr to session
> + **/
> +void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
> +{
> +	iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
> +}
> +
>  /*
>   * beiscsi_mccq_compl_wait()- Process completion in MCC CQ
>   * @phba: Driver private structure
> @@ -254,19 +263,6 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
>  	return rc;
>  }
>  
> -void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
> -{
> -	spin_lock(&ctrl->mcc_lock);
> -	tag = tag & MCC_Q_CMD_TAG_MASK;
> -	ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
> -	if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1))
> -		ctrl->mcc_free_index = 0;
> -	else
> -		ctrl->mcc_free_index++;
> -	ctrl->mcc_tag_available++;
> -	spin_unlock(&ctrl->mcc_lock);
> -}
> -
>  static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
>  {
>  	if (compl->flags != 0) {
> @@ -328,15 +324,6 @@ static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl,
>  	return 0;
>  }
>  
> -/**
> - * beiscsi_fail_session(): Closing session with appropriate error
> - * @cls_session: ptr to session
> - **/
> -void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
> -{
> -	iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
> -}
> -
>  static void beiscsi_process_async_link(struct beiscsi_hba *phba,
>  				       struct be_mcc_compl *compl)
>  {
> @@ -532,6 +519,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
>   **/
>  int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
>  {
> +	struct be_ctrl_info *ctrl = &phba->ctrl;
>  	int i;
>  
>  	for (i = 0; i < mcc_timeout; i++) {
> @@ -540,19 +528,33 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
>  
>  		beiscsi_process_mcc_cq(phba);
>  
> -		if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0)
> +		if (!test_bit(MCC_TAG_STATE_RUNNING,
> +			      &ctrl->ptag_state[tag].tag_state))
>  			break;
>  		udelay(100);
>  	}
> -	if (i == mcc_timeout) {
> -		beiscsi_log(phba, KERN_ERR,
> -			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> -			    "BC_%d : FW Timed Out\n");
> -		phba->fw_timeout = true;
> -		beiscsi_ue_detect(phba);
> -		return -EBUSY;
> -	}
> -	return 0;
> +
> +	if (i < mcc_timeout)
> +		return 0;
> +
> +	beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> +		    "BC_%d : FW Timed Out\n");
> +	phba->fw_timeout = true;
> +	beiscsi_ue_detect(phba);
> +	return -EBUSY;
> +}
> +
> +void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag)
> +{
> +	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
> +	u32 val = 0;
> +
> +	set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state);
> +	val |= mccq->id & DB_MCCQ_RING_ID_MASK;
> +	val |= 1 << DB_MCCQ_NUM_POSTED_SHIFT;
> +	/* make request available for DMA */
> +	wmb();
> +	iowrite32(val, phba->db_va + DB_MCCQ_OFFSET);
>  }
>  
>  /*
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 07/12] be2iscsi: Cleanup processing of BMBX completion
  2016-02-01 10:12 ` [PATCH 07/12] be2iscsi: Cleanup processing of BMBX completion Jitendra Bhivare
@ 2016-02-01 11:41   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 11:41 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:46PM +0530, Jitendra Bhivare wrote:
> Remove confusingly named be_mcc_compl_is_new and be_mcc_compl_use functions
> in processing of BMBX. Rearrange beiscsi_process_mbox_compl function.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_cmds.c | 75 ++++++++++++++++++++---------------------
>  1 file changed, 36 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index 60db2de..728aa133 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -263,21 +263,6 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
>  	return rc;
>  }
>  
> -static inline bool be_mcc_compl_is_new(struct be_mcc_compl *compl)
> -{
> -	if (compl->flags != 0) {
> -		compl->flags = le32_to_cpu(compl->flags);
> -		WARN_ON((compl->flags & CQE_FLAGS_VALID_MASK) == 0);
> -		return true;
> -	} else
> -		return false;
> -}
> -
> -static inline void be_mcc_compl_use(struct be_mcc_compl *compl)
> -{
> -	compl->flags = 0;
> -}
> -
>  /*
>   * beiscsi_process_mbox_compl()- Check the MBX completion status
>   * @ctrl: Function specific MBX data structure
> @@ -298,30 +283,46 @@ static int beiscsi_process_mbox_compl(struct be_ctrl_info *ctrl,
>  	struct be_cmd_req_hdr *hdr = embedded_payload(wrb);
>  	struct be_cmd_resp_hdr *resp_hdr;
>  
> -	be_dws_le_to_cpu(compl, 4);
> +	/**
> +	 * To check if valid bit is set, check the entire word as we don't know
> +	 * the endianness of the data (old entry is host endian while a new
> +	 * entry is little endian)
> +	 */
> +	if (!compl->flags) {
> +		beiscsi_log(phba, KERN_ERR,
> +				BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> +				"BC_%d : BMBX busy, no completion\n");
> +		return -EBUSY;
> +	}
> +	compl->flags = le32_to_cpu(compl->flags);
> +	WARN_ON((compl->flags & CQE_FLAGS_VALID_MASK) == 0);
>  
> +	/**
> +	 * Just swap the status to host endian;
> +	 * mcc tag is opaquely copied from mcc_wrb.
> +	 */
> +	be_dws_le_to_cpu(compl, 4);
>  	compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
> -					CQE_STATUS_COMPL_MASK;
> -	if (compl_status != MCC_STATUS_SUCCESS) {
> -		extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
> -						CQE_STATUS_EXTD_MASK;
> +		CQE_STATUS_COMPL_MASK;
> +	extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) &
> +		CQE_STATUS_EXTD_MASK;
> +	/* Need to reset the entire word that houses the valid bit */
> +	compl->flags = 0;
>  
> -		beiscsi_log(phba, KERN_ERR,
> -			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> -			    "BC_%d : error in cmd completion: "
> -			    "Subsystem : %d Opcode : %d "
> -			    "status(compl/extd)=%d/%d\n",
> -			    hdr->subsystem, hdr->opcode,
> -			    compl_status, extd_status);
> -
> -		if (compl_status == MCC_STATUS_INSUFFICIENT_BUFFER) {
> -			resp_hdr = (struct be_cmd_resp_hdr *) hdr;
> -			if (resp_hdr->response_length)
> -				return 0;
> -		}
> -		return -EINVAL;
> +	if (compl_status == MCC_STATUS_SUCCESS)
> +		return 0;
> +
> +	beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> +		    "BC_%d : error in cmd completion: Subsystem : %d Opcode : %d status(compl/extd)=%d/%d\n",
> +		    hdr->subsystem, hdr->opcode, compl_status, extd_status);
> +
> +	if (compl_status == MCC_STATUS_INSUFFICIENT_BUFFER) {
> +		/* if status is insufficient buffer, check the length */
> +		resp_hdr = (struct be_cmd_resp_hdr *) hdr;
> +		if (resp_hdr->response_length)
> +			return 0;
>  	}
> -	return 0;
> +	return -EINVAL;
>  }
>  
>  static void beiscsi_process_async_link(struct beiscsi_hba *phba,
> @@ -453,10 +454,6 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
>  	struct be_dma_mem *tag_mem;
>  	unsigned int tag, wrb_idx;
>  
> -	/**
> -	 * Just swap the status to host endian; mcc tag is opaquely copied
> -	 * from mcc_wrb
> -	 */
>  	be_dws_le_to_cpu(compl, 4);
>  	tag = (compl->tag0 & MCC_Q_CMD_TAG_MASK);
>  	wrb_idx = (compl->tag0 & CQE_STATUS_WRB_MASK) >> CQE_STATUS_WRB_SHIFT;
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection
  2016-02-01 10:12 ` [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection Jitendra Bhivare
@ 2016-02-01 11:45   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 11:45 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:47PM +0530, Jitendra Bhivare wrote:
> In open with IP of unknown address family, only tag is freed and error
> returned. MCC WRB allocated for the operation is not freed.
> 
> Added check for supported family of IP in the beginning before
> allocating the tag and WRB.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_mgmt.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
> index 85044b8..ccac1d7 100644
> --- a/drivers/scsi/be2iscsi/be_mgmt.c
> +++ b/drivers/scsi/be2iscsi/be_mgmt.c
> @@ -829,6 +829,13 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
>  	unsigned short cid = beiscsi_ep->ep_cid;
>  	struct be_sge *sge;
>  
> +	if (dst_addr->sa_family != PF_INET && dst_addr->sa_family != PF_INET6) {
> +		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> +			    "BG_%d : unknown addr family %d\n",
> +			    dst_addr->sa_family);
> +		return -EINVAL;
> +	}
> +
>  	phwi_ctrlr = phba->phwi_ctrlr;
>  	phwi_context = phwi_ctrlr->phwi_ctxt;
>  
> @@ -868,7 +875,8 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
>  		beiscsi_ep->dst_addr = daddr_in->sin_addr.s_addr;
>  		beiscsi_ep->dst_tcpport = ntohs(daddr_in->sin_port);
>  		beiscsi_ep->ip_type = BE2_IPV4;
> -	} else if (dst_addr->sa_family == PF_INET6) {
> +	} else {
> +		/* else its PF_INET6 family */
>  		req->ip_address.ip_type = BE2_IPV6;
>  		memcpy(&req->ip_address.addr,
>  		       &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
> @@ -877,14 +885,6 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
>  		memcpy(&beiscsi_ep->dst6_addr,
>  		       &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
>  		beiscsi_ep->ip_type = BE2_IPV6;
> -	} else{
> -		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> -			    "BG_%d : unknown addr family %d\n",
> -			    dst_addr->sa_family);
> -		mutex_unlock(&ctrl->mbox_lock);
> -		free_mcc_tag(&phba->ctrl, tag);
> -		return -EINVAL;
> -
>  	}
>  	req->cid = cid;
>  	i = phba->nxt_cqid++;
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 09/12] be2iscsi: Couple MCC tag and WRB alloc and free
  2016-02-01 10:12 ` [PATCH 09/12] be2iscsi: Couple MCC tag and WRB alloc and free Jitendra Bhivare
@ 2016-02-01 12:14   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 12:14 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:48PM +0530, Jitendra Bhivare wrote:
> WARN_ON(atomic_read(&mccq->used) >= mccq->len) seen when FW gets into UE.
> 
> MCCQ overflow is happening because driver discards any new request and
> frees up the tag. The tag allocation controls the number of MCC WRB posted.
> It is being replenished but WRBs are not hence the WARN_ON.
> 
> Allocation and freeing of WRB and tags for MCC is now done in one place.
> This helps to achieve proper accounting of WRB indices and MCC tags.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be.h      |   2 +-
>  drivers/scsi/be2iscsi/be_cmds.c | 103 +++++++++++++++++++++---------
>  drivers/scsi/be2iscsi/be_cmds.h |   6 +-
>  drivers/scsi/be2iscsi/be_main.c |   3 +-
>  drivers/scsi/be2iscsi/be_mgmt.c | 134 +++++++++++++++-------------------------
>  5 files changed, 130 insertions(+), 118 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
> index da1d87a..ee5ace8 100644
> --- a/drivers/scsi/be2iscsi/be.h
> +++ b/drivers/scsi/be2iscsi/be.h
> @@ -42,7 +42,7 @@ struct be_queue_info {
>  	u16 id;
>  	u16 tail, head;
>  	bool created;
> -	atomic_t used;		/* Number of valid elements in the queue */
> +	u16 used;		/* Number of valid elements in the queue */
>  };
>  
>  static inline u32 MODULO(u16 val, u16 limit)
> diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
> index 728aa133..a55eaee 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.c
> +++ b/drivers/scsi/be2iscsi/be_cmds.c
> @@ -126,8 +126,62 @@ unsigned int alloc_mcc_tag(struct beiscsi_hba *phba)
>  	return tag;
>  }
>  
> -void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
> +struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba,
> +				 unsigned int *ref_tag)
>  {
> +	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
> +	struct be_mcc_wrb *wrb = NULL;
> +	unsigned int tag;
> +
> +	spin_lock_bh(&phba->ctrl.mcc_lock);
> +	if (mccq->used == mccq->len) {
> +		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT |
> +			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> +			    "BC_%d : MCC queue full: WRB used %u tag avail %u\n",
> +			    mccq->used, phba->ctrl.mcc_tag_available);
> +		goto alloc_failed;
> +	}
> +
> +	if (!phba->ctrl.mcc_tag_available)
> +		goto alloc_failed;
> +
> +	tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index];
> +	if (!tag) {
> +		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT |
> +			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> +			    "BC_%d : MCC tag 0 allocated: tag avail %u alloc index %u\n",
> +			    phba->ctrl.mcc_tag_available,
> +			    phba->ctrl.mcc_alloc_index);
> +		goto alloc_failed;
> +	}
> +
> +	/* return this tag for further reference */
> +	*ref_tag = tag;
> +	phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0;
> +	phba->ctrl.mcc_tag_status[tag] = 0;
> +	phba->ctrl.ptag_state[tag].tag_state = 0;
> +	phba->ctrl.mcc_tag_available--;
> +	if (phba->ctrl.mcc_alloc_index == (MAX_MCC_CMD - 1))
> +		phba->ctrl.mcc_alloc_index = 0;
> +	else
> +		phba->ctrl.mcc_alloc_index++;
> +
> +	wrb = queue_head_node(mccq);
> +	memset(wrb, 0, sizeof(*wrb));
> +	wrb->tag0 = tag;
> +	wrb->tag0 |= (mccq->head << MCC_Q_WRB_IDX_SHIFT) & MCC_Q_WRB_IDX_MASK;
> +	queue_head_inc(mccq);
> +	mccq->used++;
> +
> +alloc_failed:
> +	spin_unlock_bh(&phba->ctrl.mcc_lock);
> +	return wrb;
> +}
> +
> +void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag)
> +{
> +	struct be_queue_info *mccq = &ctrl->mcc_obj.q;
> +
>  	spin_lock_bh(&ctrl->mcc_lock);
>  	tag = tag & MCC_Q_CMD_TAG_MASK;
>  	ctrl->mcc_tag[ctrl->mcc_free_index] = tag;
> @@ -136,6 +190,7 @@ void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag)
>  	else
>  		ctrl->mcc_free_index++;
>  	ctrl->mcc_tag_available++;
> +	mccq->used--;
>  	spin_unlock_bh(&ctrl->mcc_lock);
>  }
>  
> @@ -173,10 +228,8 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
>  	struct be_cmd_resp_hdr *mbx_resp_hdr;
>  	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
>  
> -	if (beiscsi_error(phba)) {
> -		free_mcc_tag(&phba->ctrl, tag);
> +	if (beiscsi_error(phba))
>  		return -EPERM;
> -	}
>  
>  	/* wait for the mccq completion */
>  	rc = wait_event_interruptible_timeout(
> @@ -259,7 +312,7 @@ int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
>  		}
>  	}
>  
> -	free_mcc_tag(&phba->ctrl, tag);
> +	free_mcc_wrb(&phba->ctrl, tag);
>  	return rc;
>  }
>  
> @@ -479,7 +532,7 @@ int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
>  		if (tag_mem->size)
>  			pci_free_consistent(ctrl->pdev, tag_mem->size,
>  					tag_mem->va, tag_mem->dma);
> -		free_mcc_tag(ctrl, tag);
> +		free_mcc_wrb(ctrl, tag);
>  		return 0;
>  	}
>  
> @@ -519,15 +572,24 @@ int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag)
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  	int i;
>  
> +	if (!test_bit(MCC_TAG_STATE_RUNNING,
> +		      &ctrl->ptag_state[tag].tag_state)) {
> +		beiscsi_log(phba, KERN_ERR,
> +			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> +			    "BC_%d: tag %u state not running\n", tag);
> +		return 0;
> +	}
>  	for (i = 0; i < mcc_timeout; i++) {
>  		if (beiscsi_error(phba))
>  			return -EIO;
>  
>  		beiscsi_process_mcc_cq(phba);
> -
> +		/* after polling, wrb and tag need to be released */
>  		if (!test_bit(MCC_TAG_STATE_RUNNING,
> -			      &ctrl->ptag_state[tag].tag_state))
> +			      &ctrl->ptag_state[tag].tag_state)) {
> +			free_mcc_wrb(ctrl, tag);
>  			break;
> +		}
>  		udelay(100);
>  	}
>  
> @@ -717,21 +779,6 @@ struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem)
>  	return &((struct be_mcc_mailbox *)(mbox_mem->va))->wrb;
>  }
>  
> -struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba)
> -{
> -	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
> -	struct be_mcc_wrb *wrb;
> -
> -	WARN_ON(atomic_read(&mccq->used) >= mccq->len);
> -	wrb = queue_head_node(mccq);
> -	memset(wrb, 0, sizeof(*wrb));
> -	wrb->tag0 = (mccq->head << MCC_Q_WRB_IDX_SHIFT) & MCC_Q_WRB_IDX_MASK;
> -	queue_head_inc(mccq);
> -	atomic_inc(&mccq->used);
> -	return wrb;
> -}
> -
> -
>  int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
>  			  struct be_queue_info *eq, int eq_delay)
>  {
> @@ -1328,22 +1375,20 @@ int beiscsi_cmd_reset_function(struct beiscsi_hba  *phba)
>  int be_cmd_set_vlan(struct beiscsi_hba *phba,
>  		     uint16_t vlan_tag)
>  {
> -	unsigned int tag = 0;
> +	unsigned int tag;
>  	struct be_mcc_wrb *wrb;
>  	struct be_cmd_set_vlan_req *req;
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  
>  	if (mutex_lock_interruptible(&ctrl->mbox_lock))
>  		return 0;
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
>  
> -	wrb = wrb_from_mccq(phba);
>  	req = embedded_payload(wrb);
> -	wrb->tag0 |= tag;
>  	be_wrb_hdr_prepare(wrb, sizeof(*wrb), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
>  			   OPCODE_COMMON_ISCSI_NTWK_SET_VLAN,
> diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
> index b14ac01..deeb951 100644
> --- a/drivers/scsi/be2iscsi/be_cmds.h
> +++ b/drivers/scsi/be2iscsi/be_cmds.h
> @@ -728,7 +728,7 @@ int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
>  				      struct beiscsi_hba *phba);
>  unsigned int be_cmd_get_initname(struct beiscsi_hba *phba);
>  
> -void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag);
> +void free_mcc_wrb(struct be_ctrl_info *ctrl, unsigned int tag);
>  
>  int be_cmd_modify_eq_delay(struct beiscsi_hba *phba, struct be_set_eqd *,
>  			    int num);
> @@ -740,10 +740,10 @@ int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
>  int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
>  
>  struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
> -struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
>  int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag);
>  void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag);
> -unsigned int alloc_mcc_tag(struct beiscsi_hba *phba);
> +struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba,
> +				 unsigned int *ref_tag);
>  void beiscsi_process_async_event(struct beiscsi_hba *phba,
>  				struct be_mcc_compl *compl);
>  int beiscsi_process_mcc_compl(struct be_ctrl_info *ctrl,
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index dfc2ee9..3f08a11 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -2047,7 +2047,6 @@ void beiscsi_process_mcc_cq(struct beiscsi_hba *phba)
>  			beiscsi_process_async_event(phba, mcc_compl);
>  		} else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) {
>  			beiscsi_process_mcc_compl(&phba->ctrl, mcc_compl);
> -			atomic_dec(&phba->ctrl.mcc_obj.q.used);
>  		}
>  
>  		mcc_compl->flags = 0;
> @@ -5245,7 +5244,7 @@ static int beiscsi_bsg_request(struct bsg_job *job)
>  		extd_status = (phba->ctrl.mcc_tag_status[tag] &
>  			       CQE_STATUS_ADDL_MASK) >> CQE_STATUS_ADDL_SHIFT;
>  		status = phba->ctrl.mcc_tag_status[tag] & CQE_STATUS_MASK;
> -		free_mcc_tag(&phba->ctrl, tag);
> +		free_mcc_wrb(&phba->ctrl, tag);
>  		resp = (struct be_cmd_resp_hdr *)nonemb_cmd.va;
>  		sg_copy_from_buffer(job->reply_payload.sg_list,
>  				    job->reply_payload.sg_cnt,
> diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
> index ccac1d7..83926e2 100644
> --- a/drivers/scsi/be2iscsi/be_mgmt.c
> +++ b/drivers/scsi/be2iscsi/be_mgmt.c
> @@ -161,20 +161,17 @@ int be_cmd_modify_eq_delay(struct beiscsi_hba *phba,
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  	struct be_mcc_wrb *wrb;
>  	struct be_cmd_req_modify_eq_delay *req;
> -	unsigned int tag = 0;
> +	unsigned int tag;
>  	int i;
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
>  
> -	wrb = wrb_from_mccq(phba);
>  	req = embedded_payload(wrb);
> -
> -	wrb->tag0 |= tag;
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
>  		OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req));
> @@ -209,22 +206,20 @@ unsigned int mgmt_reopen_session(struct beiscsi_hba *phba,
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  	struct be_mcc_wrb *wrb;
>  	struct be_cmd_reopen_session_req *req;
> -	unsigned int tag = 0;
> +	unsigned int tag;
>  
>  	beiscsi_log(phba, KERN_INFO,
>  		    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
>  		    "BG_%d : In bescsi_get_boot_target\n");
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
>  
> -	wrb = wrb_from_mccq(phba);
>  	req = embedded_payload(wrb);
> -	wrb->tag0 |= tag;
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
>  			   OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS,
> @@ -244,22 +239,20 @@ unsigned int mgmt_get_boot_target(struct beiscsi_hba *phba)
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  	struct be_mcc_wrb *wrb;
>  	struct be_cmd_get_boot_target_req *req;
> -	unsigned int tag = 0;
> +	unsigned int tag;
>  
>  	beiscsi_log(phba, KERN_INFO,
>  		    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
>  		    "BG_%d : In bescsi_get_boot_target\n");
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
>  
> -	wrb = wrb_from_mccq(phba);
>  	req = embedded_payload(wrb);
> -	wrb->tag0 |= tag;
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
>  			   OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET,
> @@ -276,7 +269,7 @@ unsigned int mgmt_get_session_info(struct beiscsi_hba *phba,
>  {
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  	struct be_mcc_wrb *wrb;
> -	unsigned int tag = 0;
> +	unsigned int tag;
>  	struct  be_cmd_get_session_req *req;
>  	struct be_cmd_get_session_resp *resp;
>  	struct be_sge *sge;
> @@ -286,21 +279,16 @@ unsigned int mgmt_get_session_info(struct beiscsi_hba *phba,
>  		    "BG_%d : In beiscsi_get_session_info\n");
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
>  
>  	nonemb_cmd->size = sizeof(*resp);
>  	req = nonemb_cmd->va;
>  	memset(req, 0, sizeof(*req));
> -	wrb = wrb_from_mccq(phba);
>  	sge = nonembedded_sgl(wrb);
> -	wrb->tag0 |= tag;
> -
> -
> -	wrb->tag0 |= tag;
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
>  			   OPCODE_ISCSI_INI_SESSION_GET_A_SESSION,
> @@ -624,20 +612,18 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
>  		return -ENOSYS;
>  	}
>  
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
>  
> -	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));
>  	mcc_sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
>  	mcc_sge->len = cpu_to_le32(nonemb_cmd->size);
> -	wrb->tag0 |= tag;
>  
>  	be_mcc_notify(phba, tag);
>  
> @@ -657,22 +643,22 @@ unsigned int mgmt_vendor_specific_fw_cmd(struct be_ctrl_info *ctrl,
>  int mgmt_epfw_cleanup(struct beiscsi_hba *phba, unsigned short ulp_num)
>  {
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
> -	struct be_mcc_wrb *wrb = wrb_from_mccq(phba);
> -	struct iscsi_cleanup_req *req = embedded_payload(wrb);
> +	struct be_mcc_wrb *wrb;
> +	struct iscsi_cleanup_req *req;
>  	unsigned int tag;
>  	int status;
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
>  		return -EBUSY;
>  	}
>  
> +	req = embedded_payload(wrb);
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
>  			   OPCODE_COMMON_ISCSI_CLEANUP, sizeof(*req));
> -	wrb->tag0 |= tag;
>  
>  	req->chute = (1 << ulp_num);
>  	req->hdr_ring_id = cpu_to_le16(HWI_GET_DEF_HDRQ_ID(phba, ulp_num));
> @@ -697,20 +683,18 @@ unsigned int  mgmt_invalidate_icds(struct beiscsi_hba *phba,
>  	struct be_mcc_wrb *wrb;
>  	struct be_sge *sge;
>  	struct invalidate_commands_params_in *req;
> -	unsigned int i, tag = 0;
> +	unsigned int i, tag;
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
>  
>  	req = nonemb_cmd->va;
>  	memset(req, 0, sizeof(*req));
> -	wrb = wrb_from_mccq(phba);
>  	sge = nonembedded_sgl(wrb);
> -	wrb->tag0 |= tag;
>  
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
> @@ -745,15 +729,13 @@ unsigned int mgmt_invalidate_connection(struct beiscsi_hba *phba,
>  	unsigned int tag = 0;
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
> -	wrb = wrb_from_mccq(phba);
> -	wrb->tag0 |= tag;
> -	req = embedded_payload(wrb);
>  
> +	req = embedded_payload(wrb);
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
>  			   OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION,
> @@ -776,18 +758,16 @@ unsigned int mgmt_upload_connection(struct beiscsi_hba *phba,
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  	struct be_mcc_wrb *wrb;
>  	struct tcp_upload_params_in *req;
> -	unsigned int tag = 0;
> +	unsigned int tag;
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
> -	wrb = wrb_from_mccq(phba);
> -	req = embedded_payload(wrb);
> -	wrb->tag0 |= tag;
>  
> +	req = embedded_payload(wrb);
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_COMMON_TCP_UPLOAD,
>  			   OPCODE_COMMON_TCP_UPLOAD, sizeof(*req));
> @@ -848,17 +828,15 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
>  	ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address);
>  	if (mutex_lock_interruptible(&ctrl->mbox_lock))
>  		return 0;
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
> -	wrb = wrb_from_mccq(phba);
> -	sge = nonembedded_sgl(wrb);
>  
> +	sge = nonembedded_sgl(wrb);
>  	req = nonemb_cmd->va;
>  	memset(req, 0, sizeof(*req));
> -	wrb->tag0 |= tag;
>  
>  	be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
> @@ -925,16 +903,13 @@ unsigned int mgmt_get_all_if_id(struct beiscsi_hba *phba)
>  
>  	if (mutex_lock_interruptible(&ctrl->mbox_lock))
>  		return -EINTR;
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
>  		return -ENOMEM;
>  	}
>  
> -	wrb = wrb_from_mccq(phba);
>  	req = embedded_payload(wrb);
> -	wrb->tag0 |= tag;
> -
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
>  			   OPCODE_COMMON_ISCSI_NTWK_GET_ALL_IF_ID,
> @@ -974,17 +949,14 @@ static int mgmt_exec_nonemb_cmd(struct beiscsi_hba *phba,
>  	int rc = 0;
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
>  		rc = -ENOMEM;
>  		goto free_cmd;
>  	}
>  
> -	wrb = wrb_from_mccq(phba);
> -	wrb->tag0 |= tag;
>  	sge = nonembedded_sgl(wrb);
> -
>  	be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1);
>  	sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
>  	sge->pa_lo = cpu_to_le32(lower_32_bits(nonemb_cmd->dma));
> @@ -1368,22 +1340,20 @@ int mgmt_get_nic_conf(struct beiscsi_hba *phba,
>  
>  unsigned int be_cmd_get_initname(struct beiscsi_hba *phba)
>  {
> -	unsigned int tag = 0;
> +	unsigned int tag;
>  	struct be_mcc_wrb *wrb;
>  	struct be_cmd_hba_name *req;
>  	struct be_ctrl_info *ctrl = &phba->ctrl;
>  
>  	if (mutex_lock_interruptible(&ctrl->mbox_lock))
>  		return 0;
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
> -		return tag;
> +		return 0;
>  	}
>  
> -	wrb = wrb_from_mccq(phba);
>  	req = embedded_payload(wrb);
> -	wrb->tag0 |= tag;
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
>  			OPCODE_ISCSI_INI_CFG_GET_HBA_NAME,
> @@ -1847,8 +1817,8 @@ int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
>  		    "BG_%d : In bescsi_logout_fwboot_sess\n");
>  
>  	mutex_lock(&ctrl->mbox_lock);
> -	tag = alloc_mcc_tag(phba);
> -	if (!tag) {
> +	wrb = alloc_mcc_wrb(phba, &tag);
> +	if (!wrb) {
>  		mutex_unlock(&ctrl->mbox_lock);
>  		beiscsi_log(phba, KERN_INFO,
>  			    BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
> @@ -1856,9 +1826,7 @@ int beiscsi_logout_fw_sess(struct beiscsi_hba *phba,
>  		return -EINVAL;
>  	}
>  
> -	wrb = wrb_from_mccq(phba);
>  	req = embedded_payload(wrb);
> -	wrb->tag0 |= tag;
>  	be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
>  	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI_INI,
>  			   OPCODE_ISCSI_INI_SESSION_LOGOUT_TARGET,
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks
  2016-02-01 10:12 ` [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks Jitendra Bhivare
@ 2016-02-01 12:24   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 12:24 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:49PM +0530, Jitendra Bhivare wrote:
> Connection resets observed from some targets when NOP-Out with wrong
> ExpStatSn is sent.
> 
> FW keeps track of StatSn and fills up ExpStatSn accordingly.
> The header filled up by the stack needs to be modified by driver to clear
> ExpStatSn. If the field is not cleared, FW recalculates ExpStatSn and
> wrong offset'ed ExpStatSn is seen in the wire trace.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_main.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 3f08a11..03265b6 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -4926,7 +4926,6 @@ int beiscsi_iotask_v2(struct iscsi_task *task, struct scatterlist *sg,
>  
>  	pwrb = io_task->pwrb_handle->pwrb;
>  
> -	io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
>  	io_task->bhs_len = sizeof(struct be_cmd_bhs);
>  
>  	if (writedir) {
> @@ -4987,7 +4986,6 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
>  	unsigned int doorbell = 0;
>  
>  	pwrb = io_task->pwrb_handle->pwrb;
> -	io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
>  	io_task->bhs_len = sizeof(struct be_cmd_bhs);
>  
>  	if (writedir) {
> @@ -5159,23 +5157,21 @@ static int beiscsi_task_xmit(struct iscsi_task *task)
>  {
>  	struct beiscsi_io_task *io_task = task->dd_data;
>  	struct scsi_cmnd *sc = task->sc;
> -	struct beiscsi_hba *phba = NULL;
> +	struct beiscsi_hba *phba;
>  	struct scatterlist *sg;
>  	int num_sg;
>  	unsigned int  writedir = 0, xferlen = 0;
>  
> -	phba = ((struct beiscsi_conn *)task->conn->dd_data)->phba;
> +	if (!io_task->conn->login_in_progress)
> +		task->hdr->exp_statsn = 0;
>  
>  	if (!sc)
>  		return beiscsi_mtask(task);
>  
>  	io_task->scsi_cmnd = sc;
>  	num_sg = scsi_dma_map(sc);
> +	phba = io_task->conn->phba;
>  	if (num_sg < 0) {
> -		struct iscsi_conn *conn = task->conn;
> -		struct beiscsi_hba *phba = NULL;
> -
> -		phba = ((struct beiscsi_conn *)conn->dd_data)->phba;
>  		beiscsi_log(phba, KERN_ERR,
>  			    BEISCSI_LOG_IO | BEISCSI_LOG_ISCSI,
>  			    "BM_%d : scsi_dma_map Failed "
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 11/12] be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock
  2016-02-01 10:12 ` [PATCH 11/12] be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock Jitendra Bhivare
@ 2016-02-01 12:26   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 12:26 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:50PM +0530, Jitendra Bhivare wrote:
> Processing of mgmt and IO tasks are done in process context and sofitrqs.
> 
> Allocation and freeing of sgl_handles needs to be done under
> spin_lock_bh/spin_unlock_bh and move the locks to the routines.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_main.c | 25 ++++++++++---------------
>  1 file changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 03265b6..fa2b589 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -1132,6 +1132,7 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba)
>  {
>  	struct sgl_handle *psgl_handle;
>  
> +	spin_lock_bh(&phba->io_sgl_lock);
>  	if (phba->io_sgl_hndl_avbl) {
>  		beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO,
>  			    "BM_%d : In alloc_io_sgl_handle,"
> @@ -1149,12 +1150,14 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba)
>  			phba->io_sgl_alloc_index++;
>  	} else
>  		psgl_handle = NULL;
> +	spin_unlock_bh(&phba->io_sgl_lock);
>  	return psgl_handle;
>  }
>  
>  static void
>  free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
>  {
> +	spin_lock_bh(&phba->io_sgl_lock);
>  	beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_IO,
>  		    "BM_%d : In free_,io_sgl_free_index=%d\n",
>  		    phba->io_sgl_free_index);
> @@ -1169,6 +1172,7 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
>  			     "value there=%p\n", phba->io_sgl_free_index,
>  			     phba->io_sgl_hndl_base
>  			     [phba->io_sgl_free_index]);
> +		 spin_unlock_bh(&phba->io_sgl_lock);
>  		return;
>  	}
>  	phba->io_sgl_hndl_base[phba->io_sgl_free_index] = psgl_handle;
> @@ -1177,6 +1181,7 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
>  		phba->io_sgl_free_index = 0;
>  	else
>  		phba->io_sgl_free_index++;
> +	spin_unlock_bh(&phba->io_sgl_lock);
>  }
>  
>  static inline struct wrb_handle *
> @@ -1257,6 +1262,7 @@ static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba)
>  {
>  	struct sgl_handle *psgl_handle;
>  
> +	spin_lock_bh(&phba->mgmt_sgl_lock);
>  	if (phba->eh_sgl_hndl_avbl) {
>  		psgl_handle = phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index];
>  		phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index] = NULL;
> @@ -1274,13 +1280,14 @@ static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba)
>  			phba->eh_sgl_alloc_index++;
>  	} else
>  		psgl_handle = NULL;
> +	spin_unlock_bh(&phba->mgmt_sgl_lock);
>  	return psgl_handle;
>  }
>  
>  void
>  free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
>  {
> -
> +	spin_lock_bh(&phba->mgmt_sgl_lock);
>  	beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
>  		    "BM_%d : In  free_mgmt_sgl_handle,"
>  		    "eh_sgl_free_index=%d\n",
> @@ -1295,6 +1302,7 @@ free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
>  			    "BM_%d : Double Free in eh SGL ,"
>  			    "eh_sgl_free_index=%d\n",
>  			    phba->eh_sgl_free_index);
> +		spin_unlock_bh(&phba->mgmt_sgl_lock);
>  		return;
>  	}
>  	phba->eh_sgl_hndl_base[phba->eh_sgl_free_index] = psgl_handle;
> @@ -1304,6 +1312,7 @@ free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle)
>  		phba->eh_sgl_free_index = 0;
>  	else
>  		phba->eh_sgl_free_index++;
> +	spin_unlock_bh(&phba->mgmt_sgl_lock);
>  }
>  
>  static void
> @@ -4616,11 +4625,9 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn,
>  	}
>  
>  	if (io_task->psgl_handle) {
> -		spin_lock_bh(&phba->mgmt_sgl_lock);
>  		free_mgmt_sgl_handle(phba,
>  				     io_task->psgl_handle);
>  		io_task->psgl_handle = NULL;
> -		spin_unlock_bh(&phba->mgmt_sgl_lock);
>  	}
>  
>  	if (io_task->mtask_addr) {
> @@ -4666,9 +4673,7 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
>  		}
>  
>  		if (io_task->psgl_handle) {
> -			spin_lock(&phba->io_sgl_lock);
>  			free_io_sgl_handle(phba, io_task->psgl_handle);
> -			spin_unlock(&phba->io_sgl_lock);
>  			io_task->psgl_handle = NULL;
>  		}
>  
> @@ -4784,9 +4789,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
>  	io_task->pwrb_handle = NULL;
>  
>  	if (task->sc) {
> -		spin_lock(&phba->io_sgl_lock);
>  		io_task->psgl_handle = alloc_io_sgl_handle(phba);
> -		spin_unlock(&phba->io_sgl_lock);
>  		if (!io_task->psgl_handle) {
>  			beiscsi_log(phba, KERN_ERR,
>  				    BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG,
> @@ -4811,10 +4814,8 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
>  		if ((opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) {
>  			beiscsi_conn->task = task;
>  			if (!beiscsi_conn->login_in_progress) {
> -				spin_lock(&phba->mgmt_sgl_lock);
>  				io_task->psgl_handle = (struct sgl_handle *)
>  						alloc_mgmt_sgl_handle(phba);
> -				spin_unlock(&phba->mgmt_sgl_lock);
>  				if (!io_task->psgl_handle) {
>  					beiscsi_log(phba, KERN_ERR,
>  						    BEISCSI_LOG_IO |
> @@ -4853,9 +4854,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
>  						beiscsi_conn->plogin_wrb_handle;
>  			}
>  		} else {
> -			spin_lock(&phba->mgmt_sgl_lock);
>  			io_task->psgl_handle = alloc_mgmt_sgl_handle(phba);
> -			spin_unlock(&phba->mgmt_sgl_lock);
>  			if (!io_task->psgl_handle) {
>  				beiscsi_log(phba, KERN_ERR,
>  					    BEISCSI_LOG_IO |
> @@ -4890,15 +4889,11 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
>  	return 0;
>  
>  free_io_hndls:
> -	spin_lock(&phba->io_sgl_lock);
>  	free_io_sgl_handle(phba, io_task->psgl_handle);
> -	spin_unlock(&phba->io_sgl_lock);
>  	goto free_hndls;
>  free_mgmt_hndls:
> -	spin_lock(&phba->mgmt_sgl_lock);
>  	free_mgmt_sgl_handle(phba, io_task->psgl_handle);
>  	io_task->psgl_handle = NULL;
> -	spin_unlock(&phba->mgmt_sgl_lock);
>  free_hndls:
>  	phwi_ctrlr = phba->phwi_ctrlr;
>  	cri_index = BE_GET_CRI_FROM_CID(
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions
  2016-02-01 10:12 ` [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions Jitendra Bhivare
  2016-02-01 11:26   ` Johannes Thumshirn
@ 2016-02-01 12:26   ` kbuild test robot
  1 sibling, 0 replies; 28+ messages in thread
From: kbuild test robot @ 2016-02-01 12:26 UTC (permalink / raw)
  Cc: kbuild-all, linux-scsi, michaelc, Jitendra Bhivare

[-- Attachment #1: Type: text/plain, Size: 2356 bytes --]

Hi Jitendra,

[auto build test ERROR on scsi/for-next]
[also build test ERROR on next-20160201]
[cannot apply to v4.5-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Jitendra-Bhivare/be2iscsi-critical-fixes-for-11-0-0-0/20160201-181716
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-s1-02011933 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: the linux-review/Jitendra-Bhivare/be2iscsi-critical-fixes-for-11-0-0-0/20160201-181716 HEAD 7dd8e579ae5fffda523c8c75978134fe99d5aa68 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/scsi/be2iscsi/be_cmds.c: In function 'be_mbox_notify_wait':
>> drivers/scsi/be2iscsi/be_cmds.c:716:12: error: implicit declaration of function 'be_mcc_compl_process' [-Werror=implicit-function-declaration]
      status = be_mcc_compl_process(ctrl, &mbox->compl);
               ^
   cc1: some warnings being treated as errors

vim +/be_mcc_compl_process +716 drivers/scsi/be2iscsi/be_cmds.c

ea53ed97 Jitendra Bhivare    2016-02-01  710  	status = be_mbox_db_ready_poll(ctrl);
bfead3b2 Jayamohan Kallickal 2009-10-23  711  	if (status != 0)
bfead3b2 Jayamohan Kallickal 2009-10-23  712  		return status;
bfead3b2 Jayamohan Kallickal 2009-10-23  713  
bfead3b2 Jayamohan Kallickal 2009-10-23  714  	/* A cq entry has been made now */
bfead3b2 Jayamohan Kallickal 2009-10-23  715  	if (be_mcc_compl_is_new(compl)) {
bfead3b2 Jayamohan Kallickal 2009-10-23 @716  		status = be_mcc_compl_process(ctrl, &mbox->compl);
bfead3b2 Jayamohan Kallickal 2009-10-23  717  		be_mcc_compl_use(compl);
bfead3b2 Jayamohan Kallickal 2009-10-23  718  		if (status)
bfead3b2 Jayamohan Kallickal 2009-10-23  719  			return status;

:::::: The code at line 716 was first introduced by commit
:::::: bfead3b2cb4607c71831423c3ee97d22cd0c9dcb [SCSI] be2iscsi: Adding msix and mcc_rings V3

:::::: TO: Jayamohan Kallickal <jayamohank@serverengines.com>
:::::: CC: James Bottomley <James.Bottomley@suse.de>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 31517 bytes --]

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

* Re: [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free
  2016-02-01 10:12 ` [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free Jitendra Bhivare
@ 2016-02-01 12:27   ` Johannes Thumshirn
  0 siblings, 0 replies; 28+ messages in thread
From: Johannes Thumshirn @ 2016-02-01 12:27 UTC (permalink / raw)
  To: Jitendra Bhivare; +Cc: linux-scsi, michaelc

On Mon, Feb 01, 2016 at 03:42:51PM +0530, Jitendra Bhivare wrote:
> FW got into UE after running IO stress test
> 
> With kernel change to split session lock in frwd_lock and back_lock for tx
> and rx path correspondingly, in the IO path, common resource used in driver
> such as WRB was left unprotected.
> 
> Add wrb_lock spinlock to protect allocation and freeing of WRB.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
> ---
>  drivers/scsi/be2iscsi/be_main.c | 5 +++++
>  drivers/scsi/be2iscsi/be_main.h | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index fa2b589..0892ee2 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -1190,12 +1190,14 @@ beiscsi_get_wrb_handle(struct hwi_wrb_context *pwrb_context,
>  {
>  	struct wrb_handle *pwrb_handle;
>  
> +	spin_lock_bh(&pwrb_context->wrb_lock);
>  	pwrb_handle = pwrb_context->pwrb_handle_base[pwrb_context->alloc_index];
>  	pwrb_context->wrb_handles_available--;
>  	if (pwrb_context->alloc_index == (wrbs_per_cxn - 1))
>  		pwrb_context->alloc_index = 0;
>  	else
>  		pwrb_context->alloc_index++;
> +	spin_unlock_bh(&pwrb_context->wrb_lock);
>  
>  	return pwrb_handle;
>  }
> @@ -1227,12 +1229,14 @@ beiscsi_put_wrb_handle(struct hwi_wrb_context *pwrb_context,
>  		       struct wrb_handle *pwrb_handle,
>  		       unsigned int wrbs_per_cxn)
>  {
> +	spin_lock_bh(&pwrb_context->wrb_lock);
>  	pwrb_context->pwrb_handle_base[pwrb_context->free_index] = pwrb_handle;
>  	pwrb_context->wrb_handles_available++;
>  	if (pwrb_context->free_index == (wrbs_per_cxn - 1))
>  		pwrb_context->free_index = 0;
>  	else
>  		pwrb_context->free_index++;
> +	spin_unlock_bh(&pwrb_context->wrb_lock);
>  }
>  
>  /**
> @@ -2920,6 +2924,7 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
>  			}
>  			num_cxn_wrbh--;
>  		}
> +		spin_lock_init(&pwrb_context->wrb_lock);
>  	}
>  	idx = 0;
>  	for (index = 0; index < phba->params.cxns_per_ctrl; index++) {
> diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
> index 5ded3fa..30a4606 100644
> --- a/drivers/scsi/be2iscsi/be_main.h
> +++ b/drivers/scsi/be2iscsi/be_main.h
> @@ -304,6 +304,7 @@ struct invalidate_command_table {
>  #define BEISCSI_GET_ULP_FROM_CRI(phwi_ctrlr, cri) \
>  	(phwi_ctrlr->wrb_context[cri].ulp_num)
>  struct hwi_wrb_context {
> +	spinlock_t wrb_lock;
>  	struct list_head wrb_handle_list;
>  	struct list_head wrb_handle_drvr_list;
>  	struct wrb_handle **pwrb_handle_base;
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock
  2016-02-01 11:15   ` James Bottomley
@ 2016-02-02  1:44     ` Martin K. Petersen
  0 siblings, 0 replies; 28+ messages in thread
From: Martin K. Petersen @ 2016-02-02  1:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: Jitendra Bhivare, linux-scsi, michaelc

>>>>> "James" == James Bottomley <James.Bottomley@HansenPartnership.com> writes:

James> On Mon, 2016-02-01 at 15:42 +0530, Jitendra Bhivare wrote:
>> mcc_cq_lock spin_lock is used only in beiscsi_process_mcc which is
>> called only when all interrupts are disabled from mgmt_epfw_cleanup
>> during unloading of driver. There is no other context where there can
>> be contention for the processing of CQ.

James> Removing a lock is not a bug fix unless it's causing a user
James> visible problem, so this patch (and quite a lot of others in this
James> series) should go through the merge window process.

James> For things that cause user visible problems, we need a
James> description of the problem in the changelog and a cc to stable
James> unless it was a regression in the 4.4+ merge window.

I applied be2iscsi 11.0.0.0 to 4.6/scsi-queue about a week ago so this
is inevitably merge window material.

Jitendra, it's a good idea to spell out the intended target release or
repository when you post patches. Makes it easier for everyone.

Instead of "[PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0" I would
suggest something like "[PATCH 00/12] be2iscsi: important fixes for
11.0.0.0 driver in 4.6/scsi-queue".

That way we know which tree to apply the patches to and it's clear that
it's an incremental update to a previously queued series.

Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2016-02-02  1:44 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 10:12 [PATCH 00/12] be2iscsi: critical fixes for 11.0.0.0 Jitendra Bhivare
2016-02-01 10:12 ` [PATCH 01/12] be2iscsi: Remove unused mcc_cq_lock Jitendra Bhivare
2016-02-01 11:10   ` Johannes Thumshirn
2016-02-01 11:15   ` James Bottomley
2016-02-02  1:44     ` Martin K. Petersen
2016-02-01 10:12 ` [PATCH 02/12] be2iscsi: Use macros for MCC WRB and CQE fields Jitendra Bhivare
2016-02-01 11:13   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 03/12] be2iscsi: Remove redundant MCC processing code Jitendra Bhivare
2016-02-01 11:17   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 04/12] be2iscsi: Rename MCC and BMBX processing functions Jitendra Bhivare
2016-02-01 11:26   ` Johannes Thumshirn
2016-02-01 12:26   ` kbuild test robot
2016-02-01 10:12 ` [PATCH 05/12] be2iscsi: Remove be_mbox_notify_wait function Jitendra Bhivare
2016-02-01 11:27   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 06/12] be2iscsi: Fix be_mcc_compl_poll to use tag_state Jitendra Bhivare
2016-02-01 11:29   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 07/12] be2iscsi: Cleanup processing of BMBX completion Jitendra Bhivare
2016-02-01 11:41   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection Jitendra Bhivare
2016-02-01 11:45   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 09/12] be2iscsi: Couple MCC tag and WRB alloc and free Jitendra Bhivare
2016-02-01 12:14   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 10/12] be2iscsi: Fix ExpStatSn in management tasks Jitendra Bhivare
2016-02-01 12:24   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 11/12] be2iscsi: _bh for io_sgl_lock and mgmt_sgl_lock Jitendra Bhivare
2016-02-01 12:26   ` Johannes Thumshirn
2016-02-01 10:12 ` [PATCH 12/12] be2iscsi: Add lock to protect WRB alloc and free Jitendra Bhivare
2016-02-01 12:27   ` Johannes Thumshirn

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.