QoS Configuration Guide
此内容尚不支持你的语言。
Introduction
Section titled “Introduction”QoS (Quality of Service) is a technique used to solve problems such as network latency and blocking. As a security mechanism in a network, QoS can provide better service capability and improved quality of service for specified network communications. Under normal circumstances, QoS is not required if the network is only used for specific untime-limited applications, such as web applications, or e-mail settings. But for critical applications and multimedia applications it is essential that QoS ensures that critical traffic is not delayed or dropped when the network is overloaded or congested, and that the network operates efficiently.
Concepts and Principles
Section titled “Concepts and Principles”Queue and Priority Mapping
Section titled “Queue and Priority Mapping”Different messages use different QoS priorities, for example, 802.1p for VLAN messages, DSCP for IP messages, TC for IPv6 messages, EXP for MPLS messages. In order to ensure the quality of service of different messages, when the message comes into the switch, the QoS priority carried by the message needs to be mapped to the internal service class (also called scheduling priority PHB) and discard priority (also called color) of the switch. Inside the switch, congestion management is carried out according to the class of service of the message and congestion avoidance according to the color of the message; when the message leaves the switch, the internal class of service and color need to be mapped to QoS priority so that subsequent network devices can provide the appropriate quality of service according to the QoS priority. Generally, the PHB ranges from 0 to 7, or is indicated by BE, AF1, AF2, AF3, AF4, CS6, CS7 respectively, and Color is available in green, yellow and red. Two types of message fields related to QoS priority are listed below.
- Priority in Layer 2 VLAN frames The priority in a Layer 2 frame is specific to VLAN frames, as ordinary Layer 2 frames do not carry a priority field. The priority in a VLAN frame is what is commonly referred to as the 802.1p priority (defined by the IEEE 802.1p protocol), and is located in the “PRI” subfield of the “802.1Q Tag” field in the VLAN frame, as shown in the figure below. The PRI field is 3 bits long and can represent 8 transmission priorities, with values of 7, 6, …, 1, 0 in descending order of priority. The different priority levels identify the different levels of quality of service required.

- Priority in Layer 3 IP messages The Layer 2 VLAN frame priority described above is relatively simple, but in Layer 3 IP messages the description of priority is much more complex, and two different types of priority and different methods of identification have emerged at different times.
- ToS In the early RFC 791 standard, IP packets relied on the ToS (Type of Service) field to identify the data priority value, which is a field (1 byte in total) in the IP header of an IP packet that specifies the priority of the IP packet, and the switch preferentially forwards packets with a high ToS value. It contains a byte (8 bits) and consists of three parts: three bits from 0 to 2 to define the IP priority of the packet (IP Precedence), ToS and the last bit fixed to 0, as shown in the figure.

- DSCP In the later new RFC 2474 standard, the ToS field in the original IP packet header was redefined and renamed the DS (Differentiated Services) field, which is also a total of one byte (8 bits). In general, bits 0 to 5 (six bits in total) are used to indicate the DSCP (Differentiated Services Code Point) priority, with values ranging from 0 to 63, which identifies a total of 64 priority values (the higher the value, the higher the priority), and the last two bits are reserved to display the ECN (Explicit Congestion Notification).

