Re: [PATCH v3 11/13] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-09-04 Thread Alexander Gordeev
On Mon, Aug 18, 2014 at 08:01:51AM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

James?

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v3 11/13] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-21 Thread Alexander Gordeev
On Thu, Aug 21, 2014 at 01:58:39PM +0200, Tomas Henzl wrote:
 my bad, this was already fixed in
 commit 029165acfa611a3a8838723f6978586ae35ff53d lpfc: Remove superfluous call 
 to pci_disable_msix()
 
 so patch looks good to me now

Many thanks for your reviews, Tomas!

 Reviewed-by: Tomas Henzl

Christoph, this patch was declined by James few times.
I think it needs his approval as well.

James?

Thanks!

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v3 00/13] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-20 Thread Alexander Gordeev
On Tue, Aug 19, 2014 at 10:00:47AM -0700, Christoph Hellwig wrote:
 Thanks,
 
 I've applied patches 1 to 7 to the drivers-for-3.18 branch.

Thanks, Christoph!

Not sure how to handle the rest, though. Chelsio driver has no
maintainers and none of be2iscsi, pmcraid and csiostor has been
reviewed for several months.

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v3 00/13] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
Hello,

This series is against 3.17-rc1. Patches 0-7 have been acked.
Patches 8-13 still need reviews and are resent without changes
except 'lpfc' which concerns latest James comments.

Thanks!

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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: James Smart james.sm...@emulex.com
Cc: Naresh Kumar Inna nar...@chelsio.com
Cc: Arvind Bhushan arvi...@chelsio.com
Cc: Jayamohan Kallickal jayamohan.kallic...@emulex.com
Cc: Chad Dupuis chad.dup...@qlogic.com
Cc: Tomas Henzl the...@redhat.com
Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
Cc: Sreekanth Reddy sreekanth.re...@lsi.com
Cc: Kashyap Desai kashyap.de...@avagotech.com
Cc: Neela Syam Kolli megaraidli...@lsi.com
Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: supp...@lsi.com
Cc: dl-mptfusionli...@lsi.com
Cc: qla2xxx-upstr...@qlogic.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org

Alexander Gordeev (13):
  hpsa: Fallback to MSI rather than to INTx if MSI-X failed
  hpsa: Use pci_enable_msix_range() instead of pci_enable_msix()
  megaraid: Fail resume if MSI-X re-initialization failed
  megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()
  mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
  mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
  qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()
  be2iscsi: Use pci_enable_msix_range()
  csiostor: Remove superfluous call to pci_disable_msix()
  csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()
  lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()
  pmcraid: Get rid of a redundant assignment
  pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()

 drivers/scsi/be2iscsi/be_main.c   |  6 ++---
 drivers/scsi/csiostor/csio_hw.h   |  2 +-
 drivers/scsi/csiostor/csio_isr.c  | 24 +++
 drivers/scsi/hpsa.c   | 28 ++
 drivers/scsi/lpfc/lpfc_init.c | 39 ++-
 drivers/scsi/megaraid/megaraid_sas_base.c | 24 ---
 drivers/scsi/mpt2sas/mpt2sas_base.c   |  6 ++---
 drivers/scsi/mpt3sas/mpt3sas_base.c   |  4 ++--
 drivers/scsi/pmcraid.c| 14 ++-
 drivers/scsi/qla2xxx/qla_isr.c| 27 +
 10 files changed, 70 insertions(+), 104 deletions(-)

-- 
1.9.3

--
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 v3 04/13] megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Acked-by: Kashyap Desai kashyap.de...@avagotech.com
Cc: Neela Syam Kolli megaraidli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++-
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index e4ffae5..a2f4d4f 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4103,17 +4103,11 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
 (unsigned int)num_online_cpus());
for (i = 0; i  instance-msix_vectors; i++)
instance-msixentry[i].entry = i;
-   i = pci_enable_msix(instance-pdev, instance-msixentry,
-   instance-msix_vectors);
-   if (i = 0) {
-   if (i) {
-   if (!pci_enable_msix(instance-pdev,
-instance-msixentry, i))
-   instance-msix_vectors = i;
-   else
-   instance-msix_vectors = 0;
-   }
-   } else
+   i = pci_enable_msix_range(instance-pdev, instance-msixentry,
+ 1, instance-msix_vectors);
+   if (i)
+   instance-msix_vectors = i;
+   else
instance-msix_vectors = 0;
 
dev_info(instance-pdev-dev, [scsi%d]: FW supports
@@ -5133,8 +5127,8 @@ megasas_resume(struct pci_dev *pdev)
 
/* Now re-enable MSI-X */
if (instance-msix_vectors 
-   pci_enable_msix(instance-pdev, instance-msixentry,
-   instance-msix_vectors))
+   pci_enable_msix_exact(instance-pdev, instance-msixentry,
+ instance-msix_vectors))
goto fail_reenable_msix;
 
switch (instance-pdev-device) {
-- 
1.9.3

--
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 v3 10/13] csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Naresh Kumar Inna nar...@chelsio.com
Cc: Arvind Bhushan arvi...@chelsio.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/csiostor/csio_hw.h  |  2 +-
 drivers/scsi/csiostor/csio_isr.c | 22 +-
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
index 49b1daa..5db2d85 100644
--- a/drivers/scsi/csiostor/csio_hw.h
+++ b/drivers/scsi/csiostor/csio_hw.h
@@ -94,7 +94,7 @@ enum {
 };
 
 struct csio_msix_entries {
-   unsigned short  vector; /* Vector assigned by pci_enable_msix */
+   unsigned short  vector; /* Assigned MSI-X vector */
void*dev_id;/* Priv object associated w/ this msix*/
chardesc[24];   /* Description of this vector */
 };
diff --git a/drivers/scsi/csiostor/csio_isr.c b/drivers/scsi/csiostor/csio_isr.c
index 91ba91d..a8c748a 100644
--- a/drivers/scsi/csiostor/csio_isr.c
+++ b/drivers/scsi/csiostor/csio_isr.c
@@ -499,7 +499,7 @@ csio_reduce_sqsets(struct csio_hw *hw, int cnt)
 static int
 csio_enable_msix(struct csio_hw *hw)
 {
-   int rv, i, j, k, n, min, cnt;
+   int i, j, k, n, min, cnt;
struct csio_msix_entries *entryp;
struct msix_entry *entries;
int extra = CSIO_EXTRA_VECS;
@@ -521,19 +521,15 @@ csio_enable_msix(struct csio_hw *hw)
 
csio_dbg(hw, FW supp #niq:%d, trying %d msix's\n, hw-cfg_niq, cnt);
 
-   while ((rv = pci_enable_msix(hw-pdev, entries, cnt)) = min)
-   cnt = rv;
-   if (!rv) {
-   if (cnt  (hw-num_sqsets + extra)) {
-   csio_dbg(hw, Reducing sqsets to %d\n, cnt - extra);
-   csio_reduce_sqsets(hw, cnt - extra);
-   }
-   } else {
-   if (rv  0)
-   csio_info(hw, Not using MSI-X, remainder:%d\n, rv);
-
+   cnt = pci_enable_msix_range(hw-pdev, entries, min, cnt);
+   if (cnt  0) {
kfree(entries);
-   return -ENOMEM;
+   return cnt;
+   }
+
+   if (cnt  (hw-num_sqsets + extra)) {
+   csio_dbg(hw, Reducing sqsets to %d\n, cnt - extra);
+   csio_reduce_sqsets(hw, cnt - extra);
}
 
/* Save off vectors */
-- 
1.9.3

--
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 v3 02/13] hpsa: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Acked-by: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/hpsa.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a9c4c9f..8c17c43 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6159,25 +6159,22 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
h-msix_vector = MAX_REPLY_QUEUES;
if (h-msix_vector  num_online_cpus())
h-msix_vector = num_online_cpus();
-   err = pci_enable_msix(h-pdev, hpsa_msix_entries,
- h-msix_vector);
-   if (err  0) {
+   err = pci_enable_msix_range(h-pdev, hpsa_msix_entries,
+   1, h-msix_vector);
+   if (err  0) {
+   dev_warn(h-pdev-dev, MSI-X init failed %d\n, err);
+   h-msix_vector = 0;
+   goto single_msi_mode;
+   } else if (err  h-msix_vector) {
dev_warn(h-pdev-dev, only %d MSI-X vectors 
   available\n, err);
-   h-msix_vector = err;
-   err = pci_enable_msix(h-pdev, hpsa_msix_entries,
- h-msix_vector);
-   }
-   if (!err) {
-   for (i = 0; i  h-msix_vector; i++)
-   h-intr[i] = hpsa_msix_entries[i].vector;
-   return;
-   } else {
-   dev_warn(h-pdev-dev, MSI-X init failed %d\n,
-  err);
-   h-msix_vector = 0;
}
+   h-msix_vector = err;
+   for (i = 0; i  h-msix_vector; i++)
+   h-intr[i] = hpsa_msix_entries[i].vector;
+   return;
}
+single_msi_mode:
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
dev_info(h-pdev-dev, MSI\n);
if (!pci_enable_msi(h-pdev))
-- 
1.9.3

--
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 v3 13/13] pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pmcraid.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 6e575ed..bcb64eb 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4698,19 +4698,10 @@ pmcraid_register_interrupt_handler(struct 
pmcraid_instance *pinstance)
for (i = 0; i  PMCRAID_NUM_MSIX_VECTORS; i++)
entries[i].entry = i;
 
-   rc = pci_enable_msix(pdev, entries, num_hrrq);
-   if (rc  0)
+   num_hrrq = pci_enable_msix_range(pdev, entries, 1, num_hrrq);
+   if (num_hrrq  0)
goto pmcraid_isr_legacy;
 
-   /* Check how many MSIX vectors are allocated and register
-* msi-x handlers for each of them giving appropriate buffer
-*/
-   if (rc  0) {
-   num_hrrq = rc;
-   if (pci_enable_msix(pdev, entries, num_hrrq))
-   goto pmcraid_isr_legacy;
-   }
-
for (i = 0; i  num_hrrq; i++) {
pinstance-hrrq_vector[i].hrrq_id = i;
pinstance-hrrq_vector[i].drv_inst = pinstance;
-- 
1.9.3

--
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 v3 05/13] mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Reviewed-by: Tomas Henzl the...@redhat.com
Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
Cc: Sreekanth Reddy sreekanth.re...@lsi.com
Cc: supp...@lsi.com
Cc: dl-mptfusionli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/mpt2sas/mpt2sas_base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 2f262be..cf51b48 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1414,10 +1414,10 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
for (i = 0, a = entries; i  ioc-reply_queue_count; i++, a++)
a-entry = i;
 
-   r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count);
+   r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count);
if (r) {
-   dfailprintk(ioc, printk(MPT2SAS_INFO_FMT pci_enable_msix 
-   failed (r=%d) !!!\n, ioc-name, r));
+   dfailprintk(ioc, printk(MPT2SAS_INFO_FMT
+   pci_enable_msix_exact failed (r=%d) !!!\n, ioc-name, r));
kfree(entries);
goto try_ioapic;
}
-- 
1.9.3

--
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 v3 09/13] csiostor: Remove superfluous call to pci_disable_msix()

2014-08-18 Thread Alexander Gordeev
There is no need to call pci_disable_msix() in case
the previous call to pci_enable_msix() failed

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Naresh Kumar Inna nar...@chelsio.com
Cc: Arvind Bhushan arvi...@chelsio.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/csiostor/csio_isr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_isr.c b/drivers/scsi/csiostor/csio_isr.c
index 7ee9777..91ba91d 100644
--- a/drivers/scsi/csiostor/csio_isr.c
+++ b/drivers/scsi/csiostor/csio_isr.c
@@ -529,10 +529,8 @@ csio_enable_msix(struct csio_hw *hw)
csio_reduce_sqsets(hw, cnt - extra);
}
} else {
-   if (rv  0) {
-   pci_disable_msix(hw-pdev);
+   if (rv  0)
csio_info(hw, Not using MSI-X, remainder:%d\n, rv);
-   }
 
kfree(entries);
return -ENOMEM;
-- 
1.9.3

--
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 v3 07/13] qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Log message code 0x00c6 preserved, although it is reported
after successful call to pci_enable_msix_range(), not before
possibly unsuccessful call to pci_enable_msix(). Consumers
of the error code should not notice the difference.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Acked-by: Chad Dupuis chad.dup...@qlogic.com
Cc: qla2xxx-upstr...@qlogic.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/qla2xxx/qla_isr.c | 27 +++
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 550a4a3..a485578 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2923,27 +2923,22 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
for (i = 0; i  ha-msix_count; i++)
entries[i].entry = i;
 
-   ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
-   if (ret) {
-   if (ret  MIN_MSIX_COUNT)
-   goto msix_failed;
-
+   ret = pci_enable_msix_range(ha-pdev,
+   entries, MIN_MSIX_COUNT, ha-msix_count);
+   if (ret  0) {
+   ql_log(ql_log_fatal, vha, 0x00c7,
+   MSI-X: Failed to enable support, 
+   giving   up -- %d/%d.\n,
+   ha-msix_count, ret);
+   goto msix_out;
+   } else if (ret  ha-msix_count) {
ql_log(ql_log_warn, vha, 0x00c6,
MSI-X: Failed to enable support 
-- %d/%d\n Retry with %d vectors.\n,
ha-msix_count, ret, ret);
-   ha-msix_count = ret;
-   ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
-   if (ret) {
-msix_failed:
-   ql_log(ql_log_fatal, vha, 0x00c7,
-   MSI-X: Failed to enable support, 
-   giving   up -- %d/%d.\n,
-   ha-msix_count, ret);
-   goto msix_out;
-   }
-   ha-max_rsp_queues = ha-msix_count - 1;
}
+   ha-msix_count = ret;
+   ha-max_rsp_queues = ha-msix_count - 1;
ha-msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
ha-msix_count, GFP_KERNEL);
if (!ha-msix_entries) {
-- 
1.9.3

--
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 v3 08/13] be2iscsi: Use pci_enable_msix_range()

2014-08-18 Thread Alexander Gordeev
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 agord...@redhat.com
Cc: Jayamohan Kallickal jayamohan.kallic...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/be2iscsi/be_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 915c26b..b422659 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5276,9 +5276,9 @@ static void beiscsi_msix_enable(struct beiscsi_hba *phba)
for (i = 0; i = phba-num_cpus; i++)
phba-msix_entries[i].entry = i;
 
-   status = pci_enable_msix(phba-pcidev, phba-msix_entries,
-(phba-num_cpus + 1));
-   if (!status)
+   status = pci_enable_msix_range(phba-pcidev, phba-msix_entries,
+  phba-num_cpus + 1, phba-num_cpus + 1);
+   if (status  0)
phba-msix_enabled = true;
 
return;
-- 
1.9.3

--
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 v3 03/13] megaraid: Fail resume if MSI-X re-initialization failed

2014-08-18 Thread Alexander Gordeev
Currently the driver fails to analize MSI-X re-enablement
status on resuming and always assumes the success. This
update checks the MSI-X initialization result and fails
to resume if MSI-Xs re-enablement failed.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Acked-by: Kashyap Desai kashyap.de...@avagotech.com
Cc: Neela Syam Kolli megaraidli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 22a04e3..e4ffae5 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5132,9 +5132,10 @@ megasas_resume(struct pci_dev *pdev)
goto fail_ready_state;
 
/* Now re-enable MSI-X */
-   if (instance-msix_vectors)
-   pci_enable_msix(instance-pdev, instance-msixentry,
-   instance-msix_vectors);
+   if (instance-msix_vectors 
+   pci_enable_msix(instance-pdev, instance-msixentry,
+   instance-msix_vectors))
+   goto fail_reenable_msix;
 
switch (instance-pdev-device) {
case PCI_DEVICE_ID_LSI_FUSION:
@@ -5243,6 +5244,7 @@ fail_init_mfi:
 
 fail_set_dma_mask:
 fail_ready_state:
+fail_reenable_msix:
 
pci_disable_device(pdev);
 
-- 
1.9.3

--
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 v3 12/13] pmcraid: Get rid of a redundant assignment

2014-08-18 Thread Alexander Gordeev
Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pmcraid.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 6f3275d..6e575ed 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4746,7 +4746,6 @@ pmcraid_isr_legacy:
pinstance-hrrq_vector[0].drv_inst = pinstance;
pinstance-hrrq_vector[0].vector = pdev-irq;
pinstance-num_hrrq = 1;
-   rc = 0;
 
rc = request_irq(pdev-irq, pmcraid_isr, IRQF_SHARED,
 PMCRAID_DRIVER_NAME, pinstance-hrrq_vector[0]);
-- 
1.9.3

--
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 v3 06/13] mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Reviewed-by: Tomas Henzl the...@redhat.com
Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
Cc: Sreekanth Reddy sreekanth.re...@lsi.com
Cc: supp...@lsi.com
Cc: dl-mptfusionli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 93ce2b2..09e6b21 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1716,10 +1716,10 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
for (i = 0, a = entries; i  ioc-reply_queue_count; i++, a++)
a-entry = i;
 
-   r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count);
+   r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count);
if (r) {
dfailprintk(ioc, pr_info(MPT3SAS_FMT
-   pci_enable_msix failed (r=%d) !!!\n,
+   pci_enable_msix_exact failed (r=%d) !!!\n,
ioc-name, r));
kfree(entries);
goto try_ioapic;
-- 
1.9.3

--
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 v3 11/13] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-18 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: James Smart james.sm...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/lpfc/lpfc_init.c | 39 +--
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a5769a9..37f2a20 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8211,9 +8211,9 @@ 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() is
- * called to enable the MSI-X vectors. Note that pci_enable_msix(), once
- * invoked, enables either all or nothing, depending on the current
+ * 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
  * for calling the individual request_irq() to register each MSI-X vector
  * with a interrupt handler, which is done in this function. Note that
@@ -8237,8 +8237,8 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
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));
+   rc = pci_enable_msix_exact(phba-pcidev, phba-msix_entries,
+  LPFC_MSIX_VECTORS);
if (rc) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
0420 PCI enable MSI-X failed (%d)\n, rc);
@@ -8775,16 +8775,14 @@ out:
  * @phba: pointer to lpfc hba data structure.
  *
  * This routine is invoked to enable the MSI-X interrupt vectors to device
- * with SLI-4 interface spec. The kernel function pci_enable_msix() is called
- * to enable the MSI-X vectors. Note that pci_enable_msix(), 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 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.
+ * with SLI-4 interface spec. The kernel function pci_enable_msix_range()
+ * 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.
  *
  * Return codes
  * 0 - successful
@@ -8805,17 +8803,14 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
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 vec_fail_out;
}
+   vectors = rc;
 
/* Log MSI-X vector assignment */
for (index = 0; index  vectors; index++)
-- 
1.9.3

--
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 v3 01/13] hpsa: Fallback to MSI rather than to INTx if MSI-X failed

2014-08-18 Thread Alexander Gordeev
Currently the driver falls back to INTx mode when MSI-X
initialization failed. This is a suboptimal behaviour
for chips that also support MSI. This update changes that
behaviour and falls back to MSI mode in case MSI-X mode
initialization failed.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Acked-by: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/hpsa.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 6b35d0d..a9c4c9f 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6176,7 +6176,6 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
dev_warn(h-pdev-dev, MSI-X init failed %d\n,
   err);
h-msix_vector = 0;
-   goto default_int_mode;
}
}
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
-- 
1.9.3

--
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 v2 RESEND 08/23] hpsa: Fallback to MSI rather than to INTx if MSI-X failed

2014-08-13 Thread Alexander Gordeev
On Wed, Aug 13, 2014 at 11:04:54AM -0500, scame...@beardog.cce.hp.com wrote:
 On Wed, Jul 16, 2014 at 08:05:12PM +0200, Alexander Gordeev wrote:
  Currently the driver falls back to INTx mode when MSI-X
  initialization failed. This is a suboptimal behaviour
  for chips that also support MSI. This update changes that
  behaviour and falls back to MSI mode in case MSI-X mode
  initialization failed.
  
  Signed-off-by: Alexander Gordeev agord...@redhat.com
  Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
  Cc: iss_storage...@hp.com
  Cc: linux-scsi@vger.kernel.org
  Cc: linux-...@vger.kernel.org
  ---
   drivers/scsi/hpsa.c |1 -
   1 files changed, 0 insertions(+), 1 deletions(-)
  
  diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
  index 31184b3..648dec2 100644
  --- a/drivers/scsi/hpsa.c
  +++ b/drivers/scsi/hpsa.c
  @@ -6177,7 +6177,6 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
  dev_warn(h-pdev-dev, MSI-X init failed %d\n,
 err);
  h-msix_vector = 0;
  -   goto default_int_mode;
  }
  }
  if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
  -- 
  1.7.7.6
 
 Ack.
 
 Sorry for the slow reply, this got lost in the tornadic maelstrom
 I call my inbox.
 
 I also tested this with a Smart Array P420, P420i, and P430 in
 the system by ifdef'ing out the code for MSI-X and setting
 h-msix_vector = 0, to force it down the MSI path, and that all
 appears to work. 

Thank you, Steve!
If your Ack apply to 08/23 or to 09/23 as well?

 -- steve
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 12/23] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-12 Thread Alexander Gordeev
On Mon, Aug 11, 2014 at 01:14:54PM -0400, James Smart wrote:
 Alexander,
 
 I haven't looked too deeply, but it's clear it doesn't jive with what we've
 discussed in the past. Your original patches missed several other similar
 sections for revision. I had sent a revised set of patches.
 
 I was also unclear as to the merge path the patches were taking, as it was
 mod'ing areas that have already changed in the scsi misc tree, but the misc
 tree didn' have the pci mods.  I take it this is heading to Christoph's tree
 ?  and that it has picked up the pci mods ?

James,

I lost the context and not sure what PCI modifications you are referring :(
I will send a patch that combines your version shortly.

Thanks!

 -- james s

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v3 12/23] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-12 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: James Smart james.sm...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/lpfc/lpfc_init.c | 39 +--
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a5769a9..37f2a20 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8211,9 +8211,9 @@ 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() is
- * called to enable the MSI-X vectors. Note that pci_enable_msix(), once
- * invoked, enables either all or nothing, depending on the current
+ * 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
  * for calling the individual request_irq() to register each MSI-X vector
  * with a interrupt handler, which is done in this function. Note that
@@ -8237,8 +8237,8 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
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));
+   rc = pci_enable_msix_exact(phba-pcidev, phba-msix_entries,
+  LPFC_MSIX_VECTORS);
if (rc) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
0420 PCI enable MSI-X failed (%d)\n, rc);
@@ -8775,16 +8775,14 @@ out:
  * @phba: pointer to lpfc hba data structure.
  *
  * This routine is invoked to enable the MSI-X interrupt vectors to device
- * with SLI-4 interface spec. The kernel function pci_enable_msix() is called
- * to enable the MSI-X vectors. Note that pci_enable_msix(), 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 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.
+ * with SLI-4 interface spec. The kernel function pci_enable_msix_range()
+ * 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.
  *
  * Return codes
  * 0 - successful
@@ -8805,17 +8803,14 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
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 vec_fail_out;
}
+   vectors = rc;
 
/* Log MSI-X vector assignment */
for (index = 0; index  vectors; index++)
-- 
1.9.3

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 04/23] bfa: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-08-12 Thread Alexander Gordeev
On Mon, Aug 11, 2014 at 11:02:56AM +, Anil Gurumurthy wrote:
 Acked-by: Anil Gurumurthy anil.gurumur...@qlogic.com

Many thanks, Anil!

If your Ack apply to this patch only or to all three
'bfa' patches in this series?

Thanks!

 -Original Message-
 From: Alexander Gordeev [mailto:agord...@redhat.com] 
 Sent: 11 August 2014 13:09
 To: linux-kernel
 Cc: Anil Gurumurthy; Vijaya Mohan Guvva; linux-scsi; linux-pci; Anil 
 Gurumurthy; Sudarsana Kalluru
 Subject: Re: [PATCH v2 RESEND 04/23] bfa: Use pci_enable_msix_exact() instead 
 of pci_enable_msix()
 
 On Wed, Jul 16, 2014 at 08:05:08PM +0200, Alexander Gordeev wrote:
  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()  or pci_enable_msi_exact() and 
  pci_enable_msix_range() or pci_enable_msix_exact() interfaces.
 
 Anil, Sudarsana,
 
 Could you please review bfa patches in this series?
 
 Thanks!
 
  Signed-off-by: Alexander Gordeev agord...@redhat.com
  Cc: Anil Gurumurthy aguru...@brocade.com
  Cc: Vijaya Mohan Guvva vmo...@brocade.com
  Cc: linux-scsi@vger.kernel.org
  Cc: linux-...@vger.kernel.org
  Acked-by: Anil Gurumurthy anil.gurumur...@qlogic.com
  ---
   drivers/scsi/bfa/bfad.c |   20 ++--
   1 files changed, 6 insertions(+), 14 deletions(-)
  
  diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 
  c18279f..e90a374 100644
  --- a/drivers/scsi/bfa/bfad.c
  +++ b/drivers/scsi/bfa/bfad.c
  @@ -1234,29 +1234,21 @@ bfad_setup_intr(struct bfad_s *bfad)
  if ((bfa_asic_id_ctc(pdev-device)  !msix_disable_ct) ||
 (bfa_asic_id_cb(pdev-device)  !msix_disable_cb)) {
   
  -   error = pci_enable_msix(bfad-pcidev, msix_entries, bfad-nvec);
  +   error = pci_enable_msix_exact(bfad-pcidev,
  + msix_entries, bfad-nvec);
  /* In CT1  CT2, try to allocate just one vector */
  -   if (error  0  bfa_asic_id_ctc(pdev-device)) {
  +   if (error == -ENOSPC  bfa_asic_id_ctc(pdev-device)) {
  printk(KERN_WARNING bfa %s: trying one msix 
 vector failed to allocate %d[%d]\n,
 bfad-pci_name, bfad-nvec, error);
  bfad-nvec = 1;
  -   error = pci_enable_msix(bfad-pcidev,
  -   msix_entries, bfad-nvec);
  +   error = pci_enable_msix_exact(bfad-pcidev,
  + msix_entries, 1);
  }
   
  -   /*
  -* Only error number of vector is available.
  -* We don't have a mechanism to map multiple
  -* interrupts into one vector, so even if we
  -* can try to request less vectors, we don't
  -* know how to associate interrupt events to
  -*  vectors. Linux doesn't duplicate vectors
  -* in the MSIX table for this case.
  -*/
  if (error) {
  printk(KERN_WARNING bfad%d: 
  -  pci_enable_msix failed (%d), 
  +  pci_enable_msix_exact failed (%d), 
 use line based.\n,
  bfad-inst_no, error);
  goto line_based;
  --
  1.7.7.6
  

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 04/23] bfa: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-08-11 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:08PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Anil, Sudarsana,

Could you please review bfa patches in this series?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Anil Gurumurthy aguru...@brocade.com
 Cc: Vijaya Mohan Guvva vmo...@brocade.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 Acked-by: Anil Gurumurthy anil.gurumur...@qlogic.com
 ---
  drivers/scsi/bfa/bfad.c |   20 ++--
  1 files changed, 6 insertions(+), 14 deletions(-)
 
 diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
 index c18279f..e90a374 100644
 --- a/drivers/scsi/bfa/bfad.c
 +++ b/drivers/scsi/bfa/bfad.c
 @@ -1234,29 +1234,21 @@ bfad_setup_intr(struct bfad_s *bfad)
   if ((bfa_asic_id_ctc(pdev-device)  !msix_disable_ct) ||
  (bfa_asic_id_cb(pdev-device)  !msix_disable_cb)) {
  
 - error = pci_enable_msix(bfad-pcidev, msix_entries, bfad-nvec);
 + error = pci_enable_msix_exact(bfad-pcidev,
 +   msix_entries, bfad-nvec);
   /* In CT1  CT2, try to allocate just one vector */
 - if (error  0  bfa_asic_id_ctc(pdev-device)) {
 + if (error == -ENOSPC  bfa_asic_id_ctc(pdev-device)) {
   printk(KERN_WARNING bfa %s: trying one msix 
  vector failed to allocate %d[%d]\n,
  bfad-pci_name, bfad-nvec, error);
   bfad-nvec = 1;
 - error = pci_enable_msix(bfad-pcidev,
 - msix_entries, bfad-nvec);
 + error = pci_enable_msix_exact(bfad-pcidev,
 +   msix_entries, 1);
   }
  
 - /*
 -  * Only error number of vector is available.
 -  * We don't have a mechanism to map multiple
 -  * interrupts into one vector, so even if we
 -  * can try to request less vectors, we don't
 -  * know how to associate interrupt events to
 -  *  vectors. Linux doesn't duplicate vectors
 -  * in the MSIX table for this case.
 -  */
   if (error) {
   printk(KERN_WARNING bfad%d: 
 -pci_enable_msix failed (%d), 
 +pci_enable_msix_exact failed (%d), 
  use line based.\n,
   bfad-inst_no, error);
   goto line_based;
 -- 
 1.7.7.6
 
--
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 v2 RESEND 20/23] pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-11 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:24PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Hi Christoph,

This device's maintainer mail anil_ravindran...@pmc-sierra.com
does not seem exist anymore.

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/pmcraid.c |   13 ++---
  1 files changed, 2 insertions(+), 11 deletions(-)
 
 diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
 index c06af7f..6d0f208 100644
 --- a/drivers/scsi/pmcraid.c
 +++ b/drivers/scsi/pmcraid.c
 @@ -4698,19 +4698,10 @@ pmcraid_register_interrupt_handler(struct 
 pmcraid_instance *pinstance)
   for (i = 0; i  PMCRAID_NUM_MSIX_VECTORS; i++)
   entries[i].entry = i;
  
 - rc = pci_enable_msix(pdev, entries, num_hrrq);
 - if (rc  0)
 + num_hrrq = pci_enable_msix_range(pdev, entries, 1, num_hrrq);
 + if (num_hrrq  0)
   goto pmcraid_isr_legacy;
  
 - /* Check how many MSIX vectors are allocated and register
 -  * msi-x handlers for each of them giving appropriate buffer
 -  */
 - if (rc  0) {
 - num_hrrq = rc;
 - if (pci_enable_msix(pdev, entries, num_hrrq))
 - goto pmcraid_isr_legacy;
 - }
 -
   for (i = 0; i  num_hrrq; i++) {
   pinstance-hrrq_vector[i].hrrq_id = i;
   pinstance-hrrq_vector[i].drv_inst = pinstance;
 -- 
 1.7.7.6
 
--
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 v2 RESEND 08/23] hpsa: Fallback to MSI rather than to INTx if MSI-X failed

2014-08-11 Thread Alexander Gordeev
On Sat, Jul 26, 2014 at 09:16:47AM +0100, Alexander Gordeev wrote:
 On Wed, Jul 16, 2014 at 08:05:12PM +0200, Alexander Gordeev wrote:
  Currently the driver falls back to INTx mode when MSI-X
  initialization failed. This is a suboptimal behaviour
  for chips that also support MSI. This update changes that
  behaviour and falls back to MSI mode in case MSI-X mode
  initialization failed.
 
 Hi Stephen,
 
 Could you please reveiew hpsa patches in this series?

Stephen?

 Thanks!
 
  Signed-off-by: Alexander Gordeev agord...@redhat.com
  Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
  Cc: iss_storage...@hp.com
  Cc: linux-scsi@vger.kernel.org
  Cc: linux-...@vger.kernel.org
  ---
   drivers/scsi/hpsa.c |1 -
   1 files changed, 0 insertions(+), 1 deletions(-)
  
  diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
  index 31184b3..648dec2 100644
  --- a/drivers/scsi/hpsa.c
  +++ b/drivers/scsi/hpsa.c
  @@ -6177,7 +6177,6 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
  dev_warn(h-pdev-dev, MSI-X init failed %d\n,
 err);
  h-msix_vector = 0;
  -   goto default_int_mode;
  }
  }
  if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
  -- 
  1.7.7.6
  
 
 -- 
 Regards,
 Alexander Gordeev
 agord...@redhat.com
--
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 v2 RESEND 10/23] isci: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-08-11 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:14PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Artur, Dave,

Could you please review isci patches in this series?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Lukasz Dorau lukasz.do...@intel.com
 Cc: Maciej Patelczyk maciej.patelc...@intel.com
 Cc: Dave Jiang dave.ji...@intel.com
 Cc: intel-linux-...@intel.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 Acked-by: Artur Paszkiewicz artur.paszkiew...@intel.com
 ---
  drivers/scsi/isci/init.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
 index 695b34e..4198e45 100644
 --- a/drivers/scsi/isci/init.c
 +++ b/drivers/scsi/isci/init.c
 @@ -356,7 +356,7 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
   for (i = 0; i  num_msix; i++)
   pci_info-msix_entries[i].entry = i;
  
 - err = pci_enable_msix(pdev, pci_info-msix_entries, num_msix);
 + err = pci_enable_msix_exact(pdev, pci_info-msix_entries, num_msix);
   if (err)
   goto intx;
  
 -- 
 1.7.7.6
 
--
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 v2 RESEND 12/23] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-11 Thread Alexander Gordeev
On Sat, Jul 26, 2014 at 09:22:27AM +0100, Alexander Gordeev wrote:
 On Wed, Jul 16, 2014 at 08:05:16PM +0200, Alexander Gordeev wrote:
  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()  or pci_enable_msi_exact()
  and pci_enable_msix_range() or pci_enable_msix_exact()
  interfaces.
 
 Hi James,
 
 Could you please review this patch?

James?

 Thanks!
 
  Signed-off-by: Alexander Gordeev agord...@redhat.com
  Cc: James Smart james.sm...@emulex.com
  Cc: linux-scsi@vger.kernel.org
  Cc: linux-...@vger.kernel.org
  ---
   drivers/scsi/lpfc/lpfc_init.c |   38 +-
   1 files changed, 17 insertions(+), 21 deletions(-)
  
  diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
  index a5769a9..d9caed9 100644
  --- a/drivers/scsi/lpfc/lpfc_init.c
  +++ b/drivers/scsi/lpfc/lpfc_init.c
  @@ -8211,9 +8211,9 @@ 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() is
  - * called to enable the MSI-X vectors. Note that pci_enable_msix(), once
  - * invoked, enables either all or nothing, depending on the current
  + * 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
* for calling the individual request_irq() to register each MSI-X vector
* with a interrupt handler, which is done in this function. Note that
  @@ -8237,8 +8237,8 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
  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));
  +   rc = pci_enable_msix_exact(phba-pcidev, phba-msix_entries,
  +  ARRAY_SIZE(phba-msix_entries));
  if (rc) {
  lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
  0420 PCI enable MSI-X failed (%d)\n, rc);
  @@ -8775,15 +8775,13 @@ out:
* @phba: pointer to lpfc hba data structure.
*
* This routine is invoked to enable the MSI-X interrupt vectors to device
  - * with SLI-4 interface spec. The kernel function pci_enable_msix() is 
  called
  - * to enable the MSI-X vectors. Note that pci_enable_msix(), 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 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
  + * with SLI-4 interface spec. The kernel function pci_enable_msix_range()
  + * 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.
*
* Return codes
  @@ -8805,18 +8803,16 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
  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 vec_fail_out;
  }
   
  +   vectors = rc;
  /* Log MSI-X vector assignment */
  for (index = 0; index  vectors; index++)
  lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
  -- 
  1.7.7.6
  
 
 -- 
 Regards,
 Alexander Gordeev
 agord...@redhat.com
--
To unsubscribe from this list: send the line unsubscribe linux-scsi

Re: [PATCH v2 RESEND 13/23] megaraid: Fail resume if MSI-X re-initialization failed

2014-08-11 Thread Alexander Gordeev
On Mon, Jul 28, 2014 at 11:26:13AM +0530, Kashyap Desai wrote:
  -Original Message-
  From: Alexander Gordeev [mailto:agord...@redhat.com]
  Sent: Saturday, July 26, 2014 1:54 PM
  To: linux-ker...@vger.kernel.org; Neela Syam Kolli
  Subject: Re: [PATCH v2 RESEND 13/23] megaraid: Fail resume if MSI-X re-
  initialization failed
 
  On Wed, Jul 16, 2014 at 08:05:17PM +0200, Alexander Gordeev wrote:
   Currently the driver fails to analize MSI-X re-enablement status on
   resuming and always assumes the success. This update checks the MSI-X
   initialization result and fails to resume if MSI-Xs re-enablement
   failed.
 
  Hi Neela,
 
  Could you please review megaraid patches in this series?
 
  Thanks!
 Please consider this patch Acked by Me.
 
 Acked-by: Kashyap Desai kashyap.de...@avagotech.com

Christoph,

I guess, this patch could be picked?

 
   Signed-off-by: Alexander Gordeev agord...@redhat.com
   ---
drivers/scsi/megaraid/megaraid_sas_base.c |8 +---
1 files changed, 5 insertions(+), 3 deletions(-)
  
   diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
   b/drivers/scsi/megaraid/megaraid_sas_base.c
   index 112799b..ba06102 100644
   --- a/drivers/scsi/megaraid/megaraid_sas_base.c
   +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
   @@ -5134,9 +5134,10 @@ megasas_resume(struct pci_dev *pdev)
 goto fail_ready_state;
  
 /* Now re-enable MSI-X */
   - if (instance-msix_vectors)
   - pci_enable_msix(instance-pdev, instance-msixentry,
   - instance-msix_vectors);
   + if (instance-msix_vectors 
   + pci_enable_msix(instance-pdev, instance-msixentry,
   + instance-msix_vectors))
   + goto fail_reenable_msix;
  
 switch (instance-pdev-device) {
 case PCI_DEVICE_ID_LSI_FUSION:
   @@ -5245,6 +5246,7 @@ fail_init_mfi:
  
fail_set_dma_mask:
fail_ready_state:
   +fail_reenable_msix:
  
 pci_disable_device(pdev);
  
   --
   1.7.7.6
  
 
  --
  Regards,
  Alexander Gordeev
  agord...@redhat.com
--
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 v2 RESEND 14/23] megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-11 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:18PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Kashyap, Neela,

Could you please reveiw this patch?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Neela Syam Kolli megaraidli...@lsi.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/megaraid/megaraid_sas_base.c |   20 +++-
  1 files changed, 7 insertions(+), 13 deletions(-)
 
 diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
 b/drivers/scsi/megaraid/megaraid_sas_base.c
 index ba06102..7a4e75e 100644
 --- a/drivers/scsi/megaraid/megaraid_sas_base.c
 +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
 @@ -4105,17 +4105,11 @@ static int megasas_init_fw(struct megasas_instance 
 *instance)
(unsigned int)num_online_cpus());
   for (i = 0; i  instance-msix_vectors; i++)
   instance-msixentry[i].entry = i;
 - i = pci_enable_msix(instance-pdev, instance-msixentry,
 - instance-msix_vectors);
 - if (i = 0) {
 - if (i) {
 - if (!pci_enable_msix(instance-pdev,
 -  instance-msixentry, i))
 - instance-msix_vectors = i;
 - else
 - instance-msix_vectors = 0;
 - }
 - } else
 + i = pci_enable_msix_range(instance-pdev, instance-msixentry,
 +   1, instance-msix_vectors);
 + if (i)
 + instance-msix_vectors = i;
 + else
   instance-msix_vectors = 0;
  
   dev_info(instance-pdev-dev, [scsi%d]: FW supports
 @@ -5135,8 +5129,8 @@ megasas_resume(struct pci_dev *pdev)
  
   /* Now re-enable MSI-X */
   if (instance-msix_vectors 
 - pci_enable_msix(instance-pdev, instance-msixentry,
 - instance-msix_vectors))
 + pci_enable_msix_exact(instance-pdev, instance-msixentry,
 +   instance-msix_vectors))
   goto fail_reenable_msix;
  
   switch (instance-pdev-device) {
 -- 
 1.7.7.6
 
--
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 v2 RESEND 16/23] mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-08-11 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:20PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Hi Nagalakshmi, Praveen, Sreekanth and Abhijit,

Could you please review mpt2/mpt3 patches in this series?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
 Cc: Sreekanth Reddy sreekanth.re...@lsi.com
 Cc: supp...@lsi.com
 Cc: dl-mptfusionli...@lsi.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/mpt3sas/mpt3sas_base.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
 b/drivers/scsi/mpt3sas/mpt3sas_base.c
 index 0cf4f70..7b65ec2 100644
 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
 +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
 @@ -1747,10 +1747,10 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
   for (i = 0, a = entries; i  ioc-reply_queue_count; i++, a++)
   a-entry = i;
  
 - r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count);
 + r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count);
   if (r) {
   dfailprintk(ioc, pr_info(MPT3SAS_FMT
 - pci_enable_msix failed (r=%d) !!!\n,
 + pci_enable_msix_exact failed (r=%d) !!!\n,
   ioc-name, r));
   kfree(entries);
   goto try_ioapic;
 -- 
 1.7.7.6
 
--
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 v2 RESEND 17/23] pm8001: Fix invalid return when request_irq() failed

2014-08-11 Thread Alexander Gordeev
On Tue, Jul 29, 2014 at 07:24:03AM -0700, Christoph Hellwig wrote:
 On Tue, Jul 29, 2014 at 04:15:45PM +0200, Alexander Gordeev wrote:
  Hmm.. 18/23 applies with a minor fuzz against
  git://git.infradead.org/users/hch/scsi-queue.git drivers-for-3.17
 
 Okay, it was just git-am being goofy then.  I'll take care of it.
 

Anything I can help with?

--
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 v2 RESEND 22/23] qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-08-11 Thread Alexander Gordeev
On Mon, Jul 28, 2014 at 11:47:19AM +, Vikas Chaudhary wrote:
 
 Acked-By: Vikas Chaudhary vikas.chaudh...@qlogic.com

Christoph,

This patch seems ready..

 On 26/07/14 2:11 pm, Alexander Gordeev agord...@redhat.com wrote:
 
 On Wed, Jul 16, 2014 at 08:05:26PM +0200, Alexander Gordeev wrote:
  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()  or pci_enable_msi_exact()
  and pci_enable_msix_range() or pci_enable_msix_exact()
  interfaces.
 
 Hi Vikas,
 
 Could you please reveiw this patch?
 
 Thanks!
 
  Signed-off-by: Alexander Gordeev agord...@redhat.com
  Cc: Vikas Chaudhary vikas.chaudh...@qlogic.com
  Cc: iscsi-dri...@qlogic.com
  Cc: linux-scsi@vger.kernel.org
  Cc: linux-...@vger.kernel.org
  Acked-By: Vikas Chaudhary vikas.chaudh...@qlogic.com
  ---
   drivers/scsi/qla4xxx/ql4_nx.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
  
  diff --git a/drivers/scsi/qla4xxx/ql4_nx.c
 b/drivers/scsi/qla4xxx/ql4_nx.c
  index 9dbdb4b..7c33658 100644
  --- a/drivers/scsi/qla4xxx/ql4_nx.c
  +++ b/drivers/scsi/qla4xxx/ql4_nx.c
  @@ -4221,7 +4221,7 @@ qla4_8xxx_enable_msix(struct scsi_qla_host *ha)
 for (i = 0; i  QLA_MSIX_ENTRIES; i++)
 entries[i].entry = qla4_8xxx_msix_entries[i].entry;
   
  -  ret = pci_enable_msix(ha-pdev, entries, ARRAY_SIZE(entries));
  +  ret = pci_enable_msix_exact(ha-pdev, entries, ARRAY_SIZE(entries));
 if (ret) {
 ql4_printk(KERN_WARNING, ha,
 MSI-X: Failed to enable support -- %d/%d\n,
  -- 
  1.7.7.6
  
 
 -- 
 Regards,
 Alexander Gordeev
 agord...@redhat.com
 
--
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 v2 RESEND 21/23] qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-08-11 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:25PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.
 
 Log message code 0x00c6 preserved, although it is reported
 after successful call to pci_enable_msix_range(), not before
 possibly unsuccessful call to pci_enable_msix(). Consumers
 of the error code should not notice the difference.

Hello,

Please, anyone (from QLogic especially) review this patch.

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: qla2xxx-upstr...@qlogic.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/qla2xxx/qla_isr.c |   27 +++
  1 files changed, 11 insertions(+), 16 deletions(-)
 
 diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
 index a56825c..52d420f 100644
 --- a/drivers/scsi/qla2xxx/qla_isr.c
 +++ b/drivers/scsi/qla2xxx/qla_isr.c
 @@ -2923,27 +2923,22 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
 rsp_que *rsp)
   for (i = 0; i  ha-msix_count; i++)
   entries[i].entry = i;
  
 - ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
 - if (ret) {
 - if (ret  MIN_MSIX_COUNT)
 - goto msix_failed;
 -
 + ret = pci_enable_msix_range(ha-pdev,
 + entries, MIN_MSIX_COUNT, ha-msix_count);
 + if (ret  0) {
 + ql_log(ql_log_fatal, vha, 0x00c7,
 + MSI-X: Failed to enable support, 
 + giving   up -- %d/%d.\n,
 + ha-msix_count, ret);
 + goto msix_out;
 + } else if (ret  ha-msix_count) {
   ql_log(ql_log_warn, vha, 0x00c6,
   MSI-X: Failed to enable support 
   -- %d/%d\n Retry with %d vectors.\n,
   ha-msix_count, ret, ret);
 - ha-msix_count = ret;
 - ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
 - if (ret) {
 -msix_failed:
 - ql_log(ql_log_fatal, vha, 0x00c7,
 - MSI-X: Failed to enable support, 
 - giving   up -- %d/%d.\n,
 - ha-msix_count, ret);
 - goto msix_out;
 - }
 - ha-max_rsp_queues = ha-msix_count - 1;
   }
 + ha-msix_count = ret;
 + ha-max_rsp_queues = ha-msix_count - 1;
   ha-msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
   ha-msix_count, GFP_KERNEL);
   if (!ha-msix_entries) {
 -- 
 1.7.7.6
 
--
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 RFC 0/2] percpu_tags: Prototype implementation

2014-08-11 Thread Alexander Gordeev
On Fri, Jul 18, 2014 at 12:20:56PM +0200, Alexander Gordeev wrote:
 The performance test is not decent, though. I used fio random
 read against a null_blk device sitting on top of percpu_tags,
 which is not exactly how percpu_ida is used. This is another
 reason I am posting - an advice on how to properly test is very
 appreciated.

Hi Nicholas et al,

I expect the best possible performance test for percpu_ida/percpu_tags
would be to stress drivers/vhost/scsi.c vhost_scsi_get_tag() function.

I tried to make such test by attaching ramdisk to a virtual machine
(similar to https://lkml.org/lkml/2012/8/10/347) but ultimately failed
to configure the necessary environment - the stock qemu does not have
-vhost-scsi parameter.

Could you please advice how to make this configuration exposed to guests?

o- / . [...]
  o- backstores .. [...]
  | o- block .. [Storage Objects: 0]
  | o- fileio . [Storage Objects: 0]
  | o- pscsi .. [Storage Objects: 0]
  | o- ramdisk  [Storage Objects: 1]
  |   o- rda .. [(1.0GiB) activated]
  o- iscsi  [Targets: 0]
  o- loopback . [Targets: 0]
  o- vhost  [Targets: 1]
o- naa.5001405b171ee405 .. [TPGs: 1]
  o- tpg1 .. [naa.5001405983a5b1a4, no-gen-acls]
o- acls .. [ACLs: 0]
o- luns .. [LUNs: 1]
  o- lun0  [ramdisk/rda]

Thanks!
--
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 v1.3 2/18] arcmsr: Add code to support MSI-X, MSI interrupt

2014-08-01 Thread Alexander Gordeev
);
 + return ARC_FAILURE;
 + }
 + return ARC_SUCCESS;
 +}
 +
  static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
  {
   struct Scsi_Host *host;
 @@ -667,16 +721,13 @@ static int arcmsr_probe(struct pci_dev *
   if(error){
   goto free_hbb_mu;
   }
 - arcmsr_iop_init(acb);
   error = scsi_add_host(host, pdev-dev);
   if(error){
   goto RAID_controller_stop;
   }
 - error = request_irq(pdev-irq, arcmsr_do_interrupt, IRQF_SHARED, 
 arcmsr, acb);
 - if(error){
 + if (arcmsr_request_irq(pdev, acb) == ARC_FAILURE)
   goto scsi_host_remove;
 - }
 - host-irq = pdev-irq;
 + arcmsr_iop_init(acb);
   scsi_scan_host(host);
   INIT_WORK(acb-arcmsr_do_message_isr_bh, arcmsr_message_isr_bh_fn);
   atomic_set(acb-rq_map_token, 16);
 @@ -710,6 +761,21 @@ pci_disable_dev:
   return -ENODEV;
  }
  
 +static void arcmsr_free_irq(struct pci_dev *pdev, struct AdapterControlBlock 
 *acb)
 +{
 + int i;
 +
 + if (acb-acb_flags  ACB_F_MSI_ENABLED) {
 + free_irq(pdev-irq, acb);
 + pci_disable_msi(pdev);
 + } else if (acb-acb_flags  ACB_F_MSIX_ENABLED) {
 + for (i = 0; i  acb-msix_vector_count; i++)
 + free_irq(acb-entries[i].vector, acb);
 + pci_disable_msix(pdev);
 + } else
 + free_irq(pdev-irq, acb);
 +}
 +
  static uint8_t arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb)
  {
   struct MessageUnit_A __iomem *reg = acb-pmuA;
 @@ -992,6 +1058,7 @@ static void arcmsr_done4abort_postqueue(
   }
   }
  }
 +
  static void arcmsr_remove(struct pci_dev *pdev)
  {
   struct Scsi_Host *host = pci_get_drvdata(pdev);
 @@ -1029,7 +1096,7 @@ static void arcmsr_remove(struct pci_dev
   }
   }
   }
 - free_irq(pdev-irq, acb);
 + arcmsr_free_irq(pdev, acb);
   arcmsr_free_ccb_pool(acb);
   arcmsr_free_hbb_mu(acb);
   arcmsr_unmap_pciregion(acb);
 @@ -1045,6 +1112,7 @@ static void arcmsr_shutdown(struct pci_d
   (struct AdapterControlBlock *)host-hostdata;
   del_timer_sync(acb-eternal_timer);
   arcmsr_disable_outbound_ints(acb);
 + arcmsr_free_irq(pdev, acb);
   flush_work(acb-arcmsr_do_message_isr_bh);
   arcmsr_stop_adapter_bgrb(acb);
   arcmsr_flush_adapter_cache(acb);
 @@ -2516,8 +2584,6 @@ static int arcmsr_iop_confirm(struct Ada
   case ACB_ADAPTER_TYPE_A: {
   if (cdb_phyaddr_hi32 != 0) {
   struct MessageUnit_A __iomem *reg = acb-pmuA;
 - uint32_t intmask_org;
 - intmask_org = arcmsr_disable_outbound_ints(acb);
   writel(ARCMSR_SIGNATURE_SET_CONFIG, \
   reg-message_rwbuffer[0]);
   writel(cdb_phyaddr_hi32, reg-message_rwbuffer[1]);
 @@ -2529,7 +2595,6 @@ static int arcmsr_iop_confirm(struct Ada
   acb-host-host_no);
   return 1;
   }
 - arcmsr_enable_outbound_ints(acb, intmask_org);
   }
   }
   break;
 @@ -2539,8 +2604,6 @@ static int arcmsr_iop_confirm(struct Ada
   uint32_t __iomem *rwbuffer;
  
   struct MessageUnit_B *reg = acb-pmuB;
 - uint32_t intmask_org;
 - intmask_org = arcmsr_disable_outbound_ints(acb);
   reg-postq_index = 0;
   reg-doneq_index = 0;
   writel(ARCMSR_MESSAGE_SET_POST_WINDOW, reg-drv2iop_doorbell);
 @@ -2569,7 +2632,6 @@ static int arcmsr_iop_confirm(struct Ada
   return 1;
   }
   arcmsr_hbb_enable_driver_mode(acb);
 - arcmsr_enable_outbound_ints(acb, intmask_org);
   }
   break;
   case ACB_ADAPTER_TYPE_C: {
 
 

One general question. What is justification for replacing standard error
codes with ARC_ ones?

Thanks!

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 17/23] pm8001: Fix invalid return when request_irq() failed

2014-07-29 Thread Alexander Gordeev
On Tue, Jul 29, 2014 at 06:56:41AM -0700, Christoph Hellwig wrote:
 On Tue, Jul 29, 2014 at 03:48:29PM +0200, Tomas Henzl wrote:
  I'm a bit confused - you were not commenting my text above I think?
  
  I see in drivers-for-3.17 this patch already applied 5607de7
  but not yet the next one (18/23) which also has a review, is there another 
  ack needed?
 
 Looks like I got a bit confused due to a non-applying patch, but it
 seems like the one that failed was the second one.  I'll look at it time
 permitting, but if someone familar with pm8001 can fix the reject for me
 that would help me greatly!

Hmm.. 18/23 applies with a minor fuzz against
git://git.infradead.org/users/hch/scsi-queue.git drivers-for-3.17

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 05/23] csiostor: Remove superfluous call to pci_disable_msix()

2014-07-26 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:09PM +0200, Alexander Gordeev wrote:
 There is no need to call pci_disable_msix() in case
 the previous call to pci_enable_msix() failed

Hi Naresh, Arvind,

Could you please review csiostor patches in this series?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Naresh Kumar Inna nar...@chelsio.com
 Cc: Arvind Bhushan arvi...@chelsio.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/csiostor/csio_isr.c |4 +---
  1 files changed, 1 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/scsi/csiostor/csio_isr.c 
 b/drivers/scsi/csiostor/csio_isr.c
 index 7ee9777..91ba91d 100644
 --- a/drivers/scsi/csiostor/csio_isr.c
 +++ b/drivers/scsi/csiostor/csio_isr.c
 @@ -529,10 +529,8 @@ csio_enable_msix(struct csio_hw *hw)
   csio_reduce_sqsets(hw, cnt - extra);
   }
   } else {
 - if (rv  0) {
 - pci_disable_msix(hw-pdev);
 + if (rv  0)
   csio_info(hw, Not using MSI-X, remainder:%d\n, rv);
 - }
  
   kfree(entries);
   return -ENOMEM;
 -- 
 1.7.7.6
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 07/23] fnic: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-26 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:11PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Hi Hiral, Suma, Brian,

Could you please review this patch?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Hiral Patel hiral...@cisco.com
 Cc: Suma Ramars sram...@cisco.com
 Cc: Brian Uchino buch...@cisco.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/fnic/fnic_isr.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/scsi/fnic/fnic_isr.c b/drivers/scsi/fnic/fnic_isr.c
 index 7d9b54a..a0dd1b6 100644
 --- a/drivers/scsi/fnic/fnic_isr.c
 +++ b/drivers/scsi/fnic/fnic_isr.c
 @@ -257,8 +257,8 @@ int fnic_set_intr_mode(struct fnic *fnic)
   fnic-raw_wq_count = m 
   fnic-wq_copy_count = o 
   fnic-cq_count = n + m + o) {
 - if (!pci_enable_msix(fnic-pdev, fnic-msix_entry,
 - n + m + o + 1)) {
 + if (!pci_enable_msix_exact(fnic-pdev, fnic-msix_entry,
 +n + m + o + 1)) {
   fnic-rq_count = n;
   fnic-raw_wq_count = m;
   fnic-wq_copy_count = o;
 -- 
 1.7.7.6
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 12/23] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-26 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:16PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Hi James,

Could you please review this patch?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: James Smart james.sm...@emulex.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/lpfc/lpfc_init.c |   38 +-
  1 files changed, 17 insertions(+), 21 deletions(-)
 
 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
 index a5769a9..d9caed9 100644
 --- a/drivers/scsi/lpfc/lpfc_init.c
 +++ b/drivers/scsi/lpfc/lpfc_init.c
 @@ -8211,9 +8211,9 @@ 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() is
 - * called to enable the MSI-X vectors. Note that pci_enable_msix(), once
 - * invoked, enables either all or nothing, depending on the current
 + * 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
   * for calling the individual request_irq() to register each MSI-X vector
   * with a interrupt handler, which is done in this function. Note that
 @@ -8237,8 +8237,8 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
   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));
 + rc = pci_enable_msix_exact(phba-pcidev, phba-msix_entries,
 +ARRAY_SIZE(phba-msix_entries));
   if (rc) {
   lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
   0420 PCI enable MSI-X failed (%d)\n, rc);
 @@ -8775,15 +8775,13 @@ out:
   * @phba: pointer to lpfc hba data structure.
   *
   * This routine is invoked to enable the MSI-X interrupt vectors to device
 - * with SLI-4 interface spec. The kernel function pci_enable_msix() is called
 - * to enable the MSI-X vectors. Note that pci_enable_msix(), 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 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
 + * with SLI-4 interface spec. The kernel function pci_enable_msix_range()
 + * 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.
   *
   * Return codes
 @@ -8805,18 +8803,16 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
   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 vec_fail_out;
   }
  
 + vectors = rc;
   /* Log MSI-X vector assignment */
   for (index = 0; index  vectors; index++)
   lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
 -- 
 1.7.7.6
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 15/23] mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-26 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:19PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Hi Nagalakshmi, Sreekanth,

Could you please review mpt patches in this series?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
 Cc: Sreekanth Reddy sreekanth.re...@lsi.com
 Cc: supp...@lsi.com
 Cc: dl-mptfusionli...@lsi.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/mpt2sas/mpt2sas_base.c |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
 b/drivers/scsi/mpt2sas/mpt2sas_base.c
 index 8b88118..6aca369 100644
 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
 +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
 @@ -1432,10 +1432,10 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
   for (i = 0, a = entries; i  ioc-reply_queue_count; i++, a++)
   a-entry = i;
  
 - r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count);
 + r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count);
   if (r) {
 - dfailprintk(ioc, printk(MPT2SAS_INFO_FMT pci_enable_msix 
 - failed (r=%d) !!!\n, ioc-name, r));
 + dfailprintk(ioc, printk(MPT2SAS_INFO_FMT
 + pci_enable_msix_exact failed (r=%d) !!!\n, ioc-name, r));
   kfree(entries);
   goto try_ioapic;
   }
 -- 
 1.7.7.6
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 18/23] pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-26 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:22PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Hi Jack, Lindar,

Could you please review this patch?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: xjtu...@gmail.com
 Cc: lindar_...@usish.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/pm8001/pm8001_init.c |   39 
 +++--
  1 files changed, 20 insertions(+), 19 deletions(-)
 
 diff --git a/drivers/scsi/pm8001/pm8001_init.c 
 b/drivers/scsi/pm8001/pm8001_init.c
 index e837ece..4057c24 100644
 --- a/drivers/scsi/pm8001/pm8001_init.c
 +++ b/drivers/scsi/pm8001/pm8001_init.c
 @@ -729,34 +729,35 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info 
 *pm8001_ha)
   sizeof(pm8001_ha-msix_entries[0]);
   for (i = 0; i  max_entry ; i++)
   pm8001_ha-msix_entries[i].entry = i;
 - rc = pci_enable_msix(pm8001_ha-pdev, pm8001_ha-msix_entries,
 + rc = pci_enable_msix_exact(pm8001_ha-pdev, pm8001_ha-msix_entries,
   number_of_intr);
   pm8001_ha-number_of_intr = number_of_intr;
 - if (!rc) {
 - PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
 - pci_enable_msix request ret:%d no of intr %d\n,
 - rc, pm8001_ha-number_of_intr));
 + if (rc)
 + return rc;
  
 + PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
 + pci_enable_msix_exact request ret:%d no of intr %d\n,
 + rc, pm8001_ha-number_of_intr));
  
 - for (i = 0; i  number_of_intr; i++) {
 - snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
 - DRV_NAME%d, i);
 - pm8001_ha-irq_vector[i].irq_id = i;
 - pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
 + for (i = 0; i  number_of_intr; i++) {
 + snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
 + DRV_NAME%d, i);
 + pm8001_ha-irq_vector[i].irq_id = i;
 + pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
  
 - rc = request_irq(pm8001_ha-msix_entries[i].vector,
 - pm8001_interrupt_handler_msix, flag,
 - intr_drvname[i], (pm8001_ha-irq_vector[i]));
 - if (rc) {
 - for (j = 0; j  i; j++)
 - free_irq(
 - pm8001_ha-msix_entries[j].vector,
 + rc = request_irq(pm8001_ha-msix_entries[i].vector,
 + pm8001_interrupt_handler_msix, flag,
 + intr_drvname[i], (pm8001_ha-irq_vector[i]));
 + if (rc) {
 + for (j = 0; j  i; j++) {
 + free_irq(pm8001_ha-msix_entries[j].vector,
   (pm8001_ha-irq_vector[i]));
 - pci_disable_msix(pm8001_ha-pdev);
 - break;
   }
 + pci_disable_msix(pm8001_ha-pdev);
 + break;
   }
   }
 +
   return rc;
  }
  #endif
 -- 
 1.7.7.6
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 20/23] pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-26 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:24PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Hi Anil,

Could you please review pmcraid patches in this series?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/pmcraid.c |   13 ++---
  1 files changed, 2 insertions(+), 11 deletions(-)
 
 diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
 index c06af7f..6d0f208 100644
 --- a/drivers/scsi/pmcraid.c
 +++ b/drivers/scsi/pmcraid.c
 @@ -4698,19 +4698,10 @@ pmcraid_register_interrupt_handler(struct 
 pmcraid_instance *pinstance)
   for (i = 0; i  PMCRAID_NUM_MSIX_VECTORS; i++)
   entries[i].entry = i;
  
 - rc = pci_enable_msix(pdev, entries, num_hrrq);
 - if (rc  0)
 + num_hrrq = pci_enable_msix_range(pdev, entries, 1, num_hrrq);
 + if (num_hrrq  0)
   goto pmcraid_isr_legacy;
  
 - /* Check how many MSIX vectors are allocated and register
 -  * msi-x handlers for each of them giving appropriate buffer
 -  */
 - if (rc  0) {
 - num_hrrq = rc;
 - if (pci_enable_msix(pdev, entries, num_hrrq))
 - goto pmcraid_isr_legacy;
 - }
 -
   for (i = 0; i  num_hrrq; i++) {
   pinstance-hrrq_vector[i].hrrq_id = i;
   pinstance-hrrq_vector[i].drv_inst = pinstance;
 -- 
 1.7.7.6
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 21/23] qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-26 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:25PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.
 
 Log message code 0x00c6 preserved, although it is reported
 after successful call to pci_enable_msix_range(), not before
 possibly unsuccessful call to pci_enable_msix(). Consumers
 of the error code should not notice the difference.

Hello,

Could someone review this patch, please?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: qla2xxx-upstr...@qlogic.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 ---
  drivers/scsi/qla2xxx/qla_isr.c |   27 +++
  1 files changed, 11 insertions(+), 16 deletions(-)
 
 diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
 index a56825c..52d420f 100644
 --- a/drivers/scsi/qla2xxx/qla_isr.c
 +++ b/drivers/scsi/qla2xxx/qla_isr.c
 @@ -2923,27 +2923,22 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
 rsp_que *rsp)
   for (i = 0; i  ha-msix_count; i++)
   entries[i].entry = i;
  
 - ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
 - if (ret) {
 - if (ret  MIN_MSIX_COUNT)
 - goto msix_failed;
 -
 + ret = pci_enable_msix_range(ha-pdev,
 + entries, MIN_MSIX_COUNT, ha-msix_count);
 + if (ret  0) {
 + ql_log(ql_log_fatal, vha, 0x00c7,
 + MSI-X: Failed to enable support, 
 + giving   up -- %d/%d.\n,
 + ha-msix_count, ret);
 + goto msix_out;
 + } else if (ret  ha-msix_count) {
   ql_log(ql_log_warn, vha, 0x00c6,
   MSI-X: Failed to enable support 
   -- %d/%d\n Retry with %d vectors.\n,
   ha-msix_count, ret, ret);
 - ha-msix_count = ret;
 - ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
 - if (ret) {
 -msix_failed:
 - ql_log(ql_log_fatal, vha, 0x00c7,
 - MSI-X: Failed to enable support, 
 - giving   up -- %d/%d.\n,
 - ha-msix_count, ret);
 - goto msix_out;
 - }
 - ha-max_rsp_queues = ha-msix_count - 1;
   }
 + ha-msix_count = ret;
 + ha-max_rsp_queues = ha-msix_count - 1;
   ha-msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
   ha-msix_count, GFP_KERNEL);
   if (!ha-msix_entries) {
 -- 
 1.7.7.6
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 22/23] qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-26 Thread Alexander Gordeev
On Wed, Jul 16, 2014 at 08:05:26PM +0200, Alexander Gordeev wrote:
 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()  or pci_enable_msi_exact()
 and pci_enable_msix_range() or pci_enable_msix_exact()
 interfaces.

Hi Vikas,

Could you please reveiw this patch?

Thanks!

 Signed-off-by: Alexander Gordeev agord...@redhat.com
 Cc: Vikas Chaudhary vikas.chaudh...@qlogic.com
 Cc: iscsi-dri...@qlogic.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 Acked-By: Vikas Chaudhary vikas.chaudh...@qlogic.com
 ---
  drivers/scsi/qla4xxx/ql4_nx.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
 index 9dbdb4b..7c33658 100644
 --- a/drivers/scsi/qla4xxx/ql4_nx.c
 +++ b/drivers/scsi/qla4xxx/ql4_nx.c
 @@ -4221,7 +4221,7 @@ qla4_8xxx_enable_msix(struct scsi_qla_host *ha)
   for (i = 0; i  QLA_MSIX_ENTRIES; i++)
   entries[i].entry = qla4_8xxx_msix_entries[i].entry;
  
 - ret = pci_enable_msix(ha-pdev, entries, ARRAY_SIZE(entries));
 + ret = pci_enable_msix_exact(ha-pdev, entries, ARRAY_SIZE(entries));
   if (ret) {
   ql4_printk(KERN_WARNING, ha,
   MSI-X: Failed to enable support -- %d/%d\n,
 -- 
 1.7.7.6
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 RFC 0/2] percpu_tags: Prototype implementation

2014-07-18 Thread Alexander Gordeev
Hello Gentleman,

This is a development of percpu_ida library. I named it
percpu_tags to simplify review, since most of percpu_ida
code has gone and a diff would not be informative.

While the concept of per-cpu arrays is is preserved, the
implementation is heavily reworked. The main objective is to
improve the percpu_ida locking scheme.

Here is the list of major differrences between percpu_ida and
percpu_tags:

* The global freelist has gone. As result, CPUs do not compete
  for the global lock.

* Long-running operatons (scanning thru a cpumask) are executed
  with local interrupts enabled;

* percpu_ida::percpu_max_size limit is eliminated. Instead, the
  limit is determined dynamically. Depending from how many CPUs
  are requesting tags each CPU gets a fair share of the tag space;

* A tag is attempted to return to the CPU it was allocated on. As
  result, it is expected the locality of data associated with the
  tag benefits;

The code is largely raw and untested. The reason I am posting
is the prototype implementation performs 2-3 times faster than
percpu_ida, so I would like to ensure if it worth going further
with this approach or is there a no-go.

The performance test is not decent, though. I used fio random
read against a null_blk device sitting on top of percpu_tags,
which is not exactly how percpu_ida is used. This is another
reason I am posting - an advice on how to properly test is very
appreciated.

The source code could be found at
https://github.com/a-gordeev/linux.git  percpu_tags-v0

Thanks!

Cc: linux-scsi@vger.kernel.org
Cc: qla2xxx-upstr...@qlogic.com
Cc: Nicholas Bellinger n...@daterainc.com
Cc: Kent Overstreet k...@daterainc.com
Cc: Michael S. Tsirkin m...@redhat.com

Alexander Gordeev (2):
  percpu_tags: Prototype implementation
  percpu_tags: Use percpu_tags instead of percpu_ida

 drivers/scsi/qla2xxx/qla_target.c|6 +-
 drivers/target/iscsi/iscsi_target_util.c |6 +-
 drivers/target/target_core_transport.c   |4 +-
 drivers/target/tcm_fc/tfc_cmd.c  |8 +-
 drivers/vhost/scsi.c |6 +-
 include/linux/percpu_tags.h  |   37 ++
 include/target/target_core_base.h|4 +-
 lib/Makefile |2 +-
 lib/percpu_tags.c|  556 ++
 9 files changed, 611 insertions(+), 18 deletions(-)
 create mode 100644 include/linux/percpu_tags.h
 create mode 100644 lib/percpu_tags.c

-- 
1.7.7.6

--
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 RFC 2/2] percpu_tags: Use percpu_tags instead of percpu_ida

2014-07-18 Thread Alexander Gordeev
All users of percpu_ida are blindly converted to
percpu_tags users. No testing has been conducted.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: linux-scsi@vger.kernel.org
Cc: qla2xxx-upstr...@qlogic.com
Cc: Nicholas Bellinger n...@daterainc.com
Cc: Kent Overstreet k...@daterainc.com
Cc: Michael S. Tsirkin m...@redhat.com
---
 drivers/scsi/qla2xxx/qla_target.c|6 +++---
 drivers/target/iscsi/iscsi_target_util.c |6 +++---
 drivers/target/target_core_transport.c   |4 ++--
 drivers/target/tcm_fc/tfc_cmd.c  |8 
 drivers/vhost/scsi.c |6 +++---
 include/target/target_core_base.h|4 ++--
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index e632e14..cec4847 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2729,7 +2729,7 @@ void qlt_free_cmd(struct qla_tgt_cmd *cmd)
WARN_ON(1);
return;
}
-   percpu_ida_free(sess-se_sess-sess_tag_pool, cmd-se_cmd.map_tag);
+   percpu_tags_free(sess-se_sess-sess_tag_pool, cmd-se_cmd.map_tag);
 }
 EXPORT_SYMBOL(qlt_free_cmd);
 
@@ -3153,7 +3153,7 @@ out_term:
 */
spin_lock_irqsave(ha-hardware_lock, flags);
qlt_send_term_exchange(vha, NULL, cmd-atio, 1);
-   percpu_ida_free(sess-se_sess-sess_tag_pool, cmd-se_cmd.map_tag);
+   percpu_tags_free(sess-se_sess-sess_tag_pool, cmd-se_cmd.map_tag);
ha-tgt.tgt_ops-put_sess(sess);
spin_unlock_irqrestore(ha-hardware_lock, flags);
 }
@@ -3173,7 +3173,7 @@ static struct qla_tgt_cmd *qlt_get_tag(scsi_qla_host_t 
*vha,
struct qla_tgt_cmd *cmd;
int tag;
 
-   tag = percpu_ida_alloc(se_sess-sess_tag_pool, TASK_RUNNING);
+   tag = percpu_tags_alloc(se_sess-sess_tag_pool, TASK_RUNNING);
if (tag  0)
return NULL;
 
diff --git a/drivers/target/iscsi/iscsi_target_util.c 
b/drivers/target/iscsi/iscsi_target_util.c
index fd90b28..f76729e 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -17,7 +17,7 @@
  
**/
 
 #include linux/list.h
-#include linux/percpu_ida.h
+#include linux/percpu_tags.h
 #include scsi/scsi_tcq.h
 #include scsi/iscsi_proto.h
 #include target/target_core_base.h
@@ -158,7 +158,7 @@ struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn 
*conn, int state)
struct se_session *se_sess = conn-sess-se_sess;
int size, tag;
 
-   tag = percpu_ida_alloc(se_sess-sess_tag_pool, state);
+   tag = percpu_tags_alloc(se_sess-sess_tag_pool, state);
if (tag  0)
return NULL;
 
@@ -701,7 +701,7 @@ void iscsit_release_cmd(struct iscsi_cmd *cmd)
kfree(cmd-iov_data);
kfree(cmd-text_in_ptr);
 
-   percpu_ida_free(sess-se_sess-sess_tag_pool, se_cmd-map_tag);
+   percpu_tags_free(sess-se_sess-sess_tag_pool, se_cmd-map_tag);
 }
 EXPORT_SYMBOL(iscsit_release_cmd);
 
diff --git a/drivers/target/target_core_transport.c 
b/drivers/target/target_core_transport.c
index 7fa62fc..5c7f6f4 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -272,7 +272,7 @@ int transport_alloc_session_tags(struct se_session *se_sess,
}
}
 
