Skip to contentSkip to conversation

scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

PATCH Applied Alexander Gordeev 4 participants 30 messages Aug 18, 2014 – Sep 4, 2014

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

v3 cover scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

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 <[email protected]>
Cc James Smart <[email protected]>
Cc Naresh Kumar Inna <[email protected]>
Cc Arvind Bhushan <[email protected]>
Cc Jayamohan Kallickal <[email protected]>
Cc Chad Dupuis <[email protected]>
Cc Tomas Henzl <[email protected]>
Cc Nagalakshmi Nandigama <[email protected]>
Cc Sreekanth Reddy <[email protected]>
Cc Kashyap Desai <[email protected]>
Cc Neela Syam Kolli <[email protected]>
Cc "Stephen M. Cameron" <[email protected]>

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(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH v3 1/13 hpsa: Fallback to MSI rather than to INTx if MSI-X failed

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.

---
 drivers/scsi/hpsa.c | 1 -
 1 file changed, 1 deletion(-)
drivers/scsi/hpsa.c +0 -1
index 6b35d0d..a9c4c9f 100644
@@ -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)) {
Signature · 1 line
1.9.3
#2 lore raw

PATCH v3 2/13 hpsa: Use pci_enable_msix_range() instead of pci_enable_msix()

In reply to 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.

---
 drivers/scsi/hpsa.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)
drivers/scsi/hpsa.c +12 -15
index a9c4c9f..8c17c43 100644
@@ -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))
Signature · 1 line
1.9.3
#3 lore raw

PATCH v3 3/13 megaraid: Fail resume if MSI-X re-initialization failed

In reply to 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.

---
 drivers/scsi/megaraid/megaraid_sas_base.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +5 -3
index 22a04e3..e4ffae5 100644
@@ -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);
 
Signature · 1 line
1.9.3
#4 lore raw

PATCH v3 4/13 megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()

In reply to 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.

---
 drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +7 -13
index e4ffae5..a2f4d4f 100644
@@ -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) {
Signature · 1 line
1.9.3
#5 lore raw

PATCH v3 5/13 mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

In reply to 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.

---
 drivers/scsi/mpt2sas/mpt2sas_base.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_base.c +3 -3
index 2f262be..cf51b48 100644
@@ -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;
 	}
Signature · 1 line
1.9.3
#6 lore raw

PATCH v3 6/13 mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()

In reply to 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.

---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +2 -2
index 93ce2b2..09e6b21 100644
@@ -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;
Signature · 1 line
1.9.3
#7 lore raw

PATCH v3 7/13 qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()

In reply to 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.

---
 drivers/scsi/qla2xxx/qla_isr.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +11 -16
index 550a4a3..a485578 100644
@@ -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) {
Signature · 1 line
1.9.3
#8 lore raw

PATCH v3 8/13 be2iscsi: Use pci_enable_msix_range()

In reply to 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.

---
 drivers/scsi/be2iscsi/be_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/be2iscsi/be_main.c +3 -3
index 915c26b..b422659 100644
@@ -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;
Signature · 1 line
1.9.3
Reviewed-by on v3 8/13
#9 lore raw

Re: [PATCH v3 08/13] be2iscsi: Use pci_enable_msix_range()

Quoted 5 lines · 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.

Patch looks good to me.

Quoted 25 lines
---
 drivers/scsi/be2iscsi/be_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/be2iscsi/be_main.c +3 -3
index 915c26b..b422659 100644
@@ -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;
Reviewed-by Tomas Henzl Acked-by
#10 lore raw

RE: [PATCH v3 08/13] be2iscsi: Use pci_enable_msix_range()

-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Thursday, August 21, 2014 4:10 AM
To: Alexander Gordeev; [email protected]
Cc: Jayamohan Kallickal; [email protected]; [email protected]
Subject: Re: [PATCH v3 08/13] be2iscsi: Use pci_enable_msix_range()

Quoted 4 lines · 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.

Patch looks good to me.

Quoted 15 lines
---
 drivers/scsi/be2iscsi/be_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/scsi/be2iscsi/be_main.c index 915c26b..b422659 100644

drivers/scsi/be2iscsi/be_main.c +0 -0
@@ -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;

drivers/scsi/be2iscsi/be_main.c static void beiscsi_msix_enable(struct beiscsi_hba *phba) · line 5284

Quoted 10 lines
drivers/scsi/be2iscsi/be_main.c +3 -3
 
-	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;

Looks Good.

--

#11 lore raw

PATCH v3 9/13 csiostor: Remove superfluous call to pci_disable_msix()

In reply to Alexander Gordeev

There is no need to call pci_disable_msix() in case the previous call to pci_enable_msix() failed

---
 drivers/scsi/csiostor/csio_isr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/csiostor/csio_isr.c +1 -3
index 7ee9777..91ba91d 100644
@@ -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;
Signature · 1 line
1.9.3
Reviewed-by on v3 9/13
#12 lore raw

Re: [PATCH v3 09/13] csiostor: Remove superfluous call to pci_disable_msix()

Quoted 2 lines · Alexander Gordeev

There is no need to call pci_disable_msix() in case the previous call to pci_enable_msix() failed

Patch looks good to me.

#13 lore raw

PATCH v3 10/13 csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()

In reply to 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.

---
 drivers/scsi/csiostor/csio_hw.h  |  2 +-
 drivers/scsi/csiostor/csio_isr.c | 22 +++++++++-------------
 2 files changed, 10 insertions(+), 14 deletions(-)
drivers/scsi/csiostor/csio_hw.h +1 -1
index 49b1daa..5db2d85 100644
@@ -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*/
 	char		desc[24];	/* Description of this vector */
 };
