From patchwork Mon Mar 27 10:22:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 75337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1403559vqo; Mon, 27 Mar 2023 03:28:47 -0700 (PDT) X-Google-Smtp-Source: AKy350aV+dU4DFwGMOMfWYTMkpEc5QdHlI3G2ho9V+j9SmrR9K7d8peJDh44glbPxanna4P74UvK X-Received: by 2002:a17:90a:e7cf:b0:23e:f855:79ed with SMTP id kb15-20020a17090ae7cf00b0023ef85579edmr11907316pjb.28.1679912927425; Mon, 27 Mar 2023 03:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679912927; cv=none; d=google.com; s=arc-20160816; b=Q3h4U5gmUlDPE/gVZiTZJ4Y4lmsCguAaiK4eHzaHRUw8aYelkhDsSsxEL0MZedmzKI yJj8ZUPxnk7VBrgFmFrLTJKcCCf3SiNZzz5YlHJRitkaDR3vSNXw5pJqXjb+xr6D67M+ cHjqXhMUHxH3dx3PeH2uXFG7Gv0l/ixURYpQd2+J9L3NLdwmheqhYLidTHraW65IOqif pVWZ3A23CYe52jKnOqyrAx376xrTS4xghh7xOQg8vOmy+3NZySEw1/1+ROzTNc6AjYUs NeOFi0anH9bToFrlZwJAfm4/zdF19WOwsPre6tc31lEf0izdNyQ4lSH1jpv1XGcwOLAw HXHQ== 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=Ay2vCNnTP4Qb5OEzh3s+tDDICXuornXYqSaVadHOyHyb84P5EPmSt88sprufD/iNuP QRHppfOuEi7J/sGAaw0oypkjOJAyvRtu6m9GiYEEqMrHruRqwcScIFbC63kklXxtNxzv 3N+aZqbwv8WvYwdjuk9KyXLA54lGPwfQxBtu7pzARSMuIswx7H50e5eSIkR6YpAekvop npqvpOqUpMOGGhVtBeC1pSuU05sMg280gCN2zdCPYziCafZ9U81iXajEn/0dZ/8lkRjG lhNHiaJ0RCXJc6PORTMrLNJo5frgmnxorP3kzWl0+Q+5Gt9IKJdKrEwbkdTLzN0QTvA9 k8fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=MHjCaeve; 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 c12-20020a17090a8d0c00b00233ebd4c537si10456651pjo.22.2023.03.27.03.28.34; Mon, 27 Mar 2023 03:28:47 -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=MHjCaeve; 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 S233693AbjC0KYq (ORCPT + 99 others); Mon, 27 Mar 2023 06:24:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233527AbjC0KYY (ORCPT ); Mon, 27 Mar 2023 06:24:24 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 156C4618D for ; Mon, 27 Mar 2023 03:24:18 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id m2so8169449wrh.6 for ; Mon, 27 Mar 2023 03:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1679912657; 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=MHjCaeveR0nLvCez0W14hOk+lY88zGiY+MtGz7b37omDe49MRW//+Jh3ZX+LhPr0xf s38b+FeFevyydUSnJvBS9fnLrUofHcA8omadWCa31JPR4lCjzeWL3pNqmKUsXy9FpY7f PGBtJm4HVfSgIIp434awf4kpHGCJqZBQY9EvwL/CwRAx8eG3EuiXslx/hutQmuJXwveP /tzIs6Neyad/ysb/ObQKKswcmV5A3bzkqXKVmGuAlUopwt258xASbe5muXa9NQTtarM8 LUyTmSjnRR645SKYQIIZC4garvFLy4rbiZYzDpVHd+/SeCbHXuN9YSRz5oJT8rpG7UfO nxyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679912657; 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=eJ7R8Yd1uYr3yiBnME8HkyDDtJK7EjR3093CNN8gnJaOAuL0lpU09X+F3F7rJsKH/g KSS9AAjyTEwfMrlzJK0FM71pn2ju4L7j0T5cVg2S0n9VdC1dVMgXawO0rSIBb06dM/7K 2SqySdcQHw5Ked2iV1Hq4UcUOqSetxUqpkQ1Y507BzSbePG17ooV21VNIcDfqtm4IwUR dEEnSP3sHzeFNhsQ5VesC7hx89xrIrkQV0xkJZ/Bw/UOwXDQbckmJiQIC+kq4Rr4wkOj iSXw0dxO3N0RRwkEt1P7aTWZiKDlXm3e3WcYzUtY7DfwBk/1Q37mySyRmsbKXTo5bbL9 5/qQ== X-Gm-Message-State: AAQBX9dpohaIcDVoRJk/bhT3SITjK9KiwzV24U0LQHxQpZeWjm7W685N heZPwGjDeHiL+F5QDmcKJltHEw== X-Received: by 2002:a5d:420d:0:b0:2cf:d25a:635b with SMTP id n13-20020a5d420d000000b002cfd25a635bmr8804536wrq.62.1679912657412; Mon, 27 Mar 2023 03:24:17 -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 p5-20020a05600c358500b003ef6f87118dsm2220615wmq.42.2023.03.27.03.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 03:24:17 -0700 (PDT) From: Matthieu Baerts Date: Mon, 27 Mar 2023 12:22:24 +0200 Subject: [PATCH net-next v2 4/4] selftests: mptcp: add mptcp_info tests MIME-Version: 1.0 Message-Id: <20230324-upstream-net-next-20230324-misc-features-v2-4-fca1471efbaa@tessares.net> References: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@tessares.net> In-Reply-To: <20230324-upstream-net-next-20230324-misc-features-v2-0-fca1471efbaa@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/ZANAwAIAfa3gk9CaaBzAcsmYgBkIW7NXKdb4dxMlhzSbDAHfngN3I6Tno49jBB1w 9wkpMWGEhGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZCFuzQAKCRD2t4JPQmmg c92dD/4zNxMiqdjA6KqIPL1tAFlRl6VCTI2idiN6Z8PkYq3y0q07BFbQ3otEDtfcVqcWc3C5r8V BOn2ssLS34vGjWxMofBz3E4L7CmUpgVBPuaLKHq0S8w/cM0nBuvCsqoyDM8XaHvGqlyYEIdkhcq FkjwM4Ut40WYZbZfeeMPtR9AzYSVwHrTIj0a9U++UV3Bw51bOVI3T3KqctrGf+YNEL//byka15o h+eSU4pZ5dZcWj/ohiSaBKZ7bmKaGBoE2ttG/Dp5NQftUakEdWEVy4jNumKOSIVjBx+TWbGeicU ObkYtZF+OxWdfCuPjc5vNJIkzBh5vmziu89eiEclc7l17/2bacpfVX0he1F7l7jfx8heml1bMbJ KcFhuB2CbjK4btrsgRaWWD1gCcof6AvTBSoE5cIMIrH2RWo9aNZJ2XL+KAg+5XCOopi0CNniWdG 1bjehBk62nXEKfp5jMsK6qH777uJPKRQs6M575gSI1Fd9ZBV6VC+UWGaZ99b5dztnzIHZd+YS3t 5mtb/xFZ/mm0LA7hLqpHCNiyFUIf0A9NvspXvQ3jEpCYG1vSkcb3mKA6YbFi3bXxjUJVeOW5ZJD t9Fp+30MyxxZeJ+AaVHnhWfrFJhRTATxYf7ZDPxB+oPBVluRzNl40Bbs+ajQ4A95dszExXBfj5J /5v6Gn9hz8U7XFQ== 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?1761516378104417921?= X-GMAIL-MSGID: =?utf-8?q?1761516378104417921?= 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 }