1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
6 * Author: Eric Barton <eric@bartonsoftware.com>
8 * This file is part of Portals, http://www.lustre.org
10 * Portals is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * Portals is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with Portals; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 static int tx_maxcontig = (1<<10);
28 CFS_MODULE_PARM(tx_maxcontig, "i", int, 0444,
29 "maximum payload to de-fragment");
31 static int ntxmsgs = 512;
32 CFS_MODULE_PARM(ntxmsgs, "i", int, 0444,
35 static int credits = 128;
36 CFS_MODULE_PARM(credits, "i", int, 0444,
37 "# concurrent sends");
39 static int peer_credits = 8;
40 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
41 "# per-peer concurrent sends");
43 static int nrxmsgs_large = 64;
44 CFS_MODULE_PARM(nrxmsgs_large, "i", int, 0444,
45 "# 'large' rx msg buffers");
47 static int ep_envelopes_large = 256;
48 CFS_MODULE_PARM(ep_envelopes_large, "i", int, 0444,
49 "# 'large' rx msg envelope buffers");
51 static int nrxmsgs_small = 256;
52 CFS_MODULE_PARM(nrxmsgs_small, "i", int, 0444,
53 "# 'small' rx msg buffers");
55 static int ep_envelopes_small = 2048;
56 CFS_MODULE_PARM(ep_envelopes_small, "i", int, 0444,
57 "# 'small' rx msg envelope buffers");
59 static int optimized_puts = (32<<10);
60 CFS_MODULE_PARM(optimized_puts, "i", int, 0644,
61 "zero-copy puts >= this size");
63 static int optimized_gets = 2048;
64 CFS_MODULE_PARM(optimized_gets, "i", int, 0644,
65 "zero-copy gets >= this size");
68 static int inject_csum_error = 0;
69 CFS_MODULE_PARM(inject_csum_error, "i", int, 0644,
73 kqswnal_tunables_t kqswnal_tunables = {
74 .kqn_tx_maxcontig = &tx_maxcontig,
75 .kqn_ntxmsgs = &ntxmsgs,
76 .kqn_credits = &credits,
77 .kqn_peercredits = &peer_credits,
78 .kqn_nrxmsgs_large = &nrxmsgs_large,
79 .kqn_ep_envelopes_large = &ep_envelopes_large,
80 .kqn_nrxmsgs_small = &nrxmsgs_small,
81 .kqn_ep_envelopes_small = &ep_envelopes_small,
82 .kqn_optimized_puts = &optimized_puts,
83 .kqn_optimized_gets = &optimized_gets,
85 .kqn_inject_csum_error = &inject_csum_error,
89 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
91 #ifndef HAVE_SYSCTL_UNNUMBERED
94 KQSWNAL_TX_MAXCONTIG = 1,
98 KQSWNAL_NRXMSGS_LARGE,
99 KQSWNAL_EP_ENVELOPES_LARGE,
100 KQSWNAL_NRXMSGS_SMALL,
101 KQSWNAL_EP_ENVELOPES_SMALL,
102 KQSWNAL_OPTIMIZED_PUTS,
103 KQSWNAL_OPTIMIZED_GETS,
104 KQSWNAL_INJECT_CSUM_ERROR
108 #define KQSWNAL_TX_MAXCONTIG CTL_UNNUMBERED
109 #define KQSWNAL_NTXMSG CTL_UNNUMBERED
110 #define KQSWNAL_CREDITS CTL_UNNUMBERED
111 #define KQSWNAL_PEERCREDITS CTL_UNNUMBERED
112 #define KQSWNAL_NRXMSGS_LARGE CTL_UNNUMBERED
113 #define KQSWNAL_EP_ENVELOPES_LARGE CTL_UNNUMBERED
114 #define KQSWNAL_NRXMSGS_SMALL CTL_UNNUMBERED
115 #define KQSWNAL_EP_ENVELOPES_SMALL CTL_UNNUMBERED
116 #define KQSWNAL_OPTIMIZED_PUTS CTL_UNNUMBERED
117 #define KQSWNAL_OPTIMIZED_GETS CTL_UNNUMBERED
118 #define KQSWNAL_INJECT_CSUM_ERROR CTL_UNNUMBERED
122 static cfs_sysctl_table_t kqswnal_ctl_table[] = {
124 .ctl_name = KQSWNAL_TX_MAXCONTIG,
125 .procname = "tx_maxcontig",
126 .data = &tx_maxcontig,
127 .maxlen = sizeof (int),
129 .proc_handler = &proc_dointvec
132 .ctl_name = KQSWNAL_NTXMSG,
133 .procname = "ntxmsgs",
135 .maxlen = sizeof (int),
137 .proc_handler = &proc_dointvec
140 .ctl_name = KQSWNAL_CREDITS,
141 .procname = "credits",
143 .maxlen = sizeof (int),
145 .proc_handler = &proc_dointvec
148 .ctl_name = KQSWNAL_PEERCREDITS,
149 .procname = "peer_credits",
150 .data = &peer_credits,
151 .maxlen = sizeof (int),
153 .proc_handler = &proc_dointvec
156 .ctl_name = KQSWNAL_NRXMSGS_LARGE,
157 .procname = "nrxmsgs_large",
158 .data = &nrxmsgs_large,
159 .maxlen = sizeof (int),
161 .proc_handler = &proc_dointvec
164 .ctl_name = KQSWNAL_EP_ENVELOPES_LARGE,
165 .procname = "ep_envelopes_large",
166 .data = &ep_envelopes_large,
167 .maxlen = sizeof (int),
169 .proc_handler = &proc_dointvec
172 .ctl_name = KQSWNAL_NRXMSGS_SMALL,
173 .procname = "nrxmsgs_small",
174 .data = &nrxmsgs_small,
175 .maxlen = sizeof (int),
177 .proc_handler = &proc_dointvec
180 .ctl_name = KQSWNAL_EP_ENVELOPES_SMALL,
181 .procname = "ep_envelopes_small",
182 .data = &ep_envelopes_small,
183 .maxlen = sizeof (int),
185 .proc_handler = &proc_dointvec
188 .ctl_name = KQSWNAL_OPTIMIZED_PUTS,
189 .procname = "optimized_puts",
190 .data = &optimized_puts,
191 .maxlen = sizeof (int),
193 .proc_handler = &proc_dointvec
196 .ctl_name = KQSWNAL_OPTIMIZED_GETS,
197 .procname = "optimized_gets",
198 .data = &optimized_gets,
199 .maxlen = sizeof (int),
201 .proc_handler = &proc_dointvec
205 .ctl_name = KQSWNAL_INJECT_CSUM_ERROR,
206 .procname = "inject_csum_error",
207 .data = &inject_csum_error,
208 .maxlen = sizeof (int),
210 .proc_handler = &proc_dointvec
216 static cfs_sysctl_table_t kqswnal_top_ctl_table[] = {
218 .ctl_name = CTL_KQSWNAL,
219 .procname = "qswnal",
223 .child = kqswnal_ctl_table
229 kqswnal_tunables_init ()
231 kqswnal_tunables.kqn_sysctl =
232 cfs_register_sysctl_table(kqswnal_top_ctl_table, 0);
234 if (kqswnal_tunables.kqn_sysctl == NULL)
235 CWARN("Can't setup /proc tunables\n");
241 kqswnal_tunables_fini ()
243 if (kqswnal_tunables.kqn_sysctl != NULL)
244 cfs_unregister_sysctl_table(kqswnal_tunables.kqn_sysctl);
248 kqswnal_tunables_init ()
254 kqswnal_tunables_fini ()