Flow Shape
Section titled “Flow Shape”Congestion in the network may be caused when the rate at which messages are sent is greater than the rate at which they are received, or when the interface rate of a downstream device is less than the interface rate of an upstream device. If the size of the service traffic sent by users is not limited, the constant burst of service data from a large number of users will make the network more congested. In order to make the limited network resources more efficient for the users, it is necessary to limit the service traffic of the users. Flow shaping provides the possibility to control the maximum output communication rate to ensure that communication meets the configured maximum transmission rate specification. Traffic shaping is usually done using buffers and token buckets. When messages are sent at too fast a rate, they are first cached in the buffers and these buffered messages are then sent evenly under the control of the token buckets. When the interface rate of the downstream device is less than the port rate of the upstream device or when burst traffic occurs, traffic congestion may occur at the incoming port of the downstream device. In this case, the user can configure traffic shaping on the outgoing port of the upstream device to cut the upstream irregular traffic and output a flatter traffic, thus solving the congestion problem of the downstream device. There are two types of flow shaping.
- Interface traffic shaping Interface traffic shaping, also known as interface rate limiting LR (Line rate), limits the total rate of all messages (including emergency messages) sent by the interface and is traffic shaping for the entire outgoing interface, regardless of priority.
- Queue traffic shaping Queue traffic shaping, also known as Shaping, allows traffic to be shaped for a particular queue on the outgoing interface, with differentiated priority. Each of the two traffic shaping methods has its own advantages and can be applied for different demand scenarios. Users can choose according to their scenarios and needs.
Congestion Management and Congestion Avoidance
Section titled “Congestion Management and Congestion Avoidance”The quality of service problems faced by traditional networks are mainly caused by congestion, which refers to problems that occur when multiple users compete for the same resources (bandwidth, buffers, etc.) on a shared network.
- Congestion Management Congestion Management is a traffic control mechanism to meet the high QoS service of delay-sensitive services by adjusting the scheduling order of messages when the network is intermittently congested and the delay-sensitive services require a higher quality QoS service than other services. This is handled by using queuing techniques, where all messages from a port are placed into multiple queues and processed according to queue priority. Queue refers to the logic of sorting messages in the cache. When the rate of traffic exceeds the interface bandwidth or the bandwidth set for that traffic, the messages are temporarily stored in the cache in a queue. The processing order and discard principle for message forwarding is determined by the queue scheduling algorithm. This series of switches supports PQ, DWRR and hybrid scheduling modes, which are described below.
- PQ Dispatch PQ (Priority Queuing) scheduling, also known as SP (Strict Priority), refers to the scheduling of queues in strict order of priority. Only after all messages in the high priority queue have been scheduled will the lower priority queue have a chance to be scheduled. PQ scheduling is used to place delay-sensitive critical services into a high-priority queue and non-critical services into a low-priority queue, thus ensuring that critical services are sent first. Disadvantage of PQ scheduling: when congestion occurs, messages in the lower priority queues will not get a chance to be scheduled if the higher priority queues are occupied for a long time.
- DWRR Dispatch Understanding DWR (Deficit Weighted Round Robin) scheduling begins with WRR (Weighted Round Robin) scheduling, which rotates between queues to ensure that each queue receives a certain amount of service time. Using the example of a port with 8 output queues, WRR can configure a weighting value for each queue (w7, w6, w5, w4, w3, w2, w1, w0 in that order), with the weighting value indicating the weight of the acquired resources. Example a 100M port is configured with a weighting value of 50, 50, 30, 30, 10, 10, 10, 10, 10 (corresponding to w7, w6, w5, w4, w3, w2, w1, w0 in that order) for its WRR queue scheduling algorithm, which ensures that the lowest priority queue gets at least 5Mbit/s of bandwidth, avoiding the disadvantage that messages in the low priority queue may go unserved for a long time when PQ scheduling is used. Disadvantages of WRR scheduling: WRR scheduling is based on the number of messages, so there is no fixed bandwidth per queue, and the actual bandwidth obtained by a larger message is greater than that obtained by a smaller message for the same scheduling opportunity. And it is bandwidth that users are generally concerned about. When the average message length of each queue is equal or known, the user can obtain the desired bandwidth by configuring the WRR weight; however, when the average message length of the queue varies, the user cannot obtain the desired bandwidth by configuring the WRR weight. Another disadvantage is that low latency demand services (e.g. voice) are not scheduled in a timely manner. DWRR, or differential weighted polling, is implemented on the same principle as WRR scheduling, but DWRR is able to schedule messages according to their length, avoiding the disadvantage that WRR scheduling cannot allocate bandwidth resources in proportion to the configuration. DWRR also has the disadvantage that delay-sensitive services (such as voice) are not scheduled in a timely manner.
- Hybrid scheduling PQ scheduling and DWRR scheduling have their own advantages and disadvantages. When PQ scheduling is used alone, messages in the low priority queue may not be scheduled for a long time, while when DWRR scheduling is used alone, low latency demand services are not scheduled timely. The “PQ+DWRR” scheduling method combines the advantages of both scheduling methods and overcomes the disadvantages of each. Users can place important protocol messages and delay-sensitive service messages into the queue using PQ scheduling and assign a designated bandwidth to this queue, while other messages are placed into each queue using DWRR scheduling according to their respective priorities, and each queue is scheduled cyclically according to its weight.
- Congestion Avoidance Congestion avoidance is a traffic control mechanism that relieves network overload by monitoring the usage of network resources (such as queues or memory buffers) and actively discarding messages when congestion occurs or tends to increase, by adjusting the traffic flow of the network. There are currently two discard strategies: tail-drop and WRED.
- Tail discard The traditional packet drop policy uses Tail Drop and treats all messages equally, regardless of their levels of service. In this case, during congestion, data messages at the tail of the queue are dropped until the congestion is lifted. However, this drop policy does not reflect priority.
- WRED In times of network congestion, we always want to discard the lower priority packets first and ensure that the higher priority packets are sent. Weighted Random Early Detection (WRED) is a weight-based random early detection that relies on the priority of the traffic to assign a corresponding drop probability. WRED can drop packets based on their DSCP or IP priority, with lower priority data always dropping before higher priority data, thus ensuring delivery of important data. The implementation of congestion management in SONiC relies heavily on an extension to WRED, the ECN (Explicit Congestion Notification) mechanism. ECN was originally defined in RFC 3168 for the TCP/IP protocol and is implemented by embedding a congestion indicator in the IP header and a congestion acknowledgement in the TCP header. ECN-compatible switches and routers mark network packets when congestion is detected, rather than just dropping them. The specific fields of the ECN take up 2 bits in the IP header, the ECT bit (ECN-capable Transport) and the CE bit (Congestion Experienced). The ECT and CE bits can form a combination of 4 ECN fields: 00 to 11.
- 00 indicates that the message does not use the ECN.
- 01 and 10 are called ECT(1) and ECT(0) respectively, and are set by the data sender to indicate that the endpoint of the transport protocol is capable of using ECN. the router treats both field combinations identically. For more information on these two field combinations, see RFC 3168.
- 11 indicates congestion.
This series of switches supports the configuration of WRED for a particular queue or queues, with the possibility of setting the operating mode (DROP/ECN) and the upper and lower thresholds, as follows.
- If the number of packets in the queue is below the minimum threshold, both modes forward packets normally with no behavioral difference.
- If the number of packets in the queue is between the minimum and maximum thresholds, DROP mode discards packets based on the WRED drop probability, while ECN mode marks the packets.
- If the number of packets in the queue exceeds the maximum threshold, all packets will be dropped or marked.
Understanding PFC begins with an introduction to the concept of flow control. Traffic Conditioning is a basic Ethernet function that prevents frame loss in the event of port congestion. A common implementation on a general switching chip is flow control based on PAUSE frames. The following is a simple application scenario.

As shown in the diagram above, ports A and B of the switch receive packets and port C forwards them. If the sum of the incoming packet rates of ports A and B is greater than the bandwidth of port C, then some of the messages will be cached in the Buffer inside the switch. When the occupancy rate of Buffer reaches the high water line XOFF, ports A and B will send out PAUSE frames with time parameter not 0 to notify the other side to pause for a period of time before sending; when the occupancy rate of Buffer drops below the low water line XON, ports A and B will send out PAUSE frames with time parameter 0 to notify the other side that they can continue to send packets, and the other side will send packets immediately after receiving packets as soon as they are received. The above descriptions are based on the premise that both the message ingress (A and B) and its counterpart devices support flow control and enable it. PFC (Priority-based Flow Control) is a priority-based flow control and is based on the same principle as flow control. This series of switches uses PFC for flow control purposes, supporting global enable/disable PFC and specifying a queue or queues to enable/disable PFC. this series of switches supports setting up to two lossless queues, the default lossless queue is 3 and 4, so queues 3 and 4 have PFC enabled by default.
QoS Configuration
Section titled “QoS Configuration”Table 1 Overview of QoS Configuration Tasks
| Configuration Tasks | Description | |
|---|---|---|
| Basic QoS configuration | Configure QoS priority mapping. | Optional |
| QoS Function configuration | Configure QoS scheduling. | Optional |
| Configure traffic shaping. | Optional | |
| Configure PFC. | Optional | |
| Configure PFCWD. | Optional | |
| Configure WRED. | Optional | |
| Configure Storm Control | Optional |
Configure QoS Priority Mapping
Section titled “Configure QoS Priority Mapping”The following two types of mapping are currently supported.
Table 2 Supported mapping table types
| Mapping Table Type | Meaning | Description |
|---|---|---|
| dot1p_to_tc | 802.1p priority to tc mapping | dot1p takes the values 0 to 7. |
| dscp_to_tc | dscp to tc mapping | dscp takes the values 0 to 63. |
Configure DSCP to COS Mapping
Table 3 Configure DSCP to COS Mapping
| Operation | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a Diffserv Map map and enter its configuration view | diffserv-map type ip-dscp diffserv-map-name | diffserv-map-name: name of diffserv-map |
| Configure DSCP to COS mapping | ip-dscp value cos cos_value | value: DSCP value, range 0-63 cos_value: COS value, range 0-7 |
| default {cos_value|copy} | cos_value indicates that all packets are mapped to the corresponding COS value. default copy indicates to use the default DSCP mapping of the system. | |
| Exit Diffserv Map view | exit | - |
| Create a policy-map and enter its configuration view | policy-map policy-map-name | - |
| Configure DSCP to TC mapping | set cos dscp diffserv diffserv-map-name | - |
| Exit Policy Map view | exit | - |
| Enter interface configuration view | interface ethernet interface-name | - |
| Bind policies to interfaces | service-policy policy-map-name | Bind the interface will make the policy effective, the policy configuration cannot be modified at this time |
Configure DOT1P to COS Mapping
Table 4 Configure DOT1P to COS Mapping
| Operation | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a Diffserv Map map and enter its configuration view | diffserv-map type ip-8021p diffserv-map-name | diffserv-map-name: name of diffserv-map |
| Configure dot1p to cos mapping | 8021p value cos cos-value | value: DOT1P value, range 0-7 cos-value: cos value, range 0-7 |
| default value | All unconfigured packets are marked with the cos value. value: cos value (0-7) | |
| Exit Diffserv Map view | exit | - |
| Create a policy-map and enter its configuration view | policy-map policy-map-name | policy-map-name: the name of the policy-map |
| Configure dot1p to tc mapping | set cos 8021p diffserv diffserv-map-name | - |
| Exit Policy Map view | exit | - |
| Enter interface configuration view | interface ethernet interface-name | - |
| Bind policies to interfaces | service-policy policy-map-name | Bind the interface will make the policy effective, the policy configuration cannot be modified at this time |
Configure QoS Schedule Policy
Section titled “Configure QoS Schedule Policy”Configure SP Schedule
Table 5 Configure SP Schedule
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a policy-map and enter its configuration view | policy-map policy-map-name | policy-map-name: name of policy-map |
| Configure SP mode policy | queue-scheduler priority queue queue-id | queue-id range from 0 to 7. |
| Exit Policy Map view | exit | - |
| Enter interface configuration view | interface ethernet interface-name | |
| Bind policy to interface | service-policy policy-map-name | Binding the interface will make the policy effective, the policy configuration cannot be modified at this time |
Configure DWRR Schedule
Table 6 Configure DWRR Schedule
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a policy-map and enter its configuration view | policy-map policy-map-name | - |
| Configuring DWRR mode policy | queue-scheduler queue-limit percent queue-weight queue queue-id | queue-weight: scheduling weight of DWRR, range from 0 to 100.queue-id range from 0 to 7. |
| Exit Policy Map view | exit | - |
| Enter interface configuration view | interface ethernet interface-name | - |
| Bind policy to interface | service-policy policy-map-name | Binding the interface will make the policy effective, the policy configuration cannot be modified at this time, it needs to be modified after unbinding |
Configure Traffic Shape
Section titled “Configure Traffic Shape”Configure Port Speed Limit
Table 7 Configure Port Speed Limit
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a policy-map and enter its configuration view | policy-map policy-map-name | - |
| Configure port speed limit policy | port-shape target-bit-rate [burst-size] | target-bit-rate: peak speed limit value (byte/s).burst-size: peak burst value (byte) |
| Enter interface configuration view | interface ethernet interface-name | - |
| Bind policy to interface | service-policy policy-map-name | Binding the interface will make the policy effective, the policy configuration cannot be modified at this time |
Configure Queue Speed Limit
Table 8 Configure Queue Speed Limit
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a Class Map and enter its configuration view | class-map class-map-name | - |
| Specify the queue for speed limit | match cos queue | The value of queue is 0-7, use space to separate multiple queues. |
| Exit Class-map configuration view | exit | - |
| Create a policy-map and enter its configuration view | policy-map policy-map-name | - |
| Bind the class-map and enter the policy class-map configuration view | class class-map-name | This command is executed in Policy Map view |
| Configure queue speed limit policy | queue-shape target-bit-rate [burst-size] | The configured queue determined by class-map.target-bit-rat specifies the peak speed limit value in bits/s.burst-size specifies the burst value in bits |
| Exit Class view under Policy Map | exit | - |
| Exit Policy Map configuration view | exit | - |
| Enter Ethernet interface view | interface ethernet interface-name | - |
| Bind policy to interface | service-policy policy-map-name | Binding the interface will make the policy effective, the policy configuration cannot be modified at this time, it needs to be modified after unbinding |
Configure PFC
Section titled “Configure PFC”The port can receive PFC PAUSE frames regardless of whether the port is configured with the PFC function or not. However, the received PFC PAUSE frames are only processed when the PFC function is on. Therefore, it is necessary to ensure that the PFC function is on at both the local end and the other end in order for the PFC function to take effect. In order to avoid packet loss due to congestion during transmission, please configure the same PFC function on all ports through which the message flows. The ingress buffer of the switch chip is shared by all ports, but can be allocated in flow control scenarios. When not configured by the user, the default trigger threshold and stop threshold values for backpressure frames in the ingress direction is present in the interface configuration. The default setting can be viewed by the show buffer profile command. the default parameter set works better in a general networking environment. In order to control the PFC function flexibly and use the interface storage space reasonably, the switch provides PFC waterline configuration and supports user-defined configuration of the PFC buffer profile, including enable queue, configure buffer size, trigger high and low thresholds for PAUSE frames.
Global Enable/Disable PFC
Table 9 Global Enable PFC
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Enable PFC | priority-flow-control enable ingress-queue | ingress-queue: indicates a queue, range 0-7. You can specify a queue (eg: 1) or specify some queues (eg: 1 4) |
| Save the configuration and reload to take effect. | writereload | - |
Table 10 Global Disable PFC
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Disable PFC | no priority-flow-control enable ingress-queue-id | ingress-queue: indicates a queue, range 0-7. You can specify a queue (eg: 1) or specify some queues (eg: 1 4), |
| Save the configuration and reload to take effect. | writereload | - |
Configure the PFC Lossless Buffer
The cell size varies from model to model.
- On CX308P-48Y-N-V2 and CX532P-N-V2, cell size=128 Bytes. When a queue on the switch is congested and the occupancy of the ingress buffer reaches the waterline, it will start to send backpressure frames; when the sender receives the backpressure frames and reduces the sending traffic, the occupancy of the ingress buffer on the switch will decrease and stop sending backpressure frames when the occupancy is below the waterline; the formula of PFC waterline is: Limit=Guaranteed Buffers+Dynamic Factor (in static mode, Dynamic Factor is different).When using self-defined lossless buffers, it is recommended to configure static mode.
- On other models, cell size=224 Bytes. When a queue on the switch is congested and the occupancy of the ingress buffer reaches xoff, it starts to send backpressure frames; when the sender receives abackpressure frames and reduces the sending traffic, the occupancy of the ingress buffer of the switch will decrease and stop sending backpressure frames when the occupancy reaches xon. When the user does not configure it, default trigger thresholds and stop thresholds for backpressure frames in the inbound direction exist in the interface configuration. When using self-defined lossless buffers, it is recommended to configure static mode. The parameters of dynamic lossless buffer are related to the interface rate, cable length, etc., and the following are the recommended configuration values:
Table 11 Recommended Values
| rate | cable length | size | xon | xoff | dynamic threshold | xon_offset |
|---|---|---|---|---|---|---|
| 25000 | 5m | 1518 | 0 | 15680 | 1 | 13440 |
| 50000 | 5m | 1518 | 0 | 21248 | 1 | 13440 |
| 100000 | 5m | 1518 | 0 | 34624 | 1 | 13440 |
| 400000 | 5m | 1518 | 0 | 117536 | 1 | 13440 |
| 25000 | 40m | 1518 | 0 | 16928 | 1 | 13440 |
| 50000 | 40m | 1518 | 0 | 23392 | 1 | 13440 |
| 100000 | 40m | 1518 | 0 | 38816 | 1 | 13440 |
| 400000 | 40m | 1518 | 0 | 135520 | 1 | 13440 |
| 25000 | 100m | 1518 | 0 | 18848 | 1 | 13440 |
| 50000 | 100m | 1518 | 0 | 27264 | 1 | 13440 |
| 100000 | 100m | 1518 | 0 | 46496 | 1 | 13440 |
| 400000 | 100m | 1518 | 0 | 166688 | 1 | 13440 |
| 25000 | 300m | 1518 | 0 | 25184 | 1 | 13440 |
| 50000 | 300m | 1518 | 0 | 40128 | 1 | 13440 |
| 100000 | 300m | 1518 | 0 | 72384 | 1 | 13440 |
| 400000 | 300m | 1518 | 0 | 268640 | 1 | 13440 |
Table 12 Configure the PFC Lossless Buffer
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a buffer profile and enter its configuration view | buffer profile profile-name | profile-name: PFC profile name |
| Configure the PFC lossless buffer | mode lossless {static static_th | dynamic dynamic_th} size sizeFor other models:** mode lossless** {static static_th |dynamic dynamic_th} size size xoff xoff xon-offset xon-offset [xon xon] | For CX308P-48Y-N-V2 and CX532P-N-V2: |
- static_th denotes the static threshold value, the unit is byte, the value range is 0-47218432.
- dynamic_th denotes the dynamic threshold coefficient, the value range is [-4,3]; dynamic_th = 2dynamic_th*remaining available buffer. e.g., if dynamic_th is set to 1, then the dynamic threshold is 2 times of the remaining available buffer, i.e., the actual threshold is 2/3 of the total available buffer.The recommended value for CX308P-48Y-NF and CX532P-NF models is -3, and for other models is -1.size indicates the reservation size in bytes, and the recommended configuration value is 1518.
- xoff indicates the PFC backpressure frame trigger buffer threshold value, and it is recommended to configure it as an integer multiple of the cell size in bytes. xoff is related to the cable length, interface rate and other parameters, and you can refer to the recommended values for configuration. xoff must be greater than the xon value.xon-offset indicates the PFC backpressure frame stop buffer threshold value, which is recommended to be an integer multiple of the cell size, and the unit is byte. The recommended configuration value is 13440.
- xon should be an integer multiple of cell size, unit is byte, it is recommended to configure 0. The actual xon takes the larger value of xon and xon-offset, so generally do not need to configure xon.
Interface Binding PFC Configuration
Table 13 Interface Binding PFC Configuration
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a Class Map and enter its configuration view | class-map class-map-name | - |
| Specify the queue for which PFC is enabled | match cos queue | The value of queue is 0-7, use space to separate multiple queues. |
| Exit Class-map configuration view | exit | - |
| Enter Policy Map view | policy-map policy-map-name | - |
| Bind the class-map and enter its configuration view | class class-map-name | - |
| Bind PG Buffer Profile in queue ingress direction | priority-group-buffer buffer-profile-name | - |
| Exiting the Class view under Policy Map | exit | - |
| Exit Policy Map view | exit | - |
| Enter interface configuration view. | interface ethernet interface-name | - |
| Apply the policy to the interface. | service-policy policy-map-name | After the policy is bound to interface , dynamic modification of the policy configuration is not allowed. |
Configure PFCWD
Section titled “Configure PFCWD”PFC is required to be enabled before enabling PFCWD.
Table 14 Configure PFCWD
| Purpose | Commands | Description |
|---|---|---|
| Enter the global configuration view | configure terminal | - |
| Enable PFCWD | pfcwd enable {all | interface_name} detection-time d_time [action pfcwd_action | restoration-time r_time] | all: all interfaces d_time: detection time, range is [100,5000] pfcwd_action: execute action, optional parameters are (drop, forward, alert) r_time: recovery time, in the range of [100,60000] |
| (Optional) Set the PFCWD polling interval | pfcwd interval poll_interval | poll-interval: polling interval, in ms, range [100,3000] |
| (Optional) Enable PFCWD in default setting | pfcwd start_default | - |
Configure WRED
Section titled “Configure WRED”Configure WRED Dropp Profile
Table 15 Configure WRED Drop Profile
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create WRED profil and enter its configuration view | wred profile-name | profile-name: WRED profile name |
| Configure the WRED profile | mode drop gmin min_th gmax max_th gprobability probability [ymin min_th ymax max_th yprobability probability | rmin min_th rmax max_th rprobability probability] | - |
- min_th sets the lower absolute limit of WRED drop in bytes. That is, when the message length in the queue reaches this value, WRED drop starts. The configurable minimum value of min threshold is 15KB. The recommended configuration value is 15360.
- max_thsets the upper absolute value of WRED drop in bytes. That is, when the message length in the queue reaches this value, it starts to drop all newly received messages; for CX308P-48Y-N devices, the value range is min_th-25165824; for other models of devices, the value range is min_th-10243072. The recommended configuration values for the different rate interfaces are as follows: 25G(bps) ---192000(bytes) 100G(bps) --- 768000(bytes) 200G(bps) --- 768000(bytes) 400G(bps) --- 1536000(bytes)
- probabilitysets the maximum drop probability in the form of integer and the value range is [1,100]. For delay-sensitive services, it is recommended that the maximum drop probability be set to 90%; for throughput-sensitive services, it is recommended that it be set to 10%.
Configure Explicit Congestion Notification
Table 16 Configure Explicit Congestion Notification
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a WRED and enter its configuration view | wred profile-name | - |
| Configure ECN parameters. | mode ecn gmin min_th gmax max_th gprobability probability [ymin min_th ymax max_th yprobability probability | rmin min_th rmax max_th rprobability probability] | - |
- min_th Set the low limit absolute value of ECN in bytes. When the message length in the queue reaches this value, the interface starts to set the ECN field of the message to CE according to the probability. The configurable minimum value is 15 KB.The recommended configuration value is 15360.
- max_thSet the high limit absolute value of ECN in bytes. When the message length in the queue reaches this value, the interface starts to set ECN field of all packets to CE. For CX308P-48Y-N-V2 and CX532P-N-V2 , the range is min_th - 25165824, and for other models, the range is min_th - 10243072. The recommended configuration values for the different rate interfaces are as follows: 25G(bps) ---192000(bytes) 100G(bps) --- 768000(bytes) 200G(bps) --- 768000(bytes) 400G(bps) --- 1536000(bytes)
- probability Set the maximum mark probability in integer form. The range is [1,100]. It is recommended to set the mark probability to 90 percent for latency-sensitive services and 10 percent for throughput-sensitive services.
Apply the WRED Profile
After configuring a WRED drop policy or ECN policy, you need to bind interfaces and queues for it to take effect.
Table 17 Apply the WRED Profile
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create a Class Map and enter its configuration view | class-map class-map-name | - |
| Specify the queue for which WRED is applied | match cos queue | The value of queue is 0-7, use space to separate multiple queues. |
| Exit Class-map configuration view | exit | - |
| Enter Policy Map view | policy-map policy-map-name | - |
| Bind the class-map | class class-map-name | - |
| Policy binds WRED profile | wred profile-name | - |
| Exit the Class view under Policy Map | exit | - |
| Exit Policy Map view | exit | - |
| Enter Ethernet interface view | interface ethernet interface-name | - |
| Bind policy to interface | service-policy policy-map-name | After the policy is bound to interface , dynamic modification of the policy configuration is not allowed. |
Configure Packet Remarking
Section titled “Configure Packet Remarking”Table 18 Configure Packet Remarking
| Purpose | Commands | Description |
|---|---|---|
| Enter global configuration view | configure terminal | - |
| Create Layer 3 ACL table | access-list table_name l3 {ingress | egress} | - |
| Bind interface | bind interface {ethernet interface-name | link-aggregation lag-id |all} | - |
| Configure remarking rule | rule rule-id rule_options {set-dscp dscp | set-tc tc |set-pcp pcp} | rule-id: Rule sequence number (Range: 1-500)rule_options: match fields.set-dscp: Modify DSCP value (dscp: 0-63)set-tc: Modify CoS value (tc: 0-7)set-pcp: Modify VLAN priority (pcp: 0-7) |
Display and Maintenance
Section titled “Display and Maintenance”Class Map Information
Section titled “Class Map Information”Table 19 Class Map Information View
| Purpose | Commands | Description |
|---|---|---|
| Show class map configuration | show class-map class-map-name |
Diffserv Map Information
Section titled “Diffserv Map Information”Table 20 Diffserv Map Information View
| Purpose | Commands | Description |
|---|---|---|
| Show Diffserv Map configuration | show diffserv-map [type {ip-dscp {default | diffserv_map_name}|8021p diffserv_map_name}] | - |
Policy Map Information
Section titled “Policy Map Information”Tables 21 PFC Information View
| Purpose | Commands | Description |
|---|---|---|
| Show Policy Map information | show policy-map | - |
PFC Information
Section titled “PFC Information”Table 22 PFC Information View
| Purpose | Commands | Description |
|---|---|---|
| Show all interface PFC modes | show interface priority-flow-control | - |
| Show PFC buffer profile configuration | show buffer profile | - |
| Show PFC profile configuration | show pfc profiles | |
| Show PFC count | show counters priority-flow-control | - |
| Clear PFC count | clear counters priority-flow-control | - |
PFCWD Information
Section titled “PFCWD Information”Table 23 PFCWD Information View
| Purpose | Commands | Description |
|---|---|---|
| Display PFCWD configuration | show pfcwd configuration | - |
| Display PFCWD statistic information | show pfcwd stats | - |
WRED Information
Section titled “WRED Information”Table 24 WRED Information View
| Purpose | Commands | Description |
|---|---|---|
| Show wred profile configuration | show wred profile-name | - |
| Show the ECN enable status of an interface | show interface ecn {detail} | - |
| Show ECN count | show counters ecn | CX308P-48Y-N-V2 and CX532P-N-V2 are not supported now. |
| Clear ECN count | clear counters ecn | - |
| ECN buffer usage view | show counters ecn-buffer interface interface_name queue queue-id | queue-id: queue ID.Not supported by CX308P-48Y-N-V2 and CX532P-N-V2 |
Queue Information
Section titled “Queue Information”Table 25 Queue Information View
| Purpose | Commands | Description |
|---|---|---|
| Show queue count | show counters queue [interface-name] | - |
| Clear queue count | clear counters queue | - |
Typical Configuration Example
Section titled “Typical Configuration Example”Example of Priority Mapping and Queue Scheduling Configuration
Section titled “Example of Priority Mapping and Queue Scheduling Configuration”- Network Requirements The network structure of a data center is shown in the figure below. There are three types of traffic accessing the Internet in the network: HTTP, FTP and Email, and the DSCP bits in the corresponding messages are 33, 35 and 27 respectively. The following requirements are required: Set the packet transmission priority on the Switch as follows: HTTP>FTP>Email. When congestion occurs, priority will be given to the transmission of HTTP messages, and HTTP data must be sent first before other data is sent, and the ratio of FTP to Email traffic will be 2:1.
- Topology

