From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nogah Frankel Subject: [PATCH iproute2 v3 4/4] ifstat: Add "sw only" extended statistics to ifstat Date: Thu, 22 Dec 2016 18:23:15 +0200 Message-ID: <1482423795-6531-5-git-send-email-nogahf@mellanox.com> References: <1482423795-6531-1-git-send-email-nogahf@mellanox.com> Cc: stephen@networkplumber.org, roopa@cumulusnetworks.com, roszenrami@gmail.com, ogerlitz@mellanox.com, jiri@mellanox.com, eladr@mellanox.com, yotamg@mellanox.com, idosch@mellanox.com, Nogah Frankel To: netdev@vger.kernel.org Return-path: Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:60697 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936238AbcLVQV2 (ORCPT ); Thu, 22 Dec 2016 11:21:28 -0500 In-Reply-To: <1482423795-6531-1-git-send-email-nogahf@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: Add support for extended statistics of SW only type, for counting only the packets that went via the cpu. (useful for systems with forward offloading). It reads it from filter type IFLA_STATS_LINK_OFFLOAD_XSTATS and sub type IFLA_OFFLOAD_XSTATS_CPU_HIT. It is under the name 'software' (or any shorten of it as 'soft' or simply 's') For example: ifstat -x s Signed-off-by: Nogah Frankel Reviewed-by: Jiri Pirko --- misc/ifstat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/ifstat.c b/misc/ifstat.c index 8325ac7..79c0dba 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -730,7 +730,8 @@ static void xstat_usage(void) { fprintf(stderr, "Usage: ifstat supported xstats:\n" -" 64bits default stats, with 64 bits support\n"); +" 64bits default stats, with 64 bits support\n" +" software SW stats. Counts only packets that went via the CPU\n"); } struct extended_stats_options_t { @@ -745,6 +746,7 @@ struct extended_stats_options_t { */ static const struct extended_stats_options_t extended_stats_options[] = { {"64bits", IFLA_STATS_LINK_64, NO_SUB_TYPE}, + {"software", IFLA_STATS_LINK_OFFLOAD_XSTATS, IFLA_OFFLOAD_XSTATS_CPU_HIT}, }; static bool get_filter_type(char *name) -- 2.4.3