diff mbox

[iproute2,v3,4/4] ifstat: Add "sw only" extended statistics to ifstat

Message ID 1482423795-6531-5-git-send-email-nogahf@mellanox.com
State Changes Requested, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Nogah Frankel Dec. 22, 2016, 4:23 p.m. UTC
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 <nogahf@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 misc/ifstat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Roopa Prabhu Dec. 22, 2016, 9:10 p.m. UTC | #1
On 12/22/16, 8:23 AM, Nogah Frankel wrote:
> 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
>
>
Nogah, can we keep the option names closer to the attribute names ?
That would avoid some confusion and help with the follow-up stats.

ifstat -x offload cpu
or
ifstat -x cpu

for others it would be:

ifstat -x link [vlan|igmp]
ifstat -x vlan
ifstat -x igmp
ifstat -x lacp

and so on...

thanks!
Nogah Frankel Dec. 25, 2016, 11:23 a.m. UTC | #2
> -----Original Message-----

> From: Roopa Prabhu [mailto:roopa@cumulusnetworks.com]

> Sent: Thursday, December 22, 2016 11:10 PM

> To: Nogah Frankel <nogahf@mellanox.com>

> Cc: netdev@vger.kernel.org; stephen@networkplumber.org; roszenrami@gmail.com; Or

> Gerlitz <ogerlitz@mellanox.com>; Jiri Pirko <jiri@mellanox.com>; Elad Raz

> <eladr@mellanox.com>; Yotam Gigi <yotamg@mellanox.com>; Ido Schimmel

> <idosch@mellanox.com>

> Subject: Re: [PATCH iproute2 v3 4/4] ifstat: Add "sw only" extended statistics to ifstat

> 

> On 12/22/16, 8:23 AM, Nogah Frankel wrote:

> > 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

> >

> >

> Nogah, can we keep the option names closer to the attribute names ?

> That would avoid some confusion and help with the follow-up stats.

> 

> ifstat -x offload cpu

> or

> ifstat -x cpu

> 

> for others it would be:

> 

> ifstat -x link [vlan|igmp]

> ifstat -x vlan

> ifstat -x igmp

> ifstat -x lacp

> 

> and so on...

> 

> thanks!


Sure, I will change it.
diff mbox

Patch

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)