Skip to content

Commit 074e2e8

Browse files
Packet trimming: Add DSCP resolution from TC and documentation (#2155)
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
1 parent 290c475 commit 074e2e8

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 DSCP 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

@@ -3277,6 +3297,25 @@ typedef enum _sai_switch_attr_t
32773297
*/
32783298
SAI_SWITCH_ATTR_SYNCE_CLOCK_LIST,
32793299

3300+
/**
3301+
* @brief New packet trim TC value
3302+
*
3303+
* @type sai_uint8_t
3304+
* @flags CREATE_AND_SET
3305+
* @default 0
3306+
* @validonly SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE == SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_FROM_TC
3307+
*/
3308+
SAI_SWITCH_ATTR_PACKET_TRIM_TC_VALUE,
3309+
3310+
/**
3311+
* @brief DSCP mapping mode for a trimmed packet
3312+
*
3313+
* @type sai_packet_trim_dscp_resolution_mode_t
3314+
* @flags CREATE_AND_SET
3315+
* @default SAI_PACKET_TRIM_DSCP_RESOLUTION_MODE_DSCP_VALUE
3316+
*/
3317+
SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE,
3318+
32803319
/**
32813320
* @brief End of attributes
32823321
*/

0 commit comments

Comments
 (0)