Whamcloud - gitweb
2a4347acc88165842468a6c77958175da3a1b41c
[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 (C) 2001, 2002 Cluster File Systems, Inc.
5  *   Author: Eric Barton <eric@bartonsoftware.com>
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 #include "socklnd.h"
22
23 static int sock_timeout = 50;
24 CFS_MODULE_PARM(sock_timeout, "i", int, 0644,
25                 "dead socket timeout (seconds)");
26
27 static int credits = 256;
28 CFS_MODULE_PARM(credits, "i", int, 0444,
29                 "# concurrent sends");
30
31 static int peer_credits = 8;
32 CFS_MODULE_PARM(peer_credits, "i", int, 0444,
33                 "# concurrent sends to 1 peer");
34
35 static int nconnds = 4;
36 CFS_MODULE_PARM(nconnds, "i", int, 0444,
37                 "# connection daemons");
38
39 static int min_reconnectms = 1000;
40 CFS_MODULE_PARM(min_reconnectms, "i", int, 0644,
41                 "min connection retry interval (mS)");
42
43 static int max_reconnectms = 60000;
44 CFS_MODULE_PARM(max_reconnectms, "i", int, 0644,
45                 "max connection retry interval (mS)");
46
47 #if defined(__APPLE__) && !defined(__DARWIN8__)
48 # define DEFAULT_EAGER_ACK 1
49 #else
50 # define DEFAULT_EAGER_ACK 0
51 #endif
52 static int eager_ack = DEFAULT_EAGER_ACK;
53 CFS_MODULE_PARM(eager_ack, "i", int, 0644,
54                 "send tcp ack packets eagerly");
55
56 static int typed_conns = 1;
57 CFS_MODULE_PARM(typed_conns, "i", int, 0444,
58                 "use different sockets for bulk");
59
60 static int min_bulk = (1<<10);
61 CFS_MODULE_PARM(min_bulk, "i", int, 0644,
62                 "smallest 'large' message");
63
64 #ifdef __APPLE__
65 # ifdef __DARWIN8__
66 #  define DEFAULT_BUFFER_SIZE (224*1024)
67 # else
68 #  define DEFAULT_BUFFER_SIZE (1152 * 1024)
69 # endif
70 #else
71 # define DEFAULT_BUFFER_SIZE 0
72 #endif
73 static int tx_buffer_size = DEFAULT_BUFFER_SIZE;
74 CFS_MODULE_PARM(tx_buffer_size, "i", int, 0644,
75                 "socket tx buffer size (0 for system default)");
76
77 static int rx_buffer_size = DEFAULT_BUFFER_SIZE;
78 CFS_MODULE_PARM(rx_buffer_size, "i", int, 0644,
79                 "socket rx buffer size (0 for system default)");
80
81 static int nagle = 0;
82 CFS_MODULE_PARM(nagle, "i", int, 0644,
83                 "enable NAGLE?");
84
85 static int keepalive_idle = 30;
86 CFS_MODULE_PARM(keepalive_idle, "i", int, 0644,
87                 "# idle seconds before probe");
88
89 #ifdef HAVE_BGL_SUPPORT
90 #define DEFAULT_KEEPALIVE_COUNT  100
91 #else
92 #define DEFAULT_KEEPALIVE_COUNT  5
93 #endif
94 static int keepalive_count = DEFAULT_KEEPALIVE_COUNT;
95 CFS_MODULE_PARM(keepalive_count, "i", int, 0644,
96                 "# missed probes == dead");
97
98 static int keepalive_intvl = 5;
99 CFS_MODULE_PARM(keepalive_intvl, "i", int, 0644,
100                 "seconds between probes");
101
102 static int enable_csum = 0;
103 CFS_MODULE_PARM(enable_csum, "i", int, 0644,
104                 "enable check sum");
105
106 static int inject_csum_error = 0;
107 CFS_MODULE_PARM(inject_csum_error, "i", int, 0644,
108                 "set non-zero to inject a checksum error");
109 #ifdef CPU_AFFINITY
110 static int enable_irq_affinity = 1;
111 CFS_MODULE_PARM(enable_irq_affinity, "i", int, 0644,
112                 "enable IRQ affinity");
113 #endif
114
115 static unsigned int zc_min_frag = (2<<10);
116 CFS_MODULE_PARM(zc_min_frag, "i", int, 0644,
117                 "minimum fragment to zero copy");
118
119 #ifdef SOCKNAL_BACKOFF
120 static int backoff_init = 3;
121 CFS_MODULE_PARM(backoff_init, "i", int, 0644,
122                 "seconds for initial tcp backoff");
123
124 static int backoff_max = 3;
125 CFS_MODULE_PARM(backoff_max, "i", int, 0644,
126                 "seconds for maximum tcp backoff");
127 #endif
128
129 #if SOCKNAL_VERSION_DEBUG
130 static int protocol = 2;
131 CFS_MODULE_PARM(protocol, "i", int, 0644,
132                 "protocol version");
133 #endif
134
135 ksock_tunables_t ksocknal_tunables = {
136         .ksnd_timeout         = &sock_timeout,
137         .ksnd_credits         = &credits,
138         .ksnd_peercredits     = &peer_credits,
139         .ksnd_nconnds         = &nconnds,
140         .ksnd_min_reconnectms = &min_reconnectms,
141         .ksnd_max_reconnectms = &max_reconnectms,
142         .ksnd_eager_ack       = &eager_ack,
143         .ksnd_typed_conns     = &typed_conns,
144         .ksnd_min_bulk        = &min_bulk,
145         .ksnd_tx_buffer_size  = &tx_buffer_size,
146         .ksnd_rx_buffer_size  = &rx_buffer_size,
147         .ksnd_nagle           = &nagle,
148         .ksnd_keepalive_idle  = &keepalive_idle,
149         .ksnd_keepalive_count = &keepalive_count,
150         .ksnd_keepalive_intvl = &keepalive_intvl,
151         .ksnd_enable_csum     = &enable_csum,
152         .ksnd_inject_csum_error = &inject_csum_error,
153         .ksnd_zc_min_frag     = &zc_min_frag,
154 #ifdef CPU_AFFINITY
155         .ksnd_irq_affinity    = &enable_irq_affinity,
156 #endif
157 #ifdef SOCKNAL_BACKOFF
158         .ksnd_backoff_init    = &backoff_init,
159         .ksnd_backoff_max     = &backoff_max,
160 #endif
161 #if SOCKNAL_VERSION_DEBUG
162         .ksnd_protocol        = &protocol,
163 #endif
164 };
165