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