Message ID | 20240912171251.937743-11-sdf@fomichev.me (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | selftests: ncdevmem: Add ncdevmem to ksft | expand |
Hi Stanislav,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Stanislav-Fomichev/selftests-ncdevmem-Add-a-flag-for-the-selftest/20240913-011631
base: net-next/main
patch link: https://lore.kernel.org/r/20240912171251.937743-11-sdf%40fomichev.me
patch subject: [PATCH net-next 10/13] selftests: ncdevmem: Use YNL to enable TCP header split
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240914/202409142047.UOZ425m7-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202409142047.UOZ425m7-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from ncdevmem.c:35:
>> tools/testing/selftests/../../../tools/net/ynl/generated/ethtool-user.h:23:43: warning: declaration of 'enum ethtool_header_flags' will not be visible outside of this function [-Wvisibility]
23 | const char *ethtool_header_flags_str(enum ethtool_header_flags value);
| ^
1 warning generated.
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 649f1fe0dc46..9c970e96ed33 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -112,7 +112,7 @@ TEST_INCLUDES := forwarding/lib.sh include ../lib.mk # YNL build -YNL_GENS := netdev +YNL_GENS := ethtool netdev include ynl.mk $(OUTPUT)/epoll_busy_poll: LDLIBS += -lcap diff --git a/tools/testing/selftests/net/ncdevmem.c b/tools/testing/selftests/net/ncdevmem.c index c5b4d9069a83..f5cfaafb6509 100644 --- a/tools/testing/selftests/net/ncdevmem.c +++ b/tools/testing/selftests/net/ncdevmem.c @@ -32,6 +32,7 @@ #include <net/if.h> #include "netdev-user.h" +#include "ethtool-user.h" #include <ynl.h> #define PAGE_SHIFT 12 @@ -191,8 +192,42 @@ static int reset_flow_steering(void) static int configure_headersplit(bool on) { - return run_command("sudo ethtool -G %s tcp-data-split %s >&2", ifname, - on ? "on" : "off"); + struct ethtool_rings_set_req *req; + struct ynl_error yerr; + struct ynl_sock *ys; + int ret; + + ys = ynl_sock_create(&ynl_ethtool_family, &yerr); + if (!ys) { + fprintf(stderr, "YNL: %s\n", yerr.msg); + return -1; + } + + req = ethtool_rings_set_req_alloc(); + ethtool_rings_set_req_set_header_dev_index(req, ifindex); + ethtool_rings_set_req_set_tcp_data_split(req, on ? 2 : 0); + ret = ethtool_rings_set(ys, req); + if (ret < 0) + fprintf(stderr, "YNL failed: %s\n", ys->err.msg); + ethtool_rings_set_req_free(req); + + { + struct ethtool_rings_get_req *req; + struct ethtool_rings_get_rsp *rsp; + + req = ethtool_rings_get_req_alloc(); + ethtool_rings_get_req_set_header_dev_index(req, ifindex); + rsp = ethtool_rings_get(ys, req); + ethtool_rings_get_req_free(req); + if (rsp) + fprintf(stderr, "TCP header split: %d\n", + rsp->tcp_data_split); + ethtool_rings_get_rsp_free(rsp); + } + + ynl_sock_destroy(ys); + + return ret; } static int configure_rss(void) @@ -321,6 +356,9 @@ int do_server(struct memory_buffer *mem) if (reset_flow_steering()) error(1, 0, "Failed to reset flow steering\n"); + if (configure_headersplit(1)) + error(1, 0, "Failed to enable TCP header split\n"); + /* Configure RSS to divert all traffic from our devmem queues */ if (configure_rss()) error(1, 0, "Failed to configure rss\n");
In the next patch the hard-coded queue numbers are gonna be removed. So introduce some initial support for ethtool YNL and use it to enable header split. Also, tcp-data-split requires latest ethtool which is unlikely to be present in the distros right now. (ideally, we should not shell out to ethtool at all). Cc: Mina Almasry <almasrymina@google.com> Signed-off-by: Stanislav Fomichev <sdf@fomichev.me> --- tools/testing/selftests/net/Makefile | 2 +- tools/testing/selftests/net/ncdevmem.c | 42 ++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-)