Whamcloud - gitweb
Severity : normal
[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 ctl_table kqswnal_ctl_table[] = {
88         {1, "tx_maxcontig", &tx_maxcontig, 
89          sizeof (int), 0444, NULL, &proc_dointvec},
90         {2, "ntxmsgs", &ntxmsgs, 
91          sizeof (int), 0444, NULL, &proc_dointvec},
92         {3, "credits", &credits, 
93          sizeof (int), 0444, NULL, &proc_dointvec},
94         {4, "peer_credits", &peer_credits, 
95          sizeof (int), 0444, NULL, &proc_dointvec},
96         {5, "nrxmsgs_large", &nrxmsgs_large, 
97          sizeof (int), 0444, NULL, &proc_dointvec},
98         {6, "ep_envelopes_large", &ep_envelopes_large, 
99          sizeof (int), 0444, NULL, &proc_dointvec},
100         {7, "nrxmsgs_small", &nrxmsgs_small, 
101          sizeof (int), 0444, NULL, &proc_dointvec},
102         {8, "ep_envelopes_small", &ep_envelopes_small, 
103          sizeof (int), 0444, NULL, &proc_dointvec},
104         {9, "optimized_puts", &optimized_puts, 
105          sizeof (int), 0644, NULL, &proc_dointvec},
106         {10, "optimized_gets", &optimized_gets, 
107          sizeof (int), 0644, NULL, &proc_dointvec},
108 #if KQSW_CKSUM
109         {11, "inject_csum_error", &inject_csum_error, 
110          sizeof (int), 0644, NULL, &proc_dointvec},
111 #endif
112         {0}
113 };
114
115 static ctl_table kqswnal_top_ctl_table[] = {
116         {201, "qswnal", NULL, 0, 0555, kqswnal_ctl_table},
117         {0}
118 };
119
120 int
121 kqswnal_tunables_init ()
122 {
123         kqswnal_tunables.kqn_sysctl =
124                 register_sysctl_table(kqswnal_top_ctl_table, 0);
125         
126         if (kqswnal_tunables.kqn_sysctl == NULL)
127                 CWARN("Can't setup /proc tunables\n");
128
129         return 0;
130 }
131
132 void
133 kqswnal_tunables_fini ()
134 {
135         if (kqswnal_tunables.kqn_sysctl != NULL)
136                 unregister_sysctl_table(kqswnal_tunables.kqn_sysctl);
137 }
138 #else
139 int 
140 kqswnal_tunables_init ()
141 {
142         return 0;
143 }
144
145 void
146 kqswnal_tunables_fini ()
147 {
148 }
149 #endif