Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: 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.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/571
Signed-off-by: Gang Yan <yangang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20250902-net-next-mptcp-misc-feat-6-18-v2-2-fa02bb3188b1@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Gang Yan and committed by
Jakub Kicinski
3fff72f8 2d5be562

+123
+123
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 74 74 unset join_bind_err 75 75 unset join_connect_err 76 76 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 + 77 88 # generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || 78 89 # (ip6 && (ip6[74] & 0xf0) == 0x30)'" 79 90 CBPF_MPTCP_SUBOPTION_ADD_ADDR="14, ··· 1410 1399 print_results "join Tx" ${rc} 1411 1400 } 1412 1401 1402 + chk_fallback_nr() 1403 + { 1404 + local infinite_map_tx=${fb_infinite_map_tx:-0} 1405 + local dss_corruption=${fb_dss_corruption:-0} 1406 + local simult_conn=${fb_simult_conn:-0} 1407 + local mpc_passive=${fb_mpc_passive:-0} 1408 + local mpc_active=${fb_mpc_active:-0} 1409 + local mpc_data=${fb_mpc_data:-0} 1410 + local md5_sig=${fb_md5_sig:-0} 1411 + local dss=${fb_dss:-0} 1412 + local rc=${KSFT_PASS} 1413 + local ns=$1 1414 + local count 1415 + 1416 + count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtInfiniteMapTx") 1417 + if [ -z "$count" ]; then 1418 + rc=${KSFT_SKIP} 1419 + elif [ "$count" != "$infinite_map_tx" ]; then 1420 + rc=${KSFT_FAIL} 1421 + print_check "$ns infinite map tx fallback" 1422 + fail_test "got $count infinite map tx fallback[s] in $ns expected $infinite_map_tx" 1423 + fi 1424 + 1425 + count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtDSSCorruptionFallback") 1426 + if [ -z "$count" ]; then 1427 + rc=${KSFT_SKIP} 1428 + elif [ "$count" != "$dss_corruption" ]; then 1429 + rc=${KSFT_FAIL} 1430 + print_check "$ns dss corruption fallback" 1431 + fail_test "got $count dss corruption fallback[s] in $ns expected $dss_corruption" 1432 + fi 1433 + 1434 + count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtSimultConnectFallback") 1435 + if [ -z "$count" ]; then 1436 + rc=${KSFT_SKIP} 1437 + elif [ "$count" != "$simult_conn" ]; then 1438 + rc=${KSFT_FAIL} 1439 + print_check "$ns simult conn fallback" 1440 + fail_test "got $count simult conn fallback[s] in $ns expected $simult_conn" 1441 + fi 1442 + 1443 + count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableFallbackACK") 1444 + if [ -z "$count" ]; then 1445 + rc=${KSFT_SKIP} 1446 + elif [ "$count" != "$mpc_passive" ]; then 1447 + rc=${KSFT_FAIL} 1448 + print_check "$ns mpc passive fallback" 1449 + fail_test "got $count mpc passive fallback[s] in $ns expected $mpc_passive" 1450 + fi 1451 + 1452 + count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableFallbackSYNACK") 1453 + if [ -z "$count" ]; then 1454 + rc=${KSFT_SKIP} 1455 + elif [ "$count" != "$mpc_active" ]; then 1456 + rc=${KSFT_FAIL} 1457 + print_check "$ns mpc active fallback" 1458 + fail_test "got $count mpc active fallback[s] in $ns expected $mpc_active" 1459 + fi 1460 + 1461 + count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableDataFallback") 1462 + if [ -z "$count" ]; then 1463 + rc=${KSFT_SKIP} 1464 + elif [ "$count" != "$mpc_data" ]; then 1465 + rc=${KSFT_FAIL} 1466 + print_check "$ns mpc data fallback" 1467 + fail_test "got $count mpc data fallback[s] in $ns expected $mpc_data" 1468 + fi 1469 + 1470 + count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtMD5SigFallback") 1471 + if [ -z "$count" ]; then 1472 + rc=${KSFT_SKIP} 1473 + elif [ "$count" != "$md5_sig" ]; then 1474 + rc=${KSFT_FAIL} 1475 + print_check "$ns MD5 Sig fallback" 1476 + fail_test "got $count MD5 Sig fallback[s] in $ns expected $md5_sig" 1477 + fi 1478 + 1479 + count=$(mptcp_lib_get_counter ${!ns} "MPTcpExtDssFallback") 1480 + if [ -z "$count" ]; then 1481 + rc=${KSFT_SKIP} 1482 + elif [ "$count" != "$dss" ]; then 1483 + rc=${KSFT_FAIL} 1484 + print_check "$ns dss fallback" 1485 + fail_test "got $count dss fallback[s] in $ns expected $dss" 1486 + fi 1487 + 1488 + return $rc 1489 + } 1490 + 1491 + chk_fallback_nr_all() 1492 + { 1493 + local netns=("ns1" "ns2") 1494 + local fb_ns=("fb_ns1" "fb_ns2") 1495 + local rc=${KSFT_PASS} 1496 + 1497 + for i in 0 1; do 1498 + if [ -n "${!fb_ns[i]}" ]; then 1499 + eval "${!fb_ns[i]}" \ 1500 + chk_fallback_nr ${netns[i]} || rc=${?} 1501 + else 1502 + chk_fallback_nr ${netns[i]} || rc=${?} 1503 + fi 1504 + done 1505 + 1506 + if [ "${rc}" != "${KSFT_PASS}" ]; then 1507 + print_results "fallback" ${rc} 1508 + fi 1509 + } 1510 + 1413 1511 chk_join_nr() 1414 1512 { 1415 1513 local syn_nr=$1 ··· 1603 1483 1604 1484 join_syn_tx="${join_syn_tx:-${syn_nr}}" \ 1605 1485 chk_join_tx_nr 1486 + 1487 + chk_fallback_nr_all 1606 1488 1607 1489 if $validate_checksum; then 1608 1490 chk_csum_nr $csum_ns1 $csum_ns2 ··· 3459 3337 join_csum_ns1=+1 join_csum_ns2=+0 \ 3460 3338 join_fail_nr=1 join_rst_nr=0 join_infi_nr=1 \ 3461 3339 join_corrupted_pkts="$(pedit_action_pkts)" \ 3340 + fb_ns1="fb_dss=1" fb_ns2="fb_infinite_map_tx=1" \ 3462 3341 chk_join_nr 0 0 0 3463 3342 chk_fail_nr 1 -1 invert 3464 3343 fi