Whamcloud - gitweb
LU-6020 kerberos: proper sg list initialization
[fs/lustre-release.git] / lnet / klnds / mxlnd / mxlnd_modparams.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (C) 2006 Myricom, Inc.
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/mxlnd/mxlnd.c
37  *
38  * Author: Eric Barton <eric@bartonsoftware.com>
39  * Author: Scott Atchley <atchley at myri.com>
40  */
41
42 #include "mxlnd.h"
43
44 static int n_waitd = MXLND_N_SCHED;
45 CFS_MODULE_PARM(n_waitd, "i", int, 0444,
46                 "# of completion daemons");
47
48 /* this was used to allocate global rxs which are no londer used */
49 static int max_peers = MXLND_MAX_PEERS;
50 CFS_MODULE_PARM(max_peers, "i", int, 0444,
51                 "Unused - was maximum number of peers that may connect");
52
53 static int cksum = MXLND_CKSUM;
54 CFS_MODULE_PARM(cksum, "i", int, 0644,
55                 "set non-zero to enable message (not data payload) checksums");
56
57 static int ntx = MXLND_NTX;
58 CFS_MODULE_PARM(ntx, "i", int, 0444,
59                 "# of total tx message descriptors");
60
61 /* this duplicates ntx */
62 static int credits = MXLND_NTX;
63 CFS_MODULE_PARM(credits, "i", int, 0444,
64                 "Unused - was # concurrent sends to all peers");
65
66 static int peercredits = MXLND_MSG_QUEUE_DEPTH;
67 CFS_MODULE_PARM(peercredits, "i", int, 0444,
68                 "# concurrent sends to one peer");
69
70 static int board = MXLND_MX_BOARD;
71 CFS_MODULE_PARM(board, "i", int, 0444,
72                 "index value of the Myrinet board (NIC)");
73
74 static int ep_id = MXLND_MX_EP_ID;
75 CFS_MODULE_PARM(ep_id, "i", int, 0444, "MX endpoint ID");
76
77 static char *ipif_name = "myri0";
78 CFS_MODULE_PARM(ipif_name, "s", charp, 0444,
79                 "IPoMX interface name");
80
81 static int polling = MXLND_POLLING;
82 CFS_MODULE_PARM(polling, "i", int, 0444,
83                 "Use 0 to block (wait). A value > 0 will poll that many times before blocking");
84
85 static char *hosts = NULL;
86 CFS_MODULE_PARM(hosts, "s", charp, 0444,
87                 "Unused - was IP-to-hostname resolution file");
88
89 kmx_tunables_t kmxlnd_tunables = {
90         .kmx_n_waitd            = &n_waitd,
91         .kmx_max_peers          = &max_peers,
92         .kmx_cksum              = &cksum,
93         .kmx_ntx                = &ntx,
94         .kmx_credits            = &credits,
95         .kmx_peercredits        = &peercredits,
96         .kmx_board              = &board,
97         .kmx_ep_id              = &ep_id,
98         .kmx_default_ipif       = &ipif_name,
99         .kmx_polling            = &polling
100 };
101
102 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
103
104 static char ipif_basename_space[32];
105
106 static struct ctl_table kmxlnd_ctl_table[] = {
107         {
108                 INIT_CTL_NAME
109                 .procname       = "n_waitd",
110                 .data           = &n_waitd,
111                 .maxlen         = sizeof(int),
112                 .mode           = 0444,
113                 .proc_handler   = &proc_dointvec
114         },
115         {
116                 INIT_CTL_NAME
117                 .procname       = "max_peers",
118                 .data           = &max_peers,
119                 .maxlen         = sizeof(int),
120                 .mode           = 0444,
121                 .proc_handler   = &proc_dointvec
122         },
123         {
124                 INIT_CTL_NAME
125                 .procname       = "cksum",
126                 .data           = &cksum,
127                 .maxlen         = sizeof(int),
128                 .mode           = 0644,
129                 .proc_handler   = &proc_dointvec
130         },
131         {
132                 INIT_CTL_NAME
133                 .procname       = "ntx",
134                 .data           = &ntx,
135                 .maxlen         = sizeof(int),
136                 .mode           = 0444,
137                 .proc_handler   = &proc_dointvec
138         },
139         {
140                 INIT_CTL_NAME
141                 .procname       = "credits",
142                 .data           = &credits,
143                 .maxlen         = sizeof(int),
144                 .mode           = 0444,
145                 .proc_handler   = &proc_dointvec
146         },
147         {
148                 INIT_CTL_NAME
149                 .procname       = "peercredits",
150                 .data           = &peercredits,
151                 .maxlen         = sizeof(int),
152                 .mode           = 0444,
153                 .proc_handler   = &proc_dointvec
154         },
155         {
156                 INIT_CTL_NAME
157                 .procname       = "board",
158                 .data           = &board,
159                 .maxlen         = sizeof(int),
160                 .mode           = 0444,
161                 .proc_handler   = &proc_dointvec
162         },
163         {
164                 INIT_CTL_NAME
165                 .procname       = "ep_id",
166                 .data           = &ep_id,
167                 .maxlen         = sizeof(int),
168                 .mode           = 0444,
169                 .proc_handler   = &proc_dointvec
170         },
171         {
172                 .procname       = "ipif_name",
173                 .data           = ipif_basename_space,
174                 .maxlen         = sizeof(ipif_basename_space),
175                 .mode           = 0444,
176                 .proc_handler   = &proc_dostring
177         },
178         {
179                 INIT_CTL_NAME
180                 .procname       = "polling",
181                 .data           = &polling,
182                 .maxlen         = sizeof(int),
183                 .mode           = 0444,
184                 .proc_handler   = &proc_dointvec
185         },
186         { 0 }
187 };
188
189 static struct ctl_table kmxlnd_top_ctl_table[] = {
190         {
191                 INIT_CTL_NAME
192                 .procname       = "mxlnd",
193                 .data           = NULL,
194                 .maxlen         = 0,
195                 .mode           = 0555,
196                 .child          = kmxlnd_ctl_table
197         },
198         { 0 }
199 };
200
201 void
202 kmxlnd_initstrtunable(char *space, char *str, int size)
203 {
204         strncpy(space, str, size);
205         space[size-1] = 0;
206 }
207
208 void
209 kmxlnd_sysctl_init (void)
210 {
211         kmxlnd_initstrtunable(ipif_basename_space, ipif_name,
212                               sizeof(ipif_basename_space));
213
214         kmxlnd_tunables.kib_sysctl =
215                 register_sysctl_table(kmxlnd_top_ctl_table);
216
217         if (kmxlnd_tunables.kib_sysctl == NULL)
218                 CWARN("Can't setup /proc tunables\n");
219 }
220
221 void
222 kmxlnd_sysctl_fini (void)
223 {
224         if (kmxlnd_tunables.kib_sysctl != NULL)
225                 unregister_sysctl_table(kmxlnd_tunables.kib_sysctl);
226 }
227
228 #else
229
230 void
231 kmxlnd_sysctl_init (void)
232 {
233 }
234
235 void
236 kmxlnd_sysctl_fini (void)
237 {
238 }
239
240 #endif
241
242 int
243 kmxlnd_tunables_init (void)
244 {
245         kmxlnd_sysctl_init();
246         return 0;
247 }
248
249 void
250 kmxlnd_tunables_fini (void)
251 {
252         kmxlnd_sysctl_fini();
253 }