diff mbox series

[RFC,net-next,2/2] gve: Map NAPI instances to queues

Message ID 20240926030025.226221-3-jdamato@fastly.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series gve: Link IRQs, queues, and NAPI instances | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 36 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Joe Damato Sept. 26, 2024, 3 a.m. UTC
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'},
[...]

Signed-off-by: Joe Damato <jdamato@fastly.com>
---
 drivers/net/ethernet/google/gve/gve_main.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Praveen Kaligineedi Sept. 27, 2024, 6:15 p.m. UTC | #1
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 661566db68c8..da811e90bdfa 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -1875,6 +1875,9 @@ static void gve_turndown(struct gve_priv *priv)
>
>                 if (!gve_tx_was_added_to_block(priv, idx))
>                         continue;
> +
> +               netif_queue_set_napi(priv->dev, idx, NETDEV_QUEUE_TYPE_TX,
> +                                    NULL);
>                 napi_disable(&block->napi);
>         }
When XDP program is installed, the for loop iterates over both
configured TX queues (idx <  priv->tx_cfg.num_queues) as well as
dedicated XDP TX queues ( idx >= priv->tx_cfg.num_queues).
Should add if (idx <  priv->tx_cfg.num_queues) check here.

> @@ -1909,6 +1915,9 @@ static void gve_turnup(struct gve_priv *priv)
>                         continue;
>
>                 napi_enable(&block->napi);
> +               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 {

Same as above. When XDP program is installed, the for loop iterates
over both configured TX queues (idx <  priv->tx_cfg.num_queues) as
well as dedicated XDP TX queues ( idx >= priv->tx_cfg.num_queues)
Joe Damato Sept. 27, 2024, 6:25 p.m. UTC | #2
On Fri, Sep 27, 2024 at 11:15:39AM -0700, Praveen Kaligineedi wrote:
> > diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> > index 661566db68c8..da811e90bdfa 100644
> > --- a/drivers/net/ethernet/google/gve/gve_main.c
> > +++ b/drivers/net/ethernet/google/gve/gve_main.c
> > @@ -1875,6 +1875,9 @@ static void gve_turndown(struct gve_priv *priv)
> >
> >                 if (!gve_tx_was_added_to_block(priv, idx))
> >                         continue;
> > +
> > +               netif_queue_set_napi(priv->dev, idx, NETDEV_QUEUE_TYPE_TX,
> > +                                    NULL);
> >                 napi_disable(&block->napi);
> >         }
> When XDP program is installed, the for loop iterates over both
> configured TX queues (idx <  priv->tx_cfg.num_queues) as well as
> dedicated XDP TX queues ( idx >= priv->tx_cfg.num_queues).
> Should add if (idx <  priv->tx_cfg.num_queues) check here.
> 
> > @@ -1909,6 +1915,9 @@ static void gve_turnup(struct gve_priv *priv)
> >                         continue;
> >
> >                 napi_enable(&block->napi);
> > +               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 {
> 
> Same as above. When XDP program is installed, the for loop iterates
> over both configured TX queues (idx <  priv->tx_cfg.num_queues) as
> well as dedicated XDP TX queues ( idx >= priv->tx_cfg.num_queues)

Ah, OK. Thanks for the review. I'll make that change and retest it
on my GCP instance.

Since net-next is (I think) likely to reopen soon, I'll include that
change in the submission I send next week and mention it in the
changelog.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 661566db68c8..da811e90bdfa 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -1875,6 +1875,9 @@  static void gve_turndown(struct gve_priv *priv)
 
 		if (!gve_tx_was_added_to_block(priv, idx))
 			continue;
+
+		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 +1886,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 +1915,9 @@  static void gve_turnup(struct gve_priv *priv)
 			continue;
 
 		napi_enable(&block->napi);
+		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 +1940,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 {