naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone
Blob Blame History Raw
From bf3cb083a64373edcad8ef43fe1fdf7ebdd27cb4 Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Thu, 18 Feb 2016 13:36:34 +0100
Subject: [PATCH] ss: add support for segs_in and segs_out

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1269114
Upstream Status: iproute2.git commit ecb435eacd501

commit ecb435eacd50161d2a7cce5731a269ef916c0dd4
Author: Craig Gallek <kraig@google.com>
Date:   Tue May 26 14:54:41 2015 -0400

    ss: add support for segs_in and segs_out

    Two new tcp_info fields: tcpi_segs_in and tcpi_segs_out.
    (2efd055c53c06b7e89c167c98069bab9afce7e59)

    ~: ss -ti src :22
    	 cubic wscale:7,6 rto:201 rtt:0.244/0.012 ato:40 mss:1418 cwnd:21 bytes_acked:80605 bytes_received:20491 segs_out:414 segs_in:600 send 976.3Mbps lastsnd:23 lastrcv:23 lastack:22 pacing_rate 1952.7Mbps rcv_rtt:98 rcv_space:28960

    Signed-off-by: Craig Gallek <kraig@google.com>
    Reviewed-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
---
 misc/ss.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/misc/ss.c b/misc/ss.c
index b1e8a8c..7750887 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -763,6 +763,8 @@ struct tcpstat
 	double		    pacing_rate_max;
 	unsigned long long  bytes_acked;
 	unsigned long long  bytes_received;
+	unsigned int	    segs_out;
+	unsigned int	    segs_in;
 	unsigned int	    unacked;
 	unsigned int	    retrans;
 	unsigned int	    retrans_total;
@@ -1689,6 +1691,10 @@ static void tcp_stats_print(struct tcpstat *s)
 		printf(" bytes_acked:%llu", s->bytes_acked);
 	if (s->bytes_received)
 		printf(" bytes_received:%llu", s->bytes_received);
+	if (s->segs_out)
+		printf(" segs_out:%u", s->segs_out);
+	if (s->segs_in)
+		printf(" segs_in:%u", s->segs_in);
 
 	if (s->dctcp && s->dctcp->enabled) {
 		struct dctcpstat *dctcp = s->dctcp;
@@ -1983,6 +1989,8 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r,
 		}
 		s.bytes_acked = info->tcpi_bytes_acked;
 		s.bytes_received = info->tcpi_bytes_received;
+		s.segs_out = info->tcpi_segs_out;
+		s.segs_in = info->tcpi_segs_in;
 		tcp_stats_print(&s);
 		if (s.dctcp)
 			free(s.dctcp);
-- 
1.8.3.1