Skip to contentSkip to conversation

BPF path manager, part 5

PATCH In review Geliang Tang 3 participants 16 messages Mar 11, 2025

Subsystems (4)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

v11 cover BPF path manager, part 5

From: Geliang Tang <[email protected]>

v11:
- add bitmap_fill(id_avail_bitmap) in mptcp_pm_kernel_init.
- squash mptcp_pm_validate into "mptcp: pm: define struct mptcp_pm_ops".
- map path_manager to pm_type after mptcp_set_path_manager().
- change 'char *pm_name = "unknown"' to 'char *pm_name = ""'.
- update pm mapping selftests.

v10:
- drop pm->init in mptcp_pm_validate, move mptcp_pm_validate into a new patch.
- remove tlb, use ctl instead in proc_pm_type.
- use "strncmp() == 0" instead of "!strncmp()".
- set pm_type __MPTCP_PM_TYPE_NR for other names.
- add WARN_ON_ONCE in mptcp_pm_unregister.
- drop mptcp_userspace_pm_init.
- rename "struct mptcp_pm_ops *pm" to "struct mptcp_pm_ops *pm_ops".
- drop pm_ops NULL check in mptcp_pm_release.
- add struct_group for struct mptcp_pm_data.
- move selftests into userspace_pm.sh.

v9:
- rename mptcp_pm_nl_ prefix to mptcp_pm_kernel_.
- rename mptcp_userspace_pm_ prefix to mptcp_pm_userspace_.
- update commit logs.

v8:
- address Matt's comments in v7.

v7:
- addresss Matt's comments in v6 [1].
- drop "type" from struct mptcp_pm_ops as Matt suggested.
- map "pm_type" to new sysctl as Matt suggested.

v6:
- add "name" in struct mptcp_pm_ops.
- add some "sysctl" patches.
- drop "struct mptcp_pm_param".
- drop "pm_type" in mptcp_pm_data.

v5:
- use "struct mptcp_pm_param *param" as unified parameters for all interfaces.
- register in-kernel mptcp_pm_ops too.
- only implement two interfaces "get_local_id" and "get_priority" in this set.

v4:
- include a new patch "define BPF path manager type".

- add new interfaces:
created established closed
listerner_created listener_closed

- rename interfaces as:
address_announced address_removed
subflow_established subflow_closed
get_priority set_priority

- rename functions as:
mptcp_pm_validate
mptcp_pm_register
mptcp_pm_unregister
mptcp_pm_initialize
mptcp_pm_release

v3:
- rename the 2nd parameter of get_local_id() from 'local' to 'skc'.
- keep the 'msk_sport' check in mptcp_userspace_pm_get_local_id().
- return 'err' instead of '0' in userspace_pm_subflow_create().
- drop 'ret' variable inmptcp_pm_data_reset().
- fix typos in commit log.

v2:
- update get_local_id interface in patch 2.

get_addr() and dump_addr() interfaces of BPF userspace pm are dropped as Matt suggested.

In order to implement BPF path manager, it's necessary to unify the interfaces of the path manager. This set contains some cleanups and refactoring to unify the interfaces in kernel space. Finally, define a struct mptcp_pm_ops for a path manager.

Geliang Tang (10):
mptcp: pm: define struct mptcp_pm_ops
mptcp: pm: register in-kernel and userspace PM
mptcp: sysctl: set path manager by name
mptcp: pm: init and release mptcp_pm_ops
mptcp: pm: add get_local_id() interface
mptcp: pm: add get_priority() interface
mptcp: sysctl: map path_manager to pm_type
mptcp: sysctl: map pm_type to path_manager
mptcp: sysctl: add available_path_managers
selftests: mptcp: add pm sysctl mapping tests

 Documentation/networking/mptcp-sysctl.rst     |  23 +++
 include/net/mptcp.h                           |  19 +++
 net/mptcp/ctrl.c                              | 113 +++++++++++++-
 net/mptcp/pm.c                                | 145 ++++++++++++++----
 net/mptcp/pm_kernel.c                         |  37 ++++-
 net/mptcp/pm_userspace.c                      |  26 +++-
 net/mptcp/protocol.h                          |  18 ++-
 .../selftests/net/mptcp/userspace_pm.sh       |  30 +++-
 8 files changed, 368 insertions(+), 43 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH v11 1/10 mptcp: pm: define struct mptcp_pm_ops

From: Geliang Tang <[email protected]>

In order to allow users to develop their own BPF-based path manager, this patch defines a struct ops "mptcp_pm_ops" for an MPTCP path manager, which contains a set of interfaces. Currently only init() and release() interfaces are included, subsequent patches will add others step by step.

Add a set of functions to register, unregister, find and validate a given path manager struct ops.

"list" is used to add this path manager to mptcp_pm_list list when it is registered. "name" is used to identify this path manager. mptcp_pm_find() uses "name" to find a path manager on the list.

mptcp_pm_unregister is not used in this set, but will be invoked in .unreg of struct bpf_struct_ops. mptcp_pm_validate() will be invoked in .validate of struct bpf_struct_ops. That's why they are exported.

---
 include/net/mptcp.h  | 12 +++++++++++
 net/mptcp/pm.c       | 50 ++++++++++++++++++++++++++++++++++++++++++++
 net/mptcp/protocol.h |  5 +++++
 3 files changed, 67 insertions(+)
include/net/mptcp.h +12 -0
index e9832a8f981e..69f7b35e57c3 100644
@@ -14,6 +14,7 @@
 
 struct mptcp_info;
 struct mptcp_sock;
+struct mptcp_pm_addr_entry;
 struct seq_file;
 
 /* MPTCP sk_buff extension data */
@@ -112,6 +113,17 @@ struct mptcp_sched_ops {
 	void (*release)(struct mptcp_sock *msk);
 } ____cacheline_aligned_in_smp;
 
+#define MPTCP_PM_NAME_MAX	16
+
+struct mptcp_pm_ops {
+	char			name[MPTCP_PM_NAME_MAX];
+	struct module		*owner;
+	struct list_head	list;
+
+	void (*init)(struct mptcp_sock *msk);
+	void (*release)(struct mptcp_sock *msk);
+} ____cacheline_aligned_in_smp;
+
 #ifdef CONFIG_MPTCP
 void mptcp_init(void);
 
