linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 09/12] mptcp: sysctl: map path_manager to pm_type
Date: Thu, 13 Mar 2025 11:20:58 +0100	[thread overview]
Message-ID: <20250313-net-next-mptcp-pm-ops-intro-v1-9-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>

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

It is important to add this to keep a compatibility with the now
deprecated pm_type sysctl knob.

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>
---
 net/mptcp/ctrl.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
index 4209dc7f97048d27deea1923742dfd5ebd710694..cb0811e636ff2f4bb981d2688eb8d07946fc1744 100644
--- a/net/mptcp/ctrl.c
+++ b/net/mptcp/ctrl.c
@@ -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;
 }

-- 
2.48.1


  parent reply	other threads:[~2025-03-13 10:23 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 ` [PATCH net-next 08/12] mptcp: sysctl: set path manager by name Matthieu Baerts (NGI0)
2025-03-18 17:24   ` Simon Horman
2025-03-13 10:20 ` Matthieu Baerts (NGI0) [this message]
2025-03-18 17:24   ` [PATCH net-next 09/12] mptcp: sysctl: map path_manager to pm_type 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-9-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).