From: Joe Damato <jdamato@fastly.com>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, kuba@kernel.org,
"David S. Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Amritha Nambiar <amritha.nambiar@intel.com>,
Mina Almasry <almasrymina@google.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v2] netdev-genl: Elide napi_id when not present
Date: Tue, 4 Feb 2025 10:28:23 -0800 [thread overview]
Message-ID: <Z6JcR5IH8WzH1lP9@LQ3V64L9R2> (raw)
In-Reply-To: <CANn89i+vf5=6f8kuZKCmP66P1LWGmAj06i+NhgqpFLVR8K5bEA@mail.gmail.com>
On Tue, Feb 04, 2025 at 06:41:34AM +0100, Eric Dumazet wrote:
> On Mon, Feb 3, 2025 at 8:17 PM Joe Damato <jdamato@fastly.com> wrote:
> >
> > There are at least two cases where napi_id may not present and the
> > napi_id should be elided:
> >
> > 1. Queues could be created, but napi_enable may not have been called
> > yet. In this case, there may be a NAPI but it may not have an ID and
> > output of a napi_id should be elided.
> >
> > 2. TX-only NAPIs currently do not have NAPI IDs. If a TX queue happens
> > to be linked with a TX-only NAPI, elide the NAPI ID from the netlink
> > output as a NAPI ID of 0 is not useful for users.
> >
> > Signed-off-by: Joe Damato <jdamato@fastly.com>
> > ---
> > v2:
> > - Updated to elide NAPI IDs for RX queues which may have not called
> > napi_enable yet.
> >
> > rfc: https://lore.kernel.org/lkml/20250128163038.429864-1-jdamato@fastly.com/
> > net/core/netdev-genl.c | 14 ++++++++------
> > 1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> > index 715f85c6b62e..a97d3b99f6cd 100644
> > --- a/net/core/netdev-genl.c
> > +++ b/net/core/netdev-genl.c
> > @@ -385,9 +385,10 @@ netdev_nl_queue_fill_one(struct sk_buff *rsp, struct net_device *netdev,
> > switch (q_type) {
> > case NETDEV_QUEUE_TYPE_RX:
> > rxq = __netif_get_rx_queue(netdev, q_idx);
> > - if (rxq->napi && nla_put_u32(rsp, NETDEV_A_QUEUE_NAPI_ID,
> > - rxq->napi->napi_id))
> > - goto nla_put_failure;
> > + if (rxq->napi && rxq->napi->napi_id >= MIN_NAPI_ID)
> > + if (nla_put_u32(rsp, NETDEV_A_QUEUE_NAPI_ID,
> > + rxq->napi->napi_id))
> > + goto nla_put_failure;
> >
> > binding = rxq->mp_params.mp_priv;
> > if (binding &&
> > @@ -397,9 +398,10 @@ netdev_nl_queue_fill_one(struct sk_buff *rsp, struct net_device *netdev,
> > break;
> > case NETDEV_QUEUE_TYPE_TX:
> > txq = netdev_get_tx_queue(netdev, q_idx);
> > - if (txq->napi && nla_put_u32(rsp, NETDEV_A_QUEUE_NAPI_ID,
> > - txq->napi->napi_id))
> > - goto nla_put_failure;
> > + if (txq->napi && txq->napi->napi_id >= MIN_NAPI_ID)
> > + if (nla_put_u32(rsp, NETDEV_A_QUEUE_NAPI_ID,
> > + txq->napi->napi_id))
> > + goto nla_put_failure;
> > }
>
> Hi Joe
>
> This might be time to add helpers, we now have these checks about
> MIN_NAPI_ID all around the places.
I'm not sure what the right etiquette is; I was thinking of just
taking the patch you proposed below and submitting it with you as
the author with my Reviewed-by.
Is that OK and if so, are you OK with the commit message?
next prev parent reply other threads:[~2025-02-04 18:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 19:17 [PATCH net-next v2] netdev-genl: Elide napi_id when not present Joe Damato
2025-02-03 19:50 ` Samudrala, Sridhar
2025-02-04 5:41 ` Eric Dumazet
2025-02-04 13:02 ` Paolo Abeni
2025-02-04 18:13 ` Joe Damato
2025-02-04 18:28 ` Joe Damato [this message]
2025-02-04 18:53 ` Eric Dumazet
2025-02-04 18:56 ` Joe Damato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z6JcR5IH8WzH1lP9@LQ3V64L9R2 \
--to=jdamato@fastly.com \
--cc=almasrymina@google.com \
--cc=amritha.nambiar@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.