Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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"

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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250313-net-next-mptcp-pm-ops-intro-v1-10-f4e4a88efc50@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Geliang Tang and committed by
Paolo Abeni
7982ed0e 573b6534

+24 -1
+24 -1
net/mptcp/ctrl.c
··· 230 230 return ret; 231 231 } 232 232 233 + static int proc_pm_type(const struct ctl_table *ctl, int write, 234 + void *buffer, size_t *lenp, loff_t *ppos) 235 + { 236 + struct mptcp_pernet *pernet = container_of(ctl->data, 237 + struct mptcp_pernet, 238 + pm_type); 239 + int ret; 240 + 241 + ret = proc_dou8vec_minmax(ctl, write, buffer, lenp, ppos); 242 + if (write && ret == 0) { 243 + u8 pm_type = READ_ONCE(*(u8 *)ctl->data); 244 + char *pm_name = ""; 245 + 246 + if (pm_type == MPTCP_PM_TYPE_KERNEL) 247 + pm_name = "kernel"; 248 + else if (pm_type == MPTCP_PM_TYPE_USERSPACE) 249 + pm_name = "userspace"; 250 + mptcp_set_path_manager(pernet->path_manager, pm_name); 251 + } 252 + 253 + return ret; 254 + } 255 + 233 256 static struct ctl_table mptcp_sysctl_table[] = { 234 257 { 235 258 .procname = "enabled", ··· 297 274 .procname = "pm_type", 298 275 .maxlen = sizeof(u8), 299 276 .mode = 0644, 300 - .proc_handler = proc_dou8vec_minmax, 277 + .proc_handler = proc_pm_type, 301 278 .extra1 = SYSCTL_ZERO, 302 279 .extra2 = &mptcp_pm_type_max 303 280 },