[Enterprise SONiC] ECN Follow
ECN (Explicit congestion notification)
Explicit congestion notification (ECN) enables traffic congestion control between two ECN-enabled devices. When the congestion is detected by the switch, the ECN field is set in the IP header of a packet before forwarding it. If the receiver device received the packets with ECN marked, it sends the congestion notification packets (CNP) to the sender device to reduce the transmit packet rate. The CNP packets continue to send to the sender until the congestion is released.
ECN uses the WRED thresholds being applied to an egress queue.
When ECN enabled, process the packets based on following rules:
- When the average queue length is below the minimum threshold, no packet is marked.
- When the average queue length is between minimum threshold and maximum threshold, one of the following scenarios can occur:
- If received the IP packet with ECT(0) or ECT(1) codepoints, changes the ECT and EC bits to 1 based drop probability and forwards the packet.
- If received the IP packet with CE codepoint '11', the packet is transmitted. No further marking is required.
- If received the IP packet with not-ECT codepoint '00', the packet is transmitted.
- When the average queue length exceeds the maximum threshold, all the incoming IP packets with the ECT(0) and ECT(1) codepoints are marked.
Restriction:
- ECN is not supported on EPS121(AS4625-54T) and EPS122(AS4625-54P)
- The profile of the WRED only supports Green.
Tested model & firmware version:
- Switch model name:
DCS520 (AS9736-64D)
- Edgecore SONiC version:
202111.8
Topology:
To achieve ECN marked by AS9736-64D, we need to trigger the traffic congestion first.
Both Packet Generator (Tx) will inject 400G traffic to Packet Generator (Rx) to trigger the traffic congestion.
Here's the Packet format.
On Packet Generator (Tx) must mark packets as ECN-capable ( ECT 1 or ECT 0).
Pre-configuration:
Add VLAN 10 to Ethernet0, Ethernet8, and Ethernet16.
admin@sonic:~$ show vlan brief
+-----------+--------------+-----------+----------------+-------------+---------------+---------------+-------------+
| VLAN ID | IP Address | Ports | Port Tagging | Proxy ARP | DHCP Helper | DHCP Relay Configuration |
| | | | | | Address | |
+===========+==============+===========+================+=============+===============+===============+=============+
| 10 | | Ethernet0 | tagged | disabled | | Source Interface: |
| | | Ethernet8 | tagged | | | Link Selection: |
| | | Ethernet16| tagged | | | Server Vrf: |
| | | | | | | Server ID Override: |
+-----------+--------------+-----------+----------------+-------------+---------------+---------------+-------------+
Procedure:
Step 1: Create the Profile of the WRED and enable ECN
admin@sonic:~$ sudo config wred add wred-prof --mode ecn --gmin 100000 --gmax 250000 --gdrop 10
Note:
- The profile of the WRED only support Green.
- If you want to modify the Profile of the WRED, here's the command to set it.
admin@sonic:~$ sudo config wred update wred-prof --gmin 100000 --gmax 240000 --gdrop 10
- The range of the threshold could be checked with "--help", for example:
admin@sonic:~$ sudo config wred add --help
Usage: config wred add [OPTIONS] <profile>
Add ECN WRED profile.
Options:
--mode [ecn|wred|both] ECN or WRED mode. [required]
--gmin INTEGER RANGE Minimum threshold in bytes to start WRED dropping
or ECN marking for green packet. [0-133168898]
--gmax INTEGER RANGE Maximum threshold in bytes for WRED dropping or
ECN marking for green packet. [0-133168898]
--gdrop INTEGER RANGE Maximum dropping or marking probability for green
packet. [0-100]
... omitted
Regarding the "--mode", here's the explanation.
Assume The situation is the average queue length is between minimum threshold and maximum threshold.
"ecn": ECN-capable packets will mark, Non ECN-Capable packets will not mark or drop.
"wred": ECN-capable packets or Non ECN-Capable packets will be dropped.
"both": ECN-capable packets will mark and Non ECN-Capable packets will be dropped.
-
- Please note the behavior is different before version 2111.8.
Here's the behavior with the old version:- "ecn": ECN-capable packets will mark, Non ECN-Capable packets will be dropped.
- "wred": ECN-capable packets or Non ECN-Capable packets will be dropped.
- Doesn't support "both".
- Please note the behavior is different before version 2111.8.
- The devices using the Broadcom ASIC, the maximum drop probability supports one of [0~10, 25, 50, 75, 100] in hardware.
- If the user configuration value is from 0 to 10, takes the same value as hardware configuration.
- If the user configuration value is from 10 to 24, takes 10 as hardware configuration.
- If the user configuration value is from 25 to 49, takes 25 as hardware configuration.
- If the user configuration value is from 50 to 74, takes 50 as hardware configuration.
- If the user configuration value is from 75 to 99, takes 75 as hardware configuration.
- If the user configuration value exceeds 100, takes 100 is used for hardware configuration.
Step 2: Check the WRED profile.
admin@sonic:~$ show wred
Profile: wred-prof
Mode: ECN
Min Threshold (Byte) Max Threshold (Byte) Mark Probability (%)
------ ---------------------- ---------------------- ----------------------
Green 100000 250000 10
Yellow - - -
Red - - -
Step 3: Binding the WRED profile on queue 3 of the Ethernet16.
admin@sonic:~$ sudo config interface wred bind queue Ethernet16 3 wred-prof
Step 4: Check the Interface that binds the WRED profile.
admin@sonic:~$ show interfaces wred Ethernet16
Ethernet16
Queue: 3
Profile: wred-prof
Mode: ECN
Min Threshold (Byte) Max Threshold (Byte) Mark Probability (%)
------ ---------------------- ---------------------- ----------------------
Green 100000 250000 10
Yellow - - -
Red - - -
Result:
Capture the packet from the Packet Generator (Rx), the switch Remark the ECT to CE.
ECN uses the last two bits, ECT and CE, below is the Differentiated Services Field of the IP header as the following:
ECT |
EC |
Combinations Indicate |
---|---|---|
0 | 0 | Non ECN-Capable Transport, Non-ECT |
0 | 1 | ECN Capable Transport, ECT(1) |
1 | 0 | ECN Capable Transport, ECT(0) |
1 | 1 | Congestion Encountered, CE |
Comments
0 comments
Please sign in to leave a comment.