Whamcloud - gitweb
LU-1422 lnet: eliminate obsolete Cray Catamount support
[fs/lustre-release.git] / lnet / klnds / ptllnd / ptllnd_modparams.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  */
30 /*
31  * This file is part of Lustre, http://www.lustre.org/
32  * Lustre is a trademark of Sun Microsystems, Inc.
33  *
34  * lnet/klnds/ptllnd/ptllnd_modparams.c
35  *
36  * Author: PJ Kirner <pjkirner@clusterfs.com>
37  */
38
39
40 #include "ptllnd.h"
41
42 static int ntx = 256;
43 CFS_MODULE_PARM(ntx, "i", int, 0444,
44                 "# of TX descriptors");
45
46 static int max_nodes = 1152;
47 CFS_MODULE_PARM(max_nodes, "i", int, 0444,
48                 "maximum number of peer nodes");
49
50 static int max_procs_per_node = 2;
51 CFS_MODULE_PARM(max_procs_per_node, "i", int, 0444,
52                 "maximum number of processes per peer node to cache");
53
54 static int checksum = 0;
55 CFS_MODULE_PARM(checksum, "i", int, 0644,
56                 "set non-zero to enable message (not RDMA) checksums");
57
58 /* NB 250 is the Cray Portals wire timeout */
59 static int timeout = 250;
60 CFS_MODULE_PARM(timeout, "i", int, 0644,
61                 "timeout (seconds)");
62
63 static int portal = PTLLND_PORTAL;              /* <lnet/ptllnd_wire.h> */
64 CFS_MODULE_PARM(portal, "i", int, 0444,
65                 "portal id");
66
67 static int pid = PTLLND_PID;                    /* <lnet/ptllnd_wire.h> */
68 CFS_MODULE_PARM(pid, "i", int, 0444,
69                 "portals pid");
70
71 static int rxb_npages = 1;
72 CFS_MODULE_PARM(rxb_npages, "i", int, 0444,
73                 "# of pages per rx buffer");
74
75 static int rxb_nspare = 8;
76 CFS_MODULE_PARM(rxb_nspare, "i", int, 0444,
77                 "# of spare rx buffers");
78
79 static int credits = 128;
80 CFS_MODULE_PARM(credits, "i", int, 0444,
81                 "concurrent sends");
82
83 static int peercredits = PTLLND_PEERCREDITS;    /* <lnet/ptllnd_wire.h> */
84 CFS_MODULE_PARM(peercredits, "i", int, 0444,
85                 "concurrent sends to 1 peer");
86
87 static int peer_buffer_credits = 0;
88 CFS_MODULE_PARM(peer_buffer_credits, "i", int, 0444,
89                 "# per-peer router buffer credits");
90
91 static int max_msg_size = PTLLND_MAX_KLND_MSG_SIZE;  /* <lnet/ptllnd_wire.h> */
92 CFS_MODULE_PARM(max_msg_size, "i", int, 0444,
93                 "max size of immediate message");
94
95 static int peer_hash_table_size = 101;
96 CFS_MODULE_PARM(peer_hash_table_size, "i", int, 0444,
97                 "# of slots in the peer hash table");
98
99 static int reschedule_loops = 100;
100 CFS_MODULE_PARM(reschedule_loops, "i", int, 0644,
101                 "# of loops before scheduler does cond_resched()");
102
103 static int ack_puts = 0;
104 CFS_MODULE_PARM(ack_puts, "i", int, 0644,
105                 "get portals to ack all PUTs");
106
107 #ifdef PJK_DEBUGGING
108 static int simulation_bitmap = 0;
109 CFS_MODULE_PARM(simulation_bitmap, "i", int, 0444,
110                 "simulation bitmap");
111 #endif
112
113
114 kptl_tunables_t kptllnd_tunables = {
115         .kptl_ntx                    = &ntx,
116         .kptl_max_nodes              = &max_nodes,
117         .kptl_max_procs_per_node     = &max_procs_per_node,
118         .kptl_checksum               = &checksum,
119         .kptl_portal                 = &portal,
120         .kptl_pid                    = &pid,
121         .kptl_timeout                = &timeout,
122         .kptl_rxb_npages             = &rxb_npages,
123         .kptl_rxb_nspare             = &rxb_nspare,
124         .kptl_credits                = &credits,
125         .kptl_peertxcredits          = &peercredits,
126         .kptl_peerrtrcredits         = &peer_buffer_credits,
127         .kptl_max_msg_size           = &max_msg_size,
128         .kptl_peer_hash_table_size   = &peer_hash_table_size,
129         .kptl_reschedule_loops       = &reschedule_loops,
130         .kptl_ack_puts               = &ack_puts,
131 #ifdef PJK_DEBUGGING
132         .kptl_simulation_bitmap      = &simulation_bitmap,
133 #endif
134 };
135
136
137 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
138
139 #ifndef HAVE_SYSCTL_UNNUMBERED
140
141 enum {
142         KPTLLND_NTX     = 1,
143         KPTLLND_MAX_NODES,
144         KPTLLND_MAX_PROC_PER_NODE,
145         KPTLLND_CHECKSUM,
146         KPTLLND_TIMEOUT,
147         KPTLLND_PORTAL,
148         KPTLLND_PID,
149         KPTLLND_RXB_PAGES,
150         KPTLLND_CREDITS,
151         KPTLLND_PEERTXCREDITS,
152         KPTLLND_PEERRTRCREDITS,
153         KPTLLND_MAX_MSG_SIZE,
154         KPTLLND_PEER_HASH_SIZE,
155         KPTLLND_RESHEDULE_LOOPS,
156         KPTLLND_ACK_PUTS,
157         KPTLLND_TRACETIMEOUT,
158         KPTLLND_TRACEFAIL,
159         KPTLLND_TRACEBASENAME,
160         KPTLLND_SIMULATION_BITMAP
161 };
162 #else
163
164 #define KPTLLND_NTX             CTL_UNNUMBERED
165 #define KPTLLND_MAX_NODES       CTL_UNNUMBERED
166 #define KPTLLND_MAX_PROC_PER_NODE CTL_UNNUMBERED
167 #define KPTLLND_CHECKSUM        CTL_UNNUMBERED
168 #define KPTLLND_TIMEOUT         CTL_UNNUMBERED
169 #define KPTLLND_PORTAL          CTL_UNNUMBERED
170 #define KPTLLND_PID             CTL_UNNUMBERED
171 #define KPTLLND_RXB_PAGES       CTL_UNNUMBERED
172 #define KPTLLND_CREDITS         CTL_UNNUMBERED
173 #define KPTLLND_PEERTXCREDITS   CTL_UNNUMBERED
174 #define KPTLLND_PEERRTRCREDITS  CTL_UNNUMBERED
175 #define KPTLLND_MAX_MSG_SIZE    CTL_UNNUMBERED
176 #define KPTLLND_PEER_HASH_SIZE  CTL_UNNUMBERED
177 #define KPTLLND_RESHEDULE_LOOPS CTL_UNNUMBERED
178 #define KPTLLND_ACK_PUTS        CTL_UNNUMBERED
179 #define KPTLLND_TRACETIMEOUT    CTL_UNNUMBERED
180 #define KPTLLND_TRACEFAIL       CTL_UNNUMBERED
181 #define KPTLLND_TRACEBASENAME   CTL_UNNUMBERED
182 #define KPTLLND_SIMULATION_BITMAP CTL_UNNUMBERED
183 #endif
184
185 static cfs_sysctl_table_t kptllnd_ctl_table[] = {
186         {
187                 .ctl_name = KPTLLND_NTX,
188                 .procname = "ntx",
189                 .data     = &ntx,
190                 .maxlen   = sizeof(int),
191                 .mode     = 0444,
192                 .proc_handler = &proc_dointvec
193         },
194         {
195                 .ctl_name = KPTLLND_MAX_NODES,
196                 .procname = "max_nodes",
197                 .data     = &max_nodes,
198                 .maxlen   = sizeof(int),
199                 .mode     = 0444,
200                 .proc_handler = &proc_dointvec
201         },
202         {
203                 .ctl_name = KPTLLND_MAX_PROC_PER_NODE,
204                 .procname = "max_procs_per_node",
205                 .data     = &max_procs_per_node,
206                 .maxlen   = sizeof(int),
207                 .mode     = 0444,
208                 .proc_handler = &proc_dointvec
209         },
210         {
211                 .ctl_name = KPTLLND_CHECKSUM,
212                 .procname = "checksum",
213                 .data     = &checksum,
214                 .maxlen   = sizeof(int),
215                 .mode     = 0644,
216                 .proc_handler = &proc_dointvec
217         },
218         {
219                 .ctl_name = KPTLLND_TIMEOUT,
220                 .procname = "timeout",
221                 .data     = &timeout,
222                 .maxlen   = sizeof(int),
223                 .mode     = 0644,
224                 .proc_handler = &proc_dointvec
225         },
226         {
227                 .ctl_name = KPTLLND_PORTAL,
228                 .procname = "portal",
229                 .data     = &portal,
230                 .maxlen   = sizeof(int),
231                 .mode     = 0444,
232                 .proc_handler = &proc_dointvec
233         },
234         {
235                 .ctl_name = KPTLLND_PID,
236                 .procname = "pid",
237                 .data     = &pid,
238                 .maxlen   = sizeof(int),
239                 .mode     = 0444,
240                 .proc_handler = &proc_dointvec
241         },
242         {
243                 .ctl_name = KPTLLND_RXB_PAGES,
244                 .procname = "rxb_npages",
245                 .data     = &rxb_npages,
246                 .maxlen   = sizeof(int),
247                 .mode     = 0444,
248                 .proc_handler = &proc_dointvec
249         },
250         {
251                 .ctl_name = KPTLLND_CREDITS,
252                 .procname = "credits",
253                 .data     = &credits,
254                 .maxlen   = sizeof(int),
255                 .mode     = 0444,
256                 .proc_handler = &proc_dointvec
257         },
258         {
259                 .ctl_name = KPTLLND_PEERTXCREDITS,
260                 .procname = "peercredits",
261                 .data     = &peercredits,
262                 .maxlen   = sizeof(int),
263                 .mode     = 0444,
264                 .proc_handler = &proc_dointvec
265         },
266         {
267                 .ctl_name = KPTLLND_PEERRTRCREDITS,
268                 .procname = "peer_buffer_credits",
269                 .data     = &peer_buffer_credits,
270                 .maxlen   = sizeof(int),
271                 .mode     = 0444,
272                 .proc_handler = &proc_dointvec
273         },
274         {
275                 .ctl_name = KPTLLND_MAX_MSG_SIZE,
276                 .procname = "max_msg_size",
277                 .data     = &max_msg_size,
278                 .maxlen   = sizeof(int),
279                 .mode     = 0444,
280                 .proc_handler = &proc_dointvec
281         },
282         {
283                 .ctl_name = KPTLLND_PEER_HASH_SIZE,
284                 .procname = "peer_hash_table_size",
285                 .data     = &peer_hash_table_size,
286                 .maxlen   = sizeof(int),
287                 .mode     = 0444,
288                 .proc_handler = &proc_dointvec
289         },
290         {
291                 .ctl_name = KPTLLND_RESHEDULE_LOOPS,
292                 .procname = "reschedule_loops",
293                 .data     = &reschedule_loops,
294                 .maxlen   = sizeof(int),
295                 .mode     = 0444,
296                 .proc_handler = &proc_dointvec
297         },
298         {
299                 .ctl_name = KPTLLND_ACK_PUTS,
300                 .procname = "ack_puts",
301                 .data     = &ack_puts,
302                 .maxlen   = sizeof(int),
303                 .mode     = 0644,
304                 .proc_handler = &proc_dointvec
305         },
306 #ifdef PJK_DEBUGGING
307         {
308                 .ctl_name = KPTLLND_SIMULATION_BITMAP,
309                 .procname = "simulation_bitmap",
310                 .data     = &simulation_bitmap,
311                 .maxlen   = sizeof(int),
312                 .mode     = 0444,
313                 .proc_handler = &proc_dointvec
314         },
315 #endif
316
317         {0}
318 };
319
320 static cfs_sysctl_table_t kptllnd_top_ctl_table[] = {
321         {
322                 .ctl_name = CTL_PTLLND,
323                 .procname = "ptllnd",
324                 .data     = NULL,
325                 .maxlen   = 0,
326                 .mode     = 0555,
327                 .child    = kptllnd_ctl_table
328         },
329         {0}
330 };
331
332 int
333 kptllnd_tunables_init ()
334 {
335         kptllnd_tunables.kptl_sysctl =
336                 cfs_register_sysctl_table(kptllnd_top_ctl_table, 0);
337
338         if (kptllnd_tunables.kptl_sysctl == NULL)
339                 CWARN("Can't setup /proc tunables\n");
340
341         return 0;
342 }
343
344 void
345 kptllnd_tunables_fini ()
346 {
347         if (kptllnd_tunables.kptl_sysctl != NULL)
348                 cfs_unregister_sysctl_table(kptllnd_tunables.kptl_sysctl);
349 }
350
351 #else
352
353 int
354 kptllnd_tunables_init ()
355 {
356         return 0;
357 }
358
359 void
360 kptllnd_tunables_fini ()
361 {
362 }
363
364 #endif