Why do we need congestion control in BOTH the transport layer and network layer in TCP/IP model. Cant we be good enough with control in just one of the layers only? And how do they differ?
2 Answers
The two methods serve slightly different purposes. As @Zac67 points out, not all transport protocols have flow control, so it makes more sense to have it in the IP layer.
Without ECN, the only way a router can signal congestion is to drop the packet. The ECN bits in the IP packet make it possible for routers to signal that there is congestion without having to drop to packet, improving efficiency. It is also easier for the router to modify the IP packet without having to inspect higher layer protocols it may not be aware of.
ECN is really a binary indication -- there is congestion, or there isn't. TCP flow control is more variable and allows the sender and receiver to adjust the flow for optimum efficiency.
TCP can modify its window size based on ECN. Different operating systems handle it differently.
ECN is not widely used and most OS's have it disabled by default.
Wikipedia has a good article on it.
Some transport-layer protocols have congestion control (like TCP), some don't (like UDP). IP's network layer doesn't care about congestion either.