Whamcloud - gitweb
Landing b_hd_newconfig on HEAD
[fs/lustre-release.git] / lnet / klnds / openiblnd / openiblnd_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 "openiblnd.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 int n_connd = 4;
31 CFS_MODULE_PARM(n_connd, "i", int, 0444,
32                 "# of connection daemons");
33
34 static int min_reconnect_interval = 1;
35 CFS_MODULE_PARM(min_reconnect_interval, "i", int, 0644,
36                 "minimum connection retry interval (seconds)");
37
38 static int max_reconnect_interval = 60;
39 CFS_MODULE_PARM(max_reconnect_interval, "i", int, 0644,
40                 "maximum connection retry interval (seconds)");
41
42 static int concurrent_peers = 1152;
43 CFS_MODULE_PARM(concurrent_peers, "i", int, 0444,
44                 "maximum number of peers that may connect");
45
46 static int cksum = 0;
47 CFS_MODULE_PARM(cksum, "i", int, 0644,
48                 "set non-zero to enable message (not RDMA) checksums");
49
50 static int timeout = 50;
51 CFS_MODULE_PARM(timeout, "i", int, 0644,
52                 "timeout (seconds)");
53
54 static int ntx = 384;
55 CFS_MODULE_PARM(ntx, "i", int, 0444,
56                 "# of message descriptors");
57
58 static int credits = 256;
59 CFS_MODULE_PARM(credits, "i", int, 0444,
60                 "# concurrent sends");
61
62 static int peer_credits = 16;
63 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
64                 "# concurrent sends to 1 peer");
65
66 static int keepalive = 100;
67 CFS_MODULE_PARM(keepalive, "i", int, 0644,
68                 "Idle time in seconds before sending a keepalive");
69
70 kib_tunables_t kibnal_tunables = {
71         .kib_ipif_basename          = &ipif_basename,
72         .kib_n_connd                = &n_connd,
73         .kib_min_reconnect_interval = &min_reconnect_interval,
74         .kib_max_reconnect_interval = &max_reconnect_interval,
75         .kib_concurrent_peers       = &concurrent_peers,
76         .kib_cksum                  = &cksum,
77         .kib_timeout                = &timeout,
78         .kib_ntx                    = &ntx,
79         .kib_credits                = &credits,
80         .kib_peercredits            = &peer_credits,
81         .kib_keepalive              = &keepalive,
82 };
83
84 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
85
86 static ctl_table kibnal_ctl_table[] = {
87         {1, "ipif_basename", &ipif_basename, 
88          1024, 0444, NULL, &proc_dostring},
89         {2, "n_connd", &n_connd, 
90          sizeof(int), 0444, NULL, &proc_dointvec},
91         {3, "min_reconnect_interval", &min_reconnect_interval, 
92          sizeof(int), 0644, NULL, &proc_dointvec},
93         {4, "max_reconnect_interval", &max_reconnect_interval, 
94          sizeof(int), 0644, NULL, &proc_dointvec},
95         {5, "concurrent_peers", &concurrent_peers, 
96          sizeof(int), 0444, NULL, &proc_dointvec},
97         {6, "cksum", &cksum, 
98          sizeof(int), 0644, NULL, &proc_dointvec},
99         {7, "timeout", &timeout, 
100          sizeof(int), 0644, NULL, &proc_dointvec},
101         {8, "ntx", &ntx, 
102          sizeof(int), 0444, NULL, &proc_dointvec},
103         {9, "credits", &credits, 
104          sizeof(int), 0444, NULL, &proc_dointvec},
105         {10, "peer_credits", &peer_credits, 
106          sizeof(int), 0444, NULL, &proc_dointvec},
107         {11, "keepalive", &keepalive, 
108          sizeof(int), 0644, NULL, &proc_dointvec},
109         {0}
110 };
111
112 static ctl_table kibnal_top_ctl_table[] = {
113         {203, "openibnal", NULL, 0, 0555, kibnal_ctl_table},
114         {0}
115 };
116
117 int
118 kibnal_tunables_init ()
119 {
120         kibnal_tunables.kib_sysctl =
121                 register_sysctl_table(kibnal_top_ctl_table, 0);
122         
123         if (kibnal_tunables.kib_sysctl == NULL)
124                 CWARN("Can't setup /proc tunables\n");
125
126         return 0;
127 }
128
129 void
130 kibnal_tunables_fini ()
131 {
132         if (kibnal_tunables.kib_sysctl != NULL)
133                 unregister_sysctl_table(kibnal_tunables.kib_sysctl);
134 }
135
136 #else
137
138 int
139 kibnal_tunables_init ()
140 {
141         return 0;
142 }
143
144 void
145 kibnal_tunables_fini ()
146 {
147 }
148
149 #endif