net/mptcp/pm.c +50 -0

65 lines not on this page · raw message

net/mptcp/protocol.h +5 -0
index b5c945064baf..2307f2fcbe9d 100644
@@ -1052,6 +1052,11 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_
 void mptcp_pm_remove_addr_entry(struct mptcp_sock *msk,
 				struct mptcp_pm_addr_entry *entry);
 
+struct mptcp_pm_ops *mptcp_pm_find(const char *name);
+int mptcp_pm_register(struct mptcp_pm_ops *pm_ops);
+void mptcp_pm_unregister(struct mptcp_pm_ops *pm_ops);
+int mptcp_pm_validate(struct mptcp_pm_ops *pm_ops);
+
 void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk);
 
 void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk,
Signature · 1 line
2.43.0
author reviewer
#2 lore raw

PATCH v11 2/10 mptcp: pm: register in-kernel and userspace PM

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

This patch defines the original in-kernel netlink path manager as a new struct mptcp_pm_ops named "mptcp_pm_kernel", and register it in mptcp_pm_kernel_register(). And define the userspace path manager as a new struct mptcp_pm_ops named "mptcp_pm_userspace", and register it in mptcp_pm_init().

To ensure that there's always a valid path manager available, the default path manager "mptcp_pm_kernel" will be skipped in mptcp_pm_unregister().

---
 net/mptcp/pm.c           |  5 +++++
 net/mptcp/pm_kernel.c    |  7 +++++++
 net/mptcp/pm_userspace.c | 10 ++++++++++
 net/mptcp/protocol.h     |  4 ++++
 4 files changed, 26 insertions(+)
net/mptcp/pm.c +5 -0
index f4948a2cf9be..3896f21a46bd 100644
@@ -1018,6 +1018,7 @@ void mptcp_pm_data_init(struct mptcp_sock *msk)
 void __init mptcp_pm_init(void)
 {
 	mptcp_pm_kernel_register();
+	mptcp_pm_userspace_register();
 	mptcp_pm_nl_init();
 }
 
@@ -1061,6 +1062,10 @@ int mptcp_pm_register(struct mptcp_pm_ops *pm_ops)
 
 void mptcp_pm_unregister(struct mptcp_pm_ops *pm_ops)
 {
+	/* skip unregistering the default path manager */
+	if (WARN_ON_ONCE(pm_ops == &mptcp_pm_kernel))
+		return;
+
 	spin_lock(&mptcp_pm_list_lock);
 	list_del_rcu(&pm_ops->list);
 	spin_unlock(&mptcp_pm_list_lock);
net/mptcp/pm_kernel.c +7 -0
index 806a9b5b3c07..d39e7c178460 100644
@@ -1398,8 +1398,15 @@ static struct pernet_operations mptcp_pm_pernet_ops = {
 	.size = sizeof(struct pm_nl_pernet),
 };
 
+struct mptcp_pm_ops mptcp_pm_kernel = {
+	.name			= "kernel",
+	.owner			= THIS_MODULE,
+};
+
 void __init mptcp_pm_kernel_register(void)
 {
 	if (register_pernet_subsys(&mptcp_pm_pernet_ops) < 0)
 		panic("Failed to register MPTCP PM pernet subsystem.\n");
+
+	mptcp_pm_register(&mptcp_pm_kernel);
 }
net/mptcp/pm_userspace.c +10 -0
index 13856df22673..2cb62f026b1f 100644
@@ -682,3 +682,13 @@ int mptcp_userspace_pm_get_addr(u8 id, struct mptcp_pm_addr_entry *addr,
 	sock_put(sk);
 	return ret;
 }
+
+static struct mptcp_pm_ops mptcp_pm_userspace = {
+	.name			= "userspace",
+	.owner			= THIS_MODULE,
+};
+
+void __init mptcp_pm_userspace_register(void)
+{
+	mptcp_pm_register(&mptcp_pm_userspace);
+}
net/mptcp/protocol.h +4 -0
index 2307f2fcbe9d..f87c71550394 100644
@@ -1052,6 +1052,9 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_
 void mptcp_pm_remove_addr_entry(struct mptcp_sock *msk,
 				struct mptcp_pm_addr_entry *entry);
 
+/* the default path manager, used in mptcp_pm_unregister */
+extern struct mptcp_pm_ops mptcp_pm_kernel;
+
 struct mptcp_pm_ops *mptcp_pm_find(const char *name);
 int mptcp_pm_register(struct mptcp_pm_ops *pm_ops);
 void mptcp_pm_unregister(struct mptcp_pm_ops *pm_ops);
@@ -1160,6 +1163,7 @@ static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *subflo
 }
 
 void __init mptcp_pm_kernel_register(void);
+void __init mptcp_pm_userspace_register(void);
 void __init mptcp_pm_nl_init(void);
 void mptcp_pm_worker(struct mptcp_sock *msk);
 void __mptcp_pm_kernel_worker(struct mptcp_sock *msk);
Signature · 1 line
2.43.0
author reviewer
#3 lore raw

PATCH v11 3/10 mptcp: sysctl: set path manager by name

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

A new net.mptcp.path_manager sysctl is added to determine which path manager will be used by each newly-created MPTCP socket by setting the name of it.

This sysctl makes the old one "pm_type" deprecated.

---
 Documentation/networking/mptcp-sysctl.rst | 19 +++++++++
 net/mptcp/ctrl.c                          | 50 +++++++++++++++++++++++
 net/mptcp/protocol.h                      |  1 +
 3 files changed, 70 insertions(+)
Documentation/networking/mptcp-sysctl.rst +19 -0
index 03e1d3610333..b78a2254d452 100644
@@ -72,6 +72,23 @@ enabled - BOOLEAN
 
 	Default: 1 (enabled)
 
