* [PATCH net v2] selftests: net: veth: propagate channel-check failures to exit status
@ 2026-11-15 21:47 Omokefe Emmanuel Onanaroghene
2026-11-16 0:45 ` Tianyi Gao
2026-11-16 21:50 ` [PATCH net v2] selftests: net: veth: propagate channel-check " netdev-bot+sashiko
0 siblings, 2 replies; 17+ messages in thread
From: Omokefe Emmanuel Onanaroghene @ 2026-11-15 21:47 UTC (permalink / raw)
To: kuba, tianyi, netdev, linux-kselftest, linux-kernel, bpf
Cc: davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk,
john.fastabend, sdf, skhan, Omokefe Emmanuel Onanaroghene
chk_channels() reports mismatches with a "fail" line but never sets
ret, so the script exits 0 even when channel counts are wrong. Every
other check helper in the file (__chk_flag, chk_xdp_feature, chk_gro)
sets ret=1 on failure, and all chk_channels() call sites expect the
check to pass. Set ret=1 on mismatch.
Fixes: 1ec2230fc721 ("selftests: net: veth: add tests for set_channel")
Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
---
v2: correct Fixes tag (was c017800af5c71, now 1ec2230fc721)
tools/testing/selftests/net/veth.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh
index 64c2a5a59821d..5c1dbe1516bb4 100755
--- a/tools/testing/selftests/net/veth.sh
+++ b/tools/testing/selftests/net/veth.sh
@@ -130,6 +130,7 @@ chk_channels() {
echo " ok "
else
echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined"
+ ret=1
fi
}
--
2.43.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH net v2] selftests: net: veth: propagate channel-check failures to exit status 2026-11-15 21:47 [PATCH net v2] selftests: net: veth: propagate channel-check failures to exit status Omokefe Emmanuel Onanaroghene @ 2026-11-16 0:45 ` Tianyi Gao 2026-11-16 0:56 ` Hangbin Liu 2026-11-16 8:41 ` [PATCH net v3 0/2] selftests: net: veth: propagate check " Omokefe Emmanuel Onanaroghene 2026-11-16 21:50 ` [PATCH net v2] selftests: net: veth: propagate channel-check " netdev-bot+sashiko 1 sibling, 2 replies; 17+ messages in thread From: Tianyi Gao @ 2026-11-16 0:45 UTC (permalink / raw) To: Omokefe Emmanuel Onanaroghene Cc: kuba, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan On Sun, 15 Nov 2026 22:47:02 +0100 Omokefe Emmanuel Onanaroghene wrote: > chk_channels() reports mismatches with a "fail" line but never sets > ret, so the script exits 0 even when channel counts are wrong. I found three more checks in the same file with the same problem: bad setting: XDP with RX nr less than TX bad setting: reducing RX nr below peer TX with XDP set bad setting: increasing peer TX nr above RX with XDP set Maybe it is worth fixing them all at once? Tested-by: Tianyi Gao <tianyi@cloudflare.com> Cheers, Tianyi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v2] selftests: net: veth: propagate channel-check failures to exit status 2026-11-16 0:45 ` Tianyi Gao @ 2026-11-16 0:56 ` Hangbin Liu 2026-11-16 8:41 ` [PATCH net v3 0/2] selftests: net: veth: propagate check " Omokefe Emmanuel Onanaroghene 1 sibling, 0 replies; 17+ messages in thread From: Hangbin Liu @ 2026-11-16 0:56 UTC (permalink / raw) To: Tianyi Gao Cc: Omokefe Emmanuel Onanaroghene, kuba, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan On Mon, Nov 16, 2026 at 12:45:48AM +0000, Tianyi Gao wrote: > On Sun, 15 Nov 2026 22:47:02 +0100 Omokefe Emmanuel Onanaroghene wrote: > > chk_channels() reports mismatches with a "fail" line but never sets > > ret, so the script exits 0 even when channel counts are wrong. > > I found three more checks in the same file with the same problem: > > bad setting: XDP with RX nr less than TX > bad setting: reducing RX nr below peer TX with XDP set > bad setting: increasing peer TX nr above RX with XDP set > > Maybe it is worth fixing them all at once? +1 > > Tested-by: Tianyi Gao <tianyi@cloudflare.com> > Hangbin ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net v3 0/2] selftests: net: veth: propagate check failures to exit status 2026-11-16 0:45 ` Tianyi Gao 2026-11-16 0:56 ` Hangbin Liu @ 2026-11-16 8:41 ` Omokefe Emmanuel Onanaroghene 2026-11-16 8:41 ` [PATCH net v3 1/2] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene ` (2 more replies) 1 sibling, 3 replies; 17+ messages in thread From: Omokefe Emmanuel Onanaroghene @ 2026-11-16 8:41 UTC (permalink / raw) To: Tianyi Gao, Hangbin Liu Cc: netdev, linux-kselftest, linux-kernel, bpf, kuba, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, Omokefe Emmanuel Onanaroghene Four checks in tools/testing/selftests/net/veth.sh report failure without setting ret, so the script exits 0 even when they fail. Fix all four: chk_channels() plus the three "bad setting" negative tests spotted by Tianyi during review of v2. Changes v2 -> v3: - Add Tianyi Gao's Tested-by to patch 1 (thanks!). - Add patch 2 fixing the remaining three checks. Changes v1 -> v2: - Correct Fixes tag to 1ec2230fc721. Omokefe Emmanuel Onanaroghene (2): selftests: net: veth: propagate channel-check failures to exit status selftests: net: veth: propagate bad-settings check failures to exit status tools/testing/selftests/net/veth.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net v3 1/2] selftests: net: veth: propagate channel-check failures to exit status 2026-11-16 8:41 ` [PATCH net v3 0/2] selftests: net: veth: propagate check " Omokefe Emmanuel Onanaroghene @ 2026-11-16 8:41 ` Omokefe Emmanuel Onanaroghene 2026-11-19 0:40 ` netdev-bot+sashiko 2026-11-16 8:41 ` [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene 2026-11-16 13:08 ` [PATCH net v3 0/2] " Tianyi Gao 2 siblings, 1 reply; 17+ messages in thread From: Omokefe Emmanuel Onanaroghene @ 2026-11-16 8:41 UTC (permalink / raw) To: Tianyi Gao, Hangbin Liu Cc: netdev, linux-kselftest, linux-kernel, bpf, kuba, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, Omokefe Emmanuel Onanaroghene chk_channels() reports mismatches with a "fail" line but never sets ret, so the script exits 0 even when channel counts are wrong. Every other check helper in the file (__chk_flag, chk_xdp_feature, chk_gro) sets ret=1 on failure, and all chk_channels() call sites expect the check to pass. Set ret=1 on mismatch. Fixes: 1ec2230fc721 ("selftests: net: veth: add tests for set_channel") Tested-by: Tianyi Gao <tianyi@cloudflare.com> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com> --- tools/testing/selftests/net/veth.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh index 64c2a5a59821d..5c1dbe1516bb4 100755 --- a/tools/testing/selftests/net/veth.sh +++ b/tools/testing/selftests/net/veth.sh @@ -130,6 +130,7 @@ chk_channels() { echo " ok " else echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined" + ret=1 fi } -- 2.43.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 1/2] selftests: net: veth: propagate channel-check failures to exit status 2026-11-16 8:41 ` [PATCH net v3 1/2] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:40 ` netdev-bot+sashiko 0 siblings, 0 replies; 17+ messages in thread From: netdev-bot+sashiko @ 2026-11-19 0:40 UTC (permalink / raw) To: emmaonana18 Cc: tianyi, hangbin.liu, netdev, linux-kselftest, linux-kernel, bpf, kuba, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 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 patch adds `ret=1` to the mismatch branch of chk_channels() in tools/testing/selftests/net/veth.sh (line 133). -- selftests: net: veth: propagate channel-check failures to exit status This commit makes chk_channels() in veth.sh set ret=1 when the observed channel counts do not match the expected ones. With it, any channel mismatch makes the script exit with a non-zero status. > diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh > index 64c2a5a59821d..5c1dbe1516bb4 100755 > --- a/tools/testing/selftests/net/veth.sh > +++ b/tools/testing/selftests/net/veth.sh > @@ -130,6 +130,7 @@ chk_channels() { > echo " ok " > else > echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined" > + ret=1 > fi > } > [Severity: Medium] With this change, can a check whose result depends on the test environment now fail the whole veth.sh run? The "setting invalid channels nr" check expects a request for CPUS + 1 TX queues to be rejected. CPUS comes from nproc: readonly CPUS=`nproc` ... ip netns exec $NS_DST ethtool -L veth$DST tx $((CPUS + 1)) 2>/dev/null chk_channels "setting invalid channels nr" $DST $CUR_RX $CUR_TX The veth queue limit is num_possible_cpus(), capped at 4096. It is not the number of CPUs the process can use: drivers/net/veth.c:veth_get_num_queues() { /* enforce the same queue limit as rtnl_create_link */ int queues = num_possible_cpus(); ... } veth_get_channels() reports dev->num_tx_queues as max_tx. The ethtool core in net/ethtool/channels.c only rejects tx_count > max_tx. nproc returns the number of CPUs the process can use. That can be smaller than the number of possible CPUs on machines with hot-pluggable CPU slots, or when the test runs under taskset or a restricted cpuset. In those cases the request is valid. No XDP program is attached at that point, so veth_set_channels() accepts it and real_num_tx_queues becomes CPUS + 1. chk_channels() then sees cur_tx != $CUR_TX, and with this patch veth.sh exits 1. Before this patch, the mismatch only printed a fail line. The later patch in the series ("selftests: net: veth: propagate bad-settings check failures to exit status") does not change this check. Could the out-of-range value come from the device's advertised maximum instead of nproc? For example, the "Pre-set maximums" TX value from ethtool -l, plus one. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116084107.6675-1-emmaonana18%40gmail.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check failures to exit status 2026-11-16 8:41 ` [PATCH net v3 0/2] selftests: net: veth: propagate check " Omokefe Emmanuel Onanaroghene 2026-11-16 8:41 ` [PATCH net v3 1/2] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene @ 2026-11-16 8:41 ` Omokefe Emmanuel Onanaroghene 2026-11-16 14:04 ` Tianyi Gao 2026-11-16 13:08 ` [PATCH net v3 0/2] " Tianyi Gao 2 siblings, 1 reply; 17+ messages in thread From: Omokefe Emmanuel Onanaroghene @ 2026-11-16 8:41 UTC (permalink / raw) To: Tianyi Gao, Hangbin Liu Cc: netdev, linux-kselftest, linux-kernel, bpf, kuba, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, Omokefe Emmanuel Onanaroghene Three more checks in veth.sh print "fail - set operation successful ?!?" without setting ret: "bad setting: XDP with RX nr less than TX", "bad setting: reducing RX nr below peer TX with XDP set", and "bad setting: increasing peer TX nr above RX with XDP set". A kernel that wrongly accepts any of these invalid operations would be reported yet the script would still exit 0. Wrap each fail branch so it sets ret=1. Fixes: 1ec2230fc721 ("selftests: net: veth: add tests for set_channel") Reported-by: Tianyi Gao <tianyi@cloudflare.com> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com> --- tools/testing/selftests/net/veth.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh index 5c1dbe1516bb4..0b173beed3442 100755 --- a/tools/testing/selftests/net/veth.sh +++ b/tools/testing/selftests/net/veth.sh @@ -474,7 +474,7 @@ if [ $CPUS -gt 1 ]; then printf "%-60s" "bad setting: XDP with RX nr less than TX" ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \ section xdp 2>/dev/null &&\ - echo "fail - set operation successful ?!?" || echo " ok " + { echo "fail - set operation successful ?!?"; ret=1; } || echo " ok " # the following tests will run with multiple channels active ip netns exec $NS_SRC ethtool -L veth$SRC rx 2 @@ -483,7 +483,7 @@ if [ $CPUS -gt 1 ]; then section xdp 2>/dev/null printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set" ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\ - echo "fail - set operation successful ?!?" || echo " ok " + { echo "fail - set operation successful ?!?"; ret=1; } || echo " ok " CUR_RX=2 CUR_TX=2 fi @@ -491,7 +491,7 @@ fi if [ $CPUS -gt 2 ]; then printf "%-60s" "bad setting: increasing peer TX nr above RX with XDP set" ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null &&\ - echo "fail - set operation successful ?!?" || echo " ok " + { echo "fail - set operation successful ?!?"; ret=1; } || echo " ok " chk_channels "setting invalid channels nr" $DST 2 2 fi -- 2.43.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check failures to exit status 2026-11-16 8:41 ` [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene @ 2026-11-16 14:04 ` Tianyi Gao 2026-11-19 0:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate " Omokefe Emmanuel Onanaroghene 0 siblings, 1 reply; 17+ messages in thread From: Tianyi Gao @ 2026-11-16 14:04 UTC (permalink / raw) To: Omokefe Emmanuel Onanaroghene Cc: Hangbin Liu, netdev, linux-kselftest, linux-kernel, bpf, Jakub Kicinski, David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman, Shuah Khan, Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev, Shuah Khan On Mon, 16 Nov 2026 09:41:07 +0100 Omokefe Emmanuel Onanaroghene wrote: > - echo "fail - set operation successful ?!?" || echo " ok " > + { echo "fail - set operation successful ?!?"; ret=1; } || echo " ok " Two small suggestions: 1. These lines are 85 columns wide, over the 80-column limit. 2. The style is inconsistent with the rest of the file. Other checks use if/else instead of a "cmd && { ...; } || ..." chain. Cheers, Tianyi ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status 2026-11-16 14:04 ` Tianyi Gao @ 2026-11-19 0:29 ` Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH net v4 1/3] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene ` (3 more replies) 0 siblings, 4 replies; 17+ messages in thread From: Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:29 UTC (permalink / raw) To: tianyi, hangbin.liu Cc: kuba, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, Omokefe Emmanuel Onanaroghene Four checks in tools/testing/selftests/net/veth.sh report failures without setting ret, allowing the script to exit 0 even when a check fails. Set ret=1 in chk_channels() and the three "bad setting" negative tests identified by Tianyi during review of v2. Patch 3 fixes the invalid TX channel test, which used nproc + 1 to determine an out-of-range value. However, nproc can be lower than num_possible_cpus() when CPU affinity or cpusets restrict a process, meaning the kernel may accept the requested queue count. This could cause false failures on a correctly functioning kernel once earlier patches propagated test failures. Use the kernel-reported max_tx + 1 instead, ensuring the attempted value always exceeds the device's supported maximum. Spotted by Sashiko AI review of v2. Changes v3 -> v4: - Patch 2: use if/else instead of "&& { ...; } ||" chains, keep lines within 80 columns (thanks Tianyi for the review). - Add patch 3 deriving the invalid tx value from the kernel maximum. Changes v2 -> v3: - Add Tianyi Gao's Tested-by to patch 1 (thanks!). - Add patch 2 fixing the remaining three checks. Changes v1 -> v2: - Correct Fixes tag to 1ec2230fc721. Omokefe Emmanuel Onanaroghene (3): selftests: net: veth: propagate channel-check failures to exit status selftests: net: veth: propagate bad-settings check failures to exit status selftests: net: veth: derive invalid-tx test value from kernel max tools/testing/selftests/net/veth.sh | 31 +++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net v4 1/3] selftests: net: veth: propagate channel-check failures to exit status 2026-11-19 0:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate " Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:30 ` Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH net v4 2/3] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene ` (2 subsequent siblings) 3 siblings, 0 replies; 17+ messages in thread From: Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:30 UTC (permalink / raw) To: tianyi, hangbin.liu Cc: kuba, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, Omokefe Emmanuel Onanaroghene chk_channels() reports mismatches with a "fail" line but never sets ret, so the script exits 0 even when channel counts are wrong. Every other check helper in the file (__chk_flag, chk_xdp_feature, chk_gro) sets ret=1 on failure, and all chk_channels() call sites expect the check to pass. Set ret=1 on mismatch. Fixes: 1ec2230fc721 ("selftests: net: veth: add tests for set_channel") Tested-by: Tianyi Gao <tianyi@cloudflare.com> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com> --- tools/testing/selftests/net/veth.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh index 64c2a5a59821d..5c1dbe1516bb4 100755 --- a/tools/testing/selftests/net/veth.sh +++ b/tools/testing/selftests/net/veth.sh @@ -130,6 +130,7 @@ chk_channels() { echo " ok " else echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined" + ret=1 fi } -- 2.43.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH net v4 2/3] selftests: net: veth: propagate bad-settings check failures to exit status 2026-11-19 0:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate " Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH net v4 1/3] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:30 ` Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH] selftests: net: veth: derive invalid-tx test value from kernel max Omokefe Emmanuel Onanaroghene 2026-11-19 1:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status Tianyi Gao 3 siblings, 0 replies; 17+ messages in thread From: Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:30 UTC (permalink / raw) To: tianyi, hangbin.liu Cc: kuba, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, Omokefe Emmanuel Onanaroghene Three more checks in veth.sh print "fail - set operation successful ?!?" without setting ret: "bad setting: XDP with RX nr less than TX", "bad setting: reducing RX nr below peer TX with XDP set", and "bad setting: increasing peer TX nr above RX with XDP set". A kernel that wrongly accepts any of these invalid operations would be reported yet the script would still exit 0. Wrap each fail branch so it sets ret=1. Fixes: 1ec2230fc721 ("selftests: net: veth: add tests for set_channel") Reported-by: Tianyi Gao <tianyi@cloudflare.com> Link: https://lore.kernel.org/all/CAG4wq-cd01i7YrcFPmma=BXUcwn_PK=wneKW=vyEBYzQ3Bn7QA@mail.gmail.com/ Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com> --- tools/testing/selftests/net/veth.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh index 5c1dbe1516bb4..2a37d21f97da5 100755 --- a/tools/testing/selftests/net/veth.sh +++ b/tools/testing/selftests/net/veth.sh @@ -472,9 +472,13 @@ if [ $CPUS -gt 1 ]; then ip netns exec $NS_DST ethtool -L veth$DST rx 1 tx 2 2>/dev/null ip netns exec $NS_SRC ethtool -L veth$SRC rx 1 tx 2 2>/dev/null printf "%-60s" "bad setting: XDP with RX nr less than TX" - ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \ - section xdp 2>/dev/null &&\ - echo "fail - set operation successful ?!?" || echo " ok " + if ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \ + section xdp 2>/dev/null; then + echo "fail - set operation successful ?!?" + ret=1 + else + echo " ok " + fi # the following tests will run with multiple channels active ip netns exec $NS_SRC ethtool -L veth$SRC rx 2 @@ -482,16 +486,24 @@ if [ $CPUS -gt 1 ]; then ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \ section xdp 2>/dev/null printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set" - ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\ - echo "fail - set operation successful ?!?" || echo " ok " + if ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null; then + echo "fail - set operation successful ?!?" + ret=1 + else + echo " ok " + fi CUR_RX=2 CUR_TX=2 fi if [ $CPUS -gt 2 ]; then printf "%-60s" "bad setting: increasing peer TX nr above RX with XDP set" - ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null &&\ - echo "fail - set operation successful ?!?" || echo " ok " + if ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null; then + echo "fail - set operation successful ?!?" + ret=1 + else + echo " ok " + fi chk_channels "setting invalid channels nr" $DST 2 2 fi -- 2.43.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH] selftests: net: veth: derive invalid-tx test value from kernel max 2026-11-19 0:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate " Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH net v4 1/3] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH net v4 2/3] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:30 ` Omokefe Emmanuel Onanaroghene 2026-11-19 1:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status Tianyi Gao 3 siblings, 0 replies; 17+ messages in thread From: Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:30 UTC (permalink / raw) To: tianyi, hangbin.liu Cc: kuba, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, Omokefe Emmanuel Onanaroghene The "setting invalid channels nr" check treats CPUS+1 (CPUS=`nproc`) as an invalid tx count, but the kernel allows up to max_tx, for veth that is num_possible_cpus(). On hosts where nproc < num_possible_cpus (taskset/cpuset confinement, QEMU maxcpus slots, hotplug firmware), the ethtool -L call succeeds and chk_channels() reports a false failure. With failure propagation fixed, this fails the whole script. Query the kernel-reported maximum with ethtool -l (the same parsing idiom chk_channels() uses, first match) and attempt max+1, which is invalid on every host. Fixes: 1ec2230fc721 ("selftests: net: veth: add tests for set_channel") Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com> --- tools/testing/selftests/net/veth.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh index 2a37d21f97da5..6eeb123aaf885 100755 --- a/tools/testing/selftests/net/veth.sh +++ b/tools/testing/selftests/net/veth.sh @@ -464,7 +464,9 @@ fi ip netns exec $NS_DST ethtool -L veth$DST combined 2 2>/dev/null chk_channels "bad setting: combined channels" $DST $CUR_RX $CUR_TX -ip netns exec $NS_DST ethtool -L veth$DST tx $((CPUS + 1)) 2>/dev/null +MAX_TX=`ip netns exec $NS_DST ethtool -l veth$DST |\ + grep TX: | head -n 1 | awk '{print $2}'` +ip netns exec $NS_DST ethtool -L veth$DST tx $((MAX_TX + 1)) 2>/dev/null chk_channels "setting invalid channels nr" $DST $CUR_RX $CUR_TX if [ $CPUS -gt 1 ]; then -- 2.43.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status 2026-11-19 0:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate " Omokefe Emmanuel Onanaroghene ` (2 preceding siblings ...) 2026-11-19 0:30 ` [PATCH] selftests: net: veth: derive invalid-tx test value from kernel max Omokefe Emmanuel Onanaroghene @ 2026-11-19 1:29 ` Tianyi Gao 2026-11-19 21:12 ` Jakub Kicinski 3 siblings, 1 reply; 17+ messages in thread From: Tianyi Gao @ 2026-11-19 1:29 UTC (permalink / raw) To: Omokefe Emmanuel Onanaroghene Cc: Hangbin Liu, kuba, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, kernel-team, tianyi.gao Hi Omokefe, On Thu, 19 Nov 2026 01:29:59 +0100 Omokefe Emmanuel Onanaroghene wrote: > Changes v3 -> v4: > - Patch 2: use if/else instead of "&& { ...; } ||" chains, keep > lines within 80 columns (thanks Tianyi for the review). > - Add patch 3 deriving the invalid tx value from the kernel maximum. Sorry for being annoying, but I see three problems with how v4 was sent: 1. Patch 3 lost its subject prefix. It went out as "[PATCH] selftests: net: veth: derive invalid-tx test value from kernel max", so patchwork put it in a series of its own [1]. 2. Patch 3 should come first. Patch 1 makes a chk_channels() failure fail the script, and from then on the nproc + 1 check can fail on a correct kernel. With the fix first, no commit in the series reports a false failure. 3. v4 was posted as a reply to my review of v3. A new version should start a new thread, and its change log should link the previous postings [2]. [1] https://patchwork.kernel.org/series/1215530/ [2] https://docs.kernel.org/process/maintainer-netdev.html#resending-after-review Cheers, Tianyi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status 2026-11-19 1:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status Tianyi Gao @ 2026-11-19 21:12 ` Jakub Kicinski 0 siblings, 0 replies; 17+ messages in thread From: Jakub Kicinski @ 2026-11-19 21:12 UTC (permalink / raw) To: Omokefe Emmanuel Onanaroghene Cc: Tianyi Gao, Hangbin Liu, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, kernel-team, tianyi.gao On Thu, 19 Nov 2026 01:29:40 +0000 Tianyi Gao wrote: > On Thu, 19 Nov 2026 01:29:59 +0100 Omokefe Emmanuel Onanaroghene wrote: > > Changes v3 -> v4: > > - Patch 2: use if/else instead of "&& { ...; } ||" chains, keep > > lines within 80 columns (thanks Tianyi for the review). > > - Add patch 3 deriving the invalid tx value from the kernel maximum. > > Sorry for being annoying, but I see three problems with how v4 was > sent: > > 1. Patch 3 lost its subject prefix. It went out as "[PATCH] selftests: > net: veth: derive invalid-tx test value from kernel max", so > patchwork put it in a series of its own [1]. > > 2. Patch 3 should come first. Patch 1 makes a chk_channels() failure > fail the script, and from then on the nproc + 1 check can fail on > a correct kernel. With the fix first, no commit in the series > reports a false failure. > > 3. v4 was posted as a reply to my review of v3. A new version should > start a new thread, and its change log should link the previous > postings [2]. On top of the points Tianyi Gao already made: 4. Please target all your "fixes" for selftests at net-next rather than net and remove the Fixes: tags. None of this is worth applying to the current release. I'm tossing all your submissions from patchwork. Please don't forget to wait at least 24h before you repost anything. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v3 0/2] selftests: net: veth: propagate check failures to exit status 2026-11-16 8:41 ` [PATCH net v3 0/2] selftests: net: veth: propagate check " Omokefe Emmanuel Onanaroghene 2026-11-16 8:41 ` [PATCH net v3 1/2] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene 2026-11-16 8:41 ` [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene @ 2026-11-16 13:08 ` Tianyi Gao 2 siblings, 0 replies; 17+ messages in thread From: Tianyi Gao @ 2026-11-16 13:08 UTC (permalink / raw) To: Omokefe Emmanuel Onanaroghene Cc: Hangbin Liu, netdev, linux-kselftest, linux-kernel, bpf, kuba, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan On Mon, 16 Nov 2026 09:41:05 +0100 Omokefe Emmanuel Onanaroghene wrote: > Changes v2 -> v3: > - Add Tianyi Gao's Tested-by to patch 1 (thanks!). > - Add patch 2 fixing the remaining three checks. Thanks for fixing all four checks. Please be aware that it is recommended to wait at least 24 hours between postings [1]. [1] https://docs.kernel.org/process/maintainer-netdev.html#resending-after-review Cheers, Tianyi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v2] selftests: net: veth: propagate channel-check failures to exit status 2026-11-15 21:47 [PATCH net v2] selftests: net: veth: propagate channel-check failures to exit status Omokefe Emmanuel Onanaroghene 2026-11-16 0:45 ` Tianyi Gao @ 2026-11-16 21:50 ` netdev-bot+sashiko 2026-11-19 0:40 ` Omokefe Emmanuel Onanaroghene 1 sibling, 1 reply; 17+ messages in thread From: netdev-bot+sashiko @ 2026-11-16 21:50 UTC (permalink / raw) To: emmaonana18 Cc: kuba, tianyi, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 1 · Low: 0 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). - [High] The fix is incomplete. - [Medium] Because chk_channels() now sets ret=1, the "setting invalid channels nr" check at tools/testing/selftests/net/veth.sh:467-468… -- selftests: net: veth: propagate channel-check failures to exit status This patch changes chk_channels() in tools/testing/selftests/net/veth.sh so that it sets ret=1 when the channel counts reported by ethtool do not match the expected values. A channel mismatch now gives the script a non-zero exit status. > diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh > index 64c2a5a59821d..5c1dbe1516bb4 100755 > --- a/tools/testing/selftests/net/veth.sh > +++ b/tools/testing/selftests/net/veth.sh > @@ -130,6 +130,7 @@ chk_channels() { > echo " ok " > else > echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined" > + ret=1 > fi > } [Severity: High] Is this fix complete? The commit in the Fixes: tag, 1ec2230fc721 ("selftests: net: veth: add tests for set_channel"), also added three inline channel/XDP checks to veth.sh. Each of them prints a fail line but never sets ret: printf "%-60s" "bad setting: XDP with RX nr less than TX" ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \ section xdp 2>/dev/null &&\ echo "fail - set operation successful ?!?" || echo " ok " printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set" ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\ echo "fail - set operation successful ?!?" || echo " ok " printf "%-60s" "bad setting: increasing peer TX nr above RX with XDP set" ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null &&\ echo "fail - set operation successful ?!?" || echo " ok " These checks test the queue count limits in drivers/net/veth.c: veth_xdp_set(): if (dev->real_num_rx_queues < peer->real_num_tx_queues) { ... err = -ENOSPC; veth_set_channels(): if (priv->_xdp_prog && peer && ch->rx_count < peer->real_num_tx_queues) return -EINVAL; if (peer && peer_priv && peer_priv->_xdp_prog && ch->tx_count > peer->real_num_rx_queues) return -EINVAL; Suppose a kernel change lets one of these invalid configurations through. The script prints "fail - set operation successful ?!?", but it still reaches exit $ret with ret=0. The subject says channel-check failures now reach the exit status. Should these three sites set ret=1 too? [Severity: Medium] Now that this sets ret=1, can the "setting invalid channels nr" check fail the whole script on hosts where nproc is lower than num_possible_cpus()? The test gets its CPU count from nproc and treats CPUS + 1 as an invalid tx count: readonly CPUS=`nproc` [ ... ] ip netns exec $NS_DST ethtool -L veth$DST tx $((CPUS + 1)) 2>/dev/null chk_channels "setting invalid channels nr" $DST $CUR_RX $CUR_TX The kernel limit comes from num_possible_cpus() instead: drivers/net/veth.c:veth_get_num_queues() { int queues = num_possible_cpus(); ... } drivers/net/veth.c:veth_get_channels() { ... channels->max_tx = dev->num_tx_queues; channels->max_rx = dev->num_rx_queues; } ethnl_set_channels() in net/ethtool/channels.c rejects only tx_count > max_tx, and the ioctl path does the same. veth_set_channels() has no upper bound check of its own. On some hosts nproc is lower than num_possible_cpus(). Examples are QEMU with -smp N,maxcpus=M, firmware that lists hotpluggable CPU slots, or a process limited by taskset or cpuset. There the ethtool -L call succeeds, ethtool -l reports tx = CPUS + 1, and chk_channels() takes the else branch. Before this patch, that only printed a fail line. With ret=1, the selftest now fails even though the kernel behaved correctly. The commit message says: all chk_channels() call sites expect the check to pass That doesn't hold for this call site on such hosts. Should the test pick its out-of-range tx value from the kernel's reported maximum instead of from nproc? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115214702.50817-1-emmaonana18%40gmail.com ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net v2] selftests: net: veth: propagate channel-check failures to exit status 2026-11-16 21:50 ` [PATCH net v2] selftests: net: veth: propagate channel-check " netdev-bot+sashiko @ 2026-11-19 0:40 ` Omokefe Emmanuel Onanaroghene 0 siblings, 0 replies; 17+ messages in thread From: Omokefe Emmanuel Onanaroghene @ 2026-11-19 0:40 UTC (permalink / raw) To: netdev-bot+sashiko Cc: kuba, tianyi, netdev, linux-kselftest, linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend, sdf, skhan, emmaonana18 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=y, Size: 537 bytes --] On Mon, 16 Nov 2026 21:50:01 +0000 netdev-bot+sashiko wrote: > - [High] The fix is incomplete. Legitimate, and already addressed: the three bad-setting checks gained ret=1 in v3 [2/2] (also spotted by Tianyi during review), restyled to if/else in v4 [2/2]. > - [Medium] Because chk_channels() now sets ret=1, the "setting > invalid channels nr" check at > tools/testing/selftests/net/veth.sh:467-468… Good catch. Fixed by [3/3] in v4, which attempts max_tx + 1 from the kernel-reported maximum instead of nproc + 1. pw-bot: cr ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2026-11-19 21:12 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-15 21:47 [PATCH net v2] selftests: net: veth: propagate channel-check failures to exit status Omokefe Emmanuel Onanaroghene 2026-11-16 0:45 ` Tianyi Gao 2026-11-16 0:56 ` Hangbin Liu 2026-11-16 8:41 ` [PATCH net v3 0/2] selftests: net: veth: propagate check " Omokefe Emmanuel Onanaroghene 2026-11-16 8:41 ` [PATCH net v3 1/2] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene 2026-11-19 0:40 ` netdev-bot+sashiko 2026-11-16 8:41 ` [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene 2026-11-16 14:04 ` Tianyi Gao 2026-11-19 0:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate " Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH net v4 1/3] selftests: net: veth: propagate channel-check " Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH net v4 2/3] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene 2026-11-19 0:30 ` [PATCH] selftests: net: veth: derive invalid-tx test value from kernel max Omokefe Emmanuel Onanaroghene 2026-11-19 1:29 ` [PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status Tianyi Gao 2026-11-19 21:12 ` Jakub Kicinski 2026-11-16 13:08 ` [PATCH net v3 0/2] " Tianyi Gao 2026-11-16 21:50 ` [PATCH net v2] selftests: net: veth: propagate channel-check " netdev-bot+sashiko 2026-11-19 0:40 ` Omokefe Emmanuel Onanaroghene
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox