9 #include <linux/sysctl.h>
10 #include <linux/module.h>
11 #include <linux/socket.h>
12 #include <linux/netdevice.h>
16 #include <linux/slab.h>
25 void __user *
buffer,
size_t *lenp, loff_t *ppos)
27 unsigned int orig_size,
size;
31 .maxlen =
sizeof(
size),
34 struct rps_sock_flow_table *orig_sock_table, *sock_table;
40 lockdep_is_held(&sock_flow_mutex));
41 size = orig_size = orig_sock_table ? orig_sock_table->mask + 1 : 0;
53 if (size != orig_size) {
55 vmalloc(RPS_SOCK_FLOW_TABLE_SIZE(size));
61 sock_table->mask = size - 1;
63 sock_table = orig_sock_table;
65 for (i = 0; i <
size; i++)
66 sock_table->ents[i] = RPS_NO_CPU;
70 if (sock_table != orig_sock_table) {
73 static_key_slow_inc(&rps_needed);
74 if (orig_sock_table) {
75 static_key_slow_dec(&rps_needed);
77 vfree(orig_sock_table);
88 static struct ctl_table net_core_table[] = {
91 .procname =
"wmem_max",
93 .maxlen =
sizeof(
int),
98 .procname =
"rmem_max",
100 .maxlen =
sizeof(
int),
105 .procname =
"wmem_default",
107 .maxlen =
sizeof(
int),
112 .procname =
"rmem_default",
114 .maxlen =
sizeof(
int),
119 .procname =
"dev_weight",
121 .maxlen =
sizeof(
int),
126 .procname =
"netdev_max_backlog",
128 .maxlen =
sizeof(
int),
132 #ifdef CONFIG_BPF_JIT
134 .procname =
"bpf_jit_enable",
136 .maxlen =
sizeof(
int),
142 .procname =
"netdev_tstamp_prequeue",
144 .maxlen =
sizeof(
int),
149 .procname =
"message_cost",
151 .maxlen =
sizeof(
int),
156 .procname =
"message_burst",
158 .maxlen =
sizeof(
int),
163 .procname =
"optmem_max",
165 .maxlen =
sizeof(
int),
171 .procname =
"rps_sock_flow_entries",
172 .maxlen =
sizeof(
int),
179 .procname =
"netdev_budget",
181 .maxlen =
sizeof(
int),
186 .procname =
"warnings",
188 .maxlen =
sizeof(
int),
195 static struct ctl_table netns_core_table[] = {
197 .procname =
"somaxconn",
198 .data = &
init_net.core.sysctl_somaxconn,
199 .maxlen =
sizeof(
int),
212 tbl = netns_core_table;
218 tbl[0].
data = &net->
core.sysctl_somaxconn;
228 if (tbl != netns_core_table)
234 static __net_exit void sysctl_core_net_exit(
struct net *net)
238 tbl = net->
core.sysctl_hdr->ctl_table_arg;
240 BUG_ON(tbl == netns_core_table);
245 .init = sysctl_core_net_init,
246 .exit = sysctl_core_net_exit,
249 static __init int sysctl_core_init(
void)