Re: [PATCH] be2iscsi: switch to pci_alloc_irq_vectors

2017-03-30 Thread Martin K. Petersen
Christoph Hellwig  writes:

> Any progress on that? I'd like to get be2iscsi off the old MSI-X API
> for 4.12.

Applied to 4.12/scsi-queue.

-- 
Martin K. Petersen  Oracle Linux Engineering


RE: [PATCH] be2iscsi: switch to pci_alloc_irq_vectors

2017-03-30 Thread Jitendra Bhivare
> -Original Message-
> From: Christoph Hellwig [mailto:h...@lst.de]
> Sent: Friday, January 13, 2017 10:00 PM
> To: subbu.seethara...@broadcom.com; ketan.muka...@broadcom.com;
> jitendra.bhiv...@broadcom.com; linux-scsi@vger.kernel.org
> Subject: [PATCH] be2iscsi: switch to pci_alloc_irq_vectors
>
> And get automatic MSI-X affinity for free.
>
> Signed-off-by: Christoph Hellwig 
> ---
>  drivers/scsi/be2iscsi/be_main.c | 127
+---
>  drivers/scsi/be2iscsi/be_main.h |   2 -
>  2 files changed, 42 insertions(+), 87 deletions(-)
>
> diff --git a/drivers/scsi/be2iscsi/be_main.c
b/drivers/scsi/be2iscsi/be_main.c
> index 6372613..03faca8 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -801,12 +801,12 @@ static int beiscsi_init_irqs(struct beiscsi_hba
> *phba)
>   struct pci_dev *pcidev = phba->pcidev;
>   struct hwi_controller *phwi_ctrlr;
>   struct hwi_context_memory *phwi_context;
> - int ret, msix_vec, i, j;
> + int ret, i, j;
>
>   phwi_ctrlr = phba->phwi_ctrlr;
>   phwi_context = phwi_ctrlr->phwi_ctxt;
>
> - if (phba->msix_enabled) {
> + if (pcidev->msix_enabled) {
>   for (i = 0; i < phba->num_cpus; i++) {
>   phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME,
>   GFP_KERNEL);
> @@ -817,9 +817,8 @@ static int beiscsi_init_irqs(struct beiscsi_hba
*phba)
>
>   sprintf(phba->msi_name[i], "beiscsi_%02x_%02x",
>   phba->shost->host_no, i);
> - msix_vec = phba->msix_entries[i].vector;
> - ret = request_irq(msix_vec, be_isr_msix, 0,
> -   phba->msi_name[i],
> + ret = request_irq(pci_irq_vector(pcidev, i),
> +   be_isr_msix, 0,
phba->msi_name[i],
> &phwi_context->be_eq[i]);
>   if (ret) {
>   beiscsi_log(phba, KERN_ERR,
> BEISCSI_LOG_INIT, @@ -837,9 +836,8 @@ static int
beiscsi_init_irqs(struct
> beiscsi_hba *phba)
>   }
>   sprintf(phba->msi_name[i], "beiscsi_mcc_%02x",
>   phba->shost->host_no);
> - msix_vec = phba->msix_entries[i].vector;
> - ret = request_irq(msix_vec, be_isr_mcc, 0, phba-
> >msi_name[i],
> -   &phwi_context->be_eq[i]);
> + ret = request_irq(pci_irq_vector(pcidev, i), be_isr_mcc,
0,
> +   phba->msi_name[i], &phwi_context-
> >be_eq[i]);
>   if (ret) {
>   beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT ,
>   "BM_%d : beiscsi_init_irqs-"
> @@ -861,9 +859,8 @@ static int beiscsi_init_irqs(struct beiscsi_hba
*phba)
>   return 0;
>  free_msix_irqs:
>   for (j = i - 1; j >= 0; j--) {
> + free_irq(pci_irq_vector(pcidev, i),
&phwi_context->be_eq[j]);
>   kfree(phba->msi_name[j]);
> - msix_vec = phba->msix_entries[j].vector;
> - free_irq(msix_vec, &phwi_context->be_eq[j]);
>   }
>   return ret;
>  }
> @@ -3039,7 +3036,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba
> *phba,
>   num_eq_pages = PAGES_REQUIRED(phba->params.num_eq_entries *
> \
> sizeof(struct be_eq_entry));
>
> - if (phba->msix_enabled)
> + if (phba->pcidev->msix_enabled)
>   eq_for_mcc = 1;
>   else
>   eq_for_mcc = 0;
> @@ -3549,7 +3546,7 @@ static int be_mcc_queues_create(struct
> beiscsi_hba *phba,
>   sizeof(struct be_mcc_compl)))
>   goto err;
>   /* Ask BE to create MCC compl queue; */
> - if (phba->msix_enabled) {
> + if (phba->pcidev->msix_enabled) {
>   if (beiscsi_cmd_cq_create(ctrl, cq, &phwi_context->be_eq
>[phba->num_cpus].q, false, true,
0))
>   goto mcc_cq_free;
> @@ -3580,42 +3577,35 @@ static int be_mcc_queues_create(struct
> beiscsi_hba *phba,
>   return -ENOMEM;
>  }
>
> -/**
> - * find_num_cpus()- Get the CPU online count
> - * @phba: ptr to priv structure
> - *
> - * CPU count is used for creating EQ.
> - **/
> -static void find_num_cpus(struct beiscsi_hba *phba)
> +static void be2iscsi_enable_msix(struct beiscsi_hb

Re: [PATCH] be2iscsi: switch to pci_alloc_irq_vectors

2017-03-30 Thread Christoph Hellwig
On Mon, Jan 23, 2017 at 09:41:45AM +0530, Jitendra Bhivare wrote:
> We will be taking this up along with some other changes in the same area.

Any progress on that? I'd like to get be2iscsi off the old MSI-X API
for 4.12.


RE: [PATCH] be2iscsi: switch to pci_alloc_irq_vectors

2017-01-22 Thread Jitendra Bhivare
> -Original Message-
> From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> Sent: Saturday, January 21, 2017 5:56 AM
> To: Christoph Hellwig
> Cc: subbu.seethara...@broadcom.com; ketan.muka...@broadcom.com;
> jitendra.bhiv...@broadcom.com; linux-scsi@vger.kernel.org
> Subject: Re: [PATCH] be2iscsi: switch to pci_alloc_irq_vectors
>
> >>>>> "Christoph" == Christoph Hellwig  writes:
>
> Christoph> And get automatic MSI-X affinity for free.
>
> Jitendra?
>
We will be taking this up along with some other changes in the same area.

Regards,

JB
--
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] be2iscsi: switch to pci_alloc_irq_vectors

2017-01-20 Thread Martin K. Petersen
> "Christoph" == Christoph Hellwig  writes:

Christoph> And get automatic MSI-X affinity for free.

Jitendra?

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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] be2iscsi: switch to pci_alloc_irq_vectors

2017-01-13 Thread Christoph Hellwig
And get automatic MSI-X affinity for free.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/be2iscsi/be_main.c | 127 +---
 drivers/scsi/be2iscsi/be_main.h |   2 -
 2 files changed, 42 insertions(+), 87 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 6372613..03faca8 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -801,12 +801,12 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
struct pci_dev *pcidev = phba->pcidev;
struct hwi_controller *phwi_ctrlr;
struct hwi_context_memory *phwi_context;
-   int ret, msix_vec, i, j;
+   int ret, i, j;
 
phwi_ctrlr = phba->phwi_ctrlr;
phwi_context = phwi_ctrlr->phwi_ctxt;
 
-   if (phba->msix_enabled) {
+   if (pcidev->msix_enabled) {
for (i = 0; i < phba->num_cpus; i++) {
phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME,
GFP_KERNEL);
@@ -817,9 +817,8 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
 
sprintf(phba->msi_name[i], "beiscsi_%02x_%02x",
phba->shost->host_no, i);
-   msix_vec = phba->msix_entries[i].vector;
-   ret = request_irq(msix_vec, be_isr_msix, 0,
- phba->msi_name[i],
+   ret = request_irq(pci_irq_vector(pcidev, i),
+ be_isr_msix, 0, phba->msi_name[i],
  &phwi_context->be_eq[i]);
if (ret) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
@@ -837,9 +836,8 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
}
sprintf(phba->msi_name[i], "beiscsi_mcc_%02x",
phba->shost->host_no);
-   msix_vec = phba->msix_entries[i].vector;
-   ret = request_irq(msix_vec, be_isr_mcc, 0, phba->msi_name[i],
- &phwi_context->be_eq[i]);
+   ret = request_irq(pci_irq_vector(pcidev, i), be_isr_mcc, 0,
+ phba->msi_name[i], &phwi_context->be_eq[i]);
if (ret) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT ,
"BM_%d : beiscsi_init_irqs-"
@@ -861,9 +859,8 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
return 0;
 free_msix_irqs:
for (j = i - 1; j >= 0; j--) {
+   free_irq(pci_irq_vector(pcidev, i), &phwi_context->be_eq[j]);
kfree(phba->msi_name[j]);
-   msix_vec = phba->msix_entries[j].vector;
-   free_irq(msix_vec, &phwi_context->be_eq[j]);
}
return ret;
 }
@@ -3039,7 +3036,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba,
num_eq_pages = PAGES_REQUIRED(phba->params.num_eq_entries * \
  sizeof(struct be_eq_entry));
 
-   if (phba->msix_enabled)
+   if (phba->pcidev->msix_enabled)
eq_for_mcc = 1;
else
eq_for_mcc = 0;
@@ -3549,7 +3546,7 @@ static int be_mcc_queues_create(struct beiscsi_hba *phba,
sizeof(struct be_mcc_compl)))
goto err;
/* Ask BE to create MCC compl queue; */
-   if (phba->msix_enabled) {
+   if (phba->pcidev->msix_enabled) {
if (beiscsi_cmd_cq_create(ctrl, cq, &phwi_context->be_eq
 [phba->num_cpus].q, false, true, 0))
goto mcc_cq_free;
@@ -3580,42 +3577,35 @@ static int be_mcc_queues_create(struct beiscsi_hba 
*phba,
return -ENOMEM;
 }
 
-/**
- * find_num_cpus()- Get the CPU online count
- * @phba: ptr to priv structure
- *
- * CPU count is used for creating EQ.
- **/
-static void find_num_cpus(struct beiscsi_hba *phba)
+static void be2iscsi_enable_msix(struct beiscsi_hba *phba)
 {
-   int  num_cpus = 0;
-
-   num_cpus = num_online_cpus();
+   int nvec = 1;
 
switch (phba->generation) {
case BE_GEN2:
case BE_GEN3:
-   phba->num_cpus = (num_cpus > BEISCSI_MAX_NUM_CPUS) ?
- BEISCSI_MAX_NUM_CPUS : num_cpus;
+   nvec = BEISCSI_MAX_NUM_CPUS + 1;
break;
case BE_GEN4:
-   /*
-* If eqid_count == 1 fall back to
-* INTX mechanism
-**/
-   if (phba->fw_config.eqid_count == 1) {
-   enable_msix = 0;
-   phba->num_cpus = 1;
-   return;
-   }
-
-   phba->num_cpus =
-   (num_cpus > (phba->fw_config.eqid_count - 1)) ?
-   (phba->fw_config.eqid_count -