Skip to content

Commit 5123b4e

Browse files
Packet trimming: Add DSCP resolution from TC and documentation
1 parent 7df1c94 commit 5123b4e

3 files changed

Lines changed: 87 additions & 0 deletions

File tree

doc/SAI-Proposal-Packet-Trimming.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,51 @@ Both the queue and the port have the packet counter to reflect the number of tri
164164
/** Packets trimmed due to failed admission [uint64_t] */
165165
SAI_QUEUE_STAT_TRIM_PACKETS = 0x00000028,
166166
```
167+
168+
It can also be beneficial to support multiple DSCP values for trimmed packets sent out via different ports. For example, trimmed packets sent to hosts will get DSCP 5 whereas trimmed packets sent to uplink/spine will have DSCP 7. It is to allow to the destination NIC to know where congestion happened - on downlinks to servers or in the fabric. Such information can be used for a better decision making on how to react to the state of network.
169+
170+
![](figures/trim-TC.png)
171+
172+
The diagram above shows the general concept - instead of setting a trim DSCP, we set a trim TC value, which, by applying a different TC to DSCP map per egres port, will yield a different DSCP value.
173+
174+
```
175+
typedef enum _sai_packet_trim_dscp_resolution_mode_t
176+
{
177+
/**
178+
* @brief Static DSCP resolution.
179+
*
180+
* In this mode, a new DSCP for the trimmed packet is set directly
181+
* by the application.
182+
*/
183+
SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_DSCP_VALUE,
184+
185+
/**
186+
* @brief Dynamic DSCP resolution.
187+
*
188+
* In this mode, a new DSCP for the trimmed packet is resolved from the new TRIM_TC
189+
* set by the application using per-port TC_TO_DSCP mapping
190+
*/
191+
SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_FROM_TC
192+
} sai_packet_trim_dscp_resolution_mode_t;
193+
```
194+
195+
```
196+
/**
197+
* @brief New packet trim TC value
198+
*
199+
* @type sai_uint8_t
200+
* @flags CREATE_AND_SET
201+
* @default 0
202+
* @validonly SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE == SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_FROM_TC
203+
*/
204+
SAI_SWITCH_ATTR_PACKET_TRIM_TC_VALUE,
205+
206+
/**
207+
* @brief Queue mapping mode for a trimmed packet
208+
*
209+
* @type sai_packet_trim_dscp_resolution_mode_t
210+
* @flags CREATE_AND_SET
211+
* @default SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_DSCP_VALUE
212+
*/
213+
SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE,
214+
```

doc/figures/trim-TC.png

40 KB
Loading

inc/saiswitch.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,25 @@ typedef enum _sai_packet_trim_queue_resolution_mode_t
640640

641641
} sai_packet_trim_queue_resolution_mode_t;
642642

643+
typedef enum _sai_packet_trim_dscp_resolution_mode_t
644+
{
645+
/**
646+
* @brief Static DSCP resolution.
647+
*
648+
* In this mode, a new DSCP for the trimmed packet is set directly
649+
* by the application.
650+
*/
651+
SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_DSCP_VALUE,
652+
653+
/**
654+
* @brief Dynamic DSCP resolution.
655+
*
656+
* In this mode, a new DSCP for the trimmed packet is resolved from the new TRIM_TC
657+
* set by the application using per-port TC_TO_DSCP mapping
658+
*/
659+
SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_FROM_TC
660+
} sai_packet_trim_dscp_resolution_mode_t;
661+
643662
/**
644663
* @brief Attribute Id in sai_set_switch_attribute() and
645664
* sai_get_switch_attribute() calls.
@@ -3169,6 +3188,7 @@ typedef enum _sai_switch_attr_t
31693188
* @type sai_uint8_t
31703189
* @flags CREATE_AND_SET
31713190
* @default 0
3191+
* @validonly SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE == SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_DSCP_VALUE
31723192
*/
31733193
SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_VALUE,
31743194

@@ -3203,6 +3223,25 @@ typedef enum _sai_switch_attr_t
32033223
*/
32043224
SAI_SWITCH_ATTR_SHARED_BUFFER_CELL_SIZE,
32053225

3226+
/**
3227+
* @brief New packet trim TC value
3228+
*
3229+
* @type sai_uint8_t
3230+
* @flags CREATE_AND_SET
3231+
* @default 0
3232+
* @validonly SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE == SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_FROM_TC
3233+
*/
3234+
SAI_SWITCH_ATTR_PACKET_TRIM_TC_VALUE,
3235+
3236+
/**
3237+
* @brief Queue mapping mode for a trimmed packet
3238+
*
3239+
* @type sai_packet_trim_dscp_resolution_mode_t
3240+
* @flags CREATE_AND_SET
3241+
* @default SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_DSCP_VALUE
3242+
*/
3243+
SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE,
3244+
32063245
/**
32073246
* @brief End of attributes
32083247
*/

0 commit comments

Comments
 (0)