diff mbox series

[RFC,net-next] netdev-genl: Elide napi_id for TX-only NAPIs

Message ID 20250128163038.429864-1-jdamato@fastly.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series [RFC,net-next] netdev-genl: Elide napi_id for TX-only NAPIs | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
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: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 2 this patch: 2
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: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 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 Jan. 28, 2025, 4:30 p.m. UTC
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(-)


base-commit: 0ad9617c78acbc71373fb341a6f75d4012b01d69

Comments

Jakub Kicinski Jan. 28, 2025, 10:27 p.m. UTC | #1
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.
diff mbox series

Patch

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