Skip to content

Commit ce988b8

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
mptcp: sysctl: map pm_type to path_manager
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" Signed-off-by: Geliang Tang <[email protected]>
1 parent 11707d8 commit ce988b8

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

net/mptcp/ctrl.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,29 @@ static int proc_path_manager(const struct ctl_table *ctl, int write,
228228
return ret;
229229
}
230230

231+
static int proc_pm_type(const struct ctl_table *ctl, int write,
232+
void *buffer, size_t *lenp, loff_t *ppos)
233+
{
234+
struct mptcp_pernet *pernet = container_of(ctl->data,
235+
struct mptcp_pernet,
236+
pm_type);
237+
int ret;
238+
239+
ret = proc_dou8vec_minmax(ctl, write, buffer, lenp, ppos);
240+
if (write && ret == 0) {
241+
u8 pm_type = READ_ONCE(*(u8 *)ctl->data);
242+
char *pm_name = "unknown";
243+
244+
if (pm_type == MPTCP_PM_TYPE_KERNEL)
245+
pm_name = "kernel";
246+
else if (pm_type == MPTCP_PM_TYPE_USERSPACE)
247+
pm_name = "userspace";
248+
mptcp_set_path_manager(pernet->path_manager, pm_name);
249+
}
250+
251+
return ret;
252+
}
253+
231254
static struct ctl_table mptcp_sysctl_table[] = {
232255
{
233256
.procname = "enabled",
@@ -272,7 +295,7 @@ static struct ctl_table mptcp_sysctl_table[] = {
272295
.procname = "pm_type",
273296
.maxlen = sizeof(u8),
274297
.mode = 0644,
275-
.proc_handler = proc_dou8vec_minmax,
298+
.proc_handler = proc_pm_type,
276299
.extra1 = SYSCTL_ZERO,
277300
.extra2 = &mptcp_pm_type_max
278301
},

0 commit comments

Comments
 (0)