summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/drivers/net
AgeCommit message (Collapse)Author
23 hoursMerge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.3-rc7). Conflicts: include/net/strparser.h 0984ebc631792 ("strparser: make sure __strp_recv isn't running before tearing down the parser") 02fd0a2111374 ("net: strparser: removed the aborted bit and aborts counter") https://lore.kernel.org/asYfmLsfy-SCxXjr@sirena.co.uk Adjacent changes: Documentation/networking/strparser.rst 5f193cdabf25 ("docs: networking: strparser: remove general mode") 0984ebc63179 ("strparser: make sure __strp_recv isn't running before tearing down the parser") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
34 hoursselftests: mlxsw: Test port range occupancy on template createPetr Machata
Add a test that creates a tc chain template matching on both source and destination port ranges and verifies via devlink-resource occupancy that this does not leak port range registers, neither while the template exists nor after it is deleted. Reviewed-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/e7b37b80adb7ac8b0ef20a22d7654a6656c1c545.1791294384.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 daysselftests: net: test MACsec undefined SCI uniquenessHaseeb Malik
Exercise duplicate transmit SCI rejection using default, explicit and all-ones SCI requests on the same lower device. Cover an all-ones request for both the first and second device, and clean up the second device if a kernel incorrectly accepts the duplicate. Also verify that an all-ones SCI still resolves to the default when a different port is already in use, and that deleting the device makes its SCI available for reuse. These cases cover the duplicate acceptance flagged by Sashiko during review of an earlier MACsec initialization fix. The same tests produce five passes and two failures before the fix, and seven passes after it. Check local iproute2 MACsec support before running the new tests. Keep the existing local and remote checks for callers supplying a configuration, without requiring remote or offload support for the new local tests. Link: https://lists.openwall.net/netdev/2026/09/16/11 Signed-off-by: Haseeb Malik <haseebulhaq55@gmail.com> Link: https://patch.msgid.link/20261001-fix-macsec-duplicate-sci-v3-2-0f179fbe1f2d@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 daysselftests: drv-net: psp: test that rx-assoc fails on closed and listen socksDaniel Zahka
Cover two of the basic psp assoc states that have been defeatured. Do not include tests with shutdown(), connect(..., AF_UNSPEC), etc. I don't think the coverage is worth the complexity. That should be done with packetdrill. Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com> Fixes: 6b46ca260e22 ("net: psp: add socket security association code") Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260930-psp-defeat-v2-4-f266e7447129@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
4 daysselftests: drv-net: psp: swap closed for connected sockets in assoc testsDaniel Zahka
Future work will only allow rx-assoc and tx-assoc to be performed when the sock is in TCP_ESTABLISHED state. Several assoc_ tests, as well as dev_rotate_spi, test using the rx-assoc and tx-assoc uapi calls against sockets in TCP_CLOSE state. These tests don't involve sending or receiving data, nor involve looking up psp device by dst entry, so using a disposable disconnected socket was just a convenience. These can be replaced by a disposable loopback socket. The loopback sockets are IPv4, where the sockets they replace were AF_INET6. This doesn't reduce coverage, since the assoc handlers accept any TCP socket and don't look at the address family. Some users of rx-assoc and tx-assoc on closed sockets are left if they validate errors that are returned before the kernel will check the socket for TCP_ESTABLISHED. Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com> Fixes: 6b46ca260e22 ("net: psp: add socket security association code") Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260930-psp-defeat-v2-1-f266e7447129@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
9 daysselftests: drv-net: Request larger zcrx buffersBjörn Töpel
The large-chunk test always requests two base pages. On interfaces with a large MTU, that may not exceed two maximum-sized frames. Request a power-of-two buffer larger than twice the MTU. This makes the existing rx_buf_len check and data-integrity traffic exercise the larger layout. Signed-off-by: Björn Töpel <bjorn@kernel.org> Tested-by: Breno Leitao <leitao@debian.org> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260925104417.2325213-6-bjorn@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-25selftests: drivers: net: check the host and device RSS keysEric Dumazet
Add a selftest under tools/testing/selftests/drivers/net/rss_key.py checking both the host RSS key (/proc/sys/net/core/netdev_rss_key) and the RSS key, indirection table, and flow-hash layouts reported by a device over ethtool netlink. When invoked without NETIF, NetDrvEnv creates a 4-queue netdevsim device, which calls netdev_rss_key_fill() and allows exercising both the host key and the netlink RSS reporting path in a virtual machine without special hardware. When invoked with NETIF, it checks the key and indirection table of that interface. Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260922163458.3900996-5-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-24selftests: drv-net: Add VLAN testOvidiu Panait
Add a test that validates ping traffic over VLAN interfaces. It aims to catch drivers which mishandle hardware VLAN tag stripping, in particular QinQ. Three VLAN configurations are covered, each with hardware RX VLAN stripping enabled and disabled (via the rx-vlan-offload and rx-vlan-stag-hw-parse features): - a single 802.1q VLAN interface - a single 802.1ad VLAN interface - an 802.1q VLAN stacked on top of an 802.1ad interface The "hw" test variants enable the RX VLAN stripping features supported by the device (rx-vlan-offload and rx-vlan-stag-hw-parse), the "sw" test variants disable all of them. A test is xfailed if the requested configuration is not possible. VLAN insertion offloads are not tested for now. NETIF=end0 LOCAL_V4=172.16.0.2 REMOTE_V4=172.16.0.3 \ REMOTE_TYPE=ssh REMOTE_ARGS=root@172.16.0.3 \ run_kselftest.sh -t drivers/net/hw:vlan.py TAP version 13 1..1 # timeout set to 0 # selftests: drivers/net/hw: vlan.py # # Interface: end0, driver: st_gmac # TAP version 13 # 1..6 # ok 1 vlan.test.8021q_hw # ok 2 vlan.test.8021q_sw # ok 3 vlan.test.8021ad_hw # ok 4 vlan.test.8021ad_sw # ok 5 vlan.test.qinq_hw # ok 6 vlan.test.qinq_sw # # Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0 ok 1 selftests: drivers/net/hw: vlan.py # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com> Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Link: https://patch.msgid.link/20260918112529.96039-4-ovidiu.panait.rb@renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-24selftests: drv-net: Check the features set by set_ethtool_feat()Ovidiu Panait
Read back the features after running ethtool -K to check if they were actually applied. The drivers might refuse to set a feature silently and the test could run with a different configuration than the requested one. Add a 'check' parameter to skip this, as the GRO "hw" mode handles the case where HW GRO is cleared by the driver. Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com> Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Link: https://patch.msgid.link/20260918112529.96039-3-ovidiu.panait.rb@renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-24selftests: drv-net: Move _set_ethtool_feat() into libOvidiu Panait
Move the _set_ethtool_feat() helper from gro_lib.py into lib, so that it can be reused by the VLAN test added in the next commit. Drop the leading underscore, now that the helper is exported. Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com> Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Link: https://patch.msgid.link/20260918112529.96039-2-ovidiu.panait.rb@renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-23selftests: drv-net: add BIG TCP coverage to TSO testNarcisa Vasile
Add IPv4 and IPv6 test cases that exercise GSO packets under BIG TCP size limits. 1..2 ok 1 tso.big_tcp_ipv4 ok 2 tso.big_tcp_ipv6 Both of them run the existing tx-tcp-segmentation and tx-tcp6-segmentation tests at the increased TSO maximum. Additionally, reserve a hugepage and transmit its content using MSG_ZEROCOPY to produce skb fragments larger than 65536. Check that the number of retransmissions represents a small percentage of the total packets sent. Record the number of drops before and after the send to catch issues with large frag handling during segmentation. Signed-off-by: Narcisa Vasile <narcisav.kernel@gmail.com> Acked-by: Petr Vorel <pvorel@suse.cz> Link: https://patch.msgid.link/20260921201145.49875-1-narcisav.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-17Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.3-rc4). Conflicts: net/core/neighbour.c 979aabdad8dd0 ("neighbour: Skip default parms when resumed in neightbl_dump_info().") 7b430fcfc972f ("neighbour: Don't render blackhole_netdev via RTM_GETNEIGHTBL.") fae1c59810b86 ("neighbour: Remove unnecessary net_eq().") https://lore.kernel.org/20260911173056.44ec06e0@kernel.org https://lore.kernel.org/aqfbJi7nAX4IbmnR@sirena.co.uk Adjacent changes: net/netlink/af_netlink.c ceac0de741bf ("netlink: do not free nlk->groups while lockless readers can use it") 7c0ec6288b49 ("net: Replace %pK output with 0") net/bridge/br_vlan.c 2842ce397dd0 ("net: bridge: vlan: fix bugs caused by switchdev deletion errors") 5bec8f861114 ("net: bridge: vlan: annotate lockless use of num_vlans") 2b1f8fd3118c ("net: bridge: vlan: annotate lockless vlan flags use") net/bridge/br_mst.c 18a6fe05fb6e ("net: bridge: mst: move switchdev call outside rcu") 120207a08fc0 ("net: bridge: vlan: annotate lockless use of msti") drivers/net/ethernet/stmicro/stmmac/hwif.h 90e4b849dfa6 ("net: stmmac: propagate FPE preemption-class mapping errors") 85ca3292d7a3 ("net: stmmac: Remove ARP offload code") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-16selftests: drv-net: psp: test PSP and TCP ULP mutual exclusionDaniel Zahka
Test both setting PSP after TLS ULP, and TLS ULP after PSP. Add CONFIG_TLS=y to the drivers/net/config. Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260915-psp-ktls-fix-v2-2-0eedc3b148ec@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-16selftests: drv-net: add BIG TCP test casesNarcisa Vasile
Add four new test cases that validate coalescing under increased size limits (BIG TCP): big_tcp_data_same - validates that equal-sized segments coalesce past the legacy IP_MAXPACKET limit. big_tcp_data_lrg_sml - validates that a smaller final segment coalesces into the previous chain of large-sized segments while crossing the IP_MAXPACKET limit. big_tcp_tcp_seq - validates that a packet with a wrong sequence number doesn't coalesce. The test uses a sequence number for which the low 16 bits correspond to the correct sequence number to validate against truncation bugs, since total aggregate length crosses over the legacy size limit for BIG TCP. big_tcp_large_max - validates that coalescing stops at the configured BIG TCP limit. Use a gro_flush_timeout value 2x higher for the BIG TCP test cases to prevent under-coalescing. Signed-off-by: Narcisa Vasile <narcisav.kernel@gmail.com> Link: https://patch.msgid.link/20260913052419.77910-1-narcisav.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-15selftests: drv-net: psp: check the PSP disassociation notificationsJakub Kicinski
The main namespace must see a change which no longer lists the device, and the namespace which lost its last association must see the device go away. Check that on both paths which generate the notifications, dev-disassoc and netdevice removal, and check that a namespace which still has another association is only told about the change. Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com> Link: https://patch.msgid.link/20260912200426.121025-7-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-15selftests: drv-net: psp: factor out creating a netkit in the test netnsJakub Kicinski
The netkit removal test builds a disposable netkit pair and moves its peer into the test namespace. The next commit needs a second associated device there, so move that to a helper. No functional change, other than looking the new peer up among all netkit devices rather than the two the environment created, which is what makes it reusable. Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com> Link: https://patch.msgid.link/20260912200426.121025-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-15selftests: drv-net: psp: check the ifindex an associated netns seesJakub Kicinski
dev-get must not report the ifindex outside of the main netns. The dev-get checks for an associated namespace are already there, add the "no main ifindex" assertion. Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com> Link: https://patch.msgid.link/20260912200426.121025-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-15selftests: drv-net: psp: fix linter issuesJakub Kicinski
Fix ruff 0.16 warnings: C403 Unnecessary list comprehension (rewrite as a set comprehension) Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com> Link: https://patch.msgid.link/20260912200426.121025-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-15selftests: drv-net: remove duplicate functions in hds.pyDimitri Daskalakis
There were duplicate definitions of the enabled_set_xdp and set_xdp test methods. The two enabled_set_xdp copies were identical apart from a comment and whitespace. The set_xdp copies differed by a reset of the hds configuration. commit ee3ae27721fb ("selftests: drv-net: hds: restore hds settings") introduced the config reset, but this was shadowed by the copy. Signed-off-by: Dimitri Daskalakis <daskald@meta.com> Link: https://patch.msgid.link/20260911224255.3675903-1-dimitri.daskalakis1@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-15selftests: drv-net: devmem: set reuseaddr on the sender's source portJakub Kicinski
devmem.py fails on the HW runners with: CMD[remote]: dd if=/dev/zero bs=512 count=1 2>/dev/null | socat -b 512 \ -u - TCP6:[fd00:2::1]:50051,bind=[fd00:2::2]:50051,nodelay STDERR: socat[41018] W bind(5, {AF=10 [fd00:2::2]:50051}, 28): \ Address already in use ncdevmem installs a 5-tuple flow rule which matches the source port, so socat has to bind it explicitly. The port comes from rand_port(), which checks availability on the DUT - but we bind on the remote... That said the failure rate seems to high to be random collisions (~2% per sub-test). It's probably TIME_WAIT sockets on the remote, run_rx_hds() alone creates 12 of them. Set reuseaddr so a TIME_WAIT socket does not fail the bind. Collisions with a live socket are still possible, we'll see if they are frequent enough to care. Reviewed-by: Breno Leitao <leitao@debian.org> Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20260912203101.153688-1-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-09-14selftests: net: add rss_multiqueue test variant to iou-zcrxJuanlu Herrero
Add a rss_multiqueue Python test variant that exercises multi-queue zero-copy receive on a single listening socket. Reviewed-by: David Wei <dw@davidwei.uk> Signed-off-by: Juanlu Herrero <juanlu@fastmail.com> Link: https://patch.msgid.link/20260909-iou-zcrx-v7-6-6b5d48a2a922@fastmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: net: add multithread server support to iou-zcrxJuanlu Herrero
Run the iou-zcrx server as N worker threads, each owning one receive queue with its own io_uring and zero-copy receive (zcrx) ifq, so the test can exercise multi-queue zero-copy receive. The main thread owns the listening socket, accepts connections, and dispatches each to the worker owning the queue it landed on by matching SO_INCOMING_NAPI_ID against per-queue NAPI IDs. Signed-off-by: Juanlu Herrero <juanlu@fastmail.com> Link: https://patch.msgid.link/20260909-iou-zcrx-v7-5-6b5d48a2a922@fastmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: net: add multithread client support to iou-zcrxJuanlu Herrero
Add pthreads to the iou-zcrx client so that multiple connections can be established simultaneously. Each client thread connects to the server and sends its payload independently. Introduce the -t option to control the number of threads (default 1), preserving backwards compatibility with existing tests. Reviewed-by: David Wei <dw@davidwei.uk> Signed-off-by: Juanlu Herrero <juanlu@fastmail.com> Link: https://patch.msgid.link/20260909-iou-zcrx-v7-4-6b5d48a2a922@fastmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: net: refactor server state into struct thread_ctxJuanlu Herrero
Move server-side state (io_uring ring, zcrx area, refill ring, receive tracking) from global variables into a local struct thread_ctx. This is a pure refactor with no behavior change: run_server still allocates a single context on the stack and runs single-threaded, using io_uring accept and recvzc as before. This prepares the ground for the multithread server support in the following commits, which spawns N worker threads each with their own struct thread_ctx. Reviewed-by: David Wei <dw@davidwei.uk> Signed-off-by: Juanlu Herrero <juanlu@fastmail.com> Link: https://patch.msgid.link/20260909-iou-zcrx-v7-3-6b5d48a2a922@fastmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: net: remove unused variable in process_recvzc()Juanlu Herrero
Remove the unused `sqe` variable in preparation for the multiqueue rss selftest changes to process_recvzc() in the following commits. Signed-off-by: Juanlu Herrero <juanlu@fastmail.com> Link: https://patch.msgid.link/20260909-iou-zcrx-v7-2-6b5d48a2a922@fastmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: net: fix get_refill_ring_size() to use its local variableJuanlu Herrero
In preparation for multi-threaded rss selftests, fix get_refill_ring_size() to use its local `size` variable instead of assigning to the file-global `ring_size`. Signed-off-by: Juanlu Herrero <juanlu@fastmail.com> Link: https://patch.msgid.link/20260909-iou-zcrx-v7-1-6b5d48a2a922@fastmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: drv-net: extend so_txtime with hw offloadWillem de Bruijn
Add two pacing hardware offload variants 1. one that uses FQ to safely offload when within bounds. 2. one that uses pfifo_fast and thus forwards all packets. Verify that the packets are paced in hardware with new flag '-H'. Also increase rcvtimeout significantly to reduce flakiness. Especially for the new beyond_hw_horizon test, which is close to the 100ms limit. But update recv_verify_empty to take MSG_DONTWAIT. That last empty check must not delay each testcase by the receive timeout. Hardware pacing offload can complete packets out of order. So the reverse_order test is expected to pass with pfifo_fast too. Do not test ETF, which does not change its dequeue behavior based on pacing_offload. The pfifo_fast beyond_hw_horizon testcase expects a failure because the packet exceeds the hardware horizon and is transmitted immediately, violating receiver arrival bounds. On slow machines (KSFT_MACHINE_SLOW), timing variance errors are suppressed by the receiver, so relax the failure expectation only for this timing-sensitive case while preserving deterministic checks for other tests (such as ETF invalid txtime). Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260910171131.2532487-8-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: drv-net: in so_txtime tell apart sw from hw pacingWillem de Bruijn
Detect software pacing in so_txtime.c using SO_TIMESTAMPING. If '-H' (hw) is passed 1. measure sw tx delay with SOF_TIMESTAMPING_TX_SOFTWARE, and 2. fail if delay exceeds a threshold, indicating pacing This will be used in the next patch in the series. Also extend while condition to account for possible variance. This applies to all tests, not just the new '-H' variants. Also reorder getopt parameters to make them alphabetical. Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260910171131.2532487-7-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: drv-net: refactor so_txtime errqueue handlingWillem de Bruijn
Prepare error queue handling for upcoming SO_EE_ORIGIN_TIMESTAMPING messages in the next patch in this series. Convert do_recv_errqueue_timeout into dispatcher do_recv_errqueue and move SO_EE_ORIGIN_TXTIME specific code into a separate helper. This will make the next patch a lot more readable. No functional changes. Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260910171131.2532487-6-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14selftests: net: add ruff linter exclusionsJakub Kicinski
Fedora is now shipping ruff 0.16 which added a ton of more opinionated rules. Let's add some exclusions for checks which are both noisy and IMO of questionable value. We can still follow them for new code but it's a matter of preference. C401: set(x for x in Y) -> {x for x in Y} I find the set() a little more readable. I001: hard requirements to sort includes A little too much RUF015: list(set_a - set_b)[0] -> next(iter(set_a - set_b)) list + index are more readable to a "C person" for sure. Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Link: https://patch.msgid.link/20260912233926.304768-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-11selftests: netdevsim: add TEST_INCLUDES to MakefileHangbin Liu
Some netdevsim selftests source forwarding/lib.sh and other files, but the Makefile doesn't have TEST_INCLUDES targets, which makes make INSTALL_PATH=/tmp/kself TARGETS=drivers/net/netdevsim \ -C tools/testing/selftests install failed to install related lib files. Add TEST_INCLUDES to the Makefile to install the dependencies. Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260910-nsim_lib-v1-1-0be0d49eaa42@kylinos.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-10selftests: net: add ctl_file_write() helperJakub Kicinski
Setting a sysctl or a sysfs attribute for the duration of a test and putting the old value back has been open coded multiple times. We generally avoid creating library helpers but this one is very common, and the defer is a little tricky as using the same function for defer as the initial write leads to an infinite loop (not that I would ever make such mistake!) Some of the conversions are not identical, but arguably ctl_file_write() semantics are more correct. Reviewed-by: Nimrod Oren <noren@nvidia.com> Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260909180009.1894019-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-09selftests: drv-net: warn if LOCAL_V6 has DAD or not kept on link downJakub Kicinski
napi_id.py intermittently fails to start its helper on Intel and Google HW runners: CMD: /srv/netdev/drivers/net/napi_id_helper 3001::1 37569 EXIT: 1 STDERR: bind failed: Cannot assign requested address Either keep_addr_on_down is not set or more likely the address is configured without nodad. Having to make sure that all tests always wait for DAD after impacting the link would be a whack-a-mole so we expect the env to have nodad and keep_addr_on_down set. Warn about both while validating the environment, and document this. We could fail completely but most tests don't impact the link so for quick local testing it'd be annoying to have to apply the settings. I hope the warninging stikes the right balance. Link: https://patch.msgid.link/20260908181956.1357684-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-08selftests/drivers/net: include lib/sh/*.shHangbin Liu
When I tried to install and run bonding selftests via: make INSTALL_PATH=/tmp/kself TARGETS=drivers/net/bonding \ -C tools/testing/selftests install Some tests fail because net/lib/sh/defer.sh is missing: /tmp/kself/net/forwarding/../lib.sh: line 5: /tmp/kself/net/lib/sh/defer.sh: No such file or directory One option is to add defer.sh directly to TEST_INCLUDES. Alternatively, follow the approach from commit f72aa1b27628 ("selftests: net: include lib/sh/*.sh with lib.sh"), which pulls in all .sh files to accommodate future changes to the library directory. This patch adds a wildcard to include all shell files for drivers/net tests that consume net lib.sh. TEST_INCLUDES is also sorted to avoid ordering‑related problems for future modifications. The team driver is not affected by this bug, but we use the wildcard for it as well, rather than listing only defer.sh. Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn> Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Breno Leitao <leitao@debian.org> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260907-selftest_lib_defer-v1-1-8af94645aaa3@kylinos.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-08selftests: drv-net: Use cross-compilation environment for the io_uring checkMaxime Chevallier (Netdev Foundation)
To test for the presence of zerocopy support in the available liburing, a small check program is compiled. The CC value used for the io_uring library check defaults to the host compiler, which will incorrectly validate liburing based on the host's sysroot and not the target's. Normally the CC for cross-compile is set in lib.mk, but this also requires the test list to be set when we include it, and this check needs to run first. Note that this doesn't cover the LLVM cross-compiling case though, as with LLVM we may still detect based on the host liburing. Suggested-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Matthieu Baerts (Netdev Foundation) <matttbe@kernel.org> Signed-off-by: Maxime Chevallier (Netdev Foundation) <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20260907161438.755125-3-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-02selftests: drv-net: bump the timeout to 15minJakub Kicinski
The XDP test takes 9m30s on the slowest NIC with debug kernel. Let's give ourselves a 50% margin and set the timeout to 15min. Reviewed-by: Joe Damato <joe@dama.to> Reviewed-by: Nimrod Oren <noren@nvidia.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260901200728.2063720-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-02selftests: drv-net: split gro.py into one test per coalescing modeJakub Kicinski
gro.py runs its full set of cases three times over - against SW GRO, HW GRO and LRO. It's our test with the longest runtime. The 318 cases take 12m30s on mlx5 with a debug kernel. Bumping the timeout for all tests feels wrong when we can so easily split the GRO test by execution mode. Shorter runtime also helps retry just the failing portion / mode (we retry failing tests to try to detect flakes vs real failures). Move the main logic to gro_lib.py and add one program per mode - gro_sw.py, gro_hw.py and gro_lro.py, 102 cases each. Move PPPoE to a dedicated test. It has been tacked onto the tests in an ugly way, and it only runs against SW GRO anyway. Note that unfortunately this will case a rename of all test cases. The mode moves from the case name to the test name gro.py test.sw_ipv4_data_same becomes gro_sw.py test.ipv4_data_same Reviewed-by: Joe Damato <joe@dama.to> Reviewed-by: Nimrod Oren <noren@nvidia.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260901200728.2063720-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-02selftests: drv-net: hw: rename gro_hw.py to gro_stats.pyJakub Kicinski
We need to free up the gro_hw.py name for the HW-GRO half of gro.py, which we need to split by mode (sw / hw / lro). The file checks mostly qstat counters, so name it after stats. Reviewed-by: Joe Damato <joe@dama.to> Reviewed-by: Nimrod Oren <noren@nvidia.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260901200728.2063720-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-13selftests: netconsole: add a userdata torture testBreno Leitao
The userdata payload is rebuilt and republished on every configfs write, including while the target is enabled and messages are being sent. Add netcons_userdata.sh that runs random tests with userdata. Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com> Link: https://patch.msgid.link/20260810-netcons-userdata-rcu-v3-2-f65557f769ce@debian.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-08-12selftests: drv-net: so_txtime: fix qdisc replace with handleWillem de Bruijn
The blamed commit updated a tc replace command by adding a handle. - tc(f"qdisc replace dev {ifname} root {qdisc} {optargs}") + tc(f"qdisc replace dev {ifname} root handle 1: {qdisc} {optargs}") This breaks the test if the root qdisc already has that handle and is of different kind, with "Invalid qdisc name: must match existing qdisc." If no handle is asked, or the kind differs, tc replace removes the old qdisc and grafts a new one. If a handle is asked and exists, tc replace tries to change the qdisc in place, for which the kind must be the same. It does not trigger in all setups, like netdevsim or debian 13, which do not have root handle 1:. But it is a common root handle. Solve the bug by first deleting the existing root qdisc if one exists. Wrap that command in a try block, because it will fail for default qdiscs with handle 0: with "Error: Cannot delete qdisc with handle of zero." Reported-by: Jakub Kicinski <kuba@kernel.org> Closes: https://lore.kernel.org/netdev/20260810183118.32d5c06a@kernel.org/ Fixes: ef3d6cca02c8 ("selftests: drv-net: so_txtime: only send test traffic to sch_etf") Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260811182856.2702163-1-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11selftests: drv-net: hide the devlink port_split testJakub Kicinski
The devlink port_split test has limited applicability. NICs (as opposed to switches) require at least a re-probe to apply the split configuration. On top of that the test is not compatible with our driver env, it just splits all ports on the system, not only what NETIF points at. Long term we may want to add some indication in devlink whether the port splitting is runtime (cmode of sorts), and fix the test to follow driver env. But since no (known) NIC driver can support runtime anyway let's just hide the test from the selftest framework by moving it to extra files. Having this test randomly break unrelated NICs within the DUT makes people implement allow-lists for ksft, which then means their setups don't run new tests. It's very useful during test review to see whether the test works across all the runners. Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20260811004645.1072124-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: bonding: disable DAD for IPv6 addressesJakub Kicinski
bond_reset() waits up to 2 seconds for IPv6 connectivity. With default settings DAD itself may take almost 2 seconds, causing flakes on debug builds. It used to flake once or twice a week, recently it started failing once a day. Probably some downstream changes to scheduler, or our machines go busier. A lot of selftests already use nodad, let's use nodad in bonding, too. I don't see an obvious reason why DAD would be important to the test. Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn> Link: https://patch.msgid.link/20260808162345.2442594-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: drv-net: so_txtime: only send test traffic to sch_etfWillem de Bruijn
The ETF qdiscs drops traffic without a socket or txtime. Even with parameter skip_sock_check regular traffic is affected by ETF. This test ran fine when run manually in a pure software environment. But with drv-net across two hosts tests fail as early as when calling cfg.remote.deploy due to effectively losing connectivity. Isolate the intended test traffic: - mark that with SO_MARK 100 - install a regular permissive root prio qdisc for background traffic - install the ETF qdisc as leaf - install a filter that only directs SO_MARK 100 traffic to this leaf Technically other high prio traffic will map onto this leaf based on ToS band mapping too. But that is immaterial in practice. Fixes: 5c6baef3885c ("selftests: drv-net: convert so_txtime to drv-net") Signed-off-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260808160129.890119-1-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: drv-net: let ethtool stats settle before readingJakub Kicinski
Some devices refresh the statistics exposed via ethtool only periodically, every stats-block-usecs (as reported by ethtool -c). ethtool_std_stats and ethtool_rmon sample the counters immediately after generating traffic, so on such devices they can read stale values and fail with a delta short of the packets just sent. Add a hw_stats_settle() helper which sleeps for 1.25x the configured stats-block-usecs (defaulting to 20ms when the device reports no, or a zero, period). Use it for ethtool std stats and RMON. The 1.25x/20msec heuristic matches what the Python tests do. Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20260808163653.2460381-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: drv-net: pace ethtool_std_stats packet generationJakub Kicinski
mausezahn defaults to sending packets back to back at the maximum rate, which can cause packet loss, especially if receiver is running a debug kernel. Space the generated packets out (-d 10usec), like ethtool_rmon already does. Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20260808163653.2460381-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-10selftests: netdevsim: fix SIGPIPE flake in ethtool-coalesceJakub Kicinski
The adaptive-rx and adaptive-tx checks use 'ethtool -c | grep -q' under 'set -o pipefail'. grep -q exits as soon as it finds a match, which can happen before ethtool finishes writing its output. When that occurs, ethtool receives SIGPIPE causing (uninformative): # selftests: drivers/net/netdevsim: ethtool-coalesce.sh # FAILED 1/22 checks not ok 1 selftests: drivers/net/netdevsim: ethtool-coalesce.sh # exit=1 This happens on debug kernels in NIPA, ~4% of the time. Link: https://patch.msgid.link/20260808163416.2456810-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-07selftests/net: devmem.py: add check_rx_large_niovBobby Eshleman
Add a new devmem test case for binding the dmabuf with rx-page-size=16K. The test sweeps RX payload sizes straddling the niov boundary to cover the sub-niov, exact-niov, and multi-niov RX paths. Silence pylint invalid-name (`with open() as f`) and too-many-arguments (ncdevmem_rx grew to 6 args) at file scope. Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260805-tcpdm-large-niovs-v8-3-3e0225e2808c@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-07selftests/net: ncdevmem: add -b option to set rx-page-size on bindBobby Eshleman
Add -b <bytes> to request a non-default niov size via NETDEV_A_DMABUF_RX_PAGE_SIZE. When the value exceeds PAGE_SIZE, udmabuf_alloc() switches to an MFD_HUGETLB-backed memfd so each 2 MB hugepage produces one naturally-aligned sg entry. Acked-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260805-tcpdm-large-niovs-v8-2-3e0225e2808c@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-07selftests: net: shaper: Cover recursive node cleanupMohsin Bashir
Exercise cleanup of nested nodes after deleting their last queue leaf. The test builds a two-level node hierarchy and checks that removing the queue also removes both now-empty node shapers. Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Link: https://patch.msgid.link/20260805030936.1092907-15-mohsin.bashr@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-07selftests: net: shaper: Cover mixed-parent groupingMohsin Bashir
Add coverage for grouping leaves that currently belong to different parent nodes. The test verifies that an implicit parent is rejected, an explicit parent succeeds, and the old empty parent nodes are cleaned up. Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Link: https://patch.msgid.link/20260805030936.1092907-14-mohsin.bashr@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>