Skip to content
  • Yuchung Cheng's avatar
    tcp: avoid resetting ACK timer upon receiving packet with ECN CWR flag · fd2123a3
    Yuchung Cheng authored
    Previously commit 9aee4000 ("tcp: ack immediately when a cwr
    packet arrives") calls tcp_enter_quickack_mode to force sending
    two immediate ACKs upon receiving a packet w/ CWR flag. The side
    effect is it'll also reset the delayed ACK timer and interactive
    session tracking. This patch removes that side effect by using the
    new ACK_NOW flag to force an immmediate ACK.
    
    Packetdrill to demonstrate:
    
        0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
       +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
       +0 setsockopt(3, SOL_TCP, TCP_CONGESTION, "dctcp", 5) = 0
       +0 bind(3, ..., ...) = 0
       +0 listen(3, 1) = 0
    
       +0 < [ect0] SEW 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
       +0 > SE. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
      +.1 < [ect0] . 1:1(0) ack 1 win 257
       +0 accept(3, ..., ...) = 4
    
       +0 < [ect0] . 1:1001(1000) ack 1 win 257
       +0 > [ect01] . 1:1(0) ack 1001
    
       +0 write(4, ..., 1) = 1
       +0 > [ect01] P. 1:2(1) ack 1001
    
       +0 < [ect0] . 1001:2001(1000) ack 2 win 257
       +0 write(4, ..., 1) = 1
       +0 > [ect01] P. 2:3(1) ack 2001
    
       +0 < [ect0] . 2001:3001(1000) ack 3 win 257
       +0 < [ect0] . 3001:4001(1000) ack 3 win 257
       // Ack delayed ...
    
       +.01 < [ce] P. 4001:4501(500) ack 3 win 257
       +0 > [ect01] . 3:3(0) ack 4001
       +0 > [ect01] E. 3:3(0) ack 4501
    
    +.001 read(4, ..., 4500) = 4500
       +0 write(4, ..., 1) = 1
       +0 > [ect01] PE. 3:4(1) ack 4501 win 100
    
     +.01 < [ect0] W. 4501:5501(1000) ack 4 win 257
       // No delayed ACK on CWR flag
       +0 > [ect01] . 4:4(0) ack 5501
    
     +.31 < [ect0] . 5501:6501(1000) ack 4 win 257
       +0 > [ect01] . 4:4(0) ack 6501
    
    Fixes: 9aee4000
    
     ("tcp: ack immediately when a cwr packet arrives")
    Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
    Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    fd2123a3