Whamcloud - gitweb
* Changed the ptllnd module parameter ptltrace_on_timeout default to 1
[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_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 #ifdef CRAY_XT3
79 static int ptltrace_on_timeout = 1;
80 CFS_MODULE_PARM(ptltrace_on_timeout, "i", int, 0644,
81                 "dump ptltrace on timeout");
82
83 static char *ptltrace_basename = "/tmp/lnet-ptltrace";
84 CFS_MODULE_PARM(ptltrace_basename, "s", charp, 0644,
85                 "ptltrace dump file basename");
86 #endif
87 #ifdef PJK_DEBUGGING
88 static int simulation_bitmap = 0;
89 CFS_MODULE_PARM(simulation_bitmap, "i", int, 0444,
90                 "simulation bitmap");
91 #endif
92
93
94 kptl_tunables_t kptllnd_tunables = {
95         .kptl_ntx                    = &ntx,
96         .kptl_max_nodes              = &max_nodes,
97         .kptl_max_procs_per_node     = &max_procs_per_node,
98         .kptl_checksum               = &checksum,
99         .kptl_portal                 = &portal,
100         .kptl_pid                    = &pid,
101         .kptl_timeout                = &timeout,
102         .kptl_rxb_npages             = &rxb_npages,
103         .kptl_rxb_nspare             = &rxb_nspare,
104         .kptl_credits                = &credits,
105         .kptl_peercredits            = &peercredits,
106         .kptl_max_msg_size           = &max_msg_size,
107         .kptl_peer_hash_table_size   = &peer_hash_table_size,
108         .kptl_reschedule_loops       = &reschedule_loops,
109 #ifdef CRAY_XT3
110         .kptl_ptltrace_on_timeout    = &ptltrace_on_timeout,
111         .kptl_ptltrace_basename      = &ptltrace_basename,
112 #endif
113 #ifdef PJK_DEBUGGING
114         .kptl_simulation_bitmap      = &simulation_bitmap,
115 #endif
116 };
117
118
119 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
120 #ifdef CRAY_XT3
121 static char ptltrace_basename_space[1024];
122
123 static void
124 kptllnd_init_strtunable(char **str_param, char *space, int size)
125 {
126         strncpy(space, *str_param, size);
127         space[size - 1] = 0;
128         *str_param = space;
129 }
130 #endif
131
132 static ctl_table kptllnd_ctl_table[] = {
133         {1, "ntx", &ntx,
134          sizeof(int), 0444, NULL, &proc_dointvec},
135         {2, "max_nodes", &max_nodes,
136          sizeof(int), 0444, NULL, &proc_dointvec},
137         {3, "max_procs_per_node", &max_procs_per_node,
138          sizeof(int), 0444, NULL, &proc_dointvec},
139         {4, "checksum", &checksum,
140          sizeof(int), 0644, NULL, &proc_dointvec},
141         {5, "timeout", &timeout,
142          sizeof(int), 0644, NULL, &proc_dointvec},
143         {6, "portal", &portal,
144          sizeof(int), 0444, NULL, &proc_dointvec},
145         {7, "pid", &pid,
146          sizeof(int), 0444, NULL, &proc_dointvec},
147         {8, "rxb_npages", &rxb_npages,
148          sizeof(int), 0444, NULL, &proc_dointvec},
149         {9, "credits", &credits,
150          sizeof(int), 0444, NULL, &proc_dointvec},
151         {10, "peercredits", &peercredits,
152          sizeof(int), 0444, NULL, &proc_dointvec},
153         {11, "max_msg_size", &max_msg_size,
154          sizeof(int), 0444, NULL, &proc_dointvec},
155         {12, "peer_hash_table_size", &peer_hash_table_size,
156          sizeof(int), 0444, NULL, &proc_dointvec},
157         {13, "reschedule_loops", &reschedule_loops,
158          sizeof(int), 0444, NULL, &proc_dointvec},
159 #ifdef CRAY_XT3
160         {14, "ptltrace_on_timeout", &ptltrace_on_timeout,
161          sizeof(int), 0644, NULL, &proc_dointvec},
162         {15, "ptltrace_basename", ptltrace_basename_space,
163          sizeof(ptltrace_basename_space), 0644, NULL, &proc_dostring,
164          &sysctl_string},
165 #endif
166 #ifdef PJK_DEBUGGING
167         {16, "simulation_bitmap", &simulation_bitmap,
168          sizeof(int), 0444, NULL, &proc_dointvec},
169 #endif
170
171         {0}
172 };
173
174 static ctl_table kptllnd_top_ctl_table[] = {
175         {203, "ptllnd", NULL, 0, 0555, kptllnd_ctl_table},
176         {0}
177 };
178
179 int
180 kptllnd_tunables_init ()
181 {
182 #ifdef CRAY_XT3
183         kptllnd_init_strtunable(&ptltrace_basename,
184                                 ptltrace_basename_space,
185                                 sizeof(ptltrace_basename_space));
186 #endif
187         kptllnd_tunables.kptl_sysctl =
188                 register_sysctl_table(kptllnd_top_ctl_table, 0);
189
190         if (kptllnd_tunables.kptl_sysctl == NULL)
191                 CWARN("Can't setup /proc tunables\n");
192
193         return 0;
194 }
195
196 void
197 kptllnd_tunables_fini ()
198 {
199         if (kptllnd_tunables.kptl_sysctl != NULL)
200                 unregister_sysctl_table(kptllnd_tunables.kptl_sysctl);
201 }
202
203 #else
204
205 int
206 kptllnd_tunables_init ()
207 {
208         return 0;
209 }
210
211 void
212 kptllnd_tunables_fini ()
213 {
214 }
215
216 #endif
217