1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
32 * Copyright (C) 2006 Myricom, Inc.
35 * This file is part of Lustre, http://www.lustre.org/
36 * Lustre is a trademark of Sun Microsystems, Inc.
38 * lnet/klnds/mxlnd/mxlnd.c
40 * Author: Eric Barton <eric@bartonsoftware.com>
41 * Author: Scott Atchley <atchley at myri.com>
46 static int n_waitd = MXLND_N_SCHED;
47 CFS_MODULE_PARM(n_waitd, "i", int, 0444,
48 "# of completion daemons");
50 /* this was used to allocate global rxs which are no londer used */
51 static int max_peers = MXLND_MAX_PEERS;
52 CFS_MODULE_PARM(max_peers, "i", int, 0444,
53 "Unused - was maximum number of peers that may connect");
55 static int cksum = MXLND_CKSUM;
56 CFS_MODULE_PARM(cksum, "i", int, 0644,
57 "set non-zero to enable message (not data payload) checksums");
59 static int ntx = MXLND_NTX;
60 CFS_MODULE_PARM(ntx, "i", int, 0444,
61 "# of total tx message descriptors");
63 /* this duplicates ntx */
64 static int credits = MXLND_NTX;
65 CFS_MODULE_PARM(credits, "i", int, 0444,
66 "Unused - was # concurrent sends to all peers");
68 static int peercredits = MXLND_MSG_QUEUE_DEPTH;
69 CFS_MODULE_PARM(peercredits, "i", int, 0444,
70 "# concurrent sends to one peer");
72 static int board = MXLND_MX_BOARD;
73 CFS_MODULE_PARM(board, "i", int, 0444,
74 "index value of the Myrinet board (NIC)");
76 static int ep_id = MXLND_MX_EP_ID;
77 CFS_MODULE_PARM(ep_id, "i", int, 0444, "MX endpoint ID");
79 static char *ipif_name = "myri0";
80 CFS_MODULE_PARM(ipif_name, "s", charp, 0444,
81 "IPoMX interface name");
83 static int polling = MXLND_POLLING;
84 CFS_MODULE_PARM(polling, "i", int, 0444,
85 "Use 0 to block (wait). A value > 0 will poll that many times before blocking");
87 static char *hosts = NULL;
88 CFS_MODULE_PARM(hosts, "s", charp, 0444,
89 "Unused - was IP-to-hostname resolution file");
91 kmx_tunables_t kmxlnd_tunables = {
92 .kmx_n_waitd = &n_waitd,
93 .kmx_max_peers = &max_peers,
96 .kmx_credits = &credits,
97 .kmx_peercredits = &peercredits,
100 .kmx_default_ipif = &ipif_name,
101 .kmx_polling = &polling
104 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
106 static char ipif_basename_space[32];
108 #ifndef HAVE_SYSCTL_UNNUMBERED
123 #define MXLND_N_WAITD CTL_UNNUMBERED
124 #define MXLND_MAX_PEERS CTL_UNNUMBERED
125 #define MXLND_CKSUM CTL_UNNUMBERED
126 #define MXLND_NNTX CTL_UNNUMBERED
127 #define MXLND_CREDITS CTL_UNNUMBERED
128 #define MXLND_BOARD CTL_UNNUMBERED
129 #define MXLND_EP_ID CTL_UNNUMBERED
130 #define MXLND_IPIF_BASENAME CTL_UNNUMBERED
131 #define MXLND_POLLING CTL_UNNUMBERED
135 static cfs_sysctl_table_t kmxlnd_ctl_table[] = {
138 .procname = "n_waitd",
140 .maxlen = sizeof(int),
142 .proc_handler = &proc_dointvec
146 .procname = "max_peers",
148 .maxlen = sizeof(int),
150 .proc_handler = &proc_dointvec
156 .maxlen = sizeof(int),
158 .proc_handler = &proc_dointvec
164 .maxlen = sizeof(int),
166 .proc_handler = &proc_dointvec
170 .procname = "credits",
172 .maxlen = sizeof(int),
174 .proc_handler = &proc_dointvec
178 .procname = "peercredits",
179 .data = &peercredits,
180 .maxlen = sizeof(int),
182 .proc_handler = &proc_dointvec
188 .maxlen = sizeof(int),
190 .proc_handler = &proc_dointvec
196 .maxlen = sizeof(int),
198 .proc_handler = &proc_dointvec
202 .procname = "ipif_name",
203 .data = ipif_basename_space,
204 .maxlen = sizeof(ipif_basename_space),
206 .proc_handler = &proc_dostring
210 .procname = "polling",
212 .maxlen = sizeof(int),
214 .proc_handler = &proc_dointvec
219 static cfs_sysctl_table_t kmxlnd_top_ctl_table[] = {
226 .child = kmxlnd_ctl_table
232 kmxlnd_initstrtunable(char *space, char *str, int size)
234 strncpy(space, str, size);
239 kmxlnd_sysctl_init (void)
241 kmxlnd_initstrtunable(ipif_basename_space, ipif_name,
242 sizeof(ipif_basename_space));
244 kmxlnd_tunables.kib_sysctl =
245 cfs_register_sysctl_table(kmxlnd_top_ctl_table, 0);
247 if (kmxlnd_tunables.kib_sysctl == NULL)
248 CWARN("Can't setup /proc tunables\n");
252 kmxlnd_sysctl_fini (void)
254 if (kmxlnd_tunables.kib_sysctl != NULL)
255 cfs_unregister_sysctl_table(kmxlnd_tunables.kib_sysctl);
261 kmxlnd_sysctl_init (void)
266 kmxlnd_sysctl_fini (void)
273 kmxlnd_tunables_init (void)
275 kmxlnd_sysctl_init();
280 kmxlnd_tunables_fini (void)
282 kmxlnd_sysctl_fini();