linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 12/22] lpfc: Use pci_enable_msix_range()
  2014-02-04 11:16 [PATCH 00/22] scsi: " Alexander Gordeev
@ 2014-02-04 11:16 ` Alexander Gordeev
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Gordeev @ 2014-02-04 11:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alexander Gordeev, James Smart, linux-scsi, linux-pci

As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: James Smart <james.smart@emulex.com>
Cc: linux-scsi@vger.kernel.org
Cc: linux-pci@vger.kernel.org
---
 drivers/scsi/lpfc/lpfc_init.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a9df97a..5bb40ca 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8187,8 +8187,8 @@ lpfc_sli_disable_msix(struct lpfc_hba *phba)
  * @phba: pointer to lpfc hba data structure.
  *
  * This routine is invoked to enable the MSI interrupt mode to device with
- * SLI-3 interface spec. The kernel function pci_enable_msi() is called to
- * enable the MSI vector. The device driver is responsible for calling the
+ * SLI-3 interface spec. The kernel function pci_enable_msi_range() is called
+ * to enable the MSI vector. The device driver is responsible for calling the
  * request_irq() to register MSI vector with a interrupt the handler, which
  * is done in this function.
  *
@@ -8201,8 +8201,8 @@ lpfc_sli_enable_msi(struct lpfc_hba *phba)
 {
 	int rc;
 
-	rc = pci_enable_msi(phba->pcidev);
-	if (!rc)
+	rc = pci_enable_msi_range(phba->pcidev, 1, 1);
+	if (rc > 0)
 		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
 				"0462 PCI enable MSI mode success.\n");
 	else {
@@ -8636,17 +8636,14 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
 		phba->sli4_hba.msix_entries[index].entry = index;
 
 	/* Configure MSI-X capability structure */
-	vectors = phba->cfg_fcp_io_channel;
-enable_msix_vectors:
-	rc = pci_enable_msix(phba->pcidev, phba->sli4_hba.msix_entries,
-			     vectors);
-	if (rc > 1) {
-		vectors = rc;
-		goto enable_msix_vectors;
-	} else if (rc) {
+	rc = pci_enable_msix_range(phba->pcidev, phba->sli4_hba.msix_entries,
+				   2, phba->cfg_fcp_io_channel);
+	if (rc < 0) {
 		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
 				"0484 PCI enable MSI-X failed (%d)\n", rc);
 		goto vec_fail_out;
+	} else {
+		vectors = rc;
 	}
 
 	/* Log MSI-X vector assignment */
-- 
1.7.7.6


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

* Re: [PATCH 12/22] lpfc: Use pci_enable_msix_range()
@ 2014-02-20 16:47 James Smart
  2014-02-23 19:45 ` Alexander Gordeev
  0 siblings, 1 reply; 3+ messages in thread
From: James Smart @ 2014-02-20 16:47 UTC (permalink / raw)
  To: agordeev; +Cc: james.smart, linux-scsi, linux-pci, linux-kernel

Alexander,

I've reworked this patch to layer on top of our rev 8.3.45 patches
that were just posted to linux-scsi. There were some conflicts due to
new additions.  Additionally, there were two other uses of pci_enable_msiXXX
that needed to be addressed.  The changes in this patch also address the
change requested by:
"[PATCH 11/22] lpfc: Remove superfluous call to pci_disable_msix()"

To avoid creating merge conflicts - either by your patches going in then
scsi git tree trying to merge or by scsi git tree going in and your patches
trying to merge - I recommend that you eliminate your lpfc patches from the
kernel and apply the patch below once scsi git with the updated lpfc driver
has actually merged.

-- james s


Revised patch:



As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

CC: Alexander Gordeev <agordeev@redhat.com>
Cc: linux-scsi@vger.kernel.org
Cc: linux-pci@vger.kernel.org



Signed-off-by: James Smart <james.smart@emulex.com>

 ---

 lpfc_init.c |   43 ++++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c	2014-02-19 16:23:07.260097013 -0500