+path_manager - STRING
+	Set the default path manager name to use for each new MPTCP
+	socket. In-kernel path management will control subflow
+	connections and address advertisements according to
+	per-namespace values configured over the MPTCP netlink
+	API. Userspace path management puts per-MPTCP-connection subflow
+	connection decisions and address advertisements under control of
+	a privileged userspace program, at the cost of more netlink
+	traffic to propagate all of the related events and commands.
+
+	This is a per-namespace sysctl.
+
+	* "kernel"          - In-kernel path manager
+	* "userspace"       - Userspace path manager
+
+	Default: "kernel"
+
 pm_type - INTEGER
 	Set the default path manager type to use for each new MPTCP
 	socket. In-kernel path management will control subflow
@@ -84,6 +101,8 @@ pm_type - INTEGER
 
 	This is a per-namespace sysctl.
 
+	Deprecated since v6.15, use path_manager instead.
+
 	* 0 - In-kernel path manager
 	* 1 - Userspace path manager
 
net/mptcp/ctrl.c +50 -0

86 lines not on this page · raw message

net/mptcp/protocol.h +1 -0
index f87c71550394..d5eaf78c041f 100644
@@ -699,6 +699,7 @@ int mptcp_allow_join_id0(const struct net *net);
 unsigned int mptcp_stale_loss_cnt(const struct net *net);
 unsigned int mptcp_close_timeout(const struct sock *sk);
 int mptcp_get_pm_type(const struct net *net);
+const char *mptcp_get_path_manager(const struct net *net);
 const char *mptcp_get_scheduler(const struct net *net);
 
 void mptcp_active_disable(struct sock *sk);
Signature · 1 line
2.43.0
author reviewer
#4 lore raw

PATCH v11 4/10 mptcp: pm: init and release mptcp_pm_ops

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

Add a struct mptcp_pm_ops pointer "ops" in struct mptcp_pm_data, and two helpers mptcp_pm_ops_init() and mptcp_pm_ops_release(), to set and release this pointer. mptcp_pm_ops_init() is invoked in mptcp_pm_data_reset(), while mptcp_pm_ops_release() is invoked in mptcp_pm_destroy().

mptcp_pm_kernel_init() is defined as init() interface of the in-kernel PM, which sets work_pending, accept_addr and accept_subflow.

mptcp_pm_userspace_is_release() is defined as release() interface of the userspace PM, which is a wrapper of userspace_pm_free_local_addr_list().

---
 net/mptcp/pm.c           | 57 +++++++++++++++++++++++++---------------
 net/mptcp/pm_kernel.c    | 21 +++++++++++++++
 net/mptcp/pm_userspace.c |  6 +++++
 net/mptcp/protocol.h     |  1 +
 4 files changed, 64 insertions(+), 21 deletions(-)
net/mptcp/pm.c +36 -21
index 3896f21a46bd..bf318cecb242 100644
@@ -970,17 +970,46 @@ void mptcp_pm_worker(struct mptcp_sock *msk)
 	spin_unlock_bh(&msk->pm.lock);
 }
 
+static void mptcp_pm_ops_init(struct mptcp_sock *msk,
+			      struct mptcp_pm_ops *pm_ops)
+{
+	if (!pm_ops || !bpf_try_module_get(pm_ops, pm_ops->owner)) {
+		pr_warn_once("pm %s fails, fallback to default pm",
+			     pm_ops->name);
+		pm_ops = &mptcp_pm_kernel;
+	}
+
+	msk->pm.ops = pm_ops;
+	if (msk->pm.ops->init)
+		msk->pm.ops->init(msk);
+
+	pr_debug("pm %s initialized\n", pm_ops->name);
+}
+
+static void mptcp_pm_ops_release(struct mptcp_sock *msk)
+{
+	struct mptcp_pm_ops *pm_ops = msk->pm.ops;
+
+	msk->pm.ops = NULL;
+	if (pm_ops->release)
+		pm_ops->release(msk);
+
+	bpf_module_put(pm_ops, pm_ops->owner);
+
+	pr_debug("pm %s released\n", pm_ops->name);
+}
+
 void mptcp_pm_destroy(struct mptcp_sock *msk)
 {
 	mptcp_pm_free_anno_list(msk);
-
-	if (mptcp_pm_is_userspace(msk))
-		mptcp_userspace_pm_free_local_addr_list(msk);
+	mptcp_pm_ops_release(msk);
 }
 
 void mptcp_pm_data_reset(struct mptcp_sock *msk)
 {
-	u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk));
+	const struct net *net = sock_net((struct sock *)msk);
+	const char *pm_name = mptcp_get_path_manager(net);
+	u8 pm_type = mptcp_get_pm_type(net);
 	struct mptcp_pm_data *pm = &msk->pm;
 
 	memset(&pm->reset, 0, sizeof(pm->reset));
@@ -988,23 +1017,9 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
 	pm->rm_list_rx.nr = 0;
 	WRITE_ONCE(pm->pm_type, pm_type);
 
-	if (pm_type == MPTCP_PM_TYPE_KERNEL) {
-		bool subflows_allowed = !!mptcp_pm_get_subflows_max(msk);
-
-		/* pm->work_pending must be only be set to 'true' when
-		 * pm->pm_type is set to MPTCP_PM_TYPE_KERNEL
-		 */
-		WRITE_ONCE(pm->work_pending,
-			   (!!mptcp_pm_get_local_addr_max(msk) &&
-			    subflows_allowed) ||
-			   !!mptcp_pm_get_add_addr_signal_max(msk));
-		WRITE_ONCE(pm->accept_addr,
-			   !!mptcp_pm_get_add_addr_accept_max(msk) &&
-			   subflows_allowed);
-		WRITE_ONCE(pm->accept_subflow, subflows_allowed);
-
-		bitmap_fill(pm->id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
-	}
+	rcu_read_lock();
+	mptcp_pm_ops_init(msk, mptcp_pm_find(pm_name));
+	rcu_read_unlock();
 }
 
 void mptcp_pm_data_init(struct mptcp_sock *msk)
net/mptcp/pm_kernel.c +21 -0
index d39e7c178460..687a423f5252 100644
@@ -1398,7 +1398,28 @@ static struct pernet_operations mptcp_pm_pernet_ops = {
 	.size = sizeof(struct pm_nl_pernet),
 };
 
