]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ipstats: Add a third level of stats hierarchy, a "suite"
authorPetr Machata <petrm@nvidia.com>
Mon, 9 May 2022 13:59:58 +0000 (15:59 +0200)
committerDavid Ahern <dsahern@kernel.org>
Thu, 12 May 2022 17:08:16 +0000 (11:08 -0600)
To show statistics nested under IFLA_STATS_LINK_XSTATS_SLAVE or
IFLA_STATS_LINK_XSTATS, one would use "group" to select the top-level
attribute, then "subgroup" to select the link type, which is itself a nest,
and then would lack a way to denote which attribute to select out of the
link-type nest.

To that end, add the selector level "suite", which is filtered in the
userspace.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/ipstats.c
man/man8/ip-stats.8

index 5b9333e3e39f6e5f70d6beb13dcdd56fff097213..0e7f2b3c9605187739bdf7cf701638a39317ec11 100644 (file)
@@ -34,6 +34,7 @@ struct ipstats_stat_show_attrs {
 static const char *const ipstats_levels[] = {
        "group",
        "subgroup",
+       "suite",
 };
 
 enum {
@@ -1024,7 +1025,7 @@ static int do_help(void)
 
        fprintf(stderr,
                "Usage: ip stats help\n"
-               "       ip stats show [ dev DEV ] [ group GROUP [ subgroup SUBGROUP ] ... ] ...\n"
+               "       ip stats show [ dev DEV ] [ group GROUP [ subgroup SUBGROUP [ suite SUITE ] ... ] ... ] ...\n"
                "       ip stats set dev DEV l3_stats { on | off }\n"
                );
 
@@ -1048,6 +1049,8 @@ static int do_help(void)
                        continue;
 
                for (j = 0; j < desc->nsubs; j++) {
+                       size_t k;
+
                        if (j == 0)
                                fprintf(stderr, "%s SUBGROUP := {", desc->name);
                        else
@@ -1057,6 +1060,10 @@ static int do_help(void)
 
                        if (desc->subs[j]->kind != IPSTATS_STAT_DESC_KIND_GROUP)
                                continue;
+
+                       for (k = 0; k < desc->subs[j]->nsubs; k++)
+                               fprintf(stderr, " [ suite %s ]",
+                                       desc->subs[j]->subs[k]->name);
                }
                if (opened)
                        fprintf(stderr, " }\n");
index 7eaaf122b8e5497df6d93b29cc65e8eb72632c8a..a82fe9f753c451ec164ecf8cdb3fe1ead86a1b18 100644 (file)
@@ -19,7 +19,8 @@ ip-stats \- manage and show interface statistics
 .RB "[ " group
 .IR GROUP " [ "
 .BI subgroup " SUBGROUP"
-.R " ] ... ] ..."
+.RB " [ " suite
+.IR " SUITE" " ] ... ] ... ] ..."
 
 .ti -8
 .BR "ip stats set"