Whamcloud - gitweb
ceb6e5d2ae65fdfd46745232baf2ce990897af2f
[fs/lustre-release.git] / lnet / klnds / iiblnd / iiblnd_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 "iiblnd.h"
25
26 static char *ipif_basename = "ib";
27 CFS_MODULE_PARM(ipif_basename, "s", charp, 0444,
28                 "IPoIB interface base name");
29
30 static char *service_name = "iiblnd";
31 CFS_MODULE_PARM(service_name, "s", charp, 0444,
32                 "IB service name");
33
34 static int service_number = 0x11b9a2;
35 CFS_MODULE_PARM(service_number, "i", int, 0444,
36                 "IB service number");
37
38 static int min_reconnect_interval = 1;
39 CFS_MODULE_PARM(min_reconnect_interval, "i", int, 0644,
40                 "minimum connection retry interval (seconds)");
41
42 static int max_reconnect_interval = 60;
43 CFS_MODULE_PARM(max_reconnect_interval, "i", int, 0644,
44                 "maximum connection retry interval (seconds)");
45
46 static int concurrent_peers = 1152;
47 CFS_MODULE_PARM(concurrent_peers, "i", int, 0444,
48                 "maximum number of peers that may connect");
49
50 static int cksum = 0;
51 CFS_MODULE_PARM(cksum, "i", int, 0644,
52                 "set non-zero to enable message (not RDMA) checksums");
53
54 static int timeout = 50;
55 CFS_MODULE_PARM(timeout, "i", int, 0644,
56                 "timeout (seconds)");
57
58 static int ntx = 256;
59 CFS_MODULE_PARM(ntx, "i", int, 0444,
60                 "# of message descriptors");
61
62 static int credits = 128;
63 CFS_MODULE_PARM(credits, "i", int, 0444,
64                 "# concurrent sends");
65
66 static int peer_credits = 8;
67 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
68                 "# concurrent sends to 1 peer");
69
70 static int sd_retries = 8;
71 CFS_MODULE_PARM(sd_retries, "i", int, 0444,
72                 "# times to retry SD queries");
73
74 static int keepalive = 100;
75 CFS_MODULE_PARM(keepalive, "i", int, 0644,
76                 "Idle time in seconds before sending a keepalive");
77
78 static int concurrent_sends = IBNAL_RX_MSGS;
79 CFS_MODULE_PARM(concurrent_sends, "i", int, 0644,
80                 "Send work queue sizing");
81
82 kib_tunables_t kibnal_tunables = {
83         .kib_ipif_basename          = &ipif_basename,
84         .kib_service_name           = &service_name,
85         .kib_service_number         = &service_number,
86         .kib_min_reconnect_interval = &min_reconnect_interval,
87         .kib_max_reconnect_interval = &max_reconnect_interval,
88         .kib_concurrent_peers       = &concurrent_peers,
89         .kib_cksum                  = &cksum,
90         .kib_timeout                = &timeout,
91         .kib_keepalive              = &keepalive,
92         .kib_ntx                    = &ntx,
93         .kib_credits                = &credits,
94         .kib_peercredits            = &peer_credits,
95         .kib_sd_retries             = &sd_retries,
96         .kib_concurrent_sends       = &concurrent_sends,
97 };
98
99 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
100
101 /* NB max_size specified for proc_dostring entries only needs to be big enough
102  * not to truncate the printout; it only needs to be the actual size of the
103  * string buffer if we allow writes (and we don't) */
104
105 static ctl_table kibnal_ctl_table[] = {
106         {1, "ipif_basename", &ipif_basename, 
107          1024, 0444, NULL, &proc_dostring},
108         {2, "service_name", &service_name, 
109          1024, 0444, NULL, &proc_dostring},
110         {3, "service_number", &service_number, 
111          sizeof(int), 0444, NULL, &proc_dointvec},
112         {4, "min_reconnect_interval", &min_reconnect_interval, 
113          sizeof(int), 0644, NULL, &proc_dointvec},
114         {5, "max_reconnect_interval", &max_reconnect_interval, 
115          sizeof(int), 0644, NULL, &proc_dointvec},
116         {6, "concurrent_peers", &concurrent_peers, 
117          sizeof(int), 0444, NULL, &proc_dointvec},
118         {7, "cksum", &cksum, 
119          sizeof(int), 0644, NULL, &proc_dointvec},
120         {8, "timeout", &timeout, 
121          sizeof(int), 0644, NULL, &proc_dointvec},
122         {9, "ntx", &ntx, 
123          sizeof(int), 0444, NULL, &proc_dointvec},
124         {10, "credits", &credits, 
125          sizeof(int), 0444, NULL, &proc_dointvec},
126         {11, "peer_credits", &peer_credits, 
127          sizeof(int), 0444, NULL, &proc_dointvec},
128         {12, "sd_retries", &sd_retries, 
129          sizeof(int), 0444, NULL, &proc_dointvec},
130         {13, "keepalive", &keepalive, 
131          sizeof(int), 0644, NULL, &proc_dointvec},
132         {14, "concurrent_sends", &concurrent_sends, 
133          sizeof(int), 0644, NULL, &proc_dointvec},
134         {0}
135 };
136
137 static ctl_table kibnal_top_ctl_table[] = {
138         {203, "openibnal", NULL, 0, 0555, kibnal_ctl_table},
139         {0}
140 };
141
142 int
143 kibnal_tunables_init ()
144 {
145         kibnal_tunables.kib_sysctl =
146                 register_sysctl_table(kibnal_top_ctl_table, 0);
147         
148         if (kibnal_tunables.kib_sysctl == NULL)
149                 CWARN("Can't setup /proc tunables\n");
150
151         if (*kibnal_tunables.kib_concurrent_sends > IBNAL_RX_MSGS)
152                 *kibnal_tunables.kib_concurrent_sends = IBNAL_RX_MSGS;
153         if (*kibnal_tunables.kib_concurrent_sends < IBNAL_MSG_QUEUE_SIZE)
154                 *kibnal_tunables.kib_concurrent_sends = IBNAL_MSG_QUEUE_SIZE;
155
156         return 0;
157 }
158
159 void
160 kibnal_tunables_fini ()
161 {
162         if (kibnal_tunables.kib_sysctl != NULL)
163                 unregister_sysctl_table(kibnal_tunables.kib_sysctl);
164 }
165
166 #else
167
168 int
169 kibnal_tunables_init ()
170 {
171         return 0;
172 }
173
174 void
175 kibnal_tunables_fini ()
176 {
177 }
178
179 #endif