A method and system for flushing forwarding queue of switching chip

By detecting congestion queues through the switching chip and employing various flushing strategies to flush some of the packets, the problem of queue congestion in switching equipment is solved, achieving efficient utilization of cache resources and reliable data forwarding.

CN114221916BActive Publication Date: 2024-11-08SUZHOU MOTORCOMM ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111556640.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2024-11-08
Estimated Expiration
2041-12-17

AI Technical Summary

Technical Problem

Congestion in the packet buffer queue of switching equipment leads to waste of buffer resources and network packet loss. Existing technologies are unable to quickly process and release buffer resources.

Method used

The switching chip detects congested message queues and uses one or more strategies based on message attributes, software configuration, and overall flushing strategies to partially flush and release messages from the congested queues, forming multiple message queues to optimize scheduling.

Benefits of technology

It effectively solved the queue congestion problem, reduced the loss of newly arriving packets, optimized the utilization of cache resources, and ensured the real-time performance and reliability of data forwarding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114221916B_ABST
    Figure CN114221916B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for flushing a forwarding queue of a switching chip, which relates to the technical field of message forwarding control, and includes: step S1, the switching chip receives and caches messages to be forwarded; step S2, the switching chip sorts the cached messages to be forwarded to form multiple message queues; step S3, the switching chip detects whether there is a congested message queue: if not, return to step S1; if so, the switching chip partially flushes the congested message queue and releases the corresponding cache. The beneficial effect is that when the queue is congested, the number of messages in the queue is reduced through the message flushing strategy, which effectively solves the queue congestion problem, and different flushing strategies can be configured according to different application scenarios to meet different application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of message forwarding control, and in particular to a forwarding queue flushing method and system for a switching chip. Background Art

[0002] As a network interconnection device, the switching device needs to support quality of service functions in order to quickly respond to data with high real-time and importance requirements while completing data forwarding. The messages received by the switching device can be forwarded to different message cache queues. The CPU forwards messages with high and low priorities through the speed limit and scheduling algorithm of the Quality of Service (QoS) queue, thereby reducing the CPU load, effectively utilizing bandwidth, and avoiding events such as protocol message loss and protocol oscillation caused by congestion of the message cache queue corresponding to the protocol message.

[0003] Message cache queue congestion refers to the excessive number of messages arriving at a message cache queue, which makes it impossible for the message cache queue to be scheduled in time. Once the message cache queue is congested and cannot be released for a long time, it will occupy the switch cache, that is, the switch cache resources cannot be released. And when multiple message cache queues are congested, the switch cache resources are greatly wasted. Since the switch cache resources are limited, it is very easy to cause network packet loss due to insufficient cache resources. Therefore, how to quickly handle and release cache resources when message cache queue congestion occurs has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] In view of the problems existing in the prior art, the present invention provides a forwarding queue flushing method for a switching chip, comprising:

[0005] Step S1, the switching chip receives and caches the message to be forwarded;

[0006] Step S2, the switching chip sorts the cached messages to be forwarded into multiple message queues;

[0007] Step S3, the switching chip detects whether there is a congested message queue:

[0008] If not, return to step S1;

[0009] If so, the switching chip partially flushes the message queue that is congested and releases the corresponding buffer.

[0010] Preferably, step S3 comprises:

[0011] Step S31, the switching chip counts the number of the to-be-forwarded messages in each of the message queues respectively;

[0012] Step S32, the switching chip determines whether there is a corresponding message queue whose number of messages reaches a threshold:

[0013] If not, it indicates that there is no congested message queue, and the process returns to step S1;

[0014] If so, it indicates that the corresponding message queue is congested, and then the switching chip flushes part of the messages in the congested message queue and releases the corresponding buffer.

[0015] Preferably, the switching chip adopts a pre-configured flushing strategy to partially flush messages from the congested message queue, and the flushing strategy is one or more of a flushing strategy based on message attributes, a flushing strategy based on software configuration, and an overall flushing strategy.

