Data scheduling method of a switch and switch

CN116827892BActive Publication Date: 2026-09-08MOTORCOMM (SHANGHAI) ELECTRONIC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310888924.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-19
Publication Date
2026-09-08
Estimated Expiration
2043-07-19

AI Technical Summary

Technical Problem

[0003]DWRR(deficit weighted round robin)调度算法和WFQ(Weighted FairQueuing,加权公平排队)调度算法是常见的调度算法,但是两个算法各有弊端,DWRR调度算法对数据包的调度效果不理想,WFQ调度算法对于硬件的要求较高

Benefits of technology

[0041] The above technical solution has the following advantages or beneficial effects: the corresponding scheduling value is calculated based on the number of packets and the weight of each message queue, and after each packet is sent, the relationship between the scheduling value of the first message queue, the scheduling value of the second message, and the scheduling value of the last message queue in the queue to be sent is judged to adjust the moving position of the first message queue. It can simultaneously have the advantages of low hardware requirements and good scheduling effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116827892B_ABST
    Figure CN116827892B_ABST
Patent Text Reader

Abstract

The application provides a data scheduling method and a switch, and relates to the field of data scheduling.The method comprises the following steps: a switch forms a to-be-sent packet queue according to queue weights associated with each message queue; the switch controls a message queue at the head of the to-be-sent packet queue to send one message packet and reduces the associated number of message packets by one, and meanwhile removes the message queue with the number of message packets not greater than zero from the to-be-sent packet queue; when there are at least two message queues in the to-be-sent packet queue, the switch calculates a corresponding scheduling value for each message queue in the to-be-sent packet queue according to the associated number of message packets and the queue weight; then the switch adjusts the position of each message queue in the to-be-sent packet queue according to the scheduling values; then the switch controls the message queue at the head to send packets again; and when there is only one message queue in the to-be-sent packet queue, the switch sends the message packets of the message queue. The method has the advantages of low hardware requirement and good scheduling effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data scheduling, and more particularly to a data scheduling method for a switch and a switch. Background Technology

[0002] When forwarding packets, switches need to sort the packets in queues. A queue refers to the logic of sorting packets in a buffer. When the traffic rate exceeds the interface bandwidth or the bandwidth set for that traffic, packets are temporarily stored in the buffer in the form of queues. The time and order in which packets leave the queues, as well as the relationship between the departure times of packets in different queues, are determined by a queue scheduling algorithm.

[0003] DWRR (deficit weighted round robin) and WFQ (weighted fair queuing) are common scheduling algorithms, but each has its drawbacks. DWRR is not ideal for packet scheduling, while WFQ has high hardware requirements. Summary of the Invention

[0004] To address the problems existing in the prior art, this invention provides a data scheduling method for a switch. The switch has a buffer of several packet queues to be forwarded, each packet queue containing multiple packets. Each packet queue is associated with a corresponding queue weight and a number of packets. The scheduling method includes:

[0005] Step S1: The switch forms a packet queue to be sent according to the queue weight associated with each packet queue.

[0006] Step S2: The switch controls the packet queue at the head of the packet queue to send a packet and decrements the associated packet count by one. Simultaneously, it removes the packet queues with a packet count not greater than zero from the packet queue to be sent. Then, it determines whether there are at least two packet queues in the packet queue to be sent.

[0007] If so, proceed to step S3;

[0008] If not, proceed to step S4;

[0009] Step S3: For each packet queue in the packet queue to be sent, the switch calculates the corresponding scheduling value based on the associated number of packets and the queue weight; then, it adjusts the position of each packet queue in the packet queue to be sent according to each scheduling value, and then returns to step S2.

[0010] Step S4, the switch determines whether the packet queue contains at least one of the packet queues:

[0011] If so, return to step S2;

[0012] If not, then exit.

[0013] Preferably, the formula for calculating the scheduling value is:

[0014] T = credit / weight

[0015] Where T is the scheduling value, credit is the number of packets, and weight is the queue weight.

[0016] Preferably, step S3 includes:

[0017] Step S31: For each packet queue in the packet queue to be sent, the switch calculates the corresponding scheduling value based on the associated number of packets and the queue weight.

[0018] In step S32, the switch adjusts the position of each packet queue in the packet queue according to the scheduling value corresponding to the packet queue at the head of the queue, the packet queue at the second position, and the packet queue at the tail of the queue, and then returns to step S2.

[0019] Preferably, step S32 includes:

