Print this page
11547 Want connstat(1M) command to display per-connection TCP statistics
Portions contributed by: Cody Peter Mello <cody.mello@joyent.com>
Portions contributed by: Ahmed G <ahmedg@delphix.com>
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/tcp.h
          +++ new/usr/src/uts/common/inet/tcp.h
↓ open down ↓ 169 lines elided ↑ open up ↑
 170  170          uint32_t tcp_iss;               /* Initial send seq num */
 171  171          uint32_t tcp_rnxt;              /* Seq we expect to recv next */
 172  172          uint32_t tcp_rwnd;
 173  173  
 174  174          /* Fields arranged in approximate access order along main paths */
 175  175          mblk_t  *tcp_xmit_head;         /* Head of xmit/rexmit list */
 176  176          mblk_t  *tcp_xmit_last;         /* Last valid data seen by tcp_wput */
 177  177          mblk_t  *tcp_xmit_tail;         /* Last data sent */
 178  178          uint32_t tcp_unsent;            /* # of bytes in hand that are unsent */
 179  179          uint32_t tcp_xmit_tail_unsent;  /* # of unsent bytes in xmit_tail */
 180      -
 181  180          uint32_t tcp_suna;              /* Sender unacknowledged */
 182  181          uint32_t tcp_rexmit_nxt;        /* Next rexmit seq num */
 183  182          uint32_t tcp_rexmit_max;        /* Max retran seq num */
 184  183          uint32_t tcp_cwnd;              /* Congestion window */
 185  184          int32_t tcp_cwnd_cnt;           /* cwnd cnt in congestion avoidance */
 186      -
 187      -        uint32_t tcp_ibsegs;            /* Inbound segments on this stream */
 188      -        uint32_t tcp_obsegs;            /* Outbound segments on this stream */
 189      -
 190  185          uint32_t tcp_naglim;            /* Tunable nagle limit */
 191  186          uint32_t        tcp_valid_bits;
 192  187  #define TCP_ISS_VALID   0x1     /* Is the tcp_iss seq num active? */
 193  188  #define TCP_FSS_VALID   0x2     /* Is the tcp_fss seq num active? */
 194  189  #define TCP_URG_VALID   0x4     /* Is the tcp_urg seq num active? */
 195  190  #define TCP_OFO_FIN_VALID 0x8   /* Has TCP received an out of order FIN? */
 196  191  
 197      -
 198      -
 199  192          timeout_id_t    tcp_timer_tid;  /* Control block for timer service */
 200  193          uchar_t tcp_timer_backoff;      /* Backoff shift count. */
 201  194          int64_t tcp_last_recv_time;     /* Last time we receive a segment. */
 202  195          uint32_t tcp_init_cwnd;         /* Initial cwnd (start/restart) */
 203  196  
 204  197          /* Following manipulated by TCP under squeue protection */
 205  198          uint32_t
 206  199                  tcp_urp_last_valid : 1, /* Is tcp_urp_last valid? */
 207  200                  tcp_hard_binding : 1,   /* TCP_DETACHED_NONEAGER */
 208  201                  tcp_fin_acked : 1,      /* Has our FIN been acked? */
↓ open down ↓ 66 lines elided ↑ open up ↑
 275  268  
 276  269          mblk_t  *tcp_rcv_list;          /* Queued until push, urgent data, */
 277  270          mblk_t  *tcp_rcv_last_head;     /* optdata, or the count exceeds */
 278  271          mblk_t  *tcp_rcv_last_tail;     /* tcp_rcv_push_wait. */
 279  272          uint32_t tcp_rcv_cnt;           /* tcp_rcv_list is b_next chain. */
 280  273  
 281  274          uint32_t tcp_cwnd_ssthresh;     /* Congestion window */
 282  275          uint32_t tcp_cwnd_max;
 283  276          uint32_t tcp_csuna;             /* Clear (no rexmits in window) suna */
 284  277  
      278 +        hrtime_t tcp_rtt_sum;           /* Round trip sum */
      279 +        uint32_t tcp_rtt_cnt;           /* Round trip count (non_dup ACKs) */
 285  280          hrtime_t tcp_rtt_sa;            /* Round trip smoothed average */
 286  281          hrtime_t tcp_rtt_sd;            /* Round trip smoothed deviation */
 287  282          uint32_t tcp_rtt_update;        /* Round trip update(s) */
 288  283          clock_t tcp_ms_we_have_waited;  /* Total retrans time */
 289  284  
 290  285          uint32_t tcp_swl1;              /* These help us avoid using stale */
 291  286          uint32_t tcp_swl2;              /*  packets to update state */
 292  287  
 293  288          uint32_t tcp_rack;              /* Seq # we have acked */
 294  289          uint32_t tcp_rack_cnt;          /* # of segs we have deferred ack */
↓ open down ↓ 191 lines elided ↑ open up ↑
 486  481  
 487  482          /* For connection counting. */
 488  483          struct tcp_listen_cnt_s *tcp_listen_cnt;
 489  484  
 490  485          /* Segment reassembly timer. */
 491  486          timeout_id_t            tcp_reass_tid;
 492  487  
 493  488          /* FIN-WAIT-2 flush timeout */
 494  489          uint32_t                tcp_fin_wait_2_flush_interval;
 495  490  
      491 +        tcp_conn_stats_t        tcp_cs;
      492 +
 496  493  #ifdef DEBUG
 497  494          pc_t                    tcmp_stk[15];
 498  495  #endif
 499  496  } tcp_t;
 500  497  
 501  498  #ifdef DEBUG
 502  499  #define TCP_DEBUG_GETPCSTACK(buffer, depth)     ((void) getpcstack(buffer, \
 503  500                                                      depth))
 504  501  #else
 505  502  #define TCP_DEBUG_GETPCSTACK(buffer, depth)
↓ open down ↓ 93 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX