Skip to content

Commit

Permalink
selftests: mptcp: join: check CURRESTAB counters
Browse files Browse the repository at this point in the history
This patch adds a new helper chk_cestab_nr() to check the current
established connections counter MIB_CURRESTAB. Set the newly added
variables cestab_ns1 and cestab_ns2 to indicate how many connections
are expected in ns1 or ns2. These checks are embedded in add_tests().

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
geliangtang authored and intel-lab-lkp committed Nov 29, 2023
1 parent 27ada64 commit 35e2c76
Showing 1 changed file with 53 additions and 5 deletions.
58 changes: 53 additions & 5 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ unset FAILING_LINKS
unset test_linkfail
unset addr_nr_ns1
unset addr_nr_ns2
unset cestab_ns1
unset cestab_ns2
unset sflags
unset fastclose
unset fullmesh
Expand Down Expand Up @@ -976,6 +978,46 @@ pm_nl_set_endpoint()
fi
}

chk_cestab_nr()
{
local ns=$1
local cestab=$2
local count

print_check "current establish"
count=$(mptcp_lib_get_counter ${ns} "MPTcpExtMPCurrEstab")
if [ -z "$count" ]; then
print_skip
elif [ "$count" != "$cestab" ]; then
fail_test "got $count current establish[s] expected $cestab"
else
print_ok
fi
}

check_cestab()
{
local cestab_ns1=${cestab_ns1:-0}
local cestab_ns2=${cestab_ns2:-0}

if ! mptcp_lib_kallsyms_has "register_ftrace_function"; then
return
fi

if [ $cestab_ns1 -gt 0 ]; then
if mptcp_lib_is_v6 $3; then
sleep 2
fi
chk_cestab_nr $1 $cestab_ns1
fi
if [ $cestab_ns2 -gt 0 ]; then
if mptcp_lib_is_v6 $3; then
sleep 2
fi
chk_cestab_nr $2 $cestab_ns2
fi
}

do_transfer()
{
local listener_ns="$1"
Expand Down Expand Up @@ -1089,6 +1131,7 @@ do_transfer()
local cpid=$!

pm_nl_set_endpoint $listener_ns $connector_ns $connect_addr
check_cestab $listener_ns $connector_ns $connect_addr

wait $cpid
local retc=$?
Expand Down Expand Up @@ -2477,47 +2520,52 @@ add_tests()
if reset "add single subflow"; then
pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 0 1
addr_nr_ns2=1 speed=slow \
addr_nr_ns2=1 speed=slow cestab_ns2=2 \
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 1 1 1
chk_cestab_nr $ns2 0
fi

# add signal address
if reset "add signal address"; then
pm_nl_set_limits $ns1 0 1
pm_nl_set_limits $ns2 1 1
addr_nr_ns1=1 speed=slow \
addr_nr_ns1=1 speed=slow cestab_ns1=2 \
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 1 1 1
chk_add_nr 1 1
chk_cestab_nr $ns1 0
fi

# add multiple subflows
if reset "add multiple subflows"; then
pm_nl_set_limits $ns1 0 2
pm_nl_set_limits $ns2 0 2
addr_nr_ns2=2 speed=slow \
addr_nr_ns2=2 speed=slow cestab_ns2=3 \
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 2 2 2
chk_cestab_nr $ns2 0
fi

# add multiple subflows IPv6
if reset "add multiple subflows IPv6"; then
pm_nl_set_limits $ns1 0 2
pm_nl_set_limits $ns2 0 2
addr_nr_ns2=2 speed=slow \
addr_nr_ns2=2 speed=slow cestab_ns2=3 \
run_tests $ns1 $ns2 dead:beef:1::1
chk_join_nr 2 2 2
chk_cestab_nr $ns2 0
fi

# add multiple addresses IPv6
if reset "add multiple addresses IPv6"; then
pm_nl_set_limits $ns1 0 2
pm_nl_set_limits $ns2 2 2
addr_nr_ns1=2 speed=slow \
addr_nr_ns1=2 speed=slow cestab_ns1=3 \
run_tests $ns1 $ns2 dead:beef:1::1
chk_join_nr 2 2 2
chk_add_nr 2 2
chk_cestab_nr $ns1 0
fi
}

Expand Down

0 comments on commit 35e2c76

Please sign in to comment.