summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Peter Mello <cody.mello@joyent.com>2019-08-09 17:55:27 +0000
committerCody Peter Mello <melloc@writev.io>2019-08-22 18:42:05 +0000
commitbc729a97a9286d8629f774f23f1edeb945c6b29c (patch)
tree1bf250a7d1f66f02b6cbda0cc1bc470bbf95622d
parent4ad9cc07d7a3af5dbe729bd2da31e2919a64a691 (diff)
downloadillumos-joyent-bc729a97a9286d8629f774f23f1edeb945c6b29c.tar.gz
OS-7944 Want support for printing RTT variance with connstat(1M)
Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: John Levon <john.levon@joyent.com>
-rw-r--r--usr/src/cmd/connstat/connstat_tcp.c5
-rw-r--r--usr/src/man/man1m/connstat.1m6
-rw-r--r--usr/src/uts/common/inet/mib2.h3
-rw-r--r--usr/src/uts/common/inet/tcp/tcp_stats.c8
4 files changed, 20 insertions, 2 deletions
diff --git a/usr/src/cmd/connstat/connstat_tcp.c b/usr/src/cmd/connstat/connstat_tcp.c
index 4cd20c9b09..bcf2c2ef5b 100644
--- a/usr/src/cmd/connstat/connstat_tcp.c
+++ b/usr/src/cmd/connstat/connstat_tcp.c
@@ -14,6 +14,7 @@
*/
/*
* Copyright (c) 2015, 2016 by Delphix. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
*/
#include <stdio.h>
@@ -77,6 +78,7 @@ typedef struct tcp_fields_buf_s {
uint64_t t_rtt_sum;
int t_state;
uint64_t t_rtt;
+ uint64_t t_rttvar;
} tcp_fields_buf_t;
static boolean_t print_tcp_state(ofmt_arg_t *, char *, uint_t);
@@ -126,6 +128,8 @@ static ofmt_field_t tcp_fields[] = {
offsetof(tcp_fields_buf_t, t_rtt_sum), print_uint64 },
{ "RTTC", 11,
offsetof(tcp_fields_buf_t, t_rtt_cnt), print_uint32 },
+ { "RTTVAR", 8,
+ offsetof(tcp_fields_buf_t, t_rttvar), print_uint64 },
{ "STATE", 12,
offsetof(tcp_fields_buf_t, t_state), print_tcp_state },
{ NULL, 0, 0, NULL}
@@ -189,6 +193,7 @@ tcp_ci2buf(struct tcpConnEntryInfo_s *ci)
fields_buf.t_rtt = (ci->ce_out_data_segs == 0 ? 0 : ci->ce_rtt_sa);
fields_buf.t_rtt_sum = ci->ce_rtt_sum;
fields_buf.t_rtt_cnt = ci->ce_rtt_cnt;
+ fields_buf.t_rttvar = ci->ce_rtt_sd;
fields_buf.t_state = ci->ce_state;
}
diff --git a/usr/src/man/man1m/connstat.1m b/usr/src/man/man1m/connstat.1m
index 2175fefdb3..e87edbe3eb 100644
--- a/usr/src/man/man1m/connstat.1m
+++ b/usr/src/man/man1m/connstat.1m
@@ -14,8 +14,9 @@
.\"
.\"
.\" Copyright (c) 2016 by Delphix. All rights reserved.
+.\" Copyright 2019 Joyent, Inc.
.\"
-.Dd July 5, 2016
+.Dd August 15, 2019
.Dt CONNSTAT 1M
.Os
.Sh NAME
@@ -165,6 +166,9 @@ The current retransmission timeout in milliseconds.
.It Sy rtt
The current smoothed round-trip time to the peer in microseconds.
The smoothed RTT average algorithm used is as described in RFC 6298.
+.It Sy rttvar
+The current smoothed variation of the round-trip time to the peer in
+microseconds.
.It Sy rttc
The number of times that a round-trip sample was added to
.Sy rtts .
diff --git a/usr/src/uts/common/inet/mib2.h b/usr/src/uts/common/inet/mib2.h
index 847ad1c560..9a9d4e15d3 100644
--- a/usr/src/uts/common/inet/mib2.h
+++ b/usr/src/uts/common/inet/mib2.h
@@ -23,6 +23,7 @@
/*
* Copyright (c) 1990 Mentat Inc.
* Copyright (c) 2015, 2016 by Delphix. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
*/
#ifndef _INET_MIB2_H
@@ -1388,6 +1389,8 @@ typedef struct mib2_tcpConnEntry {
Gauge ce_rwnd;
/* round-trip time smoothed average (us) */
Gauge ce_rtt_sa;
+ /* round-trip time smoothed deviation (us) */
+ Gauge ce_rtt_sd;
/* current rto (retransmit timeout) */
Gauge ce_rto;
/* round-trip time count */
diff --git a/usr/src/uts/common/inet/tcp/tcp_stats.c b/usr/src/uts/common/inet/tcp/tcp_stats.c
index dbf320d09d..0da7f5413c 100644
--- a/usr/src/uts/common/inet/tcp/tcp_stats.c
+++ b/usr/src/uts/common/inet/tcp/tcp_stats.c
@@ -23,6 +23,7 @@
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, Joyent Inc. All rights reserved.
* Copyright (c) 2015, 2016 by Delphix. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
*/
#include <sys/types.h>
@@ -126,9 +127,14 @@ tcp_set_conninfo(tcp_t *tcp, struct tcpConnEntryInfo_s *tcei, boolean_t ispriv)
tcei->ce_rto = tcp->tcp_rto;
tcei->ce_mss = tcp->tcp_mss;
tcei->ce_state = tcp->tcp_state;
- tcei->ce_rtt_sa = NSEC2USEC(tcp->tcp_rtt_sa >> 3);
tcei->ce_rtt_sum = NSEC2USEC(tcp->tcp_rtt_sum);
tcei->ce_rtt_cnt = tcp->tcp_rtt_cnt;
+
+ /* tcp_rtt_sa is stored as 8 times the average RTT */
+ tcei->ce_rtt_sa = NSEC2USEC(tcp->tcp_rtt_sa >> 3);
+
+ /* tcp_rtt_sd is stored as 4 times the average RTTVAR */
+ tcei->ce_rtt_sd = NSEC2USEC(tcp->tcp_rtt_sd >> 2);
}
/*