-   rc = percpu_ida_init(se_sess-sess_tag_pool, tag_num);
+   rc = percpu_tags_init(se_sess-sess_tag_pool, tag_num);
if (rc  0) {
pr_err(Unable to init se_sess-sess_tag_pool,
 tag_num: %u\n, tag_num);
@@ -445,7 +445,7 @@ EXPORT_SYMBOL(transport_deregister_session_configfs);
 void transport_free_session(struct se_session *se_sess)
 {
if (se_sess-sess_cmd_map) {
-   percpu_ida_destroy(se_sess-sess_tag_pool);
+   percpu_tags_destroy(se_sess-sess_tag_pool);
if (is_vmalloc_addr(se_sess-sess_cmd_map))
vfree(se_sess-sess_cmd_map);
else
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index be0c0d0..6176c92 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -28,7 +28,7 @@
 #include linux/configfs.h
 #include linux/ctype.h
 #include linux/hash.h
-#include linux/percpu_ida.h
+#include linux/percpu_tags.h
 #include asm/unaligned.h
 #include scsi/scsi.h
 #include scsi/scsi_host.h
@@ -100,7 +100,7 @@ static void ft_free_cmd(struct ft_cmd *cmd)
if (fr_seq(fp))
lport-tt.seq_release(fr_seq(fp));
fc_frame_free(fp);
-   percpu_ida_free(sess-se_sess-sess_tag_pool, cmd-se_cmd.map_tag);
+   percpu_tags_free(sess-se_sess-sess_tag_pool, cmd-se_cmd.map_tag);
ft_sess_put(sess);  /* undo get from lookup at recv */
 }
 
@@ -456,7 +456,7 @@ static void ft_recv_cmd(struct ft_sess *sess, struct 
fc_frame

[PATCH RFC 1/2] percpu_tags: Prototype implementation

2014-07-18 Thread Alexander Gordeev
This is a development of percpu_ida library. The major
differrences between percpu_ida and percpu_tags are:

* The global freelist has gone. As result, CPUs do not compete
  for the global lock.

* Long-running operatons (scanning thru a cpumask) are executed
  with local interrupts enabled;

* percpu_ida::percpu_max_size limit is eliminated. Instead, the
  limit is determined dynamically. Depending from how many CPUs
  are requesting tags each CPU gets a fair share of the tag space;

* A tag is attempted to return to the CPU it was allocated on. As
  result, it is expected the locality of data associated with the
  tag benefits;

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: linux-scsi@vger.kernel.org
Cc: qla2xxx-upstr...@qlogic.com
Cc: Nicholas Bellinger n...@daterainc.com
Cc: Kent Overstreet k...@daterainc.com
Cc: Michael S. Tsirkin m...@redhat.com
---
 include/linux/percpu_tags.h |   37 +++
 lib/Makefile|2 +-
 lib/percpu_tags.c   |  556 +++
 3 files changed, 594 insertions(+), 1 deletions(-)
 create mode 100644 include/linux/percpu_tags.h
 create mode 100644 lib/percpu_tags.c

diff --git a/include/linux/percpu_tags.h b/include/linux/percpu_tags.h
new file mode 100644
index 000..ee89863
--- /dev/null
+++ b/include/linux/percpu_tags.h
@@ -0,0 +1,37 @@
+#ifndef __PERCPU_TAGS_H__
+#define __PERCPU_TAGS_H__
+
+#include linux/types.h
+#include linux/bitops.h
+#include linux/init.h
+#include linux/sched.h
+#include linux/spinlock_types.h
+#include linux/wait.h
+#include linux/cpumask.h
+
+struct percpu_cache;
+
+struct percpu_tags {
+   int nr_tags;
+   struct percpu_cache __percpu*cache;
+
+   int *tag_cpu_map;
+
+   cpumask_t   alloc_tags;
+   cpumask_t   free_tags;
+   cpumask_t   wait_tags;
+};
+
+int percpu_tags_alloc(struct percpu_tags *pt, int state);
+void percpu_tags_free(struct percpu_tags *pt, int tag);
+
+int percpu_tags_init(struct percpu_tags *pt, int nr_tags);
+void percpu_tags_destroy(struct percpu_tags *pt);
+
+int percpu_tags_for_each_free(struct percpu_tags *pt,
+ int (*fn)(unsigned, void *), void *data);
+int percpu_tags_free_tags(struct percpu_tags *pt, int cpu);
+
+#define PERCPU_TAGS_BATCH_MAX  4
+
+#endif /* __PERCPU_TAGS_H__ */
diff --git a/lib/Makefile b/lib/Makefile
index ba967a1..671143f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -26,7 +26,7 @@ obj-y += bcd.o div64.o sort.o parser.o halfmd4.o 
debug_locks.o random32.o \
 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
 gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \
 bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \
-percpu-refcount.o percpu_ida.o hash.o
+percpu-refcount.o percpu_ida.o percpu_tags.o hash.o
 obj-y += string_helpers.o
 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
 obj-y += kstrtox.o
diff --git a/lib/percpu_tags.c b/lib/percpu_tags.c
new file mode 100644
index 000..7bb61f5
--- /dev/null
+++ b/lib/percpu_tags.c
@@ -0,0 +1,556 @@
+/*
+ * Percpu tags library, based on percpu IDA library
+ *
+ * Copyright (C) 2014 RedHat, Inc. Alexander Gordeev
+ * Copyright (C) 2013 Datera, Inc. Kent Overstreet
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include linux/bitmap.h
+#include linux/bitops.h
+#include linux/bug.h
+#include linux/err.h
+#include linux/export.h
+#include linux/hardirq.h
+#include linux/idr.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/percpu.h
+#include linux/sched.h
+#include linux/slab.h
+#include linux/string.h
+#include linux/spinlock.h
+#include linux/percpu_tags.h
+
+struct percpu_cache {
+   spinlock_t  lock;
+   int cpu;/* CPU this cache belongs to */
+   wait_queue_head_t   wait;   /* tasks waiting for a tag */
+
+   int nr_alloc;   /* nr of allocated tags */
+
+   int nr_free;/* nr of unallocated tags */
+   int freelist[];
+};
+
+#define spin_lock_irqsave_cond(lock, cpu, flags)   \
+do  {  \
+   preempt_disable();  \
+   if ((cpu) == smp_processor_id())\
+   local_irq_save(flags

[PATCH v2 RESEND 22/23] qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Vikas Chaudhary vikas.chaudh...@qlogic.com
Cc: iscsi-dri...@qlogic.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-By: Vikas Chaudhary vikas.chaudh...@qlogic.com
---
 drivers/scsi/qla4xxx/ql4_nx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 9dbdb4b..7c33658 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -4221,7 +4221,7 @@ qla4_8xxx_enable_msix(struct scsi_qla_host *ha)
for (i = 0; i  QLA_MSIX_ENTRIES; i++)
entries[i].entry = qla4_8xxx_msix_entries[i].entry;
 
-   ret = pci_enable_msix(ha-pdev, entries, ARRAY_SIZE(entries));
+   ret = pci_enable_msix_exact(ha-pdev, entries, ARRAY_SIZE(entries));
if (ret) {
ql4_printk(KERN_WARNING, ha,
MSI-X: Failed to enable support -- %d/%d\n,
-- 
1.7.7.6

--
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 v2 RESEND 21/23] qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Log message code 0x00c6 preserved, although it is reported
after successful call to pci_enable_msix_range(), not before
possibly unsuccessful call to pci_enable_msix(). Consumers
of the error code should not notice the difference.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: qla2xxx-upstr...@qlogic.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/qla2xxx/qla_isr.c |   27 +++
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index a56825c..52d420f 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2923,27 +2923,22 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
for (i = 0; i  ha-msix_count; i++)
entries[i].entry = i;
 
-   ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
-   if (ret) {
-   if (ret  MIN_MSIX_COUNT)
-   goto msix_failed;
-
+   ret = pci_enable_msix_range(ha-pdev,
+   entries, MIN_MSIX_COUNT, ha-msix_count);
+   if (ret  0) {
+   ql_log(ql_log_fatal, vha, 0x00c7,
+   MSI-X: Failed to enable support, 
+   giving   up -- %d/%d.\n,
+   ha-msix_count, ret);
+   goto msix_out;
+   } else if (ret  ha-msix_count) {
ql_log(ql_log_warn, vha, 0x00c6,
MSI-X: Failed to enable support 
-- %d/%d\n Retry with %d vectors.\n,
ha-msix_count, ret, ret);
-   ha-msix_count = ret;
-   ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
-   if (ret) {
-msix_failed:
-   ql_log(ql_log_fatal, vha, 0x00c7,
-   MSI-X: Failed to enable support, 
-   giving   up -- %d/%d.\n,
-   ha-msix_count, ret);
-   goto msix_out;
-   }
-   ha-max_rsp_queues = ha-msix_count - 1;
}
+   ha-msix_count = ret;
+   ha-max_rsp_queues = ha-msix_count - 1;
ha-msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
ha-msix_count, GFP_KERNEL);
if (!ha-msix_entries) {
-- 
1.7.7.6

--
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 v2 RESEND 20/23] pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pmcraid.c |   13 ++---
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index c06af7f..6d0f208 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4698,19 +4698,10 @@ pmcraid_register_interrupt_handler(struct 
pmcraid_instance *pinstance)
for (i = 0; i  PMCRAID_NUM_MSIX_VECTORS; i++)
entries[i].entry = i;
 
-   rc = pci_enable_msix(pdev, entries, num_hrrq);
-   if (rc  0)
+   num_hrrq = pci_enable_msix_range(pdev, entries, 1, num_hrrq);
+   if (num_hrrq  0)
goto pmcraid_isr_legacy;
 
-   /* Check how many MSIX vectors are allocated and register
-* msi-x handlers for each of them giving appropriate buffer
-*/
-   if (rc  0) {
-   num_hrrq = rc;
-   if (pci_enable_msix(pdev, entries, num_hrrq))
-   goto pmcraid_isr_legacy;
-   }
-
for (i = 0; i  num_hrrq; i++) {
pinstance-hrrq_vector[i].hrrq_id = i;
pinstance-hrrq_vector[i].drv_inst = pinstance;
-- 
1.7.7.6

--
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 v2 RESEND 19/23] pmcraid: Get rid of a redundant assignment

2014-07-16 Thread Alexander Gordeev
Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pmcraid.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index be8ce54..c06af7f 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4746,7 +4746,6 @@ pmcraid_isr_legacy:
pinstance-hrrq_vector[0].drv_inst = pinstance;
pinstance-hrrq_vector[0].vector = pdev-irq;
pinstance-num_hrrq = 1;
-   rc = 0;
 
rc = request_irq(pdev-irq, pmcraid_isr, IRQF_SHARED,
 PMCRAID_DRIVER_NAME, pinstance-hrrq_vector[0]);
-- 
1.7.7.6

--
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 v2 RESEND 10/23] isci: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Lukasz Dorau lukasz.do...@intel.com
Cc: Maciej Patelczyk maciej.patelc...@intel.com
Cc: Dave Jiang dave.ji...@intel.com
Cc: intel-linux-...@intel.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Artur Paszkiewicz artur.paszkiew...@intel.com
---
 drivers/scsi/isci/init.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 695b34e..4198e45 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -356,7 +356,7 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
for (i = 0; i  num_msix; i++)
pci_info-msix_entries[i].entry = i;
 
-   err = pci_enable_msix(pdev, pci_info-msix_entries, num_msix);
+   err = pci_enable_msix_exact(pdev, pci_info-msix_entries, num_msix);
if (err)
goto intx;
 
-- 
1.7.7.6

--
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 v2 RESEND 12/23] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: James Smart james.sm...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/lpfc/lpfc_init.c |   38 +-
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a5769a9..d9caed9 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8211,9 +8211,9 @@ 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() is
- * called to enable the MSI-X vectors. Note that pci_enable_msix(), once
- * invoked, enables either all or nothing, depending on the current
+ * 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
  * for calling the individual request_irq() to register each MSI-X vector
  * with a interrupt handler, which is done in this function. Note that
@@ -8237,8 +8237,8 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
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));
+   rc = pci_enable_msix_exact(phba-pcidev, phba-msix_entries,
+  ARRAY_SIZE(phba-msix_entries));
if (rc) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
0420 PCI enable MSI-X failed (%d)\n, rc);
@@ -8775,15 +8775,13 @@ out:
  * @phba: pointer to lpfc hba data structure.
  *
  * This routine is invoked to enable the MSI-X interrupt vectors to device
- * with SLI-4 interface spec. The kernel function pci_enable_msix() is called
- * to enable the MSI-X vectors. Note that pci_enable_msix(), 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 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
+ * with SLI-4 interface spec. The kernel function pci_enable_msix_range()
+ * 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.
  *
  * Return codes
@@ -8805,18 +8803,16 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
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 vec_fail_out;
}
 
+   vectors = rc;
/* Log MSI-X vector assignment */
for (index = 0; index  vectors; index++)
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-- 
1.7.7.6

--
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 v2 RESEND 11/23] lpfc: Remove superfluous call to pci_disable_msix()

2014-07-16 Thread Alexander Gordeev
There is no need to call pci_disable_msix() in case
the previous call to pci_enable_msix() failed

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: James Smart james.sm...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: James Smart james.sm...@emulex.com
---
 drivers/scsi/lpfc/lpfc_init.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 06f9a5b..a5769a9 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8242,7 +8242,7 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
if (rc) {
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,
@@ -8320,6 +8320,8 @@ irq_fail_out:
 msi_fail_out:
/* Unconfigure MSI-X capability structure */
pci_disable_msix(phba-pcidev);
+
+vec_fail_out:
return rc;
 }
 
@@ -8812,7 +8814,7 @@ enable_msix_vectors:
} else if (rc) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
0484 PCI enable MSI-X failed (%d)\n, rc);
-   goto msi_fail_out;
+   goto vec_fail_out;
}
 
/* Log MSI-X vector assignment */
@@ -8875,9 +8877,10 @@ cfg_fail_out:
 phba-sli4_hba.fcp_eq_hdl[index]);
}
 
-msi_fail_out:
/* Unconfigure MSI-X capability structure */
pci_disable_msix(phba-pcidev);
+
+vec_fail_out:
return rc;
 }
 
-- 
1.7.7.6

--
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 v2 RESEND 14/23] megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Neela Syam Kolli megaraidli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/megaraid/megaraid_sas_base.c |   20 +++-
 1 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index ba06102..7a4e75e 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4105,17 +4105,11 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
 (unsigned int)num_online_cpus());
for (i = 0; i  instance-msix_vectors; i++)
instance-msixentry[i].entry = i;
-   i = pci_enable_msix(instance-pdev, instance-msixentry,
-   instance-msix_vectors);
-   if (i = 0) {
-   if (i) {
-   if (!pci_enable_msix(instance-pdev,
-instance-msixentry, i))
-   instance-msix_vectors = i;
-   else
-   instance-msix_vectors = 0;
-   }
-   } else
+   i = pci_enable_msix_range(instance-pdev, instance-msixentry,
+ 1, instance-msix_vectors);
+   if (i)
+   instance-msix_vectors = i;
+   else
instance-msix_vectors = 0;
 
dev_info(instance-pdev-dev, [scsi%d]: FW supports
@@ -5135,8 +5129,8 @@ megasas_resume(struct pci_dev *pdev)
 
/* Now re-enable MSI-X */
if (instance-msix_vectors 
-   pci_enable_msix(instance-pdev, instance-msixentry,
-   instance-msix_vectors))
+   pci_enable_msix_exact(instance-pdev, instance-msixentry,
+ instance-msix_vectors))
goto fail_reenable_msix;
 
switch (instance-pdev-device) {
-- 
1.7.7.6

--
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 v2 RESEND 00/23] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
Hello,

This is a series of mostly trivial patches. Once accepted,
we could phase out pci_enable_msix() interface.

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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Thanks!

Cc: iss_storage...@hp.com
Cc: intel-linux-...@intel.com
Cc: supp...@lsi.com
Cc: dl-mptfusionli...@lsi.com
Cc: qla2xxx-upstr...@qlogic.com
Cc: iscsi-dri...@qlogic.com
Cc: pv-driv...@vmware.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org

Alexander Gordeev (23):
  be2iscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()
  bfa: Do not call pci_enable_msix() after it failed once
  bfa: Cleanup bfad_setup_intr() function
  bfa: Use pci_enable_msix_exact() instead of pci_enable_msix()
  csiostor: Remove superfluous call to pci_disable_msix()
  csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()
  fnic: Use pci_enable_msix_exact() instead of pci_enable_msix()
  hpsa: Fallback to MSI rather than to INTx if MSI-X failed
  hpsa: Use pci_enable_msix_range() instead of pci_enable_msix()
  isci: Use pci_enable_msix_exact() instead of pci_enable_msix()
  lpfc: Remove superfluous call to pci_disable_msix()
  lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()
  megaraid: Fail resume if MSI-X re-initialization failed
  megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()
  mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
  mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
  pm8001: Fix invalid return when request_irq() failed
  pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()
  pmcraid: Get rid of a redundant assignment
  pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()
  qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()
  qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()
  vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()

 drivers/scsi/be2iscsi/be_main.c   |6 +--
 drivers/scsi/bfa/bfad.c   |   62 -
 drivers/scsi/csiostor/csio_hw.h   |2 +-
 drivers/scsi/csiostor/csio_isr.c  |   24 ---
 drivers/scsi/fnic/fnic_isr.c  |4 +-
 drivers/scsi/hpsa.c   |   28 ++---
 drivers/scsi/isci/init.c  |2 +-
 drivers/scsi/lpfc/lpfc_init.c |   47 +++---
 drivers/scsi/megaraid/megaraid_sas_base.c |   24 +--
 drivers/scsi/mpt2sas/mpt2sas_base.c   |6 +-
 drivers/scsi/mpt3sas/mpt3sas_base.c   |4 +-
 drivers/scsi/pm8001/pm8001_init.c |   44 +++--
 drivers/scsi/pmcraid.c|   14 +--
 drivers/scsi/qla2xxx/qla_isr.c|   27 +---
 drivers/scsi/qla4xxx/ql4_nx.c |2 +-
 drivers/scsi/vmw_pvscsi.c |2 +-
 16 files changed, 128 insertions(+), 170 deletions(-)

-- 
1.7.7.6

