From: netdev-bot+sashiko@kernel.org
To: bochaolucky@gmail.com
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev,
song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
emil@etsalapatis.com, ihor.solodrai@linux.dev, shuah@kernel.org,
davem@davemloft.net, kuba@kernel.org, hawk@kernel.org,
john.fastabend@gmail.com, sdf@fomichev.me, andrew+netdev@lunn.ch,
edumazet@kernel.org, pabeni@redhat.com, horms@kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
alexis.lothore@bootlin.com, lorenzo@kernel.org,
tiozhang@didiglobal.com, willemdebruijn.kernel@gmail.com,
petrm@nvidia.com
Subject: Re: [PATCH net-next v5 5/5] selftests/net: Move the XDP feature test to drivers/net/hw
Date: Sun, 11 Oct 2026 11:17:11 +0000 [thread overview]
Message-ID: <179171743168.434549.11373662965992474852@kernel.org> (raw)
In-Reply-To: <20261010-xdp-v5-send-20261008-v5-5-de687cb67c40@gmail.com>
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 4
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The XDP_NDO_XMIT subtest fails on many drivers even when they
work correctly, because the advertised mask is read before the XDP…
- [Low] The moved BPF object xdp_features.bpf.o is built by the shared
rule in tools/testing/selftests/net/bpf.mk.
- [Low] run_feature() builds the local commands with shlex.join() (the
probe at line 45, and the DUT command from feature_command() at line…
- [Low] tools/testing/selftests/bpf/.gitignore still has an
`xdp_features` entry at line 44.
- [Low] The new README section heading 'XDP feature test' (16 characters)
at tools/testing/selftests/drivers/net/README.rst:314 has a…
--
selftests/net: Move the XDP feature test to drivers/net/hw
This moves the xdp_features helper and its BPF program from selftests/bpf
to drivers/net/hw. It replaces the private veth shell script with a
NetDrvEpEnv Python test that runs the DUT locally and the tester remotely.
The new test compares detected features against the advertised mask with
ksft_eq().
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 883c92701b9f1..cb76b68c97dbb 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
[ ... ]
> @@ -142,7 +142,6 @@ TEST_GEN_PROGS_EXTENDED = \
> test_cpp \
> test_lirc_mode2_user \
> veristat \
> - xdp_features \
> xdp_hw_metadata \
> xdp_synproxy \
> xskxceiver
[Severity: Low]
This isn't a bug, but tools/testing/selftests/bpf/.gitignore still has an
xdp_features entry. This patch removes the binary and its build rule from
this Makefile, and the ignore entry is now in drivers/net/hw/.gitignore.
Should the old entry be removed as well?
[ ... ]
> diff --git a/tools/testing/selftests/drivers/net/README.rst b/tools/testing/selftests/drivers/net/README.rst
> index 3fe49bce4f3a5..0791f02ba44b4 100644
> --- a/tools/testing/selftests/drivers/net/README.rst
> +++ b/tools/testing/selftests/drivers/net/README.rst
> @@ -310,3 +310,21 @@ Running tests CI-style
>
> See https://github.com/linux-netdev/nipa/wiki for instructions on how
> to easily run the tests using ``virtme-ng``.
> +
> +XDP feature test
> +===============
[Severity: Low]
This isn't a bug, but the underline is one character shorter than the
title. "XDP feature test" is 16 characters and the underline is 15.
docutils warns "Title underline too short" for this.
[ ... ]
> diff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile
> index 18ce235a77f84..bd818e8625c23 100644
> --- a/tools/testing/selftests/drivers/net/hw/Makefile
> +++ b/tools/testing/selftests/drivers/net/hw/Makefile
[ ... ]
> @@ -94,6 +95,18 @@ include ../../../net/ynl.mk
>
> include ../../../net/bpf.mk
>
> +$(OUTPUT)/xdp_features.bpf.o: xdp_features.h
> +
> +$(OUTPUT)/xdp_features: CFLAGS += -I$(OUTPUT) -I$(SCRATCH_DIR)/include
> +$(OUTPUT)/xdp_features: CFLAGS += -I../../../net/lib
> +$(OUTPUT)/xdp_features: LDLIBS += -lelf -lz -lpthread
> +$(OUTPUT)/xdp_features: xdp_features.c xdp_features.h \
> + $(OUTPUT)/xdp_features.skel.h $(BPFOBJ)
> + $(call msg,BINARY,,$@)
> + $(Q)$(CC) $(CFLAGS) $(CPPFLAGS) $(KHDR_INCLUDES) \
> + $(filter %.c %.o,$^) $(BPFOBJ) \
> + $(LDFLAGS) $(LDLIBS) -o $@
[Severity: Low]
Only the userspace helper gets KHDR_INCLUDES here. Can xdp_features.bpf.o
fail to build in an O= build?
The BPF object is built by the shared rule in
tools/testing/selftests/net/bpf.mk:
CCINCLUDE += -I$(selfdir)/bpf
CCINCLUDE += -I$(top_srcdir)/usr/include/
CCINCLUDE += -I$(SCRATCH_DIR)/include
...
$(Q)$(CLANG) -O2 -g --target=bpf $(CCINCLUDE) $(CLANG_SYS_INCLUDES) \
-c $< -o $@
With make O=<objdir> headers, tools/testing/selftests/Makefile sets
KHDR_INCLUDES to ${abs_objtree}/usr/include. That leaves
$(top_srcdir)/usr/include empty in a clean source tree.
The #include <linux/netdev.h> in xdp_features.bpf.c then falls back to the
system headers. Those don't have linux/netdev.h on distros whose UAPI
headers predate 6.3, for example Ubuntu 22.04.
The old selftests/bpf build passed -I$(APIDIR), and that directory has
tools/include/uapi/linux/netdev.h. Should the BPF compile for this object
also get KHDR_INCLUDES or -I$(APIDIR)?
[ ... ]
> diff --git a/tools/testing/selftests/drivers/net/hw/xdp_features.py b/tools/testing/selftests/drivers/net/hw/xdp_features.py
> new file mode 100755
> index 0000000000000..1d59772b2a4d0
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/hw/xdp_features.py
[ ... ]
> +def feature_command(binary, feature, dut_addr, tester_addr, ifname,
> + tester=False):
> + """Build the helper command with the configured endpoint addresses."""
> + args = [str(binary)]
> + if tester:
> + args.append("-t")
> + args += ["-f", feature, "-D", dut_addr]
> + if tester:
> + args += ["-C", dut_addr]
> + args += ["-T", tester_addr, ifname]
> + return shlex.join(args)
> +
> +
> +def run_feature(cfg, feature, ipver):
> + """Run one feature with bounded helper lifetimes and verify its result."""
> + cfg.require_cmd("timeout", local=False, remote=True)
> + probe = cmd(shlex.join([str(cfg.xdp_features), "-q", cfg.ifname]),
> + fail=False)
[ ... ]
> + dut_cmd = feature_command(cfg.xdp_features, feature, dut_addr,
> + tester_addr, cfg.ifname)
> + tester_cmd = feature_command(cfg.remote_xdp_features, feature, dut_addr,
> + tester_addr, cfg.remote_ifname, tester=True)
> +
> + with bkg(dut_cmd, exit_wait=True, ksft_ready=True):
[Severity: Low]
Is shlex.join() right for the local probe and dut_cmd? The local path of
cmd() in tools/testing/selftests/net/lib/py/utils.py does not use a shell:
if shell is None and isinstance(comm, str) and ' ' in comm:
comm = comm.split()
Suppose the resolved path to xdp_features contains a character that
shlex.quote() escapes, such as a space, '~', '$', '(' or '!'. The added
quotes are then passed to execve() as literal characters.
Would Popen() then raise FileNotFoundError and crash every subtest?
Only tester_cmd goes through a shell, over ssh. Could the local commands
pass an argument list instead?
> + # Bound the remote process itself, not just the local SSH wait.
> + result = cmd(f"timeout --signal=TERM --kill-after=5 90 {tester_cmd}",
> + host=cfg.remote, timeout=100)
> +
> + output = ANSI_ESCAPE.sub("", result.stdout)
> + match = RESULT.search(output)
> + if not match:
> + raise KsftFailEx(f"Unable to parse xdp_features output: {output}")
> +
> + detected = match.group(1) is None
> + advertised = match.group(2) is None
> + ksft_eq(detected, advertised,
> + comment=f"{feature}: detected and advertised support")
[Severity: Medium]
Can this report a false failure for XDP_NDO_XMIT on drivers that only
advertise it after an XDP program is attached?
tester_run() in xdp_features.c reads the advertised mask before it asks
the DUT to attach its program:
err = send_and_recv_msg(sockfd, CMD_GET_XDP_CAP, &advertised_feature,
sizeof(advertised_feature));
...
err = send_and_recv_msg(sockfd, CMD_START, NULL, 0);
dut_run() answers CMD_GET_XDP_CAP with a live bpf_xdp_query(). It only
calls dut_attach_xdp_prog() when CMD_START arrives.
Several drivers set NETDEV_XDP_ACT_NDO_XMIT in their XDP attach path. One
example is virtnet_xdp_set() in drivers/net/virtio_net.c:
if (!old_prog)
xdp_features_set_redirect_target(dev, true);
ixgbe, i40e, ice, igb, igc, stmmac, funeth, libeth and bnxt do something
similar.
On those drivers the tester sees NOT ADVERTISED. Once the program is
attached, though, the redirected frames still come back through
ndo_xdp_xmit, so the output is:
Feature XDP_NDO_XMIT: [DETECTED][NOT ADVERTISED]
The removed shell script only checked the helper's exit code. Wouldn't
this ksft_eq() now fail on a driver that works correctly? Could the
capability query be moved after CMD_START?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261010-xdp-v5-send-20261008-v5-0-de687cb67c40%40gmail.com
prev parent reply other threads:[~2026-10-11 11:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 10:22 [PATCH net-next v5 0/5] selftests: Fix and migrate the XDP feature test Bochao Cao via B4 Relay
2026-10-10 10:22 ` [PATCH net-next v5 1/5] selftests/bpf: Fix XDP feature test setup and teardown Bochao Cao via B4 Relay
2026-10-11 11:17 ` netdev-bot+sashiko
2026-10-10 10:22 ` [PATCH net-next v5 2/5] selftests/bpf: Track XDP test processes and isolate namespaces Bochao Cao via B4 Relay
2026-10-11 11:17 ` netdev-bot+sashiko
2026-10-10 10:22 ` [PATCH net-next v5 3/5] selftests/bpf: Send XDP feature probes with AF_PACKET Bochao Cao via B4 Relay
2026-10-11 11:17 ` netdev-bot+sashiko
2026-10-10 10:22 ` [PATCH net-next v5 4/5] selftests/net: Add a shared BPF skeleton rule Bochao Cao via B4 Relay
2026-10-11 11:17 ` netdev-bot+sashiko
2026-10-10 10:22 ` [PATCH net-next v5 5/5] selftests/net: Move the XDP feature test to drivers/net/hw Bochao Cao via B4 Relay
2026-10-11 11:17 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179171743168.434549.11373662965992474852@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alexis.lothore@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bochaolucky@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@kernel.org \
--cc=emil@etsalapatis.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=tiozhang@didiglobal.com \
--cc=willemdebruijn.kernel@gmail.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®