|
|
930fb9 |
From 1610b7b240601085ea42848e8d86469a091e560c Mon Sep 17 00:00:00 2001
|
|
|
930fb9 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
930fb9 |
Date: Thu, 25 Oct 2018 17:01:52 +0200
|
|
|
930fb9 |
Subject: [PATCH] tc_util: Add support for showing TCA_STATS_BASIC_HW
|
|
|
930fb9 |
statistics
|
|
|
930fb9 |
|
|
|
930fb9 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1637440
|
|
|
930fb9 |
Upstream Status: iproute2.git commit 5ac138324e31c
|
|
|
930fb9 |
|
|
|
930fb9 |
commit 5ac138324e31c75edc65c69cedcf699fb624c113
|
|
|
930fb9 |
Author: Eelco Chaudron <echaudro@redhat.com>
|
|
|
930fb9 |
Date: Tue Oct 2 03:27:18 2018 -0400
|
|
|
930fb9 |
|
|
|
930fb9 |
tc_util: Add support for showing TCA_STATS_BASIC_HW statistics
|
|
|
930fb9 |
|
|
|
930fb9 |
Add support for showing hardware specific counters to easy
|
|
|
930fb9 |
troubleshooting hardware offload.
|
|
|
930fb9 |
|
|
|
930fb9 |
$ tc -s filter show dev enp3s0np0 parent ffff:
|
|
|
930fb9 |
filter protocol ip pref 1 flower chain 0
|
|
|
930fb9 |
filter protocol ip pref 1 flower chain 0 handle 0x1
|
|
|
930fb9 |
eth_type ipv4
|
|
|
930fb9 |
dst_ip 2.0.0.0
|
|
|
930fb9 |
src_ip 1.0.0.0
|
|
|
930fb9 |
ip_flags nofrag
|
|
|
930fb9 |
in_hw
|
|
|
930fb9 |
action order 1: mirred (Egress Redirect to device eth1) stolen
|
|
|
930fb9 |
index 1 ref 1 bind 1 installed 0 sec used 0 sec
|
|
|
930fb9 |
Action statistics:
|
|
|
930fb9 |
Sent 534884742 bytes 8915697 pkt (dropped 0, overlimits 0 requeues 0)
|
|
|
930fb9 |
Sent software 187542 bytes 4077 pkt
|
|
|
930fb9 |
Sent hardware 534697200 bytes 8911620 pkt
|
|
|
930fb9 |
backlog 0b 0p requeues 0
|
|
|
930fb9 |
cookie 89173e6a44447001becfd486bda17e29
|
|
|
930fb9 |
|
|
|
930fb9 |
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
|
|
|
930fb9 |
Signed-off-by: David Ahern <dsahern@gmail.com>
|
|
|
930fb9 |
---
|
|
|
930fb9 |
tc/tc_util.c | 41 +++++++++++++++++++++++++++++++++++++++++
|
|
|
930fb9 |
1 file changed, 41 insertions(+)
|
|
|
930fb9 |
|
|
|
930fb9 |
diff --git a/tc/tc_util.c b/tc/tc_util.c
|
|
|
930fb9 |
index d757852..5a1bbf2 100644
|
|
|
930fb9 |
--- a/tc/tc_util.c
|
|
|
930fb9 |
+++ b/tc/tc_util.c
|
|
|
930fb9 |
@@ -800,6 +800,44 @@ void print_tm(FILE *f, const struct tcf_t *tm)
|
|
|
930fb9 |
}
|
|
|
930fb9 |
}
|
|
|
930fb9 |
|
|
|
930fb9 |
+static void print_tcstats_basic_hw(struct rtattr **tbs, char *prefix)
|
|
|
930fb9 |
+{
|
|
|
930fb9 |
+ struct gnet_stats_basic bs_hw;
|
|
|
930fb9 |
+
|
|
|
930fb9 |
+ if (!tbs[TCA_STATS_BASIC_HW])
|
|
|
930fb9 |
+ return;
|
|
|
930fb9 |
+
|
|
|
930fb9 |
+ memcpy(&bs_hw, RTA_DATA(tbs[TCA_STATS_BASIC_HW]),
|
|
|
930fb9 |
+ MIN(RTA_PAYLOAD(tbs[TCA_STATS_BASIC_HW]), sizeof(bs_hw)));
|
|
|
930fb9 |
+
|
|
|
930fb9 |
+ if (bs_hw.bytes == 0 && bs_hw.packets == 0)
|
|
|
930fb9 |
+ return;
|
|
|
930fb9 |
+
|
|
|
930fb9 |
+ if (tbs[TCA_STATS_BASIC]) {
|
|
|
930fb9 |
+ struct gnet_stats_basic bs;
|
|
|
930fb9 |
+
|
|
|
930fb9 |
+ memcpy(&bs, RTA_DATA(tbs[TCA_STATS_BASIC]),
|
|
|
930fb9 |
+ MIN(RTA_PAYLOAD(tbs[TCA_STATS_BASIC]),
|
|
|
930fb9 |
+ sizeof(bs)));
|
|
|
930fb9 |
+
|
|
|
930fb9 |
+ if (bs.bytes >= bs_hw.bytes && bs.packets >= bs_hw.packets) {
|
|
|
930fb9 |
+ print_string(PRINT_FP, NULL, "%s", _SL_);
|
|
|
930fb9 |
+ print_string(PRINT_FP, NULL, "%s", prefix);
|
|
|
930fb9 |
+ print_lluint(PRINT_ANY, "sw_bytes",
|
|
|
930fb9 |
+ "Sent software %llu bytes",
|
|
|
930fb9 |
+ bs.bytes - bs_hw.bytes);
|
|
|
930fb9 |
+ print_uint(PRINT_ANY, "sw_packets", " %u pkt",
|
|
|
930fb9 |
+ bs.packets - bs_hw.packets);
|
|
|
930fb9 |
+ }
|
|
|
930fb9 |
+ }
|
|
|
930fb9 |
+
|
|
|
930fb9 |
+ print_string(PRINT_FP, NULL, "%s", _SL_);
|
|
|
930fb9 |
+ print_string(PRINT_FP, NULL, "%s", prefix);
|
|
|
930fb9 |
+ print_lluint(PRINT_ANY, "hw_bytes", "Sent hardware %llu bytes",
|
|
|
930fb9 |
+ bs_hw.bytes);
|
|
|
930fb9 |
+ print_uint(PRINT_ANY, "hw_packets", " %u pkt", bs_hw.packets);
|
|
|
930fb9 |
+}
|
|
|
930fb9 |
+
|
|
|
930fb9 |
void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtattr **xstats)
|
|
|
930fb9 |
{
|
|
|
930fb9 |
SPRINT_BUF(b1);
|
|
|
930fb9 |
@@ -826,6 +864,9 @@ void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtat
|
|
|
930fb9 |
print_uint(PRINT_ANY, "requeues", " requeues %u) ", q.requeues);
|
|
|
930fb9 |
}
|
|
|
930fb9 |
|
|
|
930fb9 |
+ if (tbs[TCA_STATS_BASIC_HW])
|
|
|
930fb9 |
+ print_tcstats_basic_hw(tbs, prefix);
|
|
|
930fb9 |
+
|
|
|
930fb9 |
if (tbs[TCA_STATS_RATE_EST64]) {
|
|
|
930fb9 |
struct gnet_stats_rate_est64 re = {0};
|
|
|
930fb9 |
|
|
|
930fb9 |
--
|
|
|
930fb9 |
1.8.3.1
|
|
|
930fb9 |
|