From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev <netdev@vger.kernel.org>
Subject: [PATCH iproute2] ss: add support for bytes_acked & bytes_received
Date: Mon, 11 May 2015 10:03:49 -0700 [thread overview]
Message-ID: <1431363829.566.26.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
From: Eric Dumazet <edumazet@google.com>
tcp_info has 2 new fields : bytes_acked & bytes_received
$ ss -ti src :22
...
cubic wscale:7,6 rto:234 rtt:33.199/17.225 ato:17.225 mss:1418 cwnd:9
ssthresh:9 send 3.1Mbps lastsnd:3 lastrcv:4 lastack:193
bytes_acked:188396 bytes_received:13639 pacing_rate 6.2Mbps unacked:1
retrans:0/4 reordering:4 rcv_rtt:47.25 rcv_space:28960
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/linux/tcp.h | 5 +++++
misc/ss.c | 9 +++++++++
2 files changed, 14 insertions(+)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index f96e015..8b17cff 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -112,6 +112,9 @@ enum {
#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
#define TCP_TIMESTAMP 24
#define TCP_NOTSENT_LOWAT 25 /* limit number of unsent bytes in write queue */
+#define TCP_CC_INFO 26 /* Get Congestion Control (optional) info */
+#define TCP_SAVE_SYN 27 /* Record SYN headers for new connections */
+#define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */
struct tcp_repair_opt {
__u32 opt_code;
@@ -189,6 +192,8 @@ struct tcp_info {
__u64 tcpi_pacing_rate;
__u64 tcpi_max_pacing_rate;
+ __u64 tcpi_bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked */
+ __u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
};
/* for TCP_MD5SIG socket option */
diff --git a/misc/ss.c b/misc/ss.c
index 870cad1..8ee654a 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -767,6 +767,8 @@ struct tcpstat
unsigned int lastack;
double pacing_rate;
double pacing_rate_max;
+ unsigned long long bytes_acked;
+ unsigned long long bytes_received;
unsigned int unacked;
unsigned int retrans;
unsigned int retrans_total;
@@ -1689,6 +1691,11 @@ static void tcp_stats_print(struct tcpstat *s)
if (s->ssthresh)
printf(" ssthresh:%d", s->ssthresh);
+ if (s->bytes_acked)
+ printf(" bytes_acked:%llu", s->bytes_acked);
+ if (s->bytes_received)
+ printf(" bytes_received:%llu", s->bytes_received);
+
if (s->dctcp && s->dctcp->enabled) {
struct dctcpstat *dctcp = s->dctcp;
@@ -1981,6 +1988,8 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
info->tcpi_max_pacing_rate != ~0ULL)
s.pacing_rate_max = info->tcpi_max_pacing_rate * 8.;
}
+ s.bytes_acked = info->tcpi_bytes_acked;
+ s.bytes_received = info->tcpi_bytes_received;
tcp_stats_print(&s);
if (s.dctcp)
free(s.dctcp);
next reply other threads:[~2015-05-11 17:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 17:03 Eric Dumazet [this message]
2015-05-21 22:21 ` [PATCH iproute2] ss: add support for bytes_acked & bytes_received Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431363829.566.26.camel@edumazet-glaptop2.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox