Whamcloud - gitweb
b=13800
[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  * Copyright (C) 2004 Cluster File Systems, Inc.
5  *   Author: Eric Barton <eric@bartonsoftware.com>
6  *
7  *   This file is part of Lustre, http://www.lustre.org.
8  *
9  *   Lustre is free software; you can redistribute it and/or
10  *   modify it under the terms of version 2 of the GNU General Public
11  *   License as published by the Free Software Foundation.
12  *
13  *   Lustre is distributed in the hope that it will be useful,
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *   GNU General Public License for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with Lustre; if not, write to the Free Software
20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */
23
24 #include "ralnd.h"
25
26 static int n_connd = 4;
27 CFS_MODULE_PARM(n_connd, "i", int, 0444,
28                 "# of connection daemons");
29
30 static int min_reconnect_interval = 1;
31 CFS_MODULE_PARM(min_reconnect_interval, "i", int, 0644,
32                 "minimum connection retry interval (seconds)");
33
34 static int max_reconnect_interval = 60;
35 CFS_MODULE_PARM(max_reconnect_interval, "i", int, 0644,
36                 "maximum connection retry interval (seconds)");
37
38 static int ntx = 256;
39 CFS_MODULE_PARM(ntx, "i", int, 0444,
40                 "# of transmit descriptors");
41
42 static int credits = 128;
43 CFS_MODULE_PARM(credits, "i", int, 0444,
44                 "# concurrent sends");
45
46 static int peer_credits = 32;
47 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
48                 "# concurrent sends to 1 peer");
49
50 static int fma_cq_size = 8192;
51 CFS_MODULE_PARM(fma_cq_size, "i", int, 0444,
52                 "size of the completion queue");
53
54 static int timeout = 30;
55 CFS_MODULE_PARM(timeout, "i", int, 0644,
56                 "communications timeout (seconds)");
57
58 static int max_immediate = (2<<10);
59 CFS_MODULE_PARM(max_immediate, "i", int, 0644,
60                 "immediate/RDMA breakpoint");
61
62 kra_tunables_t kranal_tunables = {
63         .kra_n_connd                = &n_connd,
64         .kra_min_reconnect_interval = &min_reconnect_interval,
65         .kra_max_reconnect_interval = &max_reconnect_interval,
66         .kra_ntx                    = &ntx,
67         .kra_credits                = &credits,
68         .kra_peercredits            = &peer_credits,
69         .kra_fma_cq_size            = &fma_cq_size,
70         .kra_timeout                = &timeout,
71         .kra_max_immediate          = &max_immediate,
72 };
73
74 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
75 static cfs_sysctl_table_t kranal_ctl_table[] = {
76         {
77                 .ctl_name = 1,
78                 .procname = "n_connd",
79                 .data     = &n_connd,
80                 .maxlen   = sizeof(int),
81                 .mode     = 0444,
82                 .proc_handler = &proc_dointvec
83         },
84         {
85                 .ctl_name = 2,
86                 .procname = "min_reconnect_interval",
87                 .data     = &min_reconnect_interval,
88                 .maxlen   = sizeof(int),
89                 .mode     = 0644,
90                 .proc_handler = &proc_dointvec
91         },
92         {
93                 .ctl_name = 3,
94                 .procname = "max_reconnect_interval",
95                 .data     = &max_reconnect_interval,
96                 .maxlen   = sizeof(int),
97                 .mode     = 0644,
98                 .proc_handler = &proc_dointvec
99         },
100         {
101                 .ctl_name = 4,
102                 .procname = "ntx",
103                 .data     = &ntx,
104                 .maxlen   = sizeof(int),
105                 .mode     = 0444,
106                 .proc_handler = &proc_dointvec
107         },
108         {
109                 .ctl_name = 5,
110                 .procname = "credits",
111                 .data     = &credits,
112                 .maxlen   = sizeof(int),
113                 .mode     = 0444,
114                 .proc_handler = &proc_dointvec
115         },
116         {
117                 .ctl_name = 6,
118                 .procname = "peer_credits",
119                 .data     = &peer_credits,
120                 .maxlen   = sizeof(int),
121                 .mode     = 0444,
122                 .proc_handler = &proc_dointvec
123         },
124         {
125                 .ctl_name = 7,
126                 .procname = "fma_cq_size",
127                 .data     = &fma_cq_size,
128                 .maxlen   = sizeof(int),
129                 .mode     = 0444,
130                 .proc_handler = &proc_dointvec
131         },
132         {
133                 .ctl_name = 8,
134                 .procname = "timeout",
135                 .data     = &timeout,
136                 .maxlen   = sizeof(int),
137                 .mode     = 0644,
138                 .proc_handler = &proc_dointvec
139         },
140         {
141                 .ctl_name = 9,
142                 .procname = "max_immediate",
143                 .data     = &max_immediate,
144                 .maxlen   = sizeof(int),
145                 .mode     = 0644,
146                 .proc_handler = &proc_dointvec
147         },
148         {0}
149 };
150
151 static cfs_sysctl_table_t kranal_top_ctl_table[] = {
152         {
153                 .ctl_name = 202,
154                 .procname = "ranal",
155                 .data     = NULL,
156                 .maxlen   = 0,
157                 .mode     = 0555,
158                 .child    = kranal_ctl_table
159         },
160         {0}
161 };
162
163 int
164 kranal_tunables_init ()
165 {
166         kranal_tunables.kra_sysctl =
167                 cfs_register_sysctl_table(kranal_top_ctl_table, 0);
168
169         if (kranal_tunables.kra_sysctl == NULL)
170                 CWARN("Can't setup /proc tunables\n");
171
172         return 0;
173 }
174
175 void
176 kranal_tunables_fini ()
177 {
178         if (kranal_tunables.kra_sysctl != NULL)
179                 cfs_unregister_sysctl_table(kranal_tunables.kra_sysctl);
180 }
181
182 #else
183
184 int
185 kranal_tunables_init ()
186 {
187         return 0;
188 }
189
190 void
191 kranal_tunables_fini ()
192 {
193 }
194
195 #endif
196