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>

@@ -1229,15 +1229,10 @@
         int32_t         oldstate;
 
         if (!TCP_IS_SOCKET(tcp))
                 tcp_acceptor_hash_remove(tcp);
 
-        TCPS_UPDATE_MIB(tcps, tcpHCInSegs, tcp->tcp_ibsegs);
-        tcp->tcp_ibsegs = 0;
-        TCPS_UPDATE_MIB(tcps, tcpHCOutSegs, tcp->tcp_obsegs);
-        tcp->tcp_obsegs = 0;
-
         /*
          * This can be called via tcp_time_wait_processing() if TCP gets a
          * SYN with sequence number outside the TIME-WAIT connection's
          * window.  So we need to check for TIME-WAIT state here as the
          * connection counter is already decremented.  See SET_TIME_WAIT()

@@ -1902,19 +1897,10 @@
             connp->conn_ipversion == IPV6_VERSION)));
 
         /* Cancel outstanding timers */
         tcp_timers_stop(tcp);
 
-        /*
-         * Reset everything in the state vector, after updating global
-         * MIB data from instance counters.
-         */
-        TCPS_UPDATE_MIB(tcps, tcpHCInSegs, tcp->tcp_ibsegs);
-        tcp->tcp_ibsegs = 0;
-        TCPS_UPDATE_MIB(tcps, tcpHCOutSegs, tcp->tcp_obsegs);
-        tcp->tcp_obsegs = 0;
-
         tcp_close_mpp(&tcp->tcp_xmit_head);
         if (tcp->tcp_snd_zcopy_aware)
                 tcp_zcopy_notify(tcp);
         tcp->tcp_xmit_last = tcp->tcp_xmit_tail = NULL;
         tcp->tcp_unsent = tcp->tcp_xmit_tail_unsent = 0;

@@ -2082,13 +2068,10 @@
         tcp->tcp_snxt = 0;                      /* Displayed in mib */
         tcp->tcp_suna = 0;                      /* Displayed in mib */
         tcp->tcp_swnd = 0;
         DONTCARE(tcp->tcp_cwnd);        /* Init in tcp_process_options */
 
-        ASSERT(tcp->tcp_ibsegs == 0);
-        ASSERT(tcp->tcp_obsegs == 0);
-
         if (connp->conn_ht_iphc != NULL) {
                 kmem_free(connp->conn_ht_iphc, connp->conn_ht_iphc_allocated);
                 connp->conn_ht_iphc = NULL;
                 connp->conn_ht_iphc_allocated = 0;
                 connp->conn_ht_iphc_len = 0;

@@ -2176,10 +2159,12 @@
 
         tcp->tcp_rto = 0;                       /* Displayed in MIB */
         DONTCARE(tcp->tcp_rtt_sa);              /* Init in tcp_init_values */
         DONTCARE(tcp->tcp_rtt_sd);              /* Init in tcp_init_values */
         tcp->tcp_rtt_update = 0;
+        tcp->tcp_rtt_sum = 0;
+        tcp->tcp_rtt_cnt = 0;
 
         DONTCARE(tcp->tcp_swl1); /* Init in case TCPS_LISTEN/TCPS_SYN_SENT */
         DONTCARE(tcp->tcp_swl2); /* Init in case TCPS_LISTEN/TCPS_SYN_SENT */
 
         tcp->tcp_rack = 0;                      /* Displayed in mib */