Commit 010e03db authored by Jakub Kicinski's avatar Jakub Kicinski

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.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 2e7d3b67 691bb4e4
...@@ -199,6 +199,7 @@ ...@@ -199,6 +199,7 @@
# Same as above but with IPv6 # Same as above but with IPv6
source lib.sh source lib.sh
source net_helper.sh
PAUSE_ON_FAIL=no PAUSE_ON_FAIL=no
VERBOSE=0 VERBOSE=0
...@@ -1336,13 +1337,15 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() { ...@@ -1336,13 +1337,15 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() {
TCPDST="TCP:[${dst}]:50000" TCPDST="TCP:[${dst}]:50000"
fi fi
${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile & ${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile &
local socat_pid=$!
sleep 1 wait_local_port_listen ${NS_B} 50000 tcp
dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3 dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
size=$(du -sb $tmpoutfile) size=$(du -sb $tmpoutfile)
size=${size%%/tmp/*} size=${size%%/tmp/*}
wait ${socat_pid}
[ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1 [ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1
done done
...@@ -1954,6 +1957,13 @@ check_command() { ...@@ -1954,6 +1957,13 @@ check_command() {
return 0 return 0
} }
check_running() {
pid=${1}
cmd=${2}
[ "$(cat /proc/${pid}/cmdline 2>/dev/null | tr -d '\0')" = "{cmd}" ]
}
test_cleanup_vxlanX_exception() { test_cleanup_vxlanX_exception() {
outer="${1}" outer="${1}"
encap="vxlan" encap="vxlan"
...@@ -1984,11 +1994,12 @@ test_cleanup_vxlanX_exception() { ...@@ -1984,11 +1994,12 @@ test_cleanup_vxlanX_exception() {
${ns_a} ip link del dev veth_A-R1 & ${ns_a} ip link del dev veth_A-R1 &
iplink_pid=$! iplink_pid=$!
sleep 1 for i in $(seq 1 20); do
if [ "$(cat /proc/${iplink_pid}/cmdline 2>/dev/null | tr -d '\0')" = "iplinkdeldevveth_A-R1" ]; then check_running ${iplink_pid} "iplinkdeldevveth_A-R1" || return 0
err " can't delete veth device in a timely manner, PMTU dst likely leaked" sleep 0.1
return 1 done
fi err " can't delete veth device in a timely manner, PMTU dst likely leaked"
return 1
} }
test_cleanup_ipv6_exception() { test_cleanup_ipv6_exception() {
......
...@@ -440,7 +440,6 @@ kci_test_encap_vxlan() ...@@ -440,7 +440,6 @@ kci_test_encap_vxlan()
local ret=0 local ret=0
vxlan="test-vxlan0" vxlan="test-vxlan0"
vlan="test-vlan0" vlan="test-vlan0"
testns="$1"
run_cmd ip -netns "$testns" link add "$vxlan" type vxlan id 42 group 239.1.1.1 \ run_cmd ip -netns "$testns" link add "$vxlan" type vxlan id 42 group 239.1.1.1 \
dev "$devdummy" dstport 4789 dev "$devdummy" dstport 4789
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
...@@ -485,7 +484,6 @@ kci_test_encap_fou() ...@@ -485,7 +484,6 @@ kci_test_encap_fou()
{ {
local ret=0 local ret=0
name="test-fou" name="test-fou"
testns="$1"
run_cmd_grep 'Usage: ip fou' ip fou help run_cmd_grep 'Usage: ip fou' ip fou help
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
end_test "SKIP: fou: iproute2 too old" end_test "SKIP: fou: iproute2 too old"
...@@ -526,8 +524,8 @@ kci_test_encap() ...@@ -526,8 +524,8 @@ kci_test_encap()
run_cmd ip -netns "$testns" link set lo up run_cmd ip -netns "$testns" link set lo up
run_cmd ip -netns "$testns" link add name "$devdummy" type dummy run_cmd ip -netns "$testns" link add name "$devdummy" type dummy
run_cmd ip -netns "$testns" link set "$devdummy" up run_cmd ip -netns "$testns" link set "$devdummy" up
run_cmd kci_test_encap_vxlan "$testns" run_cmd kci_test_encap_vxlan
run_cmd kci_test_encap_fou "$testns" run_cmd kci_test_encap_fou
ip netns del "$testns" ip netns del "$testns"
return $ret return $ret
......
...@@ -39,6 +39,10 @@ create_ns() { ...@@ -39,6 +39,10 @@ create_ns() {
for ns in $NS_SRC $NS_DST; do for ns in $NS_SRC $NS_DST; do
ip netns add $ns ip netns add $ns
ip -n $ns link set dev lo up ip -n $ns link set dev lo up
# disable route solicitations to decrease 'noise' traffic
ip netns exec $ns sysctl -qw net.ipv6.conf.default.router_solicitations=0
ip netns exec $ns sysctl -qw net.ipv6.conf.all.router_solicitations=0
done done
ip link add name veth$SRC type veth peer name veth$DST ip link add name veth$SRC type veth peer name veth$DST
...@@ -80,6 +84,12 @@ create_vxlan_pair() { ...@@ -80,6 +84,12 @@ create_vxlan_pair() {
create_vxlan_endpoint $BASE$ns veth$ns $BM_NET_V6$((3 - $ns)) vxlan6$ns 6 create_vxlan_endpoint $BASE$ns veth$ns $BM_NET_V6$((3 - $ns)) vxlan6$ns 6
ip -n $BASE$ns addr add dev vxlan6$ns $OL_NET_V6$ns/24 nodad ip -n $BASE$ns addr add dev vxlan6$ns $OL_NET_V6$ns/24 nodad
done done
# preload neighbur cache, do avoid some noisy traffic
local addr_dst=$(ip -j -n $BASE$DST link show dev vxlan6$DST |jq -r '.[]["address"]')
local addr_src=$(ip -j -n $BASE$SRC link show dev vxlan6$SRC |jq -r '.[]["address"]')
ip -n $BASE$DST neigh add dev vxlan6$DST lladdr $addr_src $OL_NET_V6$SRC
ip -n $BASE$SRC neigh add dev vxlan6$SRC lladdr $addr_dst $OL_NET_V6$DST
} }
is_ipv6() { is_ipv6() {
...@@ -119,7 +129,7 @@ run_test() { ...@@ -119,7 +129,7 @@ run_test() {
# not enable GRO # not enable GRO
ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 4789 ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 4789
ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000 ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000
ip netns exec $NS_DST ./udpgso_bench_rx -C 1000 -R 10 -n 10 -l 1300 $rx_args & ip netns exec $NS_DST ./udpgso_bench_rx -C 2000 -R 100 -n 10 -l 1300 $rx_args &
local spid=$! local spid=$!
wait_local_port_listen "$NS_DST" 8000 udp wait_local_port_listen "$NS_DST" 8000 udp
ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst
...@@ -168,7 +178,7 @@ run_bench() { ...@@ -168,7 +178,7 @@ run_bench() {
# bind the sender and the receiver to different CPUs to try # bind the sender and the receiver to different CPUs to try
# get reproducible results # get reproducible results
ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus" ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus"
ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 1000 -R 10 & ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 2000 -R 100 &
local spid=$! local spid=$!
wait_local_port_listen "$NS_DST" 8000 udp wait_local_port_listen "$NS_DST" 8000 udp
ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst
......
...@@ -375,7 +375,7 @@ static void do_recv(void) ...@@ -375,7 +375,7 @@ static void do_recv(void)
do_flush_udp(fd); do_flush_udp(fd);
tnow = gettimeofday_ms(); tnow = gettimeofday_ms();
if (tnow > treport) { if (!cfg_expected_pkt_nr && tnow > treport) {
if (packets) if (packets)
fprintf(stderr, fprintf(stderr,
"%s rx: %6lu MB/s %8lu calls/s\n", "%s rx: %6lu MB/s %8lu calls/s\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment