HSCTechnicalWiki


view edit history print Talk subscribe
SearchWiki
Inspired by: Support Wikipedia

Views: 338

Full site statistics

Authors:

edit SideBar

Main » ECN handling in Linux TCP

PageList

Papers

Tutorials

HSC welcomes all external visitors to this site, especially students and members of the academic community. Please use the comments box at the bottom of each page to record any comments or suggestions for improvement.

Explicit Congestion Notification

TCP use two flags (ECE and CWR) in TCP header for negotiating and subsequently indicating ECN for a connection. When congestion situation occurs, TCP sends packets with ECE bit set till it receives a TCP packet with CWR set thus indicating the reduction in congestion window in response to congestion experienced.

Detailed functionality

ECN flag

ECN flag values indicate what should be the value of ECN fields in TCP header of outgoing packets. ECN flag can have following values:

  1. TCP_ECN_OK : ECN is negotiated for TCP stream
  2. TCP_ECN_QUEUE_CWR: Congestion window reduction is indicated to TCP receiver
  3. TCP_ECN_DEMAND_CWR: Indicate the congestion state to TCP sender and demand reduction of congestion window

Negotiating ECN

During SYN Transmission (TCP_ECN_send_syn)

In case ECN is supported in sysctl variable (sysctl_tcp_ecn):

  1. Set ECE and CWR fields in TCP header of outgoing SYN
  2. ECN flag is set as TCP_ECN_OK

During SYN reception (TCP_ECN_create_request)

In case ECN is supported in sysctl variable (sysctl_tcp_ecn) and ECE and CWR flags are set in received SYN, set ECN as OK for use on this TCP connection.

During SYN-ACK Transmission (TCP_ECN_make_synack)

If ECN is Oked on SYN reception, set ECE bit in TCP header of outgoing SYN-ACK

During simultaneous SYN situation

Processing ECN in received SYN (TCP_ECN_rcv_syn) If TCP_ECN_OK but the received SYN packet has either ECE or CWR not set then mark ECN flags for ECN not OK.

Responding with SYN-ACK (TCP_ECN_send_synack) Received SYN packet header is modified for:

  1. Reset CWR
  2. If ECN is not OK, reset ECE

During SYN-ACK reception (TCP_ECN_rcv_synack)

If TCP_ECN_OK and in received SYN-ACK either ECE is not set or CWR is set, then mark ECN flags for ECN not OK

ECN occurrence

Explicit congestion is declared primarily on two events:

  1. If TCP is not able to transmit a packet due to congestion experienced by the device tcp v4 error
  2. ICMP Source Quench is received tcp transmit skb

In both the scenarios, TCP_ECN_DEMAND_CWR is set.

Behavior for TCP receiver

On receiving data following ECN specific actions are taken:

Check for CWR (TCP_ECN_accept_cwr)

If the peer has indicated CWR, reset TCP_ECN_DEMAND_CWR so that the subsequent packets will not demand congestion window reduction.

Check for CE (TCP_ECN_check_ce)

If TCP_ECN_OK and the data received has CE bit set in IP header, set TCP_ECN_DEMAND_CWR in ecn flag. If TCP_ECN_OK and the ECT bits are not set in IP header, this indicates a retransmitted packet, TCP falls into quick ack mode.

Behavior for TCP Sender

While transmitting data (TCP_ECN_send)

If the packet is not being retransmitted

  1. set ECT bit in IP header
  2. If congestion window was reduced, indicate to peer by setting CWR bit in TCP header.

In case this is a retransmission, reset the ECT bits in IP header. If CE bit was received set in some packet from peer (TCP_ECN_DEMAND_CWR), set ECE bit in TCP header.

While receiving ack (TCP_ECN_rcv_ecn_echo)

ECN echo is declared when

  1. ECE is set in received packet
  2. Its not a SYN packet
  3. TCP_ECN_OK (ECN was negotiated)

Congestion window reduction (TCP_ECN_queue_cwr)

When Congestion window is reduced on detection of loss, if TCP_ECN_OK set TCP_ECN_QUEUE_CWR

Undo loss detection (TCP_ECN_withdraw_cwr)

When TCP decides to undo the reduction in congestion window, TCP_ECN_DEMAND_CWR flag is reset.

Maintainer: seema.garg@hsc.com

Categories: Inside_Linux_TCP Software

Comments

Add Comment 
Email address(will be kept hidden) 
Enter code:

Page last modified on November 04, 2009, at 06:06 AM