---
title: "Easy RoCE" Configuration Guide
slug: aidc/easy-roce-configuration-guide
description: Intelligent Lossless Network Configuration Guide
createdAt: 2025-11-12T12:13:54.496Z
---

## <font color="#1d50a2">Introduction</font>

RDMA (Remote Direct Memory Access), as a network-based memory access technology, is widely adopted in supercomputing, AI training, storage, and other scenarios.
Initially implemented on InfiniBand networks, RDMA later evolved into Ethernet-based protocols—iWARP and RoCE (RDMA over Converged Ethernet).
RoCEv2 operates over the connectionless UDP protocol. Compared to connection-oriented TCP, UDP offers faster speeds and lower resource consumption. However, unlike TCP—which ensures reliable transmission through mechanisms like sliding windows and acknowledgment—RoCEv2 faces significant performance degradation upon packet loss. RDMA NICs discard subsequently received packets when loss occurs, forcing retransmission of all subsequent data from the sender.
Thus, RDMA requires a lossless Ethernet environment. To address this, RoCEv2 employs PFC (Priority Flow Control) and ECN (Explicit Congestion Notification) technologies to guarantee data transmission reliability.
To simplify the difficulty of lossless Ethernet deployment and maintenance, Asterfusion has launched "Easy RoCE" on AsterNOS. Focusing on the requirements of RoCEv2 scenario, we have implemented a business-level command line wrapper on high-rate products, such as CX532P-N, to achieve the best maintainability and usability in this scenario.

## <font color="#1d50a2">Enable "Easy RoCE"</font>

With key parameters Cable-length, Incast-level, Traffic-model, the system will automatically generate a lossless configuration template. It applies the default DSCP mapping, with PFC and ECN enabled for queue 3 and 4, and strict priority scheduling set for queue 6 and 7.
The key parameters of Easy RoCE are detailed below:

- <font color="#1d05a2">Cable-length\:</font> cable length, used for the calculation of PFC and ECN parameters
- <font color="#1d05a2">Incast-level\:</font> incast traffic model, optional levels low, medium, high, for the calculation of PFC parameters
- <font color="#1d05a2">Traffic-mode\: </font>service type, optional throughput-sensitive service, delay-sensitive service, balanced type, used for the calculation of ECN parameters

:::hint{type="info"}
**NOTE:**&#x20;
CX308P-48Y-N-V2 and CX532P-N-V2 models do not support this function at now.
:::

The lossless RoCE configuration template generated by "Easy RoCE" is shown as follows:

```plaintext
sonic# show running-config
buffer-profile roce_lossless_25g_profile
mode lossless dynamic 1 size 1518 xoff 27104 xon-offset 13440
!
buffer-profile roce_lossless_50g_profile
mode lossless dynamic 1 size 1518 xoff 28448 xon-offset 13440
!
buffer-profile roce_lossless_100g_profile
mode lossless dynamic 1 size 1518 xoff 38816 xon-offset 13440
!
class-map roce_lossless_25g_class_map
match cos 3 4
!
class-map roce_lossless_50g_class_map
match cos 3 4
!
class-map roce_lossless_100g_class_map
match cos 3 4
!
diffserv-map type ip-dscp roce_lossless_25g_diffserv_map
default copy
!
diffserv-map type ip-dscp roce_lossless_50g_diffserv_map
default copy
!
diffserv-map type ip-dscp roce_lossless_100g_diffserv_map
default copy
!
wred roce_lossless_25g_ecn
mode ecn gmin 15360 gmax 1388576 gprobability 90
!
wred roce_lossless_50g_ecn
mode ecn gmin 15360 gmax 1388576 gprobability 90
!
wred roce_lossless_100g_ecn
mode ecn gmin 15360 gmax 1388576 gprobability 90
!
policy-map roce_lossless_25g
class roce_lossless_25g_class_map
  priority-group-buffer roce_lossless_25g_profile
  wred roce_lossless_25g_ecn
queue-scheduler priority queue 6
queue-scheduler priority queue 7
set cos dscp diffserv roce_lossless_25g_diffserv_map
!
policy-map roce_lossless_50g
class roce_lossless_50g_class_map
  priority-group-buffer roce_lossless_50g_profile
  wred roce_lossless_50g_ecn
queue-scheduler priority queue 6
queue-scheduler priority queue 7
set cos dscp diffserv roce_lossless_50g_diffserv_map
!
policy-map roce_lossless_100g
class roce_lossless_100g_class_map
  priority-group-buffer roce_lossless_100g_profile
  wred roce_lossless_100g_ecn
queue-scheduler priority queue 6
queue-scheduler priority queue 7
set cos dscp diffserv roce_lossless_100g_diffserv_map
```

