From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v7 03/11] mptcp: sysctl: map pm_type to path_manager
Date: Mon, 3 Mar 2025 11:40:53 +0100 [thread overview]
Message-ID: <4a3aeb25-5fc4-4e31-aa74-c2203c3ada2d@kernel.org> (raw)
In-Reply-To: <8840912119ce5a1180550745d496087ac7e81fa0.1740975633.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 03/03/2025 05:22, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> 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".
Don't forget to add a selftest checking this new sysctl and the mapping
are correct, e.g. in userspace_pm.sh. See my previous comment:
https://lore.kernel.org/c49517d2-38e2-4848-9fb9-1c7748689cec@kernel.org
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/ctrl.c | 33 ++++++++++++++++++++++++++++++---
> 1 file changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
> index d64e6b4f6d1d..32f13ab7db0a 100644
> --- a/net/mptcp/ctrl.c
> +++ b/net/mptcp/ctrl.c
> @@ -217,6 +217,35 @@ 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);
Out of curiosity, do you plan to drop pernet->pm_type later on?
When all the mptcp_pm_is_{kernel,userspace}() will be dropped, I think
we can also drop it from the mptcp_pernet structure. At that point, we
could then read info from "path_manager" and write in ctl->data 0, 1, or
2. But only when we will no longer use pernet->pm_type.
> + unsigned int val = READ_ONCE(*(u8 *)ctl->data);
> + const struct ctl_table tbl = {
> + .maxlen = sizeof(val),
> + .data = &val,
> + };
> + int ret;
> +
> + if (val > mptcp_pm_type_max)
> + return -ERANGE;
You might not need this if ...
> +
> + ret = proc_douintvec(&tbl, write, buffer, lenp, ppos);
... you use proc_dou8vec_minmax() here and ...
> + if (write && ret == 0) {
> + char *path_manager = "kernel";
> +
> + if (val == MPTCP_PM_TYPE_USERSPACE)
> + path_manager = "userspace";
> + mptcp_set_path_manager(pernet->path_manager, path_manager);
> + WRITE_ONCE(*(u8 *)ctl->data, val);
> + }
> +
> + return ret;
> +}
> +
> static struct ctl_table mptcp_sysctl_table[] = {
> {
> .procname = "enabled",
> @@ -261,9 +290,7 @@ static struct ctl_table mptcp_sysctl_table[] = {
> .procname = "pm_type",
> .maxlen = sizeof(u8),
> .mode = 0644,
> - .proc_handler = proc_dou8vec_minmax,
> - .extra1 = SYSCTL_ZERO,
> - .extra2 = &mptcp_pm_type_max
... you keep these two last lines.
> + .proc_handler = proc_pm_type,
> },
> {
> .procname = "scheduler",
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-03-03 10:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 4:22 [PATCH mptcp-next v7 00/11] BPF path manager, part 5 Geliang Tang
2025-03-03 4:22 ` [PATCH mptcp-next v7 01/11] mptcp: pm: define struct mptcp_pm_ops Geliang Tang
2025-03-03 10:39 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 02/11] mptcp: sysctl: new sysctl to set path manager by name Geliang Tang
2025-03-03 10:40 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 03/11] mptcp: sysctl: map pm_type to path_manager Geliang Tang
2025-03-03 10:40 ` Matthieu Baerts [this message]
2025-03-03 4:22 ` [PATCH mptcp-next v7 04/11] mptcp: sysctl: add available_path_managers Geliang Tang
2025-03-03 10:41 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 05/11] mptcp: pm: in-kernel: register mptcp_kernel_pm Geliang Tang
2025-03-03 10:42 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 06/11] mptcp: pm: userspace: register mptcp_userspace_pm Geliang Tang
2025-03-03 10:52 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 07/11] mptcp: pm: initialize and release mptcp_pm_ops Geliang Tang
2025-03-03 10:53 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 08/11] mptcp: pm: drop pm_type in mptcp_pm_data Geliang Tang
2025-03-03 10:57 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 09/11] mptcp: sysctl: drop get_pm_type helper Geliang Tang
2025-03-03 10:57 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 10/11] mptcp: pm: make get_local_id helpers static Geliang Tang
2025-03-03 10:58 ` Matthieu Baerts
2025-03-03 4:22 ` [PATCH mptcp-next v7 11/11] mptcp: pm: make is_backup " Geliang Tang
2025-03-03 5:32 ` [PATCH mptcp-next v7 00/11] BPF path manager, part 5 MPTCP CI
2025-03-03 10:38 ` Matthieu Baerts
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=4a3aeb25-5fc4-4e31-aa74-c2203c3ada2d@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/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