Whamcloud - gitweb
Branch b1_6
[fs/lustre-release.git] / lnet / klnds / iiblnd / iiblnd_modparams.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2004 Cluster File Systems, Inc.
5  *   Author: Eric Barton <eric@bartonsoftware.com>
6  *
7  *   This file is part of Lustre, http://www.lustre.org.
8  *
9  *   Lustre is free software; you can redistribute it and/or
10  *   modify it under the terms of version 2 of the GNU General Public
11  *   License as published by the Free Software Foundation.
12  *
13  *   Lustre is distributed in the hope that it will be useful,
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *   GNU General Public License for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with Lustre; if not, write to the Free Software
20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */
23
24 #include "iiblnd.h"
25
26 static char *ipif_basename = "ib";
27 CFS_MODULE_PARM(ipif_basename, "s", charp, 0444,
28                 "IPoIB interface base name");
29
30 static char *service_name = "iiblnd";
31 CFS_MODULE_PARM(service_name, "s", charp, 0444,
32                 "IB service name");
33
34 static int service_number = 0x11b9a2;
35 CFS_MODULE_PARM(service_number, "i", int, 0444,
36                 "IB service number");
37
38 static int min_reconnect_interval = 1;
39 CFS_MODULE_PARM(min_reconnect_interval, "i", int, 0644,
40                 "minimum connection retry interval (seconds)");
41
42 static int max_reconnect_interval = 60;
43 CFS_MODULE_PARM(max_reconnect_interval, "i", int, 0644,
44                 "maximum connection retry interval (seconds)");
45
46 static int concurrent_peers = 1152;
47 CFS_MODULE_PARM(concurrent_peers, "i", int, 0444,
48                 "maximum number of peers that may connect");
49
50 static int cksum = 0;
51 CFS_MODULE_PARM(cksum, "i", int, 0644,
52                 "set non-zero to enable message (not RDMA) checksums");
53
54 static int timeout = 50;
55 CFS_MODULE_PARM(timeout, "i", int, 0644,
56                 "timeout (seconds)");
57
58 static int ntx = 256;
59 CFS_MODULE_PARM(ntx, "i", int, 0444,
60                 "# of message descriptors");
61
62 static int credits = 128;
63 CFS_MODULE_PARM(credits, "i", int, 0444,
64                 "# concurrent sends");
65
66 static int peer_credits = 8;
67 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
68                 "# concurrent sends to 1 peer");
69
70 static int sd_retries = 8;
71 CFS_MODULE_PARM(sd_retries, "i", int, 0444,
72                 "# times to retry SD queries");
73
74 static int keepalive = 100;
75 CFS_MODULE_PARM(keepalive, "i", int, 0644,
76                 "Idle time in seconds before sending a keepalive");
77
78 static int concurrent_sends = IBNAL_RX_MSGS;
79 CFS_MODULE_PARM(concurrent_sends, "i", int, 0644,
80                 "Send work queue sizing");
81
82 kib_tunables_t kibnal_tunables = {
83         .kib_ipif_basename          = &ipif_basename,
84         .kib_service_name           = &service_name,
85         .kib_service_number         = &service_number,
86         .kib_min_reconnect_interval = &min_reconnect_interval,
87         .kib_max_reconnect_interval = &max_reconnect_interval,
88         .kib_concurrent_peers       = &concurrent_peers,
89         .kib_cksum                  = &cksum,
90         .kib_timeout                = &timeout,
91         .kib_keepalive              = &keepalive,
92         .kib_ntx                    = &ntx,
93         .kib_credits                = &credits,
94         .kib_peercredits            = &peer_credits,
95         .kib_sd_retries             = &sd_retries,
96         .kib_concurrent_sends       = &concurrent_sends,
97 };
98
99 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
100
101 /* NB max_size specified for proc_dostring entries only needs to be big enough
102  * not to truncate the printout; it only needs to be the actual size of the
103  * string buffer if we allow writes (and we don't) */
104
105 static cfs_sysctl_table_t kibnal_ctl_table[] = {
106         {
107                 .ctl_name = 1,
108                 .procname = "ipif_basename",
109                 .data     = &ipif_basename,
110                 .maxlen   = 1024,
111                 .mode     = 0444,
112                 .proc_handler = &proc_dostring
113         },
114         {
115                 .ctl_name = 2,
116                 .procname = "service_name",
117                 .data     = &service_name,
118                 .maxlen   = 1024,
119                 .mode     = 0444,
120                 .proc_handler = &proc_dostring
121         },
122         {
123                 .ctl_name = 3,
124                 .procname = "service_number",
125                 .data     = &service_number,
126                 .maxlen   = sizeof(int),
127                 .mode     = 0444,
128                 .proc_handler = &proc_dointvec
129         },
130         {
131                 .ctl_name = 4,
132                 .procname = "min_reconnect_interval",
133                 .data     = &min_reconnect_interval,
134                 .maxlen   = sizeof(int),
135                 .mode     = 0644,
136                 .proc_handler = &proc_dointvec
137         },
138         {
139                 .ctl_name = 5,
140                 .procname = "max_reconnect_interval",
141                 .data     = &max_reconnect_interval,
142                 .maxlen   = sizeof(int),
143                 .mode     = 0644,
144                 .proc_handler = &proc_dointvec
145         },
146         {
147                 .ctl_name = 6,
148                 .procname = "concurrent_peers",
149                 .data     = &concurrent_peers,
150                 .maxlen   = sizeof(int),
151                 .mode     = 0444,
152                 .proc_handler = &proc_dointvec
153         },
154         {
155                 .ctl_name = 7,
156                 .procname = "cksum",
157                 .data     = &cksum,
158                 .maxlen   = sizeof(int),
159                 .mode     = 0644,
160                 .proc_handler = &proc_dointvec
161         },
162         {
163                 .ctl_name = 8,
164                 .procname = "timeout",
165                 .data     = &timeout,
166                 .maxlen   = sizeof(int),
167                 .mode     = 0644,
168                 .proc_handler = &proc_dointvec
169         },
170         {
171                 .ctl_name = 9,
172                 .procname = "ntx",
173                 .data     = &ntx,
174                 .maxlen   = sizeof(int),
175                 .mode     = 0444,
176                 .proc_handler = &proc_dointvec
177         },
178         {
179                 .ctl_name = 10,
180                 .procname = "credits",
181                 .data     = &credits,
182                 .maxlen   = sizeof(int),
183                 .mode     = 0444,
184                 .proc_handler = &proc_dointvec
185         },
186         {
187                 .ctl_name = 11,
188                 .procname = "peer_credits",
189                 .data     = &peer_credits,
190                 .maxlen   = sizeof(int),
191                 .mode     = 0444,
192                 .proc_handler = &proc_dointvec
193         },
194         {
195                 .ctl_name = 12,
196                 .procname = "sd_retries",
197                 .data     = &sd_retries,
198                 .maxlen   = sizeof(int),
199                 .mode     = 0444,
200                 .proc_handler = &proc_dointvec
201         },
202         {
203                 .ctl_name = 13,
204                 .procname = "keepalive",
205                 .data     = &keepalive,
206                 .maxlen   = sizeof(int),
207                 .mode     = 0644,
208                 .proc_handler = &proc_dointvec
209         },
210         {
211                 .ctl_name = 14,
212                 .procname = "concurrent_sends",
213                 .data     = &concurrent_sends,
214                 .maxlen   = sizeof(int),
215                 .mode     = 0644,
216                 .proc_handler = &proc_dointvec
217         },
218         {0}
219 };
220
221 static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
222         {
223                 .ctl_name = 203,
224                 .procname = "openibnal",
225                 .data     = NULL,
226                 .maxlen   = 0,
227                 .mode     = 0555,
228                 .child    = kibnal_ctl_table
229         },
230         {0}
231 };
232
233 int
234 kibnal_tunables_init ()
235 {
236         kibnal_tunables.kib_sysctl =
237                 cfs_register_sysctl_table(kibnal_top_ctl_table, 0);
238
239         if (kibnal_tunables.kib_sysctl == NULL)
240                 CWARN("Can't setup /proc tunables\n");
241
242         if (*kibnal_tunables.kib_concurrent_sends > IBNAL_RX_MSGS)
243                 *kibnal_tunables.kib_concurrent_sends = IBNAL_RX_MSGS;
244         if (*kibnal_tunables.kib_concurrent_sends < IBNAL_MSG_QUEUE_SIZE)
245                 *kibnal_tunables.kib_concurrent_sends = IBNAL_MSG_QUEUE_SIZE;
246
247         return 0;
248 }
249
250 void
251 kibnal_tunables_fini ()
252 {
253         if (kibnal_tunables.kib_sysctl != NULL)
254                 cfs_unregister_sysctl_table(kibnal_tunables.kib_sysctl);
255 }
256
257 #else
258
259 int
260 kibnal_tunables_init ()
261 {
262         return 0;
263 }
264
265 void
266 kibnal_tunables_fini ()
267 {
268 }
269
270 #endif