* [net-next v3 0/2] e1000/e1000e: Link IRQs, NAPIs, and queues
@ 2024-09-30 17:12 Joe Damato
2024-09-30 17:12 ` [net-next v3 1/2] e1000e: Link NAPI instances to queues and IRQs Joe Damato
2024-09-30 17:12 ` [net-next v3 2/2] e1000: " Joe Damato
0 siblings, 2 replies; 6+ messages in thread
From: Joe Damato @ 2024-09-30 17:12 UTC (permalink / raw)
To: netdev
Cc: Joe Damato, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Przemek Kitszel, Tony Nguyen,
moderated list:INTEL ETHERNET DRIVERS, open list
Greetings:
Welcome to v3.
v1 was an RFC [1] for just e1000e, v2 was an RFC [2] for both e1000e and
e1000.
This series adds support for netdev-genl to e1000e and e1000.
Supporting this API in these drivers is very useful as commonly used
virtualization software, like VMWare Fusion and VirtualBox, expose e1000e
and e1000 NICs to VMs.
Developers who work on user apps in VMs may find themselves in need of
access to this API to build, test, or run CI on their apps. This is
especially true for apps which use epoll based busy poll and rely on
userland mapping NAPI IDs to queues.
I've tested both patches; please see the commit messages for more details.
Thanks,
Joe
[1]: https://lore.kernel.org/lkml/20240918135726.1330-1-jdamato@fastly.com/T/
[2]: https://lore.kernel.org/lkml/20240925162937.2218-1-jdamato@fastly.com/
v3:
- No longer an RFC
- Updated commit messages
- No functional or code changes at all
rfcv2:
- Include patch for e1000
Joe Damato (2):
e1000e: Link NAPI instances to queues and IRQs
e1000: Link NAPI instances to queues and IRQs
drivers/net/ethernet/intel/e1000/e1000_main.c | 5 +++++
drivers/net/ethernet/intel/e1000e/netdev.c | 11 +++++++++++
2 files changed, 16 insertions(+)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [net-next v3 1/2] e1000e: Link NAPI instances to queues and IRQs
2024-09-30 17:12 [net-next v3 0/2] e1000/e1000e: Link IRQs, NAPIs, and queues Joe Damato
@ 2024-09-30 17:12 ` Joe Damato
2024-10-01 10:50 ` Simon Horman
2024-10-08 13:45 ` [Intel-wired-lan] " Avigail Dahan
2024-09-30 17:12 ` [net-next v3 2/2] e1000: " Joe Damato
1 sibling, 2 replies; 6+ messages in thread
From: Joe Damato @ 2024-09-30 17:12 UTC (permalink / raw)
To: netdev
Cc: Joe Damato, Tony Nguyen, Przemek Kitszel, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:INTEL ETHERNET DRIVERS, open list
Add support for netdev-genl, allowing users to query IRQ, NAPI, and queue
information.
After this patch is applied, note the IRQs assigned to my NIC:
$ cat /proc/interrupts | grep ens | cut -f1 --delimiter=':'
50
51
52
While e1000e allocates 3 IRQs (RX, TX, and other), it looks like e1000e
only has a single NAPI, so I've associated the NAPI with the RX IRQ (50
on my system, seen above).
Note the output from the cli:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump napi-get --json='{"ifindex": 2}'
[{'id': 145, 'ifindex': 2, 'irq': 50}]
This device supports only 1 rx and 1 tx queue. so querying that:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump queue-get --json='{"ifindex": 2}'
[{'id': 0, 'ifindex': 2, 'napi-id': 145, 'type': 'rx'},
{'id': 0, 'ifindex': 2, 'napi-id': 145, 'type': 'tx'}]
Signed-off-by: Joe Damato <jdamato@fastly.com>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index f103249b12fa..b527642c3a82 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -4613,6 +4613,7 @@ int e1000e_open(struct net_device *netdev)
struct e1000_hw *hw = &adapter->hw;
struct pci_dev *pdev = adapter->pdev;
int err;
+ int irq;
/* disallow open during test */
if (test_bit(__E1000_TESTING, &adapter->state))
@@ -4676,7 +4677,15 @@ int e1000e_open(struct net_device *netdev)
/* From here on the code is the same as e1000e_up() */
clear_bit(__E1000_DOWN, &adapter->state);
+ if (adapter->int_mode == E1000E_INT_MODE_MSIX)
+ irq = adapter->msix_entries[0].vector;
+ else
+ irq = adapter->pdev->irq;
+
+ netif_napi_set_irq(&adapter->napi, irq);
napi_enable(&adapter->napi);
+ netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_RX, &adapter->napi);
+ netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_TX, &adapter->napi);
e1000_irq_enable(adapter);
@@ -4735,6 +4744,8 @@ int e1000e_close(struct net_device *netdev)
netdev_info(netdev, "NIC Link is Down\n");
}
+ netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_RX, NULL);
+ netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_TX, NULL);
napi_disable(&adapter->napi);
e1000e_free_tx_resources(adapter->tx_ring);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [net-next v3 2/2] e1000: Link NAPI instances to queues and IRQs
2024-09-30 17:12 [net-next v3 0/2] e1000/e1000e: Link IRQs, NAPIs, and queues Joe Damato
2024-09-30 17:12 ` [net-next v3 1/2] e1000e: Link NAPI instances to queues and IRQs Joe Damato
@ 2024-09-30 17:12 ` Joe Damato
2024-10-01 10:50 ` Simon Horman
1 sibling, 1 reply; 6+ messages in thread
From: Joe Damato @ 2024-09-30 17:12 UTC (permalink / raw)
To: netdev
Cc: Joe Damato, Tony Nguyen, Przemek Kitszel, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:INTEL ETHERNET DRIVERS, open list
Add support for netdev-genl, allowing users to query IRQ, NAPI, and queue
information.
After this patch is applied, note the IRQ assigned to my NIC:
$ cat /proc/interrupts | grep enp0s8 | cut -f1 --delimiter=':'
18
Note the output from the cli:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump napi-get --json='{"ifindex": 2}'
[{'id': 513, 'ifindex': 2, 'irq': 18}]
This device supports only 1 rx and 1 tx queue, so querying that:
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump queue-get --json='{"ifindex": 2}'
[{'id': 0, 'ifindex': 2, 'napi-id': 513, 'type': 'rx'},
{'id': 0, 'ifindex': 2, 'napi-id': 513, 'type': 'tx'}]
Signed-off-by: Joe Damato <jdamato@fastly.com>
---
drivers/net/ethernet/intel/e1000/e1000_main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index ab7ae418d294..4de9b156b2be 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -513,6 +513,8 @@ void e1000_down(struct e1000_adapter *adapter)
*/
netif_carrier_off(netdev);
+ netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_RX, NULL);
+ netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_TX, NULL);
napi_disable(&adapter->napi);
e1000_irq_disable(adapter);
@@ -1392,7 +1394,10 @@ int e1000_open(struct net_device *netdev)
/* From here on the code is the same as e1000_up() */
clear_bit(__E1000_DOWN, &adapter->flags);
+ netif_napi_set_irq(&adapter->napi, adapter->pdev->irq);
napi_enable(&adapter->napi);
+ netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_RX, &adapter->napi);
+ netif_queue_set_napi(netdev, 0, NETDEV_QUEUE_TYPE_TX, &adapter->napi);
e1000_irq_enable(adapter);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [net-next v3 1/2] e1000e: Link NAPI instances to queues and IRQs
2024-09-30 17:12 ` [net-next v3 1/2] e1000e: Link NAPI instances to queues and IRQs Joe Damato
@ 2024-10-01 10:50 ` Simon Horman
2024-10-08 13:45 ` [Intel-wired-lan] " Avigail Dahan
1 sibling, 0 replies; 6+ messages in thread
From: Simon Horman @ 2024-10-01 10:50 UTC (permalink / raw)
To: Joe Damato
Cc: netdev, Tony Nguyen, Przemek Kitszel, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:INTEL ETHERNET DRIVERS, open list
On Mon, Sep 30, 2024 at 05:12:31PM +0000, Joe Damato wrote:
> Add support for netdev-genl, allowing users to query IRQ, NAPI, and queue
> information.
>
> After this patch is applied, note the IRQs assigned to my NIC:
>
> $ cat /proc/interrupts | grep ens | cut -f1 --delimiter=':'
> 50
> 51
> 52
>
> While e1000e allocates 3 IRQs (RX, TX, and other), it looks like e1000e
> only has a single NAPI, so I've associated the NAPI with the RX IRQ (50
> on my system, seen above).
>
> Note the output from the cli:
>
> $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
> --dump napi-get --json='{"ifindex": 2}'
> [{'id': 145, 'ifindex': 2, 'irq': 50}]
>
> This device supports only 1 rx and 1 tx queue. so querying that:
>
> $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
> --dump queue-get --json='{"ifindex": 2}'
> [{'id': 0, 'ifindex': 2, 'napi-id': 145, 'type': 'rx'},
> {'id': 0, 'ifindex': 2, 'napi-id': 145, 'type': 'tx'}]
>
> Signed-off-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [net-next v3 2/2] e1000: Link NAPI instances to queues and IRQs
2024-09-30 17:12 ` [net-next v3 2/2] e1000: " Joe Damato
@ 2024-10-01 10:50 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2024-10-01 10:50 UTC (permalink / raw)
To: Joe Damato
Cc: netdev, Tony Nguyen, Przemek Kitszel, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
moderated list:INTEL ETHERNET DRIVERS, open list
On Mon, Sep 30, 2024 at 05:12:32PM +0000, Joe Damato wrote:
> Add support for netdev-genl, allowing users to query IRQ, NAPI, and queue
> information.
>
> After this patch is applied, note the IRQ assigned to my NIC:
>
> $ cat /proc/interrupts | grep enp0s8 | cut -f1 --delimiter=':'
> 18
>
> Note the output from the cli:
>
> $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
> --dump napi-get --json='{"ifindex": 2}'
> [{'id': 513, 'ifindex': 2, 'irq': 18}]
>
> This device supports only 1 rx and 1 tx queue, so querying that:
>
> $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
> --dump queue-get --json='{"ifindex": 2}'
> [{'id': 0, 'ifindex': 2, 'napi-id': 513, 'type': 'rx'},
> {'id': 0, 'ifindex': 2, 'napi-id': 513, 'type': 'tx'}]
>
> Signed-off-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-wired-lan] [net-next v3 1/2] e1000e: Link NAPI instances to queues and IRQs
2024-09-30 17:12 ` [net-next v3 1/2] e1000e: Link NAPI instances to queues and IRQs Joe Damato
2024-10-01 10:50 ` Simon Horman
@ 2024-10-08 13:45 ` Avigail Dahan
1 sibling, 0 replies; 6+ messages in thread
From: Avigail Dahan @ 2024-10-08 13:45 UTC (permalink / raw)
To: Joe Damato, netdev
Cc: Przemek Kitszel, open list, Eric Dumazet, Tony Nguyen,
moderated list:INTEL ETHERNET DRIVERS, Jakub Kicinski,
Paolo Abeni, David S. Miller
On 30/09/2024 20:12, Joe Damato wrote:
> Add support for netdev-genl, allowing users to query IRQ, NAPI, and queue
> information.
>
> After this patch is applied, note the IRQs assigned to my NIC:
>
> $ cat /proc/interrupts | grep ens | cut -f1 --delimiter=':'
> 50
> 51
> 52
>
> While e1000e allocates 3 IRQs (RX, TX, and other), it looks like e1000e
> only has a single NAPI, so I've associated the NAPI with the RX IRQ (50
> on my system, seen above).
>
> Note the output from the cli:
>
> $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
> --dump napi-get --json='{"ifindex": 2}'
> [{'id': 145, 'ifindex': 2, 'irq': 50}]
>
> This device supports only 1 rx and 1 tx queue. so querying that:
>
> $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
> --dump queue-get --json='{"ifindex": 2}'
> [{'id': 0, 'ifindex': 2, 'napi-id': 145, 'type': 'rx'},
> {'id': 0, 'ifindex': 2, 'napi-id': 145, 'type': 'tx'}]
>
> Signed-off-by: Joe Damato <jdamato@fastly.com>
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
Tested-by: Avigail Dahan <avigailx.dahan@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-08 13:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 17:12 [net-next v3 0/2] e1000/e1000e: Link IRQs, NAPIs, and queues Joe Damato
2024-09-30 17:12 ` [net-next v3 1/2] e1000e: Link NAPI instances to queues and IRQs Joe Damato
2024-10-01 10:50 ` Simon Horman
2024-10-08 13:45 ` [Intel-wired-lan] " Avigail Dahan
2024-09-30 17:12 ` [net-next v3 2/2] e1000: " Joe Damato
2024-10-01 10:50 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).