Meanwhile, when the template above is not fully applicable to your business scenario, we recommend you to modify the parameters via command line, refer to [Configuration and Parameter Tuning](https://docs.asternos.com/aidc/configuration-guide/v31/11-qos-configuration//#configuration-and-parameter-tuning) for details.

### <font color="#1d50a2">RoCE Default Setting</font>

The default setting of RoCE is shown in the following table.

<font color="#1d05a2">Table 1 Default setting of RoCE</font>

| **Parameters** | **Default value** |
| -------------- | ----------------- |
| cable-length   | 40m               |
| incast-level   | low               |
| traffic-model  | latency           |

### <font color="#1d50a2">Create RoCE configuration templates</font>

<font color="#1d05a2">Table 2 Create RoCE configuration templates</font>

| **Purpose**                                     | **Command**                                                                                                 | **Description**                                                                                                                                                                                                               |
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Enter global configuration view.                | **configure terminal**                                                                                      | -                                                                                                                                                                                                                             |
| Generate lossless RoCE configuration templates. | **qos roce lossless** \[**cable-length** *length*] \[**incast-level** *level*] \[**traffic-model** *model*] | *length*: specify the cable length, optional **5m/40m/ 100m/300m**.*level*: specify the incast model, optional **low**/ **medium**/**high**.*model*: specify the flow model, optional **throughput**/ **latency**/**balance** |

### <font color="#1d50a2">Apply Lossless RoCE Configuration to All Interfaces</font>

<font color="#1d05a2">Table 3 Apply lossless RoCE Configuration to All Interfaces</font>

| **Purpose**                                          | **Command**                                                          | **Description**                                                                                                           |
| ---------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| Enter global configuration view.                     | **configure terminal**                                               | -                                                                                                                         |
| Apply lossless RoCE configuration to all interfaces. | **qos service-policy** \{**roce\_lossless**\| *RoCE\_profile\_name*} | **roce\_lossless**: RoCE template under default parameters. *RoCE\_profile\_name*: the name of the specific RoCE template |

### <font color="#1d50a2">Apply Lossless RoCE Configuration to Specified Interfaces</font>

<font color="#1d05a2">Table 4 Apply lossless RoCE Configuration to Specified Interfaces</font>

| **Purpose**                                                        | **Command**                                                  | **Description**                                          |      |
| ------------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------------------------------------- | ---- |
| Enter global configuration view.                                   | **configure terminal**                                       | -                                                        |      |
| Enter the RoCE template configuration view                         | **qos roce** *RoCE\_profile\_name*                           | *RoCE\_profile\_name*: Specifies the RoCE template name. |      |
| Bind the interfaces that need to be enabled for RoCE configuration | **bind interface** \{**all**\|**ethernet** *interface\_name* | **range** *interface\_name\_list*}                       | **** |

## <font color="#1d50a2">Configuration and Parameter Tuning</font>

When the default lossless RoCE configuration above is not fully applicable to your business scenario, you can adjust configurations and parameters through the command line to optimize business performance.

### <font color="#1d50a2">Configure DSCP mapping</font>

<font color="#1d05a2">Table 5 Configure DSCP mapping</font>

| **Operation**                          | **Command**                                                                                                                                                   | **Description**                                                         |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Enter global configuration view.       | **configure terminal**                                                                                                                                        | -                                                                       |
| Enter DSCP mapping configuration view. | **diffserv-map type ip-dscp** *roce\_lossless\_ diffserv\_map*                                                                                                | -                                                                       |
| Modify DSCP to COS mapping.            | **ip-dscp** *value* **cos** *cos\_value*                                                                                                                      | *value*: DSCP value, range 0-63<br />*cos\_value*: COS value, range 0-7 |
| **default** \{*cos\_value*\|**copy**}  | *cos\_value* indicates that all packets are mapped to the corresponding COS value.<br />**default copy** indicates to use default DSCP mapping of the system. |                                                                         |

### <font color="#1d50a2">Configure queue scheduling policy</font>

If you have already bound the lossless RoCE policy to interfaces, please unbind it first before modifying.

<font color="#1d05a2">Table 6 Configure queue scheduling policy</font>

| **Purpose**                                    | **Command**                                                                 | **Description**                                                                                         |
| ---------------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Enter global configuration view.               | **configure terminal**                                                      | -                                                                                                       |
| Enter lossless RoCE policy configuration view. | **policy-map roce\_lossless**                                               | -                                                                                                       |
| Configure SP mode scheduling.                  | **queue-scheduler priority queue** *queue-id*                               | *queue-id* range from 0 to 7.                                                                           |
| Configure DWRR mode scheduling.                | **queue-scheduler queue-limit percent** *queue-weight* **queue** *queue-id* | *percentage* specifies the scheduling weight of DWRR, range from 0 to 100.*queue-id* range from 0 to 7. |

### <font color="#1d50a2">Set PFC threshold</font>

<font color="#1d05a2">Table 7 Set PFC threshold</font>

| **Purpose**                      | **Command**                                                                                                          | **Description** |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------- |
| Enter global configuration view. | **configure terminal**                                                                                               | -               |
| Enter PFC configuration view.    | **buffer-profile** *roce\_lossless\_profile*                                                                         | -               |
| Modify PFC lossless buffer.      | **mode lossless dynamic** *dynamic\_th* **size** *size* **xoff** *xoff* **xon-offset** *xon-offset* \[**xon** *xon*] | -               |

- <font color="#1d05a2">*dynamic\_th\:*</font>  is a dynamic threshold coefficient, and the range is \[-4,3]. Dynamic\_th = 2dynamic\_th\*remaining available buffer. e.g., if *dynamic\_th* is set to 1, then the dynamic threshold is 2 times of the remaining available buffer, i.e., the actual threshold is 2/3 of the total available buffer.
- <font color="#1d05a2">*size\:*</font>  specifies the reservation size in bytes, and the recommended configuration value is 1518.
- <font color="#1d05a2">*xoff\:* </font> is PFC backpressure frame trigger buffer threshold value, and it is recommended to configure it as an integer multiple of the cell size in bytes. xoff is related to the cable length, interface rate and other parameters, and you can refer to the recommended configuration values  for configuration. xoff must be greater than the xon value.
- <font color="#1d05a2">*xon-offset\:*</font>  is PFC backpressure frame stop buffer threshold value, which is recommended to be an integer multiple of the cell size, and the unit is byte. The recommended configuration value is 13440.
- <font color="#1d05a2">*xon\:*</font>  is an optional parameter and is normally configured as 0.

### <font color="#1d50a2">Set ECN threshold</font>

<font color="#1d05a2">Table 8 Set ECN threshold</font>

| **Purpose**                      | **Command**                                                                                                                                                                                                                     | **Description** |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
| Enter global configuration view. | **configure terminal**                                                                                                                                                                                                          | -               |
| Enter ECN configuration view.    | **wred** *roce\_lossless\_ecn*                                                                                                                                                                                                  | -               |
| Modify ECN parameters.           | **mode ecn gmin** *min\_th* **gmax** *max\_th* **gprobability** *probability* \[**ymin** *min\_t**h*** **ymax** *max\_th* **yprobability** *probability*\|**rmin** *min\_th* **rmax** *max\_th* **rprobability** *probability*] |                 |

- <font color="#1d05a2">*min\_th\:* </font>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. The recommended configuration value is 15360.
- <font color="#1d05a2">*max\_th\:*</font> 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.
  The recommended configuration values for the different rate interfaces are as follows:
  100G(bps)	---	768000(bytes)
  200G(bps)	---	768000(bytes)
  400G(bps)	---	1536000(bytes)
- <font color="#1d05a2">*probability\:*</font> 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.

## <font color="#1d50a2">Display and Maintenance</font>

<font color="#1d05a2">Table 9 "Easy RoCE" Display and Maintenance</font>

| **Purpose**                                                  | **Command**                                                                 | **Description**                                                                                                                                                                                                                                                                          |
| ------------------------------------------------------------ | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Display RoCE-related configurations.                         | **show qos roce** \[**all**\|**summary**\|*RoCE\_profile\_name*]            | By default, only RoCE configuration templates in use (i.e., bound interfaces) are displayed. **all**: view all created RoCE configurations.<br />**summary**: to view the summary of RoCE configuration *RoCE\_profile\_name*: specify the RoCE configuration template name to be viewed |
| Display the relationship between interfaces and policy-maps. | **show interface policy-map**                                               | -                                                                                                                                                                                                                                                                                        |
| Display RoCE statistics of the interface.                    | **show counters qos roce interface** *interface\_name* **queue** *queue-id* | -                                                                                                                                                                                                                                                                                        |
| Clear RoCE statistics of all interfaces.                     | **clear counters qos roce**                                                 | -                                                                                                                                                                                                                                                                                        |

## <font color="#1d50a2">Configuration Examples</font>

1. Enable Easy RoCE and apply it to all interfaces.

```plaintext
sonic# configure terminal
sonic(config)# qos roce lossless cable-length 40m incast-level low traffic-model latency
sonic(config)# qos service-policy roce_lossless_40m_low_latency
```

1. Display RoCE-related configurations.

```plaintext
sonic# show qos roce
Notice: Displaying configurations of in-use RoCE profiles
==> RoCE Profile: roce_lossless_40m_low_latency | RoCE Policy Map: roce_lossless_40m_low_latency_25g <==
+--------------------+-------------------+-----------------------------------------------------+
|                    | Operational       | Description                                         |
+====================+===================+=====================================================+

| Mode               | Lossless          | QoS RoCE mode                                       |
+--------------------+-------------------+-----------------------------------------------------+

| Status             | Bind: 0/104-0/107 | QoS RoCE binding status                             |
+--------------------+-------------------+-----------------------------------------------------+

| Cable Length       | 40m               | Cable length in meters for QoS RoCE lossless config |
+--------------------+-------------------+-----------------------------------------------------+

| Congestion-Control | -                 | -                                                   |
|  - Congestion Mode | ECN               | Congestion control mode                             |
|  - Enabled TC      | 3,4               | Congestion control config enabled traffic class     |
|  - Max Threshold   | 1388576           | Congestion control config max threshold             |
|  - Min Threshold   | 15360             | Congestion control config max threshold             |
+--------------------+-------------------+-----------------------------------------------------+

| PFC                | -                 | -                                                   |
|  - PFC Priority    | 3,4               | PFC enabled switch priority                         |
|  - TX Status       | Enabled           | PFC RX status                                       |
|  - RX Status       | Enabled           | PFC TX status                                       |
+--------------------+-------------------+-----------------------------------------------------+

| Trust              | -                 | -                                                   |
|  - Trust Mode      | DSCP              | Trust setting for packet classification             |
+--------------------+-------------------+-----------------------------------------------------+

====> RoCE DSCP->SP Mapping Configurations <====
+-------------------------+-------------------+
| DSCP                    | Switch Priority   |
+=========================+===================+

| 0,1,2,3,4,5,6,7         | 0                 |
| 8,9,10,11,12,13,14,15   | 1                 |
| 16,17,18,19,20,21,22,23 | 2                 |
| 24,25,26,27,28,29,30,31 | 3                 |
| 32,33,34,35,36,37,38,39 | 4                 |
| 40,41,42,43,44,45,46,47 | 5                 |
| 48,49,50,51,52,53,54,55 | 6                 |
| 56,57,58,59,60,61,62,63 | 7                 |
+-------------------------+-------------------+

====> RoCE SP->TC Mapping & ETS Configurations <====
+-------------------+--------+----------+
| Switch Priority   | Mode   | Weight   |
+===================+========+==========+

| 6                 | SP     | -        |
| 7                 | SP     | -        |
+-------------------+--------+----------+

====> PFC Profile Configurations <====
+--------------------------------------------+-------------------+
| Profile Name                               | Switch Priority   |
+============================================+===================+

| egress_lossless_profile                    | 3,4               |
| egress_lossy_profile                       | 0,1,2,5,6,7       |
| ingress_lossy_profile                      | 0,1,2,5,6,7       |
| roce_lossless_40m_low_latency_25g_profile  | 3,4               |
| roce_lossless_40m_low_latency_50g_profile  | 3,4               |
| roce_lossless_40m_low_latency_100g_profile | 3,4               |
+--------------------------------------------+-------------------+

……
```

1. Display RoCE statistics of the interface.

```plaintext
sonic# show counters qos roce interface 0/32 queue 3
                              operational
-----------------------------  -----------------
roce states                    Ethernet32.3
pfc-stats
- pfc_rx_stats                 0
- pfc_tx_stats                 402
- pg-stats
-   total_packet               11,380,786,999
-   total_bytes                1,456,740,735,872
-   drop_packet                0
-   curr_occupancy             0
ecn-stats
- ecn_stats                    0
- ecn_buffer
-   shared_use_watermark_byte  0
-   total_use_watermark_byte   0
-   total_use_count_byte       0
queue-stats
- Counter_pkts                 0
- Counter_bytes                0
- Drop_pkts                    0
- Drop_bytes                   0
- CounterRate_pkts             0.0
- CounterRate_bytes            0.0
- DropRate_pkts                0.0
- DropRate_bytes               0.0
- Occupancy_bytes              0
- SharedOccupancy_bytes        0
```

