TCP/IP Architecture, Design, and Implementation in Linux

Author: Sameer Seth, M. Ajaykumar Venkatesulu
This Month Stack Overflow 1


by anonymous   2019-01-13

TL;DR - Recovery is reached when duplicate acks or selective acks are detected. Packet loss leads to TCP_CA_Recovery state, which can lead to TCP_CA_Loss if retransmission timeout is reached.

Both flags are one of the 5 states of TCP congestion avoidance implementation in Linux.

enum tcp_ca_state
    TCP_CA_Open = 0,
#define TCPF_CA_Open    (1<<TCP_CA_Open)
    TCP_CA_Disorder = 1,
#define TCPF_CA_Disorder (1<<TCP_CA_Disorder)
    TCP_CA_CWR = 2,
#define TCPF_CA_CWR (1<<TCP_CA_CWR)
    TCP_CA_Recovery = 3,
#define TCPF_CA_Recovery (1<<TCP_CA_Recovery)
    TCP_CA_Loss = 4
#define TCPF_CA_Loss    (1<<TCP_CA_Loss)

See here.

Therefore all of the abnormal (non-open) states are steps of recovery after the TCP implementation 'senses' that the link is congested.

  • TCP_CA_Open - normal state of ACK processing (regulating the congestion window normally).

  • TCP_CA_Disorder - duplicate ACKs (DUPACKs) or selective acknowledgements (SACKS) detected/received.

  • TCP_CA_CWR - congestion window reduced state. Linux TCP stack starts to reduce congestion window in this state. This state can be interrupted by TCP_CA_Recovery or TCP_CA_Loss

  • TCP_CA_Recovery - state is entered when starting the retransmission of the packets.

The sender stays in the Recovery state until all of the segments outstanding when the Recovery state was entered are successfully acknowledged. After this the sender goes back to the Open state. A retransmission timeout can also interrupt the Recovery state.

(source mentioned below).

  • TCP_CA_Loss - State entered when TCP RTO (retransmission timeout) expires.

You can read more about it here. And also this book.