OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [net/] [sctp/] [sysctl.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* SCTP kernel reference Implementation
2
 * Copyright (c) 2002 International Business Machines Corp.
3
 * Copyright (c) 2002 Intel Corp.
4
 *
5
 * This file is part of the SCTP kernel reference Implementation
6
 *
7
 * Sysctl related interfaces for SCTP.
8
 *
9
 * The SCTP reference 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
 * The SCTP reference 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
 *
39
 * Any bugs reported given to us we will try to fix... any fixes shared will
40
 * be incorporated into the next SCTP release.
41
 */
42
 
43
#include <net/sctp/structs.h>
44
#include <linux/sysctl.h>
45
 
46
static ctl_handler sctp_sysctl_jiffies_ms;
47
static long rto_timer_min = 1;
48
static long rto_timer_max = 86400000; /* One day */
49
 
50
static ctl_table sctp_table[] = {
51
        {
52
                .ctl_name       = NET_SCTP_RTO_INITIAL,
53
                .procname       = "rto_initial",
54
                .data           = &sctp_rto_initial,
55
                .maxlen         = sizeof(long),
56
                .mode           = 0644,
57
                .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
58
                .strategy       = &sctp_sysctl_jiffies_ms,
59
                .extra1         = &rto_timer_min,
60
                .extra2         = &rto_timer_max
61
        },
62
        {
63
                .ctl_name       = NET_SCTP_RTO_MIN,
64
                .procname       = "rto_min",
65
                .data           = &sctp_rto_min,
66
                .maxlen         = sizeof(long),
67
                .mode           = 0644,
68
                .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
69
                .strategy       = &sctp_sysctl_jiffies_ms,
70
                .extra1         = &rto_timer_min,
71
                .extra2         = &rto_timer_max
72
        },
73
        {
74
                .ctl_name       = NET_SCTP_RTO_MAX,
75
                .procname       = "rto_max",
76
                .data           = &sctp_rto_max,
77
                .maxlen         = sizeof(long),
78
                .mode           = 0644,
79
                .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
80
                .strategy       = &sctp_sysctl_jiffies_ms,
81
                .extra1         = &rto_timer_min,
82
                .extra2         = &rto_timer_max
83
        },
84
        {
85
                .ctl_name       = NET_SCTP_VALID_COOKIE_LIFE,
86
                .procname       = "valid_cookie_life",
87
                .data           = &sctp_valid_cookie_life,
88
                .maxlen         = sizeof(long),
89
                .mode           = 0644,
90
                .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
91
                .strategy       = &sctp_sysctl_jiffies_ms,
92
                .extra1         = &rto_timer_min,
93
                .extra2         = &rto_timer_max
94
        },
95
        {
96
                .ctl_name       = NET_SCTP_MAX_BURST,
97
                .procname       = "max_burst",
98
                .data           = &sctp_max_burst,
99
                .maxlen         = sizeof(int),
100
                .mode           = 0644,
101
                .proc_handler   = &proc_dointvec
102
        },
103
        {
104
                .ctl_name       = NET_SCTP_ASSOCIATION_MAX_RETRANS,
105
                .procname       = "association_max_retrans",
106
                .data           = &sctp_max_retrans_association,
107
                .maxlen         = sizeof(int),
108
                .mode           = 0644,
109
                .proc_handler   = &proc_dointvec
110
        },
111
        {
112
                .ctl_name       = NET_SCTP_PATH_MAX_RETRANS,
113
                .procname       = "path_max_retrans",
114
                .data           = &sctp_max_retrans_path,
115
                .maxlen         = sizeof(int),
116
                .mode           = 0644,
117
                .proc_handler   = &proc_dointvec
118
        },
119
        {
120
                .ctl_name       = NET_SCTP_MAX_INIT_RETRANSMITS,
121
                .procname       = "max_init_retransmits",
122
                .data           = &sctp_max_retrans_init,
123
                .maxlen         = sizeof(int),
124
                .mode           = 0644,
125
                .proc_handler   = &proc_dointvec
126
        },
127
        {
128
                .ctl_name       = NET_SCTP_HB_INTERVAL,
129
                .procname       = "hb_interval",
130
                .data           = &sctp_hb_interval,
131
                .maxlen         = sizeof(long),
132
                .mode           = 0644,
133
                .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
134
                .strategy       = &sctp_sysctl_jiffies_ms,
135
                .extra1         = &rto_timer_min,
136
                .extra2         = &rto_timer_max
137
        },
138
        {
139
                .ctl_name       = NET_SCTP_PRESERVE_ENABLE,
140
                .procname       = "cookie_preserve_enable",
141
                .data           = &sctp_cookie_preserve_enable,
142
                .maxlen         = sizeof(long),
143
                .mode           = 0644,
144
                .proc_handler   = &proc_doulongvec_ms_jiffies_minmax,
145
                .strategy       = &sctp_sysctl_jiffies_ms,
146
                .extra1         = &rto_timer_min,
147
                .extra2         = &rto_timer_max
148
        },
149
        {
150
                .ctl_name       = NET_SCTP_RTO_ALPHA,
151
                .procname       = "rto_alpha_exp_divisor",
152
                .data           = &sctp_rto_alpha,
153
                .maxlen         = sizeof(int),
154
                .mode           = 0644,
155
                .proc_handler   = &proc_dointvec
156
        },
157
        {
158
                .ctl_name       = NET_SCTP_RTO_BETA,
159
                .procname       = "rto_beta_exp_divisor",
160
                .data           = &sctp_rto_beta,
161
                .maxlen         = sizeof(int),
162
                .mode           = 0644,
163
                .proc_handler   = &proc_dointvec
164
        },
165
        {
166
                .ctl_name       = NET_SCTP_ADDIP_ENABLE,
167
                .procname       = "addip_enable",
168
                .data           = &sctp_addip_enable,
169
                .maxlen         = sizeof(int),
170
                .mode           = 0644,
171
                .proc_handler   = &proc_dointvec
172
        },
173
        { .ctl_name = 0 }
174
};
175
 
176
static ctl_table sctp_net_table[] = {
177
        {
178
                .ctl_name       = NET_SCTP,
179
                .procname       = "sctp",
180
                .mode           = 0555,
181
                .child          = sctp_table
182
        },
183
        { .ctl_name = 0 }
184
};
185
 
186
static ctl_table sctp_root_table[] = {
187
        {
188
                .ctl_name       = CTL_NET,
189
                .procname       = "net",
190
                .mode           = 0555,
191
                .child          = sctp_net_table
192
        },
193
        { .ctl_name = 0 }
194
};
195
 
196
static struct ctl_table_header * sctp_sysctl_header;
197
 
198
/* Sysctl registration.  */
199
void sctp_sysctl_register(void)
200
{
201
        sctp_sysctl_header = register_sysctl_table(sctp_root_table, 0);
202
}
203
 
204
/* Sysctl deregistration.  */
205
void sctp_sysctl_unregister(void)
206
{
207
        unregister_sysctl_table(sctp_sysctl_header);
208
}
209
 
210
/* Strategy function to convert jiffies to milliseconds.  */
211
static int sctp_sysctl_jiffies_ms(ctl_table *table, int *name, int nlen,
212
                                  void *oldval, size_t *oldlenp,
213
                                  void *newval, size_t newlen, void **context)
214
{
215
        if (oldval) {
216
                size_t olen;
217
 
218
                if (oldlenp) {
219
                        if (get_user(olen, oldlenp))
220
                                return -EFAULT;
221
 
222
                        if (olen != sizeof (int))
223
                                return -EINVAL;
224
                }
225
                if (put_user((*(int *)(table->data) * 1000) / HZ,
226
                        (int *)oldval) ||
227
                    (oldlenp && put_user(sizeof (int), oldlenp)))
228
                        return -EFAULT;
229
        }
230
        if (newval && newlen) {
231
                int new;
232
 
233
                if (newlen != sizeof (int))
234
                        return -EINVAL;
235
 
236
                if (get_user(new, (int *)newval))
237
                        return -EFAULT;
238
 
239
                *(int *)(table->data) = (new * HZ) / 1000;
240
        }
241
        return 1;
242
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.