Whamcloud - gitweb
1c8d9845d3fb96dedb56e4ba06bec89b68aca7e9
[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 [sun.com URL with a
20  * copy of GPLv2].
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 static cfs_sysctl_table_t kibnal_ctl_table[] = {
104         {
105                 .ctl_name = 1,
106                 .procname = "ipif_basename",
107                 .data     = &ipif_basename,
108                 .maxlen   = 1024,
109                 .mode     = 0444,
110                 .proc_handler = &proc_dostring
111         },
112         {
113                 .ctl_name = 2,
114                 .procname = "n_connd",
115                 .data     = &n_connd,
116                 .maxlen   = sizeof(int),
117                 .mode     = 0444,
118                 .proc_handler = &proc_dointvec
119         },
120         {
121                 .ctl_name = 3,
122                 .procname = "min_reconnect_interval",
123                 .data     = &min_reconnect_interval,
124                 .maxlen   = sizeof(int),
125                 .mode     = 0644,
126                 .proc_handler = &proc_dointvec
127         },
128         {
129                 .ctl_name = 4,
130                 .procname = "max_reconnect_interval",
131                 .data     = &max_reconnect_interval,
132                 .maxlen   = sizeof(int),
133                 .mode     = 0644,
134                 .proc_handler = &proc_dointvec
135         },
136         {
137                 .ctl_name = 5,
138                 .procname = "concurrent_peers",
139                 .data     = &concurrent_peers,
140                 .maxlen   = sizeof(int),
141                 .mode     = 0444,
142                 .proc_handler = &proc_dointvec
143         },
144         {
145                 .ctl_name = 6,
146                 .procname = "cksum",
147                 .data     = &cksum,
148                 .maxlen   = sizeof(int),
149                 .mode     = 0644,
150                 .proc_handler = &proc_dointvec
151         },
152         {
153                 .ctl_name = 7,
154                 .procname = "timeout",
155                 .data     = &timeout,
156                 .maxlen   = sizeof(int),
157                 .mode     = 0644,
158                 .proc_handler = &proc_dointvec
159         },
160         {
161                 .ctl_name = 8,
162                 .procname = "ntx",
163                 .data     = &ntx,
164                 .maxlen   = sizeof(int),
165                 .mode     = 0444,
166                 .proc_handler = &proc_dointvec
167         },
168         {
169                 .ctl_name = 9,
170                 .procname = "credits",
171                 .data     = &credits,
172                 .maxlen   = sizeof(int),
173                 .mode     = 0444,
174                 .proc_handler = &proc_dointvec
175         },
176         {
177                 .ctl_name = 10,
178                 .procname = "peer_credits",
179                 .data     = &peer_credits,
180                 .maxlen   = sizeof(int),
181                 .mode     = 0444,
182                 .proc_handler = &proc_dointvec
183         },
184         {
185                 .ctl_name = 11,
186                 .procname = "keepalive",
187                 .data     = &keepalive,
188                 .maxlen   = sizeof(int),
189                 .mode     = 0644,
190                 .proc_handler = &proc_dointvec
191         },
192         {0}
193 };
194
195 static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
196         {
197                 .ctl_name = 203,
198                 .procname = "openibnal",
199                 .data     = NULL,
200                 .maxlen   = 0,
201                 .mode     = 0555,
202                 .child    = kibnal_ctl_table
203         },
204         {0}
205 };
206
207 int
208 kibnal_tunables_init ()
209 {
210         kibnal_tunables.kib_sysctl =
211                 cfs_register_sysctl_table(kibnal_top_ctl_table, 0);
212
213         if (kibnal_tunables.kib_sysctl == NULL)
214                 CWARN("Can't setup /proc tunables\n");
215
216         return 0;
217 }
218
219 void
220 kibnal_tunables_fini ()
221 {
222         if (kibnal_tunables.kib_sysctl != NULL)
223                 cfs_unregister_sysctl_table(kibnal_tunables.kib_sysctl);
224 }
225
226 #else
227
228 int
229 kibnal_tunables_init ()
230 {
231         return 0;
232 }
233
234 void
235 kibnal_tunables_fini ()
236 {
237 }
238
239 #endif