Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/inet/sctp/sctp_tunables.c
+++ new/usr/src/uts/common/inet/sctp/sctp_tunables.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 * Copyright (c) 2013 by Delphix. All rights reserved.
25 25 */
26 26
27 27 #include <inet/ip.h>
28 28 #include <inet/ip6.h>
29 29 #include <inet/sctp/sctp_stack.h>
30 30 #include <inet/sctp/sctp_impl.h>
31 31 #include <sys/sunddi.h>
32 32
33 33 /* Max size IP datagram is 64k - 1 */
34 34 #define SCTP_MSS_MAX_IPV4 (IP_MAXPACKET - (sizeof (ipha_t) + \
35 35 sizeof (sctp_hdr_t)))
36 36 #define SCTP_MSS_MAX_IPV6 (IP_MAXPACKET - (sizeof (ip6_t) + \
37 37 sizeof (sctp_hdr_t)))
38 38 /* Max of the above */
39 39 #define SCTP_MSS_MAX SCTP_MSS_MAX_IPV4
40 40
41 41 /*
42 42 * returns the current list of listener limit configuration.
43 43 */
44 44 /* ARGSUSED */
45 45 static int
46 46 sctp_listener_conf_get(netstack_t *stack, mod_prop_info_t *pinfo,
47 47 const char *ifname, void *val, uint_t psize, uint_t flags)
48 48 {
49 49 sctp_stack_t *sctps = stack->netstack_sctp;
50 50 sctp_listener_t *sl;
51 51 char *pval = val;
52 52 size_t nbytes = 0, tbytes = 0;
53 53 uint_t size;
54 54 int err = 0;
55 55
56 56 bzero(pval, psize);
57 57 size = psize;
58 58
59 59 if (flags & (MOD_PROP_DEFAULT|MOD_PROP_PERM|MOD_PROP_POSSIBLE))
60 60 return (0);
61 61
62 62 mutex_enter(&sctps->sctps_listener_conf_lock);
63 63 for (sl = list_head(&sctps->sctps_listener_conf); sl != NULL;
64 64 sl = list_next(&sctps->sctps_listener_conf, sl)) {
65 65 if (psize == size)
66 66 nbytes = snprintf(pval, size, "%d:%d", sl->sl_port,
67 67 sl->sl_ratio);
68 68 else
69 69 nbytes = snprintf(pval, size, ",%d:%d", sl->sl_port,
70 70 sl->sl_ratio);
71 71 size -= nbytes;
72 72 pval += nbytes;
73 73 tbytes += nbytes;
74 74 if (tbytes >= psize) {
75 75 /* Buffer overflow, stop copying information */
76 76 err = ENOBUFS;
77 77 break;
78 78 }
79 79 }
80 80
81 81 mutex_exit(&sctps->sctps_listener_conf_lock);
82 82 return (err);
83 83 }
84 84
85 85 /*
86 86 * add a new listener limit configuration.
87 87 */
88 88 /* ARGSUSED */
89 89 static int
90 90 sctp_listener_conf_add(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
91 91 const char *ifname, const void* pval, uint_t flags)
92 92 {
93 93 sctp_listener_t *new_sl;
94 94 sctp_listener_t *sl;
95 95 long lport;
96 96 long ratio;
97 97 char *colon;
98 98 sctp_stack_t *sctps = stack->netstack_sctp;
99 99
100 100 if (flags & MOD_PROP_DEFAULT)
101 101 return (ENOTSUP);
102 102
103 103 if (ddi_strtol(pval, &colon, 10, &lport) != 0 || lport <= 0 ||
104 104 lport > USHRT_MAX || *colon != ':') {
105 105 return (EINVAL);
106 106 }
107 107 if (ddi_strtol(colon + 1, NULL, 10, &ratio) != 0 || ratio <= 0)
108 108 return (EINVAL);
109 109
110 110 mutex_enter(&sctps->sctps_listener_conf_lock);
111 111 for (sl = list_head(&sctps->sctps_listener_conf); sl != NULL;
112 112 sl = list_next(&sctps->sctps_listener_conf, sl)) {
113 113 /* There is an existing entry, so update its ratio value. */
114 114 if (sl->sl_port == lport) {
115 115 sl->sl_ratio = ratio;
116 116 mutex_exit(&sctps->sctps_listener_conf_lock);
117 117 return (0);
118 118 }
119 119 }
120 120
121 121 if ((new_sl = kmem_alloc(sizeof (sctp_listener_t), KM_NOSLEEP)) ==
122 122 NULL) {
123 123 mutex_exit(&sctps->sctps_listener_conf_lock);
124 124 return (ENOMEM);
125 125 }
126 126
127 127 new_sl->sl_port = lport;
128 128 new_sl->sl_ratio = ratio;
129 129 list_insert_tail(&sctps->sctps_listener_conf, new_sl);
130 130 mutex_exit(&sctps->sctps_listener_conf_lock);
131 131 return (0);
132 132 }
133 133
134 134 /*
135 135 * remove a listener limit configuration.
136 136 */
137 137 /* ARGSUSED */
138 138 static int
139 139 sctp_listener_conf_del(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
140 140 const char *ifname, const void* pval, uint_t flags)
141 141 {
142 142 sctp_listener_t *sl;
143 143 long lport;
144 144 sctp_stack_t *sctps = stack->netstack_sctp;
145 145
146 146 if (flags & MOD_PROP_DEFAULT)
147 147 return (ENOTSUP);
148 148
149 149 if (ddi_strtol(pval, NULL, 10, &lport) != 0 || lport <= 0 ||
150 150 lport > USHRT_MAX) {
151 151 return (EINVAL);
152 152 }
153 153 mutex_enter(&sctps->sctps_listener_conf_lock);
154 154 for (sl = list_head(&sctps->sctps_listener_conf); sl != NULL;
155 155 sl = list_next(&sctps->sctps_listener_conf, sl)) {
156 156 if (sl->sl_port == lport) {
157 157 list_remove(&sctps->sctps_listener_conf, sl);
158 158 mutex_exit(&sctps->sctps_listener_conf_lock);
159 159 kmem_free(sl, sizeof (sctp_listener_t));
160 160 return (0);
161 161 }
162 162 }
163 163 mutex_exit(&sctps->sctps_listener_conf_lock);
164 164 return (ESRCH);
165 165 }
166 166
167 167 static int
168 168 sctp_set_buf_prop(netstack_t *stack, cred_t *cr, mod_prop_info_t *pinfo,
169 169 const char *ifname, const void *pval, uint_t flags)
170 170 {
171 171 return (mod_set_buf_prop(stack->netstack_sctp->sctps_propinfo_tbl,
172 172 stack, cr, pinfo, ifname, pval, flags));
173 173 }
174 174
175 175 static int
176 176 sctp_get_buf_prop(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
177 177 void *val, uint_t psize, uint_t flags)
178 178 {
179 179 return (mod_get_buf_prop(stack->netstack_sctp->sctps_propinfo_tbl,
180 180 stack, pinfo, ifname, val, psize, flags));
181 181 }
↓ open down ↓ |
181 lines elided |
↑ open up ↑ |
182 182
183 183 /*
184 184 * All of these are alterable, within the min/max values given, at run time.
185 185 *
186 186 * Note: All those tunables which do not start with "_" are Committed and
187 187 * therefore are public. See PSARC 2010/080.
188 188 */
189 189 mod_prop_info_t sctp_propinfo_tbl[] = {
190 190 { "_max_init_retr", MOD_PROTO_SCTP,
191 191 mod_set_uint32, mod_get_uint32,
192 - {0, 128, 8}, {8} },
192 + {{0, 128, 8}}, {8} },
193 193
194 194 { "_pa_max_retr", MOD_PROTO_SCTP,
195 195 mod_set_uint32, mod_get_uint32,
196 - {1, 128, 10}, {10} },
196 + {{1, 128, 10}}, {10} },
197 197
198 198 { "_pp_max_retr", MOD_PROTO_SCTP,
199 199 mod_set_uint32, mod_get_uint32,
200 - {1, 128, 5}, {5} },
200 + {{1, 128, 5}}, {5} },
201 201
202 202 { "_cwnd_max", MOD_PROTO_SCTP,
203 203 mod_set_uint32, mod_get_uint32,
204 - {128, ULP_MAX_BUF, 1024*1024}, {1024*1024} },
204 + {{128, ULP_MAX_BUF, 1024*1024}}, {1024*1024} },
205 205
206 206 { "smallest_nonpriv_port", MOD_PROTO_SCTP,
207 207 mod_set_uint32, mod_get_uint32,
208 - {1024, (32*1024), 1024}, {1024} },
208 + {{1024, (32*1024), 1024}}, {1024} },
209 209
210 210 { "_ipv4_ttl", MOD_PROTO_SCTP,
211 211 mod_set_uint32, mod_get_uint32,
212 - {1, 255, 64}, {64} },
212 + {{1, 255, 64}}, {64} },
213 213
214 214 { "_heartbeat_interval", MOD_PROTO_SCTP,
215 215 mod_set_uint32, mod_get_uint32,
216 - {0, 1*DAYS, 30*SECONDS}, {30*SECONDS} },
216 + {{0, 1*DAYS, 30*SECONDS}}, {30*SECONDS} },
217 217
218 218 { "_initial_mtu", MOD_PROTO_SCTP,
219 219 mod_set_uint32, mod_get_uint32,
220 - {68, 65535, 1500}, {1500} },
220 + {{68, 65535, 1500}}, {1500} },
221 221
222 222 { "_mtu_probe_interval", MOD_PROTO_SCTP,
223 223 mod_set_uint32, mod_get_uint32,
224 - {0, 1*DAYS, 10*MINUTES}, {10*MINUTES} },
224 + {{0, 1*DAYS, 10*MINUTES}}, {10*MINUTES} },
225 225
226 226 { "_new_secret_interval", MOD_PROTO_SCTP,
227 227 mod_set_uint32, mod_get_uint32,
228 - {0, 1*DAYS, 2*MINUTES}, {2*MINUTES} },
228 + {{0, 1*DAYS, 2*MINUTES}}, {2*MINUTES} },
229 229
230 230 /* tunable - 10 */
231 231 { "_deferred_ack_interval", MOD_PROTO_SCTP,
232 232 mod_set_uint32, mod_get_uint32,
233 - {10*MS, 1*MINUTES, 100*MS}, {100*MS} },
233 + {{10*MS, 1*MINUTES, 100*MS}}, {100*MS} },
234 234
235 235 { "_snd_lowat_fraction", MOD_PROTO_SCTP,
236 236 mod_set_uint32, mod_get_uint32,
237 - {0, 16, 0}, {0} },
237 + {{0, 16, 0}}, {0} },
238 238
239 239 { "_ignore_path_mtu", MOD_PROTO_SCTP,
240 240 mod_set_boolean, mod_get_boolean,
241 - {B_FALSE}, {B_FALSE} },
241 + {.mpi_bval = B_FALSE}, {B_FALSE} },
242 242
243 243 { "_initial_ssthresh", MOD_PROTO_SCTP,
244 244 mod_set_uint32, mod_get_uint32,
245 - {1024, UINT32_MAX, SCTP_RECV_HIWATER}, { SCTP_RECV_HIWATER} },
245 + {{1024, UINT32_MAX, SCTP_RECV_HIWATER}}, { SCTP_RECV_HIWATER} },
246 246
247 247 { "smallest_anon_port", MOD_PROTO_SCTP,
248 248 mod_set_uint32, mod_get_uint32,
249 - {1024, ULP_MAX_PORT, 32*1024}, {32*1024} },
249 + {{1024, ULP_MAX_PORT, 32*1024}}, {32*1024} },
250 250
251 251 { "largest_anon_port", MOD_PROTO_SCTP,
252 252 mod_set_uint32, mod_get_uint32,
253 - {1024, ULP_MAX_PORT, ULP_MAX_PORT}, {ULP_MAX_PORT} },
253 + {{1024, ULP_MAX_PORT, ULP_MAX_PORT}}, {ULP_MAX_PORT} },
254 254
255 255 { "send_buf", MOD_PROTO_SCTP,
256 256 sctp_set_buf_prop, sctp_get_buf_prop,
257 - {SCTP_XMIT_LOWATER, ULP_MAX_BUF, SCTP_XMIT_HIWATER},
257 + {{SCTP_XMIT_LOWATER, ULP_MAX_BUF, SCTP_XMIT_HIWATER}},
258 258 {SCTP_XMIT_HIWATER} },
259 259
260 260 { "_xmit_lowat", MOD_PROTO_SCTP,
261 261 mod_set_uint32, mod_get_uint32,
262 - {SCTP_XMIT_LOWATER, ULP_MAX_BUF, SCTP_XMIT_LOWATER},
262 + {{SCTP_XMIT_LOWATER, ULP_MAX_BUF, SCTP_XMIT_LOWATER}},
263 263 {SCTP_XMIT_LOWATER} },
264 264
265 265 { "recv_buf", MOD_PROTO_SCTP,
266 266 sctp_set_buf_prop, sctp_get_buf_prop,
267 - {SCTP_RECV_LOWATER, ULP_MAX_BUF, SCTP_RECV_HIWATER},
267 + {{SCTP_RECV_LOWATER, ULP_MAX_BUF, SCTP_RECV_HIWATER}},
268 268 {SCTP_RECV_HIWATER} },
269 269
270 270 { "max_buf", MOD_PROTO_SCTP,
271 271 mod_set_uint32, mod_get_uint32,
272 - {8192, ULP_MAX_BUF, 1024*1024}, {1024*1024} },
272 + {{8192, ULP_MAX_BUF, 1024*1024}}, {1024*1024} },
273 273
274 274 /* tunable - 20 */
275 275 { "_rtt_updates", MOD_PROTO_SCTP,
276 276 mod_set_uint32, mod_get_uint32,
277 - {0, 65536, 20}, {20} },
277 + {{0, 65536, 20}}, {20} },
278 278
279 279 { "_ipv6_hoplimit", MOD_PROTO_SCTP,
280 280 mod_set_uint32, mod_get_uint32,
281 - {0, IPV6_MAX_HOPS, IPV6_DEFAULT_HOPS}, {IPV6_DEFAULT_HOPS} },
281 + {{0, IPV6_MAX_HOPS, IPV6_DEFAULT_HOPS}}, {IPV6_DEFAULT_HOPS} },
282 282
283 283 { "_rto_min", MOD_PROTO_SCTP,
284 284 mod_set_uint32, mod_get_uint32,
285 - {500*MS, 60*SECONDS, 1*SECONDS}, {1*SECONDS} },
285 + {{500*MS, 60*SECONDS, 1*SECONDS}}, {1*SECONDS} },
286 286
287 287 { "_rto_max", MOD_PROTO_SCTP,
288 288 mod_set_uint32, mod_get_uint32,
289 - {1*SECONDS, 60000*SECONDS, 60*SECONDS}, {60*SECONDS} },
289 + {{1*SECONDS, 60000*SECONDS, 60*SECONDS}}, {60*SECONDS} },
290 290
291 291 { "_rto_initial", MOD_PROTO_SCTP,
292 292 mod_set_uint32, mod_get_uint32,
293 - {1*SECONDS, 60000*SECONDS, 3*SECONDS}, {3*SECONDS} },
293 + {{1*SECONDS, 60000*SECONDS, 3*SECONDS}}, {3*SECONDS} },
294 294
295 295 { "_cookie_life", MOD_PROTO_SCTP,
296 296 mod_set_uint32, mod_get_uint32,
297 - {10*MS, 60000*SECONDS, 60*SECONDS}, {60*SECONDS} },
297 + {{10*MS, 60000*SECONDS, 60*SECONDS}}, {60*SECONDS} },
298 298
299 299 { "_max_in_streams", MOD_PROTO_SCTP,
300 300 mod_set_uint32, mod_get_uint32,
301 - {1, UINT16_MAX, 32}, {32} },
301 + {{1, UINT16_MAX, 32}}, {32} },
302 302
303 303 { "_initial_out_streams", MOD_PROTO_SCTP,
304 304 mod_set_uint32, mod_get_uint32,
305 - {1, UINT16_MAX, 32}, {32} },
305 + {{1, UINT16_MAX, 32}}, {32} },
306 306
307 307 { "_shutack_wait_bound", MOD_PROTO_SCTP,
308 308 mod_set_uint32, mod_get_uint32,
309 - {0, 300*SECONDS, 60*SECONDS}, {60*SECONDS} },
309 + {{0, 300*SECONDS, 60*SECONDS}}, {60*SECONDS} },
310 310
311 311 { "_maxburst", MOD_PROTO_SCTP,
312 312 mod_set_uint32, mod_get_uint32,
313 - {2, 8, 4}, {4} },
313 + {{2, 8, 4}}, {4} },
314 314
315 315 /* tunable - 30 */
316 316 { "_addip_enabled", MOD_PROTO_SCTP,
317 317 mod_set_boolean, mod_get_boolean,
318 - {B_FALSE}, {B_FALSE} },
318 + {.mpi_bval = B_FALSE}, {B_FALSE} },
319 319
320 320 { "_recv_hiwat_minmss", MOD_PROTO_SCTP,
321 321 mod_set_uint32, mod_get_uint32,
322 - {1, 65536, 4}, {4} },
322 + {{1, 65536, 4}}, {4} },
323 323
324 324 { "_slow_start_initial", MOD_PROTO_SCTP,
325 325 mod_set_uint32, mod_get_uint32,
326 - {1, 16, 4}, {4} },
326 + {{1, 16, 4}}, {4} },
327 327
328 328 { "_slow_start_after_idle", MOD_PROTO_SCTP,
329 329 mod_set_uint32, mod_get_uint32,
330 - {1, 16384, 4}, {4} },
330 + {{1, 16384, 4}}, {4} },
331 331
332 332 { "_prsctp_enabled", MOD_PROTO_SCTP,
333 333 mod_set_boolean, mod_get_boolean,
334 - {B_TRUE}, {B_TRUE} },
334 + {.mpi_bval = B_TRUE}, {B_TRUE} },
335 335
336 336 { "_fast_rxt_thresh", MOD_PROTO_SCTP,
337 337 mod_set_uint32, mod_get_uint32,
338 - {1, 10000, 3}, {3} },
338 + {{1, 10000, 3}}, {3} },
339 339
340 340 { "_deferred_acks_max", MOD_PROTO_SCTP,
341 341 mod_set_uint32, mod_get_uint32,
342 - { 1, 16, 2}, {2} },
342 + {{ 1, 16, 2}}, {2} },
343 343
344 344 /*
345 345 * sctp_wroff_xtra is the extra space in front of SCTP/IP header
346 346 * for link layer header. It has to be a multiple of 8.
347 347 */
348 348 { "_wroff_xtra", MOD_PROTO_SCTP,
349 349 mod_set_aligned, mod_get_uint32,
350 - {0, 256, 32}, {32} },
350 + {{0, 256, 32}}, {32} },
351 351
352 352 { "extra_priv_ports", MOD_PROTO_SCTP,
353 353 mod_set_extra_privports, mod_get_extra_privports,
354 - {1, ULP_MAX_PORT, 0}, {0} },
354 + {{1, ULP_MAX_PORT, 0}}, {0} },
355 355
356 356 { "_listener_limit_conf", MOD_PROTO_SCTP,
357 - NULL, sctp_listener_conf_get, {0}, {0} },
357 + NULL, sctp_listener_conf_get, {{0,0,0}}, {0} },
358 358
359 359 { "_listener_limit_conf_add", MOD_PROTO_SCTP,
360 - sctp_listener_conf_add, NULL, {0}, {0} },
360 + sctp_listener_conf_add, NULL, {{0,0,0}}, {0} },
361 361
362 362 { "_listener_limit_conf_del", MOD_PROTO_SCTP,
363 - sctp_listener_conf_del, NULL, {0}, {0} },
363 + sctp_listener_conf_del, NULL, {{0,0,0}}, {0} },
364 364
365 - { "?", MOD_PROTO_SCTP, NULL, mod_get_allprop, {0}, {0} },
365 + { "?", MOD_PROTO_SCTP, NULL, mod_get_allprop, {{0,0,0}}, {0} },
366 366
367 - { NULL, 0, NULL, NULL, {0}, {0} }
367 + { NULL, 0, NULL, NULL, {{0,0,0}}, {0} }
368 368 };
369 369
370 370 int sctp_propinfo_count = A_CNT(sctp_propinfo_tbl);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX