Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp611173lqp; Fri, 5 Apr 2024 03:53:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX/Qh4/YnSosIv3U/Ns4vtsC0WEJVzyvbQztqTYmhaw7R56n2xnBMHY5R6E1kqIxAbPJn5g8hzTB5MoTyb66tL2slRvjHlx8Qup2JjZrw== X-Google-Smtp-Source: AGHT+IFPaJO6MtWWFdehZJce7k3mUa7iPi42kv4VG4XYAwijJYqFVu3+9fPBcr74+7Pgvv83GLy3 X-Received: by 2002:a17:906:b849:b0:a51:9d90:30d2 with SMTP id ga9-20020a170906b84900b00a519d9030d2mr679524ejb.14.1712314425903; Fri, 05 Apr 2024 03:53:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712314425; cv=pass; d=google.com; s=arc-20160816; b=DW/wBNm9uuopHaUqO/IsvSdcliWZMcDaBaTl8ri6KQM53uYfB5lzE4vFCD3InqtVLE q7+N1NDHuVnUmx8PAA+YJF/h8r7nLcmrYsqoM6FbitF3TdnvN6jaw/5bkZhm/TtrJ8lq OC5+uecrPeckioGgtnahSFU47nMEbQNd8gG6NRrqcyhanxgBEj+/s6JxYwS4ijUqmh0L hGs0ZKmn1UloR9IwnfStwQWv+Twn2Cu7aU1/yk28Kai3rIU2CDesbOVYsH+PaVaWfyKf Hmf8pW2yqW+BMDvdu2yQVxqjyz+SXUZNsIZTiqmBJ0nPJqyVZSsLPWJYKPieiNpnUEum PgaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=cCq/an7fAYIOZPItkrasxQXDf25Yu/BdsWe3yzvxo2Y=; fh=gM1fTaWoK9TL7webZ8yB3tcO8X47vwS7DNlJ3C0B/Lk=; b=ous1jAZU23hs6JT1fyqzWzPsqEX2Kai4OANZ8QvVnaxtfeY9aOxqiZcHQg4Aft3NjX g6EhfUr6UthJ549XjPqfwoUlplRf6Vf1jiTXGNRlUMbcvpILlf3n7z5dTU/d2J8J+W46 sdNaj+MKCAyReQ/bXbnYo/Q9DF2F2tsk5nGTB4BsGrAx5c4BiMOjrbHQZpxUjnw1tNnN Rxhg1pfq1tF8P7sMr9ldwsuXmyY1MywcbFVfU7A/3ar+9ymeT2WP2nCSGtrzWbBAE1bg XHWGt2sJkCS/ljK8qMOBIt+Yo1wIm4EqUS5RX1rlKt8hc6lDFA9pZBvVqNyNCv73XVxS DTAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uGEifxHA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132858-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qb22-20020a1709077e9600b00a517d370610si648721ejc.553.2024.04.05.03.53.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 03:53:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uGEifxHA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132858-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9BD711F217CE for ; Fri, 5 Apr 2024 10:53:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F08416C6B9; Fri, 5 Apr 2024 10:52:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uGEifxHA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9496116C45E; Fri, 5 Apr 2024 10:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314357; cv=none; b=lObTDz195LKNcYP1nNpUlqPhaSxjBCvSvwBrM1FmeX8XPSScNVIApSlltZGTkOX6mLrdUfRG4JtHqTuZqS3LSLzYph5c/gIs9q1hLamsRGslSY4fC3sZEicN9mM3zDR9sWpnMI4MVuQonmItbGXafNT3w6YGlaLrd6H+YxkfpG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314357; c=relaxed/simple; bh=Zhj1r18k/1WzNQKbSHVFV4+dDFsQJw97dLrKAuCxQcs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kU/vBFGeivSsgXurcH7mFfTFJj7beZsduyKON2Dajqljsy4QLGxE0cPcEoeXxJzxOVHuPSf9Aj2xbjwIKu3kMI+h0nx89frIEc+LyivsfX+Wnuxt5YUJIq0EVWvL3qh6ZiEDQBau6VGM4VUXBRrCxyyak5+kE2RXYkjigvnsee0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uGEifxHA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB3BFC433B2; Fri, 5 Apr 2024 10:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712314357; bh=Zhj1r18k/1WzNQKbSHVFV4+dDFsQJw97dLrKAuCxQcs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uGEifxHAYho7zC9y/rSr7+4zoVmHXnX7rUk76uoXWHw6+84TAVe+LnIMK1/IheiLK GqGYPWucYOoWzXrnoq/FTnzntJ3AmPXIDQANolJkWvjOWtqNVDKGqKJd5hiC9VybH+ 3fma8HSPZccOOFsF8dSzeiqnoRvTSaW6JM5uTQoSQqvvOjVzGyeEkLmbP9r8r6NIMf Rl6JwgSzLaWZzUSeCo8ES80HFEN7DyH7HGHn2+4RL+YK0uJfnbSlBcV3zmYfDCHz0T wIkrMB3vvK1kjZ/COjk1NxrmaCHczex7Qfm6pcVxcvLGxw2Ed2k2xWcl/1ncoiRzno YC/5gOeLnIxGw== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Apr 2024 12:52:08 +0200 Subject: [PATCH net-next 04/11] selftests: mptcp: netlink: add 'limits' helpers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-4-eabc9b960966@kernel.org> References: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-0-eabc9b960966@kernel.org> In-Reply-To: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-0-eabc9b960966@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2795; i=matttbe@kernel.org; h=from:subject:message-id; bh=nUEW5uyiDGyAzCFYUDGHkGAM2g15fOz/0B8Lus/cn9E=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmD9flyRr6mFf4wYKjXoutK7x6Byc1bA7LVkW2l ONdB/+Za8+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZg/X5QAKCRD2t4JPQmmg c+/oD/wNMZPAmNxVpI3SinaFWs8k25NUfxPYtTTpZN8gqnHP78AEDSttskqz0fmtAZKJD8siXRA 7H4u0dFlr1f3jk20AozTSbcIa6Ju6jz4SNY0e1QPUSrw75GVuEf6PRYCcYnjYB3lRgwS/Kb4vG1 qGnFIPwW88s/i7hwfjeYmNFA6LcrpBUadOv/DsgMeYnS2XMuBqsQPic05UFTtcUJFvcjdxfWSVH mfbJHAVAgFr9tiQ0WDl6BovHLGi6td2nNChzoIak1jkZ5YkhtXVjh9bWvJAREdDos2GmuwB6mwV 0uLJ66gB37xU05ay+BitKirzI20zQKipaTlt/0iCuYG6U5q5NiKHZugV1LON7KolF/TDYBaAd2I oqP2vU2OrB+u0o0IJQj+hxNp0w86xYwOkCXrLtR5LcHJNkcVZnMAmZTqVtT5DxHndTBzUDF+6pH tcbDjpHKWwdwWy6oaQCU2PUHpjOMZHQ1bsN5fKORrvtNMf27hBgSY3pbtuXOifCllY9ZtWM2KmA /gOvWx/e+3c71Liin9SW/iwxNzDhkPSbz37W9EFVSGWB3D+a3BT+fPH8l7qSEjwOHhqruQjF2dP wmPxSyJcTcfmDP1l0NfxmyvqckfA3CaQ4JH/+pl78tUzdQs9ucad9/sgN3pfpAF4kuBs5Xf2gpv 5S4TgBS6a3si4OA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang The output format of 'ip mptcp limits' command is much different from that of 'pm_nl_ctl limits' command. This patch adds format_limits() helper to format the outputs of these two commands to hide the difference. get_limits() has been added to show the limits. Use these two helpers in pm_netlink.sh to replace all 'pm_nl_ctl limits' commands and outputs. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 32 +++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index 6ab8c5d36340..d672d1e5d470 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -46,6 +46,26 @@ trap cleanup EXIT mptcp_lib_ns_init ns1 +format_limits() { + local accept="${1}" + local subflows="${2}" + + if mptcp_lib_is_ip_mptcp; then + # with a space at the end + printf "add_addr_accepted %d subflows %d \n" "${accept}" "${subflows}" + else + printf "accept %d\nsubflows %d\n" "${accept}" "${subflows}" + fi +} + +get_limits() { + if mptcp_lib_is_ip_mptcp; then + ip -n "${ns1}" mptcp limits + else + ip netns exec "${ns1}" ./pm_nl_ctl limits + fi +} + check() { local cmd="$1" @@ -69,10 +89,9 @@ check() check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "defaults addr list" -default_limits="$(ip netns exec $ns1 ./pm_nl_ctl limits)" +default_limits="$(get_limits)" if mptcp_lib_expect_all_features; then - check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0 -subflows 2" "defaults limits" + check "get_limits" "$(format_limits 0 2)" "defaults limits" fi ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 @@ -120,14 +139,13 @@ ip netns exec $ns1 ./pm_nl_ctl flush check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "flush addrs" ip netns exec $ns1 ./pm_nl_ctl limits 9 1 2>/dev/null -check "ip netns exec $ns1 ./pm_nl_ctl limits" "$default_limits" "rcv addrs above hard limit" +check "get_limits" "${default_limits}" "rcv addrs above hard limit" ip netns exec $ns1 ./pm_nl_ctl limits 1 9 2>/dev/null -check "ip netns exec $ns1 ./pm_nl_ctl limits" "$default_limits" "subflows above hard limit" +check "get_limits" "${default_limits}" "subflows above hard limit" ip netns exec $ns1 ./pm_nl_ctl limits 8 8 -check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 8 -subflows 8" "set limits" +check "get_limits" "$(format_limits 8 8)" "set limits" ip netns exec $ns1 ./pm_nl_ctl flush ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 -- 2.43.0