• Yuchung Cheng's avatar
    tcp: do not delay ACK in DCTCP upon CE status change · a0496ef2
    Yuchung Cheng authored
    Per DCTCP RFC8257 (Section 3.2) the ACK reflecting the CE status change
    has to be sent immediately so the sender can respond quickly:
    
    """ When receiving packets, the CE codepoint MUST be processed as follows:
    
       1.  If the CE codepoint is set and DCTCP.CE is false, set DCTCP.CE to
           true and send an immediate ACK.
    
       2.  If the CE codepoint is not set and DCTCP.CE is true, set DCTCP.CE
           to false and send an immediate ACK.
    """
    
    Previously DCTCP implementation may continue to delay the ACK. This
    patch fixes that to implement the RFC by forcing an immediate ACK.
    
    Tested with this packetdrill script provided by Larry Brakmo
    
    0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
    0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
    0.000 setsockopt(3, SOL_TCP, TCP_CONGESTION, "dctcp", 5) = 0
    0.000 bind(3, ..., ...) = 0
    0.000 listen(3, 1) = 0
    
    0.100 < [ect0] SEW 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
    0.100 > SE. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
    0.110 < [ect0] . 1:1(0) ack 1 win 257
    0.200 accept(3, ..., ...) = 4
       +0 setsockopt(4, SOL_SOCKET, SO_DEBUG, [1], 4) = 0
    
    0.200 < [ect0] . 1:1001(1000) ack 1 win 257
    0.200 > [ect01] . 1:1(0) ack 1001
    
    0.200 write(4, ..., 1) = 1
    0.200 > [ect01] P. 1:2(1) ack 1001
    
    0.200 < [ect0] . 1001:2001(1000) ack 2 win 257
    +0.005 < [ce] . 2001:3001(1000) ack 2 win 257
    
    +0.000 > [ect01] . 2:2(0) ack 2001
    // Previously the ACK below would be delayed by 40ms
    +0.000 > [ect01] E. 2:2(0) ack 3001
    
    +0.500 < F. 9501:9501(0) ack 4 win 257
    Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
    Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a0496ef2
tcp_dctcp.c 9.01 KB