From patchwork Fri Apr 5 10:52:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 786615 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 870E416ABC8; Fri, 5 Apr 2024 10:52:31 +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=1712314351; cv=none; b=XKCX3V05ff6CBmm0MyaAq5zHKWE2gOZO6Y6P4ASq6BPzkQFGRGF79Do0nrfHKfNOAzb4+6Ia2txbrL5B/5gOr5L9h3/milQxT1lDdhwkOSD5IdzoBiu3uazO1vC53HTMtTxoOkFxkaKP/dg9iJIsqANkwpv6c1m03gYaVfHat+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314351; c=relaxed/simple; bh=v2tpouPNyjZ1b8U4PDYegy9K1DvLXeUhvyBIxPTZtjc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eozTqajKvlBnnMH4wXbBu6SWpLSOjHrqXFrhNzsLs/f0F072lx0+UPxaZAEhRxR4lYR+OzybnA0iR9NRn/jVMhN/rv4gEs997AvaigI/8xMW044pns3O5iNKNk/HyHd6KHlzOaBs921OsloLvAVFurqX5pMYFaX3QAnT0yTeR04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K5xvw+K+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K5xvw+K+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9ED1C43399; Fri, 5 Apr 2024 10:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712314351; bh=v2tpouPNyjZ1b8U4PDYegy9K1DvLXeUhvyBIxPTZtjc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=K5xvw+K+vFNxbn/7hr+3V0jLqG71tLIsQTp8a+BBGP4PNZKO+VnrRwf6T72T6UklM iZCjezmPJMJ+x6FHoS/WPUXKE2wZHNAQMn3Dm5ZjpDeNXMSblpdeHo3XJJdUrIv9Oe IKfMVq17Bn2023BtDrvU3ziyTUljbuVpvC5OdePoR2lWml3QXEHMP93QUX21mS+Hq0 k86+hrnFyBQCKqXRcio43EO09cKf+G/X/05bEhYDmbt70Vg5g83b9FqeIobaPPR/UZ CA53yZDCdqoWKEfv6biKZmqRWuy4M5avbOjjY2DgtRNIlM9Z8d+dYIm7ugXgjSRIkQ 9yAVxwCfYk8lA== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Apr 2024 12:52:06 +0200 Subject: [PATCH net-next 02/11] selftests: mptcp: add ms units for tc-netem delay Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-2-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=2219; i=matttbe@kernel.org; h=from:subject:message-id; bh=IB5nicQTGbW0wPqnxC6mBPr/+Em2SJVyWc/UESeeex4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmD9flQUJwVIqulu5DfBX+mevThsUesOltYArXS /+54t/PaWeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZg/X5QAKCRD2t4JPQmmg cwfGD/wLc/g3nigR/s+Sqt83I+ZbVaJHIaAfJPaF7Xitbl5ZwxPkKZc48deHnCg4ZNxPr+MLJ1u Lb4olbkYfdFr9TvGBW++zhK7hoZPJiCJIL2NyG6dAJ8aYKTvexeRCXnBrOhuX+UEFg5ppxlYcW4 AS7K1utsBWdppVSHn4vOy5JgauieUHnxPj4Mpfs9Q0vDuL2bBD1F7mZTJxCq97GoSxhq1NPcxHP faISwUY+q3+RW5E5SB9poNku0BS1rioJfi4FZWyzat0++WB7Yp4Pnha1BVhVkd5o4+lDkcaTX69 7qrFMJAqn1wDjKdO0Sdw3Bcp20Zu19kuqRZxfUKnqgjQq868VIqbs/YbK1i0kW07rQNtAe+jJWQ FgMuJiF/rqGrT9ZczB10CdKAyAUrNbnnFywhrPIB5tOOtOombf43zLn4IZ8uU6Tpje9MWN6meSP AibBaPIToq75LVs4uQDuB3q06VUvz470vtBSMmjPOSRDHhPbL6fyF0vr5AvNeuzf5ZG13oJTAlF nlOM0YTfS3hR319V3Ig5u3zI1mnjMFJeW1gv+sXqeP49rbbxNVg+ZjZ5QutBQ+XI87+lVpaOmNq WP/ISGLHZAnWFw4ZgkonNN2MXDMbvJ0ONWVun8i7Omd4aL+Ap8z20uzO2oKGED2rtWyvSNnvhwV DuJumWowvezilBw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang 'delay 1' in tc-netem is confusing, not sure if it's a delay of 1 second or 1 millisecond. This patch explicitly adds millisecond units to make these commands clearer. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 6 +++--- tools/testing/selftests/net/mptcp/simult_flows.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 5a95798eb40a..73a2131e6da2 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -125,8 +125,8 @@ init_shapers() { local i for i in $(seq 1 4); do - tc -n $ns1 qdisc add dev ns1eth$i root netem rate 20mbit delay 1 - tc -n $ns2 qdisc add dev ns2eth$i root netem rate 20mbit delay 1 + tc -n $ns1 qdisc add dev ns1eth$i root netem rate 20mbit delay 1ms + tc -n $ns2 qdisc add dev ns2eth$i root netem rate 20mbit delay 1ms done } @@ -3212,7 +3212,7 @@ fail_tests() # multiple subflows if reset_with_fail "MP_FAIL MP_RST" 2; then - tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5 + tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5ms pm_nl_set_limits $ns1 0 1 pm_nl_set_limits $ns2 0 1 pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index 497141c49ccd..4e6d8fc56b38 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -216,8 +216,8 @@ run_test() shift 4 local msg=$* - [ $delay1 -gt 0 ] && delay1="delay $delay1" || delay1="" - [ $delay2 -gt 0 ] && delay2="delay $delay2" || delay2="" + [ $delay1 -gt 0 ] && delay1="delay ${delay1}ms" || delay1="" + [ $delay2 -gt 0 ] && delay2="delay ${delay2}ms" || delay2="" for dev in ns1eth1 ns1eth2; do tc -n $ns1 qdisc del dev $dev root >/dev/null 2>&1 From patchwork Fri Apr 5 10:52:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 786614 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uGEifxHA" 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-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 From patchwork Fri Apr 5 10:52:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 786613 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 201B416C865; Fri, 5 Apr 2024 10:52:43 +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=1712314364; cv=none; b=Ki2NUq/zpvOLYuxGaFTQknYRNKIvuiFppCBTIcMNLOOGmh80BRI5pOPwfsPBUwf/G/dRadJL1wK/Z9gHcafW82eNJgJ1ViNrmDdqNgsRl0of36qKCuBr11yE8S/YErTcFxOJ3M9q/Us6s5fbSnT3pkvSo9iYNB6GoPR++kuRl0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314364; c=relaxed/simple; bh=WdRiy6HK/oka5IiC6YkmLJw1/RyysTXM95OHJrdHMHw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Pr6oTlCHsRGS7mwkUsPlv/52oRHtApcqIdyeqVBddchuH9HK6A6tZCeyezRWmowPJjSfXVcPYGPJtwF5JS84jKYNdJT7Cjq4Bnt9exa//bdFUOTWdvVjMo+lxL18pp9TAjXbxu81QNLJx3DfEuIsaYPViXHJtKbPKMFvsffy7tQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ttm1skQA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ttm1skQA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03ABBC43390; Fri, 5 Apr 2024 10:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712314363; bh=WdRiy6HK/oka5IiC6YkmLJw1/RyysTXM95OHJrdHMHw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ttm1skQAhOeN/jOxF3z13kalmZf65wwd8fD23T0kY/2hGIDZdn9RWbW+mlDl8BVB2 RDh+16IM5qMRaOqo4kGDvT6fOq55g9Rd+FYOHaYL0yTysoHLytOzzRELcsK/sUkmEN s0suzYg5xru+DAK5W7BUamqBOBdIGO0D11Y8/YqYsdRerBaf//WKUmXjmZkfGeRoVl W/2McxGcJmIDsG2/8uFWPHaWxdwGomNyouwqa+gFVyjUOqdL684h2lRN5OcKY7ZxG8 7pwe5LGN/ftOzaJdXkiHO0KZwealT8vO3f3q8WQ7n3FkN2acXY0UUWfudqri9g5Vc/ 6zb3EaaQ+aIUA== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Apr 2024 12:52:10 +0200 Subject: [PATCH net-next 06/11] selftests: mptcp: netlink: add change_address helper Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-6-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=1997; i=matttbe@kernel.org; h=from:subject:message-id; bh=1mO+KsbMEu53NeIIzW9cMyK5QgtJ/nYDKgdCteaDqIc=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmD9flBcijNdTb8U2ePotkbk8EWMG/mdX2wLjCN E3MPfzHMp2JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZg/X5QAKCRD2t4JPQmmg c+6QEACHNR6j8Bnqk6AT+Ua14XQ3QHNh+nxNgBPwib5ZUcNUL5e/XPvl2hu7Yl+d9Uh3OlgNpag /y9haF+/CG+cna/LD/qYIDlW9kA29VfURIg+2AT2czHx8H8vY/vrNS1qD9KczSN7/hwmZTqZCPI Be+5rPFtGl82uiPBTmKN5akOZRTrCIr8sES2Hy6ptcX0Z5PwLIEpYSaDf1Zakgf/O5Bxi5rDPAP LH/J9jxO2KN4/TJAfmSPdHsJYofK1jfBSinb/FngvF5spnNbE5b4XEeCMEeVnRyGCppzBaCChCo IpQ5dax6rtMuu/n9Z5aty8LOy1qtc0BZbbl+G8gxaUcwyNBoJnnMTM0zFFsc66WL/t7HUc8U31P i2WvkkslSqZQfGOcbZvSkGgqoRhy0R3ahdAVFq/tqwIWFTT0fMisJb+XJzbUrf/ArCICg8qY9ih A1yb9SFQ6asldYX/w5WICPEG5SRpG82OATkzsOqUFiD5esd0280p0cB4FWDXUIi7Vrs4XQdzzb8 JYxVhy1RvIkxxRl4/SxQG1YdzWyXptjgMqQG7q8vAW8YsdGUGZDbwy26KNdlw1WkZiLPi2An0cE E1kHGWQAu6rFbrF31xwQwiL2lm3g5MWUpAufUT3wQlYjfyKd7BxF7xlzTLeNFUs4B7Y5AgFloKv ONxtboAKXPsXe+g== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang The output formats of 'ip mptcp' commands are much different from that of 'pm_nl_ctl' commands. A new 'change_address' helper is added here, to change the flag of an address. This is a bit similar to mptcp_join.sh's pm_nl_change_endpoint(). Usage: Address ID - pm_nl_change_endpoint $ns id $id $flags IP address - change_address $ns $addr $flags Use this new helper in pm_netlink.sh to replace all 'pm_nl_ctl set' commands. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index 234b88eba0cb..e27a731bd765 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -75,6 +75,17 @@ get_endpoint() { mptcp_lib_pm_nl_get_endpoint "${ns1}" "${@}" } +change_address() { + local addr=${1} + local flags=${2} + + if mptcp_lib_is_ip_mptcp; then + ip -n "${ns1}" mptcp endpoint change "${addr}" "${flags}" + else + ip netns exec "${ns1}" ./pm_nl_ctl set "${addr}" flags "${flags}" + fi +} + check() { local cmd="$1" @@ -197,10 +208,10 @@ check "ip netns exec $ns1 ./pm_nl_ctl dump" \ ip netns exec $ns1 ./pm_nl_ctl flush ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1 flags subflow -ip netns exec $ns1 ./pm_nl_ctl set 10.0.1.1 flags backup +change_address 10.0.1.1 backup check "ip netns exec $ns1 ./pm_nl_ctl dump" "$(format_endpoints "1,10.0.1.1,subflow backup")" \ "set flags (backup)" -ip netns exec $ns1 ./pm_nl_ctl set 10.0.1.1 flags nobackup +change_address 10.0.1.1 nobackup check "ip netns exec $ns1 ./pm_nl_ctl dump" "$(format_endpoints "1,10.0.1.1,subflow")" \ " (nobackup)" From patchwork Fri Apr 5 10:52:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 786612 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 CD75E16D33B; Fri, 5 Apr 2024 10:52:49 +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=1712314369; cv=none; b=kI+YWkQtCOfg8kEeGZYBiX0+pBHa7uL4uwOzGt9ekT/n/JWgJNKZbAFLTXgOtdpHcjEZMkTfy3CowQhVd81Yc2Qg1Wvwmhg2pKph0NvuqcFmxQHKllWfSECK8XDR9lLn74zlnxqUasPmn9fX4FBqstVLI1FOPlg1NLP85f7XCvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314369; c=relaxed/simple; bh=waK6o7NL+X08D46c1Uzh5uW3FEozqw+q+E4Twh8dDSI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pb6mks1r/NGWRW0NbMzPoIwWAQw8MXu0ifVAxGW4q1UQarzd9QExUM55ilGDgMDW/EXef1oPCHjAu5/jYsZtbmH4+18eD6uH6hWbgsDAlZ/9INOICK6cBtf1AjvZSDFV7033mPmB+1sChOyBm7I7vdLfJwN4+4CwYnuQF+J8tKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=npvk0vb9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="npvk0vb9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B4B9C43390; Fri, 5 Apr 2024 10:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712314369; bh=waK6o7NL+X08D46c1Uzh5uW3FEozqw+q+E4Twh8dDSI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=npvk0vb9UoDYGxAQ3aOuBq2cUowzjsvcB/6AvBie3DZjG5sxqw2BfelpwQcL9+3dL fwMQy7DINIM3SL8t1JhA9gl7yA0GqF1auOhRWUK/I+ToH5LDtBKbukyR9JfKHhZhEw fmtnQVMMXSPq3vqaT7T8V3yhTidy+nflxNqhzwEZVTsAwXx9f7SXlowNpyieeOk0J8 VEC+7dc9vjeKCn+xwTdTRB9ixQnooWwFpf3JS14C7FWprVkQ9uXesLr04maTen0sQ6 zLICxm0GOfcrH5J2wiEyYfr64HzW95O/QQ3dCLEVyYqChEtpyybn/tvz7XB20zgMtN +Ydu8pOKvHyUw== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Apr 2024 12:52:12 +0200 Subject: [PATCH net-next 08/11] selftests: mptcp: export pm_nl endpoint ops Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-8-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=5563; i=matttbe@kernel.org; h=from:subject:message-id; bh=UCh5fgsZwb/jdM6yFmZ+1A0KHly8AqybefNoJ/KitEk=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmD9flQu7izI5fWE0dAqPTFv1BYwRr5MSe9O0Kf JJz3rTg+nuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZg/X5QAKCRD2t4JPQmmg c2pjD/406w+NcOUr+QjJsiEj3R8zHXm6nmMPvtXeG2XMPsg+BOtAsMpeGWDGTWvBKZzcRe2w/hZ oVtUG7dcsRkNNDwwVZKNReshUnc6AlMk5VbX5l51Sk1Y4fJFA4QR55eNOUFqudgcbdy5d9mVAwB f8pAGmKrieyxBxFKHK5ZGFRy3aZwxQsuj6yw7oCN5eRC6gp/RbgJ52vzQaIbPnbn550aLW6v3Tv gBs4/ZcfU8ccy+W2N1ojw5OfIbHmWqCUw885c9pxweayhvRApomn9WCjdlX8wM1DSc6vWg1CTIs QC1W8uXBiy7uC/ZLSHEYGdLaBYYh2aOhsOb3xjfmUtN+Ww7FIQYvneSN4wv8qO797UtYXqI7UdR qGY2ahsf0IUYTAYdlgD0TMt+FmoZSBvdwZisekkvloyfTJDgsE98ZMGHtqjg5Tekh3gA6mwxt0g mLi4AIDuCCxpS7NFQPHY0r8vcM7su/yC4fCSQKSKGuyoQufGQIu3mVcJBCKhBY1vd8NfnTkXoej WTuNnlRor0f83RMOXEoxv+0eD2lZmlQ1digA1bBi4eyZ5mBpiunH1i0sFI0geEbmwvJCjEetyjm POjNO6tPchki6IzUfVrKC6ma+cQKxIMubc7ETTP/jLXjxcWbflIMxn9IPGAZcT7rY/ZEww31ZAo xrIBTGWvgyE7z4Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang This patch exports six endpoint operation helpers with pm_nl_ prefix, pm_nl_set_limits(), pm_nl_add_endpoint(), pm_nl_del_endpoint(), pm_nl_flush_endpoint(), pm_nl_show_endpoints() and pm_nl_change_endpoint() into mptcp_lib.sh as public functions, and renamed each of them with a mptcp_lib_ prefix. Then these old pm_nl_ prefix helpers in mptcp_join.sh can be wrappers of mptcp_lib_ prefix ones. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 72 ++------------------- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 85 +++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 66 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 8862b6a5caa0..fefa9173bdaa 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -605,92 +605,32 @@ kill_events_pids() pm_nl_set_limits() { - local ns=$1 - local addrs=$2 - local subflows=$3 - - if mptcp_lib_is_ip_mptcp; then - ip -n $ns mptcp limits set add_addr_accepted $addrs subflows $subflows - else - ip netns exec $ns ./pm_nl_ctl limits $addrs $subflows - fi + mptcp_lib_pm_nl_set_limits "${@}" } pm_nl_add_endpoint() { - local ns=$1 - local addr=$2 - local flags dev id port - local nr=2 - - local p - for p in "${@}" - do - case "${p}" in - "flags" | "dev" | "id" | "port") - eval "${p}"=\$"${nr}" - ;; - esac - - nr=$((nr + 1)) - done - - if mptcp_lib_is_ip_mptcp; then - ip -n "${ns}" mptcp endpoint add "${addr}" ${flags//","/" "} \ - ${dev:+dev "${dev}"} ${id:+id "${id}"} ${port:+port "${port}"} - else - ip netns exec "${ns}" ./pm_nl_ctl add "${addr}" ${flags:+flags "${flags}"} \ - ${dev:+dev "${dev}"} ${id:+id "${id}"} ${port:+port "${port}"} - fi + mptcp_lib_pm_nl_add_endpoint "${@}" } pm_nl_del_endpoint() { - local ns=$1 - local id=$2 - local addr=$3 - - if mptcp_lib_is_ip_mptcp; then - [ $id -ne 0 ] && addr='' - ip -n $ns mptcp endpoint delete id $id ${addr:+"${addr}"} - else - ip netns exec $ns ./pm_nl_ctl del $id $addr - fi + mptcp_lib_pm_nl_del_endpoint "${@}" } pm_nl_flush_endpoint() { - local ns=$1 - - if mptcp_lib_is_ip_mptcp; then - ip -n $ns mptcp endpoint flush - else - ip netns exec $ns ./pm_nl_ctl flush - fi + mptcp_lib_pm_nl_flush_endpoint "${@}" } pm_nl_show_endpoints() { - local ns=$1 - - if mptcp_lib_is_ip_mptcp; then - ip -n $ns mptcp endpoint show - else - ip netns exec $ns ./pm_nl_ctl dump - fi + mptcp_lib_pm_nl_show_endpoints "${@}" } pm_nl_change_endpoint() { - local ns=$1 - local id=$2 - local flags=$3 - - if mptcp_lib_is_ip_mptcp; then - ip -n $ns mptcp endpoint change id $id ${flags//","/" "} - else - ip netns exec $ns ./pm_nl_ctl set id $id flags $flags - fi + mptcp_lib_pm_nl_change_endpoint "${@}" } pm_nl_check_endpoint() diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 4fabb0091940..ad2ebda5cb64 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -555,3 +555,88 @@ mptcp_lib_pm_nl_get_endpoint() { ip netns exec "${ns}" ./pm_nl_ctl get "${id}" fi } + +mptcp_lib_pm_nl_set_limits() { + local ns=${1} + local addrs=${2} + local subflows=${3} + + if mptcp_lib_is_ip_mptcp; then + ip -n "${ns}" mptcp limits set add_addr_accepted "${addrs}" subflows "${subflows}" + else + ip netns exec "${ns}" ./pm_nl_ctl limits "${addrs}" "${subflows}" + fi +} + +mptcp_lib_pm_nl_add_endpoint() { + local ns=${1} + local addr=${2} + local flags dev id port + local nr=2 + + local p + for p in "${@}"; do + case "${p}" in + "flags" | "dev" | "id" | "port") + eval "${p}"=\$"${nr}" + ;; + esac + + nr=$((nr + 1)) + done + + if mptcp_lib_is_ip_mptcp; then + # shellcheck disable=SC2086 # blanks in flags, no double quote + ip -n "${ns}" mptcp endpoint add "${addr}" ${flags//","/" "} \ + ${dev:+dev "${dev}"} ${id:+id "${id}"} ${port:+port "${port}"} + else + ip netns exec "${ns}" ./pm_nl_ctl add "${addr}" ${flags:+flags "${flags}"} \ + ${dev:+dev "${dev}"} ${id:+id "${id}"} ${port:+port "${port}"} + fi +} + +mptcp_lib_pm_nl_del_endpoint() { + local ns=${1} + local id=${2} + local addr=${3} + + if mptcp_lib_is_ip_mptcp; then + [ "${id}" -ne 0 ] && addr='' + ip -n "${ns}" mptcp endpoint delete id "${id}" ${addr:+"${addr}"} + else + ip netns exec "${ns}" ./pm_nl_ctl del "${id}" "${addr}" + fi +} + +mptcp_lib_pm_nl_flush_endpoint() { + local ns=${1} + + if mptcp_lib_is_ip_mptcp; then + ip -n "${ns}" mptcp endpoint flush + else + ip netns exec "${ns}" ./pm_nl_ctl flush + fi +} + +mptcp_lib_pm_nl_show_endpoints() { + local ns=${1} + + if mptcp_lib_is_ip_mptcp; then + ip -n "${ns}" mptcp endpoint show + else + ip netns exec "${ns}" ./pm_nl_ctl dump + fi +} + +mptcp_lib_pm_nl_change_endpoint() { + local ns=${1} + local id=${2} + local flags=${3} + + if mptcp_lib_is_ip_mptcp; then + # shellcheck disable=SC2086 # blanks in flags, no double quote + ip -n "${ns}" mptcp endpoint change id "${id}" ${flags//","/" "} + else + ip netns exec "${ns}" ./pm_nl_ctl set id "${id}" flags "${flags}" + fi +} From patchwork Fri Apr 5 10:52:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 786611 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 4EE9516D9A6; Fri, 5 Apr 2024 10:52:55 +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=1712314376; cv=none; b=konKgbxQPlvsRmf78dkQ6H7K/u8g7GJFKlpQQ1HfFHRtm0vlbm5bGqZox/RKmkd47hVfMs9s7N9xI7qKzhXOM8tECdW+obSo54ByiK3LM+OT+Ws/U0UnZxUcUEo5YA6JBdPVWEcYfQn5hT4eTqmwTPyNg0eRZA9fvj0DLL+aZM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712314376; c=relaxed/simple; bh=/rTr+QTnJy+nrMoQt/f15OXgmpM5Wqn4Gt7TYRBqYSw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rm4CmYIq45W5hGtuWfJvV2eU1M+aMzWDq4PKVHyGKbILR9QmAmw7La6xwxdEf/0Sr4O3B+HPaVINY6Ts6vXcv8r69hgqcGYlvqBT11ze1gsGpWNdnXQVY1ln313s1Cld2DDHRaFaz4XhGZ2Qt0ZUUZQghUob3ARsuQn/SlpYGjw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X447XcDs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X447XcDs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 384B6C4166B; Fri, 5 Apr 2024 10:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712314375; bh=/rTr+QTnJy+nrMoQt/f15OXgmpM5Wqn4Gt7TYRBqYSw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=X447XcDsfh+2FJuGE/f5mcksm9/PT2mN/iUve9nxRiednc3gZ8velid3+k9etmMQ1 Nkxa2D8/64fk1HM6Q1L+WoBsn5KojKozePGcQ0S3O271wKVsxo4X9XHSfZfmuPBX2s Zm/e5osyyelqh8cUL68cQbO6RUBwDqlyBzktjqOz/n6tFNwCyqZkyye1QksjHlaptO hC1qtS8yTr2/8r1r3D2IPkGfutcfdNRq5utfoHZvGtBLUc4xKxDW07VT8db4ZY9u7P pcdZZjWCUcRLjlUTgLNYDEZCL6ujFGCYxoPBZlWsXGpC8DkloVwWVLuolQtpOZ9spX TAMBBHsduVD1w== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Apr 2024 12:52:14 +0200 Subject: [PATCH net-next 10/11] selftests: mptcp: ip_mptcp option for more scripts Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240405-upstream-net-next-20240405-mptcp-selftests-refactoring-v1-10-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=3081; i=matttbe@kernel.org; h=from:subject:message-id; bh=7dJfIPeeIjj3sU94QMXAlNLo3Zxg9tDsg6aNaMsGiDQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmD9fm3g0BXpZOC8lszEBHEYiMIRodGVCNXT5bX XMwMC9ldBuJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZg/X5gAKCRD2t4JPQmmg c0aDD/9pQhVSDzcgjjhmdAlvu/f+f41QMN7l3SwTdaD5tyAXovaZRIpy1giASUHh95SUYjob05z FTrDUOAL78/MOjtPJSMA9rcg3LjS501a0Fy4Eo8Zo3HmmsVnSda6tQik0Ciq9t+LL1p4GuUDv0P LgOUuTlmoqnIhWMlae0mrlIkmNp18cAbcWe9N1KpwVrpiveqQOOV8MgKirxSimxIREjuLRTGc8I 63aFKhdjI5IcSciAI8VylTCw1gN/3yvy2lv2Qhn9RtDTWXzUNm6g33qbzAel4WusS28uGVUeJRk UPS5p0ZMAKe/vKVz2G2skWXQpNruAzIbgoB7AofPopaDLoExAb3DEOMz5voGZ7+T16Z/UAvuXcg OLysMbb8k6hToRN+8kf3OYxC7iVApRAzlLd2M+PAh2eF6pGGJ7mFjA+sKZJMbJu/XMkYTsT+xsB PMaFWbBNg9aJiY5Noawf4fc/wtxifZhp/GwsylTcFwteP2hjCtUkad3PHro50c79hpR35+1MKz6 Y/HF5qU0HRVPkoYrmtAWvW+vPrDD0QPQG4PXRfCvrgbrswdGggTm4l/ktGyMm6RG4aScL5KPC9y vte/BRfEmf3lQ6hx7HgyxTRP70Ux5MAY5gzOCZ+PD3Mx7G7sKfUwyHI2rMQ+kmKBCfGBlDXZkE2 zMvMU7PnvKZL84w== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang This patch adds '-i' option for mptcp_sockopt.sh, pm_netlink.sh, and simult_flows.sh, to use 'ip mptcp' command in the tests instead of 'pm_nl_ctl'. Update usage() correspondingly. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 22 ++++++++++++++++++++++ tools/testing/selftests/net/mptcp/pm_netlink.sh | 9 +++++++-- tools/testing/selftests/net/mptcp/simult_flows.sh | 8 ++++++-- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index 36e81383f0e2..68899a303a1a 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -22,6 +22,28 @@ ns1="" ns2="" ns_sbox="" +usage() { + echo "Usage: $0 [ -i ] [ -h ]" + echo -e "\t-i: use 'ip mptcp' instead of 'pm_nl_ctl'" + echo -e "\t-h: help" +} + +while getopts "hi" option;do + case "$option" in + "h") + usage "$0" + exit ${KSFT_PASS} + ;; + "i") + mptcp_lib_set_ip_mptcp + ;; + "?") + usage "$0" + exit ${KSFT_FAIL} + ;; + esac +done + add_mark_rules() { local ns=$1 diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index b3adb39a7d3d..4859fa85d9a0 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -11,16 +11,21 @@ ret=0 usage() { - echo "Usage: $0 [ -h ]" + echo "Usage: $0 [ -i ] [ -h ]" + echo -e "\t-i: use 'ip mptcp' instead of 'pm_nl_ctl'" + echo -e "\t-h: help" } -optstring=h +optstring=hi while getopts "$optstring" option;do case "$option" in "h") usage $0 exit ${KSFT_PASS} ;; + "i") + mptcp_lib_set_ip_mptcp + ;; "?") usage $0 exit ${KSFT_FAIL} diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index 3ebb2fb12c8a..4b14b4412166 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -27,10 +27,11 @@ capout="" size=0 usage() { - echo "Usage: $0 [ -b ] [ -c ] [ -d ]" + echo "Usage: $0 [ -b ] [ -c ] [ -d ] [ -i]" echo -e "\t-b: bail out after first error, otherwise runs al testcases" echo -e "\t-c: capture packets for each test using tcpdump (default: no capture)" echo -e "\t-d: debug this script" + echo -e "\t-i: use 'ip mptcp' instead of 'pm_nl_ctl'" } # This function is used in the cleanup trap @@ -259,7 +260,7 @@ run_test() fi } -while getopts "bcdh" option;do +while getopts "bcdhi" option;do case "$option" in "h") usage $0 @@ -274,6 +275,9 @@ while getopts "bcdh" option;do "d") set -x ;; + "i") + mptcp_lib_set_ip_mptcp + ;; "?") usage $0 exit ${KSFT_FAIL}