1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2006 Cluster File Systems, Inc.
5 * Author: Eric Barton <eric@bartonsoftware.com>
7 * This file is part of Lustre, http://www.lustre.org.
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.
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.
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.
26 static int service = 987;
27 CFS_MODULE_PARM(service, "i", int, 0444,
28 "service number (within RDMA_PS_TCP)");
31 CFS_MODULE_PARM(cksum, "i", int, 0644,
32 "set non-zero to enable message (not RDMA) checksums");
34 static int timeout = 50;
35 CFS_MODULE_PARM(timeout, "i", int, 0644,
39 CFS_MODULE_PARM(ntx, "i", int, 0444,
40 "# of message descriptors");
42 static int credits = 64;
43 CFS_MODULE_PARM(credits, "i", int, 0444,
44 "# concurrent sends");
46 static int peer_credits = 8;
47 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
48 "# concurrent sends to 1 peer");
50 static char *ipif_name = "ib0";
51 CFS_MODULE_PARM(ipif_name, "s", charp, 0444,
52 "IPoIB interface name");
54 static int retry_count = 5;
55 CFS_MODULE_PARM(retry_count, "i", int, 0644,
56 "Retransmissions when no ACK received");
58 static int rnr_retry_count = 6;
59 CFS_MODULE_PARM(rnr_retry_count, "i", int, 0644,
60 "RNR retransmissions");
62 static int keepalive = 100;
63 CFS_MODULE_PARM(keepalive, "i", int, 0644,
64 "Idle time in seconds before sending a keepalive");
66 static int ib_mtu = 0;
67 CFS_MODULE_PARM(ib_mtu, "i", int, 0444,
68 "IB MTU 256/512/1024/2048/4096");
70 #if IBLND_MAP_ON_DEMAND
71 static int concurrent_sends = IBLND_RX_MSGS;
73 static int concurrent_sends = IBLND_MSG_QUEUE_SIZE;
75 CFS_MODULE_PARM(concurrent_sends, "i", int, 0444,
76 "send work-queue sizing");
78 #if IBLND_MAP_ON_DEMAND
79 static int fmr_pool_size = 512;
80 CFS_MODULE_PARM(fmr_pool_size, "i", int, 0444,
81 "size of the fmr pool (>= ntx)");
83 static int fmr_flush_trigger = 384;
84 CFS_MODULE_PARM(fmr_flush_trigger, "i", int, 0444,
85 "# dirty FMRs that triggers pool flush");
87 static int fmr_cache = 1;
88 CFS_MODULE_PARM(fmr_cache, "i", int, 0444,
89 "non-zero to enable FMR caching");
92 kib_tunables_t kiblnd_tunables = {
93 .kib_service = &service,
95 .kib_timeout = &timeout,
96 .kib_keepalive = &keepalive,
98 .kib_credits = &credits,
99 .kib_peercredits = &peer_credits,
100 .kib_default_ipif = &ipif_name,
101 .kib_retry_count = &retry_count,
102 .kib_rnr_retry_count = &rnr_retry_count,
103 .kib_concurrent_sends = &concurrent_sends,
104 .kib_ib_mtu = &ib_mtu,
105 #if IBLND_MAP_ON_DEMAND
106 .kib_fmr_pool_size = &fmr_pool_size,
107 .kib_fmr_flush_trigger = &fmr_flush_trigger,
108 .kib_fmr_cache = &fmr_cache,
112 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
114 static char ipif_basename_space[32];
116 static ctl_table kiblnd_ctl_table[] = {
117 {1, "service", &service,
118 sizeof(int), 0444, NULL, &proc_dointvec},
120 sizeof(int), 0644, NULL, &proc_dointvec},
121 {3, "timeout", &timeout,
122 sizeof(int), 0644, NULL, &proc_dointvec},
124 sizeof(int), 0444, NULL, &proc_dointvec},
125 {5, "credits", &credits,
126 sizeof(int), 0444, NULL, &proc_dointvec},
127 {6, "peer_credits", &peer_credits,
128 sizeof(int), 0444, NULL, &proc_dointvec},
129 {7, "ipif_name", ipif_basename_space,
130 sizeof(ipif_basename_space), 0444, NULL, &proc_dostring},
131 {8, "retry_count", &retry_count,
132 sizeof(int), 0644, NULL, &proc_dointvec},
133 {9, "rnr_retry_count", &rnr_retry_count,
134 sizeof(int), 0644, NULL, &proc_dointvec},
135 {10, "keepalive", &keepalive,
136 sizeof(int), 0644, NULL, &proc_dointvec},
137 {11, "concurrent_sends", &concurrent_sends,
138 sizeof(int), 0644, NULL, &proc_dointvec},
139 {12, "ib_mtu", &ib_mtu,
140 sizeof(int), 0444, NULL, &proc_dointvec},
141 #if IBLND_MAP_ON_DEMAND
142 {12, "fmr_pool_size", &fmr_pool_size,
143 sizeof(int), 0444, NULL, &proc_dointvec},
144 {13, "fmr_flush_trigger", &fmr_flush_trigger,
145 sizeof(int), 0444, NULL, &proc_dointvec},
146 {14, "fmr_cache", &fmr_cache,
147 sizeof(int), 0444, NULL, &proc_dointvec},
152 static ctl_table kiblnd_top_ctl_table[] = {
153 {203, "o2iblnd", NULL, 0, 0555, kiblnd_ctl_table},
158 kiblnd_initstrtunable(char *space, char *str, int size)
160 strncpy(space, str, size);
165 kiblnd_sysctl_init (void)
167 kiblnd_initstrtunable(ipif_basename_space, ipif_name,
168 sizeof(ipif_basename_space));
170 kiblnd_tunables.kib_sysctl =
171 register_sysctl_table(kiblnd_top_ctl_table, 0);
173 if (kiblnd_tunables.kib_sysctl == NULL)
174 CWARN("Can't setup /proc tunables\n");
178 kiblnd_sysctl_fini (void)
180 if (kiblnd_tunables.kib_sysctl != NULL)
181 unregister_sysctl_table(kiblnd_tunables.kib_sysctl);
187 kiblnd_sysctl_init (void)
192 kiblnd_sysctl_fini (void)
199 kiblnd_tunables_init (void)
201 kiblnd_sysctl_init();
203 if (*kiblnd_tunables.kib_concurrent_sends > IBLND_RX_MSGS)
204 *kiblnd_tunables.kib_concurrent_sends = IBLND_RX_MSGS;
205 if (*kiblnd_tunables.kib_concurrent_sends < IBLND_MSG_QUEUE_SIZE)
206 *kiblnd_tunables.kib_concurrent_sends = IBLND_MSG_QUEUE_SIZE;
212 kiblnd_tunables_fini (void)
214 kiblnd_sysctl_fini();