---
title: ECN
slug: aidc/ecn
createdAt: 2025-12-01T11:11:08.000Z
---

## <font color="#1d50a2">ECN View</font>

<font color="#1d05a2">Table 1 ECN View</font>

| **Command**                                                                   | **Purpose**               |
| ----------------------------------------------------------------------------- | ------------------------- |
| **show wred** \[*wred\_profile\_name*]                                        | Display ECN profiles.     |
| **show counters ecn**                                                         | Display ECN counters.     |
| **clear counters ecn**                                                        | Clear ECN counters.       |
| **show counters ecn-buffer interface** *interface\_name* **queue** *queue-id* | Display ECN buffer usage. |

### <font color="#1d50a2">show wred \[*wred\_profile\_name*\]</font>

**\[Command]**
**show wred** \[*wred\_profile\_name*]

**\[Purpose]**
Display ECN profiles.

**\[Parameters]**

| **Parameter**         | **Description** |
| --------------------- | --------------- |
| *wred\_profile\_name* | Profile name.   |

**\[View]**
Privileged User View

**\[Notes]**
The **default\_ecn** is the system-predefined ECN profile.

**\[Use Cases]**

```plaintext
sonic# show wred
Wred profile default_drop:
    ecn: ecn_none
    green_drop_probability: 100
    green_max_threshold: 1792000
    green_min_threshold: 15360
    red_drop_probability: 100
    red_max_threshold: 8960000
    red_min_threshold: 15360
    wred_green_enable: true
    wred_red_enable: true
    wred_yellow_enable: true
    yellow_drop_probability: 100
    yellow_max_threshold: 7168000
    yellow_min_threshold: 15360
Wred profile default_ecn:
    ecn: ecn_all
    green_drop_probability: 100
    green_max_threshold: 1792000
    green_min_threshold: 15360
    red_drop_probability: 100
    red_max_threshold: 8960000
    red_min_threshold: 15360
    wred_green_enable: true
    wred_red_enable: true
    wred_yellow_enable: true
    yellow_drop_probability: 100
    yellow_max_threshold: 7168000
    yellow_min_threshold: 15360
```

### <font color="#1d50a2">show counters ecn</font>

**\[Command]**
**show counters ecn**

**\[Purpose]**
Display ECN counters.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show counters ecn
    Port Tx    ECN0    ECN1    ECN2    ECN3    ECN4    ECN5    ECN6    ECN7
-----------  ------  ------  ------  ------  ------  ------  ------  ------
        0/0       0       0       0       0       0       0       0       0
        0/4       0       0       0       0       0       0       0       0
        0/8       0       0       0       0       0       0       0       0
       0/12       0       0       0       0       0       0       0       0
       0/16       0       0       0       0       0       0       0       0
       0/20       0       0       0       0       0       0       0       0
       0/24       0       0       0       0       0       0       0       0
       0/28       0       0       0       0       0       0       0       0
       0/32       0       0       0       0       0       0       0       0
       0/36       0       0       0       0       0       0       0       0
       0/40       0       0       0       0       0       0       0       0
       0/44       0       0       0       0       0       0       0       0
       0/48       0       0       0       0       0       0       0       0
       0/52       0       0       0       0       0       0       0       0
       0/56       0       0       0       0       0       0       0       0
       0/60       0       0       0       0       0       0       0       0
       0/64       0       0       0       0       0       0       0       0
       0/68       0       0       0       0       0       0       0       0
       0/72       0       0       0       0       0       0       0       0
       0/76       0       0       0       0       0       0       0       0
       0/80       0       0       0       0       0       0       0       0
       0/84       0       0       0       0       0       0       0       0
       0/88       0       0       0       0       0       0       0       0
       0/92       0       0       0       0       0       0       0       0
       0/96       0       0       0       0       0       0       0       0
      0/100       0       0       0       0       0       0       0       0
      0/104       0       0       0       0       0       0       0       0
      0/108       0       0       0       0       0       0       0       0
      0/112       0       0       0       0       0       0       0       0
      0/116       0       0       0       0       0       0       0       0
      0/120       0       0       0       0       0       0       0       0
      0/124       0       0       0       0       0       0       0       0
      0/128       0       0       0       0       0       0       0       0
      0/129       0       0       0       0       0       0       0       0
```

### <font color="#1d50a2">clear counters ecn</font>

**\[Command]**
**clear counters ecn**

**\[Purpose]**
Clear ECN counters.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# clear counters ecn
```

### <font color="#1d50a2">show counters ecn-buffer interface *interface\_name* queue *queue-id*</font>

**\[Command]**
**show counters ecn-buffer interface** *interface\_name* **queue** *queue-id*

**\[Purpose]**
Display ECN buffer usage.

**\[Parameters]**

