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: <20230607125441.3819767-1-vladimir.oltean@nxp.com>
Date: Wed,  7 Jun 2023 15:54:41 +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 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>
---
 tc/q_taprio.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tc/q_taprio.c b/tc/q_taprio.c
index bc29710c4686..359c4c03b8c6 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 *st[TCA_TAPRIO_OFFLOAD_STATS_MAX + 1], *nla;
+
+	if (!xstats)
+		return 0;
+
+	parse_rtattr_nested(st, TCA_TAPRIO_OFFLOAD_STATS_MAX, xstats);
+
+	nla = st[TCA_TAPRIO_OFFLOAD_STATS_WINDOW_DROPS];
+	if (nla)
+		print_lluint(PRINT_ANY, "window-drops", " Window drops: %llu",
+			     rta_getattr_u64(nla));
+
+	nla = st[TCA_TAPRIO_OFFLOAD_STATS_TX_OVERRUNS];
+	if (nla)
+		print_lluint(PRINT_ANY, "tx-overruns", " Transmit 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