From: Vladimir Oltean Date: Wed, 7 Jun 2023 15:45:04 +0000 (+0300) Subject: tc/taprio: print the offload xstats X-Git-Tag: v6.5.0~33^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=559ffd9e21bf6d29d704cea3dbe38fbaac310f43;p=thirdparty%2Fiproute2.git tc/taprio: print the offload xstats When the kernel reports offload counters through TCA_STATS2 -> TCA_STATS_APP for the taprio qdisc, decode and print them. Usage: # Global stats $ tc -s qdisc show dev eth0 root # Per-tc stats $ tc -s class show dev eth0 Signed-off-by: Vladimir Oltean Signed-off-by: David Ahern --- diff --git a/tc/q_taprio.c b/tc/q_taprio.c index bc29710c4..65d0a30bd 100644 --- a/tc/q_taprio.c +++ b/tc/q_taprio.c @@ -649,8 +649,32 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) return 0; } +static int taprio_print_xstats(struct qdisc_util *qu, FILE *f, + struct rtattr *xstats) +{ + struct rtattr *tb[TCA_TAPRIO_OFFLOAD_STATS_MAX + 1], *nla; + + if (!xstats) + return 0; + + parse_rtattr_nested(tb, TCA_TAPRIO_OFFLOAD_STATS_MAX, xstats); + + nla = tb[TCA_TAPRIO_OFFLOAD_STATS_WINDOW_DROPS]; + if (nla) + print_lluint(PRINT_ANY, "window_drops", " window_drops %llu", + rta_getattr_u64(nla)); + + nla = tb[TCA_TAPRIO_OFFLOAD_STATS_TX_OVERRUNS]; + if (nla) + print_lluint(PRINT_ANY, "tx_overruns", " tx_overruns %llu", + rta_getattr_u64(nla)); + + return 0; +} + struct qdisc_util taprio_qdisc_util = { .id = "taprio", .parse_qopt = taprio_parse_opt, .print_qopt = taprio_print_opt, + .print_xstats = taprio_print_xstats, };