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 Tested-by: Tianyi Gao Signed-off-by: Omokefe Emmanuel Onanaroghene --- 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 64c2a5a59821d..22246278e6049 100755 --- a/tools/testing/selftests/net/veth.sh +++ b/tools/testing/selftests/net/veth.sh @@ -463,7 +463,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