diff mbox

[net-next,2/2] qlcnic: Use pci_enable_msix_exact() instead of pci_enable_msix()

Message ID 0a0d5f5c33d86e3777c22c3c1bbd81035660d57c.1398412015.git.agordeev@redhat.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Alexander Gordeev April 25, 2014, 8:06 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()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Cc: Shahed Shaikh <shahed.shaikh@qlogic.com>
Cc: Dept-HSGLinuxNICDev@qlogic.com
Cc: netdev@vger.kernel.org
Cc: linux-pci@vger.kernel.org

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Shahed Shaikh April 25, 2014, 8:48 a.m. UTC | #1
> -----Original Message-----
> From: Alexander Gordeev [mailto:agordeev@redhat.com]
> Sent: Friday, April 25, 2014 1:36 PM
> To: linux-kernel
> Cc: Alexander Gordeev; Shahed Shaikh; Dept-HSG Linux NIC Dev; netdev;
> linux-pci
> Subject: [PATCH net-next 2/2] qlcnic: Use pci_enable_msix_exact() instead
> of pci_enable_msix()
> 
> 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: Shahed Shaikh <shahed.shaikh@qlogic.com>
> Cc: Dept-HSGLinuxNICDev@qlogic.com
> Cc: netdev@vger.kernel.org
> Cc: linux-pci@vger.kernel.org
> 
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> ---
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> index dbf7539..26f022b 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> @@ -690,8 +690,8 @@ int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter
> *adapter)
>  		adapter->msix_entries[vector].entry = vector;
> 
>  restore:
> -	err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
> -	if (err > 0) {
> +	err = pci_enable_msix_exact(pdev, adapter->msix_entries,
> num_msix);
> +	if (err == -ENOSPC) {
>  		if (!adapter->drv_tss_rings && !adapter->drv_rss_rings)
>  			return -ENOSPC;

I think, it would be good if we return "err" instead of "-ENOSPC" .
  
                if (!adapter->drv_tss_rings && !adapter->drv_rss_rings)
-                       return -ENOSPC;
+                       return err;

Thanks,
Shahed
Alexander Gordeev April 25, 2014, 9 a.m. UTC | #2
On Fri, Apr 25, 2014 at 08:48:14AM +0000, Shahed Shaikh wrote:
> > diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > index dbf7539..26f022b 100644
> > --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > @@ -690,8 +690,8 @@ int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter
> > *adapter)
> >  		adapter->msix_entries[vector].entry = vector;
> > 
> >  restore:
> > -	err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
> > -	if (err > 0) {
> > +	err = pci_enable_msix_exact(pdev, adapter->msix_entries,
> > num_msix);
> > +	if (err == -ENOSPC) {
> >  		if (!adapter->drv_tss_rings && !adapter->drv_rss_rings)
> >  			return -ENOSPC;
> 
> I think, it would be good if we return "err" instead of "-ENOSPC" .
>   
>                 if (!adapter->drv_tss_rings && !adapter->drv_rss_rings)
> -                       return -ENOSPC;
> +                       return err;

At this point "err" could only be -ENOSPC. I am not sure why returning
"err" is better, but I'll repost if you insist.

> 
> Thanks,
> Shahed
>
Shahed Shaikh April 25, 2014, 9:02 a.m. UTC | #3
> -----Original Message-----
> From: Alexander Gordeev [mailto:agordeev@redhat.com]
> Sent: Friday, April 25, 2014 2:31 PM
> To: Shahed Shaikh
> Cc: linux-kernel; Dept-HSG Linux NIC Dev; netdev; linux-pci
> Subject: Re: [PATCH net-next 2/2] qlcnic: Use pci_enable_msix_exact()
> instead of pci_enable_msix()
> 
> On Fri, Apr 25, 2014 at 08:48:14AM +0000, Shahed Shaikh wrote:
> > > diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > > b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > > index dbf7539..26f022b 100644
> > > --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > > +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
> > > @@ -690,8 +690,8 @@ int qlcnic_setup_tss_rss_intr(struct
> > > qlcnic_adapter
> > > *adapter)
> > >  		adapter->msix_entries[vector].entry = vector;
> > >
> > >  restore:
> > > -	err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
> > > -	if (err > 0) {
> > > +	err = pci_enable_msix_exact(pdev, adapter->msix_entries,
> > > num_msix);
> > > +	if (err == -ENOSPC) {
> > >  		if (!adapter->drv_tss_rings && !adapter->drv_rss_rings)
> > >  			return -ENOSPC;
> >
> > I think, it would be good if we return "err" instead of "-ENOSPC" .
> >
> >                 if (!adapter->drv_tss_rings && !adapter->drv_rss_rings)
> > -                       return -ENOSPC;
> > +                       return err;
> 
> At this point "err" could only be -ENOSPC. I am not sure why returning "err" is
> better, but I'll repost if you insist.

Agree. But it will make code look cleaner.

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 dbf7539..26f022b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -690,8 +690,8 @@  int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter *adapter)
 		adapter->msix_entries[vector].entry = vector;
 
 restore:
-	err = pci_enable_msix(pdev, adapter->msix_entries, num_msix);
-	if (err > 0) {
+	err = pci_enable_msix_exact(pdev, adapter->msix_entries, num_msix);
+	if (err == -ENOSPC) {
 		if (!adapter->drv_tss_rings && !adapter->drv_rss_rings)
 			return -ENOSPC;