Whamcloud - gitweb
b=16098
[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 [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/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 static cfs_sysctl_table_t kranal_ctl_table[] = {
93         {
94                 .ctl_name = 1,
95                 .procname = "n_connd",
96                 .data     = &n_connd,
97                 .maxlen   = sizeof(int),
98                 .mode     = 0444,
99                 .proc_handler = &proc_dointvec
100         },
101         {
102                 .ctl_name = 2,
103                 .procname = "min_reconnect_interval",
104                 .data     = &min_reconnect_interval,
105                 .maxlen   = sizeof(int),
106                 .mode     = 0644,
107                 .proc_handler = &proc_dointvec
108         },
109         {
110                 .ctl_name = 3,
111                 .procname = "max_reconnect_interval",
112                 .data     = &max_reconnect_interval,
113                 .maxlen   = sizeof(int),
114                 .mode     = 0644,
115                 .proc_handler = &proc_dointvec
116         },
117         {
118                 .ctl_name = 4,
119                 .procname = "ntx",
120                 .data     = &ntx,
121                 .maxlen   = sizeof(int),
122                 .mode     = 0444,
123                 .proc_handler = &proc_dointvec
124         },
125         {
126                 .ctl_name = 5,
127                 .procname = "credits",
128                 .data     = &credits,
129                 .maxlen   = sizeof(int),
130                 .mode     = 0444,
131                 .proc_handler = &proc_dointvec
132         },
133         {
134                 .ctl_name = 6,
135                 .procname = "peer_credits",
136                 .data     = &peer_credits,
137                 .maxlen   = sizeof(int),
138                 .mode     = 0444,
139                 .proc_handler = &proc_dointvec
140         },
141         {
142                 .ctl_name = 7,
143                 .procname = "fma_cq_size",
144                 .data     = &fma_cq_size,
145                 .maxlen   = sizeof(int),
146                 .mode     = 0444,
147                 .proc_handler = &proc_dointvec
148         },
149         {
150                 .ctl_name = 8,
151                 .procname = "timeout",
152                 .data     = &timeout,
153                 .maxlen   = sizeof(int),
154                 .mode     = 0644,
155                 .proc_handler = &proc_dointvec
156         },
157         {
158                 .ctl_name = 9,
159                 .procname = "max_immediate",
160                 .data     = &max_immediate,
161                 .maxlen   = sizeof(int),
162                 .mode     = 0644,
163                 .proc_handler = &proc_dointvec
164         },
165         {0}
166 };
167
168 static cfs_sysctl_table_t kranal_top_ctl_table[] = {
169         {
170                 .ctl_name = 202,
171                 .procname = "ranal",
172                 .data     = NULL,
173                 .maxlen   = 0,
174                 .mode     = 0555,
175                 .child    = kranal_ctl_table
176         },
177         {0}
178 };
179
180 int
181 kranal_tunables_init ()
182 {
183         kranal_tunables.kra_sysctl =
184                 cfs_register_sysctl_table(kranal_top_ctl_table, 0);
185
186         if (kranal_tunables.kra_sysctl == NULL)
187                 CWARN("Can't setup /proc tunables\n");
188
189         return 0;
190 }
191
192 void
193 kranal_tunables_fini ()
194 {
195         if (kranal_tunables.kra_sysctl != NULL)
196                 cfs_unregister_sysctl_table(kranal_tunables.kra_sysctl);
197 }
198
199 #else
200
201 int
202 kranal_tunables_init ()
203 {
204         return 0;
205 }
206
207 void
208 kranal_tunables_fini ()
209 {
210 }
211
212 #endif