diff mbox

[net-next,28/35] qlcnic: Use pci_enable_msix_range() instead of pci_enable_msix()

Message ID cb8eb41f672c62d1149c375bdaf97ca3328703f9.1392717503.git.agordeev@redhat.com
State Not Applicable
Headers show

Commit Message

Alexander Gordeev Feb. 18, 2014, 10:11 a.m. UTC
As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Himanshu Madhani <himanshu.madhani@qlogic.com>
Cc: Rajesh Borundia <rajesh.borundia@qlogic.com>
Cc: Shahed Shaikh <shahed.shaikh@qlogic.com>
Cc: linux-driver@qlogic.com
Cc: netdev@vger.kernel.org
Cc: linux-pci@vger.kernel.org
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Comments

Ben Hutchings Feb. 22, 2014, 12:44 a.m. UTC | #1
On Tue, 2014-02-18 at 11:11 +0100, 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() and pci_enable_msix_range()
> interfaces.
> 
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> Cc: Himanshu Madhani <himanshu.madhani@qlogic.com>
> Cc: Rajesh Borundia <rajesh.borundia@qlogic.com>
> Cc: Shahed Shaikh <shahed.shaikh@qlogic.com>
> Cc: linux-driver@qlogic.com
> Cc: netdev@vger.kernel.org
> Cc: linux-pci@vger.kernel.org
> ---
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> index 0c077cf..e07fd94 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> @@ -701,13 +701,17 @@ enable_msix:
>  		for (vector = 0; vector < num_msix; vector++)
>  			adapter->msix_entries[vector].entry = vector;
>  
> -		err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
> -		if (err == 0) {
> +		err = pci_enable_msix_range(pdev,
> +					    adapter->msix_entries, 1, num_msix);
> +
> +		if (err == num_msix) {
>  			adapter->flags |= QLCNIC_MSIX_ENABLED;
>  			adapter->ahw->num_msix = num_msix;
>  			dev_info(&pdev->dev, "using msi-x interrupts\n");
>  			return 0;
>  		} else if (err > 0) {
> +			pci_disable_msix(pdev);
> +
>  			dev_info(&pdev->dev,
>  				 "Unable to allocate %d MSI-X vectors, Available vectors %d\n",
>  				 num_msix, err);

Well this log message is nonsense - we have no idea how many vectors are
available any more.

You should remove this and the retry loop that is no longer needed.

Ben.
Ben Hutchings Feb. 22, 2014, 12:48 a.m. UTC | #2
On Sat, 2014-02-22 at 00:44 +0000, Ben Hutchings wrote:
> On Tue, 2014-02-18 at 11:11 +0100, 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() and pci_enable_msix_range()
> > interfaces.
[...]
> > --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > @@ -701,13 +701,17 @@ enable_msix:
> >  		for (vector = 0; vector < num_msix; vector++)
> >  			adapter->msix_entries[vector].entry = vector;
> >  
> > -		err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
> > -		if (err == 0) {
> > +		err = pci_enable_msix_range(pdev,
> > +					    adapter->msix_entries, 1, num_msix);
> > +
> > +		if (err == num_msix) {
> >  			adapter->flags |= QLCNIC_MSIX_ENABLED;
> >  			adapter->ahw->num_msix = num_msix;
> >  			dev_info(&pdev->dev, "using msi-x interrupts\n");
> >  			return 0;
> >  		} else if (err > 0) {
> > +			pci_disable_msix(pdev);
> > +
> >  			dev_info(&pdev->dev,
> >  				 "Unable to allocate %d MSI-X vectors, Available vectors %d\n",
> >  				 num_msix, err);
> 
> Well this log message is nonsense - we have no idea how many vectors are
> available any more.
> 
> You should remove this and the retry loop that is no longer needed.

Sorry, I'm confused and this does work.  But I wonder whether it is
really an improvement over using the old API.

Ben.
Alexander Gordeev Feb. 22, 2014, 9:24 a.m. UTC | #3
On Sat, Feb 22, 2014 at 12:48:47AM +0000, Ben Hutchings wrote:
> Sorry, I'm confused and this does work.  But I wonder whether it is
> really an improvement over using the old API.

Slightly, as far as I am concerned - we just exchange tri-state oddity
to re-enable MSI-X oddity. We're not going to improve drivers that can
not work with any number of MSI-Xs from a range, like this one.

> Ben.
Shahed Shaikh Feb. 22, 2014, 4:18 p.m. UTC | #4
> -----Original Message-----
> From: Alexander Gordeev [mailto:agordeev@redhat.com]
> Sent: Saturday, February 22, 2014 2:54 PM
> To: Ben Hutchings
> Cc: linux-kernel; Himanshu Madhani; Rajesh Borundia; Shahed Shaikh; Dept-
> Eng Linux Driver; netdev; linux-pci
> Subject: Re: [PATCH net-next 28/35] qlcnic: Use pci_enable_msix_range()
> instead of pci_enable_msix()
> 
> On Sat, Feb 22, 2014 at 12:48:47AM +0000, Ben Hutchings wrote:
> > Sorry, I'm confused and this does work.  But I wonder whether it is
> > really an improvement over using the old API.
> 
> Slightly, as far as I am concerned - we just exchange tri-state oddity to re-
> enable MSI-X oddity. We're not going to improve drivers that can not work
> with any number of MSI-Xs from a range, like this one.

I will send a patch which will make use of available MSI-X number and remove the retry logic.

Thanks,
Shahed
diff mbox

Patch

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 0c077cf..e07fd94 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -701,13 +701,17 @@  enable_msix:
 		for (vector = 0; vector < num_msix; vector++)
 			adapter->msix_entries[vector].entry = vector;
 
-		err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
-		if (err == 0) {
+		err = pci_enable_msix_range(pdev,
+					    adapter->msix_entries, 1, num_msix);
+
+		if (err == num_msix) {
 			adapter->flags |= QLCNIC_MSIX_ENABLED;
 			adapter->ahw->num_msix = num_msix;
 			dev_info(&pdev->dev, "using msi-x interrupts\n");
 			return 0;
 		} else if (err > 0) {
+			pci_disable_msix(pdev);
+
 			dev_info(&pdev->dev,
 				 "Unable to allocate %d MSI-X vectors, Available vectors %d\n",
 				 num_msix, err);