netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC net-next] netdev-genl: Elide napi_id for TX-only NAPIs
@ 2025-01-28 16:30 Joe Damato
  2025-01-28 22:27 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Damato @ 2025-01-28 16:30 UTC (permalink / raw)
  To: netdev
  Cc: sridhar.samudrala, Joe Damato, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Stanislav Fomichev,
	Mina Almasry, open list

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>
---
 net/core/netdev-genl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index 715f85c6b62e..3116e683e516 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -397,9 +397,12 @@ 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))
+		if (!txq->napi)
 			goto nla_put_failure;
+		if (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;
 	}
 
 	genlmsg_end(rsp, hdr);

base-commit: 0ad9617c78acbc71373fb341a6f75d4012b01d69
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC net-next] netdev-genl: Elide napi_id for TX-only NAPIs
  2025-01-28 16:30 [RFC net-next] netdev-genl: Elide napi_id for TX-only NAPIs Joe Damato
@ 2025-01-28 22:27 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2025-01-28 22:27 UTC (permalink / raw)
  To: Joe Damato
  Cc: netdev, sridhar.samudrala, David S. Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman, Stanislav Fomichev, Mina Almasry,
	open list

On Tue, 28 Jan 2025 16:30:37 +0000 Joe Damato wrote:
> -		if (txq->napi && nla_put_u32(rsp, NETDEV_A_QUEUE_NAPI_ID,
> -					     txq->napi->napi_id))
> +		if (!txq->napi)
>  			goto nla_put_failure;

Skip the attr but no need to fail. We're reporting info about a queue
here, the queue still exists, even if we can't report a valid NAPI ID.

> +		if (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;

Similar treatment should be applied to the Rx queues, I reckon.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-28 22:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-28 16:30 [RFC net-next] netdev-genl: Elide napi_id for TX-only NAPIs Joe Damato
2025-01-28 22:27 ` Jakub Kicinski

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).