diff mbox series

[mptcp-next,v6,13/13] selftests/mptcp: use path_manager instead of pm_type

Message ID b94e2a3b16486315acd2fa31cde3830a98573d5d.1740320007.git.tanggeliang@kylinos.cn (mailing list archive)
State Superseded, archived
Delegated to: Matthieu Baerts
Headers show
Series BPF path manager, part 4 | expand

Checks

Context Check Description
matttbe/checkpatch warning total: 0 errors, 12 warnings, 0 checks, 120 lines checked
matttbe/shellcheck success No ShellCheck issues
matttbe/build success Build and static analysis OK
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf-normal__only_bpftest_all_ success Success! ✅
matttbe/KVM_Validation__btf-debug__only_bpftest_all_ success Success! ✅

Commit Message

Geliang Tang Feb. 23, 2025, 2:26 p.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

This patch uses the newly added net.mptcp.path_manager instead of the
old net.mptcp.pm_type for all path manager selftests in mptcp_join.sh
and userspace_pm.sh.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 26 +++++++++----------
 .../selftests/net/mptcp/userspace_pm.sh       |  4 +--
 2 files changed, 15 insertions(+), 15 deletions(-)

Comments

Matthieu Baerts Feb. 23, 2025, 5:13 p.m. UTC | #1
Hi Geliang,

On 23/02/2025 15:26, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> This patch uses the newly added net.mptcp.path_manager instead of the
> old net.mptcp.pm_type for all path manager selftests in mptcp_join.sh
> and userspace_pm.sh.

With the mapping for "pm_type" and "path_manager" sysctl knobs I
mentioned before, this patch should not be needed (and would cause
issues when validating older kernels, see below).

Still, I think it would be good to make sure such mapping is working
well. Instead, I think it would be better to add a specific test in
userspace_pm.sh to make sure the mapping is correct. See below.

> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  .../testing/selftests/net/mptcp/mptcp_join.sh | 26 +++++++++----------
>  .../selftests/net/mptcp/userspace_pm.sh       |  4 +--
>  2 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 13a3b68181ee..ed04e7dedf23 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -99,7 +99,7 @@ init_partial()
>  
>  	local netns
>  	for netns in "$ns1" "$ns2"; do
> -		ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true
> +		ip netns exec $netns sysctl -q net.mptcp.path_manager="in-kernel" 2>/dev/null || true

If you change this here, it means that the selftests will report errors
when running on older kernels. So please, do not change that.

