diff mbox series

[ethtool-next,5/6] Print unknown input_xfrm values when encountered

Message ID 20250303121941.105747-6-gal@nvidia.com (mailing list archive)
State New
Delegated to: Michal Kubecek
Headers show
Series Symmetric OR-XOR RSS hash | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch, async

Commit Message

Gal Pressman March 3, 2025, 12:19 p.m. UTC
It is possible for the kernel to report unknown input_xfrm values, e.g.
when a new driver which enables a new transformation by default is used
with an old userspace ethtool.

When such values are encountered, print the raw values so the user is at
least aware that some unparsable transformations are enabled.

Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
 ethtool.c     | 5 +++++
 netlink/rss.c | 6 ++++++
 2 files changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/ethtool.c b/ethtool.c
index 1c58dbf1c379..f679f253d490 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -4118,6 +4118,11 @@  static int do_grxfh(struct cmd_context *ctx)
 	printf("RSS input transformation:\n");
 	printf("    symmetric-xor: %s\n",
 	       (rss->input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
+	rss->input_xfrm &= ~RXH_XFRM_SYM_XOR;
+
+	if (rss->input_xfrm)
+		printf("    Unknown bits in RSS input transformation: 0x%x\n",
+		       rss->input_xfrm);
 
 out:
 	free(hfuncs);
diff --git a/netlink/rss.c b/netlink/rss.c
index 0207931a5771..9ce56c2c687d 100644
--- a/netlink/rss.c
+++ b/netlink/rss.c
@@ -58,6 +58,8 @@  void dump_json_rss_info(struct cmd_context *ctx, u32 *indir_table,
 	open_json_object("rss-input-transformation");
 	print_bool(PRINT_JSON, "symmetric-xor", NULL,
 		   (input_xfrm & RXH_XFRM_SYM_XOR) ? true : false);
+	if (input_xfrm & ~RXH_XFRM_SYM_XOR)
+		print_uint(PRINT_JSON, "raw", NULL, input_xfrm);
 
 	close_json_object();
 
@@ -174,6 +176,10 @@  int rss_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 		printf("RSS input transformation:\n");
 		printf("    symmetric-xor: %s\n",
 		       (input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
+		input_xfrm &= ~RXH_XFRM_SYM_XOR;
+
+		if (input_xfrm)
+			printf("    Unknown bits in RSS input transformation: 0x%x\n", input_xfrm);
 	}
 
 	return MNL_CB_OK;