igb: Simplify how we populate the RSS key
[linux-2.6/cjktty.git] / net / sctp / sysctl.c
blob70e3ba5cb50b319319e60c7bfa6fae69bc5c1fed
1 /* SCTP kernel implementation
2 * (C) Copyright IBM Corp. 2002, 2004
3 * Copyright (c) 2002 Intel Corp.
5 * This file is part of the SCTP kernel implementation
7 * Sysctl related interfaces for SCTP.
9 * This SCTP implementation is free software;
10 * you can redistribute it and/or modify it under the terms of
11 * the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
15 * This SCTP implementation is distributed in the hope that it
16 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
17 * ************************
18 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 * See the GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GNU CC; see the file COPYING. If not, write to
23 * the Free Software Foundation, 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
26 * Please send any bug reports or fixes you make to the
27 * email address(es):
28 * lksctp developers <lksctp-developers@lists.sourceforge.net>
30 * Or submit a bug report through the following website:
31 * http://www.sf.net/projects/lksctp
33 * Written or modified by:
34 * Mingqin Liu <liuming@us.ibm.com>
35 * Jon Grimm <jgrimm@us.ibm.com>
36 * Ardelle Fan <ardelle.fan@intel.com>
37 * Ryan Layer <rmlayer@us.ibm.com>
38 * Sridhar Samudrala <sri@us.ibm.com>
40 * Any bugs reported given to us we will try to fix... any fixes shared will
41 * be incorporated into the next SCTP release.
44 #include <net/sctp/structs.h>
45 #include <net/sctp/sctp.h>
46 #include <linux/sysctl.h>
48 static int zero = 0;
49 static int one = 1;
50 static int timer_max = 86400000; /* ms in one day */
51 static int int_max = INT_MAX;
52 static int sack_timer_min = 1;
53 static int sack_timer_max = 500;
54 static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */
55 static int rwnd_scale_max = 16;
56 static unsigned long max_autoclose_min = 0;
57 static unsigned long max_autoclose_max =
58 (MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX)
59 ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ;
61 extern long sysctl_sctp_mem[3];
62 extern int sysctl_sctp_rmem[3];
63 extern int sysctl_sctp_wmem[3];
65 static ctl_table sctp_table[] = {
67 .procname = "sctp_mem",
68 .data = &sysctl_sctp_mem,
69 .maxlen = sizeof(sysctl_sctp_mem),
70 .mode = 0644,
71 .proc_handler = proc_doulongvec_minmax
74 .procname = "sctp_rmem",
75 .data = &sysctl_sctp_rmem,
76 .maxlen = sizeof(sysctl_sctp_rmem),
77 .mode = 0644,
78 .proc_handler = proc_dointvec,
81 .procname = "sctp_wmem",
82 .data = &sysctl_sctp_wmem,
83 .maxlen = sizeof(sysctl_sctp_wmem),
84 .mode = 0644,
85 .proc_handler = proc_dointvec,
88 { /* sentinel */ }
91 static ctl_table sctp_net_table[] = {
93 .procname = "rto_initial",
94 .data = &init_net.sctp.rto_initial,
95 .maxlen = sizeof(unsigned int),
96 .mode = 0644,
97 .proc_handler = proc_dointvec_minmax,
98 .extra1 = &one,
99 .extra2 = &timer_max
102 .procname = "rto_min",
103 .data = &init_net.sctp.rto_min,
104 .maxlen = sizeof(unsigned int),
105 .mode = 0644,
106 .proc_handler = proc_dointvec_minmax,
107 .extra1 = &one,
108 .extra2 = &timer_max
111 .procname = "rto_max",
112 .data = &init_net.sctp.rto_max,
113 .maxlen = sizeof(unsigned int),
114 .mode = 0644,
115 .proc_handler = proc_dointvec_minmax,
116 .extra1 = &one,
117 .extra2 = &timer_max
120 .procname = "rto_alpha_exp_divisor",
121 .data = &init_net.sctp.rto_alpha,
122 .maxlen = sizeof(int),
123 .mode = 0444,
124 .proc_handler = proc_dointvec,
127 .procname = "rto_beta_exp_divisor",
128 .data = &init_net.sctp.rto_beta,
129 .maxlen = sizeof(int),
130 .mode = 0444,
131 .proc_handler = proc_dointvec,
134 .procname = "max_burst",
135 .data = &init_net.sctp.max_burst,
136 .maxlen = sizeof(int),
137 .mode = 0644,
138 .proc_handler = proc_dointvec_minmax,
139 .extra1 = &zero,
140 .extra2 = &int_max
143 .procname = "cookie_preserve_enable",
144 .data = &init_net.sctp.cookie_preserve_enable,
145 .maxlen = sizeof(int),
146 .mode = 0644,
147 .proc_handler = proc_dointvec,
150 .procname = "valid_cookie_life",
151 .data = &init_net.sctp.valid_cookie_life,
152 .maxlen = sizeof(unsigned int),
153 .mode = 0644,
154 .proc_handler = proc_dointvec_minmax,
155 .extra1 = &one,
156 .extra2 = &timer_max
159 .procname = "sack_timeout",
160 .data = &init_net.sctp.sack_timeout,
161 .maxlen = sizeof(int),
162 .mode = 0644,
163 .proc_handler = proc_dointvec_minmax,
164 .extra1 = &sack_timer_min,
165 .extra2 = &sack_timer_max,
168 .procname = "hb_interval",
169 .data = &init_net.sctp.hb_interval,
170 .maxlen = sizeof(unsigned int),
171 .mode = 0644,
172 .proc_handler = proc_dointvec_minmax,
173 .extra1 = &one,
174 .extra2 = &timer_max
177 .procname = "association_max_retrans",
178 .data = &init_net.sctp.max_retrans_association,
179 .maxlen = sizeof(int),
180 .mode = 0644,
181 .proc_handler = proc_dointvec_minmax,
182 .extra1 = &one,
183 .extra2 = &int_max
186 .procname = "path_max_retrans",
187 .data = &init_net.sctp.max_retrans_path,
188 .maxlen = sizeof(int),
189 .mode = 0644,
190 .proc_handler = proc_dointvec_minmax,
191 .extra1 = &one,
192 .extra2 = &int_max
195 .procname = "max_init_retransmits",
196 .data = &init_net.sctp.max_retrans_init,
197 .maxlen = sizeof(int),
198 .mode = 0644,
199 .proc_handler = proc_dointvec_minmax,
200 .extra1 = &one,
201 .extra2 = &int_max
204 .procname = "pf_retrans",
205 .data = &init_net.sctp.pf_retrans,
206 .maxlen = sizeof(int),
207 .mode = 0644,
208 .proc_handler = proc_dointvec_minmax,
209 .extra1 = &zero,
210 .extra2 = &int_max
213 .procname = "sndbuf_policy",
214 .data = &init_net.sctp.sndbuf_policy,
215 .maxlen = sizeof(int),
216 .mode = 0644,
217 .proc_handler = proc_dointvec,
220 .procname = "rcvbuf_policy",
221 .data = &init_net.sctp.rcvbuf_policy,
222 .maxlen = sizeof(int),
223 .mode = 0644,
224 .proc_handler = proc_dointvec,
227 .procname = "default_auto_asconf",
228 .data = &init_net.sctp.default_auto_asconf,
229 .maxlen = sizeof(int),
230 .mode = 0644,
231 .proc_handler = proc_dointvec,
234 .procname = "addip_enable",
235 .data = &init_net.sctp.addip_enable,
236 .maxlen = sizeof(int),
237 .mode = 0644,
238 .proc_handler = proc_dointvec,
241 .procname = "addip_noauth_enable",
242 .data = &init_net.sctp.addip_noauth,
243 .maxlen = sizeof(int),
244 .mode = 0644,
245 .proc_handler = proc_dointvec,
248 .procname = "prsctp_enable",
249 .data = &init_net.sctp.prsctp_enable,
250 .maxlen = sizeof(int),
251 .mode = 0644,
252 .proc_handler = proc_dointvec,
255 .procname = "auth_enable",
256 .data = &init_net.sctp.auth_enable,
257 .maxlen = sizeof(int),
258 .mode = 0644,
259 .proc_handler = proc_dointvec,
262 .procname = "addr_scope_policy",
263 .data = &init_net.sctp.scope_policy,
264 .maxlen = sizeof(int),
265 .mode = 0644,
266 .proc_handler = proc_dointvec_minmax,
267 .extra1 = &zero,
268 .extra2 = &addr_scope_max,
271 .procname = "rwnd_update_shift",
272 .data = &init_net.sctp.rwnd_upd_shift,
273 .maxlen = sizeof(int),
274 .mode = 0644,
275 .proc_handler = &proc_dointvec_minmax,
276 .extra1 = &one,
277 .extra2 = &rwnd_scale_max,
280 .procname = "max_autoclose",
281 .data = &init_net.sctp.max_autoclose,
282 .maxlen = sizeof(unsigned long),
283 .mode = 0644,
284 .proc_handler = &proc_doulongvec_minmax,
285 .extra1 = &max_autoclose_min,
286 .extra2 = &max_autoclose_max,
289 { /* sentinel */ }
292 int sctp_sysctl_net_register(struct net *net)
294 struct ctl_table *table;
295 int i;
297 table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
298 if (!table)
299 return -ENOMEM;
301 for (i = 0; table[i].data; i++)
302 table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
304 net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table);
305 return 0;
308 void sctp_sysctl_net_unregister(struct net *net)
310 unregister_net_sysctl_table(net->sctp.sysctl_header);
313 static struct ctl_table_header * sctp_sysctl_header;
315 /* Sysctl registration. */
316 void sctp_sysctl_register(void)
318 sctp_sysctl_header = register_net_sysctl(&init_net, "net/sctp", sctp_table);
321 /* Sysctl deregistration. */
322 void sctp_sysctl_unregister(void)
324 unregister_net_sysctl_table(sctp_sysctl_header);