xref: /openbmc/linux/tools/testing/selftests/net/veth.sh (revision 87832e937c808a7ebc41254b408362e3255c87c9)
11c3cadbeSPaolo Abeni#!/bin/sh
21c3cadbeSPaolo Abeni# SPDX-License-Identifier: GPL-2.0
31c3cadbeSPaolo Abeni
4*31a6e0a8SPaolo AbeniBPF_FILE="xdp_dummy.o"
51c3cadbeSPaolo Abenireadonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
61c3cadbeSPaolo Abenireadonly BASE=`basename $STATS`
71c3cadbeSPaolo Abenireadonly SRC=2
81c3cadbeSPaolo Abenireadonly DST=1
91c3cadbeSPaolo Abenireadonly DST_NAT=100
101c3cadbeSPaolo Abenireadonly NS_SRC=$BASE$SRC
111c3cadbeSPaolo Abenireadonly NS_DST=$BASE$DST
121c3cadbeSPaolo Abeni
131c3cadbeSPaolo Abeni# "baremetal" network used for raw UDP traffic
141c3cadbeSPaolo Abenireadonly BM_NET_V4=192.168.1.
151c3cadbeSPaolo Abenireadonly BM_NET_V6=2001:db8::
161c3cadbeSPaolo Abeni
171ec2230fSPaolo Abenireadonly CPUS=`nproc`
181c3cadbeSPaolo Abeniret=0
191c3cadbeSPaolo Abeni
201c3cadbeSPaolo Abenicleanup() {
211c3cadbeSPaolo Abeni	local ns
220fd158b8SAndrea Righi	local jobs
230fd158b8SAndrea Righi	readonly jobs="$(jobs -p)"
241c3cadbeSPaolo Abeni	[ -n "${jobs}" ] && kill -1 ${jobs} 2>/dev/null
251c3cadbeSPaolo Abeni	rm -f $STATS
261c3cadbeSPaolo Abeni
271c3cadbeSPaolo Abeni	for ns in $NS_SRC $NS_DST; do
281c3cadbeSPaolo Abeni		ip netns del $ns 2>/dev/null
291c3cadbeSPaolo Abeni	done
301c3cadbeSPaolo Abeni}
311c3cadbeSPaolo Abeni
321c3cadbeSPaolo Abenitrap cleanup EXIT
331c3cadbeSPaolo Abeni
341c3cadbeSPaolo Abenicreate_ns() {
351c3cadbeSPaolo Abeni	local ns
361c3cadbeSPaolo Abeni
371c3cadbeSPaolo Abeni	for ns in $NS_SRC $NS_DST; do
381c3cadbeSPaolo Abeni		ip netns add $ns
391c3cadbeSPaolo Abeni		ip -n $ns link set dev lo up
401c3cadbeSPaolo Abeni	done
411c3cadbeSPaolo Abeni
421c3cadbeSPaolo Abeni	ip link add name veth$SRC type veth peer name veth$DST
431c3cadbeSPaolo Abeni
441c3cadbeSPaolo Abeni	for ns in $SRC $DST; do
451c3cadbeSPaolo Abeni		ip link set dev veth$ns netns $BASE$ns up
461c3cadbeSPaolo Abeni		ip -n $BASE$ns addr add dev veth$ns $BM_NET_V4$ns/24
471c3cadbeSPaolo Abeni		ip -n $BASE$ns addr add dev veth$ns $BM_NET_V6$ns/64 nodad
481c3cadbeSPaolo Abeni	done
491c3cadbeSPaolo Abeni	echo "#kernel" > $BASE
501c3cadbeSPaolo Abeni	chmod go-rw $BASE
511c3cadbeSPaolo Abeni}
521c3cadbeSPaolo Abeni
531c3cadbeSPaolo Abeni__chk_flag() {
541c3cadbeSPaolo Abeni	local msg="$1"
551c3cadbeSPaolo Abeni	local target=$2
561c3cadbeSPaolo Abeni	local expected=$3
571c3cadbeSPaolo Abeni	local flagname=$4
581c3cadbeSPaolo Abeni
591c3cadbeSPaolo Abeni	local flag=`ip netns exec $BASE$target ethtool -k veth$target |\
601c3cadbeSPaolo Abeni		    grep $flagname | awk '{print $2}'`
611c3cadbeSPaolo Abeni
621c3cadbeSPaolo Abeni	printf "%-60s" "$msg"
631c3cadbeSPaolo Abeni	if [ "$flag" = "$expected" ]; then
641c3cadbeSPaolo Abeni		echo " ok "
651c3cadbeSPaolo Abeni	else
661c3cadbeSPaolo Abeni		echo " fail - expected $expected found $flag"
671c3cadbeSPaolo Abeni		ret=1
681c3cadbeSPaolo Abeni	fi
691c3cadbeSPaolo Abeni}
701c3cadbeSPaolo Abeni
711c3cadbeSPaolo Abenichk_gro_flag() {
721c3cadbeSPaolo Abeni	__chk_flag "$1" $2 $3 generic-receive-offload
731c3cadbeSPaolo Abeni}
741c3cadbeSPaolo Abeni
751c3cadbeSPaolo Abenichk_tso_flag() {
761c3cadbeSPaolo Abeni	__chk_flag "$1" $2 $3 tcp-segmentation-offload
771c3cadbeSPaolo Abeni}
781c3cadbeSPaolo Abeni
791ec2230fSPaolo Abenichk_channels() {
801ec2230fSPaolo Abeni	local msg="$1"
811ec2230fSPaolo Abeni	local target=$2
821ec2230fSPaolo Abeni	local rx=$3
831ec2230fSPaolo Abeni	local tx=$4
841ec2230fSPaolo Abeni
851ec2230fSPaolo Abeni	local dev=veth$target
861ec2230fSPaolo Abeni
871ec2230fSPaolo Abeni	local cur_rx=`ip netns exec $BASE$target ethtool -l $dev |\
881ec2230fSPaolo Abeni		grep RX: | tail -n 1 | awk '{print $2}' `
891ec2230fSPaolo Abeni		local cur_tx=`ip netns exec $BASE$target ethtool -l $dev |\
901ec2230fSPaolo Abeni		grep TX: | tail -n 1 | awk '{print $2}'`
911ec2230fSPaolo Abeni	local cur_combined=`ip netns exec $BASE$target ethtool -l $dev |\
921ec2230fSPaolo Abeni		grep Combined: | tail -n 1 | awk '{print $2}'`
931ec2230fSPaolo Abeni
941ec2230fSPaolo Abeni	printf "%-60s" "$msg"
951ec2230fSPaolo Abeni	if [ "$cur_rx" = "$rx" -a "$cur_tx" = "$tx" -a "$cur_combined" = "n/a" ]; then
961ec2230fSPaolo Abeni		echo " ok "
971ec2230fSPaolo Abeni	else
981ec2230fSPaolo Abeni		echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined"
991ec2230fSPaolo Abeni	fi
1001ec2230fSPaolo Abeni}
1011ec2230fSPaolo Abeni
1021c3cadbeSPaolo Abenichk_gro() {
1031c3cadbeSPaolo Abeni	local msg="$1"
1041c3cadbeSPaolo Abeni	local expected=$2
1051c3cadbeSPaolo Abeni
1061c3cadbeSPaolo Abeni	ip netns exec $BASE$SRC ping -qc 1 $BM_NET_V4$DST >/dev/null
1071c3cadbeSPaolo Abeni	NSTAT_HISTORY=$STATS ip netns exec $NS_DST nstat -n
1081c3cadbeSPaolo Abeni
1091c3cadbeSPaolo Abeni	printf "%-60s" "$msg"
1101c3cadbeSPaolo Abeni	ip netns exec $BASE$DST ./udpgso_bench_rx -C 1000 -R 10 &
1111c3cadbeSPaolo Abeni	local spid=$!
1121c3cadbeSPaolo Abeni	sleep 0.1
1131c3cadbeSPaolo Abeni
1141c3cadbeSPaolo Abeni	ip netns exec $NS_SRC ./udpgso_bench_tx -4 -s 13000 -S 1300 -M 1 -D $BM_NET_V4$DST
1151c3cadbeSPaolo Abeni	local retc=$?
1161c3cadbeSPaolo Abeni	wait $spid
1171c3cadbeSPaolo Abeni	local rets=$?
1181c3cadbeSPaolo Abeni	if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
1191c3cadbeSPaolo Abeni		echo " fail client exit code $retc, server $rets"
1201c3cadbeSPaolo Abeni		ret=1
1211c3cadbeSPaolo Abeni		return
1221c3cadbeSPaolo Abeni	fi
1231c3cadbeSPaolo Abeni
1241c3cadbeSPaolo Abeni	local pkts=`NSTAT_HISTORY=$STATS ip netns exec $NS_DST nstat IpInReceives | \
1251c3cadbeSPaolo Abeni		    awk '{print $2}' | tail -n 1`
1261c3cadbeSPaolo Abeni	if [ "$pkts" = "$expected" ]; then
1271c3cadbeSPaolo Abeni		echo " ok "
1281c3cadbeSPaolo Abeni	else
1291c3cadbeSPaolo Abeni		echo " fail - got $pkts packets, expected $expected "
1301c3cadbeSPaolo Abeni		ret=1
1311c3cadbeSPaolo Abeni	fi
1321c3cadbeSPaolo Abeni}
1331c3cadbeSPaolo Abeni
1341ec2230fSPaolo Abeni__change_channels()
1351ec2230fSPaolo Abeni{
1361ec2230fSPaolo Abeni	local cur_cpu
1371ec2230fSPaolo Abeni	local end=$1
1381ec2230fSPaolo Abeni	local cur
1391ec2230fSPaolo Abeni	local i
1401ec2230fSPaolo Abeni
1411ec2230fSPaolo Abeni	while true; do
1421ec2230fSPaolo Abeni		printf -v cur '%(%s)T'
1431ec2230fSPaolo Abeni		[ $cur -le $end ] || break
1441ec2230fSPaolo Abeni
1451ec2230fSPaolo Abeni		for i in `seq 1 $CPUS`; do
1461ec2230fSPaolo Abeni			ip netns exec $NS_SRC ethtool -L veth$SRC rx $i tx $i
1471ec2230fSPaolo Abeni			ip netns exec $NS_DST ethtool -L veth$DST rx $i tx $i
1481ec2230fSPaolo Abeni		done
1491ec2230fSPaolo Abeni
1501ec2230fSPaolo Abeni		for i in `seq 1 $((CPUS - 1))`; do
1511ec2230fSPaolo Abeni			cur_cpu=$((CPUS - $i))
1521ec2230fSPaolo Abeni			ip netns exec $NS_SRC ethtool -L veth$SRC rx $cur_cpu tx $cur_cpu
1531ec2230fSPaolo Abeni			ip netns exec $NS_DST ethtool -L veth$DST rx $cur_cpu tx $cur_cpu
1541ec2230fSPaolo Abeni		done
1551ec2230fSPaolo Abeni	done
1561ec2230fSPaolo Abeni}
1571ec2230fSPaolo Abeni
1581ec2230fSPaolo Abeni__send_data() {
1591ec2230fSPaolo Abeni	local end=$1
1601ec2230fSPaolo Abeni
1611ec2230fSPaolo Abeni	while true; do
1621ec2230fSPaolo Abeni		printf -v cur '%(%s)T'
1631ec2230fSPaolo Abeni		[ $cur -le $end ] || break
1641ec2230fSPaolo Abeni
1651ec2230fSPaolo Abeni		ip netns exec $NS_SRC ./udpgso_bench_tx -4 -s 1000 -M 300 -D $BM_NET_V4$DST
1661ec2230fSPaolo Abeni	done
1671ec2230fSPaolo Abeni}
1681ec2230fSPaolo Abeni
1691ec2230fSPaolo Abenido_stress() {
1701ec2230fSPaolo Abeni	local end
1711ec2230fSPaolo Abeni	printf -v end '%(%s)T'
1721ec2230fSPaolo Abeni	end=$((end + $STRESS))
1731ec2230fSPaolo Abeni
1741ec2230fSPaolo Abeni	ip netns exec $NS_SRC ethtool -L veth$SRC rx 3 tx 3
1751ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST rx 3 tx 3
1761ec2230fSPaolo Abeni
1771ec2230fSPaolo Abeni	ip netns exec $NS_DST ./udpgso_bench_rx &
1781ec2230fSPaolo Abeni	local rx_pid=$!
1791ec2230fSPaolo Abeni
1801ec2230fSPaolo Abeni	echo "Running stress test for $STRESS seconds..."
1811ec2230fSPaolo Abeni	__change_channels $end &
1821ec2230fSPaolo Abeni	local ch_pid=$!
1831ec2230fSPaolo Abeni	__send_data $end &
1841ec2230fSPaolo Abeni	local data_pid_1=$!
1851ec2230fSPaolo Abeni	__send_data $end &
1861ec2230fSPaolo Abeni	local data_pid_2=$!
1871ec2230fSPaolo Abeni	__send_data $end &
1881ec2230fSPaolo Abeni	local data_pid_3=$!
1891ec2230fSPaolo Abeni	__send_data $end &
1901ec2230fSPaolo Abeni	local data_pid_4=$!
1911ec2230fSPaolo Abeni
1921ec2230fSPaolo Abeni	wait $ch_pid $data_pid_1 $data_pid_2 $data_pid_3 $data_pid_4
1931ec2230fSPaolo Abeni	kill -9 $rx_pid
1941ec2230fSPaolo Abeni	echo "done"
1951ec2230fSPaolo Abeni
1961ec2230fSPaolo Abeni	# restore previous setting
1971ec2230fSPaolo Abeni	ip netns exec $NS_SRC ethtool -L veth$SRC rx 2 tx 2
1981ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST rx 2 tx 1
1991ec2230fSPaolo Abeni}
2001ec2230fSPaolo Abeni
2011ec2230fSPaolo Abeniusage() {
2021ec2230fSPaolo Abeni	echo "Usage: $0 [-h] [-s <seconds>]"
2031ec2230fSPaolo Abeni	echo -e "\t-h: show this help"
2041ec2230fSPaolo Abeni	echo -e "\t-s: run optional stress tests for the given amount of seconds"
2051ec2230fSPaolo Abeni}
2061ec2230fSPaolo Abeni
2071ec2230fSPaolo AbeniSTRESS=0
2081ec2230fSPaolo Abeniwhile getopts "hs:" option; do
2091ec2230fSPaolo Abeni	case "$option" in
2101ec2230fSPaolo Abeni	"h")
2111ec2230fSPaolo Abeni		usage $0
2121ec2230fSPaolo Abeni		exit 0
2131ec2230fSPaolo Abeni		;;
2141ec2230fSPaolo Abeni	"s")
2151ec2230fSPaolo Abeni		STRESS=$OPTARG
2161ec2230fSPaolo Abeni		;;
2171ec2230fSPaolo Abeni	esac
2181ec2230fSPaolo Abenidone
2191ec2230fSPaolo Abeni
220302e57f8SWang Yufenif [ ! -f ${BPF_FILE} ]; then
221*31a6e0a8SPaolo Abeni	echo "Missing ${BPF_FILE}. Run 'make' first"
2220fd158b8SAndrea Righi	exit 1
2231c3cadbeSPaolo Abenifi
2241c3cadbeSPaolo Abeni
2251ec2230fSPaolo Abeni[ $CPUS -lt 2 ] && echo "Only one CPU available, some tests will be skipped"
2261ec2230fSPaolo Abeni[ $STRESS -gt 0 -a $CPUS -lt 3 ] && echo " stress test will be skipped, too"
2271ec2230fSPaolo Abeni
2281c3cadbeSPaolo Abenicreate_ns
2291c3cadbeSPaolo Abenichk_gro_flag "default - gro flag" $SRC off
2301c3cadbeSPaolo Abenichk_gro_flag "        - peer gro flag" $DST off
2311c3cadbeSPaolo Abenichk_tso_flag "        - tso flag" $SRC on
2321c3cadbeSPaolo Abenichk_tso_flag "        - peer tso flag" $DST on
2331c3cadbeSPaolo Abenichk_gro "        - aggregation" 1
2341c3cadbeSPaolo Abeniip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
2351c3cadbeSPaolo Abenichk_gro "        - aggregation with TSO off" 10
2361c3cadbeSPaolo Abenicleanup
2371c3cadbeSPaolo Abeni
2381c3cadbeSPaolo Abenicreate_ns
2391c3cadbeSPaolo Abeniip netns exec $NS_DST ethtool -K veth$DST gro on
2401c3cadbeSPaolo Abenichk_gro_flag "with gro on - gro flag" $DST on
2411c3cadbeSPaolo Abenichk_gro_flag "        - peer gro flag" $SRC off
2421c3cadbeSPaolo Abenichk_tso_flag "        - tso flag" $SRC on
2431c3cadbeSPaolo Abenichk_tso_flag "        - peer tso flag" $DST on
2441c3cadbeSPaolo Abeniip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
2451c3cadbeSPaolo Abeniip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
2461c3cadbeSPaolo Abenichk_gro "        - aggregation with TSO off" 1
2471c3cadbeSPaolo Abenicleanup
2481c3cadbeSPaolo Abeni
2491c3cadbeSPaolo Abenicreate_ns
2501ec2230fSPaolo Abenichk_channels "default channels" $DST 1 1
2511ec2230fSPaolo Abeni
2521c3cadbeSPaolo Abeniip -n $NS_DST link set dev veth$DST down
2531c3cadbeSPaolo Abeniip netns exec $NS_DST ethtool -K veth$DST gro on
2541c3cadbeSPaolo Abenichk_gro_flag "with gro enabled on link down - gro flag" $DST on
2551c3cadbeSPaolo Abenichk_gro_flag "        - peer gro flag" $SRC off
2561c3cadbeSPaolo Abenichk_tso_flag "        - tso flag" $SRC on
2571c3cadbeSPaolo Abenichk_tso_flag "        - peer tso flag" $DST on
2581c3cadbeSPaolo Abeniip -n $NS_DST link set dev veth$DST up
2591c3cadbeSPaolo Abeniip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
2601c3cadbeSPaolo Abeniip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
2611c3cadbeSPaolo Abenichk_gro "        - aggregation with TSO off" 1
2621c3cadbeSPaolo Abenicleanup
2631c3cadbeSPaolo Abeni
2641c3cadbeSPaolo Abenicreate_ns
2651ec2230fSPaolo Abeni
2661ec2230fSPaolo AbeniCUR_TX=1
2671ec2230fSPaolo AbeniCUR_RX=1
2681ec2230fSPaolo Abeniif [ $CPUS -gt 1 ]; then
2691ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST tx 2
2701ec2230fSPaolo Abeni	chk_channels "setting tx channels" $DST 1 2
2711ec2230fSPaolo Abeni	CUR_TX=2
2721ec2230fSPaolo Abenifi
2731ec2230fSPaolo Abeni
2741ec2230fSPaolo Abeniif [ $CPUS -gt 2 ]; then
2751ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST rx 3 tx 3
2761ec2230fSPaolo Abeni	chk_channels "setting both rx and tx channels" $DST 3 3
2771ec2230fSPaolo Abeni	CUR_RX=3
2781ec2230fSPaolo Abeni	CUR_TX=3
2791ec2230fSPaolo Abenifi
2801ec2230fSPaolo Abeni
2811ec2230fSPaolo Abeniip netns exec $NS_DST ethtool -L veth$DST combined 2 2>/dev/null
2821ec2230fSPaolo Abenichk_channels "bad setting: combined channels" $DST $CUR_RX $CUR_TX
2831ec2230fSPaolo Abeni
2841ec2230fSPaolo Abeniip netns exec $NS_DST ethtool -L veth$DST tx $((CPUS + 1)) 2>/dev/null
2851ec2230fSPaolo Abenichk_channels "setting invalid channels nr" $DST $CUR_RX $CUR_TX
2861ec2230fSPaolo Abeni
2871ec2230fSPaolo Abeniif [ $CPUS -gt 1 ]; then
2881ec2230fSPaolo Abeni	# this also tests queues nr reduction
2891ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST rx 1 tx 2 2>/dev/null
2901ec2230fSPaolo Abeni	ip netns exec $NS_SRC ethtool -L veth$SRC rx 1 tx 2 2>/dev/null
2911ec2230fSPaolo Abeni	printf "%-60s" "bad setting: XDP with RX nr less than TX"
292302e57f8SWang Yufen	ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
293d28b25a6SHangbin Liu		section xdp 2>/dev/null &&\
2941ec2230fSPaolo Abeni		echo "fail - set operation successful ?!?" || echo " ok "
2951ec2230fSPaolo Abeni
2961ec2230fSPaolo Abeni	# the following tests will run with multiple channels active
2971ec2230fSPaolo Abeni	ip netns exec $NS_SRC ethtool -L veth$SRC rx 2
2981ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST rx 2
299302e57f8SWang Yufen	ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
300d28b25a6SHangbin Liu		section xdp 2>/dev/null
3011ec2230fSPaolo Abeni	printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set"
3021ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\
3031ec2230fSPaolo Abeni		echo "fail - set operation successful ?!?" || echo " ok "
3041ec2230fSPaolo Abeni	CUR_RX=2
3051ec2230fSPaolo Abeni	CUR_TX=2
3061ec2230fSPaolo Abenifi
3071ec2230fSPaolo Abeni
3081ec2230fSPaolo Abeniif [ $CPUS -gt 2 ]; then
3091ec2230fSPaolo Abeni	printf "%-60s" "bad setting: increasing peer TX nr above RX with XDP set"
3101ec2230fSPaolo Abeni	ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null &&\
3111ec2230fSPaolo Abeni		echo "fail - set operation successful ?!?" || echo " ok "
3121ec2230fSPaolo Abeni	chk_channels "setting invalid channels nr" $DST 2 2
3131ec2230fSPaolo Abenifi
3141ec2230fSPaolo Abeni
315302e57f8SWang Yufenip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp 2>/dev/null
3161c3cadbeSPaolo Abenichk_gro_flag "with xdp attached - gro flag" $DST on
3171c3cadbeSPaolo Abenichk_gro_flag "        - peer gro flag" $SRC off
3181c3cadbeSPaolo Abenichk_tso_flag "        - tso flag" $SRC off
3191c3cadbeSPaolo Abenichk_tso_flag "        - peer tso flag" $DST on
3201c3cadbeSPaolo Abeniip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
3211c3cadbeSPaolo Abenichk_gro "        - aggregation" 1
3221c3cadbeSPaolo Abeni
3231c3cadbeSPaolo Abeni
3241c3cadbeSPaolo Abeniip -n $NS_DST link set dev veth$DST down
3251c3cadbeSPaolo Abeniip -n $NS_SRC link set dev veth$SRC down
3261c3cadbeSPaolo Abenichk_gro_flag "        - after dev off, flag" $DST on
3271c3cadbeSPaolo Abenichk_gro_flag "        - peer flag" $SRC off
3281c3cadbeSPaolo Abeni
3291c3cadbeSPaolo Abeniip netns exec $NS_DST ethtool -K veth$DST gro on
3301c3cadbeSPaolo Abeniip -n $NS_DST link set dev veth$DST xdp off
3311c3cadbeSPaolo Abenichk_gro_flag "        - after gro on xdp off, gro flag" $DST on
3321c3cadbeSPaolo Abenichk_gro_flag "        - peer gro flag" $SRC off
3331c3cadbeSPaolo Abenichk_tso_flag "        - tso flag" $SRC on
3341c3cadbeSPaolo Abenichk_tso_flag "        - peer tso flag" $DST on
3351ec2230fSPaolo Abeni
3361ec2230fSPaolo Abeniif [ $CPUS -gt 1 ]; then
3371ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST tx 1
3381ec2230fSPaolo Abeni	chk_channels "decreasing tx channels with device down" $DST 2 1
3391ec2230fSPaolo Abenifi
3401ec2230fSPaolo Abeni
3411c3cadbeSPaolo Abeniip -n $NS_DST link set dev veth$DST up
3421c3cadbeSPaolo Abeniip -n $NS_SRC link set dev veth$SRC up
3431c3cadbeSPaolo Abenichk_gro "        - aggregation" 1
3441c3cadbeSPaolo Abeni
3451ec2230fSPaolo Abeniif [ $CPUS -gt 1 ]; then
3461ec2230fSPaolo Abeni	[ $STRESS -gt 0 -a $CPUS -gt 2 ] && do_stress
3471ec2230fSPaolo Abeni
3481ec2230fSPaolo Abeni	ip -n $NS_DST link set dev veth$DST down
3491ec2230fSPaolo Abeni	ip -n $NS_SRC link set dev veth$SRC down
3501ec2230fSPaolo Abeni	ip netns exec $NS_DST ethtool -L veth$DST tx 2
3511ec2230fSPaolo Abeni	chk_channels "increasing tx channels with device down" $DST 2 2
3521ec2230fSPaolo Abeni	ip -n $NS_DST link set dev veth$DST up
3531ec2230fSPaolo Abeni	ip -n $NS_SRC link set dev veth$SRC up
3541ec2230fSPaolo Abenifi
3551ec2230fSPaolo Abeni
3561c3cadbeSPaolo Abeniip netns exec $NS_DST ethtool -K veth$DST gro off
3571c3cadbeSPaolo Abeniip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
3581c3cadbeSPaolo Abenichk_gro "aggregation again with default and TSO off" 10
3591c3cadbeSPaolo Abeni
3601c3cadbeSPaolo Abeniexit $ret
361