|
| 1 | +# Switch Abstraction Interface Change Proposal for Packet Trimming |
| 2 | + |
| 3 | +Title | Packet Trimming |
| 4 | +------------|---------------- |
| 5 | +Authors | Nvidia |
| 6 | +Status | In review |
| 7 | +Type | Standards track |
| 8 | +Created | 8/28/2024 |
| 9 | +SAI-Version | 1.14 |
| 10 | +---------- |
| 11 | + |
| 12 | +## Overview |
| 13 | +When the lossy queue exceeds a buffer threshold, it drops packets without any notification to the destination host. |
| 14 | + |
| 15 | +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. |
| 16 | + |
| 17 | +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, |
| 18 | +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. |
| 19 | + |
| 20 | +``` |
| 21 | + |
| 22 | + ┌───────────────┐ |
| 23 | + │ │ |
| 24 | + │Trimmed packet │ |
| 25 | + │ │ |
| 26 | + └───────────────┘ |
| 27 | + |
| 28 | + ┌─┬─┬─┬─┬────────┐ |
| 29 | + │ │ │ │ │ │ |
| 30 | + │ │ │ │ │ │ |
| 31 | + ┌────────────────► │ │ │ │ │ |
| 32 | + │ │ │ │ │ │ │ Queue |
| 33 | + │ │ │ │ │ │ │ |
| 34 | + │ │ │ │ │ │ │ |
| 35 | + │ └─┴─┴─┴─┴────────┘ |
| 36 | + ┌──────────────┐ │ |
| 37 | + │ │ ┌──────────────────────────────────────────────────────┐ │ ┌─┬─┬─┬─┬─┬─┬─┬─┬┐ |
| 38 | + │ │ │ │ │ │ │ │ │ │ │ │ │ ││ |
| 39 | + │ │ │ │ │ \ / │ │ │ │ │ │ │ │ ││ |
| 40 | + │ │ │ │ │ \ / │ │ │ │ │ │ │ │ ││ |
| 41 | + │ Packet │ │ Pipeline ┼────┼───────\────────► │ │ │ │ │ │ │ ││ Queue |
| 42 | + │ │ │ │ / \ │ │ │ │ │ │ │ │ ││ |
| 43 | + │ │ │ │ / \ │ │ │ │ │ │ │ │ ││ |
| 44 | + │ │ └──────────────────────────────────────────────────────┘ └─┴─┴─┴─┴─┴─┴─┴─┴┘ |
| 45 | + │ │ |
| 46 | + │ │ |
| 47 | + │ │ |
| 48 | + └──────────────┘ |
| 49 | +``` |
| 50 | + |
| 51 | +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. |
| 52 | + |
| 53 | +## Spec |
| 54 | +There is a tradeoff between trying to configure a higher threshold in a queue buffer profile and trimming the packet. |
| 55 | + |
| 56 | +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. |
| 57 | + |
| 58 | +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. |
| 59 | + |
| 60 | +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: |
| 61 | +``` |
| 62 | +/** |
| 63 | + * @brief Enum defining queue actions in case the packet fails to pass the admission control. |
| 64 | + */ |
| 65 | +typedef enum _sai_buffer_profile_packet_admission_fail_action_t |
| 66 | +{ |
| 67 | + /** |
| 68 | + * @brief Drop the packet. |
| 69 | + * |
| 70 | + * Default action. Packet has nowhere to go |
| 71 | + * and will be dropped. |
| 72 | + */ |
| 73 | + SAI_BUFFER_PROFILE_PACKET_ADMISSION_FAIL_ACTION_DROP, |
| 74 | +
|
| 75 | + /** |
| 76 | + * @brief Trim the packet. |
| 77 | + * |
| 78 | + * Try sending a shortened packet over a different |
| 79 | + * queue. Original packet will be dropped and trimmed copy of the packet will be send. |
| 80 | + * The IP length and checksum fields will be updated in a trimmed copy. |
| 81 | + * SAI_QUEUE_STAT_DROPPED_PACKETS as well as SAI_QUEUE_STAT_DROPPED_BYTES |
| 82 | + * will count the original discarded frames even if they will be trimmed afterwards. |
| 83 | + * Interface statistics must show dropped packets. |
| 84 | + * Interface statistics may show sent trimmed packets. |
| 85 | + */ |
| 86 | + SAI_BUFFER_PROFILE_PACKET_ADMISSION_FAIL_ACTION_DROP_AND_TRIM, |
| 87 | +} sai_buffer_profile_packet_admission_fail_action_t; |
| 88 | +``` |
| 89 | +``` |
| 90 | + /** |
| 91 | + * @brief Buffer profile discard action |
| 92 | + * |
| 93 | + * Action to be taken upon packet discard due to |
| 94 | + * buffer profile configuration. Applicable only |
| 95 | + * when attached to a queue. |
| 96 | + * |
| 97 | + * @type sai_buffer_profile_packet_admission_fail_action_t |
| 98 | + * @flags CREATE_AND_SET |
| 99 | + * @default SAI_BUFFER_PROFILE_PACKET_ADMISSION_FAIL_ACTION_DROP |
| 100 | + */ |
| 101 | + SAI_BUFFER_PROFILE_ATTR_PACKET_ADMISSION_FAIL_ACTION, |
| 102 | +``` |
| 103 | + |
| 104 | +Trimming engine attributes are configured globally. |
| 105 | +``` |
| 106 | + /** |
| 107 | + * @brief Trim packets to this size to reduce bandwidth |
| 108 | + * |
| 109 | + * @type sai_uint32_t |
| 110 | + * @flags CREATE_AND_SET |
| 111 | + * @default 128 |
| 112 | + */ |
| 113 | + SAI_SWITCH_ATTR_PACKET_TRIM_SIZE, |
| 114 | +
|
| 115 | + /** |
| 116 | + * @brief New packet trim DSCP value |
| 117 | + * |
| 118 | + * @type sai_uint8_t |
| 119 | + * @flags CREATE_AND_SET |
| 120 | + * @default 0 |
| 121 | + */ |
| 122 | + SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_VALUE, |
| 123 | +
|
| 124 | + /** |
| 125 | + * @brief Queue mapping mode for a trimmed packet |
| 126 | + * |
| 127 | + * @type sai_packet_trim_queue_resolution_mode_t |
| 128 | + * @flags CREATE_AND_SET |
| 129 | + * @default SAI_PACKET_TRIM_QUEUE_RESOLUTION_MODE_STATIC |
| 130 | + */ |
| 131 | + SAI_SWITCH_ATTR_PACKET_TRIM_QUEUE_RESOLUTION_MODE, |
| 132 | +
|
| 133 | + /** |
| 134 | + * @brief New packet trim queue index |
| 135 | + * |
| 136 | + * @type sai_uint8_t |
| 137 | + * @flags CREATE_AND_SET |
| 138 | + * @default 0 |
| 139 | + * @validonly SAI_SWITCH_ATTR_PACKET_TRIM_QUEUE_RESOLUTION_MODE == SAI_PACKET_TRIM_QUEUE_RESOLUTION_MODE_STATIC |
| 140 | + */ |
| 141 | + SAI_SWITCH_ATTR_PACKET_TRIM_QUEUE_INDEX, |
| 142 | +``` |
| 143 | + |
| 144 | +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. |
| 145 | +``` |
| 146 | + /** |
| 147 | + * @brief Disable packet trim for a given match condition. |
| 148 | + * |
| 149 | + * This rule takes effect only when packet trim is configured on a buffer profile of a queue to which a packet belongs. |
| 150 | + * |
| 151 | + * @type sai_acl_action_data_t bool |
| 152 | + * @flags CREATE_AND_SET |
| 153 | + * @default disabled |
| 154 | + */ |
| 155 | + SAI_ACL_ENTRY_ATTR_ACTION_PACKET_TRIM_DISABLE = SAI_ACL_ENTRY_ATTR_ACTION_START + 0x39, |
| 156 | +``` |
| 157 | + |
| 158 | +Both the queue and the port have the packet counter to reflect the number of trimmed packet. |
| 159 | +``` |
| 160 | + /** Packets trimmed due to failed shared buffer admission [uint64_t] */ |
| 161 | + SAI_PORT_STAT_TRIM_PACKETS, |
| 162 | +``` |
| 163 | +``` |
| 164 | + /** Packets trimmed due to failed admission [uint64_t] */ |
| 165 | + SAI_QUEUE_STAT_TRIM_PACKETS = 0x00000028, |
| 166 | +``` |
0 commit comments