History

fq_codel: implement L4S style ce_threshold_ect1 marking

Add TCA_FQ_CODEL_CE_THRESHOLD_ECT1 boolean option to select Low Latency, Low Loss, Scalable Throughput (L4S) style marking, along with ce_threshold. If enabled, only packets with ECT(1) can be transformed to CE if their sojourn time is above the ce_threshold. Note that this new option does not change rules for codel law. In particular, if TCA_FQ_CODEL_ECN is left enabled (this is the default when fq_codel qdisc is created), ECT(0) packets can still get CE if codel law (as governed by limit/target) decides so. Section 4.3.b of current draft [1] states: b. A scheduler with per-flow queues such as FQ-CoDel or FQ-PIE can be used for L4S. For instance within each queue of an FQ-CoDel system, as well as a CoDel AQM, there is typically also ECN marking at an immediate (unsmoothed) shallow threshold to support use in data centres (see Sec.5.2.7 of [RFC8290]). This can be modified so that the shallow threshold is solely applied to ECT(1) packets. Then if there is a flow of non-ECN or ECT(0) packets in the per-flow-queue, the Classic AQM (e.g. CoDel) is applied; while if there is a flow of ECT(1) packets in the queue, the shallower (typically sub-millisecond) threshold is applied. Tested: tc qd replace dev eth1 root fq_codel ce_threshold_ect1 50usec netperf ... -t TCP_STREAM -- K dctcp tc -s -d qd sh dev eth1 qdisc fq_codel 8022: root refcnt 32 limit 10240p flows 1024 quantum 9212 target 5ms ce_threshold_ect1 49us interval 100ms memory_limit 32Mb ecn drop_batch 64 Sent 14388596616 bytes 9543449 pkt (dropped 0, overlimits 0 requeues 152013) backlog 0b 0p requeues 152013 maxpacket 68130 drop_overlimit 0 new_flow_count 95678 ecn_mark 0 ce_mark 7639 new_flows_len 0 old_flows_len 0 [1] L4S current draft: https://datatracker.ietf.org/doc/html/draft-ietf-tsvwg-l4s-arch

Eric Dumazet committed 5 years ago

Commit e72aeb91 parent 70e939d5 files · +30 −7Browse files

Unified · Split

5 files
  1. include/net/codel.h +2 −0
  2. include/net/codel_impl.h +15 −3
  3. include/uapi/linux/pkt_sched.h +1 −0
  4. net/mac80211/sta_info.c +1 −0
  5. net/sched/sch_fq_codel.c +11 −4
include/net/codel.h+2−0
@@ -102,6 +102,7 @@ static inline u32 codel_time_to_us(codel_time_t val) · 101 unmodified lines
102 * @interval: width of moving time window102 * @interval: width of moving time window
103 * @mtu: device mtu, or minimal queue backlog in bytes.103 * @mtu: device mtu, or minimal queue backlog in bytes.
104 * @ecn: is Explicit Congestion Notification enabled104 * @ecn: is Explicit Congestion Notification enabled
105 * @ce_threshold_ect1: if ce_threshold only marks ECT(1) packets
105 */106 */
106struct codel_params {107struct codel_params {
107 codel_time_t target;108 codel_time_t target;
@@ -109,6 +110,7 @@ struct codel_params { · 1 unmodified line
109 codel_time_t interval;110 codel_time_t interval;
110 u32 mtu;111 u32 mtu;
111 bool ecn;112 bool ecn;
113 bool ce_threshold_ect1;
112};114};
113 115
114/**116/**
include/net/codel_impl.h+15−3
@@ -54,6 +54,7 @@ static void codel_params_init(struct codel_params *params) · 53 unmodified lines
54 params->interval = MS2TIME(100);54 params->interval = MS2TIME(100);
55 params->target = MS2TIME(5);55 params->target = MS2TIME(5);
56 params->ce_threshold = CODEL_DISABLED_THRESHOLD;56 params->ce_threshold = CODEL_DISABLED_THRESHOLD;
57 params->ce_threshold_ect1 = false;
57 params->ecn = false;58 params->ecn = false;
58}59}
59 60
@@ -246,9 +247,20 @@ static struct sk_buff *codel_dequeue(void *ctx, · 186 unmodified lines
246 vars->rec_inv_sqrt);247 vars->rec_inv_sqrt);
247 }248 }
248end:249end:
249 if (skb && codel_time_after(vars->ldelay, params->ce_threshold) &&250 if (skb && codel_time_after(vars->ldelay, params->ce_threshold)) {
250 INET_ECN_set_ce(skb))251 bool set_ce = true;
251 stats->ce_mark++;252
253 if (params->ce_threshold_ect1) {
254 /* Note: if skb_get_dsfield() returns -1, following
255 * gives INET_ECN_MASK, which is != INET_ECN_ECT_1.
256 */
257 u8 ecn = skb_get_dsfield(skb) & INET_ECN_MASK;
258
259 set_ce = (ecn == INET_ECN_ECT_1);
260 }
261 if (set_ce && INET_ECN_set_ce(skb))
262 stats->ce_mark++;
263 }
252 return skb;264 return skb;
253}265}
254 266
include/uapi/linux/pkt_sched.h+1−0
@@ -840,6 +840,7 @@ enum { · 839 unmodified lines
840 TCA_FQ_CODEL_CE_THRESHOLD,840 TCA_FQ_CODEL_CE_THRESHOLD,
841 TCA_FQ_CODEL_DROP_BATCH_SIZE,841 TCA_FQ_CODEL_DROP_BATCH_SIZE,
842 TCA_FQ_CODEL_MEMORY_LIMIT,842 TCA_FQ_CODEL_MEMORY_LIMIT,
843 TCA_FQ_CODEL_CE_THRESHOLD_ECT1,
843 __TCA_FQ_CODEL_MAX844 __TCA_FQ_CODEL_MAX
844};845};
845 846
net/mac80211/sta_info.c+1−0
@@ -513,6 +513,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, · 512 unmodified lines
513 sta->cparams.target = MS2TIME(20);513 sta->cparams.target = MS2TIME(20);
514 sta->cparams.interval = MS2TIME(100);514 sta->cparams.interval = MS2TIME(100);
515 sta->cparams.ecn = true;515 sta->cparams.ecn = true;
516 sta->cparams.ce_threshold_ect1 = false;
516 517
517 sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);518 sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
518 519
net/sched/sch_fq_codel.c+11−4
@@ -362,6 +362,7 @@ static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = { · 361 unmodified lines
362 [TCA_FQ_CODEL_CE_THRESHOLD] = { .type = NLA_U32 },362 [TCA_FQ_CODEL_CE_THRESHOLD] = { .type = NLA_U32 },
363 [TCA_FQ_CODEL_DROP_BATCH_SIZE] = { .type = NLA_U32 },363 [TCA_FQ_CODEL_DROP_BATCH_SIZE] = { .type = NLA_U32 },
364 [TCA_FQ_CODEL_MEMORY_LIMIT] = { .type = NLA_U32 },364 [TCA_FQ_CODEL_MEMORY_LIMIT] = { .type = NLA_U32 },
365 [TCA_FQ_CODEL_CE_THRESHOLD_ECT1] = { .type = NLA_U8 },
365};366};
366 367
367static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,368static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,
@@ -408,6 +409,9 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, · 40 unmodified lines
408 q->cparams.ce_threshold = (val * NSEC_PER_USEC) >> CODEL_SHIFT;409 q->cparams.ce_threshold = (val * NSEC_PER_USEC) >> CODEL_SHIFT;
409 }410 }
410 411
412 if (tb[TCA_FQ_CODEL_CE_THRESHOLD_ECT1])
413 q->cparams.ce_threshold_ect1 = !!nla_get_u8(tb[TCA_FQ_CODEL_CE_THRESHOLD_ECT1]);
414
411 if (tb[TCA_FQ_CODEL_INTERVAL]) {415 if (tb[TCA_FQ_CODEL_INTERVAL]) {
412 u64 interval = nla_get_u32(tb[TCA_FQ_CODEL_INTERVAL]);416 u64 interval = nla_get_u32(tb[TCA_FQ_CODEL_INTERVAL]);
413 417
@@ -544,10 +548,13 @@ static int fq_codel_dump(struct Qdisc *sch, struct sk_buff *skb) · 130 unmodified lines
544 q->flows_cnt))548 q->flows_cnt))
545 goto nla_put_failure;549 goto nla_put_failure;
546 550
547 if (q->cparams.ce_threshold != CODEL_DISABLED_THRESHOLD &&551 if (q->cparams.ce_threshold != CODEL_DISABLED_THRESHOLD) {
548 nla_put_u32(skb, TCA_FQ_CODEL_CE_THRESHOLD,552 if (nla_put_u32(skb, TCA_FQ_CODEL_CE_THRESHOLD,
549 codel_time_to_us(q->cparams.ce_threshold)))553 codel_time_to_us(q->cparams.ce_threshold)))
550 goto nla_put_failure;554 goto nla_put_failure;
555 if (nla_put_u8(skb, TCA_FQ_CODEL_CE_THRESHOLD_ECT1, q->cparams.ce_threshold_ect1))
556 goto nla_put_failure;
557 }
551 558
552 return nla_nest_end(skb, opts);559 return nla_nest_end(skb, opts);
553 560

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t