HowTo Configure ECN on Mellanox Ethernet Switches (Spectrum)

Version 11

    This post guides how to configure ECN on Mellanox Spectrum based switches.

     

    References

     

    Random early detection (RED) is a mechanism that, in case of congestion, randomly drops packets, before the switch buffer fills up.

    Explicit congestion notification (ECN) is similar to RED, but when congestion occurs, it marks packets instead of dropping them. The marking uses two dedicated bits of a Diffserv field in the IP header.

    RED and ECN can be configured separately or concurrently per traffic class.

    RED/ECN file dropping is defined according to two parameters (minimum and maximum queue length). Thresholds can be absolute or relative. Absolute thresholds define absolute queue length values. Relative thresholds define queue length values in a percenatge relative to the threshold configured for the shared buffer.

     

    121.png

     

    Threshold Mode:

    • Relative: uses the values in percentage of the tc possible buffer.

    • Absolute: uses the values in KB of the tc possible buffer.

     

    Threshold Value:

    • Minimum - a threshold that defines the queue length below which the packets are not dropped/marked.
    • Maximum – a threshold that defines the queue length above which the packets are always dropped/marked

     

    When the tc queue is between the minimum and the maximum, the packets will be randomly dropped as for the graph.

     

    ECN can be configured, with or without RED, using the following commands for a specific traffic (e.g. traffic-class 0) per interface (e.g. 1/1).

    switch (config interface ethernet 1/1) # traffic-class 0 congestion-control ecn minimum-relative 20 maximum-relative 80    --> Packets are only marked with Congestion via the ECN bits

     

    Or

     

     

    switch (config interface ethernet 1/1) # traffic-class 0 congestion-control red minimum-relative 20 maximum-relative 80    --> Packets are only randomly dropped (RED), no ECN marking is done

     

    Or

     

    switch (config interface ethernet 1/1) # traffic-class 0 congestion-control both minimum-relative 20 maximum-relative 80   --> Packets are marked with congestion via the ECN bits and and randomly dropped (RED)

     

    In a similar way, you can use minimum-absolute and maximum-absolute to configure, for example:

    switch (config interface ethernet 1/1) #traffic-class 0 congestion-control ecn minimum-absolute 150 maximum-absolute 1500

     

    Note: the values are in KB.

     

    Configuration

    The setup in this example is based on Mellanox Spectrum SN2700.

    Note : SwitchX based switch systems do not  support this configuration.

     

    Per port, per required tc (0-7), use the following command to set the ECN with minimum and maximum values.

    In this example, ECN is configured with a absolute threshold (percentage of the queue).

    switch (config interface ethernet 1/1) # traffic-class 0 congestion-control ecn minimum-absolute 150 maximum-absolute 1500

     

    Verification

    Use the following show command to check the configuration and monitor the traffic.

    switch (config interface ethernet 1/1) # show interfaces ethernet 1/1 congestion-control

    Interface ethernet: 1/1

     

    ECN marked packets: 0

    TC-0

            Mode: ECN

            Threshold mode: absolute

            Minimum threshold: 150 KB

            Maximum threshold: 1500 KB

            RED dropped packets: 0

    TC-1

            Mode: none

    TC-2

            Mode: none

    TC-3

            Mode: none

    TC-4

            Mode: none

    TC-5

            Mode: none

    TC-6

            Mode: none

    TC-7

            Mode: none