All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 v4 0/1] selftests: net: skip the veth GRO checks where they cannot run
@ 2026-10-05 11:23 Eva Kurchatova
  2026-10-05 11:23 ` [Devel] [PATCH hci-8.1 v4 1/1] " Eva Kurchatova
  0 siblings, 1 reply; 3+ messages in thread
From: Eva Kurchatova @ 2026-10-05 11:23 UTC (permalink / raw)
  To: khorenko; +Cc: devel

Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-139651

Changes in v4:
- Fix the test in chk_gro_fwd(): it skipped on a clean host and ran
  with a tunnel, udp_encap_in_use() returns 0 when it finds one.
- Rebased.

Link to v3: http://lore.virtuozzo.com/kernel/20260928193506.549055-1-eva.kurchatova@virtuozzo.com/T/#t

Changes in v3:
- Skip the three forwarding checks when UDP encapsulation is in use on
  the host, instead of asking for UDP GRO on the receiver, which made
  them pass without testing rx-udp-gro-forwarding.
- Drop the comment, the reason is in the message.
- Retitled. Sent alone, the rest of v2 is merged.

Link to v2: https://lists.openvz.org/pipermail/devel/2026-September/085192.html

Changes in v2:
- Unchanged, renumbered within the series.

Link to v1: https://lists.openvz.org/pipermail/devel/2026-September/084951.html

Eva Kurchatova (1):
  selftests: net: skip the veth GRO checks where they cannot run

 tools/testing/selftests/net/veth.sh | 47 +++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 3 deletions(-)

-- 
2.56.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Devel] [PATCH hci-8.1 v4 1/1] selftests: net: skip the veth GRO checks where they cannot run
  2026-10-05 11:23 [Devel] [PATCH hci-8.1 v4 0/1] selftests: net: skip the veth GRO checks where they cannot run Eva Kurchatova
@ 2026-10-05 11:23 ` Eva Kurchatova
  2026-10-05 11:29   ` no-reply
  0 siblings, 1 reply; 3+ messages in thread
From: Eva Kurchatova @ 2026-10-05 11:23 UTC (permalink / raw)
  To: khorenko; +Cc: devel

The three rx-udp-gro-forwarding checks in veth.sh count 10 packets
where they expect 1 on a host that has a vxlan or another UDP tunnel,
in any namespace, and pass on a host that has none.

Any UDP encapsulation socket on the machine moves UDP GRO to the socket
lookup path, see commit f2e9de210d50 ("udp: gro behind static key"),
and rx-udp-gro-forwarding is then not consulted at all, see commit
36707061d6ba ("udp: allow forwarding of plain (non-fraglisted) UDP GRO
packets"). The switch is global, so the test namespaces do not help,
and nothing the test can set brings the device flag back.

Skip those three checks when UDP encapsulation is in use: a vxlan,
geneve or bareudp device, a fou port or an l2tp tunnel in any
namespace, or a socket on the vxlan or geneve port.

https://virtuozzo.atlassian.net/browse/VSTOR-139651
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/net/veth.sh | 47 +++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh
index 6bb7dfaa30b6..08ed8781bb08 100755
--- a/tools/testing/selftests/net/veth.sh
+++ b/tools/testing/selftests/net/veth.sh
@@ -97,6 +97,42 @@ chk_channels() {
 	fi
 }
 
+udp_encap_in_use() {
+	local ns cmd t
+
+	for ns in "" `ip netns list 2>/dev/null | awk '{print $1}'`; do
+		if [ -n "$ns" ]; then
+			cmd="ip netns exec $ns"
+		else
+			cmd=""
+		fi
+
+		for t in vxlan geneve bareudp; do
+			$cmd ip -o link show type $t 2>/dev/null | \
+				grep -q . && return 0
+		done
+		$cmd ip fou show 2>/dev/null | grep -q . && return 0
+		$cmd ip l2tp show tunnel 2>/dev/null | grep -q . && return 0
+		$cmd ss -uapn 2>/dev/null | \
+			grep -qE ':(4789|6081)([^0-9]|$)' && return 0
+	done
+	return 1
+}
+
+# Only meaningful where nothing else has turned udp_encap_needed_key on
+chk_gro_fwd() {
+	local msg="$1"
+	local expected=$2
+
+	if [ $UDP_ENCAP -eq 0 ]; then
+		printf "%-60s" "$msg"
+		echo " skip - UDP encapsulation in use"
+		return
+	fi
+
+	chk_gro "$msg" $expected
+}
+
 chk_gro() {
 	local msg="$1"
 	local expected=$2
@@ -223,6 +259,11 @@ fi
 [ $CPUS -lt 2 ] && echo "Only one CPU available, some tests will be skipped"
 [ $STRESS -gt 0 -a $CPUS -lt 3 ] && echo " stress test will be skipped, too"
 
+udp_encap_in_use
+UDP_ENCAP=$?
+[ $UDP_ENCAP -eq 0 ] && \
+	echo "UDP encapsulation in use, forwarding tests will be skipped"
+
 create_ns
 chk_gro_flag "default - gro flag" $SRC off
 chk_gro_flag "        - peer gro flag" $DST off
@@ -241,7 +282,7 @@ chk_tso_flag "        - tso flag" $SRC on
 chk_tso_flag "        - peer tso flag" $DST on
 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
-chk_gro "        - aggregation with TSO off" 1
+chk_gro_fwd "        - aggregation with TSO off" 1
 cleanup
 
 create_ns
@@ -285,7 +326,7 @@ chk_tso_flag "        - peer tso flag" $DST on
 ip -n $NS_DST link set dev veth$DST up
 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
-chk_gro "        - aggregation with TSO off" 1
+chk_gro_fwd "        - aggregation with TSO off" 1
 cleanup
 
 create_ns
@@ -348,7 +389,7 @@ ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
 chk_gro "        - no aggregation" 10
 ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
 chk_gro_flag "        - gro flag with GRO on" $DST on
-chk_gro "        - aggregation" 1
+chk_gro_fwd "        - aggregation" 1
 
 
 ip -n $NS_DST link set dev veth$DST down
-- 
2.56.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Devel] [PATCH hci-8.1 v4 1/1] selftests: net: skip the veth GRO checks where they cannot run
  2026-10-05 11:23 ` [Devel] [PATCH hci-8.1 v4 1/1] " Eva Kurchatova
