Commit c017800af5c7 for kernel
commit c017800af5c71ebb2e6209eebf5c60c19850ffe7
Author: Tianyi Gao <tianyi@cloudflare.com>
Date: Tue Oct 6 18:32:37 2026 +0100
selftests: net: veth: test peer ndo-xmit after GRO toggle while down
Test that toggling GRO on a veth device while it is down updates the
peer's ndo-xmit XDP feature once the device comes up, for both GRO on
and GRO off.
xdp-features is only visible through netlink, so read it with the ynl
CLI, as double_udp_encap.sh does. Skip the checks if the CLI is not
found, as in an installed kselftest tree.
Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
Link: https://patch.msgid.link/20261006173241.65945-3-tianyi@cloudflare.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh
index 9709dd067c72..8b867e0675a7 100755
--- a/tools/testing/selftests/net/veth.sh
+++ b/tools/testing/selftests/net/veth.sh
@@ -9,6 +9,8 @@ readonly DST=1
readonly DST_NAT=100
readonly NS_SRC=$BASE$SRC
readonly NS_DST=$BASE$DST
+# shellcheck disable=SC2155 # prefer RO variable over return value from cmd
+readonly YNL="$(dirname "$(readlink -f "$0")")/../../../net/ynl/pyynl/cli.py"
# "baremetal" network used for raw UDP traffic
readonly BM_NET_V4=192.168.1.
@@ -74,6 +76,37 @@ chk_tso_flag() {
__chk_flag "$1" $2 $3 tcp-segmentation-offload
}
+chk_xdp_feature() {
+ local msg="$1"
+ local target=$2
+ local expected=$3
+ local feature=$4
+ local ifindex
+ local out
+ local st
+ local flag
+
+ ifindex=`ip netns exec $BASE$target cat /sys/class/net/veth$target/ifindex`
+ out=`ip netns exec $BASE$target "$YNL" --family netdev --do dev-get \
+ --output-json --json "{\"ifindex\": $ifindex}" 2>&1`
+ st=$?
+
+ printf "%-60s" "$msg"
+ if [ $st -ne 0 ]; then
+ echo " fail - ynl cli error: $out"
+ ret=1
+ return
+ fi
+
+ flag=`echo "$out" | grep -c "\"$feature\""`
+ if [ "$flag" = "$expected" ]; then
+ echo " ok "
+ else
+ echo " fail - expected $expected found $flag"
+ ret=1
+ fi
+}
+
chk_channels() {
local msg="$1"
local target=$2
@@ -222,6 +255,7 @@ 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"
+[ ! -f "$YNL" ] && echo "ynl cli not found, ndo-xmit tests will be skipped"
create_ns
chk_gro_flag "default - gro flag" $SRC off
@@ -283,6 +317,18 @@ chk_gro_flag " - peer gro flag" $SRC off
chk_tso_flag " - tso flag" $SRC on
chk_tso_flag " - peer tso flag" $DST on
ip -n $NS_DST link set dev veth$DST up
+if [ -f "$YNL" ]; then
+ chk_xdp_feature " - peer ndo-xmit" $SRC 1 ndo-xmit
+ # make sure the peer flag is set before disabling gro while down
+ ip netns exec $NS_DST ethtool -K veth$DST gro off
+ ip netns exec $NS_DST ethtool -K veth$DST gro on
+ chk_xdp_feature " - peer ndo-xmit re-armed" $SRC 1 ndo-xmit
+ ip -n $NS_DST link set dev veth$DST down
+ ip netns exec $NS_DST ethtool -K veth$DST gro off
+ ip -n $NS_DST link set dev veth$DST up
+ chk_xdp_feature " - peer ndo-xmit cleared" $SRC 0 ndo-xmit
+ ip netns exec $NS_DST ethtool -K veth$DST gro on
+fi
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