* [PATCH iproute2] tc_util: support TCA_STATS_PKT64 attribute
@ 2019-12-03 15:47 Eric Dumazet
2019-12-04 18:58 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2019-12-03 15:47 UTC (permalink / raw)
To: David Ahern, Stephen Hemminger; +Cc: netdev, Eric Dumazet, Eric Dumazet
Kernel exports 64bit packet counters for qdisc/class stats in linux-5.5
Tested:
$ tc -s -d qd sh dev eth1 | grep pkt
Sent 4041158922097 bytes 46393862190 pkt (dropped 0, overlimits 0 requeues 2072)
Sent 501362903764 bytes 5762621697 pkt (dropped 0, overlimits 0 requeues 247)
Sent 533282357858 bytes 6128246542 pkt (dropped 0, overlimits 0 requeues 329)
Sent 515878280709 bytes 5875638916 pkt (dropped 0, overlimits 0 requeues 267)
Sent 516221011694 bytes 5933395197 pkt (dropped 0, overlimits 0 requeues 258)
Sent 513175109761 bytes 5898402114 pkt (dropped 0, overlimits 0 requeues 231)
Sent 480207942964 bytes 5519535407 pkt (dropped 0, overlimits 0 requeues 229)
Sent 483111196765 bytes 5552917950 pkt (dropped 0, overlimits 0 requeues 240)
Sent 497920120322 bytes 5723104387 pkt (dropped 0, overlimits 0 requeues 271)
$ tc -s -d cl sh dev eth1 | grep pkt
Sent 513196316238 bytes 5898645862 pkt (dropped 0, overlimits 0 requeues 231)
Sent 533304444981 bytes 6128500406 pkt (dropped 0, overlimits 0 requeues 329)
Sent 480227709687 bytes 5519762597 pkt (dropped 0, overlimits 0 requeues 229)
Sent 501383660279 bytes 5762860276 pkt (dropped 0, overlimits 0 requeues 247)
Sent 483131168192 bytes 5553147506 pkt (dropped 0, overlimits 0 requeues 240)
Sent 515899485505 bytes 5875882649 pkt (dropped 0, overlimits 0 requeues 267)
Sent 497940747031 bytes 5723341475 pkt (dropped 0, overlimits 0 requeues 271)
Sent 516242376893 bytes 5933640774 pkt (dropped 0, overlimits 0 requeues 258)
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
tc/tc_util.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tc/tc_util.c b/tc/tc_util.c
index afdfc78f2e5b11af178bdf1db540d917b1f457f3..23115f9b950a8786453fad25be4244ff7c3bdd76 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -809,11 +809,18 @@ void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtat
if (tbs[TCA_STATS_BASIC]) {
struct gnet_stats_basic bs = {0};
+ __u64 packets64 = 0;
+
+ if (tbs[TCA_STATS_PKT64])
+ packets64 = rta_getattr_u64(tbs[TCA_STATS_PKT64]);
memcpy(&bs, RTA_DATA(tbs[TCA_STATS_BASIC]), MIN(RTA_PAYLOAD(tbs[TCA_STATS_BASIC]), sizeof(bs)));
print_string(PRINT_FP, NULL, "%s", prefix);
print_lluint(PRINT_ANY, "bytes", "Sent %llu bytes", bs.bytes);
- print_uint(PRINT_ANY, "packets", " %u pkt", bs.packets);
+ if (packets64)
+ print_lluint(PRINT_ANY, "packets", " %llu pkt", packets64);
+ else
+ print_uint(PRINT_ANY, "packets", " %u pkt", bs.packets);
}
if (tbs[TCA_STATS_QUEUE]) {
--
2.24.0.393.g34dc348eaf-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] tc_util: support TCA_STATS_PKT64 attribute
2019-12-03 15:47 [PATCH iproute2] tc_util: support TCA_STATS_PKT64 attribute Eric Dumazet
@ 2019-12-04 18:58 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2019-12-04 18:58 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Ahern, netdev, Eric Dumazet
On Tue, 3 Dec 2019 07:47:01 -0800
Eric Dumazet <edumazet@google.com> wrote:
> Kernel exports 64bit packet counters for qdisc/class stats in linux-5.5
>
> Tested:
>
> $ tc -s -d qd sh dev eth1 | grep pkt
> Sent 4041158922097 bytes 46393862190 pkt (dropped 0, overlimits 0 requeues 2072)
> Sent 501362903764 bytes 5762621697 pkt (dropped 0, overlimits 0 requeues 247)
> Sent 533282357858 bytes 6128246542 pkt (dropped 0, overlimits 0 requeues 329)
> Sent 515878280709 bytes 5875638916 pkt (dropped 0, overlimits 0 requeues 267)
> Sent 516221011694 bytes 5933395197 pkt (dropped 0, overlimits 0 requeues 258)
> Sent 513175109761 bytes 5898402114 pkt (dropped 0, overlimits 0 requeues 231)
> Sent 480207942964 bytes 5519535407 pkt (dropped 0, overlimits 0 requeues 229)
> Sent 483111196765 bytes 5552917950 pkt (dropped 0, overlimits 0 requeues 240)
> Sent 497920120322 bytes 5723104387 pkt (dropped 0, overlimits 0 requeues 271)
> $ tc -s -d cl sh dev eth1 | grep pkt
> Sent 513196316238 bytes 5898645862 pkt (dropped 0, overlimits 0 requeues 231)
> Sent 533304444981 bytes 6128500406 pkt (dropped 0, overlimits 0 requeues 329)
> Sent 480227709687 bytes 5519762597 pkt (dropped 0, overlimits 0 requeues 229)
> Sent 501383660279 bytes 5762860276 pkt (dropped 0, overlimits 0 requeues 247)
> Sent 483131168192 bytes 5553147506 pkt (dropped 0, overlimits 0 requeues 240)
> Sent 515899485505 bytes 5875882649 pkt (dropped 0, overlimits 0 requeues 267)
> Sent 497940747031 bytes 5723341475 pkt (dropped 0, overlimits 0 requeues 271)
> Sent 516242376893 bytes 5933640774 pkt (dropped 0, overlimits 0 requeues 258)
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> tc/tc_util.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-04 18:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 15:47 [PATCH iproute2] tc_util: support TCA_STATS_PKT64 attribute Eric Dumazet
2019-12-04 18:58 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).