2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
4 * Author: Eric Barton <eric@bartonsoftware.com>
6 * This file is part of Portals, http://www.lustre.org
8 * Portals is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Portals is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Portals; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 static int tx_maxcontig = (1<<10);
26 CFS_MODULE_PARM(tx_maxcontig, "i", int, 0444,
27 "maximum payload to de-fragment");
29 static int ntxmsgs = 512;
30 CFS_MODULE_PARM(ntxmsgs, "i", int, 0444,
33 static int credits = 128;
34 CFS_MODULE_PARM(credits, "i", int, 0444,
35 "# concurrent sends");
37 static int peer_credits = 8;
38 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
39 "# per-peer concurrent sends");
41 static int nrxmsgs_large = 64;
42 CFS_MODULE_PARM(nrxmsgs_large, "i", int, 0444,
43 "# 'large' rx msg buffers");
45 static int ep_envelopes_large = 256;
46 CFS_MODULE_PARM(ep_envelopes_large, "i", int, 0444,
47 "# 'large' rx msg envelope buffers");
49 static int nrxmsgs_small = 256;
50 CFS_MODULE_PARM(nrxmsgs_small, "i", int, 0444,
51 "# 'small' rx msg buffers");
53 static int ep_envelopes_small = 2048;
54 CFS_MODULE_PARM(ep_envelopes_small, "i", int, 0444,
55 "# 'small' rx msg envelope buffers");
57 static int optimized_puts = (32<<10);
58 CFS_MODULE_PARM(optimized_puts, "i", int, 0644,
59 "zero-copy puts >= this size");
61 static int optimized_gets = 2048;
62 CFS_MODULE_PARM(optimized_gets, "i", int, 0644,
63 "zero-copy gets >= this size");
66 static int inject_csum_error = 0;
67 CFS_MODULE_PARM(inject_csum_error, "i", int, 0644,
71 kqswnal_tunables_t kqswnal_tunables = {
72 .kqn_tx_maxcontig = &tx_maxcontig,
73 .kqn_ntxmsgs = &ntxmsgs,
74 .kqn_credits = &credits,
75 .kqn_peercredits = &peer_credits,
76 .kqn_nrxmsgs_large = &nrxmsgs_large,
77 .kqn_ep_envelopes_large = &ep_envelopes_large,
78 .kqn_nrxmsgs_small = &nrxmsgs_small,
79 .kqn_ep_envelopes_small = &ep_envelopes_small,
80 .kqn_optimized_puts = &optimized_puts,
81 .kqn_optimized_gets = &optimized_gets,
83 .kqn_inject_csum_error = &inject_csum_error,
87 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
89 #ifndef HAVE_SYSCTL_UNNUMBERED
92 KQSWNAL_TX_MAXCONTIG = 1,
96 KQSWNAL_NRXMSGS_LARGE,
97 KQSWNAL_EP_ENVELOPES_LARGE,
98 KQSWNAL_NRXMSGS_SMALL,
99 KQSWNAL_EP_ENVELOPES_SMALL,
100 KQSWNAL_OPTIMIZED_PUTS,
101 KQSWNAL_OPTIMIZED_GETS,
102 KQSWNAL_INJECT_CSUM_ERROR
106 #define KQSWNAL_TX_MAXCONTIG CTL_UNNUMBERED
107 #define KQSWNAL_NTXMSG CTL_UNNUMBERED
108 #define KQSWNAL_CREDITS CTL_UNNUMBERED
109 #define KQSWNAL_PEERCREDITS CTL_UNNUMBERED
110 #define KQSWNAL_NRXMSGS_LARGE CTL_UNNUMBERED
111 #define KQSWNAL_EP_ENVELOPES_LARGE CTL_UNNUMBERED
112 #define KQSWNAL_NRXMSGS_SMALL CTL_UNNUMBERED
113 #define KQSWNAL_EP_ENVELOPES_SMALL CTL_UNNUMBERED
114 #define KQSWNAL_OPTIMIZED_PUTS CTL_UNNUMBERED
115 #define KQSWNAL_OPTIMIZED_GETS CTL_UNNUMBERED
116 #define KQSWNAL_INJECT_CSUM_ERROR CTL_UNNUMBERED
120 static cfs_sysctl_table_t kqswnal_ctl_table[] = {
122 .ctl_name = KQSWNAL_TX_MAXCONTIG,
123 .procname = "tx_maxcontig",
124 .data = &tx_maxcontig,
125 .maxlen = sizeof (int),
127 .proc_handler = &proc_dointvec
130 .ctl_name = KQSWNAL_NTXMSG,
131 .procname = "ntxmsgs",
133 .maxlen = sizeof (int),
135 .proc_handler = &proc_dointvec
138 .ctl_name = KQSWNAL_CREDITS,
139 .procname = "credits",
141 .maxlen = sizeof (int),
143 .proc_handler = &proc_dointvec
146 .ctl_name = KQSWNAL_PEERCREDITS,
147 .procname = "peer_credits",
148 .data = &peer_credits,
149 .maxlen = sizeof (int),
151 .proc_handler = &proc_dointvec
154 .ctl_name = KQSWNAL_NRXMSGS_LARGE,
155 .procname = "nrxmsgs_large",
156 .data = &nrxmsgs_large,
157 .maxlen = sizeof (int),
159 .proc_handler = &proc_dointvec
162 .ctl_name = KQSWNAL_EP_ENVELOPES_LARGE,
163 .procname = "ep_envelopes_large",
164 .data = &ep_envelopes_large,
165 .maxlen = sizeof (int),
167 .proc_handler = &proc_dointvec
170 .ctl_name = KQSWNAL_NRXMSGS_SMALL,
171 .procname = "nrxmsgs_small",
172 .data = &nrxmsgs_small,
173 .maxlen = sizeof (int),
175 .proc_handler = &proc_dointvec
178 .ctl_name = KQSWNAL_EP_ENVELOPES_SMALL,
179 .procname = "ep_envelopes_small",
180 .data = &ep_envelopes_small,
181 .maxlen = sizeof (int),
183 .proc_handler = &proc_dointvec
186 .ctl_name = KQSWNAL_OPTIMIZED_PUTS,
187 .procname = "optimized_puts",
188 .data = &optimized_puts,
189 .maxlen = sizeof (int),
191 .proc_handler = &proc_dointvec
194 .ctl_name = KQSWNAL_OPTIMIZED_GETS,
195 .procname = "optimized_gets",
196 .data = &optimized_gets,
197 .maxlen = sizeof (int),
199 .proc_handler = &proc_dointvec
203 .ctl_name = KQSWNAL_INJECT_CSUM_ERROR,
204 .procname = "inject_csum_error",
205 .data = &inject_csum_error,
206 .maxlen = sizeof (int),
208 .proc_handler = &proc_dointvec
214 static cfs_sysctl_table_t kqswnal_top_ctl_table[] = {
216 .ctl_name = CTL_KQSWNAL,
217 .procname = "qswnal",
221 .child = kqswnal_ctl_table
227 kqswnal_tunables_init ()
229 kqswnal_tunables.kqn_sysctl =
230 cfs_register_sysctl_table(kqswnal_top_ctl_table, 0);
232 if (kqswnal_tunables.kqn_sysctl == NULL)
233 CWARN("Can't setup /proc tunables\n");
239 kqswnal_tunables_fini ()
241 if (kqswnal_tunables.kqn_sysctl != NULL)
242 cfs_unregister_sysctl_table(kqswnal_tunables.kqn_sysctl);
246 kqswnal_tunables_init ()
252 kqswnal_tunables_fini ()