--
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 v2 RESEND 07/23] fnic: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Hiral Patel hiral...@cisco.com
Cc: Suma Ramars sram...@cisco.com
Cc: Brian Uchino buch...@cisco.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/fnic/fnic_isr.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_isr.c b/drivers/scsi/fnic/fnic_isr.c
index 7d9b54a..a0dd1b6 100644
--- a/drivers/scsi/fnic/fnic_isr.c
+++ b/drivers/scsi/fnic/fnic_isr.c
@@ -257,8 +257,8 @@ int fnic_set_intr_mode(struct fnic *fnic)
fnic-raw_wq_count = m 
fnic-wq_copy_count = o 
fnic-cq_count = n + m + o) {
-   if (!pci_enable_msix(fnic-pdev, fnic-msix_entry,
-   n + m + o + 1)) {
+   if (!pci_enable_msix_exact(fnic-pdev, fnic-msix_entry,
+  n + m + o + 1)) {
fnic-rq_count = n;
fnic-raw_wq_count = m;
fnic-wq_copy_count = o;
-- 
1.7.7.6

--
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 v2 RESEND 04/23] bfa: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Gurumurthy aguru...@brocade.com
Cc: Vijaya Mohan Guvva vmo...@brocade.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfad.c |   20 ++--
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index c18279f..e90a374 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1234,29 +1234,21 @@ bfad_setup_intr(struct bfad_s *bfad)
if ((bfa_asic_id_ctc(pdev-device)  !msix_disable_ct) ||
   (bfa_asic_id_cb(pdev-device)  !msix_disable_cb)) {
 
-   error = pci_enable_msix(bfad-pcidev, msix_entries, bfad-nvec);
+   error = pci_enable_msix_exact(bfad-pcidev,
+ msix_entries, bfad-nvec);
/* In CT1  CT2, try to allocate just one vector */
-   if (error  0  bfa_asic_id_ctc(pdev-device)) {
+   if (error == -ENOSPC  bfa_asic_id_ctc(pdev-device)) {
printk(KERN_WARNING bfa %s: trying one msix 
   vector failed to allocate %d[%d]\n,
   bfad-pci_name, bfad-nvec, error);
bfad-nvec = 1;
-   error = pci_enable_msix(bfad-pcidev,
-   msix_entries, bfad-nvec);
+   error = pci_enable_msix_exact(bfad-pcidev,
+ msix_entries, 1);
}
 
-   /*
-* Only error number of vector is available.
-* We don't have a mechanism to map multiple
-* interrupts into one vector, so even if we
-* can try to request less vectors, we don't
-* know how to associate interrupt events to
-*  vectors. Linux doesn't duplicate vectors
-* in the MSIX table for this case.
-*/
if (error) {
printk(KERN_WARNING bfad%d: 
-  pci_enable_msix failed (%d), 
+  pci_enable_msix_exact failed (%d), 
   use line based.\n,
bfad-inst_no, error);
goto line_based;
-- 
1.7.7.6

--
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 v2 RESEND 02/23] bfa: Do not call pci_enable_msix() after it failed once

2014-07-16 Thread Alexander Gordeev
Function pci_enable_msix() should not be called in case
it threw a negative errno from a previous call.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Gurumurthy aguru...@brocade.com
Cc: Vijaya Mohan Guvva vmo...@brocade.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfad.c |   48 ++
 1 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 7593b7c..bb93180 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1235,33 +1235,31 @@ bfad_setup_intr(struct bfad_s *bfad)
   (bfa_asic_id_cb(pdev-device)  !msix_disable_cb)) {
 
error = pci_enable_msix(bfad-pcidev, msix_entries, bfad-nvec);
-   if (error) {
-   /* In CT1  CT2, try to allocate just one vector */
-   if (bfa_asic_id_ctc(pdev-device)) {
-   printk(KERN_WARNING bfa %s: trying one msix 
-  vector failed to allocate %d[%d]\n,
-  bfad-pci_name, bfad-nvec, error);
-   bfad-nvec = 1;
-   error = pci_enable_msix(bfad-pcidev,
+   /* In CT1  CT2, try to allocate just one vector */
+   if (error  0  bfa_asic_id_ctc(pdev-device)) {
+   printk(KERN_WARNING bfa %s: trying one msix 
+  vector failed to allocate %d[%d]\n,
+  bfad-pci_name, bfad-nvec, error);
+   bfad-nvec = 1;
+   error = pci_enable_msix(bfad-pcidev,
msix_entries, bfad-nvec);
-   }
+   }
 
-   /*
-* Only error number of vector is available.
-* We don't have a mechanism to map multiple
-* interrupts into one vector, so even if we
-* can try to request less vectors, we don't
-* know how to associate interrupt events to
-*  vectors. Linux doesn't duplicate vectors
-* in the MSIX table for this case.
-*/
-   if (error) {
-   printk(KERN_WARNING bfad%d: 
-  pci_enable_msix failed (%d), 
-  use line based.\n,
-   bfad-inst_no, error);
-   goto line_based;
-   }
+   /*
+* Only error number of vector is available.
+* We don't have a mechanism to map multiple
+* interrupts into one vector, so even if we
+* can try to request less vectors, we don't
+* know how to associate interrupt events to
+*  vectors. Linux doesn't duplicate vectors
+* in the MSIX table for this case.
+*/
+   if (error) {
+   printk(KERN_WARNING bfad%d: 
+  pci_enable_msix failed (%d), 
+  use line based.\n,
+   bfad-inst_no, error);
+   goto line_based;
}
 
/* Disable INTX in MSI-X mode */
-- 
1.7.7.6

--
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 v2 RESEND 17/23] pm8001: Fix invalid return when request_irq() failed

2014-07-16 Thread Alexander Gordeev
When a call to request_irq() failed pm8001_setup_msix()
still returns the success. This udate fixes the described
misbehaviour.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: xjtu...@gmail.com
Cc: lindar_...@usish.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Jack Wang xjtu...@gmail.com
---
 drivers/scsi/pm8001/pm8001_init.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index e90c89f..e837ece 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -744,9 +744,10 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info 
*pm8001_ha)
pm8001_ha-irq_vector[i].irq_id = i;
pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
 
-   if (request_irq(pm8001_ha-msix_entries[i].vector,
+   rc = request_irq(pm8001_ha-msix_entries[i].vector,
pm8001_interrupt_handler_msix, flag,
-   intr_drvname[i], (pm8001_ha-irq_vector[i]))) {
+   intr_drvname[i], (pm8001_ha-irq_vector[i]));
+   if (rc) {
for (j = 0; j  i; j++)
free_irq(
pm8001_ha-msix_entries[j].vector,
-- 
1.7.7.6

--
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 v2 RESEND 23/23] vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Arvind Kumar arvindku...@vmware.com
Cc: pv-driv...@vmware.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Arvind Kumar arvindku...@vmware.com
---
 drivers/scsi/vmw_pvscsi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index c88e146..598f65e 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -1194,7 +1194,7 @@ static int pvscsi_setup_msix(const struct pvscsi_adapter 
*adapter,
struct msix_entry entry = { 0, PVSCSI_VECTOR_COMPLETION };
int ret;
 
-   ret = pci_enable_msix(adapter-dev, entry, 1);
+   ret = pci_enable_msix_exact(adapter-dev, entry, 1);
if (ret)
return ret;
 
-- 
1.7.7.6

--
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 v2 RESEND 16/23] mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
Cc: Sreekanth Reddy sreekanth.re...@lsi.com
Cc: supp...@lsi.com
Cc: dl-mptfusionli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/mpt3sas/mpt3sas_base.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 0cf4f70..7b65ec2 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1747,10 +1747,10 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
for (i = 0, a = entries; i  ioc-reply_queue_count; i++, a++)
a-entry = i;
 
-   r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count);
+   r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count);
if (r) {
dfailprintk(ioc, pr_info(MPT3SAS_FMT
-   pci_enable_msix failed (r=%d) !!!\n,
+   pci_enable_msix_exact failed (r=%d) !!!\n,
ioc-name, r));
kfree(entries);
goto try_ioapic;
-- 
1.7.7.6

--
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 v2 RESEND 15/23] mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
Cc: Sreekanth Reddy sreekanth.re...@lsi.com
Cc: supp...@lsi.com
Cc: dl-mptfusionli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/mpt2sas/mpt2sas_base.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 8b88118..6aca369 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1432,10 +1432,10 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
for (i = 0, a = entries; i  ioc-reply_queue_count; i++, a++)
a-entry = i;
 
-   r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count);
+   r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count);
if (r) {
-   dfailprintk(ioc, printk(MPT2SAS_INFO_FMT pci_enable_msix 
-   failed (r=%d) !!!\n, ioc-name, r));
+   dfailprintk(ioc, printk(MPT2SAS_INFO_FMT
+   pci_enable_msix_exact failed (r=%d) !!!\n, ioc-name, r));
kfree(entries);
goto try_ioapic;
}
-- 
1.7.7.6

--
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 v2 RESEND 05/23] csiostor: Remove superfluous call to pci_disable_msix()

2014-07-16 Thread Alexander Gordeev
There is no need to call pci_disable_msix() in case
the previous call to pci_enable_msix() failed

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Naresh Kumar Inna nar...@chelsio.com
Cc: Arvind Bhushan arvi...@chelsio.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/csiostor/csio_isr.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_isr.c b/drivers/scsi/csiostor/csio_isr.c
index 7ee9777..91ba91d 100644
--- a/drivers/scsi/csiostor/csio_isr.c
+++ b/drivers/scsi/csiostor/csio_isr.c
@@ -529,10 +529,8 @@ csio_enable_msix(struct csio_hw *hw)
csio_reduce_sqsets(hw, cnt - extra);
}
} else {
-   if (rv  0) {
-   pci_disable_msix(hw-pdev);
+   if (rv  0)
csio_info(hw, Not using MSI-X, remainder:%d\n, rv);
-   }
 
kfree(entries);
return -ENOMEM;
-- 
1.7.7.6

--
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 v2 RESEND 08/23] hpsa: Fallback to MSI rather than to INTx if MSI-X failed

2014-07-16 Thread Alexander Gordeev
Currently the driver falls back to INTx mode when MSI-X
initialization failed. This is a suboptimal behaviour
for chips that also support MSI. This update changes that
behaviour and falls back to MSI mode in case MSI-X mode
initialization failed.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/hpsa.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 31184b3..648dec2 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6177,7 +6177,6 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
dev_warn(h-pdev-dev, MSI-X init failed %d\n,
   err);
h-msix_vector = 0;
-   goto default_int_mode;
}
}
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
-- 
1.7.7.6

--
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 v2 RESEND 06/23] csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Naresh Kumar Inna nar...@chelsio.com
Cc: Arvind Bhushan arvi...@chelsio.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/csiostor/csio_hw.h  |2 +-
 drivers/scsi/csiostor/csio_isr.c |   22 +-
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
index 49b1daa..5db2d85 100644
--- a/drivers/scsi/csiostor/csio_hw.h
+++ b/drivers/scsi/csiostor/csio_hw.h
@@ -94,7 +94,7 @@ enum {
 };
 
 struct csio_msix_entries {
-   unsigned short  vector; /* Vector assigned by pci_enable_msix */
+   unsigned short  vector; /* Assigned MSI-X vector */
void*dev_id;/* Priv object associated w/ this msix*/
chardesc[24];   /* Description of this vector */
 };
diff --git a/drivers/scsi/csiostor/csio_isr.c b/drivers/scsi/csiostor/csio_isr.c
index 91ba91d..a8c748a 100644
--- a/drivers/scsi/csiostor/csio_isr.c
+++ b/drivers/scsi/csiostor/csio_isr.c
@@ -499,7 +499,7 @@ csio_reduce_sqsets(struct csio_hw *hw, int cnt)
 static int
 csio_enable_msix(struct csio_hw *hw)
 {
-   int rv, i, j, k, n, min, cnt;
+   int i, j, k, n, min, cnt;
struct csio_msix_entries *entryp;
struct msix_entry *entries;
int extra = CSIO_EXTRA_VECS;
@@ -521,19 +521,15 @@ csio_enable_msix(struct csio_hw *hw)
 
csio_dbg(hw, FW supp #niq:%d, trying %d msix's\n, hw-cfg_niq, cnt);
 
-   while ((rv = pci_enable_msix(hw-pdev, entries, cnt)) = min)
-   cnt = rv;
-   if (!rv) {
-   if (cnt  (hw-num_sqsets + extra)) {
-   csio_dbg(hw, Reducing sqsets to %d\n, cnt - extra);
-   csio_reduce_sqsets(hw, cnt - extra);
-   }
-   } else {
-   if (rv  0)
-   csio_info(hw, Not using MSI-X, remainder:%d\n, rv);
-
+   cnt = pci_enable_msix_range(hw-pdev, entries, min, cnt);
+   if (cnt  0) {
kfree(entries);
-   return -ENOMEM;
+   return cnt;
+   }
+
+   if (cnt  (hw-num_sqsets + extra)) {
+   csio_dbg(hw, Reducing sqsets to %d\n, cnt - extra);
+   csio_reduce_sqsets(hw, cnt - extra);
}
 
/* Save off vectors */
-- 
1.7.7.6

--
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 v2 RESEND 03/23] bfa: Cleanup bfad_setup_intr() function

2014-07-16 Thread Alexander Gordeev
Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Gurumurthy aguru...@brocade.com
Cc: Vijaya Mohan Guvva vmo...@brocade.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfad.c |   18 --
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index bb93180..c18279f 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1219,7 +1219,7 @@ bfad_install_msix_handler(struct bfad_s *bfad)
 int
 bfad_setup_intr(struct bfad_s *bfad)
 {
-   int error = 0;
+   int error;
u32 mask = 0, i, num_bit = 0, max_bit = 0;
struct msix_entry msix_entries[MAX_MSIX_ENTRY];
struct pci_dev *pdev = bfad-pcidev;
@@ -1279,20 +1279,18 @@ bfad_setup_intr(struct bfad_s *bfad)
 
bfad-bfad_flags |= BFAD_MSIX_ON;
 
-   return error;
+   return 0;
}
 
 line_based:
-   error = 0;
-   if (request_irq
-   (bfad-pcidev-irq, (irq_handler_t) bfad_intx, BFAD_IRQ_FLAGS,
-BFAD_DRIVER_NAME, bfad) != 0) {
-   /* Enable interrupt handler failed */
-   return 1;
-   }
+   error = request_irq(bfad-pcidev-irq, (irq_handler_t)bfad_intx,
+   BFAD_IRQ_FLAGS, BFAD_DRIVER_NAME, bfad);
+   if (error)
+   return error;
+
bfad-bfad_flags |= BFAD_INTX_ON;
 
-   return error;
+   return 0;
 }
 
 void
-- 
1.7.7.6

--
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 v2 RESEND 09/23] hpsa: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Signed-off-by: Alexander Gordeev agord...@redhat.com
---
 drivers/scsi/hpsa.c |   27 ---
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 648dec2..5c4ab6e 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6160,25 +6160,22 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
h-msix_vector = MAX_REPLY_QUEUES;
if (h-msix_vector  num_online_cpus())
h-msix_vector = num_online_cpus();
-   err = pci_enable_msix(h-pdev, hpsa_msix_entries,
- h-msix_vector);
-   if (err  0) {
+   err = pci_enable_msix_range(h-pdev, hpsa_msix_entries,
+   1, h-msix_vector);
+   if (err  0) {
+   dev_warn(h-pdev-dev, MSI-X init failed %d\n, err);
+   h-msix_vector = 0;
+   goto single_msi_mode;
+   } else if (err  h-msix_vector) {
dev_warn(h-pdev-dev, only %d MSI-X vectors 
   available\n, err);
-   h-msix_vector = err;
-   err = pci_enable_msix(h-pdev, hpsa_msix_entries,
- h-msix_vector);
-   }
-   if (!err) {
-   for (i = 0; i  h-msix_vector; i++)
-   h-intr[i] = hpsa_msix_entries[i].vector;
-   return;
-   } else {
-   dev_warn(h-pdev-dev, MSI-X init failed %d\n,
-  err);
-   h-msix_vector = 0;
}
+   h-msix_vector = err;
+   for (i = 0; i  h-msix_vector; i++)
+   h-intr[i] = hpsa_msix_entries[i].vector;
+   return;
}
+single_msi_mode:
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
dev_info(h-pdev-dev, MSI\n);
if (!pci_enable_msi(h-pdev))
-- 
1.7.7.6

--
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 v2 RESEND 18/23] pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-07-16 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: xjtu...@gmail.com
Cc: lindar_...@usish.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pm8001/pm8001_init.c |   39 +++--
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index e837ece..4057c24 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -729,34 +729,35 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info 
*pm8001_ha)
sizeof(pm8001_ha-msix_entries[0]);
for (i = 0; i  max_entry ; i++)
pm8001_ha-msix_entries[i].entry = i;
-   rc = pci_enable_msix(pm8001_ha-pdev, pm8001_ha-msix_entries,
+   rc = pci_enable_msix_exact(pm8001_ha-pdev, pm8001_ha-msix_entries,
number_of_intr);
pm8001_ha-number_of_intr = number_of_intr;
-   if (!rc) {
-   PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
-   pci_enable_msix request ret:%d no of intr %d\n,
-   rc, pm8001_ha-number_of_intr));
+   if (rc)
+   return rc;
 
+   PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
+   pci_enable_msix_exact request ret:%d no of intr %d\n,
+   rc, pm8001_ha-number_of_intr));
 
-   for (i = 0; i  number_of_intr; i++) {
-   snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
-   DRV_NAME%d, i);
-   pm8001_ha-irq_vector[i].irq_id = i;
-   pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
+   for (i = 0; i  number_of_intr; i++) {
+   snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
+   DRV_NAME%d, i);
+   pm8001_ha-irq_vector[i].irq_id = i;
+   pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
 
-   rc = request_irq(pm8001_ha-msix_entries[i].vector,
-   pm8001_interrupt_handler_msix, flag,
-   intr_drvname[i], (pm8001_ha-irq_vector[i]));
-   if (rc) {
-   for (j = 0; j  i; j++)
-   free_irq(
-   pm8001_ha-msix_entries[j].vector,
+   rc = request_irq(pm8001_ha-msix_entries[i].vector,
+   pm8001_interrupt_handler_msix, flag,
+   intr_drvname[i], (pm8001_ha-irq_vector[i]));
+   if (rc) {
+   for (j = 0; j  i; j++) {
+   free_irq(pm8001_ha-msix_entries[j].vector,
(pm8001_ha-irq_vector[i]));
-   pci_disable_msix(pm8001_ha-pdev);
-   break;
}
+   pci_disable_msix(pm8001_ha-pdev);
+   break;
}
}
+
return rc;
 }
 #endif
-- 
1.7.7.6

--
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 v2 RESEND 00/23] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-07-07 Thread Alexander Gordeev
On Thu, Apr 24, 2014 at 12:07:12PM -0600, Bjorn Helgaas wrote:
  These depend on f7fc32c, which appeared in v3.15-rc1.  I had intended
  to merge these scsi updates at the same time, but I failed.  Would you
  like to take them now that f7fc32c is upstream?
 
  OK, will add them.  I'm planning to base the scsi-misc tree on -rc3 once
  we have our current crop of fixes upstream.
 
 Great, thanks!

James, Bjorn,

All patches except 'be2iscsi' (patch 1) and 'hpsa' (patches 9,10) still
apply. Would you take those apply or have me resend all of them or just
'be2iscsi' and 'hpsa'?

Thanks!

 Bjorn

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 00/23] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-06-16 Thread Alexander Gordeev
On Thu, Apr 24, 2014 at 05:51:09PM +, James Bottomley wrote:
  These depend on f7fc32c, which appeared in v3.15-rc1.  I had intended
  to merge these scsi updates at the same time, but I failed.  Would you
  like to take them now that f7fc32c is upstream?
 
 OK, will add them.  I'm planning to base the scsi-misc tree on -rc3 once
 we have our current crop of fixes upstream.

Hi James,

If I need to repost the series to get it into you tree?

Thanks!

 James
 

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 RESEND 09/23] hpsa: Fallback to MSI rather than to INTx if MSI-X failed

2014-04-14 Thread Alexander Gordeev
Currently the driver falls back to INTx mode when MSI-X
initialization failed. This is a suboptimal behaviour
for chips that also support MSI. This update changes that
behaviour and falls back to MSI mode in case MSI-X mode
initialization failed.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/hpsa.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 8cf4a0c..3284edb 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6162,7 +6162,6 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
dev_warn(h-pdev-dev, MSI-X init failed %d\n,
   err);
h-msix_vector = 0;
-   goto default_int_mode;
}
}
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
-- 
1.7.7.6

--
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 v2 RESEND 10/23] hpsa: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/hpsa.c |   29 +
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 3284edb..36bb1e4 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6144,26 +6144,23 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
goto default_int_mode;
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSIX)) {
dev_info(h-pdev-dev, MSIX\n);
-   h-msix_vector = MAX_REPLY_QUEUES;
-   err = pci_enable_msix(h-pdev, hpsa_msix_entries,
- h-msix_vector);
-   if (err  0) {
+   err = pci_enable_msix_range(h-pdev, hpsa_msix_entries,
+   1, MAX_REPLY_QUEUES);
+   if (err  0) {
+   dev_warn(h-pdev-dev, MSI-X init failed %d\n, err);
+   h-msix_vector = 0;
+   goto single_msi_mode;
+   } else if (err  MAX_REPLY_QUEUES) {
dev_warn(h-pdev-dev, only %d MSI-X vectors 
   available\n, err);
-   h-msix_vector = err;
-   err = pci_enable_msix(h-pdev, hpsa_msix_entries,
- h-msix_vector);
-   }
-   if (!err) {
-   for (i = 0; i  h-msix_vector; i++)
-   h-intr[i] = hpsa_msix_entries[i].vector;
-   return;
-   } else {
-   dev_warn(h-pdev-dev, MSI-X init failed %d\n,
-  err);
-   h-msix_vector = 0;
}
+
+   h-msix_vector = err;
+   for (i = 0; i  h-msix_vector; i++)
+   h-intr[i] = hpsa_msix_entries[i].vector;
+   return;
}
+single_msi_mode:
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
dev_info(h-pdev-dev, MSI\n);
if (!pci_enable_msi(h-pdev))
-- 
1.7.7.6

--
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 v2 RESEND 17/23] pm8001: Fix invalid return when request_irq() failed