[0020] Step S321, the switch determines whether the scheduling value corresponding to the packet queue at the head of the packet queue is greater than the scheduling value corresponding to the packet queue at the second position:

[0021] If so, proceed to step S2;

[0022] If not, proceed to step S322;

[0023] Step S322, the switch determines whether the scheduling value corresponding to the packet queue at the head of the packet queue is greater than the scheduling value corresponding to the packet queue at the tail of the packet queue:

[0024] If so, the message queue at the head of the queue is moved to the front of the message queue at the tail of the queue, and then proceeds to step S2;

[0025] If not, the message queue at the head of the queue is moved to the end of the queue, and then the process proceeds to step S2.

[0026] The present invention also provides a switch, which applies the above-described data scheduling method, the switch comprising:

[0027] The caching module is used to cache several message queues to be forwarded. Each message queue contains multiple message packets, and each message queue is associated with a corresponding queue weight and the number of message packets.

[0028] The initial module, connected to the cache module, is used to form a queue of packets to be sent based on the queue weights associated with each of the message queues;

[0029] The packet sending module, connected to the initial module, is used to control the packet queue at the head of the queue to be sent to send a packet and decrement the associated packet count when it is determined that the packet queue contains at least one of the packet queues. Simultaneously, it removes the packet queues with a packet count not greater than zero from the queue to be sent. Then, it generates an adjustment signal when it is determined that at least two of the packet queues exist in the queue to be sent.

[0030] An adjustment module, connected to the packet sending module, is used to calculate a corresponding scheduling value for each packet queue in the packet sending queue based on the adjustment signal, according to the associated number of packets and the queue weight; and then adjust the position of each packet queue in the packet sending queue according to each scheduling value.

[0031] Preferably, the formula for calculating the scheduling value is:

[0032] T = credit / weight

[0033] Where T is the scheduling value, credit is the number of packets, and weight is the queue weight.

[0034] Preferably, the adjustment module includes:

[0035] The calculation unit is used to calculate the corresponding scheduling value for each message queue in the packet queue to be sent, based on the associated number of messages and the queue weight.

[0036] An adjustment unit, connected to the calculation unit, is used to adjust the position of each message queue in the packet queue to be sent according to the scheduling value corresponding to the message queue at the head of the queue, the message queue at the second position, and the message queue at the tail of the queue.

[0037] Preferably, the adjustment unit includes:

[0038] The first adjustment unit is used to generate a judgment signal when it is determined that the scheduling value corresponding to the packet queue at the head of the packet queue is not greater than the scheduling value corresponding to the packet queue at the second position.

[0039] The second adjustment unit, connected to the first adjustment unit, is used to adjust the message queue at the head of the queue to the front of the message queue at the tail of the queue when the scheduling value corresponding to the message queue at the head of the queue is greater than the scheduling value corresponding to the message queue at the tail of the queue, based on the judgment signal.

[0040] The third adjustment unit, connected to the first adjustment unit, is used to adjust the message queue at the head of the queue to the tail of the queue when the scheduling value corresponding to the message queue at the head of the queue is greater than the scheduling value corresponding to the message queue at the tail of the queue, based on the judgment signal.

[0041] The above technical solution has the following advantages or beneficial effects: the corresponding scheduling value is calculated based on the number of packets and the weight of each message queue, and after each packet is sent, the relationship between the scheduling value of the first message queue, the scheduling value of the second message, and the scheduling value of the last message queue in the queue to be sent is judged to adjust the moving position of the first message queue. It can simultaneously have the advantages of low hardware requirements and good scheduling effect. Attached Figure Description

[0042] Figure 1 A flowchart illustrating a data scheduling method for a switch is provided in a preferred embodiment of the present invention.

[0043] Figure 2 This is a schematic diagram of a sub-process of step S3 in a preferred embodiment of the present invention;

[0044] Figure 3 This is a schematic diagram of a sub-process of step S32 in a preferred embodiment of the present invention;

[0045] Figure 4 This is a schematic diagram of the structure of a switch in a preferred embodiment of the present invention. Detailed Implementation

[0046] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. The present invention is not limited to this embodiment; other embodiments that conform to the spirit of the present invention may also fall within the scope of the present invention.

[0047] In a preferred embodiment of the present invention, based on the above-mentioned problems existing in the prior art, a data scheduling method for a switch is provided. The switch has a buffer of several packet queues to be forwarded, each packet queue containing multiple packets, and each packet queue is associated with a corresponding queue weight and a number of packets. Then, as follows... Figure 1 As shown, the scheduling method includes:

[0048] Step S1: The switch forms a queue of packets to be sent based on the queue weight associated with each packet queue.

[0049] Step S2: The switch controls the packet queue at the head of the queue to be sent to send a packet and decrements the associated packet count by one. At the same time, it removes the packet queue with a packet count not greater than zero from the queue to be sent. Then, it determines whether there are at least two packet queues in the queue to be sent.

[0050] If so, proceed to step S3;

[0051] If not, proceed to step S4;

[0052] Step S3: For each packet queue in the packet queue to be sent, the switch calculates the corresponding scheduling value based on the number of associated packets and the queue weight; then, it adjusts the position of each packet queue in the packet queue to be sent according to each scheduling value, and then returns to step S2.

[0053] Step S4, the switch determines whether the packet queue contains at least one packet queue:

[0054] If so, return to step S2;

[0055] If not, then exit.

[0056] Specifically, in this embodiment, the switch needs to sort the packets to be forwarded to form a forwarding queue. A queue refers to the logic of sorting packets in the buffer. When the rate of traffic received by the switch exceeds the interface bandwidth or the bandwidth set for that traffic, the packets are temporarily stored in the buffer in the form of a queue. The time and order in which packets leave the queue, as well as the relationships between the queues, are determined by the queue scheduling algorithm.

[0057] Existing scheduling algorithms such as DWRR and WFQ are common scheduling algorithms, but they each have their drawbacks. In this embodiment of the invention, a new scheduling algorithm is proposed.

[0058] In the scheduling algorithm of the present invention, the switch has multiple message queues to be forwarded, and each message queue includes multiple message packets. The switch first sorts the message queues according to the queue weight of each message queue to form a message queue to be sent.

[0059] Subsequently, the switch controls the packet queue at the head of the queue to send a packet, and simultaneously decrements the packet count associated with that packet queue by one. At this point, the DWRR algorithm would directly move the packet queue at the head of the queue to the tail, while the WFQ algorithm would find the packet queue with the largest (packet count / queue weight) in the queue to send and place it at the head of the queue. Of these two algorithms, the DWRR algorithm, although fast and with low hardware requirements, has unsatisfactory scheduling performance, and the WFQ algorithm, although with good scheduling performance, has high hardware requirements. In the scheduling algorithm of this invention, it is only necessary to calculate the scheduling value (i.e., packet count / queue weight) of the packet queues at the head, second, and tail of the queue to send, and then adjust the position of the packet queue at the head of the queue according to each scheduling value. Because it does not need to calculate the scheduling value of all packet queues, the hardware requirements are lower than those of the WFQ algorithm. Moreover, the scheduling performance is better than the DWRR algorithm because it takes into account the relationship between the scheduling values ​​of the packet queues. It achieves the advantages of good scheduling performance and low hardware requirements.

[0060] In a preferred embodiment of the present invention, the formula for calculating the scheduling value is as follows:

[0061] T = credit / weight

[0062] Where T is the scheduling value, credit is the number of packets, and weight is the queue weight.

[0063] In a preferred embodiment of the present invention, such as Figure 2 As shown, step S3 includes:

[0064] Step S31: For each packet queue in the packet queue to be sent, the switch calculates the corresponding scheduling value based on the number of associated packets and the queue weight.

[0065] In step S32, the switch adjusts the position of each packet queue in the packet queue according to the scheduling values ​​corresponding to the packet queue at the head, the second position, and the tail of the packet queue, and then returns to step S2.

[0066] In a preferred embodiment of the present invention, such as Figure 3 As shown, step S32 includes:

[0067] Step S321: The switch determines whether the scheduling value corresponding to the packet queue at the head of the queue is greater than the scheduling value corresponding to the packet queue at the second position.

[0068] If so, proceed to step S2;

[0069] If not, proceed to step S322;

[0070] In step S322, the switch determines whether the scheduling value corresponding to the packet queue at the head of the to-be-transmitted queue is greater than the scheduling value corresponding to the packet queue at the tail of the to-be-transmitted queue:

[0071] If yes, adjusting the packet queue at the head to before the packet queue at the tail, and then proceeding to step S2;

[0072] If no, adjusting the packet queue at the head to after the packet queue at the tail, and then proceeding to step S2.

