]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ifstat: Add "sw only" extended statistics to ifstat
authorNogah Frankel <nogahf@mellanox.com>
Thu, 26 Jan 2017 12:44:40 +0000 (14:44 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 3 Feb 2017 17:20:15 +0000 (09:20 -0800)
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

index 9467119192ba2670789699784934d3b677ca40c8..a853ee6d7e3b3fbdd0246d420e18ab35fcd7368a 100644 (file)
@@ -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)