Thread View: linux.kernel.netdev
4 messages
4 total messages
Started by Omokefe Emmanuel Onanaroghene
Mon, 16 Nov 2026 08:41
[PATCH net v3 0/2] selftests: net: veth: propagate check failures to exit status
Author: Omokefe Emmanuel Onanaroghene
Date: Mon, 16 Nov 2026 08:41
Date: Mon, 16 Nov 2026 08:41
23 lines
11711 bytes
11711 bytes
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
[PATCH net v3 1/2] selftests: net: veth: propagate channel-check failures to exit status
Author: Omokefe Emmanuel Onanaroghene
Date: Mon, 16 Nov 2026 08:41
Date: Mon, 16 Nov 2026 08:41
28 lines
11967 bytes
11967 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 v3 2/2] selftests: net: veth: propagate bad-settings check failures to exit status
Author: Omokefe Emmanuel Onanaroghene
Date: Mon, 16 Nov 2026 08:41
Date: Mon, 16 Nov 2026 08:41
48 lines
13210 bytes
13210 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>
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
Re: [PATCH net v3 1/2] selftests: net: veth: propagate channel-check failures to exit status
Author: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 00:40
Date: Thu, 19 Nov 2026 00:40
79 lines
11027 bytes
11027 bytes
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
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