Re: [PATCH 01/17] lpfc: Use new pci_alloc_irq_vectors() interface

2017-01-18 Thread James Smart


On 1/18/2017 8:54 AM, Christoph Hellwig wrote:

On Tue, Jan 17, 2017 at 05:20:44PM -0800, James Smart wrote:

Move to new pci_alloc_irq_vectors() interface for intx/msi/msix

Note: io channel paradigm remains, for now.

Not exactly a well written changelog.  I'd like to know why this is
better than my version here:

http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/lpfc-msix

It also seems to be missing the post_vectors setting for the
Flash Optimized Fabric interrupt, which may lead to an incorrect
vector assignment for all the queues.


well, my intent was to post what we've been testing for a while. Then we 
would look at your mods, the remaining blk-mq mods from Hannes, and 
re-evalute the io channel thing and see where we end up.   This patch 
was just an initial convert to new api change, with the real mods to 
queing and adapter configuration following in the initiator basemods 
patches (a..f). I know your mods did more than the simple api change.


thanks for the post_vectors pickup.

-- james

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/17] lpfc: Use new pci_alloc_irq_vectors() interface

2017-01-18 Thread Christoph Hellwig
On Tue, Jan 17, 2017 at 05:20:44PM -0800, James Smart wrote:
> 
> Move to new pci_alloc_irq_vectors() interface for intx/msi/msix
> 
> Note: io channel paradigm remains, for now.

Not exactly a well written changelog.  I'd like to know why this is
better than my version here:

http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/lpfc-msix

It also seems to be missing the post_vectors setting for the
Flash Optimized Fabric interrupt, which may lead to an incorrect
vector assignment for all the queues.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/17] lpfc: Use new pci_alloc_irq_vectors() interface

2017-01-17 Thread Hannes Reinecke
On 01/18/2017 02:20 AM, James Smart wrote:
> 
> Move to new pci_alloc_irq_vectors() interface for intx/msi/msix
> 
> Note: io channel paradigm remains, for now.
> 
> Signed-off-by: Dick Kennedy 
> Signed-off-by: James Smart 
> ---
>  drivers/scsi/lpfc/lpfc_init.c | 227 
> --
>  1 file changed, 154 insertions(+), 73 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@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)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/17] lpfc: Use new pci_alloc_irq_vectors() interface

2017-01-17 Thread James Smart

Move to new pci_alloc_irq_vectors() interface for intx/msi/msix

Note: io channel paradigm remains, for now.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_init.c | 227 --
 1 file changed, 154 insertions(+), 73 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 4776fd8..7a17bd0 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8485,16 +8485,14 @@ lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba)
  * @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_exact()
- * is called to enable the MSI-X vectors. Note that pci_enable_msix_exact(),
- * once invoked, enables either all or nothing, depending on the current
- * availability of PCI vector resources. The device driver is responsible
+ * with SLI-3 interface specs. The kernel function pci_alloc_irq_vectors()
+ * is called to enable the MSI-X vectors. The device driver is responsible
  * for calling the individual request_irq() to register each MSI-X vector
  * with a interrupt handler, which is done in this function. Note that
  * later when device is unloading, the driver should always call free_irq()
  * on all MSI-X vectors it has done request_irq() on before calling
- * pci_disable_msix(). Failure to do so results in a BUG_ON() and a device
- * will be left with MSI-X enabled and leaks its vectors.
+ * pci_free_irq_vectors(). Failure to do so results in a BUG_ON() and a
+ * device will be left with MSI-X enabled and leaks its vectors.
  *
  * Return codes
  *   0 - successful
@@ -8503,21 +8501,33 @@ lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba)
 static int
 lpfc_sli_enable_msix(struct lpfc_hba *phba)
 {
-   int rc, i;
+   int vectors, rc, i;
LPFC_MBOXQ_t *pmb;
+   unsigned int irq_flags;
+   uint32_t min_cnt;
 
/* Set up MSI-X multi-message vectors */
for (i = 0; i < LPFC_MSIX_VECTORS; i++)
phba->msix_entries[i].entry = i;
 
/* Configure MSI-X capability structure */
-   rc = pci_enable_msix_exact(phba->pcidev, phba->msix_entries,
-  LPFC_MSIX_VECTORS);
-   if (rc) {
+   /* Allocate explicitly LPFC_MSIX_VECTORS number of vectors */
+   min_cnt = LPFC_MSIX_VECTORS;
+   irq_flags = PCI_IRQ_MSIX;
+   vectors = pci_alloc_irq_vectors(phba->pcidev, min_cnt,
+   LPFC_MSIX_VECTORS, irq_flags);
+   if (vectors < 0) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-   "0420 PCI enable MSI-X failed (%d)\n", rc);
+   "0420 PCI enable MSI-X failed (%d)\n",
+   vectors);
+   rc = -1;
goto vec_fail_out;
}
+
+   /* Complete the MSIX vector setup. */
+   for (i = 0; i < LPFC_MSIX_VECTORS; i++)
+   phba->msix_entries[i].vector = pci_irq_vector(phba->pcidev, i);
+
for (i = 0; i < LPFC_MSIX_VECTORS; i++)
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
"0477 MSI-X entry[%d]: vector=x%x "
@@ -8593,7 +8603,7 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
 
 msi_fail_out:
/* Unconfigure MSI-X capability structure */
-   pci_disable_msix(phba->pcidev);
+   pci_free_irq_vectors(phba->pcidev);
 
 vec_fail_out:
return rc;
@@ -8615,7 +8625,7 @@ lpfc_sli_disable_msix(struct lpfc_hba *phba)
for (i = 0; i < LPFC_MSIX_VECTORS; i++)
free_irq(phba->msix_entries[i].vector, phba);
/* Disable MSI-X */
-   pci_disable_msix(phba->pcidev);
+   pci_free_irq_vectors(phba->pcidev);
 
return;
 }
@@ -8625,10 +8635,10 @@ 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
- * request_irq() to register MSI vector with a interrupt the handler, which
- * is done in this function.
+ * SLI-3 interface spec. The kernel function pci_alloc_irq_vectors() 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.
  *
  * Return codes
  * 0 - successful
@@ -8637,10 +8647,18 @@ lpfc_sli_disable_msix(struct lpfc_hba *phba)
 static int
 lpfc_sli_enable_msi(struct lpfc_hba *phba)
 {
-   int rc;
+   int vector, rc;
+   unsigned int irq_flags;
+
+   /* The adapter supports all these modes and wants the irq affinity.
+*