Packet forwarding device and queue management method
By dynamically adjusting the number of buffers in the priority queue in the gateway, the problem of resource waste caused by queue congestion in the existing technology is solved, and the effect of optimizing throughput and service quality under limited resources is achieved.
Patent Information
- Application Number
- CN202110960907.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-04-26
- Filing Date
- 2021-08-20
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-08-20
AI Technical Summary
When existing gateways provide queues for multiple output ports, in order to avoid queue congestion, a large amount of hardware cost is required to provide buffers, resulting in a waste of resources and low efficiency.
A packet forwarding device is designed, including a receiving port, an output port, a memory circuit and a queue management circuit. By dynamically allocating and adjusting the number of buffers in the priority queue in the free buffer pool, the buffers in the congestion queue are increased according to the number of discarded packets. and reduce buffers for low-priority queues to optimize throughput and quality of service.
Under limited buffer memory resources, dynamic adjustment of the number of queue buffers is achieved, improving throughput and service quality, and avoiding resource waste caused by queue congestion.
Smart Images

Figure CN115250256B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a queue management technology, and in particular to a packet forwarding device and a queue management method. Background Art
[0002] The existing gateway has multiple output ports, each of which corresponds to a queue with a different priority order to buffer and store packets. If a large number of buffers are provided for each queue, the problem of queue congestion can be avoided, but a large amount of hardware cost is required. Summary of the invention
[0003] One embodiment of the present invention provides a packet forwarding device, comprising at least one receiving port, at least one output port, a memory circuit, a forwarding circuit and a queue management circuit. The receiving port is configured to receive a packet. The memory circuit includes a free buffer pool and a plurality of priority queues. These priority queues correspond to at least one output port, wherein the priority queues corresponding to the same output port are respectively associated with different transmission priorities. The forwarding circuit is configured to store packets in a target queue in the priority queues, to discard packets in response to congestion in the target queue, and to store packets in response to no congestion in the target queue. The queue management circuit is configured to allocate at least one buffer from the free buffer pool to each priority queue, and to monitor the number of discarded packets in an observation queue in the priority queues, so as to increase the number of buffers of the observation queue according to the number of discarded packets, and to reduce the number of buffers of at least one priority queue whose transmission priority is lower than that of the observation queue.
[0004] An embodiment of the present invention provides a queue management method, which is applicable to a plurality of priority queues, each of which is associated with a different transmission priority. The queue management method includes: allocating at least one buffer from a free buffer pool to each priority queue; monitoring the number of discarded packets of an observation queue among the priority queues; and increasing the number of buffers of the observation queue according to the number of discarded packets, and reducing the number of buffers of at least one priority queue whose transmission priority is lower than that of the observation queue.
[0005] In summary, the packet forwarding device and queue management method proposed in some embodiments of the present invention can dynamically adjust the number of buffers in the queue under the resource constraints of limited buffer memory to provide optimized throughput and service quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0006] The preferred embodiments of the present invention will be further described in detail below with reference to the accompanying drawings, wherein:
[0007] Figure 1 FIG. 4 is a schematic diagram of a packet forwarding device according to an embodiment of the present invention.
[0008] Figure 2 The figure is a flow chart of a queue management method according to an embodiment of the present invention.
[0009] Figure 3 The figure is a flowchart of a queue management method according to another embodiment of the present invention.
[0010] Figure 4 For an embodiment of the present invention Figure 3 Detailed flowchart of step S505.
[0011] Figure 5 Another embodiment of the present invention Figure 3 Detailed flowchart of step S505. DETAILED DESCRIPTION
[0012] Reference Figure 1 , is a schematic diagram of a packet forwarding device according to an embodiment of the present invention. The packet forwarding device includes at least one receiving port 10, at least one output port 20, a memory circuit 30, a forwarding circuit 40 and a queue management circuit 50. The receiving port 10 is configured to receive packets. The memory circuit 30 includes a free buffer pool 32 and a plurality of priority queues 33. The free buffer pool 32 includes a plurality of buffers (not shown). The size of each buffer is not less than the size of the packet to ensure that the packet can be stored completely. Here, one receiving port 10 is taken as an example, and eight output ports 20 are taken as an example. These priority queues 33 correspond to at least one output port 20. The priority queues 33 corresponding to the same output port 20 are respectively associated with different transmission priorities. Here, Figure 1 Taking eight priority queues 33 as an example, their transmission priorities are numbered 33a-33h from high to low. The forwarding circuit 40 is configured to store the packet into a priority queue 33 (hereinafter referred to as the "target queue") of a certain output port 20 (hereinafter referred to as the "target output port"). The forwarding circuit 40 discards the packet in response to the target queue being congested, and stores the packet into the target queue in response to the target queue not being congested.
[0013] In some embodiments, the destination output port and the destination queue are determined by information extracted from the packet header.
[0014] In some embodiments, the process of storing a packet in a target queue includes the following steps. First, a buffer is allocated from the free buffer pool 32. Then, the packet is moved into the buffer. Furthermore, the target output port and the target queue of the packet are determined, and the packet is enqueued into the target queue of the target output port. After the packet is stored in the target queue, the packet can be dequeued according to the egress schedule and output from the target output port. The packet forwarding device also includes an egress scheduler (not shown) configured to execute the egress schedule.
[0015] The queue management circuit 50 executes the queue management method. Figure 2 , is a flow chart of a queue management method according to an embodiment of the present invention. The queue management method is applicable to each output port 20. First, at least one buffer 31 is allocated from the free buffer pool 32 to each priority queue 33 (step S401). Figure 1 As shown, each priority queue 33 has at least one buffer 31. In step S402, the number of discarded packets of these priority queues 33 is monitored. In step S403, based on the number of discarded packets, the buffers 31 to be increased are taken out from the free buffer pool 32 to increase the number of buffers 31 of the congested priority queue 33. In this way, the priority queue 33 whose packets are discarded due to insufficient number of buffers 31 can have enough buffers 31 to store packets. In addition, in step S403, the number of buffers 31 of the priority queue 33 with lower transmission priority than the congested priority queue 33 is also reduced to recycle the excess buffers 31 to the free buffer pool 32 to provide buffers 31 to the priority queue 33 that needs to increase the number of buffers 31.
[0016] In some embodiments, the adjustment range of the number of buffers 31 has an upper limit.
[0017] Please refer to Figure 3, is a flow chart of a queue management method according to another embodiment of the present invention. In step S501, similar to the aforementioned step S401, at least one buffer 31 is allocated from the free buffer pool 32 to each priority queue 33. In step S502, one of the one or more output ports 20 is selected as an observation output port. Next, one of the multiple priority queues 33 of the observation output port is selected as an observation queue (step S503). In step S504, the number of discarded packets of the observation queue of the observation output port is monitored (for the sake of explanation, if only the observation queue is mentioned later, it refers to the observation queue of the observation output port). Then, in step S505, the number of buffers 31 of the observation queue is adjusted; in step S506, the number of buffers 31 of the priority queue 33 (hereinafter referred to as the "low priority queue") with a lower transmission priority than the observation queue is selectively adjusted. For example, if the priority queue 33c is the observation queue, the low priority queues are the priority queues 33d to 33h. The details of steps S505 and S506 will be described later. In step S507, it is determined whether all priority queues 33 have been monitored, that is, whether there are other priority queues 33 that have not been used as observation queues. If all priority queues 33 have not been monitored, then step S508 is entered to select another priority queue 33 that has not been monitored as the observation queue. If all priority queues 33 have been monitored, then step S509 is entered to determine whether all output ports 20 have been monitored, that is, whether there are other output ports 20 that have not been used as observation output ports. If all output ports 20 have not been monitored, then step S510 is entered to select another output port 20 that has not been monitored as the observation output port. If all output ports 20 have been monitored, then return to step S502 to perform a new round of monitoring. In this way, each priority queue 33 of each output port 20 is continuously monitored to see if it is congested, and the number of buffers 31 is adjusted accordingly.
[0018] In some embodiments, the priority queues 33 are selected as observation queues in sequence according to the order of transmission priority.
[0019] Next, it is described how to adjust the number of buffers 31 of the observation queue. Figure 4 , is an embodiment of the present invention Figure 3Detailed flowchart of step S505 in FIG. First, determine whether there are packets discarded in the observation queue (step S511), that is, whether the number of discarded packets is greater than zero. If there are packets discarded (the number of discarded packets is greater than zero), then enter step S512 to increase the number of buffers 31 in the observation queue. In some embodiments, the number of discarded packets is used as the number of buffers 31 to be increased. In some embodiments, the number of discarded packets is used as a base number, and the integer multiples of the base number are used as the number of buffers 31 to be increased. In other words, the number of buffers 31 in the observation queue is at least one times the number of discarded packets. If no packets are discarded, then enter step S513 to adjust the number of buffers 31 in the observation queue according to the difference between the current number of buffers 31 in the observation queue and the number monitored in the previous (previous round). In other words, compared with the number of buffers 31 in the observation queue in the previous round of monitoring, the number of buffers 31 in the observation queue is increased (or decreased) according to the increase (or decrease) number of buffers 31 in the observation queue in this round of monitoring. That is, the number of buffers 31 increased (or decreased) is taken as a base number, and at least one times of the base number is taken as the number of buffers 31 increased (or decreased). Therefore, when there is no congestion, the number of buffers 31 can be dynamically adjusted according to the packet flow.
[0020] In some embodiments, if no packets are dropped, the number of buffers 31 in the observation queue is not adjusted.
[0021] Next, it is described how to adjust the number of buffers 31 of the low priority queue. Figure 5 , is another embodiment of the present invention Figure 3Detailed flow chart of step S506 in step S521. Here, the reduction in the number of buffers 31 of one or more low priority queues is equivalent to the increase in the number of buffers 31 of the observation queue in the aforementioned step S505. In step S521, one of the low priority queues (hereinafter referred to as the "queue to be adjusted") is first selected. In some embodiments, the selection is made in the order of transmission priority. For example, the priority queues 33 with the lowest transmission priority to the one-level lower transmission priority than the observation queue are selected as low priority queues in sequence. That is, the one with the lowest transmission priority in the low priority queue is preferentially selected as the queue to be adjusted. In other words, in one or more low priority queues, the number of buffers 31 is adjusted starting from the priority queue 33 with the lowest level of transmission priority. For example, if the priority queue 33c is used as the observation queue, the number of buffers 31 of the priority queue 33h is adjusted first. In some embodiments, the priority queue 33 with a transmission priority one level lower than the observation queue (that is, the one with the highest transmission priority in the low priority queue) is preferentially selected as the queue to be adjusted. In other words, in one or more low priority queues, the number of buffers 31 is adjusted starting from the priority queue 33 with a lower transmission priority than the observation queue. For example, if the priority queue 33c is the observation queue, the number of buffers 31 of the priority queue 33d is adjusted first.
[0022] In step S522, the adjustment quantity of the buffer 31 of the observation queue is determined.
[0023] If the adjusted number of buffers 31 of the observation queue is zero, there is no need to adjust the number of buffers 31 of the low priority queue (queue to be adjusted), and the process directly goes to the aforementioned step S507.
[0024] If the adjusted number of buffers 31 of the observation queue is less than zero (i.e., the number is reduced), the number of buffers 31 of the queue to be adjusted is increased (step S523). The increased number of buffers 31 of the queue to be adjusted is equivalent to the reduced number of buffers 31 of the observation queue in the aforementioned step S505. In this way, the buffer 31 resources not used by the observation queue can be shared with other priority queues 33.
[0025] If the adjusted number of buffers 31 of the observation queue is greater than zero (i.e., the increased number), it is determined whether the queue to be adjusted has a sufficient number of buffers 31 available for recovery (step S524). Specifically, each priority queue 33 has a buffer 31 with a minimum threshold. For example, the minimum threshold can be set to 1, and at least one buffer 31 will be reserved for the priority queue 33. Therefore, in step S524, it can be confirmed whether the number of buffers 31 other than the number of buffers 31 with the minimum threshold is greater than or equal to the increased number of buffers 31 of the observation queue in the aforementioned step S505. If so, it indicates that it is sufficient, and the process proceeds to step S525; otherwise, it indicates that it is insufficient, and the process proceeds to step S526.
[0026] In step S525, the number of buffers 31 of the secondary priority queue is reduced, and the reduced number is equivalent to the increased number of buffers 31 of the observation queue in the aforementioned step S505. Thereafter, the process proceeds to the aforementioned step S507.
[0027] In step S526, the number of buffers 31 of the secondary priority queue is reduced to the minimum threshold. The reduced number of buffers 31 is only sufficient to supply a part of the increased number of buffers 31 of the observation queue. Then, step S527 is entered to determine whether a sufficient number of buffers 31 have been recovered (i.e., the increased number of buffers 31 of the observation queue). If so, the aforementioned step S507 is entered. If not, it means that the buffers 31 must be recovered from the remaining low priority queues, and step S528 is entered to determine whether there are any remaining low priority queues. If not, the aforementioned step S507 is entered. If so, step S529 is entered to select one of the remaining low priority queues as the next queue to be adjusted. Then, the process returns to step S526 and continues to execute steps S526 to S529 until the buffers 31 equivalent to the increased number of buffers 31 of the observation queue are recovered or all low priority queues have been recovered.
[0028] In some embodiments, step S521 is performed after step S522. That is, step S521 is performed between step S522 and step S523; and step S521 is performed between step S522 and step S524.
[0029] In some embodiments, the packet forwarding device is a network device such as a gateway, a network modem, a router, or a wireless network access point.
[0030] In some embodiments, the forwarding circuit 40 and the queue management circuit 50 can be implemented through a microprocessor, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a logic circuit, an analog circuit, a digital circuit and / or any processing element based on an operation instruction operating signal (analog and / or digital).
[0031] In summary, the packet forwarding device and queue management method proposed in some embodiments of the present invention can dynamically adjust the number of buffers 31 of a queue under the resource constraints of a limited buffer memory to provide optimized throughput and service quality. In some embodiments, when queue congestion is detected, the number of buffers 31 can be increased. In some embodiments, when the usage of the buffer 31 of a queue decreases, its number can be reduced to allow other congested queues to use more buffers 31.
[0032]
Explanation of symbols
[0033] 10: receiving port
[0034] 20: Output port
[0035] 30: Memory circuit
[0036] 31: Buffer
[0037] 32: Free buffer pool
[0038] 33,33a~33h: Priority queue
[0039] 40: Forwarding circuit
[0040] 50: Queue management circuit
[0041] S401~S403: Steps
[0042] S501~S510: Steps
[0043] S511~S513: Steps
[0044] S521~S529: Steps
Claims
1. A packet forwarding device, include: at least one receiving port configured to receive a packet; at least one output port; A memory circuit comprising a free buffer pool and a plurality of priority queues, the priority queues corresponding to the at least one output port, wherein the priority queues corresponding to the same output port are respectively associated with different transmission priorities; a forwarding circuit configured to store the packet in a target queue among the priority queues, to discard the packet in response to congestion in the target queue, and to store the packet in response to no congestion in the target queue; and A queue management circuit is configured to allocate at least one buffer from the free buffer pool to each of the priority queues. The queue management circuit is also configured to select one of the multiple priority queues as an observation queue and monitor the number of discarded packets of an observation queue among the priority queues to increase the number of buffers allocated from the free buffer pool to the observation queue based on the number of discarded packets. The queue management circuit is also configured to reduce the number of buffers of at least one of the priority queues whose transmission priority is lower than that of the observation queue to recycle the buffer to the free buffer pool.
2. The packet forwarding device as described in claim 1, wherein the increase amount of the buffer of the observation queue is at least one times the number of discarded packets.
3. The packet forwarding device as claimed in claim 2, wherein the increase amount of the buffer of the observation queue is equivalent to the decrease amount of the buffer of the at least one priority queue.
4. The packet forwarding device as claimed in claim 1, wherein the increase amount of the buffer of the observation queue is equivalent to the decrease amount of the buffer of the at least one priority queue.
5. The packet forwarding device as described in claim 1, wherein if the number of discarded packets of the observation queue is zero, the queue management circuit is configured to adjust the number of the buffers of the observation queue according to the difference between the current number of the buffers of the observation queue and the number monitored last time.
6. The packet forwarding device as claimed in claim 1, wherein the queue management circuit is configured to reduce the number of buffers starting from the priority queue that is one level lower than the observation queue. 7 . The packet forwarding device as claimed in claim 1 , wherein the queue management circuit is configured to reduce the number of buffers starting from the priority queue having the lowest level of transmission priority.
8. A queue management method, applicable to a plurality of priority queues, wherein the priority queues are respectively associated with different transmission priorities. include: Allocating at least one buffer from a free buffer pool to each priority queue, selecting one of the plurality of priority queues as an observation queue; Monitoring a number of discarded packets in an observation queue among the priority queues; and According to the number of discarded packets, the number of the buffers corresponding to the observation queue is increased from the free buffer pool, and the number of the buffers of at least one priority queue with a lower transmission priority than the observation queue is reduced to recycle the buffers to the free buffer pool.
9. The queue management method according to claim 8, in, The amount of the buffer of at least one of the priority queues having a lower transmission priority than the observation queue is reduced to increase the amount of the buffer corresponding to the observation queue.
10. The queue management method of claim 8, wherein the increase amount of the buffer of the observation queue is at least one time the number of discarded packets. 11 . The queue management method as claimed in claim 10 , wherein the increase amount of the buffer of the observation queue is equivalent to the decrease amount of the buffer of the at least one priority queue. 12 . The queue management method of claim 8 , wherein the increase amount of the buffer of the observation queue is equivalent to the decrease amount of the buffer of the at least one priority queue.
13. The queue management method according to claim 8, further comprising: include: If the number of discarded packets is zero, the number of the buffer of the observation queue is adjusted according to the difference between the current number of the buffer of the observation queue and the number monitored last time.
14. The queue management method as claimed in claim 8, wherein reducing the amount of the buffer of at least one of the priority queues having a lower transmission priority than the observation queue starts from the priority queue at a lower level than the observation queue.
15. The queue management method of claim 8, wherein reducing the amount of the buffer of at least one of the priority queues having a lower transmission priority than the observation queue is reduced starting from the priority queue having the lowest level of transmission priority.
Citation Information
Patent Citations
Data packet transmission method and device
CN103229466A
Packet exchange device, and packet exchange method
JP2015177534A
System and Method for Dynamically Allocating Buffers Based on Priority Levels
US20090161684A1
Congestion drop decisions in packet queues
US20210021545A1
ATM switch
US6501757B1