drivers/scsi/csiostor/csio_isr.c +9 -13
index 91ba91d..a8c748a 100644
@@ -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 */
Signature · 1 line
1.9.3
Reviewed-by on v3 10/13
#14 lore raw

Re: [PATCH v3 10/13] csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()

Quoted 6 lines · 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.

Patch looks good to me.

#15 lore raw

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

In reply to 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.

---
 drivers/scsi/lpfc/lpfc_init.c | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +17 -22
index a5769a9..37f2a20 100644
@@ -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++)
Signature · 1 line
1.9.3
#16 lore raw

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

Quoted 33 lines · 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.

---
 drivers/scsi/lpfc/lpfc_init.c | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +3 -3
index a5769a9..37f2a20 100644
@@ -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

drivers/scsi/lpfc/lpfc_init.c lpfc_sli_enable_msix(struct lpfc_hba *phba) · line 8244

Quoted 10 lines
drivers/scsi/lpfc/lpfc_init.c +2 -2
@@ -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);

Hi Alexander

the code continues with:
goto -> pci_disable_msix(phba->pcidev);
that call to disable_msix is also superfluous I think shouldn't that be fixed too?
the same is also in lpfc_sli4_enable_msix

Tomas

Quoted 47 lines
drivers/scsi/lpfc/lpfc_init.c +12 -17
@@ -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++)
Reviewed-by
#17 lore raw

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

Quoted 46 lines · Tomas Henzl
Quoted 33 lines · 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.

---
 drivers/scsi/lpfc/lpfc_init.c | 39 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 22 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +3 -3
index a5769a9..37f2a20 100644
@@ -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

drivers/scsi/lpfc/lpfc_init.c lpfc_sli_enable_msix(struct lpfc_hba *phba) · line 8244

Quoted 10 lines
drivers/scsi/lpfc/lpfc_init.c +2 -2
@@ -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);

Hi Alexander

Quoted 7 lines

the code continues with:
goto -> pci_disable_msix(phba->pcidev);
that call to disable_msix is also superfluous I think shouldn't that be fixed too?
the same is also in lpfc_sli4_enable_msix

Tomas

my bad, this was already fixed in
commit 029165acfa611a3a8838723f6978586ae35ff53d lpfc: Remove superfluous call to pci_disable_msix()

so patch looks good to me now

Reviewed-by Tomas Henzl
Quoted 52 lines
Quoted 38 lines
drivers/scsi/lpfc/lpfc_init.c +9 -17
@@ -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,

drivers/scsi/lpfc/lpfc_init.c lpfc_sli4_enable_msix(struct lpfc_hba *phba) · line 8816

Quoted 10 lines
drivers/scsi/lpfc/lpfc_init.c +3 -0
+				   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++)

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

#18 lore raw

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

Quoted 4 lines · Tomas Henzl

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!

Quoted 1 line
Reviewed-by Tomas Henzl

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

James?

Thanks!

Signature · 3 lines
Regards,
Alexander Gordeev
[email protected]
#19 lore raw

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

Quoted 4 lines · Alexander Gordeev
Quoted 1 line
Reviewed-by Tomas Henzl

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

You're referring to James Smart here, right? For an actively maintained driver like lpfc I'd like it be acked by the maintainer indeed. In fact for lpfc I have an agreement with James that he'll pick up lpfc patches and sent the colleted patches on to me.

#20 lore raw

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

In reply to Alexander Gordeev
Quoted 6 lines · 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.

James?

Signature · 3 lines
Regards,
Alexander Gordeev
[email protected]
#21 lore raw

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

Quoted 9 lines · Alexander Gordeev
Quoted 6 lines · 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.

James?

It's part of the lpfc update he recently sent out. It's high up on my list of things to review.

#22 lore raw

PATCH v3 12/13 pmcraid: Get rid of a redundant assignment

In reply to Alexander Gordeev
---
 drivers/scsi/pmcraid.c | 1 -
 1 file changed, 1 deletion(-)
drivers/scsi/pmcraid.c +0 -1
index 6f3275d..6e575ed 100644
@@ -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]);
Signature · 1 line
1.9.3
Reviewed-by on v3 12/13
#23 lore raw

Re: [PATCH v3 12/13] pmcraid: Get rid of a redundant assignment

Quoted 13 lines · Alexander Gordeev
---
 drivers/scsi/pmcraid.c | 1 -
 1 file changed, 1 deletion(-)
drivers/scsi/pmcraid.c +0 -0
index 6f3275d..6e575ed 100644

drivers/scsi/pmcraid.c pmcraid_isr_legacy: · line 4751

Quoted 7 lines
drivers/scsi/pmcraid.c +0 -1
@@ -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]);

Patch looks good to me.

#24 lore raw

PATCH v3 13/13 pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()

In reply to 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.

---
 drivers/scsi/pmcraid.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/scsi/pmcraid.c +2 -11
index 6e575ed..bcb64eb 100644
@@ -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;
Signature · 1 line
1.9.3
Reviewed-by on v3 13/13
#25 lore raw

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

Quoted 6 lines · 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.

Patch looks good.

#27 lore raw
Quoted 3 lines · Christoph Hellwig

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.

Signature · 3 lines
Regards,
Alexander Gordeev
[email protected]
#28 lore raw
Quoted 7 lines · Alexander Gordeev
Quoted 1 line

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.

I've added Tomas to the Cc list who has been very helpful with reviewing drivers lately. Tomas, can you take a quick look at these patches?