* [PATCH net-next v8 1/2] selftests: net: veth: derive invalid-tx test value from kernel max
2026-12-01 7:12 [PATCH net-next v8 0/2] selftests: net: veth: propagate check failures to exit status Omokefe Emmanuel Onanaroghene
@ 2026-12-01 7:12 ` Omokefe Emmanuel Onanaroghene
2026-12-01 7:12 ` [PATCH net-next v8 2/2] selftests: net: veth: propagate check failures to exit status Omokefe Emmanuel Onanaroghene
2026-12-04 5:00 ` [PATCH net-next v8 0/2] " patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Omokefe Emmanuel Onanaroghene @ 2026-12-01 7:12 UTC (permalink / raw)
To: tianyi, hangbin.liu
Cc: willemb, kuba, netdev, linux-kselftest, linux-kernel, bpf, davem,
edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend,
sdf, skhan, kernel-team, tianyi.gao,
Omokefe Emmanuel Onanaroghene, Hangbin Liu
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.
Reviewed-by: Tianyi Gao <tianyi@cloudflare.com>
Tested-by: Tianyi Gao <tianyi@cloudflare.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
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 9496b599d722c..bd0d19c49b7cd 100755
--- a/tools/testing/selftests/net/veth.sh
+++ b/tools/testing/selftests/net/veth.sh
@@ -569,7 +569,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] 4+ messages in thread* [PATCH net-next v8 2/2] selftests: net: veth: propagate check failures to exit status
2026-12-01 7:12 [PATCH net-next v8 0/2] selftests: net: veth: propagate check failures to exit status Omokefe Emmanuel Onanaroghene
2026-12-01 7:12 ` [PATCH net-next v8 1/2] selftests: net: veth: derive invalid-tx test value from kernel max Omokefe Emmanuel Onanaroghene
@ 2026-12-01 7:12 ` Omokefe Emmanuel Onanaroghene
2026-12-04 5:00 ` [PATCH net-next v8 0/2] " patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Omokefe Emmanuel Onanaroghene @ 2026-12-01 7:12 UTC (permalink / raw)
To: tianyi, hangbin.liu
Cc: willemb, kuba, netdev, linux-kselftest, linux-kernel, bpf, davem,
edumazet, pabeni, horms, shuah, ast, daniel, hawk, john.fastabend,
sdf, skhan, kernel-team, tianyi.gao,
Omokefe Emmanuel Onanaroghene, Hangbin Liu
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.
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.
Reported-by: Tianyi Gao <tianyi@cloudflare.com>
Link: https://lore.kernel.org/all/CAG4wq-cd01i7YrcFPmma=BXUcwn_PK=wneKW=vyEBYzQ3Bn7QA@mail.gmail.com/
Tested-by: Tianyi Gao <tianyi@cloudflare.com>
Reviewed-by: Tianyi Gao <tianyi@cloudflare.com>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
---
tools/testing/selftests/net/veth.sh | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh
index bd0d19c49b7cd..a7aa1a677916a 100755
--- a/tools/testing/selftests/net/veth.sh
+++ b/tools/testing/selftests/net/veth.sh
@@ -192,6 +192,7 @@ chk_channels() {
echo " ok "
else
echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined"
+ ret=1
fi
}
@@ -579,9 +580,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
@@ -589,16 +594,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] 4+ messages in thread* Re: [PATCH net-next v8 0/2] selftests: net: veth: propagate check failures to exit status
2026-12-01 7:12 [PATCH net-next v8 0/2] selftests: net: veth: propagate check failures to exit status Omokefe Emmanuel Onanaroghene
2026-12-01 7:12 ` [PATCH net-next v8 1/2] selftests: net: veth: derive invalid-tx test value from kernel max Omokefe Emmanuel Onanaroghene
2026-12-01 7:12 ` [PATCH net-next v8 2/2] selftests: net: veth: propagate check failures to exit status Omokefe Emmanuel Onanaroghene
@ 2026-12-04 5:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-12-04 5:00 UTC (permalink / raw)
To: Omokefe Emmanuel Onanaroghene
Cc: tianyi, hangbin.liu, willemb, kuba, netdev, linux-kselftest,
linux-kernel, bpf, davem, edumazet, pabeni, horms, shuah, ast,
daniel, hawk, john.fastabend, sdf, skhan, kernel-team, tianyi.gao
Hello:
This series was applied to netdev/net-next.git (main)
by Willem de Bruijn <willemb@google.com>:
On Tue, 1 Dec 2026 08:12:04 +0100 you wrote:
> 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 1 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 the propagation patch makes failures honest.
>
> [...]
Here is the summary with links:
- [net-next,v8,1/2] selftests: net: veth: derive invalid-tx test value from kernel max
https://git.kernel.org/netdev/net-next/c/8c7c33b40c10
- [net-next,v8,2/2] selftests: net: veth: propagate check failures to exit status
https://git.kernel.org/netdev/net-next/c/912e6e578d91
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread