Lines Matching +full:rx +full:- +full:tx

2 # SPDX-License-Identifier: GPL-2.0
4 readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
22 readonly jobs="$(jobs -p)"
23 [ -n "${jobs}" ] && kill -1 ${jobs} 2>/dev/null
24 rm -f $STATS
38 ip -n $ns link set dev lo up
45 ip -n $BASE$ns addr add dev veth$ns $BM_NET_V4$ns/24
46 ip -n $BASE$ns addr add dev veth$ns $BM_NET_V6$ns/64 nodad
49 chmod go-rw $BASE
58 local flag=`ip netns exec $BASE$target ethtool -k veth$target |\
61 printf "%-60s" "$msg"
65 echo " fail - expected $expected found $flag"
71 __chk_flag "$1" $2 $3 generic-receive-offload
75 __chk_flag "$1" $2 $3 tcp-segmentation-offload
81 local rx=$3
82 local tx=$4
86 local cur_rx=`ip netns exec $BASE$target ethtool -l $dev |\
87 grep RX: | tail -n 1 | awk '{print $2}' `
88 local cur_tx=`ip netns exec $BASE$target ethtool -l $dev |\
89 grep TX: | tail -n 1 | awk '{print $2}'`
90 local cur_combined=`ip netns exec $BASE$target ethtool -l $dev |\
91 grep Combined: | tail -n 1 | awk '{print $2}'`
93 printf "%-60s" "$msg"
94 if [ "$cur_rx" = "$rx" -a "$cur_tx" = "$tx" -a "$cur_combined" = "n/a" ]; then
97 echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined"
105 ip netns exec $BASE$SRC ping -qc 1 $BM_NET_V4$DST >/dev/null
106 NSTAT_HISTORY=$STATS ip netns exec $NS_DST nstat -n
108 printf "%-60s" "$msg"
109 ip netns exec $BASE$DST ./udpgso_bench_rx -C 1000 -R 10 &
113 ip netns exec $NS_SRC ./udpgso_bench_tx -4 -s 13000 -S 1300 -M 1 -D $BM_NET_V4$DST
117 if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
124 awk '{print $2}' | tail -n 1`
128 echo " fail - got $pkts packets, expected $expected "
141 printf -v cur '%(%s)T'
142 [ $cur -le $end ] || break
145 ip netns exec $NS_SRC ethtool -L veth$SRC rx $i tx $i
146 ip netns exec $NS_DST ethtool -L veth$DST rx $i tx $i
149 for i in `seq 1 $((CPUS - 1))`; do
150 cur_cpu=$((CPUS - $i))
151 ip netns exec $NS_SRC ethtool -L veth$SRC rx $cur_cpu tx $cur_cpu
152 ip netns exec $NS_DST ethtool -L veth$DST rx $cur_cpu tx $cur_cpu
161 printf -v cur '%(%s)T'
162 [ $cur -le $end ] || break
164 ip netns exec $NS_SRC ./udpgso_bench_tx -4 -s 1000 -M 300 -D $BM_NET_V4$DST
170 printf -v end '%(%s)T'
173 ip netns exec $NS_SRC ethtool -L veth$SRC rx 3 tx 3
174 ip netns exec $NS_DST ethtool -L veth$DST rx 3 tx 3
192 kill -9 $rx_pid
196 ip netns exec $NS_SRC ethtool -L veth$SRC rx 2 tx 2
197 ip netns exec $NS_DST ethtool -L veth$DST rx 2 tx 1
201 echo "Usage: $0 [-h] [-s <seconds>]"
202 echo -e "\t-h: show this help"
203 echo -e "\t-s: run optional stress tests for the given amount of seconds"
219 if [ ! -f ../bpf/xdp_dummy.o ]; then
224 [ $CPUS -lt 2 ] && echo "Only one CPU available, some tests will be skipped"
225 [ $STRESS -gt 0 -a $CPUS -lt 3 ] && echo " stress test will be skipped, too"
228 chk_gro_flag "default - gro flag" $SRC off
229 chk_gro_flag " - peer gro flag" $DST off
230 chk_tso_flag " - tso flag" $SRC on
231 chk_tso_flag " - peer tso flag" $DST on
232 chk_gro " - aggregation" 1
233 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
234 chk_gro " - aggregation with TSO off" 10
238 ip netns exec $NS_DST ethtool -K veth$DST gro on
239 chk_gro_flag "with gro on - gro flag" $DST on
240 chk_gro_flag " - peer gro flag" $SRC off
241 chk_tso_flag " - tso flag" $SRC on
242 chk_tso_flag " - peer tso flag" $DST on
243 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
244 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
245 chk_gro " - aggregation with TSO off" 1
251 ip -n $NS_DST link set dev veth$DST down
252 ip netns exec $NS_DST ethtool -K veth$DST gro on
253 chk_gro_flag "with gro enabled on link down - gro flag" $DST on
254 chk_gro_flag " - peer gro flag" $SRC off
255 chk_tso_flag " - tso flag" $SRC on
256 chk_tso_flag " - peer tso flag" $DST on
257 ip -n $NS_DST link set dev veth$DST up
258 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
259 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
260 chk_gro " - aggregation with TSO off" 1
267 if [ $CPUS -gt 1 ]; then
268 ip netns exec $NS_DST ethtool -L veth$DST tx 2
269 chk_channels "setting tx channels" $DST 1 2
273 if [ $CPUS -gt 2 ]; then
274 ip netns exec $NS_DST ethtool -L veth$DST rx 3 tx 3
275 chk_channels "setting both rx and tx channels" $DST 3 3
280 ip netns exec $NS_DST ethtool -L veth$DST combined 2 2>/dev/null
283 ip netns exec $NS_DST ethtool -L veth$DST tx $((CPUS + 1)) 2>/dev/null
286 if [ $CPUS -gt 1 ]; then
288 ip netns exec $NS_DST ethtool -L veth$DST rx 1 tx 2 2>/dev/null
289 ip netns exec $NS_SRC ethtool -L veth$SRC rx 1 tx 2 2>/dev/null
290 printf "%-60s" "bad setting: XDP with RX nr less than TX"
291 ip -n $NS_DST link set dev veth$DST xdp object ../bpf/xdp_dummy.o \
293 echo "fail - set operation successful ?!?" || echo " ok "
296 ip netns exec $NS_SRC ethtool -L veth$SRC rx 2
297 ip netns exec $NS_DST ethtool -L veth$DST rx 2
298 ip -n $NS_DST link set dev veth$DST xdp object ../bpf/xdp_dummy.o \
300 printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set"
301 ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\
302 echo "fail - set operation successful ?!?" || echo " ok "
307 if [ $CPUS -gt 2 ]; then
308 printf "%-60s" "bad setting: increasing peer TX nr above RX with XDP set"
309 ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null &&\
310 echo "fail - set operation successful ?!?" || echo " ok "
314 ip -n $NS_DST link set dev veth$DST xdp object ../bpf/xdp_dummy.o section xdp_dummy 2>/dev/null
315 chk_gro_flag "with xdp attached - gro flag" $DST on
316 chk_gro_flag " - peer gro flag" $SRC off
317 chk_tso_flag " - tso flag" $SRC off
318 chk_tso_flag " - peer tso flag" $DST on
319 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
320 chk_gro " - aggregation" 1
323 ip -n $NS_DST link set dev veth$DST down
324 ip -n $NS_SRC link set dev veth$SRC down
325 chk_gro_flag " - after dev off, flag" $DST on
326 chk_gro_flag " - peer flag" $SRC off
328 ip netns exec $NS_DST ethtool -K veth$DST gro on
329 ip -n $NS_DST link set dev veth$DST xdp off
330 chk_gro_flag " - after gro on xdp off, gro flag" $DST on
331 chk_gro_flag " - peer gro flag" $SRC off
332 chk_tso_flag " - tso flag" $SRC on
333 chk_tso_flag " - peer tso flag" $DST on
335 if [ $CPUS -gt 1 ]; then
336 ip netns exec $NS_DST ethtool -L veth$DST tx 1
337 chk_channels "decreasing tx channels with device down" $DST 2 1
340 ip -n $NS_DST link set dev veth$DST up
341 ip -n $NS_SRC link set dev veth$SRC up
342 chk_gro " - aggregation" 1
344 if [ $CPUS -gt 1 ]; then
345 [ $STRESS -gt 0 -a $CPUS -gt 2 ] && do_stress
347 ip -n $NS_DST link set dev veth$DST down
348 ip -n $NS_SRC link set dev veth$SRC down
349 ip netns exec $NS_DST ethtool -L veth$DST tx 2
350 chk_channels "increasing tx channels with device down" $DST 2 2
351 ip -n $NS_DST link set dev veth$DST up
352 ip -n $NS_SRC link set dev veth$SRC up
355 ip netns exec $NS_DST ethtool -K veth$DST gro off
356 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off