diff options
author | Gregory Detal <gregory.detal@gmail.com> | 2024-05-13 18:13:28 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-05-13 18:29:23 -0700 |
commit | 73c900aa3660dae2050af456d1031d098ab4cb1d (patch) | |
tree | c7e3e3ea2254648a2d5fbefe7103a0d0b177a690 /net/mptcp/ctrl.c | |
parent | ce5f6f71b029f6a96267a7d876da4a055d7d1611 (diff) |
mptcp: add net.mptcp.available_schedulers
The sysctl lists the available schedulers that can be set using
net.mptcp.scheduler similarly to net.ipv4.tcp_available_congestion_control.
Signed-off-by: Gregory Detal <gregory.detal@gmail.com>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Tested-by: Geliang Tang <geliang@kernel.org>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Mat Martineau <martineau@kernel.org>
Link: https://lore.kernel.org/r/20240514011335.176158-5-martineau@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mptcp/ctrl.c')
-rw-r--r-- | net/mptcp/ctrl.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c index 49abf80b3fad..542555ba474c 100644 --- a/net/mptcp/ctrl.c +++ b/net/mptcp/ctrl.c @@ -133,6 +133,24 @@ static int proc_scheduler(struct ctl_table *ctl, int write, return ret; } +static int proc_available_schedulers(struct ctl_table *ctl, + int write, void *buffer, + size_t *lenp, loff_t *ppos) +{ + struct ctl_table tbl = { .maxlen = MPTCP_SCHED_BUF_MAX, }; + int ret; + + tbl.data = kmalloc(tbl.maxlen, GFP_USER); + if (!tbl.data) + return -ENOMEM; + + mptcp_get_available_schedulers(tbl.data, MPTCP_SCHED_BUF_MAX); + ret = proc_dostring(&tbl, write, buffer, lenp, ppos); + kfree(tbl.data); + + return ret; +} + static struct ctl_table mptcp_sysctl_table[] = { { .procname = "enabled", @@ -188,6 +206,12 @@ static struct ctl_table mptcp_sysctl_table[] = { .proc_handler = proc_scheduler, }, { + .procname = "available_schedulers", + .maxlen = MPTCP_SCHED_BUF_MAX, + .mode = 0644, + .proc_handler = proc_available_schedulers, + }, + { .procname = "close_timeout", .maxlen = sizeof(unsigned int), .mode = 0644, @@ -214,7 +238,8 @@ static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet) table[4].data = &pernet->stale_loss_cnt; table[5].data = &pernet->pm_type; table[6].data = &pernet->scheduler; - table[7].data = &pernet->close_timeout; + /* table[7] is for available_schedulers which is read-only info */ + table[8].data = &pernet->close_timeout; hdr = register_net_sysctl_sz(net, MPTCP_SYSCTL_PATH, table, ARRAY_SIZE(mptcp_sysctl_table)); |