explicit congestion notification
Classic TCP learns about congestion the brutal way: by having a packet thrown away. That is like a factory only learning a queue is too long when boxes start falling off the end of the conveyor. Explicit congestion notification, or ECN, offers a gentler signal: instead of dropping a packet when a router's queue starts filling, the router MARKS the packet with a flag that says 'I am getting congested', and the sender slows down — no packet, and no data, was lost at all.
It works as a small collaboration across layers. There are two bits in the IP header reserved for ECN. When a sender supports ECN, it marks its packets as 'ECN-capable'. If such a packet passes through a router whose queue is building, the router, instead of dropping it, sets the 'congestion experienced' codepoint and forwards it. The receiver notices this mark and, in the acknowledgment it sends back (using a dedicated flag in the TCP header), echoes the news to the sender. The sender then reacts just as if it had detected a loss — it reduces its congestion window — but the data sailed through intact and never had to be retransmitted.
The payoff is avoiding the cost of loss-based signalling: no wasted retransmission, no timeout risk, and the congestion warning can arrive a little earlier (when the queue is building, not yet overflowing). ECN needs cooperation from the senders, the receivers, AND the routers in between, which is why adoption took a long time and why some middleboxes historically mishandled the bits. It pairs naturally with active queue management, which decides WHEN to mark, and it is central to datacenter schemes like DCTCP and to modern low-latency Internet efforts.
A router's queue starts to build. Instead of dropping the next ECN-capable packet, it sets the 'congestion experienced' bits and forwards it. The receiver sees the mark and sets the ECN-Echo flag on its ACK. The sender reads that flag and halves its congestion window — exactly the response it would have made to a dropped packet, but with zero data lost and zero retransmission needed.
ECN marks instead of dropping, so the sender slows down without any packet being lost or resent.
ECN only works if sender, receiver, AND every router on the path cooperate — and a marked packet still signals congestion, so the sender must still slow down; ECN avoids the LOSS, not the slowdown. Historically some buggy middleboxes cleared or mishandled the ECN bits, which delayed its deployment for years.