All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nogah Frankel <nogahf@mellanox.com>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, roopa@cumulusnetworks.com,
	roszenrami@gmail.com, jbenc@redhat.com,
	sergei.shtylyov@cogentembedded.com, jiri@mellanox.com,
	eladr@mellanox.com, idosch@mellanox.com, yotamg@mellanox.com,
	ogerlitz@mellanox.com, Nogah Frankel <nogahf@mellanox.com>
Subject: [PATCH iproute2 v5 3/4] ifstat: Add "sw only" extended statistics to ifstat
Date: Thu, 26 Jan 2017 14:44:40 +0200	[thread overview]
Message-ID: <1485434681-33947-4-git-send-email-nogahf@mellanox.com> (raw)
In-Reply-To: <1485434681-33947-1-git-send-email-nogahf@mellanox.com>

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 'cpu_hits'
(or any shorten of it as 'cpu' or simply 'c')

For example:
ifstat -x c

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 misc/ifstat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/misc/ifstat.c b/misc/ifstat.c
index 9467119..a853ee6 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -729,7 +729,8 @@ static int verify_forging(int fd)
 static void xstat_usage(void)
 {
 	fprintf(stderr,
-"Usage: ifstat supported xstats:\n");
+"Usage: ifstat supported xstats:\n"
+"       cpu_hits       Counts only packets that went via the CPU.\n");
 }
 
 struct extended_stats_options_t {
@@ -743,6 +744,7 @@ struct extended_stats_options_t {
  * Name length must be under 64 chars.
  */
 static const struct extended_stats_options_t extended_stats_options[] = {
+	{"cpu_hits",  IFLA_STATS_LINK_OFFLOAD_XSTATS, IFLA_OFFLOAD_XSTATS_CPU_HIT},
 };
 
 static const char *get_filter_type(const char *name)
-- 
2.4.3

  parent reply	other threads:[~2017-01-26 12:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 12:44 [PATCH iproute2 v5 0/4] update ifstat for new stats Nogah Frankel
2017-01-26 12:44 ` [PATCH iproute2 v5 1/4] ifstat: Includes reorder Nogah Frankel
2017-01-26 12:44 ` [PATCH iproute2 v5 2/4] ifstat: Add extended statistics to ifstat Nogah Frankel
2017-01-30  4:34   ` Stephen Hemminger
2017-02-02  8:53     ` Nogah Frankel
2017-02-03 18:07   ` Stephen Hemminger
2017-02-07 12:59     ` Nogah Frankel
2017-02-07 16:48       ` Stephen Hemminger
2017-01-26 12:44 ` Nogah Frankel [this message]
2017-01-26 12:44 ` [PATCH iproute2 v5 4/4] ifstat: Add xstat to ifstat man page Nogah Frankel

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=1485434681-33947-4-git-send-email-nogahf@mellanox.com \
    --to=nogahf@mellanox.com \
    --cc=eladr@mellanox.com \
    --cc=idosch@mellanox.com \
    --cc=jbenc@redhat.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=roszenrami@gmail.com \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=stephen@networkplumber.org \
    --cc=yotamg@mellanox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.