Whamcloud - gitweb
Branch b1_8
[fs/lustre-release.git] / lnet / klnds / socklnd / socklnd_modparams.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright  2008 Sun Microsystems, Inc. All rights reserved
5  *
6  *   Author: Eric Barton <eric@bartonsoftware.com>
7  *
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.
11  *
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.
16  *
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.
20  */
21
22 #include "socklnd.h"
23
24 static int sock_timeout = 50;
25 CFS_MODULE_PARM(sock_timeout, "i", int, 0644,
26                 "dead socket timeout (seconds)");
27
28 static int credits = 256;
29 CFS_MODULE_PARM(credits, "i", int, 0444,
30                 "# concurrent sends");
31
32 static int peer_credits = 8;
33 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
34                 "# concurrent sends to 1 peer");
35
36 static int peer_buffer_credits = 0;
37 CFS_MODULE_PARM(peer_buffer_credits, "i", int, 0444,
38                 "# per-peer router buffer credits");
39
40 static int peer_timeout = 0;
41 CFS_MODULE_PARM(peer_timeout, "i", int, 0444,
42                 "Seconds without aliveness news to declare peer dead (<=0 to disable)");
43
44 static int nconnds = 4;
45 CFS_MODULE_PARM(nconnds, "i", int, 0444,
46                 "# connection daemons");
47
48 static int min_reconnectms = 1000;
49 CFS_MODULE_PARM(min_reconnectms, "i", int, 0644,
50                 "min connection retry interval (mS)");
51
52 static int max_reconnectms = 60000;
53 CFS_MODULE_PARM(max_reconnectms, "i", int, 0644,
54                 "max connection retry interval (mS)");
55
56 #if defined(__APPLE__) && !defined(__DARWIN8__)
57 # define DEFAULT_EAGER_ACK 1
58 #else
59 # define DEFAULT_EAGER_ACK 0
60 #endif
61 static int eager_ack = DEFAULT_EAGER_ACK;
62 CFS_MODULE_PARM(eager_ack, "i", int, 0644,
63                 "send tcp ack packets eagerly");
64
65 static int typed_conns = 1;
66 CFS_MODULE_PARM(typed_conns, "i", int, 0444,
67                 "use different sockets for bulk");
68
69 static int min_bulk = (1<<10);
70 CFS_MODULE_PARM(min_bulk, "i", int, 0644,
71                 "smallest 'large' message");
72
73 #ifdef __APPLE__
74 # ifdef __DARWIN8__
75 #  define DEFAULT_BUFFER_SIZE (224*1024)
76 # else
77 #  define DEFAULT_BUFFER_SIZE (1152 * 1024)
78 # endif
79 #else
80 # define DEFAULT_BUFFER_SIZE 0
81 #endif
82 static int tx_buffer_size = DEFAULT_BUFFER_SIZE;
83 CFS_MODULE_PARM(tx_buffer_size, "i", int, 0644,
84                 "socket tx buffer size (0 for system default)");
85
86 static int rx_buffer_size = DEFAULT_BUFFER_SIZE;
87 CFS_MODULE_PARM(rx_buffer_size, "i", int, 0644,
88                 "socket rx buffer size (0 for system default)");
89
90 static int nagle = 0;
91 CFS_MODULE_PARM(nagle, "i", int, 0644,
92                 "enable NAGLE?");
93
94 static int round_robin = 1;
95 CFS_MODULE_PARM(round_robin, "i", int, 0644,
96                 "Round robin for multiple interfaces");
97
98 static int keepalive = 30;
99 CFS_MODULE_PARM(keepalive, "i", int, 0644,
100                 "# seconds before send keepalive");
101
102 static int keepalive_idle = 30;
103 CFS_MODULE_PARM(keepalive_idle, "i", int, 0644,
104                 "# idle seconds before probe");
105
106 #ifdef HAVE_BGL_SUPPORT
107 #define DEFAULT_KEEPALIVE_COUNT  100
108 #else
109 #define DEFAULT_KEEPALIVE_COUNT  5
110 #endif
111 static int keepalive_count = DEFAULT_KEEPALIVE_COUNT;
112 CFS_MODULE_PARM(keepalive_count, "i", int, 0644,
113                 "# missed probes == dead");
114
115 static int keepalive_intvl = 5;
116 CFS_MODULE_PARM(keepalive_intvl, "i", int, 0644,
117                 "seconds between probes");
118
119 static int enable_csum = 0;
120 CFS_MODULE_PARM(enable_csum, "i", int, 0644,
121                 "enable check sum");
122
123 static int inject_csum_error = 0;
124 CFS_MODULE_PARM(inject_csum_error, "i", int, 0644,
125                 "set non-zero to inject a checksum error");
126 #ifdef CPU_AFFINITY
127 static int enable_irq_affinity = 0;
128 CFS_MODULE_PARM(enable_irq_affinity, "i", int, 0644,
129                 "enable IRQ affinity");
130 #endif
131
132 static unsigned int zc_min_payload = (16 << 10);
133 CFS_MODULE_PARM(zc_min_payload, "i", int, 0644,
134                 "minimum payload size to zero copy");
135
136 static unsigned int zc_recv = 0;
137 CFS_MODULE_PARM(zc_recv, "i", int, 0644,
138                 "enable ZC recv for Chelsio driver");
139
140 static unsigned int zc_recv_min_nfrags = 16;
141 CFS_MODULE_PARM(zc_recv_min_nfrags, "i", int, 0644,
142                 "minimum # of fragments to enable ZC recv");
143
144 #ifdef SOCKNAL_BACKOFF
145 static int backoff_init = 3;
146 CFS_MODULE_PARM(backoff_init, "i", int, 0644,
147                 "seconds for initial tcp backoff");
148
149 static int backoff_max = 3;
150 CFS_MODULE_PARM(backoff_max, "i", int, 0644,
151                 "seconds for maximum tcp backoff");
152 #endif
153
154 #if SOCKNAL_VERSION_DEBUG
155 static int protocol = 3;
156 CFS_MODULE_PARM(protocol, "i", int, 0644,
157                 "protocol version");
158 #endif
159
160 ksock_tunables_t ksocknal_tunables = {
161         .ksnd_timeout         = &sock_timeout,
162         .ksnd_credits         = &credits,
163         .ksnd_peertxcredits   = &peer_credits,
164         .ksnd_peerrtrcredits  = &peer_buffer_credits,
165         .ksnd_peertimeout     = &peer_timeout,
166         .ksnd_nconnds         = &nconnds,
167         .ksnd_min_reconnectms = &min_reconnectms,
168         .ksnd_max_reconnectms = &max_reconnectms,
169         .ksnd_eager_ack       = &eager_ack,
170         .ksnd_typed_conns     = &typed_conns,
171         .ksnd_min_bulk        = &min_bulk,
172         .ksnd_tx_buffer_size  = &tx_buffer_size,
173         .ksnd_rx_buffer_size  = &rx_buffer_size,
174         .ksnd_nagle           = &nagle,
175         .ksnd_round_robin     = &round_robin,
176         .ksnd_keepalive       = &keepalive,
177         .ksnd_keepalive_idle  = &keepalive_idle,
178         .ksnd_keepalive_count = &keepalive_count,
179         .ksnd_keepalive_intvl = &keepalive_intvl,
180         .ksnd_enable_csum     = &enable_csum,
181         .ksnd_inject_csum_error = &inject_csum_error,
182         .ksnd_zc_min_payload  = &zc_min_payload,
183         .ksnd_zc_recv         = &zc_recv,
184         .ksnd_zc_recv_min_nfrags = &zc_recv_min_nfrags,
185 #ifdef CPU_AFFINITY
186         .ksnd_irq_affinity    = &enable_irq_affinity,
187 #endif
188 #ifdef SOCKNAL_BACKOFF
189         .ksnd_backoff_init    = &backoff_init,
190         .ksnd_backoff_max     = &backoff_max,
191 #endif
192 #if SOCKNAL_VERSION_DEBUG
193         .ksnd_protocol        = &protocol,
194 #endif
195 };
196