| **Parameter**     | **Description**               |
| ----------------- | ----------------------------- |
| *interface\_name* | Interface name (eg.0/1)       |
| *queue-id*        | Queue ID, the range is \[0,7] |

**\[View]**
Privileged User View

**\[Notes]**
Not supported on CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2.

**\[Use Cases]**

```plaintext
sonic# show counters ecn-buffer interface 0/40 queue 4
interface      queue    shared_use_watermark (Bytes)    total_use_watermark (Bytes)    total_use_count (Bytes)
-----------  -------  ------------------------------  -----------------------------  -------------------------
0/40               4                        3501344                        3501344                    3493056
```

## <font color="#1d50a2">ECN Config</font>

<font color="#1d05a2">Table 2 ECN Config</font>

| **Command**                                                                                                                                                                                                             | **Purpose**                                              |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| **wred** *wred\_profile\_name*                                                                                                                                                                                          | Create a WRED profile and enter WRED Configuration View. |
| **mode ecn gmin** *min\_th* gmax *max\_th* **gprobability** *probability* \[**ymin** *min\_th* **ymax** *max\_th* **yprobability** *probability*\|**rmin** *min\_th* **rmax** *max\_th* **rprobability** *probability*] | Set Explicit Congestion Notification (ECN) parameters.   |
| **wred** \{*wred\_profile\_name*\|**default\_ecn}**                                                                                                                                                                     | Apply the ECN profile to interfaces.                     |

### <font color="#1d50a2">wred *wred\_profile\_name*</font>

**\[Command]**
**wred** *wred\_profile\_name*

**\[Purpose]**
Create a WRED profile and enter WRED Configuration View.

**\[Parameters]**

| **Parameter**         | **Description** |
| --------------------- | --------------- |
| *wred\_profile\_name* | Profile name.   |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no wred** *wred\_profile\_name* to delete the WRED profile.

**\[Use Cases]**

```plaintext
sonic(config)# wred test
sonic(config-wred-test)#
```

### <font color="#1d50a2">mode ecn gmin *min\_th* gmax *max\_th* gprobability *probability* \[ymin *min\_th* ymax *max\_th* yprobability *probability*|rmin *min\_th* rmax *max\_th* rprobability *probability*\]</font>

**\[Command]**
**mode ecn gmin** *min\_th* **gmax** *max\_th* **gprobability** *probability* **\[ymin** *min\_th* **ymax** *max\_th* **yprobability** *probability*|**rmin** *min\_th* **rmax** *max\_th* **rprobability** *probability*]

**\[Purpose]**
Set Explicit Congestion Notification (ECN) parameters.

**\[Parameters]**

| **Parameter** | **Description**                                                                                                                                                                                                                                                                                                                                                          |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| *min\_th*     | Set the low limit absolute value of ECN in bytes. When the message length in the queue reaches this value, the interface starts to set the ECN field of the message to CE according to the probability. The configurable minimum value is 15 KB.                                                                                                                         |
| *max\_th*     | Set the high limit absolute value of ECN in bytes. When the message length in the queue reaches this value, the interface starts to set ECN field of all packets to CE. For CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2, the range is *min\_th* \~ 25165824, for CX864E-N, the range is *min\_th -* 16777216, and for other models, the range is *min\_th* \~ 10240000. |
| *probability* | Set the maximum discard probability in integer form. The range is \[1,100]. It is recommended to set the drop probability to 90 percent for latency-sensitive services and 10 percent for throughput-sensitive services.                                                                                                                                                 |

**\[View]**
WRED Configuration View

**\[Notes]**
Recommended Configuration for 100GE interfaces:
!
wred ecn
mode ecn gmin 15360 gmax 768000 gprobability 90

**\[Use Cases]**

```plaintext
sonic(config-wred-test)# mode ecn gmin 15360 gmax 750000 gprobability 10
```

### <font color="#1d50a2">wred \{*wred\_profile\_name*|default\_ecn\}</font>

**\[Command]**
**wred** \{*wred\_profile\_name*|**default\_ecn**}

**\[Purpose]**
Apply the ECN profile to interfaces.

**\[Parameters]**

| **Parameter**         | **Description** |
| --------------------- | --------------- |
| *wred\_profile\_name* | Profile name.   |

**\[View]**
Policy Map-Class Map Configuration View

**\[Notes]**
Before running this command, please bind an existing class map to specify the queue to be matched for the policy.
The **default\_ecn** is the system-predefined ECN profile.
Run command **no wred** *wred\_profile\_name* to unbind the WRED profile.

**\[Use Cases]**

```plaintext
sonic(config)# class-map classtest
sonic(conifg-cmap-classtest)# exit
sonic(config)# polic-map test1
sonic(config-pmap-test1)# class classtest
sonic(config-pmap-c)# wred wred_profile
```