2014-04-14 Thread Alexander Gordeev
When a call to request_irq() failed pm8001_setup_msix()
still returns the success. This udate fixes the described
misbehaviour.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: xjtu...@gmail.com
Cc: lindar_...@usish.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Jack Wang xjtu...@gmail.com
---
 drivers/scsi/pm8001/pm8001_init.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index c4f31b21..df421f5 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -740,9 +740,10 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info 
*pm8001_ha)
pm8001_ha-irq_vector[i].irq_id = i;
pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
 
-   if (request_irq(pm8001_ha-msix_entries[i].vector,
+   rc = request_irq(pm8001_ha-msix_entries[i].vector,
pm8001_interrupt_handler_msix, flag,
-   intr_drvname[i], (pm8001_ha-irq_vector[i]))) {
+   intr_drvname[i], (pm8001_ha-irq_vector[i]));
+   if (rc) {
for (j = 0; j  i; j++)
free_irq(
pm8001_ha-msix_entries[j].vector,
-- 
1.7.7.6

--
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 v2 RESEND 23/23] vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Arvind Kumar arvindku...@vmware.com
Cc: pv-driv...@vmware.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Arvind Kumar arvindku...@vmware.com
---
 drivers/scsi/vmw_pvscsi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index c88e146..598f65e 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -1194,7 +1194,7 @@ static int pvscsi_setup_msix(const struct pvscsi_adapter 
*adapter,
struct msix_entry entry = { 0, PVSCSI_VECTOR_COMPLETION };
int ret;
 
-   ret = pci_enable_msix(adapter-dev, entry, 1);
+   ret = pci_enable_msix_exact(adapter-dev, entry, 1);
if (ret)
return ret;
 
-- 
1.7.7.6

--
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 v2 RESEND 18/23] pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: xjtu...@gmail.com
Cc: lindar_...@usish.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pm8001/pm8001_init.c |   39 +++--
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index df421f5..1d3c02d 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -725,34 +725,35 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info 
*pm8001_ha)
sizeof(pm8001_ha-msix_entries[0]);
for (i = 0; i  max_entry ; i++)
pm8001_ha-msix_entries[i].entry = i;
-   rc = pci_enable_msix(pm8001_ha-pdev, pm8001_ha-msix_entries,
+   rc = pci_enable_msix_exact(pm8001_ha-pdev, pm8001_ha-msix_entries,
number_of_intr);
pm8001_ha-number_of_intr = number_of_intr;
-   if (!rc) {
-   PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
-   pci_enable_msix request ret:%d no of intr %d\n,
-   rc, pm8001_ha-number_of_intr));
+   if (rc)
+   return rc;
 
+   PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
+   pci_enable_msix_exact request ret:%d no of intr %d\n,
+   rc, pm8001_ha-number_of_intr));
 
-   for (i = 0; i  number_of_intr; i++) {
-   snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
-   DRV_NAME%d, i);
-   pm8001_ha-irq_vector[i].irq_id = i;
-   pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
+   for (i = 0; i  number_of_intr; i++) {
+   snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
+   DRV_NAME%d, i);
+   pm8001_ha-irq_vector[i].irq_id = i;
+   pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
 
-   rc = request_irq(pm8001_ha-msix_entries[i].vector,
-   pm8001_interrupt_handler_msix, flag,
-   intr_drvname[i], (pm8001_ha-irq_vector[i]));
-   if (rc) {
-   for (j = 0; j  i; j++)
-   free_irq(
-   pm8001_ha-msix_entries[j].vector,
+   rc = request_irq(pm8001_ha-msix_entries[i].vector,
+   pm8001_interrupt_handler_msix, flag,
+   intr_drvname[i], (pm8001_ha-irq_vector[i]));
+   if (rc) {
+   for (j = 0; j  i; j++) {
+   free_irq(pm8001_ha-msix_entries[j].vector,
(pm8001_ha-irq_vector[i]));
-   pci_disable_msix(pm8001_ha-pdev);
-   break;
}
+   pci_disable_msix(pm8001_ha-pdev);
+   break;
}
}
+
return rc;
 }
 #endif
-- 
1.7.7.6

--
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 v2 RESEND 21/23] qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Log message code 0x00c6 preserved, although it is reported
after successful call to pci_enable_msix_range(), not before
possibly unsuccessful call to pci_enable_msix(). Consumers
of the error code should not notice the difference.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: qla2xxx-upstr...@qlogic.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/qla2xxx/qla_isr.c |   27 +++
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 95314ef..41eb0dc 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2918,27 +2918,22 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
for (i = 0; i  ha-msix_count; i++)
entries[i].entry = i;
 
-   ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
-   if (ret) {
-   if (ret  MIN_MSIX_COUNT)
-   goto msix_failed;
-
+   ret = pci_enable_msix_range(ha-pdev,
+   entries, MIN_MSIX_COUNT, ha-msix_count);
+   if (ret  0) {
+   ql_log(ql_log_fatal, vha, 0x00c7,
+   MSI-X: Failed to enable support, 
+   giving   up -- %d/%d.\n,
+   ha-msix_count, ret);
+   goto msix_out;
+   } else if (ret  ha-msix_count) {
ql_log(ql_log_warn, vha, 0x00c6,
MSI-X: Failed to enable support 
-- %d/%d\n Retry with %d vectors.\n,
ha-msix_count, ret, ret);
-   ha-msix_count = ret;
-   ret = pci_enable_msix(ha-pdev, entries, ha-msix_count);
-   if (ret) {
-msix_failed:
-   ql_log(ql_log_fatal, vha, 0x00c7,
-   MSI-X: Failed to enable support, 
-   giving   up -- %d/%d.\n,
-   ha-msix_count, ret);
-   goto msix_out;
-   }
-   ha-max_rsp_queues = ha-msix_count - 1;
}
+   ha-msix_count = ret;
+   ha-max_rsp_queues = ha-msix_count - 1;
ha-msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
ha-msix_count, GFP_KERNEL);
if (!ha-msix_entries) {
-- 
1.7.7.6

--
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 v2 RESEND 19/23] pmcraid: Get rid of a redundant assignment

2014-04-14 Thread Alexander Gordeev
Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pmcraid.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index be8ce54..c06af7f 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4746,7 +4746,6 @@ pmcraid_isr_legacy:
pinstance-hrrq_vector[0].drv_inst = pinstance;
pinstance-hrrq_vector[0].vector = pdev-irq;
pinstance-num_hrrq = 1;
-   rc = 0;
 
rc = request_irq(pdev-irq, pmcraid_isr, IRQF_SHARED,
 PMCRAID_DRIVER_NAME, pinstance-hrrq_vector[0]);
-- 
1.7.7.6

--
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 v2 RESEND 20/23] pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pmcraid.c |   13 ++---
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index c06af7f..6d0f208 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4698,19 +4698,10 @@ pmcraid_register_interrupt_handler(struct 
pmcraid_instance *pinstance)
for (i = 0; i  PMCRAID_NUM_MSIX_VECTORS; i++)
entries[i].entry = i;
 
-   rc = pci_enable_msix(pdev, entries, num_hrrq);
-   if (rc  0)
+   num_hrrq = pci_enable_msix_range(pdev, entries, 1, num_hrrq);
+   if (num_hrrq  0)
goto pmcraid_isr_legacy;
 
-   /* Check how many MSIX vectors are allocated and register
-* msi-x handlers for each of them giving appropriate buffer
-*/
-   if (rc  0) {
-   num_hrrq = rc;
-   if (pci_enable_msix(pdev, entries, num_hrrq))
-   goto pmcraid_isr_legacy;
-   }
-
for (i = 0; i  num_hrrq; i++) {
pinstance-hrrq_vector[i].hrrq_id = i;
pinstance-hrrq_vector[i].drv_inst = pinstance;
-- 
1.7.7.6

--
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 v2 RESEND 15/23] mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
Cc: Sreekanth Reddy sreekanth.re...@lsi.com
Cc: supp...@lsi.com
Cc: dl-mptfusionli...@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/mpt2sas/mpt2sas_base.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
b/drivers/scsi/mpt2sas/mpt2sas_base.c
index bde63f7..984b605 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1432,10 +1432,10 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc)
for (i = 0, a = entries; i  ioc-reply_queue_count; i++, a++)
a-entry = i;
 
-   r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count);
+   r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count);
if (r) {
-   dfailprintk(ioc, printk(MPT2SAS_INFO_FMT pci_enable_msix 
-   failed (r=%d) !!!\n, ioc-name, r));
+   dfailprintk(ioc, printk(MPT2SAS_INFO_FMT
+   pci_enable_msix_exact failed (r=%d) !!!\n, ioc-name, r));
kfree(entries);
goto try_ioapic;
}
-- 
1.7.7.6

--
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 v2 RESEND 12/23] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: James Smart james.sm...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/lpfc/lpfc_init.c |   38 +-
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 7163f37..b109adc 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8100,9 +8100,9 @@ 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() is
- * called to enable the MSI-X vectors. Note that pci_enable_msix(), once
- * invoked, enables either all or nothing, depending on the current
+ * 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
  * for calling the individual request_irq() to register each MSI-X vector
  * with a interrupt handler, which is done in this function. Note that
@@ -8126,8 +8126,8 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
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));
+   rc = pci_enable_msix_exact(phba-pcidev, phba-msix_entries,
+  ARRAY_SIZE(phba-msix_entries));
if (rc) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
0420 PCI enable MSI-X failed (%d)\n, rc);
@@ -8664,15 +8664,13 @@ out:
  * @phba: pointer to lpfc hba data structure.
  *
  * This routine is invoked to enable the MSI-X interrupt vectors to device
- * with SLI-4 interface spec. The kernel function pci_enable_msix() is called
- * to enable the MSI-X vectors. Note that pci_enable_msix(), 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 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
+ * with SLI-4 interface spec. The kernel function pci_enable_msix_range()
+ * 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.
  *
  * Return codes
@@ -8694,18 +8692,16 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
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 vec_fail_out;
}
 
+   vectors = rc;
/* Log MSI-X vector assignment */
for (index = 0; index  vectors; index++)
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-- 
1.7.7.6

--
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 v2 RESEND 11/23] lpfc: Remove superfluous call to pci_disable_msix()

2014-04-14 Thread Alexander Gordeev
There is no need to call pci_disable_msix() in case
the previous call to pci_enable_msix() failed

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: James Smart james.sm...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: James Smart james.sm...@emulex.com
---
 drivers/scsi/lpfc/lpfc_init.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 635eeb3..7163f37 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8131,7 +8131,7 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
if (rc) {
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;
 }
 
@@ -8701,7 +8703,7 @@ enable_msix_vectors:
} else if (rc) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
0484 PCI enable MSI-X failed (%d)\n, rc);
-   goto msi_fail_out;
+   goto vec_fail_out;
}
 
/* Log MSI-X vector assignment */
@@ -8764,9 +8766,10 @@ cfg_fail_out:
 phba-sli4_hba.fcp_eq_hdl[index]);
}
 
-msi_fail_out:
/* Unconfigure MSI-X capability structure */
pci_disable_msix(phba-pcidev);
+
+vec_fail_out:
return rc;
 }
 
-- 
1.7.7.6

--
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 v2 RESEND 08/23] isci: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Lukasz Dorau lukasz.do...@intel.com
Cc: Maciej Patelczyk maciej.patelc...@intel.com
Cc: Dave Jiang dave.ji...@intel.com
Cc: intel-linux-...@intel.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/isci/init.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 695b34e..4198e45 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -356,7 +356,7 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
for (i = 0; i  num_msix; i++)
pci_info-msix_entries[i].entry = i;
 
-   err = pci_enable_msix(pdev, pci_info-msix_entries, num_msix);
+   err = pci_enable_msix_exact(pdev, pci_info-msix_entries, num_msix);
if (err)
goto intx;
 
-- 
1.7.7.6

--
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 v2 RESEND 06/23] csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Naresh Kumar Inna nar...@chelsio.com
Cc: Arvind Bhushan arvi...@chelsio.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/csiostor/csio_hw.h  |2 +-
 drivers/scsi/csiostor/csio_isr.c |   22 +-
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
index 49b1daa..5db2d85 100644
--- a/drivers/scsi/csiostor/csio_hw.h
+++ b/drivers/scsi/csiostor/csio_hw.h
@@ -94,7 +94,7 @@ enum {
 };
 
 struct csio_msix_entries {
-   unsigned short  vector; /* Vector assigned by pci_enable_msix */
+   unsigned short  vector; /* Assigned MSI-X vector */
void*dev_id;/* Priv object associated w/ this msix*/
chardesc[24];   /* Description of this vector */
 };
