mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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
  0 siblings, 1 reply; 6+ 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	[flat|nested] 6+ 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
  0 siblings, 2 replies; 6+ 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] 6+ 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; 6+ 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] 6+ 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
  2026-11-16  8:41     ` [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene
  1 sibling, 2 replies; 6+ 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] 6+ 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-16  8:41     ` [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check " Omokefe Emmanuel Onanaroghene
  1 sibling, 0 replies; 6+ 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	[flat|nested] 6+ 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
  1 sibling, 0 replies; 6+ 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	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-16  8:42 UTC | newest]

Thread overview: 6+ 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-16  8:41     ` [PATCH net v3 2/2] selftests: net: veth: propagate bad-settings check " 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

all inboxes | Powered by JetHome®