From patchwork Tue May 26 18:54:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Craig Gallek X-Patchwork-Id: 476695 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2B2391402A7 for ; Wed, 27 May 2015 04:54:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=pHi/ZGHM; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751448AbbEZSyy (ORCPT ); Tue, 26 May 2015 14:54:54 -0400 Received: from mail-yh0-f47.google.com ([209.85.213.47]:34686 "EHLO mail-yh0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751106AbbEZSyv (ORCPT ); Tue, 26 May 2015 14:54:51 -0400 Received: by yhom41 with SMTP id m41so33394415yho.1 for ; Tue, 26 May 2015 11:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=QtXg24i9/cWVnPMLntC2FJjQmDGI1AKRIdPn5zSb6FI=; b=pHi/ZGHMLy+n8sz/7WezHCmWcfCgb9d0fKr90F5+M0xP9DqDaAY2Lh5CZurCXkPrIp /n0pwG5XstLw38Ygl9jQ5H/drpZNJHWDYPVt3dYp4tb5GrCrJcVhGHwQWd96RF7hTJZJ 2N2u4UmYLrziiDYIkG/4R2cEpeU9v3npetkaBpAZIQEDnKNDpbjKaMBU3czl03WYpz3n ub9Q8kvQDjaCh+xrA97Q/S8viooIU/zHPNg9vAecd4zCHBkofSyQjgi4UBLstiqIuMaP aIFPh8XSXg5BvdZD0+S4uFB2FuEApZQhcxJNqG3FFOYRJPiqsil/v5egUxMY41cGCcDv qVwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QtXg24i9/cWVnPMLntC2FJjQmDGI1AKRIdPn5zSb6FI=; b=f4WlkwifHnQTkPQzVy4lcqy4KutW919CSaDktfHoYsgXY9LLNgF1YE6U/xA+6JD+Pw nNY7xonamb/Pb4WCpoavHs339hDwuzUAlKJ98sB62/+BsolMivWMCJN557tYfB6FGu7/ aoU/DSkCZEWhZHD3Ha/h4aDZxPK4F7/4xVXCiYmEsR/3lcTu28n45SJeTHUv5yGEpQs6 sAsB6vUybnSB7RabTURBYmha1+bUdGuAZmN7lFIxeQFbMH4PfrWLSqe1G2I2T/is/HYo 7jsn5YxSvuv2OUix2/mh48gKp7tVTEXkYjHB6KjiPQklf56oZIdopklbTI3mXYXJRxY7 lOEQ== X-Gm-Message-State: ALoCoQliOUZGlXi6cXtGFdzz8NxhjjPMTiZQLkKZNchb5nxAYN1geWY7Amw9F0KNsflnNh5C/j9n X-Received: by 10.236.39.76 with SMTP id c52mr25171594yhb.124.1432666490825; Tue, 26 May 2015 11:54:50 -0700 (PDT) Received: from cgallek-warp18.nyc.corp.google.com ([172.26.105.104]) by mx.google.com with ESMTPSA id h70sm6662314yhq.49.2015.05.26.11.54.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 May 2015 11:54:49 -0700 (PDT) From: Craig Gallek To: Stephen Hemminger Cc: edumazet@google.com, mleitner@redhat.com, netdev@vger.kernel.org, Craig Gallek Subject: [PATCH iproute2] ss: add support for segs_in and segs_out Date: Tue, 26 May 2015 14:54:41 -0400 Message-Id: <1432666481-1582-1-git-send-email-kraig@google.com> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Reviewed-by: Marcelo Ricardo Leitner --- include/linux/tcp.h | 4 +++- misc/ss.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 8b17cff..1e9b4a6 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -192,8 +192,10 @@ struct tcp_info { __u64 tcpi_pacing_rate; __u64 tcpi_max_pacing_rate; - __u64 tcpi_bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked */ + __u64 tcpi_bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked */ __u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */ + __u32 tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */ + __u32 tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */ }; /* for TCP_MD5SIG socket option */ diff --git a/misc/ss.c b/misc/ss.c index dba0901..3e01f88 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -769,6 +769,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; @@ -1695,6 +1697,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; @@ -1990,6 +1996,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);