Bluetooth: Add RFCOMM option to use L2CAP ERTM mode
[pandora-kernel.git] / net / sctp / sysctl.c
1 /* SCTP kernel implementation
2  * (C) Copyright IBM Corp. 2002, 2004
3  * Copyright (c) 2002 Intel Corp.
4  *
5  * This file is part of the SCTP kernel implementation
6  *
7  * Sysctl related interfaces for SCTP.
8  *
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.
14  *
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.
20  *
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.
25  *
26  * Please send any bug reports or fixes you make to the
27  * email address(es):
28  *    lksctp developers <lksctp-developers@lists.sourceforge.net>
29  *
30  * Or submit a bug report through the following website:
31  *    http://www.sf.net/projects/lksctp
32  *
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>
39  *
40  * Any bugs reported given to us we will try to fix... any fixes shared will
41  * be incorporated into the next SCTP release.
42  */
43
44 #include <net/sctp/structs.h>
45 #include <net/sctp/sctp.h>
46 #include <linux/sysctl.h>
47
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
57 extern int sysctl_sctp_mem[3];
58 extern int sysctl_sctp_rmem[3];
59 extern int sysctl_sctp_wmem[3];
60
61 static ctl_table sctp_table[] = {
62         {
63                 .ctl_name       = NET_SCTP_RTO_INITIAL,
64                 .procname       = "rto_initial",
65                 .data           = &sctp_rto_initial,
66                 .maxlen         = sizeof(unsigned int),
67                 .mode           = 0644,
68                 .proc_handler   = proc_dointvec_minmax,
69                 .strategy       = sysctl_intvec,
70                 .extra1         = &one,
71                 .extra2         = &timer_max
72         },
73         {
74                 .ctl_name       = NET_SCTP_RTO_MIN,
75                 .procname       = "rto_min",
76                 .data           = &sctp_rto_min,
77                 .maxlen         = sizeof(unsigned int),
78                 .mode           = 0644,
79                 .proc_handler   = proc_dointvec_minmax,
80                 .strategy       = sysctl_intvec,
81                 .extra1         = &one,
82                 .extra2         = &timer_max
83         },
84         {
85                 .ctl_name       = NET_SCTP_RTO_MAX,
86                 .procname       = "rto_max",
87                 .data           = &sctp_rto_max,
88                 .maxlen         = sizeof(unsigned int),
89                 .mode           = 0644,
90                 .proc_handler   = proc_dointvec_minmax,
91                 .strategy       = sysctl_intvec,
92                 .extra1         = &one,
93                 .extra2         = &timer_max
94         },
95         {
96                 .ctl_name       = NET_SCTP_VALID_COOKIE_LIFE,
97                 .procname       = "valid_cookie_life",
98                 .data           = &sctp_valid_cookie_life,
99                 .maxlen         = sizeof(unsigned int),
100                 .mode           = 0644,
101                 .proc_handler   = proc_dointvec_minmax,
102                 .strategy       = sysctl_intvec,
103                 .extra1         = &one,
104                 .extra2         = &timer_max
105         },
106         {
107                 .ctl_name       = NET_SCTP_MAX_BURST,
108                 .procname       = "max_burst",
109                 .data           = &sctp_max_burst,
110                 .maxlen         = sizeof(int),
111                 .mode           = 0644,
112                 .proc_handler   = proc_dointvec_minmax,
113                 .strategy       = sysctl_intvec,
114                 .extra1         = &zero,
115                 .extra2         = &int_max
116         },
117         {
118                 .ctl_name       = NET_SCTP_ASSOCIATION_MAX_RETRANS,
119                 .procname       = "association_max_retrans",
120                 .data           = &sctp_max_retrans_association,
121                 .maxlen         = sizeof(int),
122                 .mode           = 0644,
123                 .proc_handler   = proc_dointvec_minmax,
124                 .strategy       = sysctl_intvec,
125                 .extra1         = &one,
126                 .extra2         = &int_max
127         },
128         {
129                 .ctl_name       = NET_SCTP_SNDBUF_POLICY,
130                 .procname       = "sndbuf_policy",
131                 .data           = &sctp_sndbuf_policy,
132                 .maxlen         = sizeof(int),
133                 .mode           = 0644,
134                 .proc_handler   = proc_dointvec,
135                 .strategy       = sysctl_intvec
136         },
137         {
138                 .ctl_name       = NET_SCTP_RCVBUF_POLICY,
139                 .procname       = "rcvbuf_policy",
140                 .data           = &sctp_rcvbuf_policy,
141                 .maxlen         = sizeof(int),
142                 .mode           = 0644,
143                 .proc_handler   = proc_dointvec,
144                 .strategy       = sysctl_intvec
145         },
146         {
147                 .ctl_name       = NET_SCTP_PATH_MAX_RETRANS,
148                 .procname       = "path_max_retrans",
149                 .data           = &sctp_max_retrans_path,
150                 .maxlen         = sizeof(int),
151                 .mode           = 0644,
152                 .proc_handler   = proc_dointvec_minmax,
153                 .strategy       = sysctl_intvec,
154                 .extra1         = &one,
155                 .extra2         = &int_max
156         },
157         {
158                 .ctl_name       = NET_SCTP_MAX_INIT_RETRANSMITS,
159                 .procname       = "max_init_retransmits",
160                 .data           = &sctp_max_retrans_init,
161                 .maxlen         = sizeof(int),
162                 .mode           = 0644,
163                 .proc_handler   = proc_dointvec_minmax,
164                 .strategy       = sysctl_intvec,
165                 .extra1         = &one,
166                 .extra2         = &int_max
167         },
168         {
169                 .ctl_name       = NET_SCTP_HB_INTERVAL,
170                 .procname       = "hb_interval",
171                 .data           = &sctp_hb_interval,
172                 .maxlen         = sizeof(unsigned int),
173                 .mode           = 0644,
174                 .proc_handler   = proc_dointvec_minmax,
175                 .strategy       = sysctl_intvec,
176                 .extra1         = &one,
177                 .extra2         = &timer_max
178         },
179         {
180                 .ctl_name       = NET_SCTP_PRESERVE_ENABLE,
181                 .procname       = "cookie_preserve_enable",
182                 .data           = &sctp_cookie_preserve_enable,
183                 .maxlen         = sizeof(int),
184                 .mode           = 0644,
185                 .proc_handler   = proc_dointvec,
186                 .strategy       = sysctl_intvec
187         },
188         {
189                 .ctl_name       = NET_SCTP_RTO_ALPHA,
190                 .procname       = "rto_alpha_exp_divisor",
191                 .data           = &sctp_rto_alpha,
192                 .maxlen         = sizeof(int),
193                 .mode           = 0444,
194                 .proc_handler   = proc_dointvec,
195                 .strategy       = sysctl_intvec
196         },
197         {
198                 .ctl_name       = NET_SCTP_RTO_BETA,
199                 .procname       = "rto_beta_exp_divisor",
200                 .data           = &sctp_rto_beta,
201                 .maxlen         = sizeof(int),
202                 .mode           = 0444,
203                 .proc_handler   = proc_dointvec,
204                 .strategy       = sysctl_intvec
205         },
206         {
207                 .ctl_name       = NET_SCTP_ADDIP_ENABLE,
208                 .procname       = "addip_enable",
209                 .data           = &sctp_addip_enable,
210                 .maxlen         = sizeof(int),
211                 .mode           = 0644,
212                 .proc_handler   = proc_dointvec,
213                 .strategy       = sysctl_intvec
214         },
215         {
216                 .ctl_name       = NET_SCTP_PRSCTP_ENABLE,
217                 .procname       = "prsctp_enable",
218                 .data           = &sctp_prsctp_enable,
219                 .maxlen         = sizeof(int),
220                 .mode           = 0644,
221                 .proc_handler   = proc_dointvec,
222                 .strategy       = sysctl_intvec
223         },
224         {
225                 .ctl_name       = NET_SCTP_SACK_TIMEOUT,
226                 .procname       = "sack_timeout",
227                 .data           = &sctp_sack_timeout,
228                 .maxlen         = sizeof(int),
229                 .mode           = 0644,
230                 .proc_handler   = proc_dointvec_minmax,
231                 .strategy       = sysctl_intvec,
232                 .extra1         = &sack_timer_min,
233                 .extra2         = &sack_timer_max,
234         },
235         {
236                 .ctl_name       = CTL_UNNUMBERED,
237                 .procname       = "sctp_mem",
238                 .data           = &sysctl_sctp_mem,
239                 .maxlen         = sizeof(sysctl_sctp_mem),
240                 .mode           = 0644,
241                 .proc_handler   = proc_dointvec,
242         },
243         {
244                 .ctl_name       = CTL_UNNUMBERED,
245                 .procname       = "sctp_rmem",
246                 .data           = &sysctl_sctp_rmem,
247                 .maxlen         = sizeof(sysctl_sctp_rmem),
248                 .mode           = 0644,
249                 .proc_handler   = proc_dointvec,
250         },
251         {
252                 .ctl_name       = CTL_UNNUMBERED,
253                 .procname       = "sctp_wmem",
254                 .data           = &sysctl_sctp_wmem,
255                 .maxlen         = sizeof(sysctl_sctp_wmem),
256                 .mode           = 0644,
257                 .proc_handler   = proc_dointvec,
258         },
259         {
260                 .ctl_name       = CTL_UNNUMBERED,
261                 .procname       = "auth_enable",
262                 .data           = &sctp_auth_enable,
263                 .maxlen         = sizeof(int),
264                 .mode           = 0644,
265                 .proc_handler   = proc_dointvec,
266                 .strategy       = sysctl_intvec
267         },
268         {
269                 .ctl_name       = CTL_UNNUMBERED,
270                 .procname       = "addip_noauth_enable",
271                 .data           = &sctp_addip_noauth,
272                 .maxlen         = sizeof(int),
273                 .mode           = 0644,
274                 .proc_handler   = proc_dointvec,
275                 .strategy       = sysctl_intvec
276         },
277         {
278                 .ctl_name       = CTL_UNNUMBERED,
279                 .procname       = "addr_scope_policy",
280                 .data           = &sctp_scope_policy,
281                 .maxlen         = sizeof(int),
282                 .mode           = 0644,
283                 .proc_handler   = &proc_dointvec_minmax,
284                 .strategy       = &sysctl_intvec,
285                 .extra1         = &zero,
286                 .extra2         = &addr_scope_max,
287         },
288         {
289                 .ctl_name       = CTL_UNNUMBERED,
290                 .procname       = "rwnd_update_shift",
291                 .data           = &sctp_rwnd_upd_shift,
292                 .maxlen         = sizeof(int),
293                 .mode           = 0644,
294                 .proc_handler   = &proc_dointvec_minmax,
295                 .strategy       = &sysctl_intvec,
296                 .extra1         = &one,
297                 .extra2         = &rwnd_scale_max,
298         },
299
300         { .ctl_name = 0 }
301 };
302
303 static struct ctl_path sctp_path[] = {
304         { .procname = "net", .ctl_name = CTL_NET, },
305         { .procname = "sctp", .ctl_name = NET_SCTP, },
306         { }
307 };
308
309 static struct ctl_table_header * sctp_sysctl_header;
310
311 /* Sysctl registration.  */
312 void sctp_sysctl_register(void)
313 {
314         sctp_sysctl_header = register_sysctl_paths(sctp_path, sctp_table);
315 }
316
317 /* Sysctl deregistration.  */
318 void sctp_sysctl_unregister(void)
319 {
320         unregister_sysctl_table(sctp_sysctl_header);
321 }