Skip to content

Commit 29f834a

Browse files
Eric DumazetPaolo Abeni
authored andcommitted
net_sched: sch_fq: add 3 bands and WRR scheduling
Before Google adopted FQ for its production servers, we had to ensure AF4 packets would get a higher share than BE1 ones. As discussed this week in Netconf 2023 in Paris, it is time to upstream this for public use. After this patch FQ can replace pfifo_fast, with the following differences : - FQ uses WRR instead of strict prio, to avoid starvation of low priority packets. - We make sure each band/prio tracks its own usage against sch->limit. This was done to make sure flood of low priority packets would not prevent AF4 packets to be queued. Contributed by Willem. - priomap can be changed, if needed (default value are the ones coming from pfifo_fast). In this patch, we set default band weights so that : - high prio (band=0) packets get 90% of the bandwidth if they compete with low prio (band=2) packets. - high prio packets get 75% of the bandwidth if they compete with medium prio (band=1) packets. Following patch in this series adds the possibility to tune the per-band weights. As we added many fields in 'struct fq_sched_data', we had to make sure to have the first cache line read-mostly, and avoid wasting precious cache lines. More optimizations are possible but will be sent separately. Signed-off-by: Eric Dumazet <[email protected]> Acked-by: Dave Taht <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Acked-by: Soheil Hassas Yeganeh <[email protected]> Reviewed-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 5579ee4 commit 29f834a

File tree

2 files changed

+171
-44
lines changed

2 files changed

+171
-44
lines changed

include/uapi/linux/pkt_sched.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,15 +941,19 @@ enum {
941941

942942
TCA_FQ_HORIZON_DROP, /* drop packets beyond horizon, or cap their EDT */
943943

944+
TCA_FQ_PRIOMAP, /* prio2band */
945+
944946
__TCA_FQ_MAX
945947
};
946948

947949
#define TCA_FQ_MAX (__TCA_FQ_MAX - 1)
948950

951+
#define FQ_BANDS 3
952+
949953
struct tc_fq_qd_stats {
950954
__u64 gc_flows;
951-
__u64 highprio_packets;
952-
__u64 tcp_retrans;
955+
__u64 highprio_packets; /* obsolete */
956+
__u64 tcp_retrans; /* obsolete */
953957
__u64 throttled;
954958
__u64 flows_plimit;
955959
__u64 pkts_too_long;
@@ -963,6 +967,9 @@ struct tc_fq_qd_stats {
963967
__u64 horizon_drops;
964968
__u64 horizon_caps;
965969
__u64 fastpath_packets;
970+
__u64 band_drops[FQ_BANDS];
971+
__u32 band_pkt_count[FQ_BANDS];
972+
__u32 pad;
966973
};
967974

968975
/* Heavy-Hitter Filter */

0 commit comments

Comments
 (0)