Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by "Hemendra M. Naik"
Mon, 09 Nov 2026 07:17
[PATCH iproute2-next v9 0/2] tc: fq_pie: add per-flow class statistics support
Author: "Hemendra M. Naik"
Date: Mon, 09 Nov 2026 07:17
Date: Mon, 09 Nov 2026 07:17
60 lines
12858 bytes
12858 bytes
FQ-PIE exposes no per-flow AQM state in userspace today. This series adds tc support for printing per-flow statistics via 'tc -s class show', matching the kernel fq_pie class ops series. The corresponding kernel series can be viewed here: https://lore.kernel.org/netdev/20261109071017.438478-1-hemendranaik@gmail.com/ Both the kernel and iproute2 patches can also be found in GitHub: - https://github.com/H-N41K/linux-net-next/tree/fq_pie_class_stats/ - https://github.com/H-N41K/iproute2-next/tree/fq_pie_class_stats/ --- Changelog: v9: - No code changes since v8. - Rebased and reposted patch since corresponding kernel series was reposted. v8: - No code changes since v7. - Rebased and reposted patch since corresponding kernel series was reposted. v7: https://lore.kernel.org/all/20260922211139.38570-1-hemendranaik@gmail.com/ - Removed UAPI header changes. The series now contains 2 commits. v6: https://lore.kernel.org/netdev/20260919061254.39678-1-hemendranaik@gmail.com/ - No code changes since v5. - Rebased over the latest iproute2-next tree and re-submitted patch. v5: https://lore.kernel.org/netdev/20260902040221.83734-1-hemendranaik@gmail.com/ - Addressed Sashiko review comments (folded into patch 1/3): - Dropped empty tc_fq_pie_xqd_stats placeholder; class_stats is now a direct struct member in the UAPI header. v4: https://lore.kernel.org/netdev/20260727165028.106817-1-hemendranaik@gmail.com/ - Split into 3 patches: fq_pie class stats, pie avg_dq_rate formatting, and tc_pie_xstats comment fixes. v3: https://lore.kernel.org/netdev/20260630184453.171410-1-hemendranaik@gmail.com/ - Moved print_nl() into each xstats type block to preserve output formatting. v2: https://lore.kernel.org/netdev/20260614130729.10076-1-hemendranaik@gmail.com/ - Addressed ABI backward compatibility issue. v1: https://lore.kernel.org/netdev/20260531131411.28213-1-hemendranaik@gmail.com/ - Initial submission Hemendra M. Naik (2): tc: fq_pie: add support for printing per-flow PIE statistics tc: pie: print avg_dq_rate in human-readable format man/man8/tc-fq_pie.8 | 18 ++++++++++++++ man/man8/tc-pie.8 | 2 +- tc/q_fq_pie.c | 59 ++++++++++++++++++++++++++++++-------------- tc/q_pie.c | 4 +-- 4 files changed, 61 insertions(+), 22 deletions(-) -- 2.34.1
[PATCH iproute2-next v9 1/2] tc: fq_pie: add support for printing per-flow PIE statistics
Author: "Hemendra M. Naik"
Date: Mon, 09 Nov 2026 07:17
Date: Mon, 09 Nov 2026 07:17
134 lines
15465 bytes
15465 bytes
`tc -s class show` for an fq_pie qdisc now prints the following
per-flow PIE statistics:
prob drop probability for the flow
delay per-flow queue sojourn time (microseconds)
deficit remaining DRR byte credits (signed integer)
avg_dq_rate dequeue rate estimate in bytes/second
(dq_rate_estimator mode only)
avg_dq_rate is formatted using tc_print_rate(), which converts the
kernel's bytes/second value to a human-readable bits/second string
(e.g. 3906Kbit), consistent with how other tc schedulers display
rate fields.
Add `tc -s class show` examples to tc-fq_pie(8) demonstrating the new
per-flow statistics with and without dq_rate_estimator enabled.
Signed-off-by: Hemendra M. Naik <hemendranaik@gmail.com>
Signed-off-by: Vishal Kamath <vishy0777@gmail.com>
Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
---
man/man8/tc-fq_pie.8 | 18 ++++++++++++++
tc/q_fq_pie.c | 59 ++++++++++++++++++++++++++++++--------------
2 files changed, 58 insertions(+), 19 deletions(-)
diff --git a/man/man8/tc-fq_pie.8 b/man/man8/tc-fq_pie.8
index 457a56bb..8027783c 100644
--- a/man/man8/tc-fq_pie.8
+++ b/man/man8/tc-fq_pie.8
@@ -153,6 +153,24 @@ dq_rate_estimator
pkts_in 6082 overlimit 0 overmemory 0 dropped 4 ecn_mark 0
new_flow_count 94 new_flows_len 0 old_flows_len 8 memory_used 1157632
+# tc qdisc add dev eth0 parent 100:1 handle 200: fq_pie target 2ms flows 3
+.br
+# tc -s class show dev eth0
+.br
+class fq_pie 200:2 parent 200:
+ Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
+ backlog 22800b 2p requeues 0
+ prob 0.57679 delay 2.38ms deficit -52
+
+# tc qdisc add dev eth0 parent 100:1 handle 200: fq_pie target 2ms flows 3 dq_rate_estimator
+.br
+# tc -s class show dev eth0
+.br
+class fq_pie 200:2 parent 200:
+ Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
+ backlog 22800b 2p requeues 0
+ prob 0.57679 delay 2.38ms deficit -52 avg_dq_rate 10742Kbit
+
.SH SEE ALSO
.BR tc (8),
.BR tc-pie (8),
diff --git a/tc/q_fq_pie.c b/tc/q_fq_pie.c
index dc2710cd..0c85e17f 100644
--- a/tc/q_fq_pie.c
+++ b/tc/q_fq_pie.c
@@ -274,6 +274,8 @@ static int fq_pie_print_xstats(const struct qdisc_util *qu, FILE *f,
{
struct tc_fq_pie_xstats _st = {}, *st;
+ SPRINT_BUF(b1);
+
if (xstats == NULL)
return 0;
@@ -283,25 +285,44 @@ static int fq_pie_print_xstats(const struct qdisc_util *qu, FILE *f,
st = &_st;
}
- print_uint(PRINT_ANY, "pkts_in", " pkts_in %u",
- st->packets_in);
- print_uint(PRINT_ANY, "overlimit", " overlimit %u",
- st->overlimit);
- print_uint(PRINT_ANY, "overmemory", " overmemory %u",
- st->overmemory);
- print_uint(PRINT_ANY, "dropped", " dropped %u",
- st->dropped);
- print_uint(PRINT_ANY, "ecn_mark", " ecn_mark %u",
- st->ecn_mark);
- print_nl();
- print_uint(PRINT_ANY, "new_flow_count", " new_flow_count %u",
- st->new_flow_count);
- print_uint(PRINT_ANY, "new_flows_len", " new_flows_len %u",
- st->new_flows_len);
- print_uint(PRINT_ANY, "old_flows_len", " old_flows_len %u",
- st->old_flows_len);
- print_uint(PRINT_ANY, "memory_used", " memory_used %u",
- st->memory_usage);
+ if (!st->type || st->type == TCA_FQ_PIE_XSTATS_QDISC) {
+ print_uint(PRINT_ANY, "pkts_in", " pkts_in %u",
+ st->packets_in);
+ print_uint(PRINT_ANY, "overlimit", " overlimit %u",
+ st->overlimit);
+ print_uint(PRINT_ANY, "overmemory", " overmemory %u",
+ st->overmemory);
+ print_uint(PRINT_ANY, "dropped", " dropped %u",
+ st->dropped);
+ print_uint(PRINT_ANY, "ecn_mark", " ecn_mark %u",
+ st->ecn_mark);
+ print_nl();
+ print_uint(PRINT_ANY, "new_flow_count", " new_flow_count %u",
+ st->new_flow_count);
+ print_uint(PRINT_ANY, "new_flows_len", " new_flows_len %u",
+ st->new_flows_len);
+ print_uint(PRINT_ANY, "old_flows_len", " old_flows_len %u",
+ st->old_flows_len);
+ print_uint(PRINT_ANY, "memory_used", " memory_used %u",
+ st->memory_usage);
+ print_nl();
+ }
+
+ if (st->type == TCA_FQ_PIE_XSTATS_CLASS) {
+ print_float(PRINT_ANY, "prob", " prob %lg",
+ (double)st->class_stats.prob / (double)UINT64_MAX);
+ print_uint(PRINT_JSON, "delay", NULL, st->class_stats.delay);
+ print_string(PRINT_FP, NULL, " delay %s",
+ sprint_time(st->class_stats.delay, b1));
+ print_int(PRINT_ANY, "deficit", " deficit %d",
+ st->class_stats.deficit);
+
+ if (st->class_stats.dq_rate_estimating) {
+ tc_print_rate(PRINT_ANY, "avg_dq_rate", " avg_dq_rate %s",
+ st->class_stats.avg_dq_rate);
+ }
+ print_nl();
+ }
return 0;
--
2.34.1
[PATCH iproute2-next v9 2/2] tc: pie: print avg_dq_rate in human-readable format
Author: "Hemendra M. Naik"
Date: Mon, 09 Nov 2026 07:17
Date: Mon, 09 Nov 2026 07:17
48 lines
12561 bytes
12561 bytes
Print avg_dq_rate using tc_print_rate() instead of displaying the
raw bytes/second value.
This converts the kernel-provided rate to a human-readable bits/second
string (for example, 10742Kbit), consistent with how other tc
schedulers display rate statistics.
Update the tc-pie(8) example to match the new output format.
Signed-off-by: Hemendra M. Naik <hemendranaik@gmail.com>
Signed-off-by: Vishal Kamath <vishy0777@gmail.com>
Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
---
man/man8/tc-pie.8 | 2 +-
tc/q_pie.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/man8/tc-pie.8 b/man/man8/tc-pie.8
index 5a8c7820..ec0d4af2 100644
--- a/man/man8/tc-pie.8
+++ b/man/man8/tc-pie.8
@@ -115,7 +115,7 @@ is turned off.
qdisc pie 8036: dev eth0 root refcnt 2 limit 1000p target 15.0ms tupdate 16.0ms alpha 2 beta 20
Sent 63947420 bytes 42414 pkt (dropped 41, overlimits 0 requeues 0)
backlog 271006b 179p requeues 0
- prob 0.000092 delay 22200us avg_dq_rate 12145996
+ prob 0.000092 delay 22200us avg_dq_rate 10742Kbit
pkts_in 41 overlimit 343 dropped 0 maxq 50 ecn_mark 0
# tc qdisc add dev eth0 root pie limit 100 target 20ms tupdate 30ms ecn
diff --git a/tc/q_pie.c b/tc/q_pie.c
index 04c9aa61..97690d49 100644
--- a/tc/q_pie.c
+++ b/tc/q_pie.c
@@ -220,8 +220,8 @@ static int pie_print_xstats(const struct qdisc_util *qu, FILE *f,
print_string(PRINT_FP, NULL, " delay %s", sprint_time(st->delay, b1));
if (st->dq_rate_estimating)
- print_uint(PRINT_ANY, "avg_dq_rate", " avg_dq_rate %u",
- st->avg_dq_rate);
+ tc_print_rate(PRINT_ANY, "avg_dq_rate", " avg_dq_rate %s",
+ st->avg_dq_rate);
print_nl();
print_uint(PRINT_ANY, "pkts_in", " pkts_in %u", st->packets_in);
--
2.34.1
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads