Buffer Management
- 1 Overview
- 1.1 Buffer Spaces
- 1.2 Buffer Configuration Mode
- 1.3 Queue Type
- 1.3.1 Multicast Queue
- 1.3.2 Unicast Queue
- 2 Configuring Buffer Spaces
- 2.1 Global Configuration
- 2.1.1 Multicast Queue
- 2.1.2 Unicast Queue
- 2.2 Per-interface Configuration
- 2.1 Global Configuration
NOTEs:
Packet queue assignment varies by platform.
For the Tomahawk3, Trident4-X9, Tomahawk4, and Tomahawk5 platforms, known unicast packets are assigned to any queue from 0 to 7, while unknown unicast, multicast, and broadcast packets are restricted to queues 0 to 3.
For other platforms, all packets can be assigned to any queue from 0 to 7.
To view the default buffer settings for ingress or egress interfaces, use the following commands before making any configurations:
run show interface egress-buffer
run show interface gigabit-ethernet ingress-buffer
run show interface gigabit-ethernet egress-buffer
Overview
During network congestion, the port doesn't drop data immediately. Instead, the device can temporarily store it in a data buffer to prevent data loss.
The chip uses fixed-size cells for packet storage, and the values of cell are different on different platforms. For example, the cell value of Tomahawk2 is 208 bytes. The first cell for a packet contains a 64-byte descriptor and 144 bytes of data. All subsequent cells are filled entirely with 208 bytes of data.
The total packet length determines cell usage. For example:
Untagged packets ranging from 64 to 144 bytes in length occupy one cell.
A 352-byte packet requires two cells.
Packets from 1393 to 1600 bytes in length require eight cells.
Buffer Spaces
The egress buffer is divided into Guaranteed, Shared, and Headroom spaces, while the ingress buffer is divided into Guaranteed and Shared spaces.
Guaranteed Spaces
The fixed space provides a minimum guaranteed allocation of memory for each port and priority group. This dedicated space cannot be used by other ports. During congestion, a port will first use its allocated fixed space. It will only utilize the shared space after its fixed space is exhausted. The fixed space should not be configured too large, as this would lead to inefficient use of buffer resources.
Shared Spaces
The shared buffer space is available to all ports and priority groups once their dedicated fixed space is exhausted. When this shared space is also fully utilized, incoming packets are dropped.
The allocation of shared space is dynamic. Unused buffer portions from inactive queues are automatically made available for other active queues.
For each queue, if the queue's buffer usage reaches a predefined threshold, any newly arrived packets for that queue will be discarded. This threshold for the shared space can be configured to be either dynamic or static at the logical queue level.
Headroom Spaces
Protocols such as Priority Flow Control (PFC) utilize Headroom space to buffer packets that the upstream switch had already sent before it received and processed the Pause frame. For details, see https://pica8-fs.atlassian.net/wiki/spaces/PicOS45/pages/258624430.
Figure 1. Buffer Spaces
Buffer Configuration Mode
You can manage buffer through global configuration and per-interface configuration.
Global configuration: Configure egress buffer on all interfaces for specified queues.
Per-interface configuration: Configure ingress or egress buffer for specified interfaces and queues, which is generally applied to PFC scenarios. For details, see https://pica8-fs.atlassian.net/wiki/spaces/PicOS45/pages/258624430.
NOTEs:
Egress buffer configuration is mutually exclusive between global and interface levels. If you configure both, conflicts may appear.
Only Trident3-X5, Trident3-X7, Tomahawk2, Tomahawk3, Trident4-X9, Tomahawk4, and Tomahawk5 platforms support the per-interface configuration.
Queue Type
The device provides separate Unicast (UC) and Multicast (MC) queues. The UC queues are designed for known unicast traffic and support flexible assignment. The MC queues handle Destination Lookup Failure (DLF), multicast, broadcast, and mirrored packets.
NOTE:
The CPU port does not support separate UC and MC queue sets, while it supports a total of 48 queues. The unicast and multicast traffic directed to these CPU queues is determined by the CPU Class of Service (CoS) mapping.
Multicast Queue
Static mode: This is the default mode. A static threshold value is configured for the multicast queue in the shared space. This mechanism prevents a port with flow control or PFC enabled from impacting the forwarding performance of other ports. The main disadvantage is less efficient memory utilization.
Dynamic mode: This mode requires configuration. In this mode, the memory threshold is dynamically adjusted based on the available shared memory. The threshold decreases as the remaining shared memory diminishes and increases as the available shared memory grows.
Figure 2. Congestion Scenario of Multicast Traffic
As shown in Figure 2, when packets are transmitted from Port 1 and Port 2 to Port 3 at 10Gbps and assigned to queue 0, Port 3 will experience congestion.
For multicast traffic, even with flow control enabled on Port 1 and Port 2 along with static threshold configuration, packet drops might still occur in Port 3's egress queue. The ingress ports will not send Pause frames because the egress port's shared ratio is smaller than that of the ingress ports, and the egress reaches its threshold before the ingress ports do.
To resolve this problem, you need to configure dynamic mode for port 1 and port 2. In this mode, Port 1 and Port 2 will send pause frames before Port 3's queue limit is reached, thereby accepting burst packets and preventing packet loss.
Unicast Queue
Dynamic mode: The dynamic threshold is the default mode for unicast queues, and the static threshold cannot be configured.
Configuring Buffer Spaces
Global Configuration
You can configure egress buffer on all interfaces for specified queues. The shared buffer space for Unicast and Multicast queues can be managed independently.
Multicast Queue
To configure the dynamic shared function, take the following steps:
Step 1 Enable the dynamic shared function. By default, it is in the static mode.
set interface ethernet-switching-options buffer egress-queue <queue-id> mc-queue-dynamic-shared true
Step 2 Configure the dynamic threshold ratio. By default, the ratio is 33%.
set interface ethernet-switching-options buffer egress-queue <queue-id> shared-ratio <value>
Step 3 Commit the configuration.
commit
Step 4 View the egress buffer information of all interfaces.
run show interface egress-buffer
For example, enable the dynamic shared function for queue 0 and configure the dynamic threshold ratio as 50%.
admin@PICOS# set interface ethernet-switching-options buffer egress-queue 0 mc-queue-dynamic-shared true
admin@PICOS# set interface ethernet-switching-options buffer egress-queue 0 shared-ratio 50
admin@PICOS# commit
Commit OK.
Save done.
admin@PICOS# run show interface egress-buffer
Queue UC-Enabled UC-Shared-Ratio MC-Enabled MC-Shared-Ratio
0 true 50 true 50
1 true 33 false --
2 true 33 false --
3 true 33 false --
4 true 33 false --
5 true 33 false --
6 true 33 false --
7 true 33 false -- Unicast Queue
To configure the dynamic shared function, take the following steps:
Step 1 Configure the dynamic threshold ratio. By default, the ratio is 33%.
set interface ethernet-switching-options buffer egress-queue <queue-id> shared-ratio <value>
Step 2 Commit the configuration.
commit
Step 3 View the egress buffer information of all interfaces.
run show interface egress-buffer
For example, configure the dynamic threshold ratio as 50% for queue 0.
admin@PICOS# set interface ethernet-switching-options buffer egress-queue 0 shared-ratio 50
admin@PICOS# commit
admin@PICOS# run show interface egress-buffer
Queue UC-Enabled UC-Shared-Ratio MC-Enabled MC-Shared-Ratio
0 true 50 false --
1 true 33 false --
2 true 33 false --
3 true 33 false --
4 true 33 false --
5 true 33 false --
6 true 33 false --
7 true 33 false -- In the show result, for the UC-Shared-Radio and MC-Shared-Radio of a queue, the percentage range of 0 to 100 is divided into 10 levels. The table below lists the actual effective values that correspond to each configured ratio level.
Table 1. Effective Values and Corresponding Ratio Level
Ratio Value | 0 to 1 | 2 to 3 | 4 to 7 | 8 to 16 | 17 to 29 | 30 to 42 | 43 to 60 | 61 to 76 | 77 to 86 | 87 to 100 |
|---|---|---|---|---|---|---|---|---|---|---|
Effective Value | 1 | 3 | 6 | 11 | 20 | 33 | 50 | 67 | 80 | 89 |
NOTE:
Currently, the multicast queue only supports eight effective ratio values, corresponding to levels 1 to 67.
Per-interface Configuration
You can configure ingress or egress buffer for specified interfaces and queues, which is generally applied to PFC scenarios.
Step 1 Enable PFC on the interface before configuring PFC buffer.
set class-of-service pfc-profile <pfc-profile-name> [code-point <cos> drop <true | false>]
set class-of-service interface <interface-name> pfc-profile <pfc-profile-name>
Step 2 Set the upper threshold of guaranteed buffer for a PFC queue on the ingress interface. When the guaranteed buffer threshold is reached, the packets will be saved in the shared service pool.
set interface gigabit-ethernet <interface-name> ethernet-switching-options buffer ingress-queue <queue-id> guaranteed <value>
Step 3 Set the upper threshold of shared buffer for a PFC queue on the ingress interface. When the occupied buffer space exceeds the specified threshold, the Pause frame will be generated and sent to the egress interface. You can specify the threshold in the static (a fixed value) or dynamic (percentage) way.
Only one way can be configured, or the error prompt will appear.
set interface gigabit-ethernet <interface-name> ethernet-switching-options buffer ingress-queue <queue-id> shared-ratio <value>
set interface gigabit-ethernet <interface-name> ethernet-switching-options buffer ingress-queue <queue-id> threshold <value>
Step 4 Set the offset value of shared buffer for a PFC queue on the ingress interface. The Pause frames will stop being generated when the occupied space is reduced to a certain level (the upper threshold minus the offset value).
set interface gigabit-ethernet <interface-name> ethernet-switching-options buffer ingress-queue <queue-id> reset-offset <value>
Step 5 Set the global threshold of shared buffer for a PFC queue on all ingress interfaces. When the global threshold is reached, the packets will be saved in the headroom buffer.
set interface ethernet-switching-options buffer service-pool <pool-id> threshold <value>
Step 6 Set the upper threshold of headroom buffer for a PFC queue on the ingress interface. When the headroom buffer threshold is reached, the interface will drop received packets.
set interface gigabit-ethernet <interface-name> ethernet-switching-options buffer ingress-queue <queue-id> headroom <value>
Step 7 Set the upper threshold of shared buffer for a PFC queue on the egress interface of the downstream switch. When the occupied buffer space exceeds the specified threshold, the packets will be saved in the headroom buffer. You can specify the threshold in the static (a fixed value) or dynamic (percentage) way.
Only one way can be configured, or the error prompt will appear.
set interface gigabit-ethernet <interface-name> ethernet-switching-options buffer egress-queue <queue-id> shared-ratio <value>
set interface gigabit-ethernet <interface-name> ethernet-switching-options buffer egress-queue <queue-id> threshold <value>
Step 8 Commit the configuration.
commit
Step 9 (Optional) View the PFC buffer information of an ingress interface or an egress interface.
run show interface gigabit-ethernet <interface-name> ingress-buffer
run show interface gigabit-ethernet <interface-name> egress-buffer