Print this page
DLPX-25998 TCP congestion control is inadequate
Reviewed at: http://reviews.delphix.com/r/34808/
DLPX-45697 Adding Avg. RTT to connstat
DLPX-43064 include high-resolution round-trip times in connstat (EP-652)
DLPX-37540 TCP per-connection kernel statistics DLPX-37544 connstat command to display per-connection TCP statistics


   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 (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2015 Joyent, Inc.
  24  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright (c) 2014 by Delphix. All rights reserved.
  26  */
  27 /* Copyright (c) 1990 Mentat Inc. */
  28 
  29 #ifndef _INET_TCP_H
  30 #define _INET_TCP_H
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #include <sys/inttypes.h>
  37 #include <netinet/ip6.h>
  38 #include <netinet/tcp.h>
  39 #include <sys/socket.h>
  40 #include <sys/socket_proto.h>
  41 #include <sys/md5.h>
  42 #include <inet/common.h>
  43 #include <inet/ip.h>
  44 #include <inet/ip6.h>
  45 #include <inet/mi.h>
  46 #include <inet/mib2.h>
  47 #include <inet/tcp_stack.h>
  48 #include <inet/tcp_sack.h>

  49 
  50 /* TCP states */
  51 #define TCPS_CLOSED             -6
  52 #define TCPS_IDLE               -5      /* idle (opened, but not bound) */
  53 #define TCPS_BOUND              -4      /* bound, ready to connect or accept */
  54 #define TCPS_LISTEN             -3      /* listening for connection */
  55 #define TCPS_SYN_SENT           -2      /* active, have sent syn */
  56 #define TCPS_SYN_RCVD           -1      /* have received syn (and sent ours) */
  57 /* states < TCPS_ESTABLISHED are those where connections not established */
  58 #define TCPS_ESTABLISHED        0       /* established */
  59 #define TCPS_CLOSE_WAIT         1       /* rcvd fin, waiting for close */
  60 /* states > TCPS_CLOSE_WAIT are those where user has closed */
  61 #define TCPS_FIN_WAIT_1         2       /* have closed and sent fin */
  62 #define TCPS_CLOSING            3       /* closed, xchd FIN, await FIN ACK */
  63 #define TCPS_LAST_ACK           4       /* had fin and close; await FIN ACK */
  64 /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
  65 #define TCPS_FIN_WAIT_2         5       /* have closed, fin is acked */
  66 #define TCPS_TIME_WAIT          6       /* in 2*msl quiet wait after close */
  67 
  68 /*


 136 struct tcp_listen_cnt_s;
 137 struct tcp_rg_s;
 138 
 139 /*
 140  * Control structure for each open TCP stream,
 141  * defined only within the kernel or for a kmem user.
 142  * NOTE: tcp_reinit_values MUST have a line for each field in this structure!
 143  */
 144 #if (defined(_KERNEL) || defined(_KMEMUSER))
 145 
 146 typedef struct tcp_s {
 147         struct tcp_s    *tcp_time_wait_next;
 148                                 /* Pointer to next T/W block */
 149         struct tcp_s    *tcp_time_wait_prev;
 150                                 /* Pointer to previous T/W next */
 151         int64_t         tcp_time_wait_expire;
 152 
 153         struct conn_s   *tcp_connp;     /* back pointer to conn_t */
 154         tcp_stack_t     *tcp_tcps;      /* back pointer to tcp_stack_t */
 155 



 156         int32_t tcp_state;
 157         int32_t tcp_rcv_ws;             /* My window scale power */
 158         int32_t tcp_snd_ws;             /* Sender's window scale power */
 159         uint32_t tcp_ts_recent;         /* Timestamp of earliest unacked */
 160                                         /*  data segment */
 161         clock_t tcp_rto;                /* Round trip timeout */
 162         int64_t tcp_last_rcv_lbolt;
 163                                 /* lbolt on last packet, used for PAWS */
 164         uint32_t tcp_rto_initial;       /* Initial RTO */
 165         uint32_t tcp_rto_min;           /* Minimum RTO */
 166         uint32_t tcp_rto_max;           /* Maximum RTO */
 167 
 168         uint32_t tcp_snxt;              /* Senders next seq num */
 169         uint32_t tcp_swnd;              /* Senders window (relative to suna) */
 170         uint32_t tcp_mss;               /* Max segment size */
 171         uint32_t tcp_iss;               /* Initial send seq num */
 172         uint32_t tcp_rnxt;              /* Seq we expect to recv next */
 173         uint32_t tcp_rwnd;
 174 
 175         /* Fields arranged in approximate access order along main paths */
 176         mblk_t  *tcp_xmit_head;         /* Head of xmit/rexmit list */
 177         mblk_t  *tcp_xmit_last;         /* Last valid data seen by tcp_wput */
 178         mblk_t  *tcp_xmit_tail;         /* Last data sent */
 179         uint32_t tcp_unsent;            /* # of bytes in hand that are unsent */
 180         uint32_t tcp_xmit_tail_unsent;  /* # of unsent bytes in xmit_tail */
 181 
 182         uint32_t tcp_suna;              /* Sender unacknowledged */
 183         uint32_t tcp_rexmit_nxt;        /* Next rexmit seq num */
 184         uint32_t tcp_rexmit_max;        /* Max retran seq num */
 185         uint32_t tcp_cwnd;              /* Congestion window */
 186         int32_t tcp_cwnd_cnt;           /* cwnd cnt in congestion avoidance */
 187 
 188         uint32_t tcp_ibsegs;            /* Inbound segments on this stream */
 189         uint32_t tcp_obsegs;            /* Outbound segments on this stream */
 190 
 191         uint32_t tcp_naglim;            /* Tunable nagle limit */
 192         uint32_t        tcp_valid_bits;
 193 #define TCP_ISS_VALID   0x1     /* Is the tcp_iss seq num active? */
 194 #define TCP_FSS_VALID   0x2     /* Is the tcp_fss seq num active? */
 195 #define TCP_URG_VALID   0x4     /* Is the tcp_urg seq num active? */
 196 #define TCP_OFO_FIN_VALID 0x8   /* Has TCP received an out of order FIN? */
 197 
 198 
 199 
 200         timeout_id_t    tcp_timer_tid;  /* Control block for timer service */
 201         uchar_t tcp_timer_backoff;      /* Backoff shift count. */
 202         int64_t tcp_last_recv_time;     /* Last time we receive a segment. */
 203         uint32_t tcp_init_cwnd;         /* Initial cwnd (start/restart) */
 204 
 205         /* Following manipulated by TCP under squeue protection */
 206         uint32_t
 207                 tcp_urp_last_valid : 1, /* Is tcp_urp_last valid? */
 208                 tcp_hard_binding : 1,   /* TCP_DETACHED_NONEAGER */
 209                 tcp_fin_acked : 1,      /* Has our FIN been acked? */
 210                 tcp_fin_rcvd : 1,       /* Have we seen a FIN? */
 211 
 212                 tcp_fin_sent : 1,       /* Have we sent our FIN yet? */
 213                 tcp_ordrel_done : 1,    /* Have we sent the ord_rel upstream? */
 214                 tcp_detached : 1,       /* If we're detached from a stream */
 215                 tcp_zero_win_probe: 1,  /* Zero win probing is in progress */
 216 
 217                 tcp_loopback: 1,        /* src and dst are the same machine */
 218                 tcp_localnet: 1,        /* src and dst are on the same subnet */
 219                 tcp_syn_defense: 1,     /* For defense against SYN attack */


 266 
 267 #define tcp_pipe                tcp_sack_info.tcp_pipe
 268 #define tcp_fack                tcp_sack_info.tcp_fack
 269 #define tcp_sack_snxt           tcp_sack_info.tcp_sack_snxt
 270 #define tcp_max_sack_blk        tcp_sack_info.tcp_max_sack_blk
 271 #define tcp_num_sack_blk        tcp_sack_info.tcp_num_sack_blk
 272 #define tcp_sack_list           tcp_sack_info.tcp_sack_list
 273 #define tcp_num_notsack_blk     tcp_sack_info.tcp_num_notsack_blk
 274 #define tcp_cnt_notsack_list    tcp_sack_info.tcp_cnt_notsack_list
 275 #define tcp_notsack_list        tcp_sack_info.tcp_notsack_list
 276 
 277         mblk_t  *tcp_rcv_list;          /* Queued until push, urgent data, */
 278         mblk_t  *tcp_rcv_last_head;     /* optdata, or the count exceeds */
 279         mblk_t  *tcp_rcv_last_tail;     /* tcp_rcv_push_wait. */
 280         uint32_t tcp_rcv_cnt;           /* tcp_rcv_list is b_next chain. */
 281 
 282         uint32_t tcp_cwnd_ssthresh;     /* Congestion window */
 283         uint32_t tcp_cwnd_max;
 284         uint32_t tcp_csuna;             /* Clear (no rexmits in window) suna */
 285 
 286         clock_t tcp_rtt_sa;             /* Round trip smoothed average */
 287         clock_t tcp_rtt_sd;             /* Round trip smoothed deviation */
 288         clock_t tcp_rtt_update;         /* Round trip update(s) */


 289         clock_t tcp_ms_we_have_waited;  /* Total retrans time */
 290 
 291         uint32_t tcp_swl1;              /* These help us avoid using stale */
 292         uint32_t tcp_swl2;              /*  packets to update state */
 293 
 294         uint32_t tcp_rack;              /* Seq # we have acked */
 295         uint32_t tcp_rack_cnt;          /* # of segs we have deferred ack */
 296         uint32_t tcp_rack_cur_max;      /* # of segs we may defer ack for now */
 297         uint32_t tcp_rack_abs_max;      /* # of segs we may defer ack ever */
 298         timeout_id_t    tcp_ack_tid;    /* Delayed ACK timer ID */
 299         timeout_id_t    tcp_push_tid;   /* Push timer ID */
 300 
 301         uint32_t tcp_max_swnd;          /* Maximum swnd we have seen */
 302 
 303         struct tcp_s *tcp_listener;     /* Our listener */
 304 
 305         uint32_t tcp_irs;               /* Initial recv seq num */
 306         uint32_t tcp_fss;               /* Final/fin send seq num */
 307         uint32_t tcp_urg;               /* Urgent data seq num */
 308 


 484          * Socket generation number which is bumped when a connection attempt
 485          * is initiated. Its main purpose is to ensure that the socket does not
 486          * miss the asynchronous connected/disconnected notification.
 487          */
 488         sock_connid_t   tcp_connid;
 489 
 490         /* mblk_t used to enter TCP's squeue from the service routine. */
 491         mblk_t          *tcp_rsrv_mp;
 492         /* Mutex for accessing tcp_rsrv_mp */
 493         kmutex_t        tcp_rsrv_mp_lock;
 494 
 495         /* For connection counting. */
 496         struct tcp_listen_cnt_s *tcp_listen_cnt;
 497 
 498         /* Segment reassembly timer. */
 499         timeout_id_t            tcp_reass_tid;
 500 
 501         /* FIN-WAIT-2 flush timeout */
 502         uint32_t                tcp_fin_wait_2_flush_interval;
 503 


 504 #ifdef DEBUG
 505         pc_t                    tcmp_stk[15];
 506 #endif
 507 } tcp_t;
 508 
 509 #ifdef DEBUG
 510 #define TCP_DEBUG_GETPCSTACK(buffer, depth)     ((void) getpcstack(buffer, \
 511                                                     depth))
 512 #else
 513 #define TCP_DEBUG_GETPCSTACK(buffer, depth)
 514 #endif
 515 
 516 extern void     tcp_conn_reclaim(void *);
 517 extern void     tcp_free(tcp_t *tcp);
 518 extern void     tcp_ddi_g_init(void);
 519 extern void     tcp_ddi_g_destroy(void);
 520 extern void     *tcp_get_conn(void *arg, tcp_stack_t *);
 521 extern mblk_t   *tcp_snmp_get(queue_t *, mblk_t *, boolean_t);
 522 extern int      tcp_snmp_set(queue_t *, int, int, uchar_t *, int len);
 523 
 524 /* Pad for the tf_t structure to avoid false cache line sharing. */
 525 #define TF_CACHEL_PAD   64
 526 
 527 /*
 528  * The TCP Fanout structure for bind and acceptor hashes.
 529  * The hash tables and their linkage (tcp_*_hash, tcp_ptp*hn) are
 530  * protected by the per-bucket tf_lock.  Each tcp_t
 531  * inserted in the list points back at this lock using tcp_*_lockp.
 532  *
 533  * The bind and acceptor hash queues are lists of tcp_t.
 534  */
 535 /* listener hash and acceptor hash queue head */
 536 typedef struct tf_s {
 537         tcp_t           *tf_tcp;
 538         kmutex_t        tf_lock;
 539         unsigned char   tf_pad[TF_CACHEL_PAD -
 540             (sizeof (tcp_t *) + sizeof (kmutex_t))];




   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 (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2015 Joyent, Inc.
  24  * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved.
  25  * Copyright (c) 2014, 2017 by Delphix. All rights reserved.
  26  */
  27 /* Copyright (c) 1990 Mentat Inc. */
  28 
  29 #ifndef _INET_TCP_H
  30 #define _INET_TCP_H
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #include <sys/inttypes.h>
  37 #include <netinet/ip6.h>
  38 #include <netinet/tcp.h>
  39 #include <sys/socket.h>
  40 #include <sys/socket_proto.h>
  41 #include <sys/md5.h>
  42 #include <inet/common.h>
  43 #include <inet/ip.h>
  44 #include <inet/ip6.h>
  45 #include <inet/mi.h>
  46 #include <inet/mib2.h>
  47 #include <inet/tcp_stack.h>
  48 #include <inet/tcp_sack.h>
  49 #include <inet/cc.h>
  50 
  51 /* TCP states */
  52 #define TCPS_CLOSED             -6
  53 #define TCPS_IDLE               -5      /* idle (opened, but not bound) */
  54 #define TCPS_BOUND              -4      /* bound, ready to connect or accept */
  55 #define TCPS_LISTEN             -3      /* listening for connection */
  56 #define TCPS_SYN_SENT           -2      /* active, have sent syn */
  57 #define TCPS_SYN_RCVD           -1      /* have received syn (and sent ours) */
  58 /* states < TCPS_ESTABLISHED are those where connections not established */
  59 #define TCPS_ESTABLISHED        0       /* established */
  60 #define TCPS_CLOSE_WAIT         1       /* rcvd fin, waiting for close */
  61 /* states > TCPS_CLOSE_WAIT are those where user has closed */
  62 #define TCPS_FIN_WAIT_1         2       /* have closed and sent fin */
  63 #define TCPS_CLOSING            3       /* closed, xchd FIN, await FIN ACK */
  64 #define TCPS_LAST_ACK           4       /* had fin and close; await FIN ACK */
  65 /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
  66 #define TCPS_FIN_WAIT_2         5       /* have closed, fin is acked */
  67 #define TCPS_TIME_WAIT          6       /* in 2*msl quiet wait after close */
  68 
  69 /*


 137 struct tcp_listen_cnt_s;
 138 struct tcp_rg_s;
 139 
 140 /*
 141  * Control structure for each open TCP stream,
 142  * defined only within the kernel or for a kmem user.
 143  * NOTE: tcp_reinit_values MUST have a line for each field in this structure!
 144  */
 145 #if (defined(_KERNEL) || defined(_KMEMUSER))
 146 
 147 typedef struct tcp_s {
 148         struct tcp_s    *tcp_time_wait_next;
 149                                 /* Pointer to next T/W block */
 150         struct tcp_s    *tcp_time_wait_prev;
 151                                 /* Pointer to previous T/W next */
 152         int64_t         tcp_time_wait_expire;
 153 
 154         struct conn_s   *tcp_connp;     /* back pointer to conn_t */
 155         tcp_stack_t     *tcp_tcps;      /* back pointer to tcp_stack_t */
 156 
 157         struct cc_algo  *tcp_cc_algo;   /* congestion control algorithm */
 158         struct cc_var   tcp_ccv;        /* congestion control specific vars */
 159 
 160         int32_t tcp_state;
 161         int32_t tcp_rcv_ws;             /* My window scale power */
 162         int32_t tcp_snd_ws;             /* Sender's window scale power */
 163         uint32_t tcp_ts_recent;         /* Timestamp of earliest unacked */
 164                                         /*  data segment */
 165         clock_t tcp_rto;                /* Round trip timeout */
 166         int64_t tcp_last_rcv_lbolt;
 167                                 /* lbolt on last packet, used for PAWS */
 168         uint32_t tcp_rto_initial;       /* Initial RTO */
 169         uint32_t tcp_rto_min;           /* Minimum RTO */
 170         uint32_t tcp_rto_max;           /* Maximum RTO */
 171 
 172         uint32_t tcp_snxt;              /* Senders next seq num */
 173         uint32_t tcp_swnd;              /* Senders window (relative to suna) */
 174         uint32_t tcp_mss;               /* Max segment size */
 175         uint32_t tcp_iss;               /* Initial send seq num */
 176         uint32_t tcp_rnxt;              /* Seq we expect to recv next */
 177         uint32_t tcp_rwnd;
 178 
 179         /* Fields arranged in approximate access order along main paths */
 180         mblk_t  *tcp_xmit_head;         /* Head of xmit/rexmit list */
 181         mblk_t  *tcp_xmit_last;         /* Last valid data seen by tcp_wput */
 182         mblk_t  *tcp_xmit_tail;         /* Last data sent */
 183         uint32_t tcp_unsent;            /* # of bytes in hand that are unsent */
 184         uint32_t tcp_xmit_tail_unsent;  /* # of unsent bytes in xmit_tail */

 185         uint32_t tcp_suna;              /* Sender unacknowledged */
 186         uint32_t tcp_rexmit_nxt;        /* Next rexmit seq num */
 187         uint32_t tcp_rexmit_max;        /* Max retran seq num */
 188         uint32_t tcp_cwnd;              /* Congestion window */
 189         int32_t tcp_cwnd_cnt;           /* cwnd cnt in congestion avoidance */




 190         uint32_t tcp_naglim;            /* Tunable nagle limit */
 191         uint32_t        tcp_valid_bits;
 192 #define TCP_ISS_VALID   0x1     /* Is the tcp_iss seq num active? */
 193 #define TCP_FSS_VALID   0x2     /* Is the tcp_fss seq num active? */
 194 #define TCP_URG_VALID   0x4     /* Is the tcp_urg seq num active? */
 195 #define TCP_OFO_FIN_VALID 0x8   /* Has TCP received an out of order FIN? */
 196 


 197         timeout_id_t    tcp_timer_tid;  /* Control block for timer service */
 198         uchar_t tcp_timer_backoff;      /* Backoff shift count. */
 199         int64_t tcp_last_recv_time;     /* Last time we receive a segment. */
 200         uint32_t tcp_init_cwnd;         /* Initial cwnd (start/restart) */
 201 
 202         /* Following manipulated by TCP under squeue protection */
 203         uint32_t
 204                 tcp_urp_last_valid : 1, /* Is tcp_urp_last valid? */
 205                 tcp_hard_binding : 1,   /* TCP_DETACHED_NONEAGER */
 206                 tcp_fin_acked : 1,      /* Has our FIN been acked? */
 207                 tcp_fin_rcvd : 1,       /* Have we seen a FIN? */
 208 
 209                 tcp_fin_sent : 1,       /* Have we sent our FIN yet? */
 210                 tcp_ordrel_done : 1,    /* Have we sent the ord_rel upstream? */
 211                 tcp_detached : 1,       /* If we're detached from a stream */
 212                 tcp_zero_win_probe: 1,  /* Zero win probing is in progress */
 213 
 214                 tcp_loopback: 1,        /* src and dst are the same machine */
 215                 tcp_localnet: 1,        /* src and dst are on the same subnet */
 216                 tcp_syn_defense: 1,     /* For defense against SYN attack */


 263 
 264 #define tcp_pipe                tcp_sack_info.tcp_pipe
 265 #define tcp_fack                tcp_sack_info.tcp_fack
 266 #define tcp_sack_snxt           tcp_sack_info.tcp_sack_snxt
 267 #define tcp_max_sack_blk        tcp_sack_info.tcp_max_sack_blk
 268 #define tcp_num_sack_blk        tcp_sack_info.tcp_num_sack_blk
 269 #define tcp_sack_list           tcp_sack_info.tcp_sack_list
 270 #define tcp_num_notsack_blk     tcp_sack_info.tcp_num_notsack_blk
 271 #define tcp_cnt_notsack_list    tcp_sack_info.tcp_cnt_notsack_list
 272 #define tcp_notsack_list        tcp_sack_info.tcp_notsack_list
 273 
 274         mblk_t  *tcp_rcv_list;          /* Queued until push, urgent data, */
 275         mblk_t  *tcp_rcv_last_head;     /* optdata, or the count exceeds */
 276         mblk_t  *tcp_rcv_last_tail;     /* tcp_rcv_push_wait. */
 277         uint32_t tcp_rcv_cnt;           /* tcp_rcv_list is b_next chain. */
 278 
 279         uint32_t tcp_cwnd_ssthresh;     /* Congestion window */
 280         uint32_t tcp_cwnd_max;
 281         uint32_t tcp_csuna;             /* Clear (no rexmits in window) suna */
 282 
 283         hrtime_t tcp_rtt_sum;           /* Round trip sum */
 284         uint32_t tcp_rtt_cnt;           /* Round trip count (non_dup ACKs) */
 285         hrtime_t tcp_rtt_sa;            /* Round trip smoothed average */
 286         hrtime_t tcp_rtt_sd;            /* Round trip smoothed deviation */
 287         uint32_t tcp_rtt_update;        /* Round trip update(s) */
 288         clock_t tcp_ms_we_have_waited;  /* Total retrans time */
 289 
 290         uint32_t tcp_swl1;              /* These help us avoid using stale */
 291         uint32_t tcp_swl2;              /*  packets to update state */
 292 
 293         uint32_t tcp_rack;              /* Seq # we have acked */
 294         uint32_t tcp_rack_cnt;          /* # of segs we have deferred ack */
 295         uint32_t tcp_rack_cur_max;      /* # of segs we may defer ack for now */
 296         uint32_t tcp_rack_abs_max;      /* # of segs we may defer ack ever */
 297         timeout_id_t    tcp_ack_tid;    /* Delayed ACK timer ID */
 298         timeout_id_t    tcp_push_tid;   /* Push timer ID */
 299 
 300         uint32_t tcp_max_swnd;          /* Maximum swnd we have seen */
 301 
 302         struct tcp_s *tcp_listener;     /* Our listener */
 303 
 304         uint32_t tcp_irs;               /* Initial recv seq num */
 305         uint32_t tcp_fss;               /* Final/fin send seq num */
 306         uint32_t tcp_urg;               /* Urgent data seq num */
 307 


 483          * Socket generation number which is bumped when a connection attempt
 484          * is initiated. Its main purpose is to ensure that the socket does not
 485          * miss the asynchronous connected/disconnected notification.
 486          */
 487         sock_connid_t   tcp_connid;
 488 
 489         /* mblk_t used to enter TCP's squeue from the service routine. */
 490         mblk_t          *tcp_rsrv_mp;
 491         /* Mutex for accessing tcp_rsrv_mp */
 492         kmutex_t        tcp_rsrv_mp_lock;
 493 
 494         /* For connection counting. */
 495         struct tcp_listen_cnt_s *tcp_listen_cnt;
 496 
 497         /* Segment reassembly timer. */
 498         timeout_id_t            tcp_reass_tid;
 499 
 500         /* FIN-WAIT-2 flush timeout */
 501         uint32_t                tcp_fin_wait_2_flush_interval;
 502 
 503         tcp_conn_stats_t        tcp_cs;
 504 
 505 #ifdef DEBUG
 506         pc_t                    tcmp_stk[15];
 507 #endif
 508 } tcp_t;
 509 
 510 #ifdef DEBUG
 511 #define TCP_DEBUG_GETPCSTACK(buffer, depth)     ((void) getpcstack(buffer, \
 512                                                     depth))
 513 #else
 514 #define TCP_DEBUG_GETPCSTACK(buffer, depth)
 515 #endif
 516 
 517 extern void     tcp_conn_reclaim(void *);
 518 extern void     tcp_free(tcp_t *tcp);
 519 extern void     tcp_ddi_g_init(void);
 520 extern void     tcp_ddi_g_destroy(void);
 521 extern conn_t   *tcp_get_conn(void *arg, tcp_stack_t *);
 522 extern mblk_t   *tcp_snmp_get(queue_t *, mblk_t *, boolean_t);
 523 extern int      tcp_snmp_set(queue_t *, int, int, uchar_t *, int len);
 524 
 525 /* Pad for the tf_t structure to avoid false cache line sharing. */
 526 #define TF_CACHEL_PAD   64
 527 
 528 /*
 529  * The TCP Fanout structure for bind and acceptor hashes.
 530  * The hash tables and their linkage (tcp_*_hash, tcp_ptp*hn) are
 531  * protected by the per-bucket tf_lock.  Each tcp_t
 532  * inserted in the list points back at this lock using tcp_*_lockp.
 533  *
 534  * The bind and acceptor hash queues are lists of tcp_t.
 535  */
 536 /* listener hash and acceptor hash queue head */
 537 typedef struct tf_s {
 538         tcp_t           *tf_tcp;
 539         kmutex_t        tf_lock;
 540         unsigned char   tf_pad[TF_CACHEL_PAD -
 541             (sizeof (tcp_t *) + sizeof (kmutex_t))];