Whamcloud - gitweb
Landing b_hd_newconfig on HEAD
[fs/lustre-release.git] / lnet / klnds / viblnd / viblnd_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 "viblnd.h"
25
26 static int service_number = 0x11b9a2;
27 CFS_MODULE_PARM(service_number, "i", int, 0444,
28                 "IB service number");
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 concurrent_peers = 1152;
39 CFS_MODULE_PARM(concurrent_peers, "i", int, 0444,
40                 "maximum number of peers that may connect");
41
42 static int cksum = 0;
43 CFS_MODULE_PARM(cksum, "i", int, 0644,
44                 "set non-zero to enable message (not RDMA) checksums");
45
46 static int timeout = 50;
47 CFS_MODULE_PARM(timeout, "i", int, 0644,
48                 "timeout (seconds)");
49
50 static int ntx = 256;
51 CFS_MODULE_PARM(ntx, "i", int, 0444,
52                 "# of message descriptors");
53
54 static int credits = 128;
55 CFS_MODULE_PARM(credits, "i", int, 0444,
56                 "# concurrent sends");
57
58 static int peer_credits = 8;
59 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
60                 "# concurrent sends to 1 peer");
61
62 static int arp_retries = 3;
63 CFS_MODULE_PARM(arp_retries, "i", int, 0644,
64                 "# of times to retry ARP");
65
66 static char *hca_basename = "InfiniHost";
67 CFS_MODULE_PARM(hca_basename, "s", charp, 0444,
68                 "HCA base name");
69
70 static char *ipif_basename = "ipoib";
71 CFS_MODULE_PARM(ipif_basename, "s", charp, 0444,
72                 "IPoIB interface base name");
73
74 static int local_ack_timeout = 0x12;
75 CFS_MODULE_PARM(local_ack_timeout, "i", int, 0644,
76                 "ACK timeout for low-level 'sends'");
77
78 static int retry_cnt = 7;
79 CFS_MODULE_PARM(retry_cnt, "i", int, 0644,
80                 "Retransmissions when no ACK received");
81
82 static int rnr_cnt = 6;
83 CFS_MODULE_PARM(rnr_cnt, "i", int, 0644,
84                 "RNR retransmissions");
85
86 static int rnr_nak_timer = 0x10;
87 CFS_MODULE_PARM(rnr_nak_timer, "i", int, 0644,
88                 "RNR retransmission interval");
89
90 static int keepalive = 100;
91 CFS_MODULE_PARM(keepalive, "i", int, 0644,
92                 "Idle time in seconds before sending a keepalive");
93
94 static int concurrent_sends = IBNAL_RX_MSGS;
95 CFS_MODULE_PARM(concurrent_sends, "i", int, 0644,
96                 "send work-queue sizing");
97
98 #if IBNAL_USE_FMR
99 static int fmr_remaps = 1000;
100 CFS_MODULE_PARM(fmr_remaps, "i", int, 0444,
101                 "FMR mappings allowed before unmap");
102 #endif
103
104 kib_tunables_t kibnal_tunables = {
105         .kib_service_number         = &service_number,
106         .kib_min_reconnect_interval = &min_reconnect_interval,
107         .kib_max_reconnect_interval = &max_reconnect_interval,
108         .kib_concurrent_peers       = &concurrent_peers,
109         .kib_cksum                  = &cksum,
110         .kib_timeout                = &timeout,
111         .kib_ntx                    = &ntx,
112         .kib_credits                = &credits,
113         .kib_peercredits            = &peer_credits,
114         .kib_arp_retries            = &arp_retries,
115         .kib_hca_basename           = &hca_basename,
116         .kib_ipif_basename          = &ipif_basename,
117         .kib_local_ack_timeout      = &local_ack_timeout,
118         .kib_retry_cnt              = &retry_cnt,
119         .kib_rnr_cnt                = &rnr_cnt,
120         .kib_rnr_nak_timer          = &rnr_nak_timer,
121         .kib_keepalive              = &keepalive,
122         .kib_concurrent_sends       = &concurrent_sends,
123 #if IBNAL_USE_FMR
124         .kib_fmr_remaps             = &fmr_remaps,
125 #endif
126 };
127
128 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
129
130 static char hca_basename_space[32];
131 static char ipif_basename_space[32];
132
133 static ctl_table kibnal_ctl_table[] = {
134         {1, "service_number", &service_number, 
135          sizeof(int), 0444, NULL, &proc_dointvec},
136         {2, "min_reconnect_interval", &min_reconnect_interval, 
137          sizeof(int), 0644, NULL, &proc_dointvec},
138         {3, "max_reconnect_interval", &max_reconnect_interval, 
139          sizeof(int), 0644, NULL, &proc_dointvec},
140         {4, "concurrent_peers", &concurrent_peers, 
141          sizeof(int), 0444, NULL, &proc_dointvec},
142         {5, "cksum", &cksum, 
143          sizeof(int), 0644, NULL, &proc_dointvec},
144         {6, "timeout", &timeout, 
145          sizeof(int), 0644, NULL, &proc_dointvec},
146         {7, "ntx", &ntx, 
147          sizeof(int), 0444, NULL, &proc_dointvec},
148         {8, "credits", &credits, 
149          sizeof(int), 0444, NULL, &proc_dointvec},
150         {9, "peer_credits", &peer_credits, 
151          sizeof(int), 0444, NULL, &proc_dointvec},
152         {10, "arp_retries", &arp_retries, 
153          sizeof(int), 0644, NULL, &proc_dointvec},
154         {11, "hca_basename", hca_basename_space, 
155          sizeof(hca_basename_space), 0444, NULL, &proc_dostring},
156         {12, "ipif_basename", ipif_basename_space, 
157          sizeof(ipif_basename_space), 0444, NULL, &proc_dostring},
158         {13, "local_ack_timeout", &local_ack_timeout, 
159          sizeof(int), 0644, NULL, &proc_dointvec},
160         {14, "retry_cnt", &retry_cnt, 
161          sizeof(int), 0644, NULL, &proc_dointvec},
162         {15, "rnr_cnt", &rnr_cnt, 
163          sizeof(int), 0644, NULL, &proc_dointvec},
164         {16, "rnr_nak_timer", &rnr_nak_timer, 
165          sizeof(int), 0644, NULL, &proc_dointvec},
166         {17, "keepalive", &keepalive, 
167          sizeof(int), 0644, NULL, &proc_dointvec},
168         {18, "concurrent_sends", &concurrent_sends, 
169          sizeof(int), 0644, NULL, &proc_dointvec},
170 #if IBNAL_USE_FMR
171         {19, "fmr_remaps", &fmr_remaps, 
172          sizeof(int), 0444, NULL, &proc_dointvec},
173 #endif        
174         {0}
175 };
176
177 static ctl_table kibnal_top_ctl_table[] = {
178         {203, "vibnal", NULL, 0, 0555, kibnal_ctl_table},
179         {0}
180 };
181
182 void
183 kibnal_initstrtunable(char *space, char *str, int size)
184 {
185         strncpy(space, str, size);
186         space[size-1] = 0;
187 }
188
189 int
190 kibnal_tunables_init ()
191 {
192         kibnal_initstrtunable(hca_basename_space, hca_basename,
193                               sizeof(hca_basename_space));
194         kibnal_initstrtunable(ipif_basename_space, ipif_basename,
195                               sizeof(ipif_basename_space));
196
197         kibnal_tunables.kib_sysctl =
198                 register_sysctl_table(kibnal_top_ctl_table, 0);
199         
200         if (kibnal_tunables.kib_sysctl == NULL)
201                 CWARN("Can't setup /proc tunables\n");
202
203         if (*kibnal_tunables.kib_concurrent_sends > IBNAL_RX_MSGS)
204                 *kibnal_tunables.kib_concurrent_sends = IBNAL_RX_MSGS;
205         if (*kibnal_tunables.kib_concurrent_sends < IBNAL_MSG_QUEUE_SIZE)
206                 *kibnal_tunables.kib_concurrent_sends = IBNAL_MSG_QUEUE_SIZE;
207
208         return 0;
209 }
210
211 void
212 kibnal_tunables_fini ()
213 {
214         if (kibnal_tunables.kib_sysctl != NULL)
215                 unregister_sysctl_table(kibnal_tunables.kib_sysctl);
216 }
217
218 #else
219
220 int
221 kibnal_tunables_init ()
222 {
223         return 0;
224 }
225
226 void
227 kibnal_tunables_fini ()
228 {
229 }
230
231 #endif
232         
233                 
234                 
235
236         
237