tc: fq_pie: add per-flow class statistics support
Subsystems (3)
v4 cover tc: fq_pie: add per-flow class statistics support
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/[email protected]/
---
Changelog:
v4:
- 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/[email protected]/
- Moved print_nl() into each xstats type block to preserve output formatting.
v2: https://lore.kernel.org/netdev/[email protected]/
- Addressed ABI backward compatibility issue.
v1: https://lore.kernel.org/netdev/[email protected]/
- Initial submission
Hemendra M. Naik (3):
tc: fq_pie: add support for printing per-flow PIE statistics
tc: pie: print avg_dq_rate in human-readable format
tc: correct tc_pie_xstats field documentation
include/uapi/linux/pkt_sched.h | 29 +++++++++++++++-- man/man8/tc-fq_pie.8 | 18 +++++++++++ man/man8/tc-pie.8 | 2 +- tc/q_fq_pie.c | 59 +++++++++++++++++++++++----------- tc/q_pie.c | 4 +-- 5 files changed, 88 insertions(+), 24 deletions(-)
Signature · 1 line
2.34.1
PATCH v4 1/3 tc: fq_pie: add support for printing per-flow PIE statistics
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.
Update the UAPI header to mirror tc_fq_pie_cl_stats from the kernel.
Add tc -s class show examples to tc-fq_pie(8) demonstrating the new per-flow statistics with and without dq_rate_estimator enabled.
--- include/uapi/linux/pkt_sched.h | 25 ++++++++++++++ man/man8/tc-fq_pie.8 | 18 +++++++++++ tc/q_fq_pie.c | 59 +++++++++++++++++++++++----------- 3 files changed, 83 insertions(+), 19 deletions(-)
include/uapi/linux/pkt_sched.h +25 -0
@@ -953,6 +953,25 @@ enum { };#define TCA_FQ_PIE_MAX (__TCA_FQ_PIE_MAX - 1) +enum { +TCA_FQ_PIE_XSTATS_QDISC , +TCA_FQ_PIE_XSTATS_CLASS , +}; + +struct tc_fq_pie_cl_stats { +__u64 prob;/* current probability */ +__u32 delay;/* current delay in microseconds */ +__s32 deficit;/* number of remaining byte credits */ +__u32 avg_dq_rate;/* current average dq_rate in +* bytes/second +*/ +__u32 dq_rate_estimating;/* is avg_dq_rate being calculated? */ +}; + +struct tc_fq_pie_xqd_stats { +/* placeholder for new qdisc-level stats */ +}; +struct tc_fq_pie_xstats {__u32 packets_in;/* total number of packets enqueued */ __u32 dropped;/* packets dropped due to fq_pie_action */
@@ -963,6 +982,12 @@ struct tc_fq_pie_xstats {__u32 new_flows_len;/* count of flows in new list */ __u32 old_flows_len;/* count of flows in old list */ __u32 memory_usage;/* total memory across all queues */ +__u32 type; +union { +struct tc_fq_pie_cl_stats class_stats; +struct tc_fq_pie_xqd_stats xqdisc_stats; + }; + };/* CBS */
man/man8/tc-fq_pie.8 +18 -0
@@ -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),
tc/q_fq_pie.c +40 -19
71 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v4 2/3 tc: pie: print avg_dq_rate in human-readable format
In reply to Hemendra M. NaikPrint 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.
--- man/man8/tc-pie.8 | 2 +- tc/q_pie.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
man/man8/tc-pie.8 +1 -1
@@ -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
tc/q_pie.c +2 -2
@@ -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);
Signature · 1 line
2.34.1
PATCH v4 3/3 tc: correct tc_pie_xstats field documentation
In reply to Hemendra M. NaikCorrect the comments describing the delay and avg_dq_rate fields in struct tc_pie_xstats to match the values exported by the kernel.
Update the delay field comment to indicate that the value is reported in microseconds, matching the PSCHED_TICKS2NS() / NSEC_PER_USEC conversion.
Similarly, update the avg_dq_rate field comment to indicate that the value is reported in bytes/second, matching the conversion performed by avg_dq_rate * PSCHED_TICKS_PER_SEC >> PIE_SCALE.
These are documentation-only changes and do not affect the UAPI or runtime behavior.
--- include/uapi/linux/pkt_sched.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/pkt_sched.h +2 -2
@@ -920,9 +920,9 @@ enum {struct tc_pie_xstats {__u64 prob;/* current probability */ -__u32 delay;/* current delay in ms */ +__u32 delay;/* current delay in microseconds */ __u32 avg_dq_rate;/* current average dq_rate in -* bits/pie_time +* bytes/second */ __u32 dq_rate_estimating;/* is avg_dq_rate being calculated? */ __u32 packets_in;/* total number of packets enqueued */
Signature · 1 line
2.34.1