ECN (Explicit Congestion Notification)

Stop network congestion by marking the packets congested. So that the receiver of the packets can let sender know to reduce traffic rate

Similar to PFC (Priority Flow Control) but in Layer 3 while PFC is in Layer 2

  • kmin: threshold for marking the packets. When congestion reaches this threshold, packet will notify sender about congestion
  • kmax: maximum threshold for marking packets. If congestion level reaches this threshold, we will start marking more aggressively
  • pmax: highest probability that a packet is marked when the queue exceeds kmin below kmax

When a switch detect early congestion, it marks the ECN part in IP (Internet Protocol) Header 11 to say that it's congested.

sequenceDiagram
    participant Sender
    participant Switch
    participant Receiver

    Note over Sender, Receiver: Data Flow Starts
    Sender->>Switch: Data Packet (ECN=01 or 10: ECN Capable)
    Note right of Switch: CONGESTION DETECTED!
    Switch-->>Switch: Change IP Header ECN to 11 (CE)
    Switch->>Receiver: Data Packet (ECN=11: Congestion Experienced)

    rect rgb(200, 230, 255)
    Note over Receiver, Sender: Feedback Scenarios
    
    alt Standard TCP (L4)
        Receiver->>Sender: TCP ACK (ECE=1 Flag)
        Note left of Sender: Reduction: Shrink Congestion Window
        Sender->>Receiver: Next Data Packet (CWR=1 Flag)
    else AI/RDMA - RoCEv2 (L3/L4)
        Receiver->>Sender: CNP (Congestion Notification Packet)
        Note left of Sender: Reduction: Hardware Rate Limiting
    end
    end

For Layer 4 traffic, we can use TCP (Transmission Control Protocol) with ECE and CWR flag to resolve congestion.

For RoCEv2 which typically uses Layer3 and Layer4, we need to send CNP (Congest Notification Packet)

BinaryHex/DecimalNameMeaning
000x0Non-ECTNot ECN-Capable Transport. The sender/protocol does not support ECN. Switches must drop packets to signal congestion.
010x1ECT(1)ECN-Capable Transport. Sender supports ECN. (Often used for L4S or experimental protocols in 2026). Instead of halving the transmission rate, they use different strategy to control the traffic flow. Suitable for Cloud Gaming, VR/AR and High quality video conferencing
100x2ECT(0)ECN-Capable Transport. Standard value used by most senders (like TCP) to indicate they support ECN. Halving the transmission rate
110x3CECongestion Experienced. Set by a switch/router when its buffer is filling up. This is the "Mark" we discussed.