+++ b/drivers/scsi/lpfc/lpfc_init.c	2014-02-20 11:39:20.348203354 -0500
@@ -8100,8 +8100,8 @@ lpfc_sli4_pci_mem_unset(struct lpfc_hba
  * @phba: pointer to lpfc hba data structure.
  *
  * This routine is invoked to enable the MSI-X interrupt vectors to device
- * with SLI-3 interface specs. The kernel function pci_enable_msix() is
- * called to enable the MSI-X vectors. Note that pci_enable_msix(), once
+ * with SLI-3 interface specs. The kernel function pci_enable_msix_range() is
+ * called to enable the MSI-X vectors. Note that pci_enable_msix_range(), once
  * invoked, enables either all or nothing, depending on the current
  * availability of PCI vector resources. The device driver is responsible
  * for calling the individual request_irq() to register each MSI-X vector
@@ -8126,12 +8126,12 @@ lpfc_sli_enable_msix(struct lpfc_hba *ph
 		phba->msix_entries[i].entry = i;
 
 	/* Configure MSI-X capability structure */
-	rc = pci_enable_msix(phba->pcidev, phba->msix_entries,
-				ARRAY_SIZE(phba->msix_entries));
-	if (rc) {
+	rc = pci_enable_msix_range(phba->pcidev, phba->msix_entries,
+				   LPFC_MSIX_VECTORS, LPFC_MSIX_VECTORS);
+	if (rc < 0) {
 		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
 				"0420 PCI enable MSI-X failed (%d)\n", rc);
-		goto msi_fail_out;
+		goto vec_fail_out;
 	}
 	for (i = 0; i < LPFC_MSIX_VECTORS; i++)
 		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
@@ -8209,6 +8209,8 @@ irq_fail_out:
 msi_fail_out:
 	/* Unconfigure MSI-X capability structure */
 	pci_disable_msix(phba->pcidev);
+
+vec_fail_out:
 	return rc;
 }
 
@@ -8238,8 +8240,8 @@ lpfc_sli_disable_msix(struct lpfc_hba *p
  * @phba: pointer to lpfc hba data structure.
  *
  * This routine is invoked to enable the MSI interrupt mode to device with
- * SLI-3 interface spec. The kernel function pci_enable_msi() is called to
- * enable the MSI vector. The device driver is responsible for calling the
+ * SLI-3 interface spec. The kernel function pci_enable_msi_range() is called
+ * to enable the MSI vector. The device driver is responsible for calling the
  * request_irq() to register MSI vector with a interrupt the handler, which
  * is done in this function.
  *
@@ -8252,8 +8254,8 @@ lpfc_sli_enable_msi(struct lpfc_hba *phb
 {
 	int rc;
 
-	rc = pci_enable_msi(phba->pcidev);
-	if (!rc)
+	rc = pci_enable_msi_range(phba->pcidev, 1, 1);
+	if (rc > 0)
 		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
 				"0462 PCI enable MSI mode success.\n");
 	else {
@@ -8692,17 +8694,15 @@ lpfc_sli4_enable_msix(struct lpfc_hba *p
 		phba->sli4_hba.msix_entries[index].entry = index;
 		vectors++;
 	}
-enable_msix_vectors:
-	rc = pci_enable_msix(phba->pcidev, phba->sli4_hba.msix_entries,
-			     vectors);
-	if (rc > 1) {
-		vectors = rc;
-		goto enable_msix_vectors;
-	} else if (rc) {
+
+	rc = pci_enable_msix_range(phba->pcidev, phba->sli4_hba.msix_entries,
+				   2, vectors);
+	if (rc < 0) {
 		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
 				"0484 PCI enable MSI-X failed (%d)\n", rc);
 		goto msi_fail_out;
 	}
+	vectors = rc;
 
 	/* Log MSI-X vector assignment */
 	for (index = 0; index < vectors; index++)
@@ -8764,9 +8764,10 @@ cfg_fail_out:
 			 &phba->sli4_hba.fcp_eq_hdl[index]);
 	}
 
-msi_fail_out:
 	/* Unconfigure MSI-X capability structure */
 	pci_disable_msix(phba->pcidev);
+
+msi_fail_out:
 	return rc;
 }
 
@@ -8804,7 +8805,7 @@ lpfc_sli4_disable_msix(struct lpfc_hba *
  * @phba: pointer to lpfc hba data structure.
  *
  * This routine is invoked to enable the MSI interrupt mode to device with
- * SLI-4 interface spec. The kernel function pci_enable_msi() is called
+ * SLI-4 interface spec. The kernel function pci_enable_msi_range() is called
  * to enable the MSI vector. The device driver is responsible for calling
  * the request_irq() to register MSI vector with a interrupt the handler,
  * which is done in this function.
@@ -8818,8 +8819,8 @@ lpfc_sli4_enable_msi(struct lpfc_hba *ph
 {
 	int rc, index;
 
-	rc = pci_enable_msi(phba->pcidev);
-	if (!rc)
+	rc = pci_enable_msi_range(phba->pcidev, 1, 1);
+	if (rc > 0)
 		lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
 				"0487 PCI enable MSI mode success.\n");
 	else {



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

* Re: [PATCH 12/22] lpfc: Use pci_enable_msix_range()
  2014-02-20 16:47 [PATCH 12/22] lpfc: Use pci_enable_msix_range() James Smart
@ 2014-02-23 19:45 ` Alexander Gordeev
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Gordeev @ 2014-02-23 19:45 UTC (permalink / raw)
  To: James Smart; +Cc: linux-scsi, linux-pci, linux-kernel

On Thu, Feb 20, 2014 at 11:47:02AM -0500, James Smart wrote:
> Alexander,
> 
> I've reworked this patch to layer on top of our rev 8.3.45 patches
> that were just posted to linux-scsi. There were some conflicts due to
> new additions.  Additionally, there were two other uses of pci_enable_msiXXX
> that needed to be addressed.  The changes in this patch also address the
> change requested by:
> "[PATCH 11/22] lpfc: Remove superfluous call to pci_disable_msix()"
> 
> To avoid creating merge conflicts - either by your patches going in then
> scsi git tree trying to merge or by scsi git tree going in and your patches
> trying to merge - I recommend that you eliminate your lpfc patches from the
> kernel and apply the patch below once scsi git with the updated lpfc driver
> has actually merged.

Hi James,

Thank you for the review and for the updated patch - it is embarrassing 
I have not addressed all pci_enable_msix()'s.

I will keep the two patches separate to ease bisecting -
I am going to repost the patches on top of scsi tree.

Cheers!

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

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

end of thread, other threads:[~2014-02-23 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 16:47 [PATCH 12/22] lpfc: Use pci_enable_msix_range() James Smart
2014-02-23 19:45 ` Alexander Gordeev
  -- strict thread matches above, loose matches on Subject: below --
2014-02-04 11:16 [PATCH 00/22] scsi: " Alexander Gordeev
2014-02-04 11:16 ` [PATCH 12/22] lpfc: " Alexander Gordeev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).