[0016] Preferably, the flushing strategy based on message attributes includes:

[0017] Acquire the attribute of each of the to-be-forwarded messages in the message queue with congestion, and flush the to-be-forwarded messages when the attribute meets a preset attribute;

[0018] or

[0019] The attributes of each of the to-be-forwarded messages in the message queue with congestion are obtained, and when the attributes do not meet preset attributes, the to-be-forwarded messages are flushed.

[0020] Preferably, the flushing strategy based on software configuration is to pre-configure corresponding flushing conditions, and when the to-be-forwarded messages in the congested message queue meet the flushing conditions, the to-be-forwarded messages are flushed.

[0021] Preferably, the overall flushing strategy is to flush all the to-be-forwarded messages in the congested message queue.

[0022] Preferably, when there are multiple flushing strategies including the overall flushing strategy, each flushing strategy is pre-configured with a corresponding execution priority, and the execution priority of the overall flushing strategy is the lowest.

[0023] The present invention also provides a forwarding queue flushing system for a switching chip, which is applied to the forwarding queue flushing method described above. The forwarding queue flushing system comprises:

[0024] A cache management module, used for receiving and caching messages to be forwarded;

[0025] A queue management module, the queue management module is connected to the cache management module, and includes:

[0026] A sorting unit, used for sorting the cached messages to be forwarded to form a plurality of message queues;

[0027] A flushing unit, connected to the sorting unit, configured to flush part of the messages in the message queue when a congested message queue is detected, and output a cache release signal;

[0028] The cache management module performs corresponding cache release according to the cache release signal.

[0029] Preferably, the flushing unit comprises:

[0030] A statistical subunit, used to count the number of the to-be-forwarded messages in each of the message queues;

[0031] A judgment subunit, connected to the statistical subunit, configured to output a flushing signal indicating that congestion exists in the corresponding message queue when judging that there is a message queue in which the number of messages reaches a threshold;

[0032] The flushing subunit is connected to the judging subunit and is used to partially flush the message queue that is congested according to the flushing signal and output the cache release signal.

[0033] Preferably, a pre-configured flushing strategy is used to partially flush messages from the message queue that is congested, and the flushing strategy is one or more of a flushing strategy based on message attributes, a flushing strategy based on software configuration, and an overall flushing of the queue.

[0034] The above technical solution has the following advantages or beneficial effects: when congestion occurs in the message queue, the number of messages in the queue is reduced through the corresponding flushing strategy to ensure that the newly arrived messages can enter the corresponding message queue, effectively solving the queue congestion problem, and different flushing strategies can be configured according to different application scenarios to minimize the loss of required messages. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic flow chart of a method for flushing a forwarding queue of a switching chip in a preferred embodiment of the present invention;

[0036] Figure 2 A schematic diagram of a flow chart of a switch chip detecting whether there is a congested message queue in a preferred embodiment of the present invention;

[0037] Figure 3 A schematic diagram of a message queue before and after flushing using a flushing strategy based on message attributes in a preferred embodiment of the present invention;

[0038] Figure 4This is a schematic diagram of a message queue before and after flushing using an overall flushing strategy in a preferred embodiment of the present invention;

[0039] Figure 5 The figure is a structural diagram of a forwarding queue flushing system of a switching chip in a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0040] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The present invention is not limited to this embodiment, and other embodiments may also fall within the scope of the present invention as long as they conform to the gist of the present invention.

[0041] In a preferred embodiment of the present invention, based on the above problems existing in the prior art, a method for flushing a forwarding queue of a switching chip is provided. Figure 1 As shown, including:

[0042] Step S1, the switching chip receives and caches the message to be forwarded;

[0043] Step S2, the switching chip sorts the cached messages to be forwarded into multiple message queues;

[0044] Step S3: The switching chip detects whether there is a congested message queue:

[0045] If not, return to step S1;

[0046] If so, the switching chip flushes part of the messages in the congested message queue and releases the corresponding buffer.

[0047] Specifically, in this embodiment, in step S2, the switching chip sorts each message to be forwarded according to specific requirements to form multiple message queues, and the specific requirements include but are not limited to scheduling priorities. The specific sorting method is a prior art and will not be repeated here. By sorting the messages to be forwarded to form multiple message queues, a corresponding scheduling algorithm is subsequently used to determine which queue to schedule, thereby realizing the forwarding of each message to be forwarded in the message queue.

[0048] For each message queue, the corresponding scheduling order is different according to the different scheduling algorithms. For example, scheduling according to the priority of the message queue, if the scheduling priority of message queue A is higher than that of message queue B, when the messages to be forwarded in message queue A are not scheduled, message queue B is in a continuous waiting state. If new messages continue to arrive in message queue B at this time, message queue B may be congested. In order to ensure that the newly arrived messages can enter the corresponding queue, in this technical solution, some messages are flushed for the message queue with congestion, and the corresponding cache is released.

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

[0050] Step S31, the switching chip counts the number of messages to be forwarded in each message queue;

[0051] Step S32: The switching chip determines whether there is a message queue whose number of corresponding messages reaches a threshold.

[0052] If not, it means that there is no congested message queue, and the process returns to step S1;

[0053] If so, it indicates that the corresponding message queue is congested. Then the switching chip flushes part of the messages in the congested message queue and releases the corresponding buffer.

[0054] Specifically, whether the message queue is congested is determined by a pre-configured threshold value, and the threshold value can be configured according to demand, and different threshold values ​​can be configured for different message queues. In this embodiment, when the number of messages in a message queue reaches a threshold value, we consider that it is congested, and need to flush the message queue to ensure that newly arrived messages can enter the message queue, and avoid the loss of newly arrived messages.

[0055] In a preferred embodiment of the present invention, the switching chip uses a pre-configured flushing strategy to partially flush messages in a congested message queue, and the flushing strategy is one or more of a flushing strategy based on message attributes, a flushing strategy based on software configuration, and an overall flushing strategy.

[0056] In a preferred embodiment of the present invention, the flushing strategy based on message attributes includes:

[0057] Acquire the attributes of each message to be forwarded in the congested message queue, and flush the message to be forwarded when the attribute meets the preset attribute;

[0058] or

[0059] The attributes of each message to be forwarded in the congested message queue are obtained, and when the attributes do not meet the preset attributes, the message to be forwarded is flushed.

[0060] Specifically, in this embodiment, a flushing strategy based on message attributes can be implemented through a hardware state machine control. Further, the flushing strategy based on message attributes includes two solutions:

[0061] One solution is to flush the messages that meet the preset attributes. Since the messages are stored in the memory in a linked list, it is necessary to screen from the head to the tail of the message. If a message that meets the preset attributes is found, it will be flushed, and the memory occupied by the message will be released, and the previous message of the deleted message will be linked to the next message to be deleted. Figure 3 As shown in the figure, the congested message queue 1 contains message 0, message 1, message 2 and message 3. If the attribute of message 1 meets the preset attribute, message 1 is flushed, and then the previous message of message 1, i.e., message 0, is linked to the next message of message 1, i.e., message 2. At this time, message queue 1 contains message 0, message 2 and message 3. The preset attributes can be flexibly configured according to the requirements, thereby realizing the flexibility of message flushing.

[0062] Another solution is to flush the messages whose attributes do not meet the preset attributes. Similarly, since the messages are stored in the memory in a linked list, it is necessary to screen from the head to the tail of the message. If a message that does not meet the preset attributes is found, the message will be flushed, the memory occupied by the message will be released, and the previous message of the deleted message will be linked to the next message to be deleted. Figure 3 As shown, the congested message queue 1 includes message 0, message 1, message 2, and message 3. If the attribute of message 1 does not meet the preset attribute, message 1 is flushed, and then the previous message of message 1, i.e., message 0, is linked to the next message of message 1, i.e., message 2. At this time, message queue 1 includes message 0, message 2, and message 3. The preset attributes can be flexibly configured according to the requirements, thereby realizing the flexibility of message flushing.

[0063] In a preferred embodiment of the present invention, the flushing strategy based on software configuration is to pre-configure the corresponding flushing conditions. When the to-be-forwarded messages in the congested message queue meet the flushing conditions, the to-be-forwarded messages are flushed. The flushing conditions include but are not limited to specifying to flush a message with a certain number. The flushing strategy based on software configuration has the advantages of flexible configuration, no need for searching, and fast flushing speed.

[0064] In a preferred embodiment of the present invention, the overall flushing strategy is to flush all the to-be-forwarded messages in the congested message queue. Figure 4 As shown, the congested message queue 1 includes message 0, message 1, message 2 and message 3. If the overall flushing strategy is adopted, the flushed message queue 1 is an empty queue. The overall flushing strategy has the advantages of simple implementation and fast flushing speed.

[0065] In a preferred embodiment of the present invention, when there are multiple flushing strategies including an overall flushing strategy, each flushing strategy is pre-configured with a corresponding execution priority, and the overall flushing strategy has the lowest execution priority.

[0066] In a preferred embodiment of the present invention, the above-mentioned flushing strategies can be configured accordingly according to the application scenario, and can also be used in combination according to needs.

[0067] Specifically, in the case where the flushing demand is clearly known, a flushing strategy based on message attributes can be selected to obtain the attributes of each message to be forwarded in the congested message queue, and when the attributes meet the preset attributes, the message to be forwarded will be flushed. For example, because small packets will affect the bandwidth, only the messages that meet the small packet attributes will be flushed.

[0068] For situations where you know for sure that you want to retain messages of certain formats, you can choose a flushing strategy based on message attributes to obtain the attributes of each message to be forwarded in the congested message queue. When the attributes do not meet the preset attributes, flush the messages to be forwarded. For example, you can retain messages of 10 specified formats and flush all other messages.

[0069] For flushing requirements that require dynamic adjustment, you can choose a flushing strategy based on software configuration. For example, after congestion is detected, you can configure the IP address / MAC address to specify the flushing of packets for one or some IP addresses / MAC addresses.

[0070] If congestion still occurs after using the above solutions, you can use the overall flushing strategy to flush everything.

[0071] In other words, if you need to flush messages with small packet attributes and retain messages in 10 specified formats, you can combine the two flushing strategies based on message attributes. In addition, you can pre-configure an overall flushing strategy. If the message queue is still congested after flushing with the above two solutions, execute the overall flushing strategy. Other strategy combinations are similar.

[0072] By configuring the overall flushing strategy to the lowest priority, the loss of demand messages can be minimized.

[0073] The present invention also provides a forwarding queue flushing system for a switching chip, which is applied to the forwarding queue flushing method mentioned above. Figure 5 As shown, the forwarding queue flushing system includes:

[0074] Cache management module 1, used for receiving and caching messages to be forwarded;

[0075] The queue management module 2 is connected to the cache management module 1 and includes:

[0076] A sorting unit 21, used for sorting the cached messages to be forwarded into multiple message queues;

[0077] The flushing unit 22 is connected to the sorting unit 21 and is used to flush part of the congested message queue when a congested message queue is detected, and output a cache release signal;

[0078] The cache management module 1 performs corresponding cache release according to the cache release signal.

[0079] In a preferred embodiment of the present invention, the flushing unit 22 includes:

[0080] A counting subunit 221, used to count the number of messages to be forwarded in each message queue;

[0081] The judging subunit 222 is connected to the statistical subunit 221 and is used to output a flushing signal indicating that the corresponding message queue is congested when judging that there is a message queue whose corresponding message number reaches a threshold value;

[0082] The flushing subunit 223 is connected to the determining subunit 222 and is used to flush part of the messages in the congested message queue according to the flushing signal and output a buffer release signal.

