2014-04-25 08:08:22

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH net-next 0/2] Use pci_enable_msix_range() instead of pci_enable_msix()

Hello,

The series completes converison of network drivers to the new
MSI initialization API.

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: Mitch Williams <[email protected]>
Cc: Jesse Brandeburg <[email protected]>
Cc: Shahed Shaikh <[email protected]>
Cc: Linux NICS <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Alexander Gordeev (2):
i40evf: Use pci_enable_msix_range() instead of pci_enable_msix()
qlcnic: Use pci_enable_msix_exact() instead of pci_enable_msix()

drivers/net/ethernet/intel/i40evf/i40evf_main.c | 31 ++++++++--------------
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 4 +-
2 files changed, 13 insertions(+), 22 deletions(-)

--
1.7.7.6


2014-04-25 08:05:30

by Alexander Gordeev

[permalink] [raw]
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 <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Signed-off-by: Alexander Gordeev <[email protected]>
---
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;

--
1.7.7.6

2014-04-25 08:08:16

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH net-next 1/2] i40evf: Use pci_enable_msix_range() 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.

Signed-off-by: Alexander Gordeev <[email protected]>
Cc: Mitch Williams <[email protected]>
Cc: Jesse Brandeburg <[email protected]>
Cc: Linux NICS <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 31 ++++++++--------------
1 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index da6054c..78f1859 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -1027,30 +1027,21 @@ i40evf_acquire_msix_vectors(struct i40evf_adapter *adapter, int vectors)
* Right now, we simply care about how many we'll get; we'll
* set them up later while requesting irq's.
*/
- while (vectors >= vector_threshold) {
- err = pci_enable_msix(adapter->pdev, adapter->msix_entries,
- vectors);
- if (!err) /* Success in acquiring all requested vectors. */
- break;
- else if (err < 0)
- vectors = 0; /* Nasty failure, quit now */
- else /* err == number of vectors we should try again with */
- vectors = err;
- }
-
- if (vectors < vector_threshold) {
+ err = pci_enable_msix_range(adapter->pdev, adapter->msix_entries,
+ vector_threshold, vectors);
+ if (err < 0) {
dev_err(&adapter->pdev->dev, "Unable to allocate MSI-X interrupts.\n");
kfree(adapter->msix_entries);
adapter->msix_entries = NULL;
- err = -EIO;
- } else {
- /* Adjust for only the vectors we'll use, which is minimum
- * of max_msix_q_vectors + NONQ_VECS, or the number of
- * vectors we were allocated.
- */
- adapter->num_msix_vectors = vectors;
+ return err;
}
- return err;
+
+ /* Adjust for only the vectors we'll use, which is minimum
+ * of max_msix_q_vectors + NONQ_VECS, or the number of
+ * vectors we were allocated.
+ */
+ adapter->num_msix_vectors = err;
+ return 0;
}

/**
--
1.7.7.6

2014-04-25 08:48:21

by Shahed Shaikh

[permalink] [raw]
Subject: RE: [PATCH net-next 2/2] qlcnic: Use pci_enable_msix_exact() instead of pci_enable_msix()

> -----Original Message-----
> From: Alexander Gordeev [mailto:[email protected]]
> 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 <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
>
> Signed-off-by: Alexander Gordeev <[email protected]>
> ---
> 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

2014-04-25 08:59:08

by Alexander Gordeev

[permalink] [raw]
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.

>
> Thanks,
> Shahed
>

--
Regards,
Alexander Gordeev
[email protected]

2014-04-25 09:02:13

by Shahed Shaikh

[permalink] [raw]
Subject: RE: [PATCH net-next 2/2] qlcnic: Use pci_enable_msix_exact() instead of pci_enable_msix()

> -----Original Message-----
> From: Alexander Gordeev [mailto:[email protected]]
> 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

2014-04-25 09:42:29

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH v2 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 <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Signed-off-by: Alexander Gordeev <[email protected]>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index dbf7539..73f908a 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -690,10 +690,10 @@ 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;
+ return err;

netdev_info(adapter->netdev,
"Unable to allocate %d MSI-X vectors, Available vectors %d\n",
--
1.7.7.6

--
Regards,
Alexander Gordeev
[email protected]

2014-04-25 09:43:55

by Shahed Shaikh

[permalink] [raw]
Subject: RE: [PATCH v2 net-next 2/2] qlcnic: Use pci_enable_msix_exact() instead of pci_enable_msix()

> -----Original Message-----
> From: Alexander Gordeev [mailto:[email protected]]
> Sent: Friday, April 25, 2014 3:14 PM
> To: Shahed Shaikh
> Cc: linux-kernel; Dept-HSG Linux NIC Dev; netdev; linux-pci
> Subject: [PATCH v2 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 <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
>
> Signed-off-by: Alexander Gordeev <[email protected]>
Acked-by: Shahed Shaikh <[email protected]>

Thanks,
Shahed

2014-04-27 23:30:31

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net-next 1/2] i40evf: Use pci_enable_msix_range() instead of pci_enable_msix()

From: Alexander Gordeev <[email protected]>
Date: Fri, 25 Apr 2014 10:06:24 +0200

> 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 <[email protected]>

Jeff, I assume you will take this in via your tree.

Thanks.

2014-04-28 09:50:32

by Jeff Kirsher

[permalink] [raw]
Subject: Re: [E1000-devel] [PATCH net-next 1/2] i40evf: Use pci_enable_msix_range() instead of pci_enable_msix()

On Sun, Apr 27, 2014 at 4:30 PM, David Miller <[email protected]> wrote:
> From: Alexander Gordeev <[email protected]>
> Date: Fri, 25 Apr 2014 10:06:24 +0200
>
>> 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 <[email protected]>
>
> Jeff, I assume you will take this in via your tree.
>

Yes, I have picked this up.

--
Cheers,
Jeff