[0073] Specifically, in this embodiment, the specific scheduling process of the present invention is: after the packet queue at the head of the queue transmits packets, the scheduling values of the head T(head), the second T(next) and the tail T(tail) are calculated respectively; the relationship between T(head) and T(next) is first determined: when T(head)>T(next), the packet queue at the head remains at the head position without adjustment; when T(head)<T(next) and T(head)>T(tail), the packet queue at the head is moved to before the packet queue at the tail; when T(head)<T(next) and T(head)<T(tail), the packet queue at the head is moved to after the packet queue at the tail.

[0074] If the number of packet queues is n, and weight(Qn)=2^n, then the maximum transmission length is as follows

[0075]

[0076] It is easy to see that the scheduling algorithm of the present invention significantly improves the scheduling effect. When the number of queues is around 4, the scheduling effect of the present invention is very close to that of the WFQ algorithm. Even when the number of queues is larger, the present invention still has better scheduling effect than the DWRR algorithm, and the larger the number of queues is, the more obvious the effect difference is.

[0077] In general:

[0078] Scheduling effect: WFQ algorithm > scheduling algorithm of the present invention > DWRR algorithm

[0079] Hardware requirement of the algorithm: WFQ algorithm > scheduling algorithm of the present invention > DWRR algorithm

[0080] When the number of queues is small:

[0081] Scheduling effect: WFQ algorithm ≈ scheduling algorithm of the present invention > DWRR algorithm

[0082] Hardware overhead of the algorithm: WFQ algorithm > scheduling algorithm of the present invention > DWRR algorithm

[0083] It can be seen that the scheduling algorithm of the present invention has the advantages of both low hardware requirements and good scheduling effect.

[0084] The present invention also provides a switch that applies the above-described data scheduling method, such as... Figure 4 As shown, the switch includes:

[0085] Cache module 1 is used to cache several message queues to be forwarded. Each message queue contains multiple message packets, and each message queue is associated with a corresponding queue weight and the number of message packets.

[0086] Initial module 2, connected to cache module 1, is used to form a queue of packets to be sent based on the queue weight associated with each message queue;

[0087] Packet sending module 3, connected to initialization module 2, is used to control the packet queue at the head of the packet queue to send a packet and decrement the associated packet count when it is determined that the packet queue contains at least one packet queue. At the same time, it removes the packet queue with a packet count not greater than zero from the packet queue to be sent. Subsequently, it generates an adjustment signal when it is determined that there are at least two packet queues in the packet queue to be sent.

[0088] Adjustment module 4, connected to packet sending module 3, is used to calculate the corresponding scheduling value for each message queue in the packet sending queue based on the number of associated messages and the queue weight, according to the adjustment signal; and then adjust the position of each message queue in the packet sending queue according to each scheduling value.

[0089] In a preferred embodiment of the present invention, the formula for calculating the scheduling value is as follows:

[0090] T = credit / weight

[0091] Where T is the scheduling value, credit is the number of packets, and weight is the queue weight.

[0092] In a preferred embodiment of the present invention, the adjustment module 4 includes:

[0093] The calculation unit 41 is used to calculate the corresponding scheduling value for each message queue in the packet queue to be sent, based on the number of associated messages and the queue weight.

[0094] The adjustment unit 42 is connected to the calculation unit 41 and is used to adjust the position of each message queue in the packet queue according to the scheduling values ​​corresponding to the message queue at the head of the queue, the message queue at the second position, and the message queue at the tail of the queue.

[0095] In a preferred embodiment of the present invention, the adjustment unit 42 includes:

[0096] The first adjustment unit 421 is used to generate a judgment signal when it is determined that the scheduling value corresponding to the message queue at the head of the queue is not greater than the scheduling value corresponding to the message queue at the second position in the packet queue to be sent:

[0097] The second adjustment unit 422 is connected to the first adjustment unit 421 and is used to adjust the message queue at the head of the queue to the front of the message queue at the tail of the queue when the scheduling value corresponding to the message queue at the head of the queue is greater than the scheduling value corresponding to the message queue at the tail of the queue according to the judgment signal.

[0098] The third adjustment unit 423, connected to the first adjustment unit 421, is used to adjust the message queue at the head of the queue to the tail of the queue when the scheduling value corresponding to the message queue at the head of the queue is greater than the scheduling value corresponding to the message queue at the tail of the queue, based on the judgment signal.

[0099] The above are merely preferred embodiments of the present invention and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should recognize that any equivalent substitutions and obvious changes made using the content of this specification and illustrations should be included within the protection scope of the present invention.

Claims

