Message ID | f96a373f1deb84ab24623e546067bdf47c52bb57.1741258415.git.tanggeliang@kylinos.cn (mailing list archive) |
---|---|
State | Superseded |
Commit | 59f4fd0d9b0b2739f63d516b13e57be5c12f28b4 |
Headers | show |
Series | BPF path manager, part 5 | expand |
Context | Check | Description |
---|---|---|
matttbe/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 37 lines checked |
matttbe/shellcheck | success | MPTCP selftests files have not been modified |
matttbe/build | success | Build and static analysis OK |
matttbe/KVM_Validation__normal | success | Success! ✅ |
matttbe/KVM_Validation__debug | success | Success! ✅ |
matttbe/KVM_Validation__btf-normal__only_bpftest_all_ | success | Success! ✅ |
matttbe/KVM_Validation__btf-debug__only_bpftest_all_ | success | Success! ✅ |
Hi Geliang, On 06/03/2025 12:01, 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". > > path_manager pm_type > > MPTCP_PM_TYPE_KERNEL -> "kernel" > MPTCP_PM_TYPE_USERSPACE -> "userspace" > > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> > --- > net/mptcp/ctrl.c | 25 ++++++++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c > index 6a35e6bb0a63..357083977ba5 100644 > --- a/net/mptcp/ctrl.c > +++ b/net/mptcp/ctrl.c > @@ -228,6 +228,29 @@ 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); > + int ret; > + > + ret = proc_dou8vec_minmax(ctl, write, buffer, lenp, ppos); > + if (write && ret == 0) { > + u8 pm_type = READ_ONCE(*(u8 *)ctl->data); > + char *pm_name = "unknown"; Small detail: thanks to proc_dou8vec_minmax, pm_name cannot be "unknown": it should only be 0 or 1. Then you can either not assign it, or assign it to an empty string "just in case"? Cheers, Matt
diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c index 6a35e6bb0a63..357083977ba5 100644 --- a/net/mptcp/ctrl.c +++ b/net/mptcp/ctrl.c @@ -228,6 +228,29 @@ 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); + int ret; + + ret = proc_dou8vec_minmax(ctl, write, buffer, lenp, ppos); + if (write && ret == 0) { + u8 pm_type = READ_ONCE(*(u8 *)ctl->data); + char *pm_name = "unknown"; + + if (pm_type == MPTCP_PM_TYPE_KERNEL) + pm_name = "kernel"; + else if (pm_type == MPTCP_PM_TYPE_USERSPACE) + pm_name = "userspace"; + mptcp_set_path_manager(pernet->path_manager, pm_name); + } + + return ret; +} + static struct ctl_table mptcp_sysctl_table[] = { { .procname = "enabled", @@ -272,7 +295,7 @@ static struct ctl_table mptcp_sysctl_table[] = { .procname = "pm_type", .maxlen = sizeof(u8), .mode = 0644, - .proc_handler = proc_dou8vec_minmax, + .proc_handler = proc_pm_type, .extra1 = SYSCTL_ZERO, .extra2 = &mptcp_pm_type_max },