From patchwork Fri Mar 24 17:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 74653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp795050vqo; Fri, 24 Mar 2023 10:29:36 -0700 (PDT) X-Google-Smtp-Source: AKy350ZNuuMXCwE8wSEcVQCK6DW2H2d6a5SUhViIk7rvyUpSPaTaEE0gCGCI9PyapMUd1Fb2j3ag X-Received: by 2002:a62:3807:0:b0:626:2426:e1eb with SMTP id f7-20020a623807000000b006262426e1ebmr3345286pfa.14.1679678976425; Fri, 24 Mar 2023 10:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679678976; cv=none; d=google.com; s=arc-20160816; b=lBWc3HwqxmqOYoAYlRwbtzSqsaIIWB/eR0mMsFudzPThbmwFuTBUVKzunHdZqvo58g fhNGgLw5uxQqbrHEKzrfM1Jl3iHR9Z2Bt6O0vvtuPQhwSE1e5VkDs6pSM30QK5UzxL0+ xJptuJD9BhBVxVVoDUZaRRi4p/s4Ejlr/Q97fDn3xRYZWHAGZ0HWC1kwa28I0ymb6Pc8 /9X5hPa9aUyz4q8lmtDU43jA7RPiYk5u0rAQ+HLP4hkG9l2sfqn90RozCmtWKvKGvBlp xX5l31v3UZMMdmqxg0g+Vh0uas1GKhHScoTWgIyFd+olwsRwndeT101QM2G1VAAht0s0 mUvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=VW3IChK5d/LMd19IisgoH//5UFlp1VHM94HpnaBU+Yc=; b=iEVjsFLjYN6mBDUAqA1bWNpC3tlSDJ1Zd0RnfEnqQb1N8jOwv5qt6OASySC2mKnqCq EUCoayOHyXVd9GVIonst9jgoKpg/O32KjMxQt49CMRDu3/Zzh/SMxpN9lWIY27The7/a G0rvRGjMN3CI3ubDKBaNigy/ae5xCYvsX3JmUC1jLkrhLx8wEIK9gPxw+XUmI3BJemmz BHrm/KIOWHHjcGficpocSSRZUKBM+BLLE60H9JdxHs9MESuS6hLOkW41GvOm6l7F03Tm 7BwKNuVUWHiNQ0gZWVpml70SF6bs0DjO5Xr1d6SkuvaiSA1COlNWYlX0+sHz3PFHaZyZ istA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b="o/wu2Jp3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r17-20020a056a00217100b0060102d22785si20120113pff.283.2023.03.24.10.29.24; Fri, 24 Mar 2023 10:29:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b="o/wu2Jp3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232126AbjCXRMV (ORCPT + 99 others); Fri, 24 Mar 2023 13:12:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbjCXRMJ (ORCPT ); Fri, 24 Mar 2023 13:12:09 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CAD021950 for ; Fri, 24 Mar 2023 10:12:07 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso3632088wmb.0 for ; Fri, 24 Mar 2023 10:12:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679677925; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VW3IChK5d/LMd19IisgoH//5UFlp1VHM94HpnaBU+Yc=; b=o/wu2Jp3AliRkeMPA3jrM6zYirVq78icMef0YJjAEAOIjono/Q1XQsI5GyyrPoG4Mn /zplq16SxtbGB00v1S0EpbjE6TuahnUvhbFvBEzK7EOEtFxWBCiB0ZM/SjFdOLZb7+L0 fGXj2wQ3OoheKWQEOdTU3hWsrjGx3ffbfyJyRQk2b1QoJHXgACaWbJmzE+Um0J6PVQec m+XE4Urk/DSEjihv4hwjNOrwe5HYdSicRPPGqjP5fEiG8+dFtJfuST6Ju64clJeaPDj6 1cAOw6vCNCxNd6KrMhGwSUGW04FVB6FsUkx0rk8h5F1fMJSjiTvNIl9WKAXRrzzBpFS0 x9Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679677925; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VW3IChK5d/LMd19IisgoH//5UFlp1VHM94HpnaBU+Yc=; b=j08CVShsMeavMweG5Vt9/JBZ9lRcOMcIEkaf7jziBHHh0O4xYseHyWSrFLXE1lgl3r 3BqiaVWxrlGp3a/5BVLnIRlx240I4zBK5IVHiDQOyhFH+kgPGMwBIaLT/BR2Seqxwd6p mbt/tpYM6s5bcKjybXMELHQYjKlLa4cpgigP/su98x+dtOUyPL7FeyZO8qOytez1N/AY NzUKM23XBvYE/thRQgfiyjgSQi3B6PL897Fuo6TKvq8Q1zF6yhg+JXbCFLDSRIMDO8X2 EC0oSz74ewdqxInVtFT6IGIFMgluTvpOrdQPgnw+7MD6guX6IXOHzGZYiq9Jv5VX6hlq 5TAA== X-Gm-Message-State: AO0yUKVNM4mUmA5nXbJwINCvDs5N3LfSLyEUagLvxGfTy+OzrE9Vpv2G 8jQEBlULxd1SUKOQdOAF1EcDeQ== X-Received: by 2002:a7b:cb92:0:b0:3ed:88f5:160a with SMTP id m18-20020a7bcb92000000b003ed88f5160amr2989596wmi.11.1679677925645; Fri, 24 Mar 2023 10:12:05 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id n17-20020a1c7211000000b003edf2dc7ca3sm5336285wmc.34.2023.03.24.10.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 10:12:05 -0700 (PDT) From: Matthieu Baerts Date: Fri, 24 Mar 2023 18:11:33 +0100 Subject: [PATCH net-next 4/4] selftests: mptcp: add mptcp_info tests MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v1-4-5a29154592bd@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v1-0-5a29154592bd@tessares.net> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matthieu Baerts , Geliang Tang X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2389; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=QeiNRTK3EtggzUHbWnfSGf4g3uU4Ocezndf67d7El5Q=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkHdnhcKy+LEHHWVyW1OaYzW6ZE+zvu5rKivgtO i0d5UuW2PuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZB3Z4QAKCRD2t4JPQmmg cyO4D/0RGtWOVhnnPQw0U6tE5JDXBeBt38aOFdVXXGVKAaMChT/ipA+MJbbPLyLu55o1ZdX2YKm rLWSbnRvM8yU7ghzyEpHXk2tbX8LQYKw1p7ouIavViGk3Ocf0Y27jHIiHL9T+N5QHglV0nEfof/ gR4yEYzo1Mp+V+Ci6ZVERiNRcPHfQ5sLf20NmRFuE5C20uI7RjoJQXE0oudnQHsLfeiSOhum0mr vbYcyou76rwW9PBaxETfRp7Mkm5rYJDG+v47PTNqM0u4YLgQZ6IiZmsjxEeKmosXYZHoTSsVTgF 9AEX7ELhm1ZkwSrQNAhkuF60MQunJji7lTNqgqPPE9Zp597vtRJu+imWBIJ9ufTodR/tz99OeOx 1AfHatFbnhs+/6kWxJZbCq8wqsnDWX+0Pn0ek13120mQi3xxzBViF7jpFNpgHMteasE2Mk43kr2 AciC8ehADjSHMKYCYgXPbxshPleFBHhGaD3L0lL2Laavb1P9hKlga1HjVW2GcKreG/EvNF9m3WB R94iWn3cOSnIhguBkrICbDQbiNzjfYBuOK3ub/dHr8ZKlz6ak31vrkRiYXRiAA5Uc53gybtFuJl GcTOKQR2d4Kh4OpVsFDd2G7Hn1B9uGwsUuY4JKXAJ4w0lbshwNSd//jnoM2K1quptCELI4w8KhV Fm+mtOuhlL84RMw== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761271062362328617?= X-GMAIL-MSGID: =?utf-8?q?1761271062362328617?= From: Geliang Tang This patch adds the mptcp_info fields tests in endpoint_tests(). Add a new function chk_mptcp_info() to check the given number of the given mptcp_info field. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/330 Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 47 ++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 42e3bd1a05f5..fafd19ec7e1f 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1719,6 +1719,46 @@ chk_subflow_nr() fi } +chk_mptcp_info() +{ + local nr_info=$1 + local info + local cnt1 + local cnt2 + local dump_stats + + if [[ $nr_info = "subflows_"* ]]; then + info="subflows" + nr_info=${nr_info:9} + else + echo "[fail] unsupported argument: $nr_info" + fail_test + return 1 + fi + + printf "%-${nr_blank}s %-30s" " " "mptcp_info $info=$nr_info" + + cnt1=$(ss -N $ns1 -inmHM | grep "$info:" | + sed -n 's/.*\('"$info"':\)\([[:digit:]]*\).*$/\2/p;q') + [ -z "$cnt1" ] && cnt1=0 + cnt2=$(ss -N $ns2 -inmHM | grep "$info:" | + sed -n 's/.*\('"$info"':\)\([[:digit:]]*\).*$/\2/p;q') + [ -z "$cnt2" ] && cnt2=0 + if [ "$cnt1" != "$nr_info" ] || [ "$cnt2" != "$nr_info" ]; then + echo "[fail] got $cnt1:$cnt2 $info expected $nr_info" + fail_test + dump_stats=1 + else + echo "[ ok ]" + fi + + if [ "$dump_stats" = 1 ]; then + ss -N $ns1 -inmHM + ss -N $ns2 -inmHM + dump_stats + fi +} + chk_link_usage() { local ns=$1 @@ -3118,13 +3158,18 @@ endpoint_tests() run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null & wait_mpj $ns2 + chk_subflow_nr needtitle "before delete" 2 + chk_mptcp_info subflows_1 + pm_nl_del_endpoint $ns2 2 10.0.2.2 sleep 0.5 - chk_subflow_nr needtitle "after delete" 1 + chk_subflow_nr "" "after delete" 1 + chk_mptcp_info subflows_0 pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow wait_mpj $ns2 chk_subflow_nr "" "after re-add" 2 + chk_mptcp_info subflows_1 kill_tests_wait fi }