Whamcloud - gitweb
first part of 2.6.26 support (lnet/libcfs part)
[fs/lustre-release.git] / lnet / klnds / openiblnd / openiblnd_modparams.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright  2008 Sun Microsystems, Inc. All rights reserved
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lnet/klnds/openiblnd/openiblnd_modparams.c
37  *
38  * Author: Eric Barton <eric@bartonsoftware.com>
39  */
40
41 #include "openiblnd.h"
42
43 static char *ipif_basename = "ib";
44 CFS_MODULE_PARM(ipif_basename, "s", charp, 0444,
45                 "IPoIB interface base name");
46
47 static int n_connd = 4;
48 CFS_MODULE_PARM(n_connd, "i", int, 0444,
49                 "# of connection daemons");
50
51 static int min_reconnect_interval = 1;
52 CFS_MODULE_PARM(min_reconnect_interval, "i", int, 0644,
53                 "minimum connection retry interval (seconds)");
54
55 static int max_reconnect_interval = 60;
56 CFS_MODULE_PARM(max_reconnect_interval, "i", int, 0644,
57                 "maximum connection retry interval (seconds)");
58
59 static int concurrent_peers = 1152;
60 CFS_MODULE_PARM(concurrent_peers, "i", int, 0444,
61                 "maximum number of peers that may connect");
62
63 static int cksum = 0;
64 CFS_MODULE_PARM(cksum, "i", int, 0644,
65                 "set non-zero to enable message (not RDMA) checksums");
66
67 static int timeout = 50;
68 CFS_MODULE_PARM(timeout, "i", int, 0644,
69                 "timeout (seconds)");
70
71 static int ntx = 384;
72 CFS_MODULE_PARM(ntx, "i", int, 0444,
73                 "# of message descriptors");
74
75 static int credits = 256;
76 CFS_MODULE_PARM(credits, "i", int, 0444,
77                 "# concurrent sends");
78
79 static int peer_credits = 16;
80 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
81                 "# concurrent sends to 1 peer");
82
83 static int keepalive = 100;
84 CFS_MODULE_PARM(keepalive, "i", int, 0644,
85                 "Idle time in seconds before sending a keepalive");
86
87 kib_tunables_t kibnal_tunables = {
88         .kib_ipif_basename          = &ipif_basename,
89         .kib_n_connd                = &n_connd,
90         .kib_min_reconnect_interval = &min_reconnect_interval,
91         .kib_max_reconnect_interval = &max_reconnect_interval,
92         .kib_concurrent_peers       = &concurrent_peers,
93         .kib_cksum                  = &cksum,
94         .kib_timeout                = &timeout,
95         .kib_ntx                    = &ntx,
96         .kib_credits                = &credits,
97         .kib_peercredits            = &peer_credits,
98         .kib_keepalive              = &keepalive,
99 };
100
101 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
102
103 #ifndef HAVE_SYSCTL_UNNUMBERED
104 enum {
105         KIBNAL_IPIF_BASENAME = 1,
106         KIBNAL_N_CONND,
107         KIBNAL_RECONNECT_MIN,
108         KIBNAL_RECONNECT_MAX,
109         KIBNAL_CONCURRENT_PEERS,
110         KIBNAL_CKSUM,
111         KIBNAL_TIMEOUT,
112         KIBNAL_NTX,
113         KIBNAL_CREDITS,
114         KIBNAL_PEER_CREDITS,
115         KIBNAL_KEEPALIVE
116 };
117 #else
118
119 #define KIBNAL_IPIF_BASENAME    CTL_UNNUMBERED
120 #define KIBNAL_N_CONND          CTL_UNNUMBERED
121 #define KIBNAL_RECONNECT_MIN    CTL_UNNUMBERED
122 #define KIBNAL_RECONNECT_MAX    CTL_UNNUMBERED
123 #define KIBNAL_CONCURRENT_PEERS CTL_UNNUMBERED
124 #define KIBNAL_CKSUM            CTL_UNNUMBERED
125 #define KIBNAL_TIMEOUT          CTL_UNNUMBERED
126 #define KIBNAL_NTX              CTL_UNNUMBERED
127 #define KIBNAL_CREDITS          CTL_UNNUMBERED
128 #define KIBNAL_PEER_CREDITS     CTL_UNNUMBERED
129 #define KIBNAL_KEEPALIVE        CTL_UNNUMBERED
130
131 #endif
132
133 static cfs_sysctl_table_t kibnal_ctl_table[] = {
134         {
135                 .ctl_name = KIBNAL_IPIF_BASENAME,
136                 .procname = "ipif_basename",
137                 .data     = &ipif_basename,
138                 .maxlen   = 1024,
139                 .mode     = 0444,
140                 .proc_handler = &proc_dostring
141         },
142         {
143                 .ctl_name = KIBNAL_N_CONND,
144                 .procname = "n_connd",
145                 .data     = &n_connd,
146                 .maxlen   = sizeof(int),
147                 .mode     = 0444,
148                 .proc_handler = &proc_dointvec
149         },
150         {
151                 .ctl_name = KIBNAL_RECONNECT_MIN,
152                 .procname = "min_reconnect_interval",
153                 .data     = &min_reconnect_interval,
154                 .maxlen   = sizeof(int),
155                 .mode     = 0644,
156                 .proc_handler = &proc_dointvec
157         },
158         {
159                 .ctl_name = KIBNAL_RECONNECT_MAX,
160                 .procname = "max_reconnect_interval",
161                 .data     = &max_reconnect_interval,
162                 .maxlen   = sizeof(int),
163                 .mode     = 0644,
164                 .proc_handler = &proc_dointvec
165         },
166         {
167                 .ctl_name = KIBNAL_CONCURRENT_PEERS,
168                 .procname = "concurrent_peers",
169                 .data     = &concurrent_peers,
170                 .maxlen   = sizeof(int),
171                 .mode     = 0444,
172                 .proc_handler = &proc_dointvec
173         },
174         {
175                 .ctl_name = KIBNAL_CKSUM,
176                 .procname = "cksum",
177                 .data     = &cksum,
178                 .maxlen   = sizeof(int),
179                 .mode     = 0644,
180                 .proc_handler = &proc_dointvec
181         },
182         {
183                 .ctl_name = KIBNAL_TIMEOUT,
184                 .procname = "timeout",
185                 .data     = &timeout,
186                 .maxlen   = sizeof(int),
187                 .mode     = 0644,
188                 .proc_handler = &proc_dointvec
189         },
190         {
191                 .ctl_name = KIBNAL_NTX,
192                 .procname = "ntx",
193                 .data     = &ntx,
194                 .maxlen   = sizeof(int),
195                 .mode     = 0444,
196                 .proc_handler = &proc_dointvec
197         },
198         {
199                 .ctl_name = KIBNAL_CREDITS,
200                 .procname = "credits",
201                 .data     = &credits,
202                 .maxlen   = sizeof(int),
203                 .mode     = 0444,
204                 .proc_handler = &proc_dointvec
205         },
206         {
207                 .ctl_name = KIBNAL_PEER_CREDITS,
208                 .procname = "peer_credits",
209                 .data     = &peer_credits,
210                 .maxlen   = sizeof(int),
211                 .mode     = 0444,
212                 .proc_handler = &proc_dointvec
213         },
214         {
215                 .ctl_name = KIBNAL_KEEPALIVE,
216                 .procname = "keepalive",
217                 .data     = &keepalive,
218                 .maxlen   = sizeof(int),
219                 .mode     = 0644,
220                 .proc_handler = &proc_dointvec
221         },
222         {0}
223 };
224
225 static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
226         {
227                 .ctl_name = CTL_KIBNAL,
228                 .procname = "openibnal",
229                 .data     = NULL,
230                 .maxlen   = 0,
231                 .mode     = 0555,
232                 .child    = kibnal_ctl_table
233         },
234         {0}
235 };
236
237 int
238 kibnal_tunables_init ()
239 {
240         kibnal_tunables.kib_sysctl =
241                 cfs_register_sysctl_table(kibnal_top_ctl_table, 0);
242
243         if (kibnal_tunables.kib_sysctl == NULL)
244                 CWARN("Can't setup /proc tunables\n");
245
246         return 0;
247 }
248
249 void
250 kibnal_tunables_fini ()
251 {
252         if (kibnal_tunables.kib_sysctl != NULL)
253                 cfs_unregister_sysctl_table(kibnal_tunables.kib_sysctl);
254 }
255
256 #else
257
258 int
259 kibnal_tunables_init ()
260 {
261         return 0;
262 }
263
264 void
265 kibnal_tunables_fini ()
266 {
267 }
268
269 #endif