aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2022-05-09 15:59:58 +0200
committerDavid Ahern <dsahern@kernel.org>2022-05-12 11:08:16 -0600
commitc6900b79b13d7bc329955b4f9e8c7470d42ae2fa (patch)
treef0a0ca68fbff3d820ab0b1f421c2e1bb3dead68c
parent2ed73b9a80d8291359d477caafab5defca113c58 (diff)
downloadiproute2-c6900b79b13d7bc329955b4f9e8c7470d42ae2fa.tar.gz
ipstats: Add a third level of stats hierarchy, a "suite"
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>
-rw-r--r--ip/ipstats.c9
-rw-r--r--man/man8/ip-stats.83
2 files changed, 10 insertions, 2 deletions
diff --git a/ip/ipstats.c b/ip/ipstats.c
index 5b9333e3e..0e7f2b3c9 100644
--- a/ip/ipstats.c
+++ b/ip/ipstats.c
@@ -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");
diff --git a/man/man8/ip-stats.8 b/man/man8/ip-stats.8
index 7eaaf122b..a82fe9f75 100644
--- a/man/man8/ip-stats.8
+++ b/man/man8/ip-stats.8
@@ -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"