All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue
@ 2016-08-26  9:39 Jitendra Bhivare
  2016-08-26  9:39 ` [PATCH v2 1/3] be2iscsi: Fix error return code Jitendra Bhivare
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jitendra Bhivare @ 2016-08-26  9:39 UTC (permalink / raw)
  To: christophe.jaillet, julia.lawall, martin.petersen
  Cc: linux-scsi, Jitendra Bhivare

These patches address some auto built issues of 11.2.0.0 be2iscsi
committed in 4.9/scsi-queue.

v2 changes:
Added NULL check for pwrb_handle in PATCH v2 2/3

Christophe JAILLET (1):
  be2iscsi: Fix error return code

Jitendra Bhivare (2):
  be2iscsi: Remove redundant iscsi_wrb desc memset
  be2iscsi: Add missing unlock for mbox_lock

 drivers/scsi/be2iscsi/be_main.c | 27 ++++++++++++++++-----------
 drivers/scsi/be2iscsi/be_mgmt.c |  7 +++----
 2 files changed, 19 insertions(+), 15 deletions(-)

-- 
2.7.4


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

* [PATCH v2 1/3] be2iscsi: Fix error return code
  2016-08-26  9:39 [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue Jitendra Bhivare
@ 2016-08-26  9:39 ` Jitendra Bhivare
  2016-08-26 13:25   ` Johannes Thumshirn
  2016-08-26  9:39 ` [PATCH v2 2/3] be2iscsi: Remove redundant iscsi_wrb desc memset Jitendra Bhivare
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Jitendra Bhivare @ 2016-08-26  9:39 UTC (permalink / raw)
  To: christophe.jaillet, julia.lawall, martin.petersen
  Cc: linux-scsi, Jitendra Bhivare

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

We know that 'ret' is not an error code because it has been tested a few
lines above.
So, if one of these function fails, 0 will be returned instead of an error
code.
Return -ENOMEM instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

'ret' needs to be set with error code if hba_setup_cid_tbls fails.

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

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 222edfc..b30db87 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3017,8 +3017,8 @@ static int be_fill_queue(struct be_queue_info *q,
 static int beiscsi_create_eqs(struct beiscsi_hba *phba,
 			     struct hwi_context_memory *phwi_context)
 {
+	int ret = -ENOMEM, eq_for_mcc;
 	unsigned int i, num_eq_pages;
-	int ret = 0, eq_for_mcc;
 	struct be_queue_info *eq;
 	struct be_dma_mem *mem;
 	void *eq_vaddress;
@@ -3036,8 +3036,8 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
 		mem = &eq->dma_mem;
 		phwi_context->be_eq[i].phba = phba;
 		eq_vaddress = pci_alloc_consistent(phba->pcidev,
-						     num_eq_pages * PAGE_SIZE,
-						     &paddr);
+						   num_eq_pages * PAGE_SIZE,
+						   &paddr);
 		if (!eq_vaddress)
 			goto create_eq_error;
 
@@ -3065,6 +3065,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
 			    phwi_context->be_eq[i].q.id);
 	}
 	return 0;
+
 create_eq_error:
 	for (i = 0; i < (phba->num_cpus + eq_for_mcc); i++) {
 		eq = &phwi_context->be_eq[i].q;
@@ -3081,11 +3082,11 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
 			     struct hwi_context_memory *phwi_context)
 {
 	unsigned int i, num_cq_pages;
-	int ret = 0;
 	struct be_queue_info *cq, *eq;
 	struct be_dma_mem *mem;
 	struct be_eq_obj *pbe_eq;
 	void *cq_vaddress;
+	int ret = -ENOMEM;
 	dma_addr_t paddr;
 
 	num_cq_pages = PAGES_REQUIRED(phba->params.num_cq_entries * \
@@ -3099,10 +3100,11 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba,
 		pbe_eq->phba = phba;
 		mem = &cq->dma_mem;
 		cq_vaddress = pci_alloc_consistent(phba->pcidev,
-						     num_cq_pages * PAGE_SIZE,
-						     &paddr);
+						   num_cq_pages * PAGE_SIZE,
+						   &paddr);
 		if (!cq_vaddress)
 			goto create_cq_error;
+
 		ret = be_fill_queue(cq, phba->params.num_cq_entries,
 				    sizeof(struct sol_cqe), cq_vaddress);
 		if (ret) {
@@ -3137,7 +3139,6 @@ create_cq_error:
 					    mem->va, mem->dma);
 	}
 	return ret;
-
 }
 
 static int
@@ -4230,7 +4231,8 @@ static int beiscsi_init_port(struct beiscsi_hba *phba)
 		goto do_cleanup_ctrlr;
 	}
 
-	if (hba_setup_cid_tbls(phba)) {
+	ret = hba_setup_cid_tbls(phba);
+	if (ret < 0) {
 		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
 			    "BM_%d : Failed in hba_setup_cid_tbls\n");
 		kfree(phba->io_sgl_hndl_base);
@@ -5627,7 +5629,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
 	struct hwi_context_memory *phwi_context;
 	struct be_eq_obj *pbe_eq;
 	unsigned int s_handle;
-	int ret = 0, i;
+	int ret, i;
 
 	ret = beiscsi_enable_pci(pcidev);
 	if (ret < 0) {
@@ -5640,6 +5642,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
 	if (!phba) {
 		dev_err(&pcidev->dev,
 			"beiscsi_dev_probe - Failed in beiscsi_hba_alloc\n");
+		ret = -ENOMEM;
 		goto disable_pci;
 	}
 
@@ -5744,6 +5747,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
 		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
 			    "BM_%d : beiscsi_dev_probe-"
 			    "Failed to allocate work queue\n");
+		ret = -ENOMEM;
 		goto free_twq;
 	}
 
-- 
2.7.4


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

* [PATCH v2 2/3] be2iscsi: Remove redundant iscsi_wrb desc memset
  2016-08-26  9:39 [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue Jitendra Bhivare
  2016-08-26  9:39 ` [PATCH v2 1/3] be2iscsi: Fix error return code Jitendra Bhivare
@ 2016-08-26  9:39 ` Jitendra Bhivare
  2016-08-26 13:27   ` Johannes Thumshirn
  2016-08-26  9:39 ` [PATCH v2 3/3] be2iscsi: Add missing unlock for mbox_lock Jitendra Bhivare
  2016-08-31  2:26 ` [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue Martin K. Petersen
  3 siblings, 1 reply; 8+ messages in thread
From: Jitendra Bhivare @ 2016-08-26  9:39 UTC (permalink / raw)
  To: christophe.jaillet, julia.lawall, martin.petersen
  Cc: linux-scsi, Jitendra Bhivare

alloc_wrb_handle already does memset zero of iscsi_wrb descriptor so
remove redundant memset in WRB submission paths.

Add pwrb_handle NULL check before memsett'ing pwrb.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
---
 drivers/scsi/be2iscsi/be_main.c | 5 +++--
 drivers/scsi/be2iscsi/be_mgmt.c | 3 ---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index b30db87..6a6906f 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -967,7 +967,9 @@ beiscsi_get_wrb_handle(struct hwi_wrb_context *pwrb_context,
 	else
 		pwrb_context->alloc_index++;
 	spin_unlock_bh(&pwrb_context->wrb_lock);
-	memset(pwrb_handle->pwrb, 0, sizeof(*pwrb_handle->pwrb));
+
+	if (pwrb_handle)
+		memset(pwrb_handle->pwrb, 0, sizeof(*pwrb_handle->pwrb));
 
 	return pwrb_handle;
 }
@@ -4718,7 +4720,6 @@ static int beiscsi_mtask(struct iscsi_task *task)
 
 	cid = beiscsi_conn->beiscsi_conn_cid;
 	pwrb = io_task->pwrb_handle->pwrb;
-	memset(pwrb, 0, sizeof(*pwrb));
 
 	if (is_chip_be2_be3r(phba)) {
 		AMAP_SET_BITS(struct amap_iscsi_wrb, cmdsn_itt, pwrb,
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 3ac7b88..b9ff939 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -1350,7 +1350,6 @@ void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
 {
 	struct iscsi_wrb *pwrb = pwrb_handle->pwrb;
 
-	memset(pwrb, 0, sizeof(*pwrb));
 	AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb,
 		      max_send_data_segment_length, pwrb,
 		      params->dw[offsetof(struct amap_beiscsi_offload_params,
@@ -1422,8 +1421,6 @@ void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params,
 {
 	struct iscsi_wrb *pwrb = pwrb_handle->pwrb;
 
-	memset(pwrb, 0, sizeof(*pwrb));
-
 	AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2,
 		      max_burst_length, pwrb, params->dw[offsetof
 		      (struct amap_beiscsi_offload_params,
-- 
2.7.4


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

* [PATCH v2 3/3] be2iscsi: Add missing unlock for mbox_lock
  2016-08-26  9:39 [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue Jitendra Bhivare
  2016-08-26  9:39 ` [PATCH v2 1/3] be2iscsi: Fix error return code Jitendra Bhivare
  2016-08-26  9:39 ` [PATCH v2 2/3] be2iscsi: Remove redundant iscsi_wrb desc memset Jitendra Bhivare
@ 2016-08-26  9:39 ` Jitendra Bhivare
  2016-08-26 13:28   ` Johannes Thumshirn
  2016-08-31  2:26 ` [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue Martin K. Petersen
  3 siblings, 1 reply; 8+ messages in thread
From: Jitendra Bhivare @ 2016-08-26  9:39 UTC (permalink / raw)
  To: christophe.jaillet, julia.lawall, martin.petersen
  Cc: linux-scsi, Jitendra Bhivare

Julia pointed out beiscsi_boot_get_sinfo does not unlock
mbox_lock on nonemb_cmd memory allocation failure.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
---
 drivers/scsi/be2iscsi/be_mgmt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index b9ff939..aebc4dd 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -1085,8 +1085,10 @@ unsigned int beiscsi_boot_get_sinfo(struct beiscsi_hba *phba)
 	nonemb_cmd->va = pci_alloc_consistent(phba->ctrl.pdev,
 					      sizeof(nonemb_cmd->size),
 					      &nonemb_cmd->dma);
-	if (!nonemb_cmd->va)
+	if (!nonemb_cmd->va) {
+		mutex_unlock(&ctrl->mbox_lock);
 		return 0;
+	}
 
 	req = nonemb_cmd->va;
 	memset(req, 0, sizeof(*req));
-- 
2.7.4


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

* Re: [PATCH v2 1/3] be2iscsi: Fix error return code
  2016-08-26  9:39 ` [PATCH v2 1/3] be2iscsi: Fix error return code Jitendra Bhivare
@ 2016-08-26 13:25   ` Johannes Thumshirn
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Thumshirn @ 2016-08-26 13:25 UTC (permalink / raw)
  To: Jitendra Bhivare
  Cc: christophe.jaillet, julia.lawall, martin.petersen, linux-scsi

On Fri, Aug 26, 2016 at 03:09:06PM +0530, Jitendra Bhivare wrote:
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> We know that 'ret' is not an error code because it has been tested a few
> lines above.
> So, if one of these function fails, 0 will be returned instead of an error
> code.
> Return -ENOMEM instead.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> 'ret' needs to be set with error code if hba_setup_cid_tbls fails.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
> ---

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

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

* Re: [PATCH v2 2/3] be2iscsi: Remove redundant iscsi_wrb desc memset
  2016-08-26  9:39 ` [PATCH v2 2/3] be2iscsi: Remove redundant iscsi_wrb desc memset Jitendra Bhivare
@ 2016-08-26 13:27   ` Johannes Thumshirn
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Thumshirn @ 2016-08-26 13:27 UTC (permalink / raw)
  To: Jitendra Bhivare
  Cc: christophe.jaillet, julia.lawall, martin.petersen, linux-scsi

On Fri, Aug 26, 2016 at 03:09:07PM +0530, Jitendra Bhivare wrote:
> alloc_wrb_handle already does memset zero of iscsi_wrb descriptor so
> remove redundant memset in WRB submission paths.
> 
> Add pwrb_handle NULL check before memsett'ing pwrb.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
> ---
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

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

* Re: [PATCH v2 3/3] be2iscsi: Add missing unlock for mbox_lock
  2016-08-26  9:39 ` [PATCH v2 3/3] be2iscsi: Add missing unlock for mbox_lock Jitendra Bhivare
@ 2016-08-26 13:28   ` Johannes Thumshirn
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Thumshirn @ 2016-08-26 13:28 UTC (permalink / raw)
  To: Jitendra Bhivare
  Cc: christophe.jaillet, julia.lawall, martin.petersen, linux-scsi

On Fri, Aug 26, 2016 at 03:09:08PM +0530, Jitendra Bhivare wrote:
> Julia pointed out beiscsi_boot_get_sinfo does not unlock
> mbox_lock on nonemb_cmd memory allocation failure.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
> ---

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

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

* Re: [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue
  2016-08-26  9:39 [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue Jitendra Bhivare
                   ` (2 preceding siblings ...)
  2016-08-26  9:39 ` [PATCH v2 3/3] be2iscsi: Add missing unlock for mbox_lock Jitendra Bhivare
@ 2016-08-31  2:26 ` Martin K. Petersen
  3 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2016-08-31  2:26 UTC (permalink / raw)
  To: Jitendra Bhivare
  Cc: christophe.jaillet, julia.lawall, martin.petersen, linux-scsi

>>>>> "Jitendra" == Jitendra Bhivare <jitendra.bhivare@broadcom.com> writes:

Jitendra> These patches address some auto built issues of 11.2.0.0
Jitendra> be2iscsi committed in 4.9/scsi-queue.

Applied to 4.9/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2016-08-31  2:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-26  9:39 [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue Jitendra Bhivare
2016-08-26  9:39 ` [PATCH v2 1/3] be2iscsi: Fix error return code Jitendra Bhivare
2016-08-26 13:25   ` Johannes Thumshirn
2016-08-26  9:39 ` [PATCH v2 2/3] be2iscsi: Remove redundant iscsi_wrb desc memset Jitendra Bhivare
2016-08-26 13:27   ` Johannes Thumshirn
2016-08-26  9:39 ` [PATCH v2 3/3] be2iscsi: Add missing unlock for mbox_lock Jitendra Bhivare
2016-08-26 13:28   ` Johannes Thumshirn
2016-08-31  2:26 ` [PATCH v2 0/3] be2iscsi: cleanup of 11.2 in 4.9/scsi-queue Martin K. Petersen

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.