Thread View: linux.kernel.netdev
5 messages
5 total messages
Started by Omokefe Emmanuel Onanaroghene
Thu, 19 Nov 2026 00:29
[PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status
Author: Omokefe Emmanuel Onanaroghene
Date: Thu, 19 Nov 2026 00:29
Date: Thu, 19 Nov 2026 00:29
40 lines
12766 bytes
12766 bytes
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
[PATCH net v4 1/3] selftests: net: veth: propagate channel-check failures to exit status
Author: Omokefe Emmanuel Onanaroghene
Date: Thu, 19 Nov 2026 00:30
Date: Thu, 19 Nov 2026 00:30
28 lines
12165 bytes
12165 bytes
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
[PATCH net v4 2/3] selftests: net: veth: propagate bad-settings check failures to exit status
Author: Omokefe Emmanuel Onanaroghene
Date: Thu, 19 Nov 2026 00:30
Date: Thu, 19 Nov 2026 00:30
68 lines
13973 bytes
13973 bytes
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
[PATCH] selftests: net: veth: derive invalid-tx test value from kernel max
Author: Omokefe Emmanuel Onanaroghene
Date: Thu, 19 Nov 2026 00:30
Date: Thu, 19 Nov 2026 00:30
35 lines
12724 bytes
12724 bytes
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
Re: [PATCH net v4 0/3] selftests: net: veth: propagate check failures to exit status
Author: Jakub Kicinski
Date: Thu, 19 Nov 2026 21:12
Date: Thu, 19 Nov 2026 21:12
32 lines
9424 bytes
9424 bytes
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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads