diff options
author | Sebastien Roy <seb@delphix.com> | 2015-05-29 13:47:23 -0400 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2019-08-19 22:32:46 +0000 |
commit | a2f04351e04971ab0879872d264d6038c156b860 (patch) | |
tree | cd6640900e1adf19b745c5f8e796a0e97c7a8ee7 /usr/src/uts/common/inet/tcp/tcp_input.c | |
parent | c12492cf73149aa0aa845af5d59966b0eb5aa910 (diff) | |
download | illumos-gate-a2f04351e04971ab0879872d264d6038c156b860.tar.gz |
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>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/uts/common/inet/tcp/tcp_input.c')
-rw-r--r-- | usr/src/uts/common/inet/tcp/tcp_input.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/usr/src/uts/common/inet/tcp/tcp_input.c b/usr/src/uts/common/inet/tcp/tcp_input.c index 0e12d23c3e..dd50c3f6ad 100644 --- a/usr/src/uts/common/inet/tcp/tcp_input.c +++ b/usr/src/uts/common/inet/tcp/tcp_input.c @@ -559,7 +559,7 @@ tcp_process_options(tcp_t *tcp, tcpha_t *tcpha) static mblk_t * tcp_reass(tcp_t *tcp, mblk_t *mp, uint32_t start) { - uint32_t end; + uint32_t end, bytes; mblk_t *mp1; mblk_t *mp2; mblk_t *next_mp; @@ -578,26 +578,26 @@ tcp_reass(tcp_t *tcp, mblk_t *mp, uint32_t start) freeb(mp); continue; } + bytes = end - start; mp->b_cont = NULL; TCP_REASS_SET_SEQ(mp, start); TCP_REASS_SET_END(mp, end); mp1 = tcp->tcp_reass_tail; - if (!mp1) { - tcp->tcp_reass_tail = mp; - tcp->tcp_reass_head = mp; - TCPS_BUMP_MIB(tcps, tcpInDataUnorderSegs); - TCPS_UPDATE_MIB(tcps, tcpInDataUnorderBytes, - end - start); - continue; - } - /* New stuff completely beyond tail? */ - if (SEQ_GEQ(start, TCP_REASS_END(mp1))) { - /* Link it on end. */ - mp1->b_cont = mp; + if (mp1 == NULL || SEQ_GEQ(start, TCP_REASS_END(mp1))) { + if (mp1 != NULL) { + /* + * New stuff is beyond the tail; link it on the + * end. + */ + mp1->b_cont = mp; + } else { + tcp->tcp_reass_head = mp; + } tcp->tcp_reass_tail = mp; TCPS_BUMP_MIB(tcps, tcpInDataUnorderSegs); - TCPS_UPDATE_MIB(tcps, tcpInDataUnorderBytes, - end - start); + TCPS_UPDATE_MIB(tcps, tcpInDataUnorderBytes, bytes); + tcp->tcp_cs.tcp_in_data_unorder_segs++; + tcp->tcp_cs.tcp_in_data_unorder_bytes += bytes; continue; } mp1 = tcp->tcp_reass_head; @@ -2414,7 +2414,7 @@ tcp_input_data(void *arg, mblk_t *mp, void *arg2, ip_recv_attr_t *ira) flags = (unsigned int)tcpha->tha_flags & 0xFF; - BUMP_LOCAL(tcp->tcp_ibsegs); + TCPS_BUMP_MIB(tcps, tcpHCInSegs); DTRACE_PROBE2(tcp__trace__recv, mblk_t *, mp, tcp_t *, tcp); if ((flags & TH_URG) && sqp != NULL) { @@ -2659,7 +2659,7 @@ tcp_input_data(void *arg, mblk_t *mp, void *arg2, ip_recv_attr_t *ira) tcp->tcp_ack_tid = 0; } tcp_send_data(tcp, ack_mp); - BUMP_LOCAL(tcp->tcp_obsegs); + TCPS_BUMP_MIB(tcps, tcpHCOutSegs); TCPS_BUMP_MIB(tcps, tcpOutAck); if (!IPCL_IS_NONSTR(connp)) { @@ -3048,6 +3048,7 @@ try_again:; if (tcp->tcp_rwnd == 0) { TCPS_BUMP_MIB(tcps, tcpInWinProbe); + tcp->tcp_cs.tcp_in_zwnd_probes++; } else { TCPS_BUMP_MIB(tcps, tcpInDataPastWinSegs); TCPS_UPDATE_MIB(tcps, tcpInDataPastWinBytes, -rgap); @@ -3297,6 +3298,9 @@ ok:; } else if (seg_len > 0) { TCPS_BUMP_MIB(tcps, tcpInDataInorderSegs); TCPS_UPDATE_MIB(tcps, tcpInDataInorderBytes, seg_len); + tcp->tcp_cs.tcp_in_data_inorder_segs++; + tcp->tcp_cs.tcp_in_data_inorder_bytes += seg_len; + /* * If an out of order FIN was received before, and the seq * num and len of the new segment match that of the FIN, @@ -4146,7 +4150,7 @@ process_ack: } mp = tcp_ack_mp(tcp); if (mp != NULL) { - BUMP_LOCAL(tcp->tcp_obsegs); + TCPS_BUMP_MIB(tcps, tcpHCOutSegs); TCPS_BUMP_MIB(tcps, tcpOutAck); tcp_send_data(tcp, mp); } @@ -4837,6 +4841,8 @@ xmit_check: TCPS_BUMP_MIB(tcps, tcpRetransSegs); TCPS_UPDATE_MIB(tcps, tcpRetransBytes, snd_size); + tcp->tcp_cs.tcp_out_retrans_segs++; + tcp->tcp_cs.tcp_out_retrans_bytes += snd_size; tcp_send_data(tcp, mp1); } } @@ -4912,7 +4918,7 @@ ack_check: if (mp1 != NULL) { tcp_send_data(tcp, mp1); - BUMP_LOCAL(tcp->tcp_obsegs); + TCPS_BUMP_MIB(tcps, tcpHCOutSegs); TCPS_BUMP_MIB(tcps, tcpOutAck); } if (tcp->tcp_ack_tid != 0) { @@ -5228,6 +5234,8 @@ tcp_set_rto(tcp_t *tcp, hrtime_t rtt) TCPS_BUMP_MIB(tcps, tcpRttUpdate); tcp->tcp_rtt_update++; + tcp->tcp_rtt_sum += m; + tcp->tcp_rtt_cnt++; /* tcp_rtt_sa is not 0 means this is a new sample. */ if (sa != 0) { |