Skip to content

Commit 393bf9e

Browse files
Dwyane-Yanintel-lab-lkp
authored andcommitted
selftests: net: mptcp: add checks for fallback counters
Recently, some mib counters about fallback has been added, this patch provides a method to check the expected behavior of these mib counters during the test execution. Link: multipath-tcp/mptcp_net-next#571 Signed-off-by: Gang Yan <[email protected]> ------ Changelog: v3: - Squash into a single patch. - Using 'fb_' as a prefix instead of the suffix for variables. - Adjust the order of mib counters to check, ensuring it matches the variable declaration. - The namespace('ns1'/'ns2') is included in the output of 'chk_fallback_nr', like: "ns2 infinite map tx fallback [IGNO] (flaky) got 1 infinite map tx fallback[s] in ns2 expected 0" - Add a new helper named 'chk_fallback_nr_all', which prints only when an error occurs. - Fix some code style issues. v2: - add a helper which can check all the fallback mib counters. - put the 'chk_fallback_nr' in 'chk_join_nr' like chk_join_tx_nr. Notes: Hi Matt, I wanted to apologize for splitting the changes into multiple commits, my intention was to ease the review process, but it unfortunately backfired. Thanks for your valuable suggestions, I've made some improvements based on your feedback. Please take another look at the updated changes. Best regards, Gang
1 parent fb997af commit 393bf9e

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ unset join_create_err
7474
unset join_bind_err
7575
unset join_connect_err
7676

77+
unset fb_ns1
78+
unset fb_ns2
79+
unset fb_infinite_map_tx
80+
unset fb_dss_corruption
81+
unset fb_simult_conn
82+
unset fb_mpc_passive
83+
unset fb_mpc_active
84+
unset fb_mpc_data
85+
unset fb_md5_sig
86+
unset fb_dss
87+
7788
# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
7889
# (ip6 && (ip6[74] & 0xf0) == 0x30)'"
7990
CBPF_MPTCP_SUBOPTION_ADD_ADDR="14,
@@ -1399,6 +1410,115 @@ chk_join_tx_nr()
13991410
print_results "join Tx" ${rc}
14001411
}
14011412

1413+
chk_fallback_nr()
1414+
{
1415+
local infinite_map_tx=${fb_infinite_map_tx:-0}
1416+
local dss_corruption=${fb_dss_corruption:-0}
1417+
local simult_conn=${fb_simult_conn:-0}
1418+
local mpc_passive=${fb_mpc_passive:-0}
1419+
local mpc_active=${fb_mpc_active:-0}
1420+
local mpc_data=${fb_mpc_data:-0}
1421+
local md5_sig=${fb_md5_sig:-0}
1422+
local dss=${fb_dss:-0}
1423+
local rc=${KSFT_PASS}
1424+
local ns=$1
1425+
local count
1426+
1427+
count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtInfiniteMapTx")
1428+
if [ -z "$count" ]; then
1429+
rc=${KSFT_SKIP}
1430+
elif [ "$count" != "$infinite_map_tx" ]; then
1431+
rc=${KSFT_FAIL}
1432+
print_check "$ns infinite map tx fallback"
1433+
fail_test "got $count infinite map tx fallback[s] in $ns expected $infinite_map_tx"
1434+
fi
1435+
1436+
count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtDSSCorruptionFallback")
1437+
if [ -z "$count" ]; then
1438+
rc=${KSFT_SKIP}
1439+
elif [ "$count" != "$dss_corruption" ]; then
1440+
rc=${KSFT_FAIL}
1441+
print_check "$ns dss corruption fallback"
1442+
fail_test "got $count dss corruption fallback[s] in $ns expected $dss_corruption"
1443+
fi
1444+
1445+
count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtSimultConnectFallback")
1446+
if [ -z "$count" ]; then
1447+
rc=${KSFT_SKIP}
1448+
elif [ "$count" != "$simult_conn" ]; then
1449+
rc=${KSFT_FAIL}
1450+
print_check "$ns simult conn fallback"
1451+
fail_test "got $count simult conn fallback[s] in $ns expected $simult_conn"
1452+
fi
1453+
1454+
count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableFallbackACK")
1455+
if [ -z "$count" ]; then
1456+
rc=${KSFT_SKIP}
1457+
elif [ "$count" != "$mpc_passive" ]; then
1458+
rc=${KSFT_FAIL}
1459+
print_check "$ns mpc passive fallback"
1460+
fail_test "got $count mpc passive fallback[s] in $ns expected $mpc_passive"
1461+
fi
1462+
1463+
count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableFallbackSYNACK")
1464+
if [ -z "$count" ]; then
1465+
rc=${KSFT_SKIP}
1466+
elif [ "$count" != "$mpc_active" ]; then
1467+
rc=${KSFT_FAIL}
1468+
print_check "$ns mpc active fallback"
1469+
fail_test "got $count mpc active fallback[s] in $ns expected $mpc_active"
1470+
fi
1471+
1472+
count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableDataFallback")
1473+
if [ -z "$count" ]; then
1474+
rc=${KSFT_SKIP}
1475+
elif [ "$count" != "$mpc_data" ]; then
1476+
rc=${KSFT_FAIL}
1477+
print_check "$ns mpc data fallback"
1478+
fail_test "got $count mpc data fallback[s] in $ns expected $mpc_data"
1479+
fi
1480+
1481+
count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMD5SigFallback")
1482+
if [ -z "$count" ]; then
1483+
rc=${KSFT_SKIP}
1484+
elif [ "$count" != "$md5_sig" ]; then
1485+
rc=${KSFT_FAIL}
1486+
print_check "$ns MD5 Sig fallback"
1487+
fail_test "got $count MD5 Sig fallback[s] in $ns expected $MD5_Sig"
1488+
fi
1489+
1490+
count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtDssFallback")
1491+
if [ -z "$count" ]; then
1492+
rc=${KSFT_SKIP}
1493+
elif [ "$count" != "$dss" ]; then
1494+
rc=${KSFT_FAIL}
1495+
print_check "$ns dss fallback"
1496+
fail_test "got $count dss fallback[s] in $ns expected $dss"
1497+
fi
1498+
1499+
return $rc
1500+
}
1501+
1502+
chk_fallback_nr_all()
1503+
{
1504+
local netns=("ns1" "ns2")
1505+
local fb_ns=("fb_ns1" "fb_ns2")
1506+
local rc=${KSFT_PASS}
1507+
1508+
for i in 0 1; do
1509+
if [ -n "${!fb_ns[i]}" ]; then
1510+
eval "${!fb_ns[i]}" \
1511+
chk_fallback_nr ${netns[i]} || rc={?}
1512+
else
1513+
chk_fallback_nr ${netns[i]} || rc={?}
1514+
fi
1515+
done
1516+
1517+
if [ "$rc" != "${KSFT_PASS}" ]; then
1518+
print_results "fallback" $rc
1519+
fi
1520+
}
1521+
14021522
chk_join_nr()
14031523
{
14041524
local syn_nr=$1
@@ -1484,6 +1604,8 @@ chk_join_nr()
14841604
join_syn_tx="${join_syn_tx:-${syn_nr}}" \
14851605
chk_join_tx_nr
14861606

1607+
chk_fallback_nr_all
1608+
14871609
if $validate_checksum; then
14881610
chk_csum_nr $csum_ns1 $csum_ns2
14891611
chk_fail_nr $fail_nr $fail_nr
@@ -3337,6 +3459,7 @@ fail_tests()
33373459
join_csum_ns1=+1 join_csum_ns2=+0 \
33383460
join_fail_nr=1 join_rst_nr=0 join_infi_nr=1 \
33393461
join_corrupted_pkts="$(pedit_action_pkts)" \
3462+
fb_ns1="fb_dss=1" fb_ns2="fb_infinite_map_tx=1" \
33403463
chk_join_nr 0 0 0
33413464
chk_fail_nr 1 -1 invert
33423465
fi

0 commit comments

Comments
 (0)