--- /dev/null
+From 1cf667174f8696af711881355253807ed5cd679c Mon Sep 17 00:00:00 2001
+From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+Date: Sat, 18 Jan 2020 19:44:33 +0000
+Subject: [PATCH] cake traffic
+
+Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+---
+ include/uapi/linux/pkt_sched.h | 2 ++
+ tc/q_cake.c | 28 ++++++++++++++++++++++++++++
+ 2 files changed, 30 insertions(+)
+
+--- a/include/uapi/linux/pkt_sched.h
++++ b/include/uapi/linux/pkt_sched.h
+@@ -1141,6 +1141,8 @@ enum {
+ TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS,
+ TCA_CAKE_TIN_STATS_MAX_SKBLEN,
+ TCA_CAKE_TIN_STATS_FLOW_QUANTUM,
++ TCA_CAKE_TIN_STATS_TRAFFIC_BYTES,
++ TCA_CAKE_TIN_STATS_TRAFFIC_TIME,
+ __TCA_CAKE_TIN_STATS_MAX
+ };
+ #define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1)
+--- a/tc/q_cake.c
++++ b/tc/q_cake.c
+@@ -620,6 +620,8 @@ static int cake_print_xstats(struct qdis
+ {
+ struct rtattr *st[TCA_CAKE_STATS_MAX + 1];
+ SPRINT_BUF(b1);
++ __u64 traf_cap;
++ __u32 traf_bps, traf_pct, traf_time;
+ int i;
+
+ if (xstats == NULL)
+@@ -645,10 +647,13 @@ static int cake_print_xstats(struct qdis
+ GET_STAT_U32(MEMORY_LIMIT));
+ }
+
+- if (st[TCA_CAKE_STATS_CAPACITY_ESTIMATE64])
++ traf_cap = 1;
++ if (st[TCA_CAKE_STATS_CAPACITY_ESTIMATE64]) {
+ tc_print_rate(PRINT_ANY, "capacity_estimate",
+ " capacity estimate: %s\n",
+ GET_STAT_U64(CAPACITY_ESTIMATE64));
++ traf_cap = GET_STAT_U64(CAPACITY_ESTIMATE64);
++ }
+
+ if (st[TCA_CAKE_STATS_MIN_NETLEN] &&
+ st[TCA_CAKE_STATS_MAX_NETLEN]) {
+@@ -801,6 +806,30 @@ static int cake_print_xstats(struct qdis
+ PRINT_TSTAT_U32(" pkts ", SENT_PACKETS);
+ PRINT_TSTAT_U64(" bytes ", SENT_BYTES64);
+
++ fprintf(f, " traffic%%");
++ for (i = 0; i < num_tins; i++) {
++ traf_bps = rta_getattr_u32(GET_TSTAT(i, TRAFFIC_BYTES));
++ traf_time = rta_getattr_u32(GET_TSTAT(i, TRAFFIC_TIME));
++ traf_pct = 0;
++ if (traf_time)
++ traf_pct = ((traf_bps * 1000ULL) / traf_time) * 100ULL / traf_cap;
++ fprintf(f, " %12u", traf_pct);
++ }
++ fprintf(f, "\n");
++
++ fprintf(f, " traftin%%");
++ for (i = 0; i < num_tins; i++) {
++ traf_bps = rta_getattr_u32(GET_TSTAT(i, TRAFFIC_BYTES));
++ traf_time = rta_getattr_u32(GET_TSTAT(i, TRAFFIC_TIME));
++ traf_cap = rta_getattr_u64(GET_TSTAT(i, THRESHOLD_RATE64));
++
++ traf_pct = 0;
++ if (traf_time)
++ traf_pct = ((traf_bps * 1000ULL) / traf_time) * 100ULL / traf_cap;
++ fprintf(f, " %12u", traf_pct);
++ }
++ fprintf(f, "\n");
++
+ PRINT_TSTAT_U32(" way_inds", WAY_INDIRECT_HITS);
+ PRINT_TSTAT_U32(" way_miss", WAY_MISSES);
+ PRINT_TSTAT_U32(" way_cols", WAY_COLLISIONS);
--- /dev/null
+From 69fa00eeb9e7a700ae3a8b5e9b4d1908d418796c Mon Sep 17 00:00:00 2001
+From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+Date: Sun, 19 Jan 2020 09:13:22 +0000
+Subject: [PATCH] traffic stats
+
+Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+---
+ include/uapi/linux/pkt_sched.h | 2 ++
+ net/sched/sch_cake.c | 13 ++++++++++++-
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+--- a/include/uapi/linux/pkt_sched.h
++++ b/include/uapi/linux/pkt_sched.h
+@@ -1146,6 +1146,8 @@ enum {
+ TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS,
+ TCA_CAKE_TIN_STATS_MAX_SKBLEN,
+ TCA_CAKE_TIN_STATS_FLOW_QUANTUM,
++ TCA_CAKE_TIN_STATS_TRAFFIC_BYTES,
++ TCA_CAKE_TIN_STATS_TRAFFIC_TIME,
+ __TCA_CAKE_TIN_STATS_MAX
+ };
+ #define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1)
+--- a/net/sched/sch_cake.c
++++ b/net/sched/sch_cake.c
+@@ -181,6 +181,8 @@ struct cake_tin_data {
+
+ u32 packets;
+ u64 bytes;
++ u64 prev_bytes;
++ ktime_t prev_time;
+
+ u32 ack_drops;
+
+@@ -2848,6 +2850,8 @@ static int cake_dump_stats(struct Qdisc
+ struct nlattr *stats = nla_nest_start_noflag(d->skb, TCA_STATS_APP);
+ struct cake_sched_data *q = qdisc_priv(sch);
+ struct nlattr *tstats, *ts;
++ ktime_t now;
++ u64 tin_bytes;
+ int i;
+
+ if (!stats)
+@@ -2897,7 +2901,14 @@ static int cake_dump_stats(struct Qdisc
+ goto nla_put_failure;
+
+ PUT_TSTAT_U64(THRESHOLD_RATE64, b->tin_rate_bps);
+- PUT_TSTAT_U64(SENT_BYTES64, b->bytes);
++ tin_bytes = b->bytes;
++ now = ktime_get();
++ PUT_TSTAT_U64(SENT_BYTES64, tin_bytes);
++ PUT_TSTAT_U32(TRAFFIC_BYTES, (u32)(tin_bytes - b->prev_bytes));
++ b->prev_bytes = tin_bytes;
++ PUT_TSTAT_U32(TRAFFIC_TIME, ktime_ms_delta(now, b->prev_time));
++ b->prev_time = now;
++
+ PUT_TSTAT_U32(BACKLOG_BYTES, b->tin_backlog);
+
+ PUT_TSTAT_U32(TARGET_US,
--- /dev/null
+From 69fa00eeb9e7a700ae3a8b5e9b4d1908d418796c Mon Sep 17 00:00:00 2001
+From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+Date: Sun, 19 Jan 2020 09:13:22 +0000
+Subject: [PATCH] traffic stats
+
+Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+---
+ include/uapi/linux/pkt_sched.h | 2 ++
+ net/sched/sch_cake.c | 13 ++++++++++++-
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+--- a/include/uapi/linux/pkt_sched.h
++++ b/include/uapi/linux/pkt_sched.h
+@@ -1146,6 +1146,8 @@ enum {
+ TCA_CAKE_TIN_STATS_UNRESPONSIVE_FLOWS,
+ TCA_CAKE_TIN_STATS_MAX_SKBLEN,
+ TCA_CAKE_TIN_STATS_FLOW_QUANTUM,
++ TCA_CAKE_TIN_STATS_TRAFFIC_BYTES,
++ TCA_CAKE_TIN_STATS_TRAFFIC_TIME,
+ __TCA_CAKE_TIN_STATS_MAX
+ };
+ #define TCA_CAKE_TIN_STATS_MAX (__TCA_CAKE_TIN_STATS_MAX - 1)
+--- a/net/sched/sch_cake.c
++++ b/net/sched/sch_cake.c
+@@ -181,6 +181,8 @@ struct cake_tin_data {
+
+ u32 packets;
+ u64 bytes;
++ u64 prev_bytes;
++ ktime_t prev_time;
+
+ u32 ack_drops;
+
+@@ -2848,6 +2850,8 @@ static int cake_dump_stats(struct Qdisc
+ struct nlattr *stats = nla_nest_start_noflag(d->skb, TCA_STATS_APP);
+ struct cake_sched_data *q = qdisc_priv(sch);
+ struct nlattr *tstats, *ts;
++ ktime_t now;
++ u64 tin_bytes;
+ int i;
+
+ if (!stats)
+@@ -2897,7 +2901,14 @@ static int cake_dump_stats(struct Qdisc
+ goto nla_put_failure;
+
+ PUT_TSTAT_U64(THRESHOLD_RATE64, b->tin_rate_bps);
+- PUT_TSTAT_U64(SENT_BYTES64, b->bytes);
++ tin_bytes = b->bytes;
++ now = ktime_get();
++ PUT_TSTAT_U64(SENT_BYTES64, tin_bytes);
++ PUT_TSTAT_U32(TRAFFIC_BYTES, (u32)(tin_bytes - b->prev_bytes));
++ b->prev_bytes = tin_bytes;
++ PUT_TSTAT_U32(TRAFFIC_TIME, ktime_ms_delta(now, b->prev_time));
++ b->prev_time = now;
++
+ PUT_TSTAT_U32(BACKLOG_BYTES, b->tin_backlog);
+
+ PUT_TSTAT_U32(TARGET_US,