+static void mptcp_pm_kernel_init(struct mptcp_sock *msk)
+{
+	bool subflows_allowed = !!mptcp_pm_get_subflows_max(msk);
+	struct mptcp_pm_data *pm = &msk->pm;
+
+	/* pm->work_pending must be only be set to 'true' when
+	 * pm->pm_type is set to MPTCP_PM_TYPE_KERNEL
+	 */
+	WRITE_ONCE(pm->work_pending,
+		   (!!mptcp_pm_get_local_addr_max(msk) &&
+		    subflows_allowed) ||
+		   !!mptcp_pm_get_add_addr_signal_max(msk));
+	WRITE_ONCE(pm->accept_addr,
+		   !!mptcp_pm_get_add_addr_accept_max(msk) &&
+		   subflows_allowed);
+	WRITE_ONCE(pm->accept_subflow, subflows_allowed);
+
+	bitmap_fill(pm->id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
+}
+
 struct mptcp_pm_ops mptcp_pm_kernel = {
+	.init			= mptcp_pm_kernel_init,
 	.name			= "kernel",
 	.owner			= THIS_MODULE,
 };
net/mptcp/pm_userspace.c +6 -0
index 2cb62f026b1f..6afab631580f 100644
@@ -683,7 +683,13 @@ int mptcp_userspace_pm_get_addr(u8 id, struct mptcp_pm_addr_entry *addr,
 	return ret;
 }
 
+static void mptcp_pm_userspace_release(struct mptcp_sock *msk)
+{
+	mptcp_userspace_pm_free_local_addr_list(msk);
+}
+
 static struct mptcp_pm_ops mptcp_pm_userspace = {
+	.release		= mptcp_pm_userspace_release,
 	.name			= "userspace",
 	.owner			= THIS_MODULE,
 };
net/mptcp/protocol.h +1 -0
index d5eaf78c041f..a1670463519f 100644
@@ -220,6 +220,7 @@ struct mptcp_pm_data {
 	struct mptcp_addr_info remote;
 	struct list_head anno_list;
 	struct list_head userspace_pm_local_addr_list;
+	struct mptcp_pm_ops *ops;
 
 	spinlock_t	lock;		/*protects the whole PM data */
 
Signature · 1 line
2.43.0
author reviewer
#5 lore raw

PATCH v11 5/10 mptcp: pm: add get_local_id() interface

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

This patch adds get_local_id() interface for struct mptcp_sched_ops, then mptcp_pm_get_local_id() can directly invoke get_local_id() interface through "ops" of "msk->pm". Instead of using mptcp_pm_is_userspace() to check which get_local_id() helper to invoke.

Also rename mptcp_pm_nl_get_local_id() to mptcp_pm_kernel_get_local_id() and mptcp_userspace_pm_get_local_id() to mptcp_pm_userspace_get_local_id(), and make them static.

---
 include/net/mptcp.h      | 3 +++
 net/mptcp/pm.c           | 9 ++++++---
 net/mptcp/pm_kernel.c    | 5 +++--
 net/mptcp/pm_userspace.c | 5 +++--
 net/mptcp/protocol.h     | 4 ----
 5 files changed, 15 insertions(+), 11 deletions(-)
include/net/mptcp.h +3 -0
index 69f7b35e57c3..169e19440b03 100644
@@ -116,6 +116,9 @@ struct mptcp_sched_ops {
 #define MPTCP_PM_NAME_MAX	16
 
 struct mptcp_pm_ops {
+	int (*get_local_id)(struct mptcp_sock *msk,
+			    struct mptcp_pm_addr_entry *skc);
+
 	char			name[MPTCP_PM_NAME_MAX];
 	struct module		*owner;
 	struct list_head	list;
net/mptcp/pm.c +6 -3
index bf318cecb242..6eaf072a472a 100644
@@ -872,9 +872,7 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
 	skc_local.addr.id = 0;
 	skc_local.flags = MPTCP_PM_ADDR_FLAG_IMPLICIT;
 
-	if (mptcp_pm_is_userspace(msk))
-		return mptcp_userspace_pm_get_local_id(msk, &skc_local);
-	return mptcp_pm_nl_get_local_id(msk, &skc_local);
+	return msk->pm.ops->get_local_id(msk, &skc_local);
 }
 
 bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc)
@@ -1052,6 +1050,11 @@ struct mptcp_pm_ops *mptcp_pm_find(const char *name)
 
 int mptcp_pm_validate(struct mptcp_pm_ops *pm_ops)
 {
+	if (!pm_ops->get_local_id) {
+		pr_err("%s does not implement required ops\n", pm_ops->name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
net/mptcp/pm_kernel.c +3 -2
index 687a423f5252..1380e529aa02 100644
@@ -693,8 +693,8 @@ static int mptcp_pm_nl_create_listen_socket(struct sock *sk,
 	return err;
 }
 
-int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk,
-			     struct mptcp_pm_addr_entry *skc)
+static int mptcp_pm_kernel_get_local_id(struct mptcp_sock *msk,
+					struct mptcp_pm_addr_entry *skc)
 {
 	struct mptcp_pm_addr_entry *entry;
 	struct pm_nl_pernet *pernet;
@@ -1419,6 +1419,7 @@ static void mptcp_pm_kernel_init(struct mptcp_sock *msk)
 }
 
 struct mptcp_pm_ops mptcp_pm_kernel = {
+	.get_local_id		= mptcp_pm_kernel_get_local_id,
 	.init			= mptcp_pm_kernel_init,
 	.name			= "kernel",
 	.owner			= THIS_MODULE,
net/mptcp/pm_userspace.c +3 -2
index 6afab631580f..81ddc14bc273 100644
@@ -126,8 +126,8 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id)
 	return NULL;
 }
 
-int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,
-				    struct mptcp_pm_addr_entry *skc)
+static int mptcp_pm_userspace_get_local_id(struct mptcp_sock *msk,
+					   struct mptcp_pm_addr_entry *skc)
 {
 	__be16 msk_sport =  ((struct inet_sock *)
 			     inet_sk((struct sock *)msk))->inet_sport;
@@ -689,6 +689,7 @@ static void mptcp_pm_userspace_release(struct mptcp_sock *msk)
 }
 
 static struct mptcp_pm_ops mptcp_pm_userspace = {
+	.get_local_id		= mptcp_pm_userspace_get_local_id,
 	.release		= mptcp_pm_userspace_release,
 	.name			= "userspace",
 	.owner			= THIS_MODULE,
net/mptcp/protocol.h +0 -4
index a1670463519f..282067717b39 100644
@@ -1139,10 +1139,6 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb,
 bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
 			     struct mptcp_rm_list *rm_list);
 int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
-int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk,
-			     struct mptcp_pm_addr_entry *skc);
-int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,
-				    struct mptcp_pm_addr_entry *skc);
 bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc);
 bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
 bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
Signature · 1 line
2.43.0
author reviewer
#6 lore raw

PATCH v11 6/10 mptcp: pm: add get_priority() interface

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

This patch adds get_priority() interface for struct mptcp_sched_ops, then mptcp_pm_is_backup() can directly invoke get_priority() interface through "ops" of "msk->pm". Instead of using mptcp_pm_is_userspace() to check which is_backup() helper to invoke.

Also rename mptcp_pm_nl_is_backup() to mptcp_pm_kernel_get_priority() and mptcp_userspace_pm_is_backup() to mptcp_pm_userspace_get_priority(), and make them static.

---
 include/net/mptcp.h      | 2 ++
 net/mptcp/pm.c           | 7 ++-----
 net/mptcp/pm_kernel.c    | 4 +++-
 net/mptcp/pm_userspace.c | 5 +++--
 net/mptcp/protocol.h     | 2 --
 5 files changed, 10 insertions(+), 10 deletions(-)
include/net/mptcp.h +2 -0
index 169e19440b03..b344b909e749 100644
@@ -118,6 +118,8 @@ struct mptcp_sched_ops {
 struct mptcp_pm_ops {
 	int (*get_local_id)(struct mptcp_sock *msk,
 			    struct mptcp_pm_addr_entry *skc);
+	bool (*get_priority)(struct mptcp_sock *msk,
+			     struct mptcp_addr_info *skc);
 
 	char			name[MPTCP_PM_NAME_MAX];
 	struct module		*owner;
net/mptcp/pm.c +2 -5
index 6eaf072a472a..e4d790ecfe27 100644
@@ -881,10 +881,7 @@ bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc)
 
 	mptcp_local_address((struct sock_common *)skc, &skc_local);
 
-	if (mptcp_pm_is_userspace(msk))
-		return mptcp_userspace_pm_is_backup(msk, &skc_local);
-
-	return mptcp_pm_nl_is_backup(msk, &skc_local);
+	return msk->pm.ops->get_priority(msk, &skc_local);
 }
 
 static void mptcp_pm_subflows_chk_stale(const struct mptcp_sock *msk, struct sock *ssk)
