Skip to content

Commit 010e03d

Browse files
committed
Merge branch 'selftests-net-more-fixes'
Paolo Abeni says: ==================== selftests: net: more fixes Another small bunch of fixes, addressing issues outlined by the netdev CI. The first 2 patches are just rebased. The following 2 are new fixes, for even more problems that surfaced meanwhile. ==================== Link: https://lore.kernel.org/r/cover.1706812005.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 2e7d3b6 + 691bb4e commit 010e03d

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

tools/testing/selftests/net/pmtu.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
# Same as above but with IPv6
200200

201201
source lib.sh
202+
source net_helper.sh
202203

203204
PAUSE_ON_FAIL=no
204205
VERBOSE=0
@@ -1336,13 +1337,15 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() {
13361337
TCPDST="TCP:[${dst}]:50000"
13371338
fi
13381339
${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile &
1340+
local socat_pid=$!
13391341

1340-
sleep 1
1342+
wait_local_port_listen ${NS_B} 50000 tcp
13411343

13421344
dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
13431345

13441346
size=$(du -sb $tmpoutfile)
13451347
size=${size%%/tmp/*}
1348+
wait ${socat_pid}
13461349

13471350
[ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1
13481351
done
@@ -1954,6 +1957,13 @@ check_command() {
19541957
return 0
19551958
}
19561959

1960+
check_running() {
1961+
pid=${1}
1962+
cmd=${2}
1963+
1964+
[ "$(cat /proc/${pid}/cmdline 2>/dev/null | tr -d '\0')" = "{cmd}" ]
1965+
}
1966+
19571967
test_cleanup_vxlanX_exception() {
19581968
outer="${1}"
19591969
encap="vxlan"
@@ -1984,11 +1994,12 @@ test_cleanup_vxlanX_exception() {
19841994

19851995
${ns_a} ip link del dev veth_A-R1 &
19861996
iplink_pid=$!
1987-
sleep 1
1988-
if [ "$(cat /proc/${iplink_pid}/cmdline 2>/dev/null | tr -d '\0')" = "iplinkdeldevveth_A-R1" ]; then
1989-
err " can't delete veth device in a timely manner, PMTU dst likely leaked"
1990-
return 1
1991-
fi
1997+
for i in $(seq 1 20); do
1998+
check_running ${iplink_pid} "iplinkdeldevveth_A-R1" || return 0
1999+
sleep 0.1
2000+
done
2001+
err " can't delete veth device in a timely manner, PMTU dst likely leaked"
2002+
return 1
19922003
}
19932004

19942005
test_cleanup_ipv6_exception() {

tools/testing/selftests/net/rtnetlink.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ kci_test_encap_vxlan()
440440
local ret=0
441441
vxlan="test-vxlan0"
442442
vlan="test-vlan0"
443-
testns="$1"
444443
run_cmd ip -netns "$testns" link add "$vxlan" type vxlan id 42 group 239.1.1.1 \
445444
dev "$devdummy" dstport 4789
446445
if [ $? -ne 0 ]; then
@@ -485,7 +484,6 @@ kci_test_encap_fou()
485484
{
486485
local ret=0
487486
name="test-fou"
488-
testns="$1"
489487
run_cmd_grep 'Usage: ip fou' ip fou help
490488
if [ $? -ne 0 ];then
491489
end_test "SKIP: fou: iproute2 too old"
@@ -526,8 +524,8 @@ kci_test_encap()
526524
run_cmd ip -netns "$testns" link set lo up
527525
run_cmd ip -netns "$testns" link add name "$devdummy" type dummy
528526
run_cmd ip -netns "$testns" link set "$devdummy" up
529-
run_cmd kci_test_encap_vxlan "$testns"
530-
run_cmd kci_test_encap_fou "$testns"
527+
run_cmd kci_test_encap_vxlan
528+
run_cmd kci_test_encap_fou
531529

532530
ip netns del "$testns"
533531
return $ret

tools/testing/selftests/net/udpgro_fwd.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ create_ns() {
3939
for ns in $NS_SRC $NS_DST; do
4040
ip netns add $ns
4141
ip -n $ns link set dev lo up
42+
43+
# disable route solicitations to decrease 'noise' traffic
44+
ip netns exec $ns sysctl -qw net.ipv6.conf.default.router_solicitations=0
45+
ip netns exec $ns sysctl -qw net.ipv6.conf.all.router_solicitations=0
4246
done
4347

4448
ip link add name veth$SRC type veth peer name veth$DST
@@ -80,6 +84,12 @@ create_vxlan_pair() {
8084
create_vxlan_endpoint $BASE$ns veth$ns $BM_NET_V6$((3 - $ns)) vxlan6$ns 6
8185
ip -n $BASE$ns addr add dev vxlan6$ns $OL_NET_V6$ns/24 nodad
8286
done
87+
88+
# preload neighbur cache, do avoid some noisy traffic
89+
local addr_dst=$(ip -j -n $BASE$DST link show dev vxlan6$DST |jq -r '.[]["address"]')
90+
local addr_src=$(ip -j -n $BASE$SRC link show dev vxlan6$SRC |jq -r '.[]["address"]')
91+
ip -n $BASE$DST neigh add dev vxlan6$DST lladdr $addr_src $OL_NET_V6$SRC
92+
ip -n $BASE$SRC neigh add dev vxlan6$SRC lladdr $addr_dst $OL_NET_V6$DST
8393
}
8494

8595
is_ipv6() {
@@ -119,7 +129,7 @@ run_test() {
119129
# not enable GRO
120130
ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 4789
121131
ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000
122-
ip netns exec $NS_DST ./udpgso_bench_rx -C 1000 -R 10 -n 10 -l 1300 $rx_args &
132+
ip netns exec $NS_DST ./udpgso_bench_rx -C 2000 -R 100 -n 10 -l 1300 $rx_args &
123133
local spid=$!
124134
wait_local_port_listen "$NS_DST" 8000 udp
125135
ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst
@@ -168,7 +178,7 @@ run_bench() {
168178
# bind the sender and the receiver to different CPUs to try
169179
# get reproducible results
170180
ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus"
171-
ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 1000 -R 10 &
181+
ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 2000 -R 100 &
172182
local spid=$!
173183
wait_local_port_listen "$NS_DST" 8000 udp
174184
ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst

tools/testing/selftests/net/udpgso_bench_rx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static void do_recv(void)
375375
do_flush_udp(fd);
376376

377377
tnow = gettimeofday_ms();
378-
if (tnow > treport) {
378+
if (!cfg_expected_pkt_nr && tnow > treport) {
379379
if (packets)
380380
fprintf(stderr,
381381
"%s rx: %6lu MB/s %8lu calls/s\n",

0 commit comments

Comments
 (0)