From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
To: mptcp@lists.linux.dev, Mat Martineau <martineau@kernel.org>,
Geliang Tang <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
"Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
Geliang Tang <geliang@kernel.org>
Subject: [PATCH net-next 08/12] mptcp: sysctl: set path manager by name
Date: Thu, 13 Mar 2025 11:20:57 +0100 [thread overview]
Message-ID: <20250313-net-next-mptcp-pm-ops-intro-v1-8-f4e4a88efc50@kernel.org> (raw)
In-Reply-To: <20250313-net-next-mptcp-pm-ops-intro-v1-0-f4e4a88efc50@kernel.org>
From: Geliang Tang <tanggeliang@kylinos.cn>
Similar to net.mptcp.scheduler, a new net.mptcp.path_manager sysctl knob
is added to determine which path manager will be used by each newly
created MPTCP socket by setting the name of it.
Dealing with an explicit name is easier than with a number, especially
when more PMs will be introduced.
This sysctl knob makes the old one "pm_type" deprecated.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Documentation/networking/mptcp-sysctl.rst | 19 ++++++++++++
net/mptcp/ctrl.c | 50 +++++++++++++++++++++++++++++++
net/mptcp/protocol.h | 1 +
3 files changed, 70 insertions(+)
diff --git a/Documentation/networking/mptcp-sysctl.rst b/Documentation/networking/mptcp-sysctl.rst
index 03e1d3610333e29423b0f40591c9e914dc2d0366..b78a2254d4523e0c0fa09338d4b676da18f82d97 100644
--- a/Documentation/networking/mptcp-sysctl.rst
+++ b/Documentation/networking/mptcp-sysctl.rst
@@ -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
diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
index be6c0237e10bfd7520edd3c57ec43ce4377b97d5..4209dc7f97048d27deea1923742dfd5ebd710694 100644
--- a/net/mptcp/ctrl.c
+++ b/net/mptcp/ctrl.c
@@ -39,6 +39,7 @@ struct mptcp_pernet {
u8 allow_join_initial_addr_port;
u8 pm_type;
char scheduler[MPTCP_SCHED_NAME_MAX];
+ char path_manager[MPTCP_PM_NAME_MAX];
};
static struct mptcp_pernet *mptcp_get_pernet(const struct net *net)
@@ -83,6 +84,11 @@ int mptcp_get_pm_type(const struct net *net)
return mptcp_get_pernet(net)->pm_type;
}
+const char *mptcp_get_path_manager(const struct net *net)
+{
+ return mptcp_get_pernet(net)->path_manager;
+}
+
const char *mptcp_get_scheduler(const struct net *net)
{
return mptcp_get_pernet(net)->scheduler;
@@ -101,6 +107,7 @@ static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
pernet->stale_loss_cnt = 4;
pernet->pm_type = MPTCP_PM_TYPE_KERNEL;
strscpy(pernet->scheduler, "default", sizeof(pernet->scheduler));
+ strscpy(pernet->path_manager, "kernel", sizeof(pernet->path_manager));
}
#ifdef CONFIG_SYSCTL
@@ -174,6 +181,42 @@ static int proc_blackhole_detect_timeout(const struct ctl_table *table,
return ret;
}
+static int mptcp_set_path_manager(char *path_manager, const char *name)
+{
+ struct mptcp_pm_ops *pm_ops;
+ int ret = 0;
+
+ rcu_read_lock();
+ pm_ops = mptcp_pm_find(name);
+ if (pm_ops)
+ strscpy(path_manager, name, MPTCP_PM_NAME_MAX);
+ else
+ ret = -ENOENT;
+ rcu_read_unlock();
+
+ return ret;
+}
+
+static int proc_path_manager(const struct ctl_table *ctl, int write,
+ void *buffer, size_t *lenp, loff_t *ppos)
+{
+ char (*path_manager)[MPTCP_PM_NAME_MAX] = ctl->data;
+ char pm_name[MPTCP_PM_NAME_MAX];
+ const struct ctl_table tbl = {
+ .data = pm_name,
+ .maxlen = MPTCP_PM_NAME_MAX,
+ };
+ int ret;
+
+ strscpy(pm_name, *path_manager, MPTCP_PM_NAME_MAX);
+
+ ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
+ if (write && ret == 0)
+ ret = mptcp_set_path_manager(*path_manager, pm_name);
+
+ return ret;
+}
+
static struct ctl_table mptcp_sysctl_table[] = {
{
.procname = "enabled",
@@ -253,6 +296,12 @@ static struct ctl_table mptcp_sysctl_table[] = {
.mode = 0644,
.proc_handler = proc_dou8vec_minmax,
},
+ {
+ .procname = "path_manager",
+ .maxlen = MPTCP_PM_NAME_MAX,
+ .mode = 0644,
+ .proc_handler = proc_path_manager,
+ },
};
static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
@@ -278,6 +327,7 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
table[8].data = &pernet->close_timeout;
table[9].data = &pernet->blackhole_timeout;
table[10].data = &pernet->syn_retrans_before_tcp_fallback;
+ table[11].data = &pernet->path_manager;
hdr = register_net_sysctl_sz(net, MPTCP_SYSCTL_PATH, table,
ARRAY_SIZE(mptcp_sysctl_table));
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index c9e435a1fd7c7ab22a279c6de7c1573fe45cee98..818c2c648677c255a00d668ab9b7406f0731fcf8 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -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);
--
2.48.1
next prev parent reply other threads:[~2025-03-13 10:22 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 10:20 [PATCH net-next 00/12] mptcp: pm: prep work for new ops and sysctl knobs Matthieu Baerts (NGI0)
2025-03-13 10:20 ` [PATCH net-next 01/12] mptcp: pm: split netlink and in-kernel init Matthieu Baerts (NGI0)
2025-03-18 17:20 ` Simon Horman
2025-03-13 10:20 ` [PATCH net-next 02/12] mptcp: pm: in-kernel: use kmemdup helper Matthieu Baerts (NGI0)
2025-03-18 17:20 ` Simon Horman
2025-03-13 10:20 ` [PATCH net-next 03/12] mptcp: pm: use pm variable instead of msk->pm Matthieu Baerts (NGI0)
2025-03-18 17:20 ` Simon Horman
2025-03-13 10:20 ` [PATCH net-next 04/12] mptcp: pm: only fill id_avail_bitmap for in-kernel pm Matthieu Baerts (NGI0)
2025-03-18 17:22 ` Simon Horman
2025-03-13 10:20 ` [PATCH net-next 05/12] mptcp: pm: add struct_group in mptcp_pm_data Matthieu Baerts (NGI0)
2025-03-18 17:23 ` Simon Horman
2025-03-13 10:20 ` [PATCH net-next 06/12] mptcp: pm: define struct mptcp_pm_ops Matthieu Baerts (NGI0)
2025-03-18 17:23 ` Simon Horman
2025-03-13 10:20 ` [PATCH net-next 07/12] mptcp: pm: register in-kernel and userspace PM Matthieu Baerts (NGI0)
2025-03-18 17:23 ` Simon Horman
2025-03-13 10:20 ` Matthieu Baerts (NGI0) [this message]
2025-03-18 17:24 ` [PATCH net-next 08/12] mptcp: sysctl: set path manager by name Simon Horman
2025-03-13 10:20 ` [PATCH net-next 09/12] mptcp: sysctl: map path_manager to pm_type Matthieu Baerts (NGI0)
2025-03-18 17:24 ` Simon Horman
2025-03-13 10:20 ` [PATCH net-next 10/12] mptcp: sysctl: map pm_type to path_manager Matthieu Baerts (NGI0)
2025-03-18 17:24 ` Simon Horman
2025-03-13 10:21 ` [PATCH net-next 11/12] mptcp: sysctl: add available_path_managers Matthieu Baerts (NGI0)
2025-03-18 17:24 ` Simon Horman
2025-03-13 10:21 ` [PATCH net-next 12/12] selftests: mptcp: add pm sysctl mapping tests Matthieu Baerts (NGI0)
2025-03-18 17:25 ` Simon Horman
2025-03-20 9:30 ` [PATCH net-next 00/12] mptcp: pm: prep work for new ops and sysctl knobs patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250313-net-next-mptcp-pm-ops-intro-v1-8-f4e4a88efc50@kernel.org \
--to=matttbe@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).