1. A data scheduling method for a switch, characterized in that, The switch has several queues of packets to be forwarded cached within it. Each queue contains multiple packets, and each queue is associated with a corresponding queue weight and a number of packets. The scheduling method includes: Step S1: The switch forms a packet queue to be sent according to the queue weight associated with each packet queue. Step S2: The switch controls the packet queue at the head of the packet queue to send a packet and decrements the associated packet count by one. Simultaneously, it removes the packet queues with a packet count not greater than zero from the packet queue to be sent. Then, it determines whether there are at least two packet queues in the packet queue to be sent. If so, proceed to step S3; If not, proceed to step S4; Step S3: For each packet queue in the packet queue to be sent, the switch calculates the corresponding scheduling value based on the associated number of packets and the queue weight, then adjusts the position of each packet queue in the packet queue to be sent according to each scheduling value, and then returns to step S2. Step S3 includes: Step S31: For each packet queue in the packet queue to be sent, the switch calculates the corresponding scheduling value based on the associated number of packets and the queue weight. Step S32: The switch adjusts the position of each packet queue in the packet queue according to the scheduling value corresponding to the packet queue at the head of the queue, the packet queue at the second position, and the packet queue at the tail of the queue, and then returns to step S2. Step S4, the switch determines whether the packet queue contains at least one of the packet queues: If so, return to step S2; If not, then exit.

2. The data scheduling method according to claim 1, characterized in that, The formula for calculating the scheduling value is: ; Where T is the scheduling value, credit is the number of packets, and weight is the queue weight.

3. The data scheduling method according to claim 1, characterized in that, Step S32 includes: Step S321, the switch determines whether the scheduling value corresponding to the packet queue at the head of the packet queue is greater than the scheduling value corresponding to the packet queue at the second position: If so, proceed to step S2; If not, proceed to step S322; Step S322, the switch determines whether the scheduling value corresponding to the packet queue at the head of the packet queue is greater than the scheduling value corresponding to the packet queue at the tail of the packet queue: If so, the message queue at the head of the queue is moved to the front of the message queue at the tail of the queue, and then proceeds to step S2; If not, the message queue at the head of the queue is moved to the end of the queue, and then the process proceeds to step S2.

4. A switch, characterized in that, The data scheduling method described in any one of claims 1-3, wherein the switch comprises: The caching module is used to cache several message queues to be forwarded. Each message queue contains multiple message packets, and each message queue is associated with a corresponding queue weight and the number of message packets. The initial module, connected to the cache module, is used to form a queue of packets to be sent based on the queue weights associated with each of the message queues; The packet sending module, connected to the initial module, is used to control the packet queue at the head of the queue to be sent to send a packet and decrement the associated packet count when it is determined that the packet queue contains at least one of the packet queues. Simultaneously, it removes the packet queues with a packet count not greater than zero from the queue to be sent. Then, it generates an adjustment signal when it is determined that at least two of the packet queues exist in the queue to be sent. An adjustment module, connected to the packet sending module, is used to calculate a corresponding scheduling value for each message queue in the packet sending queue based on the adjustment signal, according to the associated number of messages and the queue weight; and then adjust the position of each message queue in the packet sending queue according to each scheduling value. The adjustment module includes: The calculation unit is used to calculate the corresponding scheduling value for each message queue in the packet queue to be sent, based on the associated number of messages and the queue weight. An adjustment unit, connected to the calculation unit, is used to adjust the position of each message queue in the packet queue to be sent according to the scheduling value corresponding to the message queue at the head of the queue, the message queue at the second position, and the message queue at the tail of the queue.

5. The switch according to claim 4, characterized in that, The formula for calculating the scheduling value is: ; Where T is the scheduling value, credit is the number of packets, and weight is the queue weight.

6. The switch according to claim 4, characterized in that, The adjustment unit includes: The first adjustment unit is used to generate a judgment signal when it is determined that the scheduling value corresponding to the packet queue at the head of the packet queue is not greater than the scheduling value corresponding to the packet queue at the second position. The second adjustment unit, connected to the first adjustment unit, is used to adjust the message queue at the head of the queue to the front of the message queue at the tail of the queue when the scheduling value corresponding to the message queue at the head of the queue is greater than the scheduling value corresponding to the message queue at the tail of the queue, based on the judgment signal. The third adjustment unit, connected to the first adjustment unit, is used to adjust the message queue at the head of the queue to the tail of the queue when the scheduling value corresponding to the message queue at the head of the queue is not greater than the scheduling value corresponding to the message queue at the tail of the queue, based on the judgment signal.

Citation Information

Patent Citations

  • Task scheduling method and apparatus

    CN107423120A