All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: Fix qla2x00_request_irqs() for MSI
@ 2019-11-21  5:40 Huacai Chen
  2019-11-22 16:06 ` [EXT] " Himanshu Madhani
  2019-11-27  2:39 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Huacai Chen @ 2019-11-21  5:40 UTC (permalink / raw)
  To: hmadhani
  Cc: James E . J . Bottomley, Martin K . Petersen, Fuxin Zhang,
	linux-scsi, Huacai Chen, Michael Hernandez

Commit 4fa183455988adaa ("scsi: qla2xxx: Utilize pci_alloc_irq_vectors
/pci_free_irq_vectors calls.") use pci_alloc_irq_vectors() to replace
pci_enable_msi() but it didn't handle the return value correctly. This
bug make qla2x00 always fail to setup MSI if MSI-X fail, so fix it.

BTW, improve the log message of return value in qla2x00_request_irqs()
to avoid confusing.

Fixes: 4fa183455988adaa ("scsi: qla2xxx: Utilize pci_alloc_irq_vectors/pci_free_irq_vectors calls.")
Cc: Michael Hernandez <michael.hernandez@cavium.com>
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 drivers/scsi/qla2xxx/qla_isr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 4c26630..c0568c6 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3626,7 +3626,7 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
 skip_msix:
 
 	ql_log(ql_log_info, vha, 0x0037,
-	    "Falling back-to MSI mode -%d.\n", ret);
+	    "Falling back-to MSI mode -- ret=%d.\n", ret);
 
 	if (!IS_QLA24XX(ha) && !IS_QLA2532(ha) && !IS_QLA8432(ha) &&
 	    !IS_QLA8001(ha) && !IS_P3P_TYPE(ha) && !IS_QLAFX00(ha) &&
@@ -3634,13 +3634,13 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
 		goto skip_msi;
 
 	ret = pci_alloc_irq_vectors(ha->pdev, 1, 1, PCI_IRQ_MSI);
-	if (!ret) {
+	if (ret > 0) {
 		ql_dbg(ql_dbg_init, vha, 0x0038,
 		    "MSI: Enabled.\n");
 		ha->flags.msi_enabled = 1;
 	} else
 		ql_log(ql_log_warn, vha, 0x0039,
-		    "Falling back-to INTa mode -- %d.\n", ret);
+		    "Falling back-to INTa mode -- ret=%d.\n", ret);
 skip_msi:
 
 	/* Skip INTx on ISP82xx. */
-- 
2.7.0


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

* Re: [EXT] [PATCH] scsi: qla2xxx: Fix qla2x00_request_irqs() for MSI
  2019-11-21  5:40 [PATCH] scsi: qla2xxx: Fix qla2x00_request_irqs() for MSI Huacai Chen
@ 2019-11-22 16:06 ` Himanshu Madhani
  2019-11-27  2:39 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Himanshu Madhani @ 2019-11-22 16:06 UTC (permalink / raw)
  To: Huacai Chen
  Cc: James E . J . Bottomley, Martin K . Petersen, Fuxin Zhang,
	linux-scsi, Michael Hernandez



On 11/20/19, 11:37 PM, "Huacai Chen" <chenhuacai@gmail.com on behalf of chenhc@lemote.com> wrote:

    External Email
    
    ----------------------------------------------------------------------
    Commit 4fa183455988adaa ("scsi: qla2xxx: Utilize pci_alloc_irq_vectors
    /pci_free_irq_vectors calls.") use pci_alloc_irq_vectors() to replace
    pci_enable_msi() but it didn't handle the return value correctly. This
    bug make qla2x00 always fail to setup MSI if MSI-X fail, so fix it.
    
    BTW, improve the log message of return value in qla2x00_request_irqs()
    to avoid confusing.
    
    Fixes: 4fa183455988adaa ("scsi: qla2xxx: Utilize pci_alloc_irq_vectors/pci_free_irq_vectors calls.")
    Cc: Michael Hernandez <michael.hernandez@cavium.com>
    Signed-off-by: Huacai Chen <chenhc@lemote.com>
    ---
     drivers/scsi/qla2xxx/qla_isr.c | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
    index 4c26630..c0568c6 100644
    --- a/drivers/scsi/qla2xxx/qla_isr.c
    +++ b/drivers/scsi/qla2xxx/qla_isr.c
    @@ -3626,7 +3626,7 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
     skip_msix:
     
     	ql_log(ql_log_info, vha, 0x0037,
    -	    "Falling back-to MSI mode -%d.\n", ret);
    +	    "Falling back-to MSI mode -- ret=%d.\n", ret);
     
     	if (!IS_QLA24XX(ha) && !IS_QLA2532(ha) && !IS_QLA8432(ha) &&
     	    !IS_QLA8001(ha) && !IS_P3P_TYPE(ha) && !IS_QLAFX00(ha) &&
    @@ -3634,13 +3634,13 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
     		goto skip_msi;
     
     	ret = pci_alloc_irq_vectors(ha->pdev, 1, 1, PCI_IRQ_MSI);
    -	if (!ret) {
    +	if (ret > 0) {
     		ql_dbg(ql_dbg_init, vha, 0x0038,
     		    "MSI: Enabled.\n");
     		ha->flags.msi_enabled = 1;
     	} else
     		ql_log(ql_log_warn, vha, 0x0039,
    -		    "Falling back-to INTa mode -- %d.\n", ret);
    +		    "Falling back-to INTa mode -- ret=%d.\n", ret);
     skip_msi:
     
     	/* Skip INTx on ISP82xx. */
    -- 
    2.7.0
    
   
 Looks Good. 

Acked-by: Himanshu Madhani <hmadhani@marvell.com>


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

* Re: [PATCH] scsi: qla2xxx: Fix qla2x00_request_irqs() for MSI
  2019-11-21  5:40 [PATCH] scsi: qla2xxx: Fix qla2x00_request_irqs() for MSI Huacai Chen
  2019-11-22 16:06 ` [EXT] " Himanshu Madhani
@ 2019-11-27  2:39 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-11-27  2:39 UTC (permalink / raw)
  To: Huacai Chen
  Cc: hmadhani, James E . J . Bottomley, Martin K . Petersen,
	Fuxin Zhang, linux-scsi, Michael Hernandez


Huacai,

> Commit 4fa183455988adaa ("scsi: qla2xxx: Utilize pci_alloc_irq_vectors
> /pci_free_irq_vectors calls.") use pci_alloc_irq_vectors() to replace
> pci_enable_msi() but it didn't handle the return value correctly. This
> bug make qla2x00 always fail to setup MSI if MSI-X fail, so fix it.

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2019-11-27  2:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21  5:40 [PATCH] scsi: qla2xxx: Fix qla2x00_request_irqs() for MSI Huacai Chen
2019-11-22 16:06 ` [EXT] " Himanshu Madhani
2019-11-27  2:39 ` 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.