Lines Matching +full:src +full:- +full:2
2 # SPDX-License-Identifier: GPL-2.0
5 readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
7 readonly SRC=2
10 readonly NS_SRC=$BASE$SRC
23 readonly jobs="$(jobs -p)"
24 [ -n "${jobs}" ] && kill -1 ${jobs} 2>/dev/null
25 rm -f $STATS
28 ip netns del $ns 2>/dev/null
39 ip -n $ns link set dev lo up
42 ip link add name veth$SRC type veth peer name veth$DST
44 for ns in $SRC $DST; do
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
55 local target=$2
59 local flag=`ip netns exec $BASE$target ethtool -k veth$target |\
60 grep $flagname | awk '{print $2}'`
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
81 local target=$2
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
104 local expected=$2
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
252 ip -n $NS_DST link set dev veth$DST down
253 ip netns exec $NS_DST ethtool -K veth$DST gro on
254 chk_gro_flag "with gro enabled on link down - gro flag" $DST on
255 chk_gro_flag " - peer gro flag" $SRC off
256 chk_tso_flag " - tso flag" $SRC on
257 chk_tso_flag " - peer tso flag" $DST on
258 ip -n $NS_DST link set dev veth$DST up
259 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off
260 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
261 chk_gro " - aggregation with TSO off" 1
268 if [ $CPUS -gt 1 ]; then
269 ip netns exec $NS_DST ethtool -L veth$DST tx 2
270 chk_channels "setting tx channels" $DST 1 2
271 CUR_TX=2
274 if [ $CPUS -gt 2 ]; then
275 ip netns exec $NS_DST ethtool -L veth$DST rx 3 tx 3
281 ip netns exec $NS_DST ethtool -L veth$DST combined 2 2>/dev/null
284 ip netns exec $NS_DST ethtool -L veth$DST tx $((CPUS + 1)) 2>/dev/null
287 if [ $CPUS -gt 1 ]; then
289 ip netns exec $NS_DST ethtool -L veth$DST rx 1 tx 2 2>/dev/null
290 ip netns exec $NS_SRC ethtool -L veth$SRC rx 1 tx 2 2>/dev/null
291 printf "%-60s" "bad setting: XDP with RX nr less than TX"
292 ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
293 section xdp 2>/dev/null &&\
294 echo "fail - set operation successful ?!?" || echo " ok "
297 ip netns exec $NS_SRC ethtool -L veth$SRC rx 2
298 ip netns exec $NS_DST ethtool -L veth$DST rx 2
299 ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} \
300 section xdp 2>/dev/null
301 printf "%-60s" "bad setting: reducing RX nr below peer TX with XDP set"
302 ip netns exec $NS_DST ethtool -L veth$DST rx 1 2>/dev/null &&\
303 echo "fail - set operation successful ?!?" || echo " ok "
304 CUR_RX=2
305 CUR_TX=2
308 if [ $CPUS -gt 2 ]; then
309 printf "%-60s" "bad setting: increasing peer TX nr above RX with XDP set"
310 ip netns exec $NS_SRC ethtool -L veth$SRC tx 3 2>/dev/null &&\
311 echo "fail - set operation successful ?!?" || echo " ok "
312 chk_channels "setting invalid channels nr" $DST 2 2
315 ip -n $NS_DST link set dev veth$DST xdp object ${BPF_FILE} section xdp 2>/dev/null
316 chk_gro_flag "with xdp attached - gro flag" $DST on
317 chk_gro_flag " - peer gro flag" $SRC off
318 chk_tso_flag " - tso flag" $SRC off
319 chk_tso_flag " - peer tso flag" $DST on
320 ip netns exec $NS_DST ethtool -K veth$DST rx-udp-gro-forwarding on
321 chk_gro " - aggregation" 1
324 ip -n $NS_DST link set dev veth$DST down
325 ip -n $NS_SRC link set dev veth$SRC down
326 chk_gro_flag " - after dev off, flag" $DST on
327 chk_gro_flag " - peer flag" $SRC off
329 ip netns exec $NS_DST ethtool -K veth$DST gro on
330 ip -n $NS_DST link set dev veth$DST xdp off
331 chk_gro_flag " - after gro on xdp off, gro flag" $DST on
332 chk_gro_flag " - peer gro flag" $SRC off
333 chk_tso_flag " - tso flag" $SRC on
334 chk_tso_flag " - peer tso flag" $DST on
336 if [ $CPUS -gt 1 ]; then
337 ip netns exec $NS_DST ethtool -L veth$DST tx 1
338 chk_channels "decreasing tx channels with device down" $DST 2 1
341 ip -n $NS_DST link set dev veth$DST up
342 ip -n $NS_SRC link set dev veth$SRC up
343 chk_gro " - aggregation" 1
345 if [ $CPUS -gt 1 ]; then
346 [ $STRESS -gt 0 -a $CPUS -gt 2 ] && do_stress
348 ip -n $NS_DST link set dev veth$DST down
349 ip -n $NS_SRC link set dev veth$SRC down
350 ip netns exec $NS_DST ethtool -L veth$DST tx 2
351 chk_channels "increasing tx channels with device down" $DST 2 2
352 ip -n $NS_DST link set dev veth$DST up
353 ip -n $NS_SRC link set dev veth$SRC up
356 ip netns exec $NS_DST ethtool -K veth$DST gro off
357 ip netns exec $NS_SRC ethtool -K veth$SRC tx-udp-segmentation off