@@ -1050,7 +1047,7 @@ struct mptcp_pm_ops *mptcp_pm_find(const char *name)
 
 int mptcp_pm_validate(struct mptcp_pm_ops *pm_ops)
 {
-	if (!pm_ops->get_local_id) {
+	if (!pm_ops->get_local_id || !pm_ops->get_priority) {
 		pr_err("%s does not implement required ops\n", pm_ops->name);
 		return -EINVAL;
 	}
net/mptcp/pm_kernel.c +3 -1
index 1380e529aa02..7ec81d5195d4 100644
@@ -722,7 +722,8 @@ static int mptcp_pm_kernel_get_local_id(struct mptcp_sock *msk,
 	return ret;
 }
 
-bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc)
+static bool mptcp_pm_kernel_get_priority(struct mptcp_sock *msk,
+					 struct mptcp_addr_info *skc)
 {
 	struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk);
 	struct mptcp_pm_addr_entry *entry;
@@ -1420,6 +1421,7 @@ static void mptcp_pm_kernel_init(struct mptcp_sock *msk)
 
 struct mptcp_pm_ops mptcp_pm_kernel = {
 	.get_local_id		= mptcp_pm_kernel_get_local_id,
+	.get_priority		= mptcp_pm_kernel_get_priority,
 	.init			= mptcp_pm_kernel_init,
 	.name			= "kernel",
 	.owner			= THIS_MODULE,
net/mptcp/pm_userspace.c +3 -2
index 81ddc14bc273..7fc19b844384 100644
@@ -145,8 +145,8 @@ static int mptcp_pm_userspace_get_local_id(struct mptcp_sock *msk,
 	return mptcp_userspace_pm_append_new_local_addr(msk, skc, true);
 }
 
-bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk,
-				  struct mptcp_addr_info *skc)
+static bool mptcp_pm_userspace_get_priority(struct mptcp_sock *msk,
+					    struct mptcp_addr_info *skc)
 {
 	struct mptcp_pm_addr_entry *entry;
 	bool backup;
@@ -690,6 +690,7 @@ static void mptcp_pm_userspace_release(struct mptcp_sock *msk)
 
 static struct mptcp_pm_ops mptcp_pm_userspace = {
 	.get_local_id		= mptcp_pm_userspace_get_local_id,
+	.get_priority		= mptcp_pm_userspace_get_priority,
 	.release		= mptcp_pm_userspace_release,
 	.name			= "userspace",
 	.owner			= THIS_MODULE,
net/mptcp/protocol.h +0 -2
index 282067717b39..d69c9e07e6e6 100644
@@ -1140,8 +1140,6 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
 			     struct mptcp_rm_list *rm_list);
 int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
 bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc);
-bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
-bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
 int mptcp_pm_nl_dump_addr(struct sk_buff *msg,
 			  struct netlink_callback *cb);
 int mptcp_userspace_pm_dump_addr(struct sk_buff *msg,
Signature · 1 line
2.43.0
author reviewer
#7 lore raw

PATCH v11 7/10 mptcp: sysctl: map path_manager to pm_type

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

This patch maps the newly added path manager sysctl "path_manager" to the old one "pm_type".

	path_manager   pm_type

	"kernel"    -> MPTCP_PM_TYPE_KERNEL
	"userspace" -> MPTCP_PM_TYPE_USERSPACE
	others      -> __MPTCP_PM_TYPE_NR
---
 net/mptcp/ctrl.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
net/mptcp/ctrl.c +14 -1
index 4209dc7f9704..cb0811e636ff 100644
@@ -200,6 +200,9 @@ static int mptcp_set_path_manager(char *path_manager, const char *name)
 static int proc_path_manager(const struct ctl_table *ctl, int write,
 			     void *buffer, size_t *lenp, loff_t *ppos)
 {
+	struct mptcp_pernet *pernet = container_of(ctl->data,
+						   struct mptcp_pernet,
+						   path_manager);
 	char (*path_manager)[MPTCP_PM_NAME_MAX] = ctl->data;
 	char pm_name[MPTCP_PM_NAME_MAX];
 	const struct ctl_table tbl = {
@@ -211,8 +214,18 @@ static int proc_path_manager(const struct ctl_table *ctl, int write,
 	strscpy(pm_name, *path_manager, MPTCP_PM_NAME_MAX);
 
 	ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
-	if (write && ret == 0)
+	if (write && ret == 0) {
 		ret = mptcp_set_path_manager(*path_manager, pm_name);
+		if (ret == 0) {
+			u8 pm_type = __MPTCP_PM_TYPE_NR;
+
+			if (strncmp(pm_name, "kernel", MPTCP_PM_NAME_MAX) == 0)
+				pm_type = MPTCP_PM_TYPE_KERNEL;
+			else if (strncmp(pm_name, "userspace", MPTCP_PM_NAME_MAX) == 0)
+				pm_type = MPTCP_PM_TYPE_USERSPACE;
+			pernet->pm_type = pm_type;
+		}
+	}
 
 	return ret;
 }
Signature · 1 line
2.43.0
author reviewer
#8 lore raw

PATCH v11 8/10 mptcp: sysctl: map pm_type to path_manager

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

This patch adds a new proc_handler "proc_pm_type" for "pm_type" to map old path manager sysctl "pm_type" to the newly added "path_manager".

	path_manager		   pm_type

	MPTCP_PM_TYPE_KERNEL    -> "kernel"
	MPTCP_PM_TYPE_USERSPACE -> "userspace"
---
 net/mptcp/ctrl.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
net/mptcp/ctrl.c +24 -1
index cb0811e636ff..4d8b31f32eb5 100644
@@ -230,6 +230,29 @@ static int proc_path_manager(const struct ctl_table *ctl, int write,
 	return ret;
 }
 
+static int proc_pm_type(const struct ctl_table *ctl, int write,
+			void *buffer, size_t *lenp, loff_t *ppos)
+{
+	struct mptcp_pernet *pernet = container_of(ctl->data,
+						   struct mptcp_pernet,
+						   pm_type);
+	int ret;
+
+	ret = proc_dou8vec_minmax(ctl, write, buffer, lenp, ppos);
+	if (write && ret == 0) {
+		u8 pm_type = READ_ONCE(*(u8 *)ctl->data);
+		char *pm_name = "";
+
+		if (pm_type == MPTCP_PM_TYPE_KERNEL)
+			pm_name = "kernel";
+		else if (pm_type == MPTCP_PM_TYPE_USERSPACE)
+			pm_name = "userspace";
+		mptcp_set_path_manager(pernet->path_manager, pm_name);
+	}
+
+	return ret;
+}
+
 static struct ctl_table mptcp_sysctl_table[] = {
 	{
 		.procname = "enabled",
@@ -274,7 +297,7 @@ static struct ctl_table mptcp_sysctl_table[] = {
 		.procname = "pm_type",
 		.maxlen = sizeof(u8),
 		.mode = 0644,
-		.proc_handler = proc_dou8vec_minmax,
+		.proc_handler = proc_pm_type,
 		.extra1       = SYSCTL_ZERO,
 		.extra2       = &mptcp_pm_type_max
 	},
Signature · 1 line
2.43.0
author reviewer
#9 lore raw

PATCH v11 9/10 mptcp: sysctl: add available_path_managers

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

Similarly to net.mptcp.available_schedulers, this patch adds a new one net.mptcp.available_path_managers to list the available path managers.

---
 Documentation/networking/mptcp-sysctl.rst |  4 ++++
 include/net/mptcp.h                       |  2 ++
 net/mptcp/ctrl.c                          | 25 +++++++++++++++++++++++
 net/mptcp/pm.c                            | 19 +++++++++++++++++
 net/mptcp/protocol.h                      |  1 +
 5 files changed, 51 insertions(+)
Documentation/networking/mptcp-sysctl.rst +4 -0
index b78a2254d452..5bfab01eff5a 100644
@@ -30,6 +30,10 @@ allow_join_initial_addr_port - BOOLEAN
 
 	Default: 1
 
+available_path_managers - STRING
+	Shows the available path managers choices that are registered. More
+	path managers may be available, but not loaded.
+
 available_schedulers - STRING
 	Shows the available schedulers choices that are registered. More packet
 	schedulers may be available, but not loaded.
include/net/mptcp.h +2 -0
index b344b909e749..6a08ac862bbe 100644
@@ -114,6 +114,8 @@ struct mptcp_sched_ops {
 } ____cacheline_aligned_in_smp;
 
 #define MPTCP_PM_NAME_MAX	16
+#define MPTCP_PM_MAX		128
+#define MPTCP_PM_BUF_MAX	(MPTCP_PM_NAME_MAX * MPTCP_PM_MAX)
 
 struct mptcp_pm_ops {
 	int (*get_local_id)(struct mptcp_sock *msk,
net/mptcp/ctrl.c +25 -0
index 4d8b31f32eb5..d9290c5bb6c7 100644
@@ -253,6 +253,24 @@ static int proc_pm_type(const struct ctl_table *ctl, int write,
 	return ret;
 }
 
+static int proc_available_path_managers(const struct ctl_table *ctl,
+					int write, void *buffer,
+					size_t *lenp, loff_t *ppos)
+{
+	struct ctl_table tbl = { .maxlen = MPTCP_PM_BUF_MAX, };
+	int ret;
+
+	tbl.data = kmalloc(tbl.maxlen, GFP_USER);
+	if (!tbl.data)
+		return -ENOMEM;
+
+	mptcp_pm_get_available(tbl.data, MPTCP_PM_BUF_MAX);
+	ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
+	kfree(tbl.data);
+
+	return ret;
+}
+
 static struct ctl_table mptcp_sysctl_table[] = {
 	{
 		.procname = "enabled",
@@ -338,6 +356,12 @@ static struct ctl_table mptcp_sysctl_table[] = {
 		.mode = 0644,
 		.proc_handler = proc_path_manager,
 	},
+	{
+		.procname = "available_path_managers",
+		.maxlen	= MPTCP_PM_BUF_MAX,
+		.mode = 0444,
+		.proc_handler = proc_available_path_managers,
+	},
 };
 
 static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
@@ -364,6 +388,7 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
 	table[9].data = &pernet->blackhole_timeout;
 	table[10].data = &pernet->syn_retrans_before_tcp_fallback;
 	table[11].data = &pernet->path_manager;
+	/* table[12] is for available_path_managers which is read-only info */
 
 	hdr = register_net_sysctl_sz(net, MPTCP_SYSCTL_PATH, table,
 				     ARRAY_SIZE(mptcp_sysctl_table));
net/mptcp/pm.c +19 -0
index e4d790ecfe27..ba7424582ebf 100644
@@ -1085,3 +1085,22 @@ void mptcp_pm_unregister(struct mptcp_pm_ops *pm_ops)
 	list_del_rcu(&pm_ops->list);
 	spin_unlock(&mptcp_pm_list_lock);
 }
+
+/* Build string with list of available path manager values.
+ * Similar to tcp_get_available_congestion_control()
+ */
+void mptcp_pm_get_available(char *buf, size_t maxlen)
+{
+	struct mptcp_pm_ops *pm_ops;
+	size_t offs = 0;
+
+	rcu_read_lock();
+	list_for_each_entry_rcu(pm_ops, &mptcp_pm_list, list) {
+		offs += snprintf(buf + offs, maxlen - offs, "%s%s",
+				 offs == 0 ? "" : " ", pm_ops->name);
+
+		if (WARN_ON_ONCE(offs >= maxlen))
+			break;
+	}
+	rcu_read_unlock();
+}
net/mptcp/protocol.h +1 -0
index d69c9e07e6e6..d9ca3a19a218 100644
@@ -1061,6 +1061,7 @@ struct mptcp_pm_ops *mptcp_pm_find(const char *name);
 int mptcp_pm_register(struct mptcp_pm_ops *pm_ops);
 void mptcp_pm_unregister(struct mptcp_pm_ops *pm_ops);
 int mptcp_pm_validate(struct mptcp_pm_ops *pm_ops);
+void mptcp_pm_get_available(char *buf, size_t maxlen);
 
 void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk);
 
Signature · 1 line
2.43.0
author reviewer
#10 lore raw

PATCH v11 10/10 selftests: mptcp: add pm sysctl mapping tests

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

This patch checks if the newly added net.mptcp.path_manager is mapped successfully from or to the old net.mptcp.pm_type in userspace_pm.sh.

---
 .../selftests/net/mptcp/userspace_pm.sh       | 30 ++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/userspace_pm.sh +29 -1
index 3651f73451cf..333064b0b5ac 100755
@@ -117,7 +117,36 @@ cleanup()
 trap cleanup EXIT
 
 # Create and configure network namespaces for testing
+print_title "Init"
 mptcp_lib_ns_init ns1 ns2
+
+# check path_manager and pm_type sysctl mapping
+if [ -f /proc/sys/net/mptcp/path_manager ]; then
+	ip netns exec "$ns1" sysctl -q net.mptcp.path_manager=userspace
+	pm_type="$(ip netns exec "$ns1" 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
+
+	ip netns exec "$ns1" sysctl -q net.mptcp.path_manager=error 2>/dev/null
+	pm_type="$(ip netns exec "$ns1" sysctl -n net.mptcp.pm_type)"
+	if [ "${pm_type}" != "1" ]; then
+		test_fail "unexpected pm_type after error: ${pm_type}"
+		mptcp_lib_result_print_all_tap
+		exit ${KSFT_FAIL}
+	fi
+
+	ip netns exec "$ns1" sysctl -q net.mptcp.pm_type=0
+	pm_name="$(ip netns exec "$ns1" sysctl -n net.mptcp.path_manager)"
+	if [ "${pm_name}" != "kernel" ]; then
+		test_fail "unexpected path-manager: ${pm_name}"
+		mptcp_lib_result_print_all_tap
+		exit ${KSFT_FAIL}
+	fi
+fi
+
 for i in "$ns1" "$ns2" ;do
 	ip netns exec "$i" sysctl -q net.mptcp.pm_type=1
 done
@@ -152,7 +181,6 @@ mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid
 sleep 0.5
 mptcp_lib_subtests_last_ts_reset
 
-print_title "Init"
 print_test "Created network namespaces ns1, ns2"
 test_pass
 
Signature · 1 line
2.43.0
author reviewer
#11 lore raw
In reply to Geliang Tang
Quoted 9 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v11:
 - add bitmap_fill(id_avail_bitmap) in mptcp_pm_kernel_init.
 - squash mptcp_pm_validate into "mptcp: pm: define struct mptcp_pm_ops".
 - map path_manager to pm_type after mptcp_set_path_manager().
 - change 'char *pm_name = "unknown"' to 'char *pm_name = ""'.
 - update pm mapping selftests.

Sorry, I forgot to add "Based-on" here. So I resend this v11 to trigger CI tests. Sorry for the mess.

Thanks,
-Geliang

Quoted 101 lines

v10:
 - drop pm->init in mptcp_pm_validate, move mptcp_pm_validate into a new
   patch.
 - remove tlb, use ctl instead in proc_pm_type.
 - use "strncmp() == 0" instead of "!strncmp()".
 - set pm_type __MPTCP_PM_TYPE_NR for other names.
 - add WARN_ON_ONCE in mptcp_pm_unregister.
 - drop mptcp_userspace_pm_init.
 - rename "struct mptcp_pm_ops *pm" to "struct mptcp_pm_ops *pm_ops".
 - drop pm_ops NULL check in mptcp_pm_release.
 - add struct_group for struct mptcp_pm_data.
 - move selftests into userspace_pm.sh.

v9:
 - rename mptcp_pm_nl_ prefix to mptcp_pm_kernel_.
 - rename mptcp_userspace_pm_ prefix to mptcp_pm_userspace_.
 - update commit logs.

v8:
 - address Matt's comments in v7.

v7:
 - addresss Matt's comments in v6 [1].
 - drop "type" from struct mptcp_pm_ops as Matt suggested.
 - map "pm_type" to new sysctl as Matt suggested.

v6:
 - add "name" in struct mptcp_pm_ops.
 - add some "sysctl" patches.
 - drop "struct mptcp_pm_param".
 - drop "pm_type" in mptcp_pm_data.

v5:
 - use "struct mptcp_pm_param *param" as unified parameters for all interfaces.
 - register in-kernel mptcp_pm_ops too.
 - only implement two interfaces "get_local_id" and "get_priority" in this set.

v4:
 - include a new patch "define BPF path manager type".

 - add new interfaces:
created established closed
listerner_created listener_closed

 - rename interfaces as:
address_announced address_removed
subflow_established subflow_closed
get_priority set_priority

 - rename functions as:
mptcp_pm_validate
mptcp_pm_register
mptcp_pm_unregister
mptcp_pm_initialize
mptcp_pm_release

v3:
 - rename the 2nd parameter of get_local_id() from 'local' to 'skc'.
 - keep the 'msk_sport' check in mptcp_userspace_pm_get_local_id().
 - return 'err' instead of '0' in userspace_pm_subflow_create().
 - drop 'ret' variable inmptcp_pm_data_reset().
 - fix typos in commit log.

v2:
 - update get_local_id interface in patch 2.

get_addr() and dump_addr() interfaces of BPF userspace pm are dropped as Matt suggested.

In order to implement BPF path manager, it's necessary to unify the interfaces of the path manager. This set contains some cleanups and refactoring to unify the interfaces in kernel space. Finally, define a struct mptcp_pm_ops for a path manager.

Geliang Tang (10):
  mptcp: pm: define struct mptcp_pm_ops
  mptcp: pm: register in-kernel and userspace PM
  mptcp: sysctl: set path manager by name
  mptcp: pm: init and release mptcp_pm_ops
  mptcp: pm: add get_local_id() interface
  mptcp: pm: add get_priority() interface
  mptcp: sysctl: map path_manager to pm_type
  mptcp: sysctl: map pm_type to path_manager
  mptcp: sysctl: add available_path_managers
  selftests: mptcp: add pm sysctl mapping tests

 Documentation/networking/mptcp-sysctl.rst     |  23 +++ include/net/mptcp.h                           |  19 +++ net/mptcp/ctrl.c                              | 113 +++++++++++++- net/mptcp/pm.c                                | 145 ++++++++++++++-- --
 net/mptcp/pm_kernel.c                         |  37 ++++- net/mptcp/pm_userspace.c                      |  26 +++- net/mptcp/protocol.h                          |  18 ++- .../selftests/net/mptcp/userspace_pm.sh       |  30 +++-

 8 files changed, 368 insertions(+), 43 deletions(-)
maintainer
#12 lore raw

Hi Geliang,

Quoted 11 lines · Geliang Tang
Quoted 9 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v11:
 - add bitmap_fill(id_avail_bitmap) in mptcp_pm_kernel_init.
 - squash mptcp_pm_validate into "mptcp: pm: define struct mptcp_pm_ops".
 - map path_manager to pm_type after mptcp_set_path_manager().
 - change 'char *pm_name = "unknown"' to 'char *pm_name = ""'.
 - update pm mapping selftests.

Quoted 2 lines

Sorry, I forgot to add "Based-on" here. So I resend this v11 to trigger CI tests. Sorry for the mess.

No problem, I forced things to get it working. The CI should start soon.

To get this working next time, simply send me an email, and if I'm not responding, you need to send a new version if anything is being changed in the patches, including the inclusion of this "Based-on" tag.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
#13 lore raw
In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Unstable: 1 failed test(s): bpftest_test_progs_mptcp 🔴
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/13784337084

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/cf4f2ea21e3e
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=942579

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)

maintainer Reviewed-by on the v11 series
#14 lore raw
In reply to Geliang Tang

Hi Geliang,

Quoted 9 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v11:
- add bitmap_fill(id_avail_bitmap) in mptcp_pm_kernel_init.
- squash mptcp_pm_validate into "mptcp: pm: define struct mptcp_pm_ops".
- map path_manager to pm_type after mptcp_set_path_manager().
- change 'char *pm_name = "unknown"' to 'char *pm_name = ""'.
- update pm mapping selftests.

Thank you for the new version!

It looks good to me:

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#15 lore raw
Quoted 13 lines · Matthieu Baerts

Hi Geliang,

Quoted 9 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v11:
- add bitmap_fill(id_avail_bitmap) in mptcp_pm_kernel_init.
- squash mptcp_pm_validate into "mptcp: pm: define struct mptcp_pm_ops".
- map path_manager to pm_type after mptcp_set_path_manager().
- change 'char *pm_name = "unknown"' to 'char *pm_name = ""'.
- update pm mapping selftests.

Quoted 1 line

Thank you for the new version!

Now in our tree (feat. for net-next):

New patches for t/upstream:
- 65af42fa552d: mptcp: pm: define struct mptcp_pm_ops
- 60dbf3c5392c: mptcp: pm: register in-kernel and userspace PM
- 16f4a1ec2359: mptcp: sysctl: set path manager by name
- 59f4fd0d9b0b: mptcp: sysctl: map path_manager to pm_type
- 7e3dbe52536d: mptcp: sysctl: map pm_type to path_manager
- ae2be6b1ab64: mptcp: sysctl: add available_path_managers
- dc69452c20e5: selftests: mptcp: add pm sysctl mapping tests
- 9c827852b057: mptcp: pm: init and release mptcp_pm_ops
- cc6386364b56: mptcp: pm: add get_local_id() interface
- 75a9b54d9647: mptcp: pm: add get_priority() interface
- Results: 336906910afb..ef50eaa97a0c (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/153a4b172efa4822ab857d7298e29fac02df6c13/checks

I slightly changed the order to regroup the sysctl ones, because I might need to split the series when sending this upstream with other patches.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.