[0083] In a preferred embodiment of the present invention, a pre-configured flushing strategy is used to partially flush messages from a congested message queue, and the flushing strategy is one or more of a flushing strategy based on message attributes, a flushing strategy based on software configuration, and an overall flushing of the queue.

[0084] The above description is only a preferred embodiment of the present invention, and does not limit the implementation mode and protection scope of the present invention. For those skilled in the art, it should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the contents of this specification and illustrations should be included in the protection scope of the present invention.

Claims

1. A method for flushing a forwarding queue of a switching chip, characterized in that: include: Step S1, the switching chip receives and caches the message to be forwarded; Step S2, the switching chip sorts the cached messages to be forwarded into multiple message queues according to specific requirements; the specific requirements include scheduling priorities; Step S3, the switching chip detects whether there is a congested message queue: If not, return to step S1; If yes, the switching chip flushes part of the message queue that is congested and releases the corresponding buffer; The switching chip adopts a pre-configured flushing strategy to partially flush the message queue with congestion, wherein the flushing strategy is one or more of a flushing strategy based on message attributes, a flushing strategy based on software configuration, and an overall flushing strategy; The attributes in the flushing strategy based on message attributes include message size and / or message format; The flushing strategy based on software configuration is to pre-configure corresponding flushing conditions, and when the to-be-forwarded messages in the congested message queue meet the flushing conditions, the to-be-forwarded messages are flushed.

2. The forwarding queue flushing method according to claim 1, characterized in that: The step S3 comprises: Step S31, the switching chip counts the number of the to-be-forwarded messages in each of the message queues respectively; Step S32, the switching chip determines whether there is a corresponding message queue whose number of messages reaches a threshold: If not, it indicates that there is no congested message queue, and the process returns to step S1; If so, it indicates that the corresponding message queue is congested, and then the switching chip flushes part of the messages in the congested message queue and releases the corresponding buffer.

3. The forwarding queue flushing method according to claim 1, characterized in that: The flushing strategy based on message attributes includes: Acquire the attribute of each of the to-be-forwarded messages in the message queue with congestion, and flush the to-be-forwarded messages when the attribute meets a preset attribute; or The attributes of each of the to-be-forwarded messages in the message queue with congestion are obtained, and when the attributes do not meet preset attributes, the to-be-forwarded messages are flushed.

4. The forwarding queue flushing method according to claim 1, characterized in that: The overall flushing strategy is to flush all the to-be-forwarded messages in the congested message queue.

5. The forwarding queue flushing method according to claim 1, characterized in that: When there are multiple flushing strategies including the overall flushing strategy, each flushing strategy is pre-configured with a corresponding execution priority, and the execution priority of the overall flushing strategy is the lowest.

6. A forwarding queue flushing system for a switching chip, characterized in that: Applied to the forwarding queue flushing method according to any one of claims 1 to 5, the forwarding queue flushing system comprises: A cache management module, used for receiving and caching messages to be forwarded; A queue management module, the queue management module is connected to the cache management module, and includes: A sorting unit, used for sorting the cached messages to be forwarded to form a plurality of message queues; A flushing unit, connected to the sorting unit, configured to flush part of the messages in the message queue when a congested message queue is detected, and output a cache release signal; The cache management module performs corresponding cache release according to the cache release signal.

7. The forwarding queue flushing system according to claim 6, characterized in that: The flushing unit comprises: A statistical subunit, used to count the number of the to-be-forwarded messages in each of the message queues; A judgment subunit, connected to the statistical subunit, configured to output a flushing signal indicating that congestion exists in the corresponding message queue when judging that there is a message queue in which the number of messages reaches a threshold; The flushing subunit is connected to the judging subunit and is used to partially flush the message queue that is congested according to the flushing signal and output the cache release signal.

8. The forwarding queue flushing system according to claim 6 or 7, characterized in that: A pre-configured flushing strategy is used to partially flush the message queue with congestion, and the flushing strategy is one or more of a flushing strategy based on message attributes, a flushing strategy based on software configuration, and an overall flushing of the queue.