diff --git a/drivers/scsi/csiostor/csio_isr.c b/drivers/scsi/csiostor/csio_isr.c
index 91ba91d..a8c748a 100644
--- a/drivers/scsi/csiostor/csio_isr.c
+++ b/drivers/scsi/csiostor/csio_isr.c
@@ -499,7 +499,7 @@ csio_reduce_sqsets(struct csio_hw *hw, int cnt)
 static int
 csio_enable_msix(struct csio_hw *hw)
 {
-   int rv, i, j, k, n, min, cnt;
+   int i, j, k, n, min, cnt;
struct csio_msix_entries *entryp;
struct msix_entry *entries;
int extra = CSIO_EXTRA_VECS;
@@ -521,19 +521,15 @@ csio_enable_msix(struct csio_hw *hw)
 
csio_dbg(hw, FW supp #niq:%d, trying %d msix's\n, hw-cfg_niq, cnt);
 
-   while ((rv = pci_enable_msix(hw-pdev, entries, cnt)) = min)
-   cnt = rv;
-   if (!rv) {
-   if (cnt  (hw-num_sqsets + extra)) {
-   csio_dbg(hw, Reducing sqsets to %d\n, cnt - extra);
-   csio_reduce_sqsets(hw, cnt - extra);
-   }
-   } else {
-   if (rv  0)
-   csio_info(hw, Not using MSI-X, remainder:%d\n, rv);
-
+   cnt = pci_enable_msix_range(hw-pdev, entries, min, cnt);
+   if (cnt  0) {
kfree(entries);
-   return -ENOMEM;
+   return cnt;
+   }
+
+   if (cnt  (hw-num_sqsets + extra)) {
+   csio_dbg(hw, Reducing sqsets to %d\n, cnt - extra);
+   csio_reduce_sqsets(hw, cnt - extra);
}
 
/* Save off vectors */
-- 
1.7.7.6

--
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 v2 RESEND 02/23] bfa: Do not call pci_enable_msix() after it failed once

2014-04-14 Thread Alexander Gordeev
Function pci_enable_msix() should not be called in case
it threw a negative errno from a previous call.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Gurumurthy aguru...@brocade.com
Cc: Vijaya Mohan Guvva vmo...@brocade.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfad.c |   48 ++
 1 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index cc0fbcd..972ff8d 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1235,33 +1235,31 @@ bfad_setup_intr(struct bfad_s *bfad)
   (bfa_asic_id_cb(pdev-device)  !msix_disable_cb)) {
 
error = pci_enable_msix(bfad-pcidev, msix_entries, bfad-nvec);
-   if (error) {
-   /* In CT1  CT2, try to allocate just one vector */
-   if (bfa_asic_id_ctc(pdev-device)) {
-   printk(KERN_WARNING bfa %s: trying one msix 
-  vector failed to allocate %d[%d]\n,
-  bfad-pci_name, bfad-nvec, error);
-   bfad-nvec = 1;
-   error = pci_enable_msix(bfad-pcidev,
+   /* In CT1  CT2, try to allocate just one vector */
+   if (error  0  bfa_asic_id_ctc(pdev-device)) {
+   printk(KERN_WARNING bfa %s: trying one msix 
+  vector failed to allocate %d[%d]\n,
+  bfad-pci_name, bfad-nvec, error);
+   bfad-nvec = 1;
+   error = pci_enable_msix(bfad-pcidev,
msix_entries, bfad-nvec);
-   }
+   }
 
-   /*
-* Only error number of vector is available.
-* We don't have a mechanism to map multiple
-* interrupts into one vector, so even if we
-* can try to request less vectors, we don't
-* know how to associate interrupt events to
-*  vectors. Linux doesn't duplicate vectors
-* in the MSIX table for this case.
-*/
-   if (error) {
-   printk(KERN_WARNING bfad%d: 
-  pci_enable_msix failed (%d), 
-  use line based.\n,
-   bfad-inst_no, error);
-   goto line_based;
-   }
+   /*
+* Only error number of vector is available.
+* We don't have a mechanism to map multiple
+* interrupts into one vector, so even if we
+* can try to request less vectors, we don't
+* know how to associate interrupt events to
+*  vectors. Linux doesn't duplicate vectors
+* in the MSIX table for this case.
+*/
+   if (error) {
+   printk(KERN_WARNING bfad%d: 
+  pci_enable_msix failed (%d), 
+  use line based.\n,
+   bfad-inst_no, error);
+   goto line_based;
}
 
/* Disable INTX in MSI-X mode */
-- 
1.7.7.6

--
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 v2 RESEND 05/23] csiostor: Remove superfluous call to pci_disable_msix()

2014-04-14 Thread Alexander Gordeev
There is no need to call pci_disable_msix() in case
the previous call to pci_enable_msix() failed

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Naresh Kumar Inna nar...@chelsio.com
Cc: Arvind Bhushan arvi...@chelsio.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/csiostor/csio_isr.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_isr.c b/drivers/scsi/csiostor/csio_isr.c
index 7ee9777..91ba91d 100644
--- a/drivers/scsi/csiostor/csio_isr.c
+++ b/drivers/scsi/csiostor/csio_isr.c
@@ -529,10 +529,8 @@ csio_enable_msix(struct csio_hw *hw)
csio_reduce_sqsets(hw, cnt - extra);
}
} else {
-   if (rv  0) {
-   pci_disable_msix(hw-pdev);
+   if (rv  0)
csio_info(hw, Not using MSI-X, remainder:%d\n, rv);
-   }
 
kfree(entries);
return -ENOMEM;
-- 
1.7.7.6

--
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 v2 RESEND 04/23] bfa: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Gurumurthy aguru...@brocade.com
Cc: Vijaya Mohan Guvva vmo...@brocade.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/bfa/bfad.c |   20 ++--
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index e7e4774..839c81c 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1234,29 +1234,21 @@ bfad_setup_intr(struct bfad_s *bfad)
if ((bfa_asic_id_ctc(pdev-device)  !msix_disable_ct) ||
   (bfa_asic_id_cb(pdev-device)  !msix_disable_cb)) {
 
-   error = pci_enable_msix(bfad-pcidev, msix_entries, bfad-nvec);
+   error = pci_enable_msix_exact(bfad-pcidev,
+ msix_entries, bfad-nvec);
/* In CT1  CT2, try to allocate just one vector */
-   if (error  0  bfa_asic_id_ctc(pdev-device)) {
+   if (error == -ENOSPC  bfa_asic_id_ctc(pdev-device)) {
printk(KERN_WARNING bfa %s: trying one msix 
   vector failed to allocate %d[%d]\n,
   bfad-pci_name, bfad-nvec, error);
bfad-nvec = 1;
-   error = pci_enable_msix(bfad-pcidev,
-   msix_entries, bfad-nvec);
+   error = pci_enable_msix_exact(bfad-pcidev,
+ msix_entries, 1);
}
 
-   /*
-* Only error number of vector is available.
-* We don't have a mechanism to map multiple
-* interrupts into one vector, so even if we
-* can try to request less vectors, we don't
-* know how to associate interrupt events to
-*  vectors. Linux doesn't duplicate vectors
-* in the MSIX table for this case.
-*/
if (error) {
printk(KERN_WARNING bfad%d: 
-  pci_enable_msix failed (%d), 
+  pci_enable_msix_exact failed (%d), 
   use line based.\n,
bfad-inst_no, error);
goto line_based;
-- 
1.7.7.6

--
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 v2 RESEND 03/23] bfa: Cleanup bfad_setup_intr() function

2014-04-14 Thread Alexander Gordeev
Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Gurumurthy aguru...@brocade.com
Cc: Vijaya Mohan Guvva vmo...@brocade.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Anil Gurumurthy anil.gurumur...@qlogic.com
---
 drivers/scsi/bfa/bfad.c |   18 --
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 972ff8d..e7e4774 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1219,7 +1219,7 @@ bfad_install_msix_handler(struct bfad_s *bfad)
 int
 bfad_setup_intr(struct bfad_s *bfad)
 {
-   int error = 0;
+   int error;
u32 mask = 0, i, num_bit = 0, max_bit = 0;
struct msix_entry msix_entries[MAX_MSIX_ENTRY];
struct pci_dev *pdev = bfad-pcidev;
@@ -1279,20 +1279,18 @@ bfad_setup_intr(struct bfad_s *bfad)
 
bfad-bfad_flags |= BFAD_MSIX_ON;
 
-   return error;
+   return 0;
}
 
 line_based:
-   error = 0;
-   if (request_irq
-   (bfad-pcidev-irq, (irq_handler_t) bfad_intx, BFAD_IRQ_FLAGS,
-BFAD_DRIVER_NAME, bfad) != 0) {
-   /* Enable interrupt handler failed */
-   return 1;
-   }
+   error = request_irq(bfad-pcidev-irq, (irq_handler_t)bfad_intx,
+   BFAD_IRQ_FLAGS, BFAD_DRIVER_NAME, bfad);
+   if (error)
+   return error;
+
bfad-bfad_flags |= BFAD_INTX_ON;
 
-   return error;
+   return 0;
 }
 
 void
-- 
1.7.7.6

--
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 v2 RESEND 01/23] be2iscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Jayamohan Kallickal jayamohan.kallic...@emulex.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Jayamohan Kallickal jayamohan.kallic...@emulex.com
---
 drivers/scsi/be2iscsi/be_main.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 0d82229..279b2f9 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5282,12 +5282,10 @@ static void beiscsi_msix_enable(struct beiscsi_hba 
*phba)
for (i = 0; i = phba-num_cpus; i++)
phba-msix_entries[i].entry = i;
 
-   status = pci_enable_msix(phba-pcidev, phba-msix_entries,
-(phba-num_cpus + 1));
+   status = pci_enable_msix_exact(phba-pcidev, phba-msix_entries,
+  phba-num_cpus + 1);
if (!status)
phba-msix_enabled = true;
-
-   return;
 }
 
 /*
-- 
1.7.7.6

--
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 v2 RESEND 00/23] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-04-14 Thread Alexander Gordeev
Hello,

This series is against 3.15-rc1.

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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

There are no major changes in this series since I posted
it last time.

Thanks!

Cc: iss_storage...@hp.com
Cc: intel-linux-...@intel.com
Cc: supp...@lsi.com
Cc: dl-mptfusionli...@lsi.com
Cc: qla2xxx-upstr...@qlogic.com
Cc: iscsi-dri...@qlogic.com
Cc: pv-driv...@vmware.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org


Alexander Gordeev (23):
  be2iscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()
  bfa: Do not call pci_enable_msix() after it failed once
  bfa: Cleanup bfad_setup_intr() function
  bfa: Use pci_enable_msix_exact() instead of pci_enable_msix()
  csiostor: Remove superfluous call to pci_disable_msix()
  csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()
  fnic: Use pci_enable_msix_exact() instead of pci_enable_msix()
  isci: Use pci_enable_msix_exact() instead of pci_enable_msix()
  hpsa: Fallback to MSI rather than to INTx if MSI-X failed
  hpsa: Use pci_enable_msix_range() instead of pci_enable_msix()
  lpfc: Remove superfluous call to pci_disable_msix()
  lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()
  megaraid: Fail resume if MSI-X re-initialization failed
  megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()
  mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
  mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
  pm8001: Fix invalid return when request_irq() failed
  pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()
  pmcraid: Get rid of a redundant assignment
  pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()
  qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()
  qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()
  vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()

 drivers/scsi/be2iscsi/be_main.c   |6 +--
 drivers/scsi/bfa/bfad.c   |   62 -
 drivers/scsi/csiostor/csio_hw.h   |2 +-
 drivers/scsi/csiostor/csio_isr.c  |   24 ---
 drivers/scsi/fnic/fnic_isr.c  |4 +-
 drivers/scsi/hpsa.c   |   30 ++
 drivers/scsi/isci/init.c  |2 +-
 drivers/scsi/lpfc/lpfc_init.c |   47 +++---
 drivers/scsi/megaraid/megaraid_sas_base.c |   24 +--
 drivers/scsi/mpt2sas/mpt2sas_base.c   |6 +-
 drivers/scsi/mpt3sas/mpt3sas_base.c   |4 +-
 drivers/scsi/pm8001/pm8001_init.c |   44 +++--
 drivers/scsi/pmcraid.c|   14 +--
 drivers/scsi/qla2xxx/qla_isr.c|   27 +---
 drivers/scsi/qla4xxx/ql4_nx.c |2 +-
 drivers/scsi/vmw_pvscsi.c |2 +-
 16 files changed, 129 insertions(+), 171 deletions(-)

-- 
1.7.7.6

--
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 v2 00/23] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-04-02 Thread Alexander Gordeev
On Wed, Mar 12, 2014 at 10:04:40PM -0600, Bjorn Helgaas wrote:
 Hi James,
 
 I think Alexander sent these to linux-scsi hoping that you would handle
 them, but I know it's a hassle because they depend on f7fc32c, which went
 in after the merge window.
 
 I'd be glad to review these and apply them through my tree, unless you want
 to do it.  I'd like to get these merged in the v3.15 merge window so
 Alexander can move on to something else.  I haven't checked for merge
 conflicts with scsi.git yet, but I assume they'd be pretty trivial if there
 are any.

Hi Bjorn,

It has shifted to v3.16, right?

 Bjorn

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 00/23] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-02-25 Thread Alexander Gordeev
On Mon, Feb 24, 2014 at 09:02:00AM +0100, Alexander Gordeev wrote:
 This series is against James Bottomley's SCSI tree [1], but it needs
 commit f7fc32c (PCI/MSI: Add pci_enable_msi_exact() and
 pci_enable_msix_exact()) from from Bjorn Helgaas's PCI tree [2]:

The prerequisite commit 3ce4e86 is in 3.14-rc4 now.

-- 
Regards,
Alexander Gordeev
agord...@redhat.com
--
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 v2 04/23] bfa: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-02-24 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Gurumurthy aguru...@brocade.com
Cc: Vijaya Mohan Guvva vmo...@brocade.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/bfa/bfad.c |   18 +-
 1 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index e7e4774..b7b0733 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1234,26 +1234,18 @@ bfad_setup_intr(struct bfad_s *bfad)
if ((bfa_asic_id_ctc(pdev-device)  !msix_disable_ct) ||
   (bfa_asic_id_cb(pdev-device)  !msix_disable_cb)) {
 
-   error = pci_enable_msix(bfad-pcidev, msix_entries, bfad-nvec);
+   error = pci_enable_msix_exact(bfad-pcidev,
+ msix_entries, bfad-nvec);
/* In CT1  CT2, try to allocate just one vector */
-   if (error  0  bfa_asic_id_ctc(pdev-device)) {
+   if (error == -ENOSPC  bfa_asic_id_ctc(pdev-device)) {
printk(KERN_WARNING bfa %s: trying one msix 
   vector failed to allocate %d[%d]\n,
   bfad-pci_name, bfad-nvec, error);
bfad-nvec = 1;
-   error = pci_enable_msix(bfad-pcidev,
-   msix_entries, bfad-nvec);
+   error = pci_enable_msix_exact(bfad-pcidev,
+ msix_entries, 1);
}
 
-   /*
-* Only error number of vector is available.
-* We don't have a mechanism to map multiple
-* interrupts into one vector, so even if we
-* can try to request less vectors, we don't
-* know how to associate interrupt events to
-*  vectors. Linux doesn't duplicate vectors
-* in the MSIX table for this case.
-*/
if (error) {
printk(KERN_WARNING bfad%d: 
   pci_enable_msix failed (%d), 
-- 
1.7.7.6

--
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 v2 23/23] vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-02-24 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Arvind Kumar arvindku...@vmware.com
Cc: pv-driv...@vmware.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/vmw_pvscsi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index b9755ec..a046618 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -1078,7 +1078,7 @@ static int pvscsi_setup_msix(const struct pvscsi_adapter 
*adapter,
struct msix_entry entry = { 0, PVSCSI_VECTOR_COMPLETION };
int ret;
 
-   ret = pci_enable_msix(adapter-dev, entry, 1);
+   ret = pci_enable_msix_exact(adapter-dev, entry, 1);
if (ret)
return ret;
 
-- 
1.7.7.6

--
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 v2 09/23] hpsa: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-02-24 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/hpsa.c |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 52cfd19..523a60e 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4169,7 +4169,7 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
goto default_int_mode;
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSIX)) {
dev_info(h-pdev-dev, MSIX\n);
-   err = pci_enable_msix(h-pdev, hpsa_msix_entries,
+   err = pci_enable_msix_exact(h-pdev, hpsa_msix_entries,
MAX_REPLY_QUEUES);
if (!err) {
for (i = 0; i  MAX_REPLY_QUEUES; i++)
@@ -4177,13 +4177,7 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
h-msix_vector = 1;
return;
}
-   if (err  0) {
-   dev_warn(h-pdev-dev, only %d MSI-X vectors 
-  available\n, err);
-   } else {
-   dev_warn(h-pdev-dev, MSI-X init failed %d\n,
-  err);
-   }
+   dev_warn(h-pdev-dev, MSI-X init failed %d\n, err);
}
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
dev_info(h-pdev-dev, MSI\n);
-- 
1.7.7.6

--
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 v2 08/23] hpsa: Fallback to MSI rather than to INTx if MSI-X failed

2014-02-24 Thread Alexander Gordeev
Currently the driver falls back to INTx mode when MSI-X
initialization failed. This is a suboptimal behaviour
for chips that also support MSI. This update changes that
behaviour and falls back to MSI mode in case MSI-X mode
initialization failed.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Stephen M. Cameron scame...@beardog.cce.hp.com
Cc: iss_storage...@hp.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/hpsa.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 868318a..52cfd19 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4180,11 +4180,9 @@ static void hpsa_interrupt_mode(struct ctlr_info *h)
if (err  0) {
dev_warn(h-pdev-dev, only %d MSI-X vectors 
   available\n, err);
-   goto default_int_mode;
} else {
dev_warn(h-pdev-dev, MSI-X init failed %d\n,
   err);
-   goto default_int_mode;
}
}
if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) {
-- 
1.7.7.6

--
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 v2 17/23] pm8001: Fix invalid return when request_irq() failed

2014-02-24 Thread Alexander Gordeev
When a call to request_irq() failed pm8001_setup_msix()
still returns the success. This udate fixes the described
misbehaviour.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: xjtu...@gmail.com
Cc: lindar_...@usish.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
Acked-by: Jack Wang xjtu...@gmail.com
---
 drivers/scsi/pm8001/pm8001_init.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index 73a120d..efffbb9 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -739,9 +739,10 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info 
*pm8001_ha)
pm8001_ha-irq_vector[i].irq_id = i;
pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
 
-   if (request_irq(pm8001_ha-msix_entries[i].vector,
+   rc = request_irq(pm8001_ha-msix_entries[i].vector,
pm8001_interrupt_handler_msix, flag,
-   intr_drvname[i], (pm8001_ha-irq_vector[i]))) {
+   intr_drvname[i], (pm8001_ha-irq_vector[i]));
+   if (rc) {
for (j = 0; j  i; j++)
free_irq(
pm8001_ha-msix_entries[j].vector,
-- 
1.7.7.6

--
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 v2 18/23] pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-02-24 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: xjtu...@gmail.com
Cc: lindar_...@usish.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pm8001/pm8001_init.c |   39 +++--
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index efffbb9..0aa9059 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -724,34 +724,35 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info 
*pm8001_ha)
sizeof(pm8001_ha-msix_entries[0]);
for (i = 0; i  max_entry ; i++)
pm8001_ha-msix_entries[i].entry = i;
-   rc = pci_enable_msix(pm8001_ha-pdev, pm8001_ha-msix_entries,
+   rc = pci_enable_msix_exact(pm8001_ha-pdev, pm8001_ha-msix_entries,
number_of_intr);
pm8001_ha-number_of_intr = number_of_intr;
-   if (!rc) {
-   PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
-   pci_enable_msix request ret:%d no of intr %d\n,
-   rc, pm8001_ha-number_of_intr));
+   if (rc)
+   return rc;
 
+   PM8001_INIT_DBG(pm8001_ha, pm8001_printk(
+   pci_enable_msix_exact request ret:%d no of intr %d\n,
+   rc, pm8001_ha-number_of_intr));
 
-   for (i = 0; i  number_of_intr; i++) {
-   snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
-   DRV_NAME%d, i);
-   pm8001_ha-irq_vector[i].irq_id = i;
-   pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
+   for (i = 0; i  number_of_intr; i++) {
+   snprintf(intr_drvname[i], sizeof(intr_drvname[0]),
+   DRV_NAME%d, i);
+   pm8001_ha-irq_vector[i].irq_id = i;
+   pm8001_ha-irq_vector[i].drv_inst = pm8001_ha;
 
-   rc = request_irq(pm8001_ha-msix_entries[i].vector,
-   pm8001_interrupt_handler_msix, flag,
-   intr_drvname[i], (pm8001_ha-irq_vector[i]));
-   if (rc) {
-   for (j = 0; j  i; j++)
-   free_irq(
-   pm8001_ha-msix_entries[j].vector,
+   rc = request_irq(pm8001_ha-msix_entries[i].vector,
+   pm8001_interrupt_handler_msix, flag,
+   intr_drvname[i], (pm8001_ha-irq_vector[i]));
+   if (rc) {
+   for (j = 0; j  i; j++) {
+   free_irq(pm8001_ha-msix_entries[j].vector,
(pm8001_ha-irq_vector[i]));
-   pci_disable_msix(pm8001_ha-pdev);
-   break;
}
+   pci_disable_msix(pm8001_ha-pdev);
+   break;
}
}
+
return rc;
 }
 #endif
-- 
1.7.7.6

--
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 v2 22/23] qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()

2014-02-24 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Vikas Chaudhary vikas.chaudh...@qlogic.com
Cc: iscsi-dri...@qlogic.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/qla4xxx/ql4_nx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index d001202..2cfcfbf 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -3805,7 +3805,7 @@ qla4_8xxx_enable_msix(struct scsi_qla_host *ha)
for (i = 0; i  QLA_MSIX_ENTRIES; i++)
entries[i].entry = qla4_8xxx_msix_entries[i].entry;
 
-   ret = pci_enable_msix(ha-pdev, entries, ARRAY_SIZE(entries));
+   ret = pci_enable_msix_exact(ha-pdev, entries, ARRAY_SIZE(entries));
if (ret) {
ql4_printk(KERN_WARNING, ha,
MSI-X: Failed to enable support -- %d/%d\n,
-- 
1.7.7.6

--
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 v2 20/23] pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-02-24 Thread Alexander Gordeev
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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pmcraid.c |   13 ++---
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index c06af7f..6d0f208 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4698,19 +4698,10 @@ pmcraid_register_interrupt_handler(struct 
pmcraid_instance *pinstance)
for (i = 0; i  PMCRAID_NUM_MSIX_VECTORS; i++)
entries[i].entry = i;
 
-   rc = pci_enable_msix(pdev, entries, num_hrrq);
-   if (rc  0)
+   num_hrrq = pci_enable_msix_range(pdev, entries, 1, num_hrrq);
+   if (num_hrrq  0)
goto pmcraid_isr_legacy;
 
-   /* Check how many MSIX vectors are allocated and register
-* msi-x handlers for each of them giving appropriate buffer
-*/
-   if (rc  0) {
-   num_hrrq = rc;
-   if (pci_enable_msix(pdev, entries, num_hrrq))
-   goto pmcraid_isr_legacy;
-   }
-
for (i = 0; i  num_hrrq; i++) {
pinstance-hrrq_vector[i].hrrq_id = i;
pinstance-hrrq_vector[i].drv_inst = pinstance;
-- 
1.7.7.6

--
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 v2 19/23] pmcraid: Get rid of a redundant assignment

2014-02-24 Thread Alexander Gordeev
Signed-off-by: Alexander Gordeev agord...@redhat.com
Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com
Cc: linux-scsi@vger.kernel.org
Cc: linux-...@vger.kernel.org
---
 drivers/scsi/pmcraid.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index be8ce54..c06af7f 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4746,7 +4746,6 @@ pmcraid_isr_legacy:
pinstance-hrrq_vector[0].drv_inst = pinstance;
pinstance-hrrq_vector[0].vector = pdev-irq;
pinstance-num_hrrq = 1;
-   rc = 0;
 
rc = request_irq(pdev-irq, pmcraid_isr, IRQF_SHARED,
 PMCRAID_DRIVER_NAME, pinstance-hrrq_vector[0]);
-- 
1.7.7.6

--
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


  1   2   3   >