gve: Link IRQs, queues, and NAPI instances
Subsystems (3)
v2 cover gve: Link IRQs, queues, and NAPI instances
Greetings:
Welcome to v2. The previous revision was an RFC [1].
This series uses the netdev-genl API to link IRQs and queues to NAPI IDs so that this information is queryable by user apps. This is particularly useful for epoll-based busy polling apps which rely on having access to the NAPI ID.
I've tested these commits on a GCP instance with a GVE NIC configured and have included test output in the commit messages for each patch showing how to query the information.
Thanks,
Joe
[1]: https://lore.kernel.org/netdev/[email protected]/
v2:
- Fixed spelling error in commit message of patch 1 suggested by Simon Horman
- Fixed patch 2 to skip XDP TX queues, as suggested by Praveen Kaligineedi
Joe Damato (2):
gve: Map IRQs to NAPI instances
gve: Map NAPI instances to queues
drivers/net/ethernet/google/gve/gve_main.c | 17 +++++++++++++++++ drivers/net/ethernet/google/gve/gve_utils.c | 1 + 2 files changed, 18 insertions(+)
Signature · 1 line
2.43.0
PATCH v2 1/2 gve: Map IRQs to NAPI instances
Use netdev-genl interface to map IRQs to NAPI instances so that this information is accessible by user apps via netlink.
$ cat /proc/interrupts | grep gve | grep -v mgmnt | cut -f1 --delimiter=':' 34 35 36 37 38 39 40 [...] 65
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump napi-get --json='{"ifindex": 2}'
[{'id': 8288, 'ifindex': 2, 'irq': 65},
[...]
{'id': 8263, 'ifindex': 2, 'irq': 40},
{'id': 8262, 'ifindex': 2, 'irq': 39},
{'id': 8261, 'ifindex': 2, 'irq': 38},
{'id': 8260, 'ifindex': 2, 'irq': 37},
{'id': 8259, 'ifindex': 2, 'irq': 36},
{'id': 8258, 'ifindex': 2, 'irq': 35},
{'id': 8257, 'ifindex': 2, 'irq': 34}]---
v2:
- Fix a spelling error in the commit message, pointed out by Simon Horman
drivers/net/ethernet/google/gve/gve_utils.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/google/gve/gve_utils.c +1 -0
@@ -111,6 +111,7 @@ void gve_add_napi(struct gve_priv *priv, int ntfy_idx,struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx];netif_napi_add (priv->dev, &block->napi, gve_poll); +netif_napi_set_irq (&block->napi, block->irq); }void gve_remove_napi (struct gve_priv *priv,int ntfy_idx)
Signature · 1 line
2.43.0
Re: [net-next v2 1/2] gve: Map IRQs to NAPI instances
Quoted 27 lines · Joe Damato
Use netdev-genl interface to map IRQs to NAPI instances so that this information is accessible by user apps via netlink.
$ cat /proc/interrupts | grep gve | grep -v mgmnt | cut -f1 --delimiter=':' 34 35 36 37 38 39 40 [...] 65$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump napi-get --json='{"ifindex": 2}' [{'id': 8288, 'ifindex': 2, 'irq': 65}, [...] {'id': 8263, 'ifindex': 2, 'irq': 40}, {'id': 8262, 'ifindex': 2, 'irq': 39}, {'id': 8261, 'ifindex': 2, 'irq': 38}, {'id': 8260, 'ifindex': 2, 'irq': 37}, {'id': 8259, 'ifindex': 2, 'irq': 36}, {'id': 8258, 'ifindex': 2, 'irq': 35}, {'id': 8257, 'ifindex': 2, 'irq': 34}]
Quoted 1 line
Signed-off-by Joe Damato <[email protected]>
PATCH v2 2/2 gve: Map NAPI instances to queues
In reply to Joe DamatoUse the netdev-genl interface to map NAPI instances to queues so that this information is accessible to user programs via netlink.
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump queue-get --json='{"ifindex": 2}'[{'id': 0, 'ifindex': 2, 'napi-id': 8313, 'type': 'rx'},
{'id': 1, 'ifindex': 2, 'napi-id': 8314, 'type': 'rx'}, {'id': 2, 'ifindex': 2, 'napi-id': 8315, 'type': 'rx'}, {'id': 3, 'ifindex': 2, 'napi-id': 8316, 'type': 'rx'}, {'id': 4, 'ifindex': 2, 'napi-id': 8317, 'type': 'rx'},
[...]
{'id': 0, 'ifindex': 2, 'napi-id': 8297, 'type': 'tx'}, {'id': 1, 'ifindex': 2, 'napi-id': 8298, 'type': 'tx'}, {'id': 2, 'ifindex': 2, 'napi-id': 8299, 'type': 'tx'}, {'id': 3, 'ifindex': 2, 'napi-id': 8300, 'type': 'tx'}, {'id': 4, 'ifindex': 2, 'napi-id': 8301, 'type': 'tx'},
[...]
---
v2:
- Check that idx < priv->tx_cfg.num_queues in both gve_turnup and gve_turndown as suggested by Praveen Kaligineedi
drivers/net/ethernet/google/gve/gve_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/ethernet/google/gve/gve_main.c +17 -0
@@ -1875,6 +1875,11 @@ static void gve_turndown(struct gve_priv *priv)if (!gve_tx_was_added_to_block (priv, idx))continue ; + +if (idx < priv->tx_cfg.num_queues) +netif_queue_set_napi (priv->dev, idx, +NETDEV_QUEUE_TYPE_TX ,NULL ); +napi_disable (&block->napi); }for (idx =0 ; idx < priv->rx_cfg.num_queues; idx++) {
@@ -1883,6 +1888,9 @@ static void gve_turndown(struct gve_priv *priv)if (!gve_rx_was_added_to_block (priv, idx))continue ; + +netif_queue_set_napi (priv->dev, idx,NETDEV_QUEUE_TYPE_RX , +NULL );napi_disable (&block->napi); }
@@ -1909,6 +1917,12 @@ static void gve_turnup(struct gve_priv *priv)continue ;napi_enable (&block->napi); + +if (idx < priv->tx_cfg.num_queues) +netif_queue_set_napi (priv->dev, idx, +NETDEV_QUEUE_TYPE_TX , + &block->napi); +if (gve_is_gqi (priv)) {iowrite32be (0 ,gve_irq_doorbell (priv, block)); }else {
@@ -1931,6 +1945,9 @@ static void gve_turnup(struct gve_priv *priv)continue ;napi_enable (&block->napi); +netif_queue_set_napi (priv->dev, idx,NETDEV_QUEUE_TYPE_RX , + &block->napi); +if (gve_is_gqi (priv)) {iowrite32be (0 ,gve_irq_doorbell (priv, block)); }else {
Signature · 1 line
2.43.0
Re: [net-next v2 2/2] gve: Map NAPI instances to queues
Quoted 20 lines · Joe Damato
Use the netdev-genl interface to map NAPI instances to queues so that this information is accessible to user programs via netlink.
$ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \ --dump queue-get --json='{"ifindex": 2}'[{'id': 0, 'ifindex': 2, 'napi-id': 8313, 'type': 'rx'},
{'id': 1, 'ifindex': 2, 'napi-id': 8314, 'type': 'rx'}, {'id': 2, 'ifindex': 2, 'napi-id': 8315, 'type': 'rx'}, {'id': 3, 'ifindex': 2, 'napi-id': 8316, 'type': 'rx'}, {'id': 4, 'ifindex': 2, 'napi-id': 8317, 'type': 'rx'},
[...]
{'id': 0, 'ifindex': 2, 'napi-id': 8297, 'type': 'tx'}, {'id': 1, 'ifindex': 2, 'napi-id': 8298, 'type': 'tx'}, {'id': 2, 'ifindex': 2, 'napi-id': 8299, 'type': 'tx'}, {'id': 3, 'ifindex': 2, 'napi-id': 8300, 'type': 'tx'}, {'id': 4, 'ifindex': 2, 'napi-id': 8301, 'type': 'tx'},
[...]
Quoted 1 line
Signed-off-by Joe Damato <[email protected]>
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 30 Sep 2024 21:07:06 +0000 you wrote:
Greetings:
Welcome to v2. The previous revision was an RFC [1].
This series uses the netdev-genl API to link IRQs and queues to NAPI IDs so that this information is queryable by user apps. This is particularly useful for epoll-based busy polling apps which rely on having access to the NAPI ID.
[...]
Here is the summary with links:
- [net-next,v2,1/2] gve: Map IRQs to NAPI instances
https://git.kernel.org/netdev/net-next/c/3017238b60d3 - [net-next,v2,2/2] gve: Map NAPI instances to queues https://git.kernel.org/netdev/net-next/c/021f9e671e4a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html