From nobody Wed Sep 17 18:19:39 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA1222DCF42 for ; Fri, 15 Aug 2025 07:32:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755243130; cv=none; b=RcAvM/ybL7dGfqLnSJtAFk3zUpOT8vqBsG3Fk2WyBrWGVXbB1SJpza62rfrg1/HzZa9ZSLx4tGEXTN7fmoxzi3nEIPjqIHM4L/ajaxU3u9po7AiwbvA98V58qC+PozX/EOkCRiR4DfziUbtTp5m5n74dJX2oOJuRYRs8EGcfo9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755243130; c=relaxed/simple; bh=d1uY3JmgzrFc+A32kT8kA/1FSYMRFLH0wUQih9446tw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TnYLQMcXKduYMKO6djxGYpaydn4IczdNBfaE+gwGCSgqQl1H/0VlYSMXtzaGyqOcSMihh2BbGxAzMzBpX8Rc6oDmrfG+crDDpStLeA8oP+HE2KzXvN13vLKgwGaD0w/XCnaggk8eOcxcL5yTCmmUW1bRQSZ04koYsj/o1APo1Hc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: e9c6003a79a911f0b29709d653e92f7d-20250815 X-CTIC-Tags: HR_CC_AS_FROM, HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_DIGIT_LEN, HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM HR_SJ_PHRASE, HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT HR_TO_NO_NAME, IP_TRUSTED, SRC_TRUSTED, DN_TRUSTED, SA_TRUSTED SA_EXISTED, SN_EXISTED, SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS UD_TRUSTED, CIE_BAD, CIE_GOOD, CIE_GOOD_SPF, GTI_FG_BS GTI_C_CI, GTI_FG_IT, GTI_RG_INFO, GTI_C_BU, AMN_T1 AMN_GOOD, AMN_C_TI, AMN_C_BU, ABX_MISS_RDNS X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:a6c7121b-f0ac-4038-bb9c-b2b859661567,IP:10, URL:0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:20 X-CID-INFO: VERSION:1.1.45,REQID:a6c7121b-f0ac-4038-bb9c-b2b859661567,IP:10,UR L:0,TC:0,Content:0,EDM:25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:20 X-CID-META: VersionHash:6493067,CLOUDID:6e26cadf8c8e3aa56a5ca39bdf4496e4,BulkI D:250815153202H9ZS6XZR,BulkQuantity:0,Recheck:0,SF:17|19|24|44|66|78|102,T C:nil,Content:0|50,EDM:5,IP:-2,URL:1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:n il,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI, TF_CID_SPAM_ULS X-UUID: e9c6003a79a911f0b29709d653e92f7d-20250815 X-User: yangang@kylinos.cn Received: from yangang-thinkpad-t14-gen-1.. [(223.70.159.239)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 38302188; Fri, 15 Aug 2025 15:31:52 +0800 From: Gang Yan To: mptcp@lists.linux.dev Cc: Gang Yan Subject: [PATCH mptcp-next v3] selftests: net: mptcp: add checks for fallback counters Date: Fri, 15 Aug 2025 15:31:40 +0800 Message-ID: <20250815073140.29077-1-yangang@kylinos.cn> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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: https://github.com/multipath-tcp/mptcp_net-next/issues/571 Signed-off-by: Gang Yan ------ 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=20 'chk_fallback_nr', like: "ns2 infinite map tx fallback [IGNO] (flaky) got 1 infinite ma= p 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. =20 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 --- .../testing/selftests/net/mptcp/mptcp_join.sh | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index b8af65373b3a..898779a9af58 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -74,6 +74,17 @@ unset join_create_err unset join_bind_err unset join_connect_err =20 +unset fb_ns1 +unset fb_ns2 +unset fb_infinite_map_tx +unset fb_dss_corruption +unset fb_simult_conn +unset fb_mpc_passive +unset fb_mpc_active +unset fb_mpc_data +unset fb_md5_sig +unset fb_dss + # generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) =3D=3D 0x30) || # (ip6 && (ip6[74] & 0xf0) =3D=3D 0x30)'" CBPF_MPTCP_SUBOPTION_ADD_ADDR=3D"14, @@ -1399,6 +1410,115 @@ chk_join_tx_nr() print_results "join Tx" ${rc} } =20 +chk_fallback_nr() +{ + local infinite_map_tx=3D${fb_infinite_map_tx:-0} + local dss_corruption=3D${fb_dss_corruption:-0} + local simult_conn=3D${fb_simult_conn:-0} + local mpc_passive=3D${fb_mpc_passive:-0} + local mpc_active=3D${fb_mpc_active:-0} + local mpc_data=3D${fb_mpc_data:-0} + local md5_sig=3D${fb_md5_sig:-0} + local dss=3D${fb_dss:-0} + local rc=3D${KSFT_PASS} + local ns=3D$1 + local count + + count=3D$(mptcp_lib_get_counter ${!ns} "MPTcpExtInfiniteMapTx") + if [ -z "$count" ]; then + rc=3D${KSFT_SKIP} + elif [ "$count" !=3D "$infinite_map_tx" ]; then + rc=3D${KSFT_FAIL} + print_check "$ns infinite map tx fallback" + fail_test "got $count infinite map tx fallback[s] in $ns expected $infin= ite_map_tx" + fi + + count=3D$(mptcp_lib_get_counter ${!ns} "MPTcpExtDSSCorruptionFallback") + if [ -z "$count" ]; then + rc=3D${KSFT_SKIP} + elif [ "$count" !=3D "$dss_corruption" ]; then + rc=3D${KSFT_FAIL} + print_check "$ns dss corruption fallback" + fail_test "got $count dss corruption fallback[s] in $ns expected $dss_co= rruption" + fi + + count=3D$(mptcp_lib_get_counter ${!ns} "MPTcpExtSimultConnectFallback") + if [ -z "$count" ]; then + rc=3D${KSFT_SKIP} + elif [ "$count" !=3D "$simult_conn" ]; then + rc=3D${KSFT_FAIL} + print_check "$ns simult conn fallback" + fail_test "got $count simult conn fallback[s] in $ns expected $simult_co= nn" + fi + + count=3D$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableFallbackACK") + if [ -z "$count" ]; then + rc=3D${KSFT_SKIP} + elif [ "$count" !=3D "$mpc_passive" ]; then + rc=3D${KSFT_FAIL} + print_check "$ns mpc passive fallback" + fail_test "got $count mpc passive fallback[s] in $ns expected $mpc_passi= ve" + fi + + count=3D$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableFallbackSYNACK") + if [ -z "$count" ]; then + rc=3D${KSFT_SKIP} + elif [ "$count" !=3D "$mpc_active" ]; then + rc=3D${KSFT_FAIL} + print_check "$ns mpc active fallback" + fail_test "got $count mpc active fallback[s] in $ns expected $mpc_active" + fi + + count=3D$(mptcp_lib_get_counter ${!ns} "MPTcpExtMPCapableDataFallback") + if [ -z "$count" ]; then + rc=3D${KSFT_SKIP} + elif [ "$count" !=3D "$mpc_data" ]; then + rc=3D${KSFT_FAIL} + print_check "$ns mpc data fallback" + fail_test "got $count mpc data fallback[s] in $ns expected $mpc_data" + fi + + count=3D$(mptcp_lib_get_counter ${!ns} "MPTcpExtMD5SigFallback") + if [ -z "$count" ]; then + rc=3D${KSFT_SKIP} + elif [ "$count" !=3D "$md5_sig" ]; then + rc=3D${KSFT_FAIL} + print_check "$ns MD5 Sig fallback" + fail_test "got $count MD5 Sig fallback[s] in $ns expected $MD5_Sig" + fi + + count=3D$(mptcp_lib_get_counter ${!ns} "MPTcpExtDssFallback") + if [ -z "$count" ]; then + rc=3D${KSFT_SKIP} + elif [ "$count" !=3D "$dss" ]; then + rc=3D${KSFT_FAIL} + print_check "$ns dss fallback" + fail_test "got $count dss fallback[s] in $ns expected $dss" + fi + + return $rc +} + +chk_fallback_nr_all() +{ + local netns=3D("ns1" "ns2") + local fb_ns=3D("fb_ns1" "fb_ns2") + local rc=3D${KSFT_PASS} + + for i in 0 1; do + if [ -n "${!fb_ns[i]}" ]; then + eval "${!fb_ns[i]}" \ + chk_fallback_nr ${netns[i]} || rc=3D{?} + else + chk_fallback_nr ${netns[i]} || rc=3D{?} + fi + done + + if [ "$rc" !=3D "${KSFT_PASS}" ]; then + print_results "fallback" $rc + fi +} + chk_join_nr() { local syn_nr=3D$1 @@ -1484,6 +1604,8 @@ chk_join_nr() join_syn_tx=3D"${join_syn_tx:-${syn_nr}}" \ chk_join_tx_nr =20 + chk_fallback_nr_all + if $validate_checksum; then chk_csum_nr $csum_ns1 $csum_ns2 chk_fail_nr $fail_nr $fail_nr @@ -3337,6 +3459,7 @@ fail_tests() join_csum_ns1=3D+1 join_csum_ns2=3D+0 \ join_fail_nr=3D1 join_rst_nr=3D0 join_infi_nr=3D1 \ join_corrupted_pkts=3D"$(pedit_action_pkts)" \ + fb_ns1=3D"fb_dss=3D1" fb_ns2=3D"fb_infinite_map_tx=3D1" \ chk_join_nr 0 0 0 chk_fail_nr 1 -1 invert fi --=20 2.43.0