lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230607154504.4085041-1-vladimir.oltean@nxp.com>
Date: Wed,  7 Jun 2023 18:45:04 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org
Cc: David Ahern <dsahern@...nel.org>,
	Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH v2 iproute2-next] 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 <vladimir.oltean@....com>
---
v1->v2:
- s/st/tb/ for consistency with the rest of q_taprio.c
- name counters tx_overruns and window_drops for consistency with the
  printing style of other Qdiscs

 tc/q_taprio.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tc/q_taprio.c b/tc/q_taprio.c
index bc29710c4686..65d0a30bd67f 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,
 };
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