Skip to content

Commit 3a7467f

Browse files
committed
ethtool: work-around ETHTOOL_GRSSH/ETHTOOL_SRSSH ABI breakage
ethtool since version 6.9 introduced support for getting/setting RSS input transformation supported in Linux since version 6.8. The now changed kernel ioctl ABI, however, cannot be detected from userland, and ethtool since version 6.9 simply assumes that a previously reserved field is now used to set the input transformation. Unfortunately the default value RXH_XFRM_NO_CHANGE (0xff) used by ethtool userland creates an incompatibility with older kernels which cannot be resolved easily without introducing even more ABI breakage. Work-around the issue and fix support for --set-rxfh and --set-rxfh-indir ethtool userland tool commands by making the support for input_xfrm conditional on compile time, and keep it disabled for Linux 6.6. Fixes: 8c2dcd1 ("ethtool: update to 6.10") Signed-off-by: Daniel Golle <daniel@makrotopia.org>
1 parent da2cc98 commit 3a7467f

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

package/network/utils/ethtool/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ else
5757
CONFIGURE_ARGS += --disable-netlink --disable-pretty-dump
5858
endif
5959

60+
# enable support for input_xfrm with kernels newer than 6.6
61+
ifeq ($(CONFIG_LINUX_6_6),)
62+
CONFIGURE_ARGS += --enable-rss-input-xfrm
63+
endif
64+
6065
define Package/ethtool/install
6166
$(INSTALL_DIR) $(1)/usr/sbin
6267
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethtool $(1)/usr/sbin
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From c88eb6f4e9b2d8f71f3391db2bf0ec82ecccae81 Mon Sep 17 00:00:00 2001
2+
From: Daniel Golle <daniel@makrotopia.org>
3+
Date: Wed, 12 Feb 2025 04:12:42 +0000
4+
Subject: [PATCH] ethtool: make building for RSS input xfrm optional
5+
6+
Unfortunately there is no way to detect at runtime if the kernel the
7+
support for RSS input transformation, and the default value
8+
RXH_XFRM_NO_CHANGE (0xff) used by newer ethtool results in breakage
9+
with older kernels.
10+
As a stop-gap solution simply don't compile with support for input
11+
xfrm by default.
12+
13+
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
14+
---
15+
configure.ac | 10 ++++++++++
16+
ethtool.c | 10 ++++++++++
17+
2 files changed, 20 insertions(+)
18+
19+
--- a/configure.ac
20+
+++ b/configure.ac
21+
@@ -45,6 +45,16 @@ if test x$enable_pretty_dump = xyes; the
22+
fi
23+
AM_CONDITIONAL([ETHTOOL_ENABLE_PRETTY_DUMP], [test x$enable_pretty_dump = xyes])
24+
25+
+AC_ARG_ENABLE(rss-input-xfrm,
26+
+ [ --enable-rss-input-xfrm build with support for RSS input transformation (disabled by default)],
27+
+ ,
28+
+ enable_rss_input_xfrm=no)
29+
+if test x$enable_rss_input_xfrm = xyes; then
30+
+ AC_DEFINE(ETHTOOL_ENABLE_RSS_INPUT_XFRM, 1,
31+
+ [Define this to enable building with support for RSS input transformation.])
32+
+fi
33+
+AM_CONDITIONAL([ETHTOOL_ENABLE_RSS_INPUT_XFRM], [test x$enable_rss_input_xfrm = xyes])
34+
+
35+
AC_ARG_WITH([bash-completion-dir],
36+
AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
37+
[Install the bash-completion script in this directory. @<:@default=yes@:>@]),
38+
--- a/ethtool.c
39+
+++ b/ethtool.c
40+
@@ -4109,9 +4109,11 @@ static int do_grxfh(struct cmd_context *
41+
(const char *)hfuncs->data + i * ETH_GSTRING_LEN,
42+
(rss->hfunc & (1 << i)) ? "on" : "off");
43+
44+
+#ifdef ETHTOOL_ENABLE_RSS_INPUT_XFRM
45+
printf("RSS input transformation:\n");
46+
printf(" symmetric-xor: %s\n",
47+
(rss->input_xfrm & RXH_XFRM_SYM_XOR) ? "on" : "off");
48+
+#endif
49+
50+
out:
51+
free(hfuncs);
52+
@@ -4431,7 +4433,15 @@ static int do_srxfh(struct cmd_context *
53+
rss->cmd = ETHTOOL_SRSSH;
54+
rss->rss_context = rss_context;
55+
rss->hfunc = req_hfunc;
56+
+#ifdef ETHTOOL_ENABLE_RSS_INPUT_XFRM
57+
rss->input_xfrm = req_input_xfrm;
58+
+#else
59+
+ if (req_input_xfrm != 0xff) {
60+
+ perror("Compiled for kernel without support for input transformation");
61+
+ err = 1;
62+
+ goto free;
63+
+ }
64+
+#endif
65+
if (delete) {
66+
rss->indir_size = rss->key_size = 0;
67+
} else {

0 commit comments

Comments
 (0)