Skip to contentSkip to conversation

cleanups for BPF PM part 5 v10

PATCH New Geliang Tang 1 participant 3 messages Mar 7, 2025

Subsystems (3)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

cover cleanups for BPF PM part 5 v10

From: Geliang Tang <[email protected]>

Two cleanups for "BPF path manager, part 5 v10".

Geliang Tang (2):
Squash to "mptcp: sysctl: set path manager by name" Squash to "selftests: mptcp: add path_manager sysctl tests"

 net/mptcp/ctrl.c                              |  6 ++---
 .../testing/selftests/net/mptcp/mptcp_lib.sh  | 13 +++++++++++
 .../selftests/net/mptcp/userspace_pm.sh       | 22 ++++---------------
 3 files changed, 20 insertions(+), 21 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH 1/2 Squash to "mptcp: sysctl: set path manager by name"

From: Geliang Tang <[email protected]>

Name mptcp_pm_ops variable as "pm_ops", instead of "pm" in mptcp_set_path_manager().

---
 net/mptcp/ctrl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/ctrl.c +3 -3
index 14c32d06f51e..e6e8b4dde5bc 100644
@@ -183,12 +183,12 @@ static int proc_blackhole_detect_timeout(const struct ctl_table *table,
 
 static int mptcp_set_path_manager(char *path_manager, const char *name)
 {
-	struct mptcp_pm_ops *pm;
+	struct mptcp_pm_ops *pm_ops;
 	int ret = 0;
 
 	rcu_read_lock();
-	pm = mptcp_pm_find(name);
-	if (pm)
+	pm_ops = mptcp_pm_find(name);
+	if (pm_ops)
 		strscpy(path_manager, name, MPTCP_PM_NAME_MAX);
 	else
 		ret = -ENOENT;
Signature · 1 line
2.43.0
author reviewer
#2 lore raw

PATCH 2/2 Squash to "selftests: mptcp: add path_manager sysctl tests"

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

Check pm_type mapping in ns2 too.
Move set_path_manager to mptcp_lib.sh.

---
 .../testing/selftests/net/mptcp/mptcp_lib.sh  | 13 +++++++++++
 .../selftests/net/mptcp/userspace_pm.sh       | 22 ++++---------------
 2 files changed, 17 insertions(+), 18 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_lib.sh +13 -0
index 051e289d7967..ed2c27e345f7 100644
@@ -693,3 +693,16 @@ mptcp_lib_pm_nl_change_endpoint() {
 		ip netns exec "${ns}" ./pm_nl_ctl set id "${id}" flags "${flags}"
 	fi
 }
+
+mptcp_lib_set_path_manager()
+{
+	local ns=$1
+	local pm=$2
+
+	if ! ip netns exec ${ns} sysctl net.mptcp.available_path_managers |
+	     grep -wq "${pm}"; then
+		test_fail "path manager ${pm} not found"
+		return 1
+	fi
+	ip netns exec ${ns} sysctl -q net.mptcp.path_manager="${pm}"
+}
tools/testing/selftests/net/mptcp/userspace_pm.sh +4 -18
index 35ba4edc0fa2..b8dec1ce5762 100755
@@ -119,19 +119,6 @@ trap cleanup EXIT
 # Create and configure network namespaces for testing
 mptcp_lib_ns_init ns1 ns2
 
-set_path_manager()
-{
-	local ns=$1
-	local pm=$2
-
-	if ! ip netns exec ${ns} sysctl net.mptcp.available_path_managers |
-	     grep -wq "${pm}"; then
-		test_fail "path manager ${pm} not found"
-		return 1
-	fi
-	ip netns exec ${ns} sysctl -q net.mptcp.path_manager="${pm}"
-}
-
 if [ -f /proc/sys/net/mptcp/path_manager ]; then
 	ip netns exec "$ns1" sysctl -q net.mptcp.pm_type=0
 	pm_name="$(ip netns exec "$ns1" sysctl -n net.mptcp.path_manager)"
@@ -149,23 +136,22 @@ if [ -f /proc/sys/net/mptcp/path_manager ]; then
 		exit ${KSFT_FAIL}
 	fi
 
-	set_path_manager "$ns1" "kernel"
-	pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
+	mptcp_lib_set_path_manager "$ns2" "kernel"
+	pm_type="$(ip netns exec "$ns2" sysctl -n net.mptcp.pm_type)"
 	if [ "${pm_type}" != "0" ]; then
 		test_fail "unexpected pm_type: ${pm_type}"
 		mptcp_lib_result_print_all_tap
 		exit ${KSFT_FAIL}
 	fi
 
-	set_path_manager "$ns1" "userspace"
-	pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
+	mptcp_lib_set_path_manager "$ns2" "userspace"
+	pm_type="$(ip netns exec "$ns2" sysctl -n net.mptcp.pm_type)"
 	if [ "${pm_type}" != "1" ]; then
 		test_fail "unexpected pm_type: ${pm_type}"
 		mptcp_lib_result_print_all_tap
 		exit ${KSFT_FAIL}
 	fi
 
-	set_path_manager "$ns2" "userspace"
 	print_test "check path_manager and pm_type sysctl mapping"
 	test_pass
 else
Signature · 1 line
2.43.0