Lines Matching +full:tx +full:- +full:rx
2 # SPDX-License-Identifier: GPL-2.0
5 readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
23 readonly jobs="$(jobs -p)"
24 [ -n "${jobs}" ] && kill -1 ${jobs} 2>/dev/null
25 rm -f $STATS
39 ip -n $ns link set dev lo up
46 ip -n $BASE$ns addr add dev veth$ns $BM_NET_V4$ns/24
47 ip -n $BASE$ns addr add dev veth$ns $BM_NET_V6$ns/64 nodad
50 chmod go-rw $BASE
59 local flag=`ip netns exec $BASE$target ethtool -k veth$target |\
62 printf "%-60s" "$msg"
66 echo " fail - expected $expected found $flag"
72 __chk_flag "$1" $2 $3 generic-receive-offload
76 __chk_flag "$1" $2 $3 tcp-segmentation-offload
82 local rx=$3
83 local tx=$4
87 local cur_rx=`ip netns exec $BASE$target ethtool -l $dev |\
88 grep RX: | tail -n 1 | awk '{print $2}' `
89 local cur_tx=`ip netns exec $BASE$target ethtool -l $dev |\
90 grep TX: | tail -n 1 | awk '{print $2}'`
91 local cur_combined=`ip netns exec $BASE$target ethtool -l $dev |\
92 grep Combined: | tail -n 1 | awk '{print $2}'`
94 printf "%-60s" "$msg"
95 if [ "$cur_rx" = "$rx" -a "$cur_tx" = "$tx" -a "$cur_combined" = "n/a" ]; then
98 echo " fail rx:$rx:$cur_rx tx:$tx:$cur_tx combined:n/a:$cur_combined"
106 ip netns exec $BASE$SRC ping -qc 1 $BM_NET_V4$DST >/dev/null
107 NSTAT_HISTORY=$STATS ip netns exec $NS_DST nstat -n
109 printf "%-60s" "$msg"
110 ip netns exec $BASE$DST ./udpgso_bench_rx -C 1000 -R 10 &
114 ip netns exec $NS_SRC ./udpgso_bench_tx -4 -s 13000 -S 1300 -M 1 -D $BM_NET_V4$DST
118 if [ ${rets} -ne 0 ] || [ ${retc} -ne 0 ]; then
125 awk '{print $2}' | tail -n 1`
129 echo " fail - got $pkts packets, expected $expected "
142 printf -v cur '%(%s)T'
143 [ $cur -le $end ] || break
146 ip netns exec $NS_SRC ethtool -L veth$SRC rx $i tx $i
147 ip netns exec $NS_DST ethtool -L veth$DST rx $i tx $i
150 for i in `seq 1 $((CPUS - 1))`; do
151 cur_cpu=$((CPUS - $i))
152 ip netns exec $NS_SRC ethtool -L veth$SRC rx $cur_cpu tx $cur_cpu
153 ip netns exec $NS_DST ethtool -L veth$DST rx $cur_cpu tx $cur_cpu
162 printf -v cur '%(%s)T'
163 [ $cur -le $end ] || break
165 ip netns exec $NS_SRC ./udpgso_bench_tx -4 -s 1000 -M 300 -D $BM_NET_V4$DST
171 printf -v end '%(%s)T'
174 ip netns exec $NS_SRC ethtool -L veth$SRC rx 3 tx 3
175 ip netns exec $NS_DST ethtool -L veth$DST rx 3 tx 3
193 kill -9 $rx_pid
197 ip netns exec $NS_SRC ethtool -L veth$SRC rx 2 tx 2
198 ip netns exec $NS_DST ethtool -L veth$DST rx 2 tx 1
202 echo "Usage: $0 [-h] [-s <seconds>]"
203 echo -e "\t-h: show this help"
204 echo -e "\t-s: run optional stress tests for the given amount of seconds"
220 if [ ! -f ${BPF_FILE} ]; then
225 [ $CPUS -lt 2 ] && echo "Only one CPU available, some tests will be skipped"
226 [ $STRESS -gt 0 -a $CPUS -lt 3 ] && echo " stress test will be skipped, too"
229 chk_gro_flag "default - gro flag" $SRC off
230 chk_gro_flag " - peer gro flag" $DST off
231 chk_tso_flag " - tso flag" $SRC on
232 chk_tso_flag " - peer tso flag" $DST on
233 chk_gro " - aggregation" 1
234 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
235 chk_gro " - aggregation with TSO off" 10
239 ip netns exec $NS_DST ethtool -K veth$DST gro on
240 chk_gro_flag "with gro on - gro flag" $DST on
241 chk_gro_flag " - peer gro flag" $SRC off
242 chk_tso_flag " - tso flag" $SRC on
243 chk_tso_flag " - peer tso flag" $DST on
244 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
245 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
246 chk_gro " - aggregation with TSO off" 1
250 ip -n $NS_DST link set dev veth$DST up
251 ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp
252 chk_gro_flag "gro vs xdp while down - gro flag off" $DST off
253 ip -n $NS_DST link set dev veth$DST down
254 chk_gro_flag " - after down" $DST off
255 ip -n $NS_DST link set dev veth$DST xdp off
256 chk_gro_flag " - after xdp off" $DST off
257 ip -n $NS_DST link set dev veth$DST up
258 chk_gro_flag " - after up" $DST off
259 ip -n $NS_SRC link set dev veth$SRC xdp object ${BPF_FILE} section xdp
260 chk_gro_flag " - after peer xdp" $DST off
264 ip -n $NS_DST link set dev veth$DST up
265 ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp
266 ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
267 chk_gro_flag "gro vs xdp while down - gro flag on" $DST on
268 ip -n $NS_DST link set dev veth$DST down
269 chk_gro_flag " - after down" $DST on
270 ip -n $NS_DST link set dev veth$DST xdp off
271 chk_gro_flag " - after xdp off" $DST on
272 ip -n $NS_DST link set dev veth$DST up
273 chk_gro_flag " - after up" $DST on
274 ip -n $NS_SRC link set dev veth$SRC xdp object ${BPF_FILE} section xdp
275 chk_gro_flag " - after peer xdp" $DST on
281 ip -n $NS_DST link set dev veth$DST down
282 ip netns exec $NS_DST ethtool -K veth$DST gro on
283 chk_gro_flag "with gro enabled on link down - gro flag" $DST on
284 chk_gro_flag " - peer gro flag" $SRC off
285 chk_tso_flag " - tso flag" $SRC on
286 chk_tso_flag " - peer tso flag" $DST on
287 ip -n $NS_DST link set dev veth$DST up
288 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
289 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
290 chk_gro " - aggregation with TSO off" 1
297 if [ $CPUS -gt 1 ]; then
298 ip netns exec $NS_DST ethtool -L veth$DST tx 2
299 chk_channels "setting tx channels" $DST 1 2
303 if [ $CPUS -gt 2 ]; then
304 ip netns exec $NS_DST ethtool -L veth$DST rx 3 tx 3
305 chk_channels "setting both rx and tx channels" $DST 3 3
310 ip netns exec $NS_DST ethtool -L veth$DST combined 2 2>/dev/null
313 ip netns exec $NS_DST ethtool -L veth$DST tx $((CPUS + 1)) 2>/dev/null
316 if [ $CPUS -gt 1 ]; then
318 ip netns exec $NS_DST ethtool -L veth$DST rx 1 tx 2 2>/dev/null
319 ip netns exec $NS_SRC ethtool -L veth$SRC rx 1 tx 2 2>/dev/null
320 printf "%-60s" "bad setting: XDP with RX nr less than TX"
321 ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
323 echo "fail - set operation successful ?!?" || echo " ok "
326 ip netns exec $NS_SRC ethtool -L veth$SRC rx 2
327 ip netns exec $NS_DST ethtool -L veth$DST rx 2
328 ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
330 printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set"
331 ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\
332 echo "fail - set operation successful ?!?" || echo " ok "
337 if [ $CPUS -gt 2 ]; then
338 printf "%-60s" "bad setting: increasing peer TX nr above RX with XDP set"
339 ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null &&\
340 echo "fail - set operation successful ?!?" || echo " ok "
344 ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp 2>/dev/null
345 chk_gro_flag "with xdp attached - gro flag" $DST off
346 chk_gro_flag " - peer gro flag" $SRC off
347 chk_tso_flag " - tso flag" $SRC off
348 chk_tso_flag " - peer tso flag" $DST on
349 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
350 chk_gro " - no aggregation" 10
351 ip netns exec $NS_DST ethtool -K veth$DST generic-receive-offload on
352 chk_gro_flag " - gro flag with GRO on" $DST on
353 chk_gro " - aggregation" 1
356 ip -n $NS_DST link set dev veth$DST down
357 ip -n $NS_SRC link set dev veth$SRC down
358 chk_gro_flag " - after dev off, flag" $DST on
359 chk_gro_flag " - peer flag" $SRC off
361 ip netns exec $NS_DST ethtool -K veth$DST gro on
362 ip -n $NS_DST link set dev veth$DST xdp off
363 chk_gro_flag " - after gro on xdp off, gro flag" $DST on
364 chk_gro_flag " - peer gro flag" $SRC off
365 chk_tso_flag " - tso flag" $SRC on
366 chk_tso_flag " - peer tso flag" $DST on
368 if [ $CPUS -gt 1 ]; then
369 ip netns exec $NS_DST ethtool -L veth$DST tx 1
370 chk_channels "decreasing tx channels with device down" $DST 2 1
373 ip -n $NS_DST link set dev veth$DST up
374 ip -n $NS_SRC link set dev veth$SRC up
375 chk_gro " - aggregation" 1
377 if [ $CPUS -gt 1 ]; then
378 [ $STRESS -gt 0 -a $CPUS -gt 2 ] && do_stress
380 ip -n $NS_DST link set dev veth$DST down
381 ip -n $NS_SRC link set dev veth$SRC down
382 ip netns exec $NS_DST ethtool -L veth$DST tx 2
383 chk_channels "increasing tx channels with device down" $DST 2 2
384 ip -n $NS_DST link set dev veth$DST up
385 ip -n $NS_SRC link set dev veth$SRC up
388 ip netns exec $NS_DST ethtool -K veth$DST gro off
389 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off