- Procedure
- Configure each interface IP to enable users to access the network through the Switch. (skipped)
- Check the default mapping relationship on the port and find that dscp33, 35 and 27 are mapped to local priority 0. According to the networking requirements, these three types of messages should be mapped to different queues. Here, dscp33, 35 and 27 are mapped to queues 5, 6 and 7 respectively as an example.
sonic# configure terminal sonic(config)# diffserv-map type ip-dscp dscp-profile sonic(config-diffservmap-dscp-profile)# ip-dscp 33 cos 5 sonic(config-diffservmap-dscp-profile)# ip-dscp 35 cos 6 sonic(config-diffservmap-dscp-profile)# ip-dscp 27 cos 7 sonic(config-diffservmap-dscp-profile)# exit sonic(config)# policy-map pmap1 sonic(config-pmap-pmap1)# set cos dscp diffserv dscp-profile sonic(config-pmap-pmap1)# exit sonic(config)# interface ethernet 0/0 sonic(config-if-0/1)# service-policy pmap1- Configure DWRR+SP schedule on switch Ethernet1.
sonic(config)# policy-map pmap2 sonic(config-pmap-pmap2)# queue-scheduler queue-limit percent 20 queue 6 sonic(config-pmap-pmap2)# queue-scheduler queue-limit percent 10 queue 7 sonic(config-pmap-pmap2)# queue-scheduler priority queue 5 sonic(config)# interface ethernet 0/1 sonic(config-if-0/1)# service-policy pmap2- Verify
- Verify the configuration
sonic# show diffserv-map type ip-dscp dscp-profileDiffserv Map dscp-profile:Type ip-dscp from 27 to 7 from 33 to 5 from 35 to 6sonic# show policy-map!policy-map pmap1set cos dscp diffserv dscp-profile!policy-map pmap2queue-scheduler priority queue 5queue-scheduler queue-limit percent 10 queue 7queue-scheduler queue-limit percent 20 queue 6sonic# show interface policy-mapPort service policy------ ---------------0/0 pmap10/1 pmap2- Send the stream to verify. Check queue reception on switch port Ethernet1.
sonic# show counters queue 0/1When congestion occurs, traffic on queue5 is sent first and there is no packet loss. queue6 and 7 both experience packet loss and transmit traffic in a ratio of roughly 2:1.
Example of Flow Shape Configuration
Section titled “Example of Flow Shape Configuration”- Networking Requirements The network structure of a data center is shown in the figure below. The services from the network side of the group are data, voice and video, carrying 802.1p priorities of 2, 5 and 6 respectively. Bandwidth jitter may occur as the traffic rate on the ingress side of the Switch is greater than the rate on the egress side. In order to reduce bandwidth jitter while ensuring bandwidth requirements for all types of services, it is required that
- Switch egress bandwidth limited to 1000Mbit/s.
- Data bandwidth limited to 200Mbit/s.
- Voice bandwidth limited to 300Mbit/s.
- Video bandwidth limited to 500Mbit/s.
- Topology

