Print this page
3660 tcp_slow_start_* tunables should allow increasing the initial congestion window
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Brendan Gregg <brendan.gregg@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/inet/tcp_impl.h
+++ new/usr/src/uts/common/inet/tcp_impl.h
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
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
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 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 2011, Joyent Inc. All rights reserved.
24 + * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
24 25 */
25 26
26 27 #ifndef _INET_TCP_IMPL_H
27 28 #define _INET_TCP_IMPL_H
28 29
29 30 /*
30 31 * TCP implementation private declarations. These interfaces are
31 32 * used to build the IP module and are not meant to be accessed
32 33 * by any modules except IP itself. They are undocumented and are
33 34 * subject to change without notice.
34 35 */
35 36
36 37 #ifdef __cplusplus
37 38 extern "C" {
38 39 #endif
39 40
40 41 #ifdef _KERNEL
41 42
42 43 #include <sys/cpuvar.h>
43 44 #include <sys/clock_impl.h> /* For LBOLT_FASTPATH{,64} */
44 45 #include <inet/optcom.h>
45 46 #include <inet/tcp.h>
46 47 #include <inet/tunables.h>
47 48
48 49 #define TCP_MOD_ID 5105
49 50
50 51 extern struct qinit tcp_sock_winit;
51 52 extern struct qinit tcp_winit;
52 53
53 54 extern sock_downcalls_t sock_tcp_downcalls;
54 55
55 56 /*
56 57 * Bind hash list size and has function. It has to be a power of 2 for
57 58 * hashing.
58 59 */
59 60 #define TCP_BIND_FANOUT_SIZE 1024
60 61 #define TCP_BIND_HASH(lport) (ntohs(lport) & (TCP_BIND_FANOUT_SIZE - 1))
61 62
62 63 /*
63 64 * This implementation follows the 4.3BSD interpretation of the urgent
64 65 * pointer and not RFC 1122. Switching to RFC 1122 behavior would cause
65 66 * incompatible changes in protocols like telnet and rlogin.
66 67 */
67 68 #define TCP_OLD_URP_INTERPRETATION 1
68 69
69 70 /* TCP option length */
70 71 #define TCPOPT_NOP_LEN 1
71 72 #define TCPOPT_MAXSEG_LEN 4
72 73 #define TCPOPT_WS_LEN 3
73 74 #define TCPOPT_REAL_WS_LEN (TCPOPT_WS_LEN+1)
74 75 #define TCPOPT_TSTAMP_LEN 10
75 76 #define TCPOPT_REAL_TS_LEN (TCPOPT_TSTAMP_LEN+2)
76 77 #define TCPOPT_SACK_OK_LEN 2
77 78 #define TCPOPT_REAL_SACK_OK_LEN (TCPOPT_SACK_OK_LEN+2)
78 79 #define TCPOPT_REAL_SACK_LEN 4
79 80 #define TCPOPT_MAX_SACK_LEN 36
80 81 #define TCPOPT_HEADER_LEN 2
81 82
82 83 /* Round up the value to the nearest mss. */
83 84 #define MSS_ROUNDUP(value, mss) ((((value) - 1) / (mss) + 1) * (mss))
84 85
85 86 /*
86 87 * Was this tcp created via socket() interface?
87 88 */
88 89 #define TCP_IS_SOCKET(tcp) ((tcp)->tcp_issocket)
89 90
90 91 /*
91 92 * Is this tcp not attached to any upper client?
92 93 */
93 94 #define TCP_IS_DETACHED(tcp) ((tcp)->tcp_detached)
94 95
95 96 /* TCP timers related data strucutres. Refer to tcp_timers.c. */
96 97 typedef struct tcp_timer_s {
97 98 conn_t *connp;
98 99 void (*tcpt_proc)(void *);
99 100 callout_id_t tcpt_tid;
100 101 } tcp_timer_t;
101 102
102 103 extern kmem_cache_t *tcp_timercache;
103 104
104 105 /*
105 106 * Macro for starting various timers. Retransmission timer has its own macro,
106 107 * TCP_TIMER_RESTART(). tim is in millisec.
107 108 */
108 109 #define TCP_TIMER(tcp, f, tim) \
109 110 tcp_timeout(tcp->tcp_connp, f, tim)
110 111 #define TCP_TIMER_CANCEL(tcp, id) \
111 112 tcp_timeout_cancel(tcp->tcp_connp, id)
112 113
113 114 /*
114 115 * To restart the TCP retransmission timer. intvl is in millisec.
115 116 */
116 117 #define TCP_TIMER_RESTART(tcp, intvl) { \
117 118 if ((tcp)->tcp_timer_tid != 0) \
118 119 (void) TCP_TIMER_CANCEL((tcp), (tcp)->tcp_timer_tid); \
119 120 (tcp)->tcp_timer_tid = TCP_TIMER((tcp), tcp_timer, (intvl)); \
120 121 }
121 122
122 123 /*
123 124 * For scalability, we must not run a timer for every TCP connection
124 125 * in TIME_WAIT state. To see why, consider (for time wait interval of
125 126 * 1 minutes):
126 127 * 10,000 connections/sec * 60 seconds/time wait = 600,000 active conn's
127 128 *
128 129 * This list is ordered by time, so you need only delete from the head
129 130 * until you get to entries which aren't old enough to delete yet.
130 131 * The list consists of only the detached TIME_WAIT connections.
131 132 *
132 133 * When a tcp_t enters TIME_WAIT state, a timer is started (timeout is
133 134 * tcps_time_wait_interval). When the tcp_t is detached (upper layer closes
134 135 * the end point), it is moved to the time wait list and another timer is
135 136 * started (expiry time is set at tcp_time_wait_expire, which is
136 137 * also calculated using tcps_time_wait_interval). This means that the
137 138 * TIME_WAIT state can be extended (up to doubled) if the tcp_t doesn't
138 139 * become detached for a long time.
139 140 *
140 141 * The list manipulations (including tcp_time_wait_next/prev)
141 142 * are protected by the tcp_time_wait_lock. The content of the
142 143 * detached TIME_WAIT connections is protected by the normal perimeters.
143 144 *
144 145 * This list is per squeue and squeues are shared across the tcp_stack_t's.
145 146 * Things on tcp_time_wait_head remain associated with the tcp_stack_t
146 147 * and conn_netstack.
147 148 * The tcp_t's that are added to tcp_free_list are disassociated and
148 149 * have NULL tcp_tcps and conn_netstack pointers.
149 150 */
150 151 typedef struct tcp_squeue_priv_s {
151 152 kmutex_t tcp_time_wait_lock;
152 153 callout_id_t tcp_time_wait_tid;
153 154 tcp_t *tcp_time_wait_head;
154 155 tcp_t *tcp_time_wait_tail;
155 156 tcp_t *tcp_free_list;
156 157 uint_t tcp_free_list_cnt;
157 158 #ifdef DEBUG
158 159 /*
159 160 * For debugging purpose, true when tcp_time_wait_collector() is
160 161 * running.
161 162 */
162 163 boolean_t tcp_time_wait_running;
163 164 #endif
164 165 } tcp_squeue_priv_t;
165 166
166 167 /*
167 168 * Parameters for TCP Initial Send Sequence number (ISS) generation. When
168 169 * tcp_strong_iss is set to 1, which is the default, the ISS is calculated
169 170 * by adding three components: a time component which grows by 1 every 4096
170 171 * nanoseconds (versus every 4 microseconds suggested by RFC 793, page 27);
171 172 * a per-connection component which grows by 125000 for every new connection;
172 173 * and an "extra" component that grows by a random amount centered
173 174 * approximately on 64000. This causes the ISS generator to cycle every
174 175 * 4.89 hours if no TCP connections are made, and faster if connections are
175 176 * made.
176 177 *
177 178 * When tcp_strong_iss is set to 0, ISS is calculated by adding two
178 179 * components: a time component which grows by 250000 every second; and
179 180 * a per-connection component which grows by 125000 for every new connections.
180 181 *
181 182 * A third method, when tcp_strong_iss is set to 2, for generating ISS is
182 183 * prescribed by Steve Bellovin. This involves adding time, the 125000 per
183 184 * connection, and a one-way hash (MD5) of the connection ID <sport, dport,
184 185 * src, dst>, a "truly" random (per RFC 1750) number, and a console-entered
185 186 * password.
186 187 */
187 188 #define ISS_INCR 250000
188 189 #define ISS_NSEC_SHT 12
189 190
190 191 /* Macros for timestamp comparisons */
191 192 #define TSTMP_GEQ(a, b) ((int32_t)((a)-(b)) >= 0)
↓ open down ↓ |
158 lines elided |
↑ open up ↑ |
192 193 #define TSTMP_LT(a, b) ((int32_t)((a)-(b)) < 0)
193 194
194 195 /*
195 196 * Initialize cwnd according to RFC 3390. def_max_init_cwnd is
196 197 * either tcp_slow_start_initial or tcp_slow_start_after idle
197 198 * depending on the caller. If the upper layer has not used the
198 199 * TCP_INIT_CWND option to change the initial cwnd, tcp_init_cwnd
199 200 * should be 0 and we use the formula in RFC 3390 to set tcp_cwnd.
200 201 * If the upper layer has changed set the tcp_init_cwnd, just use
201 202 * it to calculate the tcp_cwnd.
203 + *
204 + * "An Argument for Increasing TCP's Initial Congestion Window"
205 + * ACM SIGCOMM Computer Communications Review, vol. 40 (2010), pp. 27-33
206 + * -- Nandita Dukkipati, Tiziana Refice, Yuchung Cheng,
207 + * Hsiao-keng Jerry Chu, Tom Herbert, Amit Agarwal,
208 + * Arvind Jain, Natalia Sutin
209 + *
210 + * "Based on the results from our experiments, we believe the
211 + * initial congestion window should be at least ten segments
212 + * and the same be investigated for standardization by the IETF."
213 + *
214 + * As such, the def_max_init_cwnd argument with which this macro is
215 + * invoked is either the tcps_slow_start_initial or
216 + * tcps_slow_start_after_idle which both default to 0 and will respect
217 + * RFC 3390 exactly. If the tunables are explicitly set by the operator,
218 + * then the initial congestion window should be set as the operator
219 + * demands, within reason. We shall arbitrarily define reason as a
220 + * maximum of 16 (same as used by the TCP_INIT_CWND setsockopt).
202 221 */
222 +
223 +/* Maximum TCP initial cwin (start/restart). */
224 +#define TCP_MAX_INIT_CWND 16
225 +
203 226 #define TCP_SET_INIT_CWND(tcp, mss, def_max_init_cwnd) \
204 227 { \
205 228 if ((tcp)->tcp_init_cwnd == 0) { \
206 - (tcp)->tcp_cwnd = MIN(def_max_init_cwnd * (mss), \
207 - MIN(4 * (mss), MAX(2 * (mss), 4380 / (mss) * (mss)))); \
229 + if (def_max_init_cwnd == 0) { \
230 + (tcp)->tcp_cwnd = MIN(4 * (mss), \
231 + MAX(2 * (mss), 4380 / (mss) * (mss))); \
232 + } else { \
233 + (tcp)->tcp_cwnd = MIN(TCP_MAX_INIT_CWND * (mss),\
234 + def_max_init_cwnd * (mss)); \
235 + } \
208 236 } else { \
209 237 (tcp)->tcp_cwnd = (tcp)->tcp_init_cwnd * (mss); \
210 238 } \
211 239 tcp->tcp_cwnd_cnt = 0; \
212 240 }
213 241
214 242 /*
215 243 * Set ECN capable transport (ECT) code point in IP header.
216 244 *
217 245 * Note that there are 2 ECT code points '01' and '10', which are called
218 246 * ECT(1) and ECT(0) respectively. Here we follow the original ECT code
219 247 * point ECT(0) for TCP as described in RFC 2481.
220 248 */
221 249 #define TCP_SET_ECT(tcp, iph) \
222 250 if ((tcp)->tcp_connp->conn_ipversion == IPV4_VERSION) { \
223 251 /* We need to clear the code point first. */ \
224 252 ((ipha_t *)(iph))->ipha_type_of_service &= 0xFC; \
225 253 ((ipha_t *)(iph))->ipha_type_of_service |= IPH_ECN_ECT0; \
226 254 } else { \
227 255 ((ip6_t *)(iph))->ip6_vcf &= htonl(0xFFCFFFFF); \
228 256 ((ip6_t *)(iph))->ip6_vcf |= htonl(IPH_ECN_ECT0 << 20); \
229 257 }
230 258
231 259 /*
232 260 * Set tcp_rto with boundary checking.
233 261 */
234 262 #define TCP_SET_RTO(tcp, rto) \
235 263 if ((rto) < (tcp)->tcp_rto_min) \
236 264 (tcp)->tcp_rto = (tcp)->tcp_rto_min; \
237 265 else if ((rto) > (tcp)->tcp_rto_max) \
238 266 (tcp)->tcp_rto = (tcp)->tcp_rto_max; \
239 267 else \
240 268 (tcp)->tcp_rto = (rto);
241 269
242 270 /*
243 271 * TCP options struct returned from tcp_parse_options.
244 272 */
245 273 typedef struct tcp_opt_s {
246 274 uint32_t tcp_opt_mss;
247 275 uint32_t tcp_opt_wscale;
248 276 uint32_t tcp_opt_ts_val;
249 277 uint32_t tcp_opt_ts_ecr;
250 278 tcp_t *tcp;
251 279 } tcp_opt_t;
252 280
253 281 /*
254 282 * Write-side flow-control is implemented via the per instance STREAMS
255 283 * write-side Q by explicitly setting QFULL to stop the flow of mblk_t(s)
256 284 * and clearing QFULL and calling qbackenable() to restart the flow based
257 285 * on the number of TCP unsent bytes (i.e. those not on the wire waiting
258 286 * for a remote ACK).
259 287 *
260 288 * This is different than a standard STREAMS kmod which when using the
261 289 * STREAMS Q the framework would automatictly flow-control based on the
262 290 * defined hiwat/lowat values as mblk_t's are enqueued/dequeued.
263 291 *
264 292 * As of FireEngine TCP write-side flow-control needs to take into account
265 293 * both the unsent tcp_xmit list bytes but also any squeue_t enqueued bytes
266 294 * (i.e. from tcp_wput() -> tcp_output()).
267 295 *
268 296 * This is accomplished by adding a new tcp_t fields, tcp_squeue_bytes, to
269 297 * count the number of bytes enqueued by tcp_wput() and the number of bytes
270 298 * dequeued and processed by tcp_output().
271 299 *
272 300 * So, the total number of bytes unsent is (squeue_bytes + unsent) with all
273 301 * flow-control uses of unsent replaced with the macro TCP_UNSENT_BYTES.
274 302 */
275 303 extern void tcp_clrqfull(tcp_t *);
276 304 extern void tcp_setqfull(tcp_t *);
277 305
278 306 #define TCP_UNSENT_BYTES(tcp) \
279 307 ((tcp)->tcp_squeue_bytes + (tcp)->tcp_unsent)
280 308
281 309 /*
282 310 * Linked list struct to store listener connection limit configuration per
283 311 * IP stack. The list is stored at tcps_listener_conf in tcp_stack_t.
284 312 *
285 313 * tl_port: the listener port of this limit configuration
286 314 * tl_ratio: the maximum amount of memory consumed by all concurrent TCP
287 315 * connections created by a listener does not exceed 1/tl_ratio
288 316 * of the total system memory. Note that this is only an
289 317 * approximation.
290 318 * tl_link: linked list struct
291 319 */
292 320 typedef struct tcp_listener_s {
293 321 in_port_t tl_port;
294 322 uint32_t tl_ratio;
295 323 list_node_t tl_link;
296 324 } tcp_listener_t;
297 325
298 326 /*
299 327 * If there is a limit set on the number of connections allowed per each
300 328 * listener, the following struct is used to store that counter. It keeps
301 329 * the number of TCP connection created by a listener. Note that this needs
302 330 * to be separated from the listener since the listener can go away before
303 331 * all the connections are gone.
304 332 *
305 333 * When the struct is allocated, tlc_cnt is set to 1. When a new connection
306 334 * is created by the listener, tlc_cnt is incremented by 1. When a connection
307 335 * created by the listener goes away, tlc_count is decremented by 1. When the
308 336 * listener itself goes away, tlc_cnt is decremented by one. The last
309 337 * connection (or the listener) which decrements tlc_cnt to zero frees the
310 338 * struct.
311 339 *
312 340 * tlc_max is the maximum number of concurrent TCP connections created from a
313 341 * listner. It is calculated when the tcp_listen_cnt_t is allocated.
314 342 *
315 343 * tlc_report_time stores the time when cmn_err() is called to report that the
316 344 * max has been exceeeded. Report is done at most once every
317 345 * TCP_TLC_REPORT_INTERVAL mins for a listener.
318 346 *
319 347 * tlc_drop stores the number of connection attempt dropped because the
320 348 * limit has reached.
321 349 */
322 350 typedef struct tcp_listen_cnt_s {
323 351 uint32_t tlc_max;
324 352 uint32_t tlc_cnt;
325 353 int64_t tlc_report_time;
326 354 uint32_t tlc_drop;
327 355 } tcp_listen_cnt_t;
328 356
329 357 #define TCP_TLC_REPORT_INTERVAL (30 * MINUTES)
330 358
331 359 #define TCP_DECR_LISTEN_CNT(tcp) \
332 360 { \
333 361 ASSERT((tcp)->tcp_listen_cnt->tlc_cnt > 0); \
334 362 if (atomic_add_32_nv(&(tcp)->tcp_listen_cnt->tlc_cnt, -1) == 0) \
335 363 kmem_free((tcp)->tcp_listen_cnt, sizeof (tcp_listen_cnt_t)); \
336 364 (tcp)->tcp_listen_cnt = NULL; \
337 365 }
338 366
339 367 /* Increment and decrement the number of connections in tcp_stack_t. */
340 368 #define TCPS_CONN_INC(tcps) \
341 369 atomic_inc_64( \
342 370 (uint64_t *)&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_conn_cnt)
343 371
344 372 #define TCPS_CONN_DEC(tcps) \
345 373 atomic_dec_64( \
346 374 (uint64_t *)&(tcps)->tcps_sc[CPU->cpu_seqid]->tcp_sc_conn_cnt)
347 375
348 376 /*
349 377 * When the system is under memory pressure, stack variable tcps_reclaim is
350 378 * true, we shorten the connection timeout abort interval to tcp_early_abort
351 379 * seconds. Defined in tcp.c.
352 380 */
353 381 extern uint32_t tcp_early_abort;
354 382
355 383 /*
356 384 * To reach to an eager in Q0 which can be dropped due to an incoming
357 385 * new SYN request when Q0 is full, a new doubly linked list is
358 386 * introduced. This list allows to select an eager from Q0 in O(1) time.
359 387 * This is needed to avoid spending too much time walking through the
360 388 * long list of eagers in Q0 when tcp_drop_q0() is called. Each member of
361 389 * this new list has to be a member of Q0.
362 390 * This list is headed by listener's tcp_t. When the list is empty,
363 391 * both the pointers - tcp_eager_next_drop_q0 and tcp_eager_prev_drop_q0,
364 392 * of listener's tcp_t point to listener's tcp_t itself.
365 393 *
366 394 * Given an eager in Q0 and a listener, MAKE_DROPPABLE() puts the eager
367 395 * in the list. MAKE_UNDROPPABLE() takes the eager out of the list.
368 396 * These macros do not affect the eager's membership to Q0.
369 397 */
370 398 #define MAKE_DROPPABLE(listener, eager) \
371 399 if ((eager)->tcp_eager_next_drop_q0 == NULL) { \
372 400 (listener)->tcp_eager_next_drop_q0->tcp_eager_prev_drop_q0\
373 401 = (eager); \
374 402 (eager)->tcp_eager_prev_drop_q0 = (listener); \
375 403 (eager)->tcp_eager_next_drop_q0 = \
376 404 (listener)->tcp_eager_next_drop_q0; \
377 405 (listener)->tcp_eager_next_drop_q0 = (eager); \
378 406 }
379 407
380 408 #define MAKE_UNDROPPABLE(eager) \
381 409 if ((eager)->tcp_eager_next_drop_q0 != NULL) { \
382 410 (eager)->tcp_eager_next_drop_q0->tcp_eager_prev_drop_q0 \
383 411 = (eager)->tcp_eager_prev_drop_q0; \
384 412 (eager)->tcp_eager_prev_drop_q0->tcp_eager_next_drop_q0 \
385 413 = (eager)->tcp_eager_next_drop_q0; \
386 414 (eager)->tcp_eager_prev_drop_q0 = NULL; \
387 415 (eager)->tcp_eager_next_drop_q0 = NULL; \
388 416 }
389 417
390 418 /*
391 419 * The format argument to pass to tcp_display().
392 420 * DISP_PORT_ONLY means that the returned string has only port info.
393 421 * DISP_ADDR_AND_PORT means that the returned string also contains the
394 422 * remote and local IP address.
395 423 */
396 424 #define DISP_PORT_ONLY 1
397 425 #define DISP_ADDR_AND_PORT 2
398 426
399 427 #define IP_ADDR_CACHE_SIZE 2048
400 428 #define IP_ADDR_CACHE_HASH(faddr) \
401 429 (ntohl(faddr) & (IP_ADDR_CACHE_SIZE -1))
402 430
403 431 /* TCP cwnd burst factor. */
404 432 #define TCP_CWND_INFINITE 65535
405 433 #define TCP_CWND_SS 3
406 434 #define TCP_CWND_NORMAL 5
407 435
408 436 /*
409 437 * TCP reassembly macros. We hide starting and ending sequence numbers in
410 438 * b_next and b_prev of messages on the reassembly queue. The messages are
411 439 * chained using b_cont. These macros are used in tcp_reass() so we don't
412 440 * have to see the ugly casts and assignments.
413 441 */
414 442 #define TCP_REASS_SEQ(mp) ((uint32_t)(uintptr_t)((mp)->b_next))
415 443 #define TCP_REASS_SET_SEQ(mp, u) ((mp)->b_next = \
416 444 (mblk_t *)(uintptr_t)(u))
417 445 #define TCP_REASS_END(mp) ((uint32_t)(uintptr_t)((mp)->b_prev))
418 446 #define TCP_REASS_SET_END(mp, u) ((mp)->b_prev = \
419 447 (mblk_t *)(uintptr_t)(u))
420 448
421 449 #define tcps_time_wait_interval tcps_propinfo_tbl[0].prop_cur_uval
422 450 #define tcps_conn_req_max_q tcps_propinfo_tbl[1].prop_cur_uval
423 451 #define tcps_conn_req_max_q0 tcps_propinfo_tbl[2].prop_cur_uval
424 452 #define tcps_conn_req_min tcps_propinfo_tbl[3].prop_cur_uval
425 453 #define tcps_conn_grace_period tcps_propinfo_tbl[4].prop_cur_uval
426 454 #define tcps_cwnd_max_ tcps_propinfo_tbl[5].prop_cur_uval
427 455 #define tcps_dbg tcps_propinfo_tbl[6].prop_cur_uval
428 456 #define tcps_smallest_nonpriv_port tcps_propinfo_tbl[7].prop_cur_uval
429 457 #define tcps_ip_abort_cinterval tcps_propinfo_tbl[8].prop_cur_uval
430 458 #define tcps_ip_abort_linterval tcps_propinfo_tbl[9].prop_cur_uval
431 459 #define tcps_ip_abort_interval tcps_propinfo_tbl[10].prop_cur_uval
432 460 #define tcps_ip_notify_cinterval tcps_propinfo_tbl[11].prop_cur_uval
433 461 #define tcps_ip_notify_interval tcps_propinfo_tbl[12].prop_cur_uval
434 462 #define tcps_ipv4_ttl tcps_propinfo_tbl[13].prop_cur_uval
435 463 #define tcps_keepalive_interval_high tcps_propinfo_tbl[14].prop_max_uval
436 464 #define tcps_keepalive_interval tcps_propinfo_tbl[14].prop_cur_uval
437 465 #define tcps_keepalive_interval_low tcps_propinfo_tbl[14].prop_min_uval
438 466 #define tcps_maxpsz_multiplier tcps_propinfo_tbl[15].prop_cur_uval
439 467 #define tcps_mss_def_ipv4 tcps_propinfo_tbl[16].prop_cur_uval
440 468 #define tcps_mss_max_ipv4 tcps_propinfo_tbl[17].prop_cur_uval
441 469 #define tcps_mss_min tcps_propinfo_tbl[18].prop_cur_uval
442 470 #define tcps_naglim_def tcps_propinfo_tbl[19].prop_cur_uval
443 471 #define tcps_rexmit_interval_initial_high \
444 472 tcps_propinfo_tbl[20].prop_max_uval
445 473 #define tcps_rexmit_interval_initial tcps_propinfo_tbl[20].prop_cur_uval
446 474 #define tcps_rexmit_interval_initial_low \
447 475 tcps_propinfo_tbl[20].prop_min_uval
448 476 #define tcps_rexmit_interval_max_high tcps_propinfo_tbl[21].prop_max_uval
449 477 #define tcps_rexmit_interval_max tcps_propinfo_tbl[21].prop_cur_uval
450 478 #define tcps_rexmit_interval_max_low tcps_propinfo_tbl[21].prop_min_uval
451 479 #define tcps_rexmit_interval_min_high tcps_propinfo_tbl[22].prop_max_uval
452 480 #define tcps_rexmit_interval_min tcps_propinfo_tbl[22].prop_cur_uval
453 481 #define tcps_rexmit_interval_min_low tcps_propinfo_tbl[22].prop_min_uval
454 482 #define tcps_deferred_ack_interval tcps_propinfo_tbl[23].prop_cur_uval
455 483 #define tcps_snd_lowat_fraction tcps_propinfo_tbl[24].prop_cur_uval
456 484 #define tcps_dupack_fast_retransmit tcps_propinfo_tbl[25].prop_cur_uval
457 485 #define tcps_ignore_path_mtu tcps_propinfo_tbl[26].prop_cur_bval
458 486 #define tcps_smallest_anon_port tcps_propinfo_tbl[27].prop_cur_uval
459 487 #define tcps_largest_anon_port tcps_propinfo_tbl[28].prop_cur_uval
460 488 #define tcps_xmit_hiwat tcps_propinfo_tbl[29].prop_cur_uval
461 489 #define tcps_xmit_lowat tcps_propinfo_tbl[30].prop_cur_uval
462 490 #define tcps_recv_hiwat tcps_propinfo_tbl[31].prop_cur_uval
463 491 #define tcps_recv_hiwat_minmss tcps_propinfo_tbl[32].prop_cur_uval
464 492 #define tcps_fin_wait_2_flush_interval_high \
465 493 tcps_propinfo_tbl[33].prop_max_uval
466 494 #define tcps_fin_wait_2_flush_interval tcps_propinfo_tbl[33].prop_cur_uval
467 495 #define tcps_fin_wait_2_flush_interval_low \
468 496 tcps_propinfo_tbl[33].prop_min_uval
469 497 #define tcps_max_buf tcps_propinfo_tbl[34].prop_cur_uval
470 498 #define tcps_strong_iss tcps_propinfo_tbl[35].prop_cur_uval
471 499 #define tcps_rtt_updates tcps_propinfo_tbl[36].prop_cur_uval
472 500 #define tcps_wscale_always tcps_propinfo_tbl[37].prop_cur_bval
473 501 #define tcps_tstamp_always tcps_propinfo_tbl[38].prop_cur_bval
474 502 #define tcps_tstamp_if_wscale tcps_propinfo_tbl[39].prop_cur_bval
475 503 #define tcps_rexmit_interval_extra tcps_propinfo_tbl[40].prop_cur_uval
476 504 #define tcps_deferred_acks_max tcps_propinfo_tbl[41].prop_cur_uval
477 505 #define tcps_slow_start_after_idle tcps_propinfo_tbl[42].prop_cur_uval
478 506 #define tcps_slow_start_initial tcps_propinfo_tbl[43].prop_cur_uval
479 507 #define tcps_sack_permitted tcps_propinfo_tbl[44].prop_cur_uval
480 508 #define tcps_ipv6_hoplimit tcps_propinfo_tbl[45].prop_cur_uval
481 509 #define tcps_mss_def_ipv6 tcps_propinfo_tbl[46].prop_cur_uval
482 510 #define tcps_mss_max_ipv6 tcps_propinfo_tbl[47].prop_cur_uval
483 511 #define tcps_rev_src_routes tcps_propinfo_tbl[48].prop_cur_bval
484 512 #define tcps_local_dack_interval tcps_propinfo_tbl[49].prop_cur_uval
485 513 #define tcps_local_dacks_max tcps_propinfo_tbl[50].prop_cur_uval
486 514 #define tcps_ecn_permitted tcps_propinfo_tbl[51].prop_cur_uval
487 515 #define tcps_rst_sent_rate_enabled tcps_propinfo_tbl[52].prop_cur_bval
488 516 #define tcps_rst_sent_rate tcps_propinfo_tbl[53].prop_cur_uval
489 517 #define tcps_push_timer_interval tcps_propinfo_tbl[54].prop_cur_uval
490 518 #define tcps_use_smss_as_mss_opt tcps_propinfo_tbl[55].prop_cur_bval
491 519 #define tcps_keepalive_abort_interval_high \
492 520 tcps_propinfo_tbl[56].prop_max_uval
493 521 #define tcps_keepalive_abort_interval \
494 522 tcps_propinfo_tbl[56].prop_cur_uval
495 523 #define tcps_keepalive_abort_interval_low \
496 524 tcps_propinfo_tbl[56].prop_min_uval
497 525 #define tcps_wroff_xtra tcps_propinfo_tbl[57].prop_cur_uval
498 526 #define tcps_dev_flow_ctl tcps_propinfo_tbl[58].prop_cur_bval
499 527 #define tcps_reass_timeout tcps_propinfo_tbl[59].prop_cur_uval
500 528 #define tcps_iss_incr tcps_propinfo_tbl[65].prop_cur_uval
501 529
502 530 extern struct qinit tcp_rinitv4, tcp_rinitv6;
503 531 extern boolean_t do_tcp_fusion;
504 532
505 533 /*
506 534 * Object to represent database of options to search passed to
507 535 * {sock,tpi}optcom_req() interface routine to take care of option
508 536 * management and associated methods.
509 537 */
510 538 extern optdb_obj_t tcp_opt_obj;
511 539 extern uint_t tcp_max_optsize;
512 540
513 541 extern int tcp_squeue_flag;
514 542
515 543 extern uint_t tcp_free_list_max_cnt;
516 544
517 545 /*
518 546 * Functions in tcp.c.
519 547 */
520 548 extern void tcp_acceptor_hash_insert(t_uscalar_t, tcp_t *);
521 549 extern tcp_t *tcp_acceptor_hash_lookup(t_uscalar_t, tcp_stack_t *);
522 550 extern void tcp_acceptor_hash_remove(tcp_t *);
523 551 extern mblk_t *tcp_ack_mp(tcp_t *);
524 552 extern int tcp_build_hdrs(tcp_t *);
525 553 extern void tcp_cleanup(tcp_t *);
526 554 extern int tcp_clean_death(tcp_t *, int);
527 555 extern void tcp_clean_death_wrapper(void *, mblk_t *, void *,
528 556 ip_recv_attr_t *);
529 557 extern void tcp_close_common(conn_t *, int);
530 558 extern void tcp_close_detached(tcp_t *);
531 559 extern void tcp_close_mpp(mblk_t **);
532 560 extern void tcp_closei_local(tcp_t *);
533 561 extern sock_lower_handle_t tcp_create(int, int, int, sock_downcalls_t **,
534 562 uint_t *, int *, int, cred_t *);
535 563 extern conn_t *tcp_create_common(cred_t *, boolean_t, boolean_t, int *);
536 564 extern void tcp_disconnect(tcp_t *, mblk_t *);
537 565 extern char *tcp_display(tcp_t *, char *, char);
538 566 extern int tcp_do_bind(conn_t *, struct sockaddr *, socklen_t, cred_t *,
539 567 boolean_t);
540 568 extern int tcp_do_connect(conn_t *, const struct sockaddr *, socklen_t,
541 569 cred_t *, pid_t);
542 570 extern int tcp_do_listen(conn_t *, struct sockaddr *, socklen_t, int,
543 571 cred_t *, boolean_t);
544 572 extern int tcp_do_unbind(conn_t *);
545 573 extern boolean_t tcp_eager_blowoff(tcp_t *, t_scalar_t);
546 574 extern void tcp_eager_cleanup(tcp_t *, boolean_t);
547 575 extern void tcp_eager_kill(void *, mblk_t *, void *, ip_recv_attr_t *);
548 576 extern void tcp_eager_unlink(tcp_t *);
549 577 extern void tcp_init_values(tcp_t *, tcp_t *);
550 578 extern void tcp_ipsec_cleanup(tcp_t *);
551 579 extern int tcp_maxpsz_set(tcp_t *, boolean_t);
552 580 extern void tcp_mss_set(tcp_t *, uint32_t);
553 581 extern void tcp_reinput(conn_t *, mblk_t *, ip_recv_attr_t *, ip_stack_t *);
554 582 extern void tcp_rsrv(queue_t *);
555 583 extern uint_t tcp_rwnd_reopen(tcp_t *);
556 584 extern int tcp_rwnd_set(tcp_t *, uint32_t);
557 585 extern int tcp_set_destination(tcp_t *);
558 586 extern void tcp_set_ws_value(tcp_t *);
559 587 extern void tcp_stop_lingering(tcp_t *);
560 588 extern void tcp_update_pmtu(tcp_t *, boolean_t);
561 589 extern mblk_t *tcp_zcopy_backoff(tcp_t *, mblk_t *, boolean_t);
562 590 extern boolean_t tcp_zcopy_check(tcp_t *);
563 591 extern void tcp_zcopy_notify(tcp_t *);
564 592 extern void tcp_get_proto_props(tcp_t *, struct sock_proto_props *);
565 593
566 594 /*
567 595 * Bind related functions in tcp_bind.c
568 596 */
569 597 extern int tcp_bind_check(conn_t *, struct sockaddr *, socklen_t,
570 598 cred_t *, boolean_t);
571 599 extern void tcp_bind_hash_insert(tf_t *, tcp_t *, int);
572 600 extern void tcp_bind_hash_remove(tcp_t *);
573 601 extern in_port_t tcp_bindi(tcp_t *, in_port_t, const in6_addr_t *,
574 602 int, boolean_t, boolean_t, boolean_t);
575 603 extern in_port_t tcp_update_next_port(in_port_t, const tcp_t *,
576 604 boolean_t);
577 605
578 606 /*
579 607 * Fusion related functions in tcp_fusion.c.
580 608 */
581 609 extern void tcp_fuse(tcp_t *, uchar_t *, tcpha_t *);
582 610 extern void tcp_unfuse(tcp_t *);
583 611 extern boolean_t tcp_fuse_output(tcp_t *, mblk_t *, uint32_t);
584 612 extern void tcp_fuse_output_urg(tcp_t *, mblk_t *);
585 613 extern boolean_t tcp_fuse_rcv_drain(queue_t *, tcp_t *, mblk_t **);
586 614 extern size_t tcp_fuse_set_rcv_hiwat(tcp_t *, size_t);
587 615 extern int tcp_fuse_maxpsz(tcp_t *);
588 616 extern void tcp_fuse_backenable(tcp_t *);
589 617 extern void tcp_iss_key_init(uint8_t *, int, tcp_stack_t *);
590 618
591 619 /*
592 620 * Output related functions in tcp_output.c.
593 621 */
594 622 extern void tcp_close_output(void *, mblk_t *, void *, ip_recv_attr_t *);
595 623 extern void tcp_output(void *, mblk_t *, void *, ip_recv_attr_t *);
596 624 extern void tcp_output_urgent(void *, mblk_t *, void *, ip_recv_attr_t *);
597 625 extern void tcp_rexmit_after_error(tcp_t *);
598 626 extern void tcp_sack_rexmit(tcp_t *, uint_t *);
599 627 extern void tcp_send_data(tcp_t *, mblk_t *);
600 628 extern void tcp_send_synack(void *, mblk_t *, void *, ip_recv_attr_t *);
601 629 extern void tcp_shutdown_output(void *, mblk_t *, void *, ip_recv_attr_t *);
602 630 extern void tcp_ss_rexmit(tcp_t *);
603 631 extern void tcp_update_xmit_tail(tcp_t *, uint32_t);
604 632 extern void tcp_wput(queue_t *, mblk_t *);
605 633 extern void tcp_wput_data(tcp_t *, mblk_t *, boolean_t);
606 634 extern void tcp_wput_sock(queue_t *, mblk_t *);
607 635 extern void tcp_wput_fallback(queue_t *, mblk_t *);
608 636 extern void tcp_xmit_ctl(char *, tcp_t *, uint32_t, uint32_t, int);
609 637 extern void tcp_xmit_listeners_reset(mblk_t *, ip_recv_attr_t *,
610 638 ip_stack_t *i, conn_t *);
611 639 extern mblk_t *tcp_xmit_mp(tcp_t *, mblk_t *, int32_t, int32_t *,
612 640 mblk_t **, uint32_t, boolean_t, uint32_t *, boolean_t);
613 641
614 642 /*
615 643 * Input related functions in tcp_input.c.
616 644 */
617 645 extern void tcp_icmp_input(void *, mblk_t *, void *, ip_recv_attr_t *);
618 646 extern void tcp_input_data(void *, mblk_t *, void *, ip_recv_attr_t *);
619 647 extern void tcp_input_listener_unbound(void *, mblk_t *, void *,
620 648 ip_recv_attr_t *);
621 649 extern boolean_t tcp_paws_check(tcp_t *, tcpha_t *, tcp_opt_t *);
622 650 extern uint_t tcp_rcv_drain(tcp_t *);
623 651 extern void tcp_rcv_enqueue(tcp_t *, mblk_t *, uint_t, cred_t *);
624 652 extern boolean_t tcp_verifyicmp(conn_t *, void *, icmph_t *, icmp6_t *,
625 653 ip_recv_attr_t *);
626 654
627 655 /*
628 656 * Kernel socket related functions in tcp_socket.c.
629 657 */
630 658 extern int tcp_fallback(sock_lower_handle_t, queue_t *, boolean_t,
631 659 so_proto_quiesced_cb_t, sock_quiesce_arg_t *);
632 660 extern boolean_t tcp_newconn_notify(tcp_t *, ip_recv_attr_t *);
633 661
634 662 /*
635 663 * Timer related functions in tcp_timers.c.
636 664 */
637 665 extern void tcp_ack_timer(void *);
638 666 extern void tcp_close_linger_timeout(void *);
639 667 extern void tcp_keepalive_timer(void *);
640 668 extern void tcp_push_timer(void *);
641 669 extern void tcp_reass_timer(void *);
642 670 extern mblk_t *tcp_timermp_alloc(int);
643 671 extern void tcp_timermp_free(tcp_t *);
644 672 extern timeout_id_t tcp_timeout(conn_t *, void (*)(void *), hrtime_t);
645 673 extern clock_t tcp_timeout_cancel(conn_t *, timeout_id_t);
646 674 extern void tcp_timer(void *arg);
647 675 extern void tcp_timers_stop(tcp_t *);
648 676
649 677 /*
650 678 * TCP TPI related functions in tcp_tpi.c.
651 679 */
652 680 extern void tcp_addr_req(tcp_t *, mblk_t *);
653 681 extern void tcp_capability_req(tcp_t *, mblk_t *);
654 682 extern boolean_t tcp_conn_con(tcp_t *, uchar_t *, mblk_t *,
655 683 mblk_t **, ip_recv_attr_t *);
656 684 extern void tcp_err_ack(tcp_t *, mblk_t *, int, int);
657 685 extern void tcp_err_ack_prim(tcp_t *, mblk_t *, int, int, int);
658 686 extern void tcp_info_req(tcp_t *, mblk_t *);
659 687 extern void tcp_send_conn_ind(void *, mblk_t *, void *);
660 688 extern void tcp_send_pending(void *, mblk_t *, void *, ip_recv_attr_t *);
661 689 extern void tcp_tpi_accept(queue_t *, mblk_t *);
662 690 extern void tcp_tpi_bind(tcp_t *, mblk_t *);
663 691 extern int tcp_tpi_close(queue_t *, int);
664 692 extern int tcp_tpi_close_accept(queue_t *);
665 693 extern void tcp_tpi_connect(tcp_t *, mblk_t *);
666 694 extern int tcp_tpi_opt_get(queue_t *, t_scalar_t, t_scalar_t, uchar_t *);
667 695 extern int tcp_tpi_opt_set(queue_t *, uint_t, int, int, uint_t, uchar_t *,
668 696 uint_t *, uchar_t *, void *, cred_t *);
669 697 extern void tcp_tpi_unbind(tcp_t *, mblk_t *);
670 698 extern void tcp_tli_accept(tcp_t *, mblk_t *);
671 699 extern void tcp_use_pure_tpi(tcp_t *);
672 700 extern void tcp_do_capability_ack(tcp_t *, struct T_capability_ack *,
673 701 t_uscalar_t);
674 702
675 703 /*
676 704 * TCP option processing related functions in tcp_opt_data.c
677 705 */
678 706 extern int tcp_opt_get(conn_t *, int, int, uchar_t *);
679 707 extern int tcp_opt_set(conn_t *, uint_t, int, int, uint_t, uchar_t *,
680 708 uint_t *, uchar_t *, void *, cred_t *);
681 709
682 710 /*
683 711 * TCP time wait processing related functions in tcp_time_wait.c.
684 712 */
685 713 extern void tcp_time_wait_append(tcp_t *);
686 714 extern void tcp_time_wait_collector(void *);
687 715 extern boolean_t tcp_time_wait_remove(tcp_t *, tcp_squeue_priv_t *);
688 716 extern void tcp_time_wait_processing(tcp_t *, mblk_t *, uint32_t,
689 717 uint32_t, int, tcpha_t *, ip_recv_attr_t *);
690 718
691 719 /*
692 720 * Misc functions in tcp_misc.c.
693 721 */
694 722 extern uint32_t tcp_find_listener_conf(tcp_stack_t *, in_port_t);
695 723 extern void tcp_ioctl_abort_conn(queue_t *, mblk_t *);
696 724 extern void tcp_listener_conf_cleanup(tcp_stack_t *);
697 725 extern void tcp_stack_cpu_add(tcp_stack_t *, processorid_t);
698 726
699 727 #endif /* _KERNEL */
700 728
701 729 #ifdef __cplusplus
702 730 }
703 731 #endif
704 732
705 733 #endif /* _INET_TCP_IMPL_H */
↓ open down ↓ |
488 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX