 1/draftietftsvwgaqmdualqcoupled00.txt 20170703 17:14:08.656350395 0700
+++ 2/draftietftsvwgaqmdualqcoupled01.txt 20170703 17:14:08.720351930 0700
@@ 1,99 +1,101 @@
Transport Area working group (tsvwg) K. De Schepper
InternetDraft Nokia Bell Labs
Intended status: Experimental B. Briscoe, Ed.
Expires: November 11, 2017 O. Bondarenko
+Expires: January 4, 2018 O. Bondarenko
Simula Research Lab
I. Tsang
Nokia Bell Labs
 May 10, 2017
+ July 3, 2017
DualQ Coupled AQM for Low Latency, Low Loss and Scalable Throughput
 draftietftsvwgaqmdualqcoupled00
+ draftietftsvwgaqmdualqcoupled01
Abstract
Data Centre TCP (DCTCP) was designed to provide predictably low
queuing latency, nearzero loss, and throughput scalability using
explicit congestion notification (ECN) and an extremely simple
marking behaviour on switches. However, DCTCP does not coexist with
 existing TCP trafficthroughput starves. So, until now, DCTCP
 could only be deployed where a cleanslate environment could be
 arranged, such as in private data centres. This specification
 defines `DualQ Coupled Active Queue Management (AQM)' to allow
 scalable congestion controls like DCTCP to safely coexist with
 classic Internet traffic. The Coupled AQM ensures that a flow runs
 at about the same rate whether it uses DCTCP or TCP Reno/Cubic, but
 without inspecting transport layer flow identifiers. When tested in
 a residential broadband setting, DCTCP achieved submillisecond
 average queuing delay and zero congestion loss under a wide range of
 mixes of DCTCP and `Classic' broadband Internet traffic, without
 compromising the performance of the Classic traffic. The solution
 also reduces network complexity and eliminates network configuration.
+ existing TCP trafficDCTCP is so aggressive that existing TCP
+ algorithms approach starvation. So, until now, DCTCP could only be
+ deployed where a cleanslate environment could be arranged, such as
+ in private data centres. This specification defines `DualQ Coupled
+ Active Queue Management (AQM)' to allow scalable congestion controls
+ like DCTCP to safely coexist with classic Internet traffic. The
+ Coupled AQM ensures that a flow runs at about the same rate whether
+ it uses DCTCP or TCP Reno/Cubic, but without inspecting transport
+ layer flow identifiers. When tested in a residential broadband
+ setting, DCTCP achieved submillisecond average queuing delay and
+ zero congestion loss under a wide range of mixes of DCTCP and
+ `Classic' broadband Internet traffic, without compromising the
+ performance of the Classic traffic. The solution also reduces
+ network complexity and eliminates network configuration.
Status of This Memo
This InternetDraft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
InternetDrafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as InternetDrafts. The list of current Internet
Drafts is at http://datatracker.ietf.org/drafts/current/.
InternetDrafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use InternetDrafts as reference
material or to cite them other than as "work in progress."
 This InternetDraft will expire on November 11, 2017.
+ This InternetDraft will expire on January 4, 2018.
Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/licenseinfo) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
 1.1. Problem and Scope . . . . . . . . . . . . . . . . . . . . 2
+ 1.1. Problem and Scope . . . . . . . . . . . . . . . . . . . . 3
1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 5
1.3. Features . . . . . . . . . . . . . . . . . . . . . . . . 5
 2. DualQ Coupled AQM Algorithm . . . . . . . . . . . . . . . . . 6
+ 2. DualQ Coupled AQM Algorithm . . . . . . . . . . . . . . . . . 7
2.1. Coupled AQM . . . . . . . . . . . . . . . . . . . . . . . 7
2.2. Dual Queue . . . . . . . . . . . . . . . . . . . . . . . 8
2.3. Traffic Classification . . . . . . . . . . . . . . . . . 8
2.4. Normative Requirements . . . . . . . . . . . . . . . . . 8
3. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
 4. Security Considerations . . . . . . . . . . . . . . . . . . . 9
+ 4. Security Considerations . . . . . . . . . . . . . . . . . . . 10
4.1. Overload Handling . . . . . . . . . . . . . . . . . . . . 10
5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 11
6. References . . . . . . . . . . . . . . . . . . . . . . . . . 11
6.1. Normative References . . . . . . . . . . . . . . . . . . 11
6.2. Informative References . . . . . . . . . . . . . . . . . 11
Appendix A. Example DualQ Coupled PI2 Algorithm . . . . . . . . 14
 Appendix B. Example DualQ Coupled Curvy RED Algorithm . . . . . 17
 Appendix C. Guidance on Controlling Throughput Equivalence . . . 23
 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24
+ A.1. Pass #1: Core Concepts . . . . . . . . . . . . . . . . . 15
+ A.2. Pass #2: Overload Details . . . . . . . . . . . . . . . . 18
+ Appendix B. Example DualQ Coupled Curvy RED Algorithm . . . . . 21
+ Appendix C. Guidance on Controlling Throughput Equivalence . . . 26
+ Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28
1. Introduction

1.1. Problem and Scope
Latency is becoming the critical performance factor for many (most?)
applications on the public Internet, e.g. interactive Web, Web
services, voice, conversational video, interactive video, interactive
remote presence, instant messaging, online gaming, remote desktop,
cloudbased applications, and videoassisted remote control of
machinery and industrial processes. In the developed world, further
increases in access network bitrate offer diminishing returns,
whereas latency is still a multifaceted problem. In the last decade
@@ 120,21 +122,21 @@
some traffic at the expense of others, AQM controls latency for _all_
traffic in a class. In general, AQMs introduce an increasing level
of discard from the buffer the longer the queue persists above a
shallow threshold. This gives sufficient signals to capacityseeking
(aka. greedy) flows to keep the buffer empty for its intended
purpose: absorbing bursts. However, RED [RFC2309] and other
algorithms from the 1990s were sensitive to their configuration and
hard to set correctly. So, AQM was not widely deployed.
More recent stateoftheart AQMs, e.g.
 fq_CoDel [ID.ietfaqmfqcodel], PIE [ID.ietfaqmpie], Adaptive
+ fq_CoDel [ID.ietfaqmfqcodel], PIE [RFC8033], Adaptive
RED [ARED01], are easier to configure, because they define the
queuing threshold in time not bytes, so it is invariant for different
link rates. However, no matter how good the AQM, the sawtoothing
rate of TCP will either cause queuing delay to vary or cause the link
to be underutilized. Even with a perfectly tuned AQM, the
additional queuing delay will be of the same order as the underlying
speedoflight delay across the network. Flowqueuing can isolate
one flow from another, but it cannot isolate a TCP flow from the
delay variations it inflicts on itself, and it has other problems 
it overrides the flow rate decisions of variable rate video
@@ 175,21 +177,21 @@
the problem of coexistence between scalable and classic flows,
without having to inspect flow identifiers. The AQM is not like
flowqueuing approaches [ID.ietfaqmfqcodel] that classify packets
by flow identifier into numerous separate queues in order to isolate
sparse flows from the higher latency in the queues assigned to
heavier flow. In contrast, the AQM exploits the behaviour of
scalable congestion controls like DCTCP so that every packet in every
flow sharing the queue for DCTCPlike traffic can be served with very
low latency.
 This AQM extension can be combined with any single qeueu AQM that
+ This AQM extension can be combined with any single queue AQM that
generates a statistical or deterministic mark/drop probability driven
by the queue dynamics. In many cases it simplifies the basic control
algorithm, and requires little extra processing. Therefore it is
believed the Coupled AQM would be applicable and easy to deploy in
all types of buffers; buffers in costreduced massmarket residential
equipment; buffers in endsystem stacks; buffers in carrierscale
equipment including remote access servers, routers, firewalls and
Ethernet switches; buffers in network interface cards, buffers in
virtualized network appliances, hypervisors, and so on.
@@ 320,24 +322,21 @@
There is a really simple way to implement the square of a probability
 by testing the queue against two random numbers not one. This is
the approach adopted in Appendix A and Appendix B.
Stating this as a formula, the relation between Classic drop
probability, p_C, and L4S marking probability, p_L needs to take the
form:
p_C = ( p_L / k )^2 (1)
 where k is the constant of proportionality. Optionally, k can be
 expressed as a power of 2, so k=2^k', where k' is another constant.
 Then implementations can avoid costly division by shifting p_L by k'
 bits to the right.
+ where k is the constant of proportionality.
2.2. Dual Queue
Classic traffic builds a large queue, so a separate queue is provided
for L4S traffic, and it is scheduled with strict priority.
Nonetheless, coupled marking ensures that giving priority to L4S
traffic still leaves the right amount of spare scheduling time for
Classic flows to each get equivalent throughput to DCTCP flows (all
other factors such as RTT being equal). The algorithm achieves this
without having to inspect flow identifiers.
@@ 398,38 +398,39 @@
Typically, access network operators isolate customers from each other
with some form of layer2 multiplexing (TDM in DOCSIS, CDMA in 3G) or
L3 scheduling (WRR in broadband), rather than relying on TCP to share
capacity between customers [RFC0970]. In such cases, the choice of k
will solely affect relative flow rates within each customer's access
capacity, not between customers. Also, k will not affect relative
flow rates at any times when all flows are Classic or all L4S, and it
will not affect small flows.
 Example DualQ Coupled AQM algorithms called PI2 and Curvy RED are
+ Example DualQ Coupled AQM algorithms called DualPI2 and Curvy RED are
given in Appendix A and Appendix B. Either example AQM can be used
to couple packet marking and dropping across a dual Q. Curvy RED
requires less operations per packet than RED and can be used if the
 range of RTTs is limited. PI2 is a simplification of PIE with stable
 ProportionalIntegral control for both Classic and L4S congestion
 controls. Nonetheless, it would be possible to control the queues
 with other alternative AQMs, as long as the above normative
 requirements (those expressed in capitals) are observed, which are
 intended to be independent of the specific AQM.
+ range of RTTs is limited. DualPI2 is a simplification of PIE with
+ stable ProportionalIntegral control for both Classic and L4S
+ congestion controls. Nonetheless, it would be possible to control
+ the queues with other alternative AQMs, as long as the above
+ normative requirements (those expressed in capitals) are observed,
+ which are intended to be independent of the specific AQM.
{ToDo: Add management and monitoring requirements}
3. IANA Considerations
This specification contains no IANA considerations.
4. Security Considerations
+
4.1. Overload Handling
Where the interests of users or flows might conflict, it could be
necessary to police traffic to isolate any harm to performance. This
is a policy issue that needs to be separable from a basic AQM, but an
AQM does need to handle overload. A tradeoff needs to be made
between complexity and the risk of either class harming the other.
It is an operator policy to define what must happen if the service
time of the classic queue becomes too great. In the following
subsections three optional nonexclusive overload protections are
@@ 536,37 +537,31 @@
(Under submission)
[ID.ietfaqmfqcodel]
HoeilandJoergensen, T., McKenney, P.,
dave.taht@gmail.com, d., Gettys, J., and E. Dumazet, "The
FlowQueueCoDel Packet Scheduler and Active Queue
Management Algorithm", draftietfaqmfqcodel06 (work in
progress), March 2016.
 [ID.ietfaqmpie]
 Pan, R., Natarajan, P., Baker, F., and G. White, "PIE: A
 Lightweight Control Scheme To Address the Bufferbloat
 Problem", draftietfaqmpie10 (work in progress),
 September 2016.

[ID.ietftcpmcubic]
Rhee, I., Xu, L., Ha, S., Zimmermann, A., Eggert, L., and
R. Scheffenegger, "CUBIC for Fast LongDistance Networks",
draftietftcpmcubic04 (work in progress), February
2017.
[ID.ietftcpmdctcp]
Bensley, S., Thaler, D., Balasubramanian, P., Eggert, L.,
and G. Judd, "Datacenter TCP (DCTCP): TCP Congestion
 Control for Datacenters", draftietftcpmdctcp05 (work
 in progress), March 2017.
+ Control for Datacenters", draftietftcpmdctcp08 (work
+ in progress), June 2017.
[ID.ietftsvwgecnexperimentation]
Black, D., "Explicit Congestion Notification (ECN)
Experimentation", draftietftsvwgecnexperimentation00
(work in progress), November 2016.
[ID.ietftsvwgecnl4sid]
Schepper, K., Briscoe, B., and I. Tsang, "Identifying
Modified Explicit Congestion Notification (ECN) Semantics
for UltraLow Queuing Delay", draftietftsvwgecnl4s
@@ 627,159 +622,329 @@
.
[RFC3649] Floyd, S., "HighSpeed TCP for Large Congestion Windows",
RFC 3649, DOI 10.17487/RFC3649, December 2003,
.
[RFC5681] Allman, M., Paxson, V., and E. Blanton, "TCP Congestion
Control", RFC 5681, DOI 10.17487/RFC5681, September 2009,
.
+ [RFC7567] Baker, F., Ed. and G. Fairhurst, Ed., "IETF
+ Recommendations Regarding Active Queue Management",
+ BCP 197, RFC 7567, DOI 10.17487/RFC7567, July 2015,
+ .
+
+ [RFC8033] Pan, R., Natarajan, P., Baker, F., and G. White,
+ "Proportional Integral Controller Enhanced (PIE): A
+ Lightweight Control Scheme to Address the Bufferbloat
+ Problem", RFC 8033, DOI 10.17487/RFC8033, February 2017,
+ .
+
Appendix A. Example DualQ Coupled PI2 Algorithm
 As a first concrete example, the pseudocode below gives the DualQ
 Coupled AQM algorithm based on the PI2 Classic AQM, we used and
 tested. For this example only the pseudo code is given. An open
 source implementation for Linux is available at:
+ As a first concrete example, the pseudocode below gives the DualPI2
+ algorithm, which is a DualQ Coupled AQM algorithm based on the PI2
+ algorithm [PI216] for the Classic AQM. Pi2 is an improved variant of
+ the PIE AQM [RFC8033].
+
+ We will introduce the pseudocode in two passes. The first pass
+ explains the core concepts, deferring handling of overload to the
+ second pass. The first pass also uses regular arithmetic, whereas
+ some integer arithmetic more suitable for kernel operations appears
+ in the second pass. To aid comparison, line numbers are kept in step
+ between the two passes by using letter suffixes where the longer code
+ needs extra lines.
+
+ A full open source implementation for Linux is available at:
https://github.com/olgabo/dualpi2.
+A.1. Pass #1: Core Concepts
+
+ The pseudocode manipulates three main structures of variables: the
+ packet (pkt), the L4S queue (lq) and the Classic queue (cq). The
+ pseudocode consists of the following four functions:
+
+ o initialization code (Figure 1) that sets parameter defaults (the
+ API for setting nondefault values is omitted for brevity)
+
+ o enqueue code (Figure 2)
+
+ o dequeue code (Figure 3)
+
+ o code to regularly update the base probability (p) used in the
+ dequeue code (Figure 4).
+
+ The base probability (p) is an internal variable from which the
+ marking and dropping probabilities for L4S and Classic traffic (p_L
+ and p_C) are derived. Specifically, p_L = p * k and p_C = p^2, from
+ Equation (1) (see lines 4a and 4b in Figure 4).
+
+ In our experiments so far (building on experiments with PIE) on
+ broadband access links ranging from 4 Mb/s to 200 Mb/s with base RTTs
+ from 5 ms to 100 ms, DualPI2 achieves good results with the default
+ parameters in Figure 1.
+
+ 1: dualpi2_params_init(...) { % Set parameter defaults
+ 2: target = 15 ms % PI AQM Classic queue delay target
+ 3: tshift = 2 * target % Scheduler time bias
+ 4: Tupdate = 16 ms % PI Classic queue sampling interval
+ 5: alpha = 10 Hz^2 % PI integral gain
+ 6: beta = 100 Hz^2 % PI proportional gain
+ 7: alpha_U = alpha *Tupdate % PI integral gain per update interval
+ 8: beta_U = beta * Tupdate % PI prop'nal gain per update interval
+ 9: T_time = 1 ms % L4S marking threshold in time
+ 10: T_len = 2 * MTU % Min L4S marking threshold in bytes
+ 11: k = 2 % Coupling factor
+ 12: limit = MAX_LINK_RATE * 250 ms % Dual buffer size
+ 13: p_Cmax = 1/4 % Max Classic drop/mark prob
+ 14: p_Lmax = min(k*sqrt(p_Cmax), 1) % Max L4S marking prob
+ 15: }
+
+ Figure 1: Example Header Pseudocode for DualQ Coupled PI2 AQM
+
1: dualpi2_enqueue(lq, cq, pkt) { % Test limit and classify lq or cq
2: stamp(pkt) % attach arrival time to packet
3: if ( lq.len() + cq.len() > limit )
 4: drop(pkt) % drop packet if q is full
 5: else {
 6: if ( ecn(pkt) modulo 2 == 0 ) % ECN bits = notect or ect(0)
 7: cq.enqueue(pkt)
 8: else % ECN bits = ect(1) or ce
 9: lq.enqueue(pkt)
+ 4: drop(pkt) % drop packet if buffer is full
+ 5: else { % Packet classifier
+ 6: if ( ecn(pkt) modulo 2 == 1 ) % ECN bits = ECT(1) or CE
+ 7: lq.enqueue(pkt)
+ 8: else % ECN bits = notECT or ECT(0)
+ 9: cq.enqueue(pkt)
10: }
11: }
 Figure 1: Example Enqueue Pseudocode for DualQ Coupled PI2 AQM
+ Figure 2: Example Enqueue Pseudocode for DualQ Coupled PI2 AQM
 1: dualpi2_dequeue(lq, cq) { % Couples L4S & Classic queues, lq & cq
+ 1: dualpi2_dequeue(lq, cq, pkt) { % Couples L4S & Classic queues
2: while ( lq.len() + cq.len() > 0 )
 3: if ( lq.time() + tshift >= cq.time() ) {
+ 3: if ( lq.time() + tshift >= cq.time() ) { % timeshifted FIFO
4: lq.dequeue(pkt)
 5: if ( (pkt.time() > T) or (p * k > rand()) ) % coupling here
 6: mark(pkt)
 7: return(pkt) % return the packet and stop here
 8: } else {
 9: cq.dequeue(pkt)
 10: if ( p > max(rand(), rand()) ) % only square part of (p/k)^2
 11: if ( ecn(pkt) == 0 ) % ECN field = notect
 12: drop(pkt) % squared drop, redo loop
 13: else {
 14: mark(pkt) % squared mark
 15: return(pkt) % return the packet and stop here
 16: }
 17: else
 18: return(pkt) % return the packet and stop here
 19: }
+ 5: if ( ((pkt.time() > T_time) % step marking ...
+ 6: AND (lq.len > T_len))
+ 7: OR (p_L > rand()) ) % ...or linear marking
+ 8: mark(pkt)
+ 9: } else {
+ 10: cq.dequeue(pkt)
+ 11: if ( p_C > rand() ) { % probability p^2
+ 12: if ( ecn(pkt) == 0 ) { % if ECN field = notECT
+ 13: drop(pkt) % squared drop
+ 14: continue % continue to the top of the while loop
+ 15: }
+ 16: mark(pkt) % squared mark
+ 17: }
+ 18: }
+ 19: return(pkt) % return the packet and stop
20: }
21: return(NULL) % no packet to dequeue
22: }
 Figure 2: Example Dequeue Pseudocode for DualQ Coupled PI2 AQM
+ Figure 3: Example Dequeue Pseudocode for DualQ Coupled PI2 AQM
 1: dualpi2_update(lq, cq) { % Update p every Tupdate
+ 1: dualpi2_update(lq, cq, target) { % Update p every Tupdate
2: curq = cq.time() % use queuing time of firstin Classic packet
 3: alpha_U = alpha * Tupdate % done once when parameters are set
 4: beta_U = beta * Tupdate % done once when parameters are set
 5: p = p + alpha_U * (curq  target) + beta_U * (curq  prevq)
 6: prevq = curq
 7: }
+ 3: p = p + alpha_U * (curq  target) + beta_U * (curq  prevq)
+ 4a: p_L = p * k % L4S prob = base prob * coupling factor
+ 4b: p_C = p^2 % Classic prob = (base prob)^2
+ 5: prevq = curq
+ 6: }
 Figure 3: Example PIUpdate Pseudocode for DualQ Coupled PI2 AQM
+ Figure 4: Example PIUpdate Pseudocode for DualQ Coupled PI2 AQM
When packets arrive, first a common queue limit is checked as shown
 in line 3 of the enqueuing pseudocode in Figure 1. Note that the
+ in line 3 of the enqueuing pseudocode in Figure 2. Note that the
limit is deliberately tested before enqueue to avoid any bias against
larger packets (so the actual buffer has to be one packet larger than
limit). If limit is not exceeded, the packet will be classified and
enqueued to the Classic or L4S queue dependent on the least
significant bit of the ECN field in the IP header (line 6). Packets
with a codepoint having an LSB of 0 (NotECT and ECT(0)) will be
enqueued in the Classic queue. Otherwise, ECT(1) and CE packets will
 be enqueued in the L4S queue.
+ be enqueued in the L4S queue. Optional packet classification
+ flexibility is omitted for brevity.
 The pseudocode in Figure 2 summarises the per packet dequeue
 implementation of the DualPI2 code. Line 3 implements the time
+ The dequeue pseudocode schedules one packet for dequeuing (or zero if
+ the queue is empty). It also makes all the AQM decisions on dropping
+ and marking. It is contained within a large while loop so that if it
+ decides to drop a packet, it will continue until it selects a packet
+ to schedule. Line 3 of the dequeue pseudocode implements time
shifted FIFO scheduling. It takes the packet that waited the
 longest, biased by a timeshift of tshift for the Classic traffic.
 If an L4S packet is scheduled, lines 5 and 6 mark the packet if
 either the L4S threshold T is exceeded, or if a random marking
 decision is drawn according to k times the probability p (maintained
 by the dualpi2_update() function discussed below). The coupling
 factor is applied here for determining the L4S marking probability so
 that Classic TCP control is independent from the L4S coupling factor.
 If a Classic packet is scheduled, lines 10 to 16 drop or mark the
 packet based on 2 random decisions resulting in the squared
 probability p^2 (hence the name PI2 for Classic traffic). Note that
 p is not reduced here by the factor k, as p has already been
 multiplied by the factor k when it was used to mark the L4S traffic.
 The coupling factor gives Classic TCP and DCTCP traffic equal
 throughput; Because L4S marking is factored up by k, the dynamic gain
 parameters alpha and beta also have to be factored up by k for the
 L4S queue, which is necessary to ensure that Classic TCP and DCTCP
 controls have the same stability.
+ longest, biased against the Classic traffic by a timeshift of
+ tshift.
+
+ o If an L4S packet is scheduled, lines 5 to 8 mark the packet if
+ either the L4S threshold is exceeded, or if a random marking
+ decision is drawn according to k times the probability p
+ (maintained by the dualpi2_update() function discussed below).
+ The L4S threshold is usually in units of time (default T_time = 1
+ ms). However, on slow links the packet serialization time can
+ approach the threshold T_time, so line 6 sets a floor of 2 MTU to
+ the threshold.
+
+ o If a Classic packet is scheduled, lines 10 to 17 drop or mark the
+ packet based on the squared probability p_C = p^2 (hence the name
+ PI2 for Classic traffic).
The probability p is kept up to date by the core PI algorithm in
 Figure 3 which is executed every Tupdate ([ID.ietfaqmpie] now
 recommends 16ms, but in our testing so far we have used the earlier
 recommendation of 32ms). Note that p solely depends on the queuing
 time in the Classic queue. In line 2, the current queuing delay is
 evaluated by inspecting the timestamp of the next packet to schedule
 in the Classic queue. The function cq.time() subtracts the time
 stamped at enqueue from the current time and implicitly takes the
 current queuing delay as 0 if the queue is empty. Line 3 and 4 only
 need to be executed when the configuration parameters are changed.
 Alpha and beta in Hz are gain factors per 1 second. If a briefer
 update time is configured, alpha_U and beta_U (_U = per Tupdate) also
 have to be reduced, to ensure that the same response is given over
 time. As such, a smaller Tupdate will only result in a response with
 smaller and finer steps, not a more aggressive response. The new
 probability is calculated in line 5, where target is the target
 queuing delay, as defined in [ID.ietfaqmpie]. In corner cases, p
 can overflow the range [0,1] so the resulting value of p has to be
 bounded (omitted from the pseudocode). Unlike PIE, alpha_U and
 beta_U are not tuned dependent on p, every Tupdate. Instead, in PI2
 alpha_U and beta_U can be constants because the squaring applied to
 Classic traffic tunes them inherently, as explained in [PI216].
+ Figure 4 which is executed every Tupdate ([RFC8033] now recommends
+ 16ms). The algorithm centres on line 3, which is a classical
+ ProportionalIntegral (PI) controller that alters p dependent on a)
+ the error between the current queuing delay (curq) and the target
+ queuing delay (target) as defined in [RFC8033] and b) the change in
+ queuing delay since the last sample. The name 'PI' represents the
+ fact that the second factor is proportional to load while the first
+ is the integral of the load (so it removes any standing queue). In
+ corner cases, p can overflow the range [0,1] so the resulting value
+ of p has to be bounded (omitted from the pseudocode).
 In our experiments so far (building on experiments with PIE) on
 broadband access links ranging from 4 Mb/s to 200 Mb/s with base RTTs
 from 5 ms to 100 ms, PI2 achieves good results with the following
 parameters:
+ Alpha_U and beta_U are gain factors chosen based on stability
+ analysis to convert changes in queueing delay into changes in
+ probability. They are therefore in units of 'per second of delay' or
+ Hz. The suffix '_U' represents 'per update time' (Tupdate). If a
+ briefer update time is configured, alpha_U and beta_U also have to be
+ reduced to ensure that the same response is given over time, so that
+ a smaller Tupdate will only result in a response with finer steps,
+ not a more aggressive response. Therefore, alpha_U and beta_U are
+ derived from alpha and beta, which each represent a 'gain factor per
+ second of update time', so they can be configured independently of
+ the update time (see lines 7 and 8 of Figure 1).
 tshift = 40ms
 T = max(1ms, serialization time of 2 MTU)
+ Unlike in PIE, alpha_U and beta_U do not need to be tuned every
+ Tupdate dependent on p. Instead, in PI2 alpha_U and beta_U can be
+ constants because the squaring applied to Classic traffic tunes them
+ inherently, as explained in [PI216].
 target = 20ms
+ Note that p solely depends on the queuing time in the Classic queue.
+ In line 2, the current queuing delay is evaluated by inspecting the
+ timestamp of the next packet to schedule in the Classic queue. The
+ function cq.time() subtracts the time stamped at enqueue from the
+ current time and implicitly takes the current queuing delay as 0 if
+ the queue is empty.
 Tupdate = 32ms
+ Because the L4S marking probability (p_L) is factored up by k, the
+ dynamic gain parameters alpha and beta are also inherently factored
+ up by k for the L4S queue, which is necessary to ensure that Classic
+ TCP and DCTCP controls have the same stability. So, if alpha is 10
+ Hz^2, the effective gain factor for the L4S queue is k*alpha, which
+ is 20 Hz^2 with the default coupling factor of k=2.
 k = 2
+A.2. Pass #2: Overload Details
 alpha = 10Hz (alpha*k = 20Hz for L4S)
+ Figure 5 repeats the dequeue function of Figure 3, but with overload
+ details added. Similarly Figure 6 repeats the core PI algorithm of
+ Figure 4 with overload details added. The initialization and enqueue
+ functions are unchanged.
 beta = 100Hz (beta*k = 200Hz for L4S)
+ In line 13 of the initialization function (Figure 1), the default
+ maximum Classic drop probability p_Cmax = 1/4 or 25%. This is the
+ point at which it is deemed that the Classic queue has become
+ persistently overloaded, so it switches to using solely drop, even
+ for ECNcapable packets. This protects the queue against any
+ unresponsive traffic that falsely claims that it is responsive to ECN
+ marking, as required by [RFC3168] and [RFC7567].
+
+ Line 14 translates this into a maximum L4S marking probability
+ (p_Lmax) by rearranging Equation (1). With the default coupling
+ factor of k=2, this translates to a maximum L4S marking probability
+ of 1 or 100%. This is intended to ensure that the L4S queue starts to
+ introduce dropping once marking saturates and can rise no further.
+ The 'TCP Prague' requirements [ID.ietftsvwgecnl4sid] require
+ that, when an L4S congestion control detects a drop, it falls back to
+ a response that coexists with 'Classic' TCP. So it is correct that
+ the L4S queue drops packets proportional to p^2, as if they are
+ Classic packets.
+
+ Both these switchovers are triggered by the tests for overload
+ introduced in lines 4b and 12b of the dequeue function (Figure 5).
+ Lines 8c to 8g drop L4S packets with probability p^2 by comparing p
+ against two random numbers. Lines 8h to 8i mark the remaining
+ packets with probability p_L.
+
+ Lines 2c to 2d in the core PI algorithm (Figure 6) deal with overload
+ of the L4S queue when there is no Classic traffic. This is
+ necessary, because the core PI algorithm maintains the right
+ probability of drop to regulate overload, but it depends on the
+ length of the Classic queue. If there is no Classic queue the naive
+ algorithm in Figure 4 drops nothing, even if the L4S queue is
+ overloaded  so tail drop takes over (lines 3 and 4 of Figure 2).
+
+ If the test at line 2a finds that the Classic queue is empty, line 2d
+ measures the current queue delay using the L4S queue not the Classic
+ queue, While the L4S queue is not overloaded, its delay will always
+ be tiny compared to the target Classic queue delay. So p_L will be
+ driven to zero, and the L4S queue will naturally be governed solely
+ by threshold marking (lines 5 and 6 of the dequeue algorithm in
+ Figure 5). But, if unresponsive L4S source(s) cause overload, the
+ DualQ transitions smoothly to L4S marking based on the PI algorithm.
+ And as overload increases, it naturally transitions from marking to
+ dropping by the switchover mechanism already described.
+
+ 1: dualpi2_dequeue(lq, cq) { % Couples L4S & Classic queues, lq & cq
+ 2: while ( lq.len() + cq.len() > 0 )
+ 3: if ( lq.time() + tshift >= cq.time() ) { % timeshifted FIFO
+ 4a: lq.dequeue(pkt)
+ 4b: if ( p_L < p_Lmax ) { % Check for overload saturation
+ 5: if ( ((pkt.time() > T_time) % step marking ...
+ 6: AND (lq.len > T_len))
+ 7: OR (p_L > rand()) ) % ...or linear marking
+ 8a: mark(pkt)
+ 8b: } else { % overload saturation
+ 8c: if ( p > max(rand(), rand()) ) { % probability p^2
+ 8e: drop(pkt) % revert to Classic drop due to overload
+ 8f: continue % continue to the top of the while loop
+ 8g: }
+ 8h: if ( p_L > rand() ) % probability p_L = k * p
+ 8i: mark(pkt) % linear marking of remaining packets
+ 8j: }
+ 9: } else {
+ 10: cq.dequeue(pkt)
+ 11: if ( p > max(rand(), rand()) ) { % probability p^2
+ 12a: if ( (ecn(pkt) == 0) % ECN field = notECT
+ 12b: OR (p_L >= p_Lmax) ) { % Overload disables ECN
+ 13: drop(pkt) % squared drop, redo loop
+ 14: continue % continue to the top of the while loop
+ 15: }
+ 16: mark(pkt) % squared mark
+ 17: }
+ 18: }
+ 19: return(pkt) % return the packet and stop
+ 20: }
+ 21: return(NULL) % no packet to dequeue
+ 22: }
+
+ Figure 5: Example Dequeue Pseudocode for DualQ Coupled PI2 AQM
+ (Including Integer Arithmetic and Overload Code)
+
+ 1: dualpi2_update(lq, cq, target) { % Update p every Tupdate
+ 2a: if ( cq.len() > 0 )
+ 2b: curq = cq.time() %use queuing time of firstin Classic packet
+ 2c: else % Classic queue empty
+ 2d: curq = lq.time() % use queuing time of firstin L4S packet
+ 3: p = p + alpha_U * (curq  target) + beta_U * (curq  prevq)
+ 4: p_L = p * k % L4S prob = base prob * coupling factor
+ 5: prevq = curq
+ 6: }
+
+ Figure 6: Example PIUpdate Pseudocode for DualQ Coupled PI2 AQM
+ (Including Overload Code)
Appendix B. Example DualQ Coupled Curvy RED Algorithm
 As another example, the pseudocode below gives the Curvy RED based
 DualQ Coupled AQM algorithm we used and tested. Although we designed
 the AQM to be efficient in integer arithmetic, to aid understanding
 it is first given using realnumber arithmetic. Then, one possible
 optimization for integer arithmetic is given, also in pseudocode. To
 aid comparison, the line numbers are kept in step between the two by
 using letter suffixes where the longer code needs extra lines.
+ As another example of a DualQ Coupled AQM algorithm, the pseudocode
+ below gives the Curvy RED based algorithm we used and tested.
+ Although we designed the AQM to be efficient in integer arithmetic,
+ to aid understanding it is first given using realnumber arithmetic.
+ Then, one possible optimization for integer arithmetic is given, also
+ in pseudocode. To aid comparison, the line numbers are kept in step
+ between the two by using letter suffixes where the longer code needs
+ extra lines.
1: dualq_dequeue(lq, cq) { % Couples L4S & Classic queues, lq & cq
2: if ( lq.dequeue(pkt) ) {
3a: p_L = cq.sec() / 2^S_L
3b: if ( lq.byt() > T )
3c: mark(pkt)
3d: elif ( p_L > maxrand(U) )
4: mark(pkt)
5: return(pkt) % return the packet and stop here
6: }
@@ 795,26 +960,29 @@
14: return(NULL) % no packet to dequeue
15: }
16: maxrand(u) { % return the max of u random numbers
17: maxr=0
18: while (u > 0)
19: maxr = max(maxr, rand()) % 0 <= rand() < 1
20: return(maxr)
21: }
 Figure 4: Example Dequeue Pseudocode for DualQ Coupled Curvy RED AQM
+ Figure 7: Example Dequeue Pseudocode for DualQ Coupled Curvy RED AQM
Packet classification code is not shown, as it is no different from
 Figure 1. Potential classification schemes are discussed in
 Section 2. Overload protection code will be included in a future
 draft {ToDo}.
+ Figure 2. Classic ECN handling is not shown. Potential
+ classification schemes are discussed in Section 2. The Curvy RED
+ algorithm has not been maintained to the same degree as the DualPI2
+ algorithm. Some ideas used in DualPI2 could be translated into Curvy
+ RED, such as i) the timeshifted FIFO scheduler ii) the timebased
+ L4S threshold; iii) overload protection. {ToDo}.
At the outer level, the structure of dualq_dequeue() implements
strict priority scheduling. The code is written assuming the AQM is
applied on dequeue (Note 1) . Every time dualq_dequeue() is called,
the ifblock in lines 26 determines whether there is an L4S packet
to dequeue by calling lq.dequeue(pkt), and otherwise the whileblock
in lines 713 determines whether there is a Classic packet to
dequeue, by calling cq.dequeue(pkt). (Note 2)
In the lower priority Classic queue, a while loop is used so that, if
@@ 848,21 +1016,21 @@
Specifically, in line 3a the marking probability p_L is set to the
Classic queueing time qc.sec() in seconds divided by the L4S
scaling parameter 2^S_L, which represents the queuing time (in
seconds) at which marking probability would hit 100%. Then in line
3d (if U=1) the result is compared with a uniformly distributed
random number between 0 and 1, which ensures that marking
probability will linearly increase with queueing time. The
scaling parameter is expressed as a power of 2 so that division
can be implemented as a right bitshift (>>) in line 3 of the
 integer variant of the pseudocode (Figure 5).
+ integer variant of the pseudocode (Figure 8).
Classic: If the test at line 7 determines that there is at least one
Classic packet to dequeue, the test at line 9b determines whether
to drop it. But before that, line 8b updates Q_C, which is an
exponentially weighted moving average (Note 5) of the queuing time
in the Classic queue, where pkt.sec() is the instantaneous
queueing time of the current Classic packet and alpha is the EWMA
constant for the classic queue. In line 8a, alpha is represented
as an integer power of 2, so that in line 8 of the integer code
the division needed to weight the moving average can be
@@ 910,30 +1078,32 @@
Classic:
S_C : The scaling factor of the dropping function scales Classic
queuing times in the range [0, 2^(S_C)] seconds into a dropping
probability in the range [0,1]. To make division efficient, it
is constrained to be an integer power of two;
f_C : To smooth the queuing time of the Classic queue and make
multiplication efficient, we use a negative integer power of
two for the dimensionless EWMA constant, which we define as
 2^(f_C).
+ alpha = 2^(f_C).
L4S :
 S_L (and k): As for the Classic queue, the scaling factor of the
 L4S marking function scales Classic queueing times in the range
 [0, 2^(S_L)] seconds into a probability in the range [0,1].
 Note that S_L = S_C + k, where k is the coupling between the
 queues (Section 2.1). So S_L and k count as only one
 parameter;
+ S_L (and k'): As for the Classic queue, the scaling factor of
+ the L4S marking function scales Classic queueing times in the
+ range [0, 2^(S_L)] seconds into a probability in the range
+ [0,1]. Note that S_L = S_C + k', where k' is the coupling
+ between the queues. So S_L and k' count as only one parameter;
+ k' is related to k in Equation (1) (Section 2.1) by k=2^k',
+ where both k and k' are constants. Then implementations can
+ avoid costly division by shifting p_L by k' bits to the right.
T : The queue size in bytes at which step threshold marking
starts in the L4S queue.
{ToDo: These are the raw parameters used within the algorithm. A
configuration frontend could accept more meaningful parameters and
convert them into these raw parameters.}
From our experiments so far, recommended values for these parameters
are: S_C = 1; f_C = 5; T = 5 * MTU for the range of base RTTs
@@ 979,21 +1149,21 @@
7: while ( cq.dequeue(pkt) ) {
8: Q_C += (pkt.ns()  Q_C) >> f_C % Classic Q EWMA
9: if ( (Q_C >> (S_C2) ) > maxrand(2*U) )
10: drop(pkt) % Squared drop, redo loop
11: else
12: return(pkt) % return the packet and stop here
13: }
14: return(NULL) % no packet to dequeue
15: }
 Figure 5: Optimised Example Dequeue Pseudocode for Coupled DualQ AQM
+ Figure 8: Optimised Example Dequeue Pseudocode for Coupled DualQ AQM
using Integer Arithmetic
Notes:
1. The drain rate of the queue can vary if it is scheduled relative
to other queues, or to cater for fluctuations in a wireless
medium. To autoadjust to changes in drain rate, the queue must
be measured in time, not bytes or packets [CoDel]. In our Linux
implementation, it was easiest to measure queuing time at
dequeue. Queuing time can be estimated when a packet is enqueued
@@ 1022,21 +1192,21 @@
adaptive smoothing methods could be valid and it might be
appropriate to decrease the EWMA faster than it increases.
6. In practice at line 10 the Classic queue would probably test for
ECN capability on the packet to determine whether to drop or mark
the packet. However, for brevity such detail is omitted. All
packets classified into the L4S queue have to be ECNcapable, so
no dropping logic is necessary at line 3. Nonetheless, L4S
packets could be dropped by overload code (see Section 4.1).
 7. In the integer variant of the pseudocode (Figure 5) real numbers
+ 7. In the integer variant of the pseudocode (Figure 8) real numbers
are all represented as integers scaled up by 2^32. In lines 3 &
9 the function maxrand() is arranged to return an integer in the
range 0 <= maxrand() < 2^32. Queuing times are also scaled up by
2^32, but in two stages: i) In lines 3 and 8 queuing times
cq.ns() and pkt.ns() are returned in integer nanoseconds, making
the values about 2^30 times larger than when the units were
seconds, ii) then in lines 3 and 9 an adjustment of 2 to the
right bitshift multiplies the result by 2^2, to complete the
scaling by 2^32.
@@ 1034,65 +1204,70 @@
9 the function maxrand() is arranged to return an integer in the
range 0 <= maxrand() < 2^32. Queuing times are also scaled up by
2^32, but in two stages: i) In lines 3 and 8 queuing times
cq.ns() and pkt.ns() are returned in integer nanoseconds, making
the values about 2^30 times larger than when the units were
seconds, ii) then in lines 3 and 9 an adjustment of 2 to the
right bitshift multiplies the result by 2^2, to complete the
scaling by 2^32.
Appendix C. Guidance on Controlling Throughput Equivalence

++++
 RTT_C / RTT_L  Reno  Cubic 
++++
  1  k=1  k=0 
  2  k=2  k=1 
  3  k=2  k=2 
  4  k=3  k=2 
  5  k=3  k=3 
+  1  k'=1  k'=0 
+  2  k'=2  k'=1 
+  3  k'=2  k'=2 
+  4  k'=3  k'=2 
+  5  k'=3  k'=3 
++++
 Table 1: Value of k for which DCTCP throughput is roughly the same as
 Reno or Cubic, for some example RTT ratios
+ Table 1: Value of k' for which DCTCP throughput is roughly the same
+ as Reno or Cubic, for some example RTT ratios
+
+ k' is related to k in Equation (1) (Section 2.1) by k=2^k'.
To determine the appropriate policy, the operator first has to judge
whether it wants DCTCP flows to have roughly equal throughput with
Reno or with Cubic (because, even in its Renocompatibility mode,
Cubic is about 1.4 times more aggressive than Reno). Then the
operator needs to decide at what ratio of RTTs it wants DCTCP and
Classic flows to have roughly equal throughput. For example choosing
 the recommended value of k=0 will make DCTCP throughput roughly the
 same as Cubic, _if their RTTs are the same_.
+ k'=0 (equivalent to k=1) will make DCTCP throughput roughly the same
+ as Cubic, _if their RTTs are the same_.
However, even if the base RTTs are the same, the actual RTTs are
unlikely to be the same, because Classic (Cubic or Reno) traffic
needs a large queue to avoid underutilization and excess drop,
whereas L4S (DCTCP) does not. The operator might still choose this
policy if it judges that DCTCP throughput should be rewarded for
keeping its own queue short.
On the other hand, the operator will choose one of the higher values
 for k, if it wants to slow DCTCP down to roughly the same throughput
+ for k', if it wants to slow DCTCP down to roughly the same throughput
as Classic flows, to compensate for Classic flows slowing themselves
down by causing themselves extra queuing delay.
 The values for k in the table are derived from the formulae, which
+ The values for k' in the table are derived from the formulae, which
was developed in [DCttH15]:
 2^k = 1.64 (RTT_reno / RTT_dc) (2)
 2^k = 1.19 (RTT_cubic / RTT_dc ) (3)
+ 2^k' = 1.64 (RTT_reno / RTT_dc) (2)
+ 2^k' = 1.19 (RTT_cubic / RTT_dc ) (3)
For localized traffic from a particular ISP's data centre, we used
 the measured RTTs to calculate that a value of k=3 would achieve
 throughput equivalence, and our experiments verified the formula very
 closely.
+ the measured RTTs to calculate that a value of k'=3 (equivalant to
+ k=8) would achieve throughput equivalence, and our experiments
+ verified the formula very closely.
+
+ For a typical mix of RTTs from local data centres and across the
+ general Internet, a value of k'=1 (equivalent to k=2) is recommended
+ as a good workable compromise.
Authors' Addresses
Koen De Schepper
Nokia Bell Labs
Antwerp
Belgium
Email: koen.de_schepper@nokia.com
URI: https://www.belllabs.com/usr/koen.de_schepper