Whamcloud - gitweb
Branch b1_6
[fs/lustre-release.git] / lnet / klnds / qswlnd / qswlnd_modparams.c
1 /*
2  * Copyright (C) 2002-2004 Cluster File Systems, Inc.
3  *   Author: Eric Barton <eric@bartonsoftware.com>
4  *
5  * This file is part of Portals, http://www.lustre.org
6  *
7  * Portals is free software; you can redistribute it and/or
8  * modify it under the terms of version 2 of the GNU General Public
9  * License as published by the Free Software Foundation.
10  *
11  * Portals is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Portals; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */
21
22 #include "qswlnd.h"
23
24 static int tx_maxcontig = (1<<10);
25 CFS_MODULE_PARM(tx_maxcontig, "i", int, 0444,
26                 "maximum payload to de-fragment");
27
28 static int ntxmsgs = 512;
29 CFS_MODULE_PARM(ntxmsgs, "i", int, 0444,
30                 "# tx msg buffers");
31
32 static int credits = 128;
33 CFS_MODULE_PARM(credits, "i", int, 0444,
34                 "# concurrent sends");
35
36 static int peer_credits = 8;
37 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
38                 "# per-peer concurrent sends");
39
40 static int nrxmsgs_large = 64;
41 CFS_MODULE_PARM(nrxmsgs_large, "i", int, 0444,
42                 "# 'large' rx msg buffers");
43
44 static int ep_envelopes_large = 256;
45 CFS_MODULE_PARM(ep_envelopes_large, "i", int, 0444,
46                 "# 'large' rx msg envelope buffers");
47
48 static int nrxmsgs_small = 256;
49 CFS_MODULE_PARM(nrxmsgs_small, "i", int, 0444,
50                 "# 'small' rx msg buffers");
51
52 static int ep_envelopes_small = 2048;
53 CFS_MODULE_PARM(ep_envelopes_small, "i", int, 0444,
54                 "# 'small' rx msg envelope buffers");
55
56 static int optimized_puts = (32<<10);
57 CFS_MODULE_PARM(optimized_puts, "i", int, 0644,
58                 "zero-copy puts >= this size");
59
60 static int optimized_gets = 2048;
61 CFS_MODULE_PARM(optimized_gets, "i", int, 0644,
62                 "zero-copy gets >= this size");
63
64 #if KQSW_CKSUM
65 static int inject_csum_error = 0;
66 CFS_MODULE_PARM(inject_csum_error, "i", int, 0644,
67                 "test checksumming");
68 #endif
69
70 kqswnal_tunables_t kqswnal_tunables = {
71         .kqn_tx_maxcontig       = &tx_maxcontig,
72         .kqn_ntxmsgs            = &ntxmsgs,
73         .kqn_credits            = &credits,
74         .kqn_peercredits        = &peer_credits,
75         .kqn_nrxmsgs_large      = &nrxmsgs_large,
76         .kqn_ep_envelopes_large = &ep_envelopes_large,
77         .kqn_nrxmsgs_small      = &nrxmsgs_small,
78         .kqn_ep_envelopes_small = &ep_envelopes_small,
79         .kqn_optimized_puts     = &optimized_puts,
80         .kqn_optimized_gets     = &optimized_gets,
81 #if KQSW_CKSUM
82         .kqn_inject_csum_error  = &inject_csum_error,
83 #endif
84 };
85
86 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
87 static cfs_sysctl_table_t kqswnal_ctl_table[] = {
88         {
89                 .ctl_name = 1,
90                 .procname = "tx_maxcontig",
91                 .data     = &tx_maxcontig,
92                 .maxlen   = sizeof (int),
93                 .mode     = 0444,
94                 .proc_handler = &proc_dointvec
95         },
96         {
97                 .ctl_name = 2,
98                 .procname = "ntxmsgs",
99                 .data     = &ntxmsgs,
100                 .maxlen   = sizeof (int),
101                 .mode     = 0444,
102                 .proc_handler = &proc_dointvec
103         },
104         {
105                 .ctl_name = 3,
106                 .procname = "credits",
107                 .data     = &credits,
108                 .maxlen   = sizeof (int),
109                 .mode     = 0444,
110                 .proc_handler = &proc_dointvec
111         },
112         {
113                 .ctl_name = 4,
114                 .procname = "peer_credits",
115                 .data     = &peer_credits,
116                 .maxlen   = sizeof (int),
117                 .mode     = 0444,
118                 .proc_handler = &proc_dointvec
119         },
120         {
121                 .ctl_name = 5,
122                 .procname = "nrxmsgs_large",
123                 .data     = &nrxmsgs_large,
124                 .maxlen   = sizeof (int),
125                 .mode     = 0444,
126                 .proc_handler = &proc_dointvec
127         },
128         {
129                 .ctl_name = 6,
130                 .procname = "ep_envelopes_large",
131                 .data     = &ep_envelopes_large,
132                 .maxlen   = sizeof (int),
133                 .mode     = 0444,
134                 .proc_handler = &proc_dointvec
135         },
136         {
137                 .ctl_name = 7,
138                 .procname = "nrxmsgs_small",
139                 .data     = &nrxmsgs_small,
140                 .maxlen   = sizeof (int),
141                 .mode     = 0444,
142                 .proc_handler = &proc_dointvec
143         },
144         {
145                 .ctl_name = 8,
146                 .procname = "ep_envelopes_small",
147                 .data     = &ep_envelopes_small,
148                 .maxlen   = sizeof (int),
149                 .mode     = 0444,
150                 .proc_handler = &proc_dointvec
151         },
152         {
153                 .ctl_name = 9,
154                 .procname = "optimized_puts",
155                 .data     = &optimized_puts,
156                 .maxlen   = sizeof (int),
157                 .mode     = 0644,
158                 .proc_handler = &proc_dointvec
159         },
160         {
161                 .ctl_name = 10,
162                 .procname = "optimized_gets",
163                 .data     = &optimized_gets,
164                 .maxlen   = sizeof (int),
165                 .mode     = 0644,
166                 .proc_handler = &proc_dointvec
167         },
168 #if KQSW_CKSUM
169         {
170                 .ctl_name = 11,
171                 .procname = "inject_csum_error",
172                 .data     = &inject_csum_error,
173                 .maxlen   = sizeof (int),
174                 .mode     = 0644,
175                 .proc_handler = &proc_dointvec
176         },
177 #endif
178         {0}
179 };
180
181 static cfs_sysctl_table_t kqswnal_top_ctl_table[] = {
182         {
183                 .ctl_name = 201,
184                 .procname = "qswnal",
185                 .data     = NULL,
186                 .maxlen   = 0,
187                 .mode     = 0555,
188                 .child    = kqswnal_ctl_table
189         },
190         {0}
191 };
192
193 int
194 kqswnal_tunables_init ()
195 {
196         kqswnal_tunables.kqn_sysctl =
197                 cfs_register_sysctl_table(kqswnal_top_ctl_table, 0);
198
199         if (kqswnal_tunables.kqn_sysctl == NULL)
200                 CWARN("Can't setup /proc tunables\n");
201
202         return 0;
203 }
204
205 void
206 kqswnal_tunables_fini ()
207 {
208         if (kqswnal_tunables.kqn_sysctl != NULL)
209                 cfs_unregister_sysctl_table(kqswnal_tunables.kqn_sysctl);
210 }
211 #else
212 int
213 kqswnal_tunables_init ()
214 {
215         return 0;
216 }
217
218 void
219 kqswnal_tunables_fini ()
220 {
221 }
222 #endif