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_timers.c
          +++ new/usr/src/uts/common/inet/tcp/tcp_timers.c
↓ open down ↓ 586 lines elided ↑ open up ↑
 587  587                   * permanently back in the direction of
 588  588                   * ACK-every-other-packet as suggested in RFC 1122.
 589  589                   */
 590  590                  if (tcp->tcp_rack_abs_max > 2)
 591  591                          tcp->tcp_rack_abs_max--;
 592  592                  tcp->tcp_rack_cur_max = 2;
 593  593          }
 594  594          mp = tcp_ack_mp(tcp);
 595  595  
 596  596          if (mp != NULL) {
 597      -                BUMP_LOCAL(tcp->tcp_obsegs);
      597 +                TCPS_BUMP_MIB(tcps, tcpHCOutSegs);
 598  598                  TCPS_BUMP_MIB(tcps, tcpOutAck);
 599  599                  TCPS_BUMP_MIB(tcps, tcpOutAckDelayed);
 600  600                  tcp_send_data(tcp, mp);
 601  601          }
 602  602  }
 603  603  
 604  604  /*
 605  605   * Notify IP that we are having trouble with this connection.  IP should
 606  606   * make note so it can potentially use a different IRE.
 607  607   */
↓ open down ↓ 238 lines elided ↑ open up ↑
 846  846                                   * the network is really congested.
 847  847                                   */
 848  848                                  ASSERT(tcp->tcp_ecn_ok);
 849  849                                  tcp->tcp_cwnd = tcp->tcp_mss;
 850  850                          }
 851  851                          if (tcp->tcp_swnd == 0) {
 852  852                                  /* Extend window for zero window probe */
 853  853                                  tcp->tcp_swnd++;
 854  854                                  tcp->tcp_zero_win_probe = B_TRUE;
 855  855                                  TCPS_BUMP_MIB(tcps, tcpOutWinProbe);
      856 +                                tcp->tcp_cs.tcp_out_zwnd_probes++;
 856  857                          } else {
 857  858                                  /*
 858  859                                   * Handle timeout from sender SWS avoidance.
 859  860                                   * Reset our knowledge of the max send window
 860  861                                   * since the receiver might have reduced its
 861  862                                   * receive buffer.  Avoid setting tcp_max_swnd
 862  863                                   * to one since that will essentially disable
 863  864                                   * the SWS checks.
 864  865                                   *
 865  866                                   * Note that since we don't have a SWS
↓ open down ↓ 208 lines elided ↑ open up ↑
1074 1075           */
1075 1076          if (tcp->tcp_snd_sack_ok)
1076 1077                  TCP_NOTSACK_REMOVE_ALL(tcp->tcp_notsack_list, tcp);
1077 1078          if (mp == NULL) {
1078 1079                  return;
1079 1080          }
1080 1081  
1081 1082          tcp->tcp_csuna = tcp->tcp_snxt;
1082 1083          TCPS_BUMP_MIB(tcps, tcpRetransSegs);
1083 1084          TCPS_UPDATE_MIB(tcps, tcpRetransBytes, mss);
     1085 +        tcp->tcp_cs.tcp_out_retrans_segs++;
     1086 +        tcp->tcp_cs.tcp_out_retrans_bytes += mss;
1084 1087          tcp_send_data(tcp, mp);
1085 1088  
1086 1089  }
1087 1090  
1088 1091  /*
1089 1092   * Handle lingering timeouts. This function is called when the SO_LINGER timeout
1090 1093   * expires.
1091 1094   */
1092 1095  void
1093 1096  tcp_close_linger_timeout(void *arg)
1094 1097  {
1095 1098          conn_t  *connp = (conn_t *)arg;
1096 1099          tcp_t   *tcp = connp->conn_tcp;
1097 1100  
1098 1101          tcp->tcp_client_errno = ETIMEDOUT;
1099 1102          tcp_stop_lingering(tcp);
1100 1103  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX