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