Whamcloud - gitweb
c5bff41452e0d46b98495e9859ec8be9cd896492
[fs/lustre-release.git] / lnet / klnds / ptllnd / ptllnd_modparams.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2005 Cluster File Systems, Inc. All rights reserved.
5  *   Author: PJ Kirner <pjkirner@clusterfs.com>
6  *
7  *   This file is part of the Lustre file system, http://www.lustre.org
8  *   Lustre is a trademark of Cluster File Systems, Inc.
9  *
10  *   This file is confidential source code owned by Cluster File Systems.
11  *   No viewing, modification, compilation, redistribution, or any other
12  *   form of use is permitted except through a signed license agreement.
13  *
14  *   If you have not signed such an agreement, then you have no rights to
15  *   this file.  Please destroy it immediately and contact CFS.
16  *
17  */
18
19
20 #include "ptllnd.h"
21
22 static int ntx = 256;
23 CFS_MODULE_PARM(ntx, "i", int, 0444,
24                 "# of TX descriptors");
25
26 static int max_nodes = 1152;
27 CFS_MODULE_PARM(max_nodes, "i", int, 0444,
28                 "maximum number of peer nodes");
29
30 static int max_procs_per_node = 2;
31 CFS_MODULE_PARM(max_procs_per_node, "i", int, 0444,
32                 "maximum number of processes per peer node to cache");
33
34 static int checksum = 0;
35 CFS_MODULE_PARM(checksum, "i", int, 0644,
36                 "set non-zero to enable message (not RDMA) checksums");
37
38 static int timeout = 50;
39 CFS_MODULE_PARM(timeout, "i", int, 0644,
40                 "timeout (seconds)");
41
42 static int portal = PTLLND_PORTAL;              /* <lnet/ptllnd_wire.h> */
43 CFS_MODULE_PARM(portal, "i", int, 0444,
44                 "portal id");
45
46 static int pid = PTLLND_PID;                    /* <lnet/ptllnd_wire.h> */
47 CFS_MODULE_PARM(pid, "i", int, 0444,
48                 "portals pid");
49
50 static int rxb_npages = 1;
51 CFS_MODULE_PARM(rxb_npages, "i", int, 0444,
52                 "# of pages per rx buffer");
53
54 static int rxb_nspare = 8;
55 CFS_MODULE_PARM(rxb_nspare, "i", int, 0444,
56                 "# of spare rx buffers");
57
58 static int credits = 128;
59 CFS_MODULE_PARM(credits, "i", int, 0444,
60                 "concurrent sends");
61
62 static int peercredits = PTLLND_PEERCREDITS;    /* <lnet/ptllnd_wire.h> */
63 CFS_MODULE_PARM(peercredits, "i", int, 0444,
64                 "concurrent sends to 1 peer");
65
66 static int max_msg_size = PTLLND_MAX_KLND_MSG_SIZE;  /* <lnet/ptllnd_wire.h> */
67 CFS_MODULE_PARM(max_msg_size, "i", int, 0444,
68                 "max size of immediate message");
69
70 static int peer_hash_table_size = 101;
71 CFS_MODULE_PARM(peer_hash_table_size, "i", int, 0444,
72                 "# of slots in the peer hash table");
73
74 static int reschedule_loops = 100;
75 CFS_MODULE_PARM(reschedule_loops, "i", int, 0644,
76                 "# of loops before scheduler does cond_resched()");
77
78 static int ack_puts = 0;
79 CFS_MODULE_PARM(ack_puts, "i", int, 0644,
80                 "get portals to ack all PUTs");
81
82 #ifdef CRAY_XT3
83 static int ptltrace_on_timeout = 0;
84 CFS_MODULE_PARM(ptltrace_on_timeout, "i", int, 0644,
85                 "dump ptltrace on timeout");
86
87 static char *ptltrace_basename = "/tmp/lnet-ptltrace";
88 CFS_MODULE_PARM(ptltrace_basename, "s", charp, 0644,
89                 "ptltrace dump file basename");
90 #endif
91 #ifdef PJK_DEBUGGING
92 static int simulation_bitmap = 0;
93 CFS_MODULE_PARM(simulation_bitmap, "i", int, 0444,
94                 "simulation bitmap");
95 #endif
96
97
98 kptl_tunables_t kptllnd_tunables = {
99         .kptl_ntx                    = &ntx,
100         .kptl_max_nodes              = &max_nodes,
101         .kptl_max_procs_per_node     = &max_procs_per_node,
102         .kptl_checksum               = &checksum,
103         .kptl_portal                 = &portal,
104         .kptl_pid                    = &pid,
105         .kptl_timeout                = &timeout,
106         .kptl_rxb_npages             = &rxb_npages,
107         .kptl_rxb_nspare             = &rxb_nspare,
108         .kptl_credits                = &credits,
109         .kptl_peercredits            = &peercredits,
110         .kptl_max_msg_size           = &max_msg_size,
111         .kptl_peer_hash_table_size   = &peer_hash_table_size,
112         .kptl_reschedule_loops       = &reschedule_loops,
113         .kptl_ack_puts               = &ack_puts,
114 #ifdef CRAY_XT3
115         .kptl_ptltrace_on_timeout    = &ptltrace_on_timeout,
116         .kptl_ptltrace_basename      = &ptltrace_basename,
117 #endif
118 #ifdef PJK_DEBUGGING
119         .kptl_simulation_bitmap      = &simulation_bitmap,
120 #endif
121 };
122
123
124 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
125 #ifdef CRAY_XT3
126 static char ptltrace_basename_space[1024];
127
128 static void
129 kptllnd_init_strtunable(char **str_param, char *space, int size)
130 {
131         strncpy(space, *str_param, size);
132         space[size - 1] = 0;
133         *str_param = space;
134 }
135 #endif
136
137 static cfs_sysctl_table_t kptllnd_ctl_table[] = {
138         {
139                 .ctl_name = 1,
140                 .procname = "ntx",
141                 .data     = &ntx,
142                 .maxlen   = sizeof(int),
143                 .mode     = 0444,
144                 .proc_handler = &proc_dointvec
145         },
146         {
147                 .ctl_name = 2,
148                 .procname = "max_nodes",
149                 .data     = &max_nodes,
150                 .maxlen   = sizeof(int),
151                 .mode     = 0444,
152                 .proc_handler = &proc_dointvec
153         },
154         {
155                 .ctl_name = 3,
156                 .procnmae = "max_procs_per_node",
157                 .data     = &max_procs_per_node,
158                 .maxlen   = sizeof(int),
159                 .mode     = 0444,
160                 .proc_handler = &proc_dointvec
161         },
162         {
163                 .ctl_name = 4,
164                 .procname = "checksum",
165                 .data     = &checksum,
166                 .maxlen   = sizeof(int),
167                 .mode     = 0644,
168                 .proc_handler = &proc_dointvec
169         },
170         {
171                 .ctl_name = 5,
172                 .procname = "timeout",
173                 .data     = &timeout,
174                 .maxlen   = sizeof(int),
175                 .mode     = 0644,
176                 .proc_handler = &proc_dointvec
177         },
178         {
179                 .ctl_name = 6,
180                 .procname = "portal",
181                 .data     = &portal,
182                 .maxlen   = sizeof(int),
183                 .mode     = 0444,
184                 .proc_handler = &proc_dointvec
185         },
186         {
187                 .ctl_name = 7,
188                 .procname = "pid",
189                 .data     = &pid,
190                 .maxlen   = sizeof(int),
191                 .mode     = 0444,
192                 .proc_handler = &proc_dointvec
193         },
194         {
195                 .ctl_name = 8,
196                 .procname = "rxb_npages",
197                 .data     = &rxb_npages,
198                 .maxlen   = sizeof(int),
199                 .mode     = 0444,
200                 .proc_handler = &proc_dointvec
201         },
202         {
203                 .ctl_name = 9,
204                 .procname = "credits",
205                 .data     = &credits,
206                 .maxlen   = sizeof(int),
207                 .mode     = 0444,
208                 .proc_handler = &proc_dointvec
209         },
210         {
211                 .ctl_name = 10,
212                 .procname = "peercredits",
213                 .data     = &peercredits,
214                 .maxlen   = sizeof(int),
215                 .mode     = 0444,
216                 .proc_handler = &proc_dointvec
217         },
218         {
219                 .ctl_name = 11,
220                 .procname = "max_msg_size",
221                 .data     = &max_msg_size,
222                 .maxlen   = sizeof(int),
223                 .mode     = 0444,
224                 .proc_handler = &proc_dointvec
225         },
226         {
227                 .ctl_name = 12,
228                 .procname = "peer_hash_table_size",
229                 .data     = &peer_hash_table_size,
230                 .maxlen   = sizeof(int),
231                 .mode     = 0444,
232                 .proc_handler = &proc_dointvec
233         },
234         {
235                 .ctl_name = 13,
236                 .procname = "reschedule_loops",
237                 .data     = &reschedule_loops,
238                 .maxlen   = sizeof(int),
239                 .mode     = 0444,
240                 .proc_handler = &proc_dointvec
241         },
242         {
243                 .ctl_name = 14,
244                 .procname = "ack_puts",
245                 .data     = &ack_puts,
246                 .maxlen   = sizeof(int),
247                 .mode     = 0644,
248                 .proc_handler = &proc_dointvec
249         },
250 #ifdef CRAY_XT3
251         {
252                 .ctl_name = 15,
253                 .procname = "ptltrace_on_timeout",
254                 .data     = &ptltrace_on_timeout,
255                 .maxlen   = sizeof(int),
256                 .mode     = 0644,
257                 .proc_handler = &proc_dointvec
258         },
259         {
260                 .ctl_name = 16,
261                 .procname = "ptltrace_basename",
262                 .data     = ptltrace_basename_space,
263                 .maxlen   = sizeof(ptltrace_basename_space),
264                 .mode     = 0644,
265                 .proc_handler = &proc_dostring,
266                 .strategy = &sysctl_string
267         },
268 #endif
269 #ifdef PJK_DEBUGGING
270         {
271                 .ctl_name = 17,
272                 .procname = "simulation_bitmap",
273                 .data     = &simulation_bitmap,
274                 .maxlen   = sizeof(int),
275                 .mode     = 0444,
276                 .proc_handler = &proc_dointvec
277         },
278 #endif
279
280         {0}
281 };
282
283 static cfs_sysctl_table_t kptllnd_top_ctl_table[] = {
284         {
285                 .ctl_name = 203,
286                 .procname = "ptllnd",
287                 .data     = NULL,
288                 .maxlen   = 0,
289                 .mode     = 0555,
290                 .child    = kptllnd_ctl_table
291         },
292         {0}
293 };
294
295 int
296 kptllnd_tunables_init ()
297 {
298 #ifdef CRAY_XT3
299         kptllnd_init_strtunable(&ptltrace_basename,
300                                 ptltrace_basename_space,
301                                 sizeof(ptltrace_basename_space));
302 #endif
303         kptllnd_tunables.kptl_sysctl =
304                 cfs_register_sysctl_table(kptllnd_top_ctl_table, 0);
305
306         if (kptllnd_tunables.kptl_sysctl == NULL)
307                 CWARN("Can't setup /proc tunables\n");
308
309         return 0;
310 }
311
312 void
313 kptllnd_tunables_fini ()
314 {
315         if (kptllnd_tunables.kptl_sysctl != NULL)
316                 cfs_unregister_sysctl_table(kptllnd_tunables.kptl_sysctl);
317 }
318
319 #else
320
321 int
322 kptllnd_tunables_init ()
323 {
324         return 0;
325 }
326
327 void
328 kptllnd_tunables_fini ()
329 {
330 }
331
332 #endif
333