xref: /titanic_50/usr/src/uts/common/inet/sctp/sctp_tunables.c (revision 5bd55801d6fb883418913e3f9f6d13fb29003956)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #include <inet/ip.h>
27 #include <inet/ip6.h>
28 #include <inet/sctp/sctp_stack.h>
29 #include <inet/sctp/sctp_impl.h>
30 #include <sys/sunddi.h>
31 
32 /* Max size IP datagram is 64k - 1 */
33 #define	SCTP_MSS_MAX_IPV4 (IP_MAXPACKET - (sizeof (ipha_t) + \
34 					sizeof (sctp_hdr_t)))
35 #define	SCTP_MSS_MAX_IPV6 (IP_MAXPACKET - (sizeof (ip6_t) + \
36 					sizeof (sctp_hdr_t)))
37 /* Max of the above */
38 #define	SCTP_MSS_MAX	SCTP_MSS_MAX_IPV4
39 
40 /*
41  * All of these are alterable, within the min/max values given, at run time.
42  *
43  * Note: All those tunables which do not start with "sctp_" are Committed and
44  * therefore are public. See PSARC 2009/306.
45  */
46 mod_prop_info_t sctp_propinfo_tbl[] = {
47 	{ "sctp_max_init_retr", MOD_PROTO_SCTP,
48 	    mod_set_uint32, mod_get_uint32,
49 	    {0, 128, 8}, {8} },
50 
51 	{ "sctp_pa_max_retr", MOD_PROTO_SCTP,
52 	    mod_set_uint32, mod_get_uint32,
53 	    {1, 128, 10}, {10} },
54 
55 	{ "sctp_pp_max_retr", MOD_PROTO_SCTP,
56 	    mod_set_uint32, mod_get_uint32,
57 	    {1, 128, 5}, {5} },
58 
59 	{ "sctp_cwnd_max", MOD_PROTO_SCTP,
60 	    mod_set_uint32, mod_get_uint32,
61 	    {128, (1<<30), 1024*1024}, {1024*1024} },
62 
63 	{ "smallest_nonpriv_port", MOD_PROTO_SCTP,
64 	    mod_set_uint32, mod_get_uint32,
65 	    {1024, (32*1024), 1024}, {1024} },
66 
67 	{ "sctp_ipv4_ttl", MOD_PROTO_SCTP,
68 	    mod_set_uint32, mod_get_uint32,
69 	    {1, 255, 64}, {64} },
70 
71 	{ "sctp_heartbeat_interval", MOD_PROTO_SCTP,
72 	    mod_set_uint32, mod_get_uint32,
73 	    {0, 1*DAYS, 30*SECONDS}, {30*SECONDS} },
74 
75 	{ "sctp_initial_mtu", MOD_PROTO_SCTP,
76 	    mod_set_uint32, mod_get_uint32,
77 	    {68, 65535, 1500}, {1500} },
78 
79 	{ "sctp_mtu_probe_interval", MOD_PROTO_SCTP,
80 	    mod_set_uint32, mod_get_uint32,
81 	    {0, 1*DAYS, 10*MINUTES}, {10*MINUTES} },
82 
83 	{ "sctp_new_secret_interval", MOD_PROTO_SCTP,
84 	    mod_set_uint32, mod_get_uint32,
85 	    {0, 1*DAYS, 2*MINUTES}, {2*MINUTES} },
86 
87 	/* tunable - 10 */
88 	{ "sctp_deferred_ack_interval", MOD_PROTO_SCTP,
89 	    mod_set_uint32, mod_get_uint32,
90 	    {10*MS, 1*MINUTES, 100*MS}, {100*MS} },
91 
92 	{ "sctp_snd_lowat_fraction", MOD_PROTO_SCTP,
93 	    mod_set_uint32, mod_get_uint32,
94 	    {0, 16, 0}, {0} },
95 
96 	{ "sctp_ignore_path_mtu", MOD_PROTO_SCTP,
97 	    mod_set_boolean, mod_get_boolean,
98 	    {B_FALSE}, {B_FALSE} },
99 
100 	{ "sctp_initial_ssthresh", MOD_PROTO_SCTP,
101 	    mod_set_uint32, mod_get_uint32,
102 	    {1024, UINT32_MAX, SCTP_RECV_HIWATER}, { SCTP_RECV_HIWATER} },
103 
104 	{ "smallest_anon_port", MOD_PROTO_SCTP,
105 	    mod_set_uint32, mod_get_uint32,
106 	    {1024, ULP_MAX_PORT, 32*1024}, {32*1024} },
107 
108 	{ "largest_anon_port", MOD_PROTO_SCTP,
109 	    mod_set_uint32, mod_get_uint32,
110 	    {1024, ULP_MAX_PORT, ULP_MAX_PORT}, {ULP_MAX_PORT} },
111 
112 	{ "send_maxbuf", MOD_PROTO_SCTP,
113 	    mod_set_uint32, mod_get_uint32,
114 	    {SCTP_XMIT_LOWATER,  (1<<30),  SCTP_XMIT_HIWATER},
115 	    {SCTP_XMIT_HIWATER} },
116 
117 	{ "sctp_xmit_lowat", MOD_PROTO_SCTP,
118 	    mod_set_uint32, mod_get_uint32,
119 	    {SCTP_XMIT_LOWATER,  (1<<30),  SCTP_XMIT_LOWATER},
120 	    {SCTP_XMIT_LOWATER} },
121 
122 	{ "recv_maxbuf", MOD_PROTO_SCTP,
123 	    mod_set_uint32, mod_get_uint32,
124 	    {SCTP_RECV_LOWATER,  (1<<30),  SCTP_RECV_HIWATER},
125 	    {SCTP_RECV_HIWATER} },
126 
127 	{ "sctp_max_buf", MOD_PROTO_SCTP,
128 	    mod_set_uint32, mod_get_uint32,
129 	    {8192, (1<<30), 1024*1024}, {1024*1024} },
130 
131 	/* tunable - 20 */
132 	{ "sctp_rtt_updates", MOD_PROTO_SCTP,
133 	    mod_set_uint32, mod_get_uint32,
134 	    {0, 65536, 20}, {20} },
135 
136 	{ "sctp_ipv6_hoplimit", MOD_PROTO_SCTP,
137 	    mod_set_uint32, mod_get_uint32,
138 	    {0, IPV6_MAX_HOPS, IPV6_DEFAULT_HOPS}, {IPV6_DEFAULT_HOPS} },
139 
140 	{ "sctp_rto_min", MOD_PROTO_SCTP,
141 	    mod_set_uint32, mod_get_uint32,
142 	    {500*MS, 60*SECONDS, 1*SECONDS}, {1*SECONDS} },
143 
144 	{ "sctp_rto_max", MOD_PROTO_SCTP,
145 	    mod_set_uint32, mod_get_uint32,
146 	    {1*SECONDS, 60000*SECONDS, 60*SECONDS}, {60*SECONDS} },
147 
148 	{ "sctp_rto_initial", MOD_PROTO_SCTP,
149 	    mod_set_uint32, mod_get_uint32,
150 	    {1*SECONDS, 60000*SECONDS, 3*SECONDS}, {3*SECONDS} },
151 
152 	{ "sctp_cookie_life", MOD_PROTO_SCTP,
153 	    mod_set_uint32, mod_get_uint32,
154 	    {10*MS, 60000*SECONDS, 60*SECONDS}, {60*SECONDS} },
155 
156 	{ "sctp_max_in_streams", MOD_PROTO_SCTP,
157 	    mod_set_uint32, mod_get_uint32,
158 	    {1, UINT16_MAX, 32}, {32} },
159 
160 	{ "sctp_initial_out_streams", MOD_PROTO_SCTP,
161 	    mod_set_uint32, mod_get_uint32,
162 	    {1, UINT16_MAX, 32}, {32} },
163 
164 	{ "sctp_shutack_wait_bound", MOD_PROTO_SCTP,
165 	    mod_set_uint32, mod_get_uint32,
166 	    {0, 300*SECONDS, 60*SECONDS}, {60*SECONDS} },
167 
168 	{ "sctp_maxburst", MOD_PROTO_SCTP,
169 	    mod_set_uint32, mod_get_uint32,
170 	    {2, 8, 4}, {4} },
171 
172 	/* tunable - 30 */
173 	{ "sctp_addip_enabled", MOD_PROTO_SCTP,
174 	    mod_set_boolean, mod_get_boolean,
175 	    {B_FALSE}, {B_FALSE} },
176 
177 	{ "sctp_recv_hiwat_minmss", MOD_PROTO_SCTP,
178 	    mod_set_uint32, mod_get_uint32,
179 	    {1, 65536, 4}, {4} },
180 
181 	{ "sctp_slow_start_initial", MOD_PROTO_SCTP,
182 	    mod_set_uint32, mod_get_uint32,
183 	    {1, 16, 4}, {4} },
184 
185 	{ "sctp_slow_start_after_idle", MOD_PROTO_SCTP,
186 	    mod_set_uint32, mod_get_uint32,
187 	    {1, 16384, 4}, {4} },
188 
189 	{ "sctp_prsctp_enabled", MOD_PROTO_SCTP,
190 	    mod_set_boolean, mod_get_boolean,
191 	    {B_TRUE}, {B_TRUE} },
192 
193 	{ "sctp_fast_rxt_thresh", MOD_PROTO_SCTP,
194 	    mod_set_uint32, mod_get_uint32,
195 	    {1, 10000, 3}, {3} },
196 
197 	{ "sctp_deferred_acks_max", MOD_PROTO_SCTP,
198 	    mod_set_uint32, mod_get_uint32,
199 	    { 1, 16, 2}, {2} },
200 
201 	/*
202 	 * sctp_wroff_xtra is the extra space in front of SCTP/IP header
203 	 * for link layer header.  It has to be a multiple of 8.
204 	 */
205 	{ "sctp_wroff_xtra", MOD_PROTO_SCTP,
206 	    mod_set_aligned, mod_get_uint32,
207 	    {0, 256, 32}, {32} },
208 
209 	{ "extra_priv_ports", MOD_PROTO_SCTP,
210 	    mod_set_extra_privports, mod_get_extra_privports,
211 	    {1, ULP_MAX_PORT, 0}, {0} },
212 
213 	{ "?", MOD_PROTO_SCTP, NULL, mod_get_allprop, {0}, {0} },
214 
215 	{ NULL, 0, NULL, NULL, {0}, {0} }
216 };
217 
218 int sctp_propinfo_count = A_CNT(sctp_propinfo_tbl);
219