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/tcp_time_wait.c
          +++ new/usr/src/uts/common/inet/tcp/tcp_time_wait.c
↓ open down ↓ 600 lines elided ↑ open up ↑
 601  601          int32_t         bytes_acked;
 602  602          int32_t         gap;
 603  603          int32_t         rgap;
 604  604          tcp_opt_t       tcpopt;
 605  605          uint_t          flags;
 606  606          uint32_t        new_swnd = 0;
 607  607          conn_t          *nconnp;
 608  608          conn_t          *connp = tcp->tcp_connp;
 609  609          tcp_stack_t     *tcps = tcp->tcp_tcps;
 610  610  
 611      -        BUMP_LOCAL(tcp->tcp_ibsegs);
      611 +        TCPS_BUMP_MIB(tcps, tcpHCInSegs);
 612  612          DTRACE_PROBE2(tcp__trace__recv, mblk_t *, mp, tcp_t *, tcp);
 613  613  
 614  614          flags = (unsigned int)tcpha->tha_flags & 0xFF;
 615  615          new_swnd = ntohs(tcpha->tha_win) <<
 616  616              ((tcpha->tha_flags & TH_SYN) ? 0 : tcp->tcp_snd_ws);
 617  617  
 618  618          boolean_t keepalive = (seg_len == 0 || seg_len == 1) &&
 619  619              (seg_seq + 1 == tcp->tcp_rnxt);
 620  620          if (tcp->tcp_snd_ts_ok && !(flags & TH_RST) && !keepalive) {
 621  621                  int options;
↓ open down ↓ 165 lines elided ↑ open up ↑
 787  787          }
 788  788  
 789  789          if (seg_seq != tcp->tcp_rnxt && seg_len > 0) {
 790  790                  /* Always ack out of order packets */
 791  791                  flags |= TH_ACK_NEEDED;
 792  792                  seg_len = 0;
 793  793          } else if (seg_len > 0) {
 794  794                  TCPS_BUMP_MIB(tcps, tcpInClosed);
 795  795                  TCPS_BUMP_MIB(tcps, tcpInDataInorderSegs);
 796  796                  TCPS_UPDATE_MIB(tcps, tcpInDataInorderBytes, seg_len);
      797 +                tcp->tcp_cs.tcp_in_data_inorder_segs++;
      798 +                tcp->tcp_cs.tcp_in_data_inorder_bytes += seg_len;
 797  799          }
 798  800          if (flags & TH_RST) {
 799  801                  (void) tcp_clean_death(tcp, 0);
 800  802                  goto done;
 801  803          }
 802  804          if (flags & TH_SYN) {
 803  805                  tcp_xmit_ctl("TH_SYN", tcp, seg_ack, seg_seq + 1,
 804  806                      TH_RST|TH_ACK);
 805  807                  /*
 806  808                   * Do not delete the TCP structure if it is in
↓ open down ↓ 26 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX