All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 09/11] lpfc: Correct oops on vport port resets
@ 2016-12-19 23:07 James Smart
  2016-12-20 13:47 ` Hannes Reinecke
  0 siblings, 1 reply; 4+ messages in thread
From: James Smart @ 2016-12-19 23:07 UTC (permalink / raw)
  To: linux-scsi


Correct oops on vport port resets. Incorrect WQE type, thus the clearing
code actually overstepped the WQE.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_sli.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 47b5520..d0ffcf3 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -17219,7 +17219,8 @@ lpfc_drain_txq(struct lpfc_hba *phba)
 	unsigned long iflags = 0;
 	char *fail_msg = NULL;
 	struct lpfc_sglq *sglq;
-	union lpfc_wqe wqe;
+	union lpfc_wqe128 wqe128;
+	union lpfc_wqe *wqe = (union lpfc_wqe *) &wqe128;
 	uint32_t txq_cnt = 0;
 
 	spin_lock_irqsave(&pring->ring_lock, iflags);
@@ -17258,9 +17259,9 @@ lpfc_drain_txq(struct lpfc_hba *phba)
 		piocbq->sli4_xritag = sglq->sli4_xritag;
 		if (NO_XRI == lpfc_sli4_bpl2sgl(phba, piocbq, sglq))
 			fail_msg = "to convert bpl to sgl";
-		else if (lpfc_sli4_iocb2wqe(phba, piocbq, &wqe))
+		else if (lpfc_sli4_iocb2wqe(phba, piocbq, wqe))
 			fail_msg = "to convert iocb to wqe";
-		else if (lpfc_sli4_wq_put(phba->sli4_hba.els_wq, &wqe))
+		else if (lpfc_sli4_wq_put(phba->sli4_hba.els_wq, wqe))
 			fail_msg = " - Wq is full";
 		else
 			lpfc_sli_ringtxcmpl_put(phba, pring, piocbq);
-- 
2.5.0



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

* Re: [PATCH v2 09/11] lpfc: Correct oops on vport port resets
  2016-12-19 23:07 [PATCH v2 09/11] lpfc: Correct oops on vport port resets James Smart
@ 2016-12-20 13:47 ` Hannes Reinecke
  2016-12-20 16:51   ` James Smart
  0 siblings, 1 reply; 4+ messages in thread
From: Hannes Reinecke @ 2016-12-20 13:47 UTC (permalink / raw)
  To: James Smart, linux-scsi

On 12/20/2016 12:07 AM, James Smart wrote:
> 
> Correct oops on vport port resets. Incorrect WQE type, thus the clearing
> code actually overstepped the WQE.
> 
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <james.smart@broadcom.com>
> ---
>  drivers/scsi/lpfc/lpfc_sli.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index 47b5520..d0ffcf3 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -17219,7 +17219,8 @@ lpfc_drain_txq(struct lpfc_hba *phba)
>  	unsigned long iflags = 0;
>  	char *fail_msg = NULL;
>  	struct lpfc_sglq *sglq;
> -	union lpfc_wqe wqe;
> +	union lpfc_wqe128 wqe128;
> +	union lpfc_wqe *wqe = (union lpfc_wqe *) &wqe128;
>  	uint32_t txq_cnt = 0;
>  
>  	spin_lock_irqsave(&pring->ring_lock, iflags);
> @@ -17258,9 +17259,9 @@ lpfc_drain_txq(struct lpfc_hba *phba)
>  		piocbq->sli4_xritag = sglq->sli4_xritag;
>  		if (NO_XRI == lpfc_sli4_bpl2sgl(phba, piocbq, sglq))
>  			fail_msg = "to convert bpl to sgl";
> -		else if (lpfc_sli4_iocb2wqe(phba, piocbq, &wqe))
> +		else if (lpfc_sli4_iocb2wqe(phba, piocbq, wqe))
>  			fail_msg = "to convert iocb to wqe";
> -		else if (lpfc_sli4_wq_put(phba->sli4_hba.els_wq, &wqe))
> +		else if (lpfc_sli4_wq_put(phba->sli4_hba.els_wq, wqe))
>  			fail_msg = " - Wq is full";
>  		else
>  			lpfc_sli_ringtxcmpl_put(phba, pring, piocbq);
> 
Now that is what I call a dodgy interface.
Casting a 128-bit structure to a 64-bit structure, only to call a memset
on the 128-bit structure in lpfc_sli4_iocb2wqe() is positively evil.
Can't you clear up this mess by generally passing in a wqe128?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH v2 09/11] lpfc: Correct oops on vport port resets
  2016-12-20 13:47 ` Hannes Reinecke
@ 2016-12-20 16:51   ` James Smart
  2016-12-20 19:56     ` Hannes Reinecke
  0 siblings, 1 reply; 4+ messages in thread
From: James Smart @ 2016-12-20 16:51 UTC (permalink / raw)
  To: Hannes Reinecke, linux-scsi



On 12/20/2016 5:47 AM, Hannes Reinecke wrote:
>
> Now that is what I call a dodgy interface.
> Casting a 128-bit structure to a 64-bit structure, only to call a memset
> on the 128-bit structure in lpfc_sli4_iocb2wqe() is positively evil.
> Can't you clear up this mess by generally passing in a wqe128?
>
> Cheers,
>
> Hannes

Completely agree. Wanted to get this in now to avoid the issue, and the 
better clean up done afterward as its a bit more involved.

-- james


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

* Re: [PATCH v2 09/11] lpfc: Correct oops on vport port resets
  2016-12-20 16:51   ` James Smart
@ 2016-12-20 19:56     ` Hannes Reinecke
  0 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2016-12-20 19:56 UTC (permalink / raw)
  To: James Smart, linux-scsi

On 12/20/2016 05:51 PM, James Smart wrote:
>
>
> On 12/20/2016 5:47 AM, Hannes Reinecke wrote:
>>
>> Now that is what I call a dodgy interface.
>> Casting a 128-bit structure to a 64-bit structure, only to call a memset
>> on the 128-bit structure in lpfc_sli4_iocb2wqe() is positively evil.
>> Can't you clear up this mess by generally passing in a wqe128?
>>
>> Cheers,
>>
>> Hannes
>
> Completely agree. Wanted to get this in now to avoid the issue, and the
> better clean up done afterward as its a bit more involved.
>
If you promise to...

Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

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

end of thread, other threads:[~2016-12-20 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 23:07 [PATCH v2 09/11] lpfc: Correct oops on vport port resets James Smart
2016-12-20 13:47 ` Hannes Reinecke
2016-12-20 16:51   ` James Smart
2016-12-20 19:56     ` Hannes Reinecke

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.