Whamcloud - gitweb
Introduce .gitignore files.
[fs/lustre-release.git] / lnet / klnds / ralnd / ralnd_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/ralnd/ralnd_modparams.c
37  *
38  * Author: Eric Barton <eric@bartonsoftware.com>
39  */
40
41 #include "ralnd.h"
42
43 static int n_connd = 4;
44 CFS_MODULE_PARM(n_connd, "i", int, 0444,
45                 "# of connection daemons");
46
47 static int min_reconnect_interval = 1;
48 CFS_MODULE_PARM(min_reconnect_interval, "i", int, 0644,
49                 "minimum connection retry interval (seconds)");
50
51 static int max_reconnect_interval = 60;
52 CFS_MODULE_PARM(max_reconnect_interval, "i", int, 0644,
53                 "maximum connection retry interval (seconds)");
54
55 static int ntx = 256;
56 CFS_MODULE_PARM(ntx, "i", int, 0444,
57                 "# of transmit descriptors");
58
59 static int credits = 128;
60 CFS_MODULE_PARM(credits, "i", int, 0444,
61                 "# concurrent sends");
62
63 static int peer_credits = 32;
64 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
65                 "# concurrent sends to 1 peer");
66
67 static int fma_cq_size = 8192;
68 CFS_MODULE_PARM(fma_cq_size, "i", int, 0444,
69                 "size of the completion queue");
70
71 static int timeout = 30;
72 CFS_MODULE_PARM(timeout, "i", int, 0644,
73                 "communications timeout (seconds)");
74
75 static int max_immediate = (2<<10);
76 CFS_MODULE_PARM(max_immediate, "i", int, 0644,
77                 "immediate/RDMA breakpoint");
78
79 kra_tunables_t kranal_tunables = {
80         .kra_n_connd                = &n_connd,
81         .kra_min_reconnect_interval = &min_reconnect_interval,
82         .kra_max_reconnect_interval = &max_reconnect_interval,
83         .kra_ntx                    = &ntx,
84         .kra_credits                = &credits,
85         .kra_peercredits            = &peer_credits,
86         .kra_fma_cq_size            = &fma_cq_size,
87         .kra_timeout                = &timeout,
88         .kra_max_immediate          = &max_immediate,
89 };
90
91 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
92
93 #ifndef HAVE_SYSCTL_UNNUMBERED
94 enum {
95         KRANAL_N_CONND = 1,
96         KRANAL_RECONNECT_MIN,
97         KRANAL_RECONNECT_MAX,
98         KRANAL_NTX,
99         KRANAL_CREDITS,
100         KRANAL_PEERCREDITS,
101         KRANAL_FMA_CQ_SIZE,
102         KRANAL_TIMEOUT,
103         KRANAL_IMMEDIATE_MAX
104 };
105 #else
106
107 #define KRANAL_N_CONND          CTL_UNNUMBERED
108 #define KRANAL_RECONNECT_MIN    CTL_UNNUMBERED
109 #define KRANAL_RECONNECT_MAX    CTL_UNNUMBERED
110 #define KRANAL_NTX              CTL_UNNUMBERED
111 #define KRANAL_CREDITS          CTL_UNNUMBERED
112 #define KRANAL_PEERCREDITS      CTL_UNNUMBERED
113 #define KRANAL_FMA_CQ_SIZE      CTL_UNNUMBERED
114 #define KRANAL_TIMEOUT          CTL_UNNUMBERED
115 #define KRENAL_IMMEDIATE_MAX    CTL_UNNUMBERED
116 #endif
117
118 static cfs_sysctl_table_t kranal_ctl_table[] = {
119         {
120                 .ctl_name = KRANAL_N_CONND,
121                 .procname = "n_connd",
122                 .data     = &n_connd,
123                 .maxlen   = sizeof(int),
124                 .mode     = 0444,
125                 .proc_handler = &proc_dointvec
126         },
127         {
128                 .ctl_name = KRANAL_RECONNECT_MIN,
129                 .procname = "min_reconnect_interval",
130                 .data     = &min_reconnect_interval,
131                 .maxlen   = sizeof(int),
132                 .mode     = 0644,
133                 .proc_handler = &proc_dointvec
134         },
135         {
136                 .ctl_name = KRANAL_RECONNECT_MAX,
137                 .procname = "max_reconnect_interval",
138                 .data     = &max_reconnect_interval,
139                 .maxlen   = sizeof(int),
140                 .mode     = 0644,
141                 .proc_handler = &proc_dointvec
142         },
143         {
144                 .ctl_name = KRANAL_NTX,
145                 .procname = "ntx",
146                 .data     = &ntx,
147                 .maxlen   = sizeof(int),
148                 .mode     = 0444,
149                 .proc_handler = &proc_dointvec
150         },
151         {
152                 .ctl_name = KRANAL_CREDITS,
153                 .procname = "credits",
154                 .data     = &credits,
155                 .maxlen   = sizeof(int),
156                 .mode     = 0444,
157                 .proc_handler = &proc_dointvec
158         },
159         {
160                 .ctl_name = KRANAL_PEERCREDITS,
161                 .procname = "peer_credits",
162                 .data     = &peer_credits,
163                 .maxlen   = sizeof(int),
164                 .mode     = 0444,
165                 .proc_handler = &proc_dointvec
166         },
167         {
168                 .ctl_name = KRANAL_FMA_CQ_SIZE,
169                 .procname = "fma_cq_size",
170                 .data     = &fma_cq_size,
171                 .maxlen   = sizeof(int),
172                 .mode     = 0444,
173                 .proc_handler = &proc_dointvec
174         },
175         {
176                 .ctl_name = KRANAL_TIMEOUT,
177                 .procname = "timeout",
178                 .data     = &timeout,
179                 .maxlen   = sizeof(int),
180                 .mode     = 0644,
181                 .proc_handler = &proc_dointvec
182         },
183         {
184                 .ctl_name = KRANAL_IMMEDIATE_MAX,
185                 .procname = "max_immediate",
186                 .data     = &max_immediate,
187                 .maxlen   = sizeof(int),
188                 .mode     = 0644,
189                 .proc_handler = &proc_dointvec
190         },
191         {0}
192 };
193
194 static cfs_sysctl_table_t kranal_top_ctl_table[] = {
195         {
196                 .ctl_name = CTL_KRANAL,
197                 .procname = "ranal",
198                 .data     = NULL,
199                 .maxlen   = 0,
200                 .mode     = 0555,
201                 .child    = kranal_ctl_table
202         },
203         {0}
204 };
205
206 int
207 kranal_tunables_init ()
208 {
209         kranal_tunables.kra_sysctl =
210                 cfs_register_sysctl_table(kranal_top_ctl_table, 0);
211
212         if (kranal_tunables.kra_sysctl == NULL)
213                 CWARN("Can't setup /proc tunables\n");
214
215         return 0;
216 }
217
218 void
219 kranal_tunables_fini ()
220 {
221         if (kranal_tunables.kra_sysctl != NULL)
222                 cfs_unregister_sysctl_table(kranal_tunables.kra_sysctl);
223 }
224
225 #else
226
227 int
228 kranal_tunables_init ()
229 {
230         return 0;
231 }
232
233 void
234 kranal_tunables_fini ()
235 {
236 }
237
238 #endif