-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add packet trimming API #2077
base: master
Are you sure you want to change the base?
Add packet trimming API #2077
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
# Switch Abstraction Interface Change Proposal for Packet Trimming | ||
|
||
Title | Packet Trimming | ||
------------|---------------- | ||
Authors | Nvidia | ||
Status | In review | ||
Type | Standards track | ||
Created | 8/28/2024 | ||
SAI-Version | 1.14 | ||
---------- | ||
|
||
## Overview | ||
When the lossy queue exceeds a buffer threshold, it drops packets without any notification to the destination host. | ||
|
||
When a packet is lost, it can be recovered through fast retransmission (e.g., Go-Back-N in RoCE) or by using timeouts. Retransmission triggered by timeouts typically incurs significant latency. Packet trimming aims to facilitate rapid packet loss notification and, consequently, eliminate slow timeout-based retransmissions. | ||
|
||
To help the host recover data more quickly and accurately, we introduce a packet trimming feature, that upon a failed packet admission to a shared buffer, | ||
will trim a packet to a configured size, and try sending it on a different queue to deliver a packet drop notification to an end host. | ||
|
||
``` | ||
|
||
┌───────────────┐ | ||
│ │ | ||
│Trimmed packet │ | ||
│ │ | ||
└───────────────┘ | ||
|
||
┌─┬─┬─┬─┬────────┐ | ||
│ │ │ │ │ │ | ||
│ │ │ │ │ │ | ||
┌────────────────► │ │ │ │ │ | ||
│ │ │ │ │ │ │ Queue | ||
│ │ │ │ │ │ │ | ||
│ │ │ │ │ │ │ | ||
│ └─┴─┴─┴─┴────────┘ | ||
┌──────────────┐ │ | ||
│ │ ┌──────────────────────────────────────────────────────┐ │ ┌─┬─┬─┬─┬─┬─┬─┬─┬┐ | ||
│ │ │ │ │ │ │ │ │ │ │ │ │ ││ | ||
│ │ │ │ │ \ / │ │ │ │ │ │ │ │ ││ | ||
│ │ │ │ │ \ / │ │ │ │ │ │ │ │ ││ | ||
│ Packet │ │ Pipeline ┼────┼───────\────────► │ │ │ │ │ │ │ ││ Queue | ||
│ │ │ │ / \ │ │ │ │ │ │ │ │ ││ | ||
│ │ │ │ / \ │ │ │ │ │ │ │ │ ││ | ||
│ │ └──────────────────────────────────────────────────────┘ └─┴─┴─┴─┴─┴─┴─┴─┴┘ | ||
│ │ | ||
│ │ | ||
│ │ | ||
└──────────────┘ | ||
``` | ||
|
||
This feature assumes that forwarding tables are configured properly, and the original packet would be delivered to the destination successfully if not for the congestion. | ||
|
||
## Spec | ||
There is a tradeoff between trying to configure a higher threshold in a queue buffer profile and trimming the packet. | ||
|
||
If the user chooses to configure higher thresholds for queues, the probability of a drop on a particular queue is lower only if other ports are less congested at the moment. | ||
|
||
However, if all the ports are equally utilized, it makes sense to create a different buffer profile for these queues, with a stricter threshold to have more fairness in shared buffer. | ||
|
||
A static trimming threshold may not be effective with shared buffer switches, where the buffer resources allocated to a queue or port can vary over time. Therefore, we propose adding a new attribute to a buffer profile to allow configuring packet trimming on such stricter profiles: | ||
``` | ||
/** | ||
* @brief Enum defining queue actions in case the packet fails to pass the admission control. | ||
*/ | ||
typedef enum _sai_buffer_profile_packet_admission_fail_action_t | ||
{ | ||
/** | ||
* @brief Drop the packet. | ||
* | ||
* Default action. Packet has nowhere to go | ||
* and will be dropped. | ||
*/ | ||
SAI_BUFFER_PROFILE_PACKET_ADMISSION_FAIL_ACTION_DROP, | ||
|
||
/** | ||
* @brief Trim the packet. | ||
* | ||
* Try sending a shortened packet over a different | ||
* queue. Original packet will be dropped and trimmed copy of the packet will be send. | ||
* The IP length and checksum fields will be updated in a trimmed copy. | ||
* SAI_QUEUE_STAT_DROPPED_PACKETS as well as SAI_QUEUE_STAT_DROPPED_BYTES | ||
* will count the original discarded frames even if they will be trimmed afterwards. | ||
* Interface statistics must show dropped packets. | ||
* Interface statistics may show sent trimmed packets. | ||
*/ | ||
SAI_BUFFER_PROFILE_PACKET_ADMISSION_FAIL_ACTION_DROP_AND_TRIM, | ||
} sai_buffer_profile_packet_admission_fail_action_t; | ||
``` | ||
``` | ||
/** | ||
* @brief Buffer profile discard action | ||
* | ||
* Action to be taken upon packet discard due to | ||
* buffer profile configuration. Applicable only | ||
* when attached to a queue. | ||
* | ||
* @type sai_buffer_profile_packet_admission_fail_action_t | ||
* @flags CREATE_AND_SET | ||
* @default SAI_BUFFER_PROFILE_PACKET_ADMISSION_FAIL_ACTION_DROP | ||
*/ | ||
SAI_BUFFER_PROFILE_ATTR_PACKET_ADMISSION_FAIL_ACTION, | ||
``` | ||
|
||
Trimming engine attributes are configured globally. | ||
``` | ||
/** | ||
* @brief Trim packets to this size to reduce bandwidth | ||
* | ||
* @type sai_uint32_t | ||
* @flags CREATE_AND_SET | ||
* @default 128 | ||
*/ | ||
SAI_SWITCH_ATTR_PACKET_TRIMMING_SIZE, | ||
|
||
/** | ||
* @brief New packet trimming DSCP value | ||
* | ||
* @type sai_uint8_t | ||
* @flags CREATE_AND_SET | ||
* @default 0 | ||
*/ | ||
SAI_SWITCH_ATTR_PACKET_TRIMMING_DSCP_VALUE, | ||
|
||
/** | ||
* @brief Is the new queue index for a trimmed packet mapped from DSCP | ||
* | ||
* @type sai_bool_t | ||
* @flags READ_ONLY | ||
*/ | ||
SAI_SWITCH_ATTR_PACKET_TRIMMING_QUEUE_INDEX_MAPPED_FROM_DSCP, | ||
|
||
/** | ||
* @brief New packet trimming queue index | ||
* | ||
* @type sai_uint8_t | ||
* @flags CREATE_AND_SET | ||
* @default 0 | ||
* @validonly SAI_SWITCH_ATTR_PACKET_TRIMMING_QUEUE_INDEX_MAPPED_FROM_DSCP == false | ||
*/ | ||
SAI_SWITCH_ATTR_PACKET_TRIMMING_QUEUE_INDEX, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typically the domain will be configured with TRIM_DSCP value and its much better to derive to the queue from the DSCP. Current proposal dis-associates the TRIM_DSCP and queue index i.e. one can configure DSCP_TRIM that may be handled by a certain queue in hw and SAI may configure wrong queue index. Instead of hardcoding the queue index. |
||
``` | ||
|
||
If more granularity is needed (e.g. trim a specific protocol, or packets within protocol), ACL action is added to disable trimming even if the packet is eligible due to a queue with a buffer profile attached that has trimming enabled. | ||
``` | ||
/** | ||
* @brief Disable packet trimming for a given match condition. | ||
* | ||
* This rule takes effect only when packet trimming is configured on a buffer profile of a queue to which a packet belongs. | ||
* | ||
* @type sai_acl_action_data_t bool | ||
* @flags CREATE_AND_SET | ||
* @default disabled | ||
*/ | ||
SAI_ACL_ENTRY_ATTR_ACTION_DISABLE_TRIMMING = SAI_ACL_ENTRY_ATTR_ACTION_START + 0x39, | ||
``` | ||
|
||
Both the queue and the port have the packet counter to reflect the number of trimmed packet. | ||
``` | ||
/** Packets trimmed due to failed admission [uint64_t] */ | ||
SAI_QUEUE_STAT_TRIMMED_PACKETS = 0x00000028, | ||
``` | ||
``` | ||
/** Packets trimmed due to failed shared buffer admission [uint64_t] */ | ||
SAI_PORT_STAT_TRIMMED_PACKETS, | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -610,6 +610,30 @@ typedef enum _sai_switch_hostif_oper_status_update_mode_t | |
|
||
} sai_switch_hostif_oper_status_update_mode_t; | ||
|
||
/** | ||
* @brief Attribute data for SAI_SWITCH_ATTR_HOSTIF_OPER_STATUS_UPDATE_MODE. | ||
*/ | ||
typedef enum _sai_packet_trimming_queue_resolution_mode_t | ||
{ | ||
/** | ||
* @brief Static queue resolution. | ||
* | ||
* In this mode, a new queue for the trimmed packet is set directly | ||
* by the application. | ||
*/ | ||
SAI_PACKET_TRIMMING_QUEUE_RESOLUTION_MODE_STATIC, | ||
|
||
/** | ||
* @brief Dynamic queue resolution. | ||
* | ||
* In this mode, a new queue for the trimmed packet is resolved | ||
* using QOS maps, applied to a new DSCP value that was provided | ||
* for a trimmed packet. | ||
*/ | ||
SAI_PACKET_TRIMMING_QUEUE_RESOLUTION_MODE_DYNAMIC, | ||
|
||
} sai_packet_trimming_queue_resolution_mode_t; | ||
|
||
/** | ||
* @brief Attribute Id in sai_set_switch_attribute() and | ||
* sai_get_switch_attribute() calls. | ||
|
@@ -3070,6 +3094,43 @@ typedef enum _sai_switch_attr_t | |
*/ | ||
SAI_SWITCH_ATTR_SELECTIVE_COUNTER_LIST, | ||
|
||
/** | ||
* @brief Trim packets to this size to reduce bandwidth | ||
* | ||
* @type sai_uint32_t | ||
* @flags CREATE_AND_SET | ||
* @default 128 | ||
*/ | ||
SAI_SWITCH_ATTR_PACKET_TRIMMING_SIZE, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comments are confusing. One can interpret them as that trimming can be done lesser then configured byte upto maximum size. We should change it keep it consistent with sample truncation attribute comments Something like "Trim packet to this size" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, should we add an attribute to specify a min size threshold for packets to qualify for trimming? As an example - a packet can only be trimmed if its size exceeds a min threshold Len1 and if trimmed, it will be trimmed to size Len2, where Len1 >= Len2. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ashutosh, I am not sure about adding a min size. Truncation size is the min and max both. We use similar semantics for Sampling as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed description There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @marian-pritsak There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added this comment to the action description in saibuffer.h |
||
|
||
/** | ||
* @brief New packet trimming DSCP value | ||
* | ||
* @type sai_uint8_t | ||
* @flags CREATE_AND_SET | ||
* @default 0 | ||
*/ | ||
SAI_SWITCH_ATTR_PACKET_TRIMMING_DSCP_VALUE, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should DSCP and QUEUE_INDEX be on a more granular level like on every buffer profile or port? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be, but the initial proposal is to have a global setting, which is enough for now. |
||
|
||
/** | ||
* @brief Queue mapping mode for a trimmed packet | ||
* | ||
* @type sai_packet_trimming_queue_resolution_mode_t | ||
* @flags CREATE_AND_SET | ||
* @default SAI_PACKET_TRIMMING_QUEUE_RESOLUTION_MODE_STATIC | ||
*/ | ||
SAI_SWITCH_ATTR_PACKET_TRIMMING_QUEUE_RESOLUTION_MODE, | ||
|
||
/** | ||
* @brief New packet trimming queue index | ||
* | ||
* @type sai_uint8_t | ||
* @flags CREATE_AND_SET | ||
* @default 0 | ||
* @validonly SAI_SWITCH_ATTR_PACKET_TRIMMING_QUEUE_RESOLUTION_MODE == SAI_PACKET_TRIMMING_QUEUE_RESOLUTION_MODE_STATIC | ||
*/ | ||
SAI_SWITCH_ATTR_PACKET_TRIMMING_QUEUE_INDEX, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is expected behavior if TRIMMING_QUEUE experiences congestion ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drop the packet There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If SAI_SWITCH_ATTR_QOS_DSCP_TO_TC_MAP, SAI_SWITCH_ATTR_QOS_TC_AND_COLOR_TO_DSCP_MAP, SAI_SWITCH_ATTR_PACKET_TRIMMING_DSCP_VALUE and SAI_SWITCH_ATTR_PACKET_TRIMMING_QUEUE_INDEX are all configured and if there are any conflicts between these configuration, what is the expected behavior ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @marian-pritsak How does the NOS knows what queue index to program in this case? Capability query will not return a support queue index value. We should let HW decide what queue index it will support for TRIM and make this attribute as READ_ONLY. Else please provide a workflow that how NOS is supposed to know the queue index |
||
|
||
/** | ||
* @brief End of attributes | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will the trimmed packet's headers look like? Will it be the same as the original packet with the exception of the length and DSCP information?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, TRIM packets are original packets, trimmed to the specified length and IP length updated