@ 2026-10-05 11:29   ` no-reply
  0 siblings, 0 replies; 3+ messages in thread
From: no-reply @ 2026-10-05 11:29 UTC (permalink / raw)
  To: khorenko, Eva Kurchatova; +Cc: devel

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] selftests: veth.sh udp_encap_in_use() probes only some UDP encap users
- [Low] selftests: veth.sh ss port regex is not anchored to local encap sockets
- [Low] selftests: veth.sh UDP_ENCAP flag is inverted and skips are not reported as skips
--

commit f9959728bd7c821cbe897be9079c649853692e5a
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

selftests: net: skip the veth GRO checks where they cannot run

This patch adds udp_encap_in_use() to veth.sh. It detects UDP
encapsulation users such as vxlan, geneve, bareudp, fou, l2tp and sockets
on ports 4789 and 6081. A new chk_gro_fwd() wrapper then skips the three
rx-udp-gro-forwarding aggregation checks when any of them is found.

Link: https://virtuozzo.atlassian.net/browse/VSTOR-139651

> diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh
> --- a/tools/testing/selftests/net/veth.sh
> +++ b/tools/testing/selftests/net/veth.sh

[ ... ]

> +udp_encap_in_use() {
> +	local ns cmd t
> +
> +	for ns in "" `ip netns list 2>/dev/null | awk '{print $1}'`; do

[Severity: Medium]
udp_encap_enable() does static_branch_inc(&udp_encap_needed_key), and
udp_gro_receive() tests that global key. The set of callers is much wider
than what this function probes. WireGuard (drivers/net/wireguard/socket.c),
GTP (drivers/net/gtp.c) and the UDP_ENCAP setsockopt path, which covers
ESP-in-UDP and NAT-T sockets, all reach it.

Consider a host with only one of those. None of the vxlan, geneve,
bareudp, fou, l2tp or port 4789/6081 probes match, so udp_encap_in_use()
returns 1. chk_gro_fwd() then calls chk_gro(), and the check still fails
with 10 packets where 1 is expected. Doesn't that leave the failure this
patch is meant to remove?

Only named namespaces from "ip netns list" are visited. Anonymous and
container-runtime namespaces are missed, even though the key is global.
Can the commit message wording "in any namespace" hold with this approach?

Errors from "ip fou show", "ip l2tp show tunnel" and "ss" are discarded
with 2>/dev/null. Doesn't a missing tool or an unloaded module then read
as "no encapsulation"?

The probe also runs only once, before the tests start. Tunnels created
later are not seen.

The commit message says "Any UDP encapsulation socket on the machine".
The comment above chk_gro_fwd() says "Only meaningful where nothing else
has turned udp_encap_needed_key on". Could both be reworded to match the
subset of users that is actually detected?

> +		$cmd ss -uapn 2>/dev/null | \
> +			grep -qE ':(4789|6081)([^0-9]|$)' && return 0

[Severity: Low]
ss -uapn prints both the local and the peer address:port columns. This
regex is not anchored to the local column. Can a plain UDP socket bound to
4789 or 6081, or a client connected to a peer on those ports, match here?
Such sockets do not enable udp_encap_needed_key, so the checks would be
skipped on hosts where they could have run.

Conversely, encap sockets on non-default ports are only caught through the
link type checks.

[ ... ]

> +# Only meaningful where nothing else has turned udp_encap_needed_key on
> +chk_gro_fwd() {
> +	local msg="$1"
> +	local expected=$2
> +
> +	if [ $UDP_ENCAP -eq 0 ]; then
> +		printf "%-60s" "$msg"
> +		echo " skip - UDP encapsulation in use"
> +		return
> +	fi

[Severity: Low]
This isn't a bug, but UDP_ENCAP=0 meaning "encapsulation in use" comes
from storing the exit status of udp_encap_in_use() with UDP_ENCAP=$?. It
is easy to misread.

The skip path only prints text. It does not set the kselftest skip exit
code (4). Can the script then exit 0 when all three gated checks were
skipped?

> +
> +	chk_gro "$msg" $expected
> +}

[ ... ]

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261005112332.1989594-1-eva.kurchatova@virtuozzo.com?part=1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-05 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-05 11:23 [Devel] [PATCH hci-8.1 v4 0/1] selftests: net: skip the veth GRO checks where they cannot run Eva Kurchatova
2026-10-05 11:23 ` [Devel] [PATCH hci-8.1 v4 1/1] " Eva Kurchatova
2026-10-05 11:29   ` no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.