>  		if $checksum; then
>  			ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1
>  		fi
> @@ -1920,7 +1920,7 @@ set_userspace_pm()
>  {
>  	local ns=$1
>  
> -	ip netns exec $ns sysctl -q net.mptcp.pm_type=1
> +	ip netns exec $ns sysctl -q net.mptcp.path_manager="userspace"

Same here.

>  }
>  
>  subflows_tests()
> @@ -3497,7 +3497,7 @@ userspace_tests()
>  {
>  	# userspace pm type prevents add_addr
>  	if reset "userspace pm type prevents add_addr" &&
> -	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
> +	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then

Here, it means the tests will be skipped on older kernels while they
don't require this new sysctl knob.

So please do not change that. Same below.

(...)

> diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> index 3651f73451cf..dfeec8d4aecf 100755
> --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
> +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
> @@ -13,7 +13,7 @@
>  mptcp_lib_check_mptcp
>  mptcp_lib_check_kallsyms
>  
> -if ! mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
> +if ! mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then

Same here.

>  	echo "userspace pm tests are not supported by the kernel: SKIP"
>  	exit ${KSFT_SKIP}
>  fi
> @@ -119,7 +119,7 @@ trap cleanup EXIT
>  # Create and configure network namespaces for testing
>  mptcp_lib_ns_init ns1 ns2

Here, if /proc/sys/net/mptcp/path_manager is available:

 - set it to "userspace", then check if "pm_type" is set to 1.
 - set "pm_type" to 0, and check if "path_manager" is "kernel".
 - then continue like before (so setting pm_type=1)
 - (you might have to move 'print_title "Init"' here above if these new
steps can create errors)

I don't think we need individual subtests here, only fail if it doesn't
work as expected (again, if the new sysctl is available, not to fail on
older kernels).

>  for i in "$ns1" "$ns2" ;do
> -	ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
> +	ip netns exec "$i" sysctl -q net.mptcp.path_manager="userspace"

Do not change that.

>  done
>  
>  #  "$ns1"              ns2

Cheers,
Matt
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 13a3b68181ee..ed04e7dedf23 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -99,7 +99,7 @@  init_partial()
 
 	local netns
 	for netns in "$ns1" "$ns2"; do
-		ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true
+		ip netns exec $netns sysctl -q net.mptcp.path_manager="in-kernel" 2>/dev/null || true
 		if $checksum; then
 			ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1
 		fi
@@ -1920,7 +1920,7 @@  set_userspace_pm()
 {
 	local ns=$1
 
-	ip netns exec $ns sysctl -q net.mptcp.pm_type=1
+	ip netns exec $ns sysctl -q net.mptcp.path_manager="userspace"
 }
 
 subflows_tests()
@@ -3497,7 +3497,7 @@  userspace_tests()
 {
 	# userspace pm type prevents add_addr
 	if reset "userspace pm type prevents add_addr" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns1
 		pm_nl_set_limits $ns1 0 2
 		pm_nl_set_limits $ns2 0 2
@@ -3509,7 +3509,7 @@  userspace_tests()
 
 	# userspace pm type does not echo add_addr without daemon
 	if reset "userspace pm no echo w/o daemon" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns2
 		pm_nl_set_limits $ns1 0 2
 		pm_nl_set_limits $ns2 0 2
@@ -3521,7 +3521,7 @@  userspace_tests()
 
 	# userspace pm type rejects join
 	if reset "userspace pm type rejects join" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns1
 		pm_nl_set_limits $ns1 1 1
 		pm_nl_set_limits $ns2 1 1
@@ -3532,7 +3532,7 @@  userspace_tests()
 
 	# userspace pm type does not send join
 	if reset "userspace pm type does not send join" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns2
 		pm_nl_set_limits $ns1 1 1
 		pm_nl_set_limits $ns2 1 1
@@ -3543,7 +3543,7 @@  userspace_tests()
 
 	# userspace pm type prevents mp_prio
 	if reset "userspace pm type prevents mp_prio" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns1
 		pm_nl_set_limits $ns1 1 1
 		pm_nl_set_limits $ns2 1 1
@@ -3556,7 +3556,7 @@  userspace_tests()
 
 	# userspace pm type prevents rm_addr
 	if reset "userspace pm type prevents rm_addr" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns1
 		set_userspace_pm $ns2
 		pm_nl_set_limits $ns1 0 1
@@ -3570,7 +3570,7 @@  userspace_tests()
 
 	# userspace pm add & remove address
 	if reset_with_events "userspace pm add & remove address" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns1
 		pm_nl_set_limits $ns2 2 2
 		{ speed=5 \
@@ -3603,7 +3603,7 @@  userspace_tests()
 
 	# userspace pm create destroy subflow
 	if reset_with_events "userspace pm create destroy subflow" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns2
 		pm_nl_set_limits $ns1 0 1
 		{ speed=5 \
@@ -3631,7 +3631,7 @@  userspace_tests()
 
 	# userspace pm create id 0 subflow
 	if reset_with_events "userspace pm create id 0 subflow" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns2
 		pm_nl_set_limits $ns1 0 1
 		{ speed=5 \
@@ -3652,7 +3652,7 @@  userspace_tests()
 
 	# userspace pm remove initial subflow
 	if reset_with_events "userspace pm remove initial subflow" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns2
 		pm_nl_set_limits $ns1 0 1
 		{ speed=5 \
@@ -3676,7 +3676,7 @@  userspace_tests()
 
 	# userspace pm send RM_ADDR for ID 0
 	if reset_with_events "userspace pm send RM_ADDR for ID 0" &&
-	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+	   continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 		set_userspace_pm $ns1
 		pm_nl_set_limits $ns2 1 1
 		{ speed=5 \
diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh
index 3651f73451cf..dfeec8d4aecf 100755
--- a/tools/testing/selftests/net/mptcp/userspace_pm.sh
+++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh
@@ -13,7 +13,7 @@ 
 mptcp_lib_check_mptcp
 mptcp_lib_check_kallsyms
 
-if ! mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+if ! mptcp_lib_has_file '/proc/sys/net/mptcp/path_manager'; then
 	echo "userspace pm tests are not supported by the kernel: SKIP"
 	exit ${KSFT_SKIP}
 fi
@@ -119,7 +119,7 @@  trap cleanup EXIT
 # Create and configure network namespaces for testing
 mptcp_lib_ns_init ns1 ns2
 for i in "$ns1" "$ns2" ;do
-	ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
+	ip netns exec "$i" sysctl -q net.mptcp.path_manager="userspace"
 done
 
 #  "$ns1"              ns2