- Procedure
- Configure each interface IP to enable users to access the network through the Switch. (skipped)
- Configure the priority mapping of dot1p_to_tc.
sonic# configure terminalsonic(config)# diffserv-map type ip-dscp dscp-profilesonic(config-diffservmap-dscp-profile)# ip-dscp 2 cos 2sonic(config-diffservmap-dscp-profile)# ip-dscp 5 cos 5sonic(config-diffservmap-dscp-profile)# ip-dscp 6 cos 6sonic(config-diffservmap-dscp-profile)# exitsonic(config)# policy-map pmap1sonic(config-pmap-pmap1)# set cos dscp diffserv dscp-profilesonic(config-pmap-pmap1)# exitsonic(config)# interface ethernet 0/0sonic(config-if-0/1)# service-policy pmap1- Configure port traffic shaping and queue traffic shaping on Ethernet1 of the Switch. Set pir=1000Mb/s and pbs=1280000b.
sonic(config)# class-map que2sonic(config-cmap-c1)# match cos 2sonic(config)# class-map que5sonic(config-cmap-c1)# match cos 5sonic(config)# class-map que6sonic(config-cmap-c1)# match cos 6sonic(config)# policy-map pmap2sonic(config-pmap-pmap2)# port-shape 1000000000 1280000sonic(config-pmap-pmap2)# queue-scheduler priority queue 2sonic(config-pmap-pmap2)# queue-scheduler priority queue 5sonic(config-pmap-pmap2)# queue-scheduler priority queue 6sonic(config-pmap-pmap2)# class que2sonic(config-pmap-c)# queue-shape 200000000 256000sonic(config-pmap-c)# exitsonic(config-pmap-pmap1)# class que5sonic(config-pmap-c)# queue-shape 500000000 640000sonic(config-pmap-c)# exitsonic(config-pmap-pmap2)# class que6sonic(config-pmap-c)# queue-shape 600000000 768000sonic(config-pmap-c)# endsonic# configure terminalsonic(config)# interface ethernet 0/1sonic(config-if-0/1)# service-policy pmap2- Verify
- Verify the configuration
sonic# show diffserv-map type ip-dscp dscp-profileDiffserv Map dscp-profile:Type ip-dscp from 2 to 2 from 5 to 5 from 6 to 6sonic# show policy-map!policy-map pmap1set cos dscp diffserv dscp-profile!policy-map pmap2class que2 queue-shape 200000000 256000class que5 queue-shape 500000000 640000class que6 queue-shape 600000000 768000port-shape 1000000000 1280000queue-scheduler priority queue 2queue-scheduler priority queue 5queue-scheduler priority queue 6sonic# show interface policy-mapPort service policy------ ---------------0/0 pmap10/1 pmap2- Send the stream to verify. Check the port count and queue count, and both meet the requirements.
show counters interfaceshow counters queue 0/1