Flow control method, system, equipment and medium

By introducing scheduling circuits, DMA and token management circuits into the flow control system, the number of tokens is calculated based on the packet length, the problem of excessive FIFO resource consumption in the existing technology is solved, and more efficient flow control and networking are achieved Performance improvement.

CN118890318AInactive Publication Date: 2024-11-01CORE YUNSHENG (HANGZHOU) ELECTRONIC TECH CO LTD

Patent Information

Application Number
CN202411338259.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2024-11-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In existing networks, FIFO queues are added step by step to prevent packet loss and reduce congestion, resulting in FIFO consumption of more resources and lack of effective traffic control methods.

Method used

The scheduling circuit, DMA and token management circuit are introduced in the flow control system. By calculating the number of tokens to be consumed and the number of currently available tokens based on the packet length, it decides whether to continue scheduling the message descriptor, and reduces the number of tokens by using the token management circuit. FIFO resource consumption.

Benefits of technology

By reducing the consumption of FIFO resources, the efficiency of traffic control and system performance are improved, and data loss and network congestion caused by resource overload are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890318A_ABST
    Figure CN118890318A_ABST
Patent Text Reader

Abstract

The invention provides a flow control method, system and device and a medium, and the method comprises the steps: transmitting each message descriptor to a DMA (Direct Memory Access) according to a preset scheduling rule when a scheduling circuit receives a plurality of message descriptors; the DMA obtains the packet length of the message corresponding to each message description according to each message descriptor, and inputs the packet length of each message to a token management circuit; the token management circuit determines the number of tokens to be consumed required by a channel corresponding to each message according to each packet length, and obtains the number of currently available tokens of each channel; and the token management circuit determines whether to notify the scheduling circuit to continue to schedule the next message descriptor of each channel according to a judgment result of whether the number of currently available tokens is greater than or equal to the number of tokens to be consumed. The token management circuit is additionally arranged at the QOS position, and the token corresponds to the remote cache limit storage space according to the control logic of the token management circuit, so that resources consumed by step-by-step FIFO (First In First Out) are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a flow control method, system, device and medium. Background Art

[0002] Flow control is used to manage and optimize the transmission of data packets in the network. Its main purpose is to prevent network congestion, ensure the reliability and order of data transmission, and provide QOS (Quality of Service) guarantee.

[0003] Currently, in network processor chips, data packets go through a series of handling processes after completing message processing. This includes transferring from the cache of the message processor to the cache of the corresponding channel. In order to prevent packet loss caused by egress congestion, data flow is usually managed by gradually adding FIFO (First-In-First-Out) queues. Each FIFO queue has a threshold that is about to be full. When the data column in the FIFO reaches or exceeds this threshold, a full signal is generated. When the FIFO's full signal is activated, a flow control signal can be sent to the data sender, asking it to suspend sending data until there is enough space in the FIFO to receive new data.

[0004] However, since increasing the FIFO queue level by level to prevent packet loss and reduce congestion will cause the FIFO to consume more resources, an effective flow control method is urgently needed to solve the above problems. Summary of the invention

[0005] In view of the above problems, the present invention is proposed to provide a flow control method, system, device and medium that overcome the above problems or at least partially solve the above problems.

[0006] To achieve the above-mentioned purpose and other related purposes, the present invention provides a flow control method, which is applied to a flow control system. The flow control system includes a scheduling circuit, a DMA and a token management circuit. The method includes: When the scheduling circuit receives multiple message descriptors with destinations being different channels, it sends each message descriptor to the DMA according to a preset scheduling rule; The DMA obtains the packet length of the message corresponding to each message description according to each message descriptor, and inputs the packet length of each message into the token management circuit; The token management circuit determines the number of tokens to be consumed required by the channel corresponding to each message according to each packet length, and obtains the number of currently available tokens in the token management circuit; The token management circuit determines whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

[0007] Optionally, the token management circuit includes a channel token counter, and obtaining the current number of available tokens of each channel includes: If the message descriptor is scheduled for the first time, obtaining the first available token amount configured for each channel in the channel token counter, and determining the first available token amount as the current available token number; If it is not the first time to determine the scheduling message descriptor, the first available token amount configured for each channel is obtained from the channel token counter, and the token count value of each channel is obtained from the channel token counter; based on the first available token amount and the token count value, the current number of available tokens is determined; wherein the token count value is the number of tokens consumed when transmitting the message corresponding to the last message descriptor.

[0008] Optionally, the token management circuit includes a channel token counter and a shared pool token counter, and the token management circuit determines whether to notify the scheduling circuit to continue scheduling the next message descriptor according to a judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed, including: When there is a channel token counter whose current available token number is less than the number of tokens to be consumed, the difference between the number of tokens to be consumed and the current available token number is taken as the excess token number; The second available token amount configured in the shared pool token counter is obtained, and when the second available token amount is greater than or equal to the excess token number, the excess token number is subtracted from the second available token amount so that the scheduling circuit continues to schedule the next message descriptor of the output channel.

[0009] Optionally, when there is a channel token counter whose current available token number is less than the number of tokens to be consumed, after the step of taking the difference between the number of tokens to be consumed and the current available token number as the number of tokens exceeded, the method further comprises: The token management circuit outputs the overlimit flag of the corresponding channel to the scheduling circuit to instruct the scheduling circuit to no longer schedule the output of the next message descriptor of the channel.

[0010] Optionally, when the second available token amount is greater than or equal to the excess token amount, after the step of subtracting the excess token amount from the second available token amount, the method further includes: Determine the difference between the second available token number and the excess token number as the remaining token number in the shared pool token counter; When the storage space corresponding to the remaining number of tokens is less than the preset packet length, the token management circuit outputs a flow control signal to the scheduling circuit to instruct the scheduling circuit to no longer schedule the output of the next message descriptor of all channels.

[0011] Optionally, after the step of sending each message descriptor to the DMA according to a preset scheduling rule when the scheduling circuit receives multiple message descriptors with destinations being different channels, the step further includes: The DMA determines the number of tokens to be consumed required by the channel corresponding to each message according to each message descriptor, and sends the number of consumed tokens of each channel to the token management circuit; The token management circuit obtains the current number of available tokens of each channel, and determines whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

[0012] Optionally, the token management circuit includes a channel token counter and a shared pool token counter, and the determination of whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed includes: When the number of currently available tokens in a channel token counter is less than the number of tokens to be consumed, the difference between the number of tokens to be consumed and the currently available tokens is taken as the number of excess tokens; The second available token amount configured in the shared pool token counter is obtained, and when the second available token amount is greater than or equal to the excess token number, the excess token number is subtracted from the second available token amount so that the scheduling circuit continues to schedule the next message descriptor of the output channel.

[0013] In a second aspect, the present invention further provides a flow control system, the system comprising a scheduling circuit, a DMA and a token management circuit, wherein: A scheduling circuit, for sending each message descriptor to the DMA according to a preset scheduling rule when receiving multiple message descriptors with destinations being different channels; DMA, used for obtaining the packet length of the message corresponding to each message descriptor according to each message descriptor, and inputting the packet length of each message into the token management circuit; The token management circuit is used to determine the number of tokens to be consumed by the channel corresponding to each message according to each packet length, and to obtain the current number of available tokens for each channel; The token management circuit is further used to determine whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

[0014] In a third aspect, the present invention provides an electronic device, comprising: a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program stored in the memory, so that the electronic device performs the steps of the flow control method as described above.

[0015] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by an electronic device, implements the steps of the flow control method as described above.

[0016] The above one or more technical solutions provided by the present invention may have the following advantages or at least achieve the following technical effects: As described above, the flow control method, system, device and medium of the present invention increase a token management circuit at the QOS position, and according to the control logic of the token management circuit, correspond the token with the remote cache quota storage space, thereby reducing the resources consumed by the FIFO level by level. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 Shown is a flow chart of a flow control method in one embodiment of the present invention;

[0018] Figure 2 Shown is a schematic diagram of the transmission process of a message corresponding to a multi-channel message descriptor in one embodiment of the present invention;

[0019] Figure 3 It is a schematic flow chart showing a token management circuit with fixed byte length feedback in another embodiment of the present invention;

[0020] Figure 4 Shown is a flow chart of a flow control method in one embodiment of the present invention;

[0021] Figure 5 Shown is a flow chart of a token management circuit for whole packet feedback in one embodiment of the present invention;

[0022] Figure 6 Shown is a schematic diagram of the functional modules of a flow control system in one embodiment of the present invention;

[0023] Figure 7 Shown is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0025] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0026] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0027] The terms "first", "second", etc. in the specification and claims of the disclosed embodiments and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the disclosed embodiments described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0028] Unless otherwise stated, the term "plurality" means two or more.

[0029] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.

[0030] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.

[0031] For ease of understanding, the following first explains the relevant nouns or terms used in the embodiments of the present invention: <1> , traffic control system, which may include components such as scheduling circuits, DMA and token management circuits, which work together to achieve efficient transmission and processing of network traffic.

[0032] <2> , Scheduling circuit, used to schedule the transmission of message descriptors, can ensure that messages can be transmitted efficiently and orderly in the system, while maximizing resource utilization and minimizing transmission delay. It can determine the order of message processing and forwarding based on message priority, destination and other criteria.

[0033] When the scheduling circuit is processing message descriptors for multiple purposes, it will decide whether to schedule a new message descriptor based on the flow control signal output by the token management circuit and the number of available tokens in each channel.

[0034] <3> DMA (Direct Memory Access) refers to a computer data transmission method that allows hardware to directly write to or read data from memory without the intervention of the CPU. DMA is responsible for message handling according to the message descriptor.

[0035] <4> , token management circuit, which is responsible for generating, allocating and recycling tokens to control the transmission rate of messages. Each token represents a certain number of data transmission rights. When a message arrives, if there are enough tokens, the message can be sent and the corresponding tokens are consumed. It can include byte counters, channel token counters and shared pool token counters.

[0036] <5> , byte counter, which can convert the message into a certain number of tokens according to the packet length for token management.

[0037] A token is defined as a certain byte length. When the amount of message data transmitted on the channel reaches the certain byte length, a token is considered to be consumed.

[0038] The message is calculated as a whole packet, and the number of tokens consumed by the message increases by one every time a specific byte length is reached; when the remaining packet length does not meet a specific byte length, an additional token is still consumed.

[0039] <6> , channel token counter, which can count the number of tokens consumed by the message according to the packet length of the message sent to each channel.

[0040] Among them, the corresponding available token quota can be configured for each channel according to the business needs of each channel (such as data traffic, priority, QOS, etc.).

[0041] <7> , shared pool token counter, which counts the number of tokens consumed based on the usage of shared pool tokens.

[0042] Among them, the corresponding available token quota can be configured for the shared pool according to the shared pool storage space.

[0043] <8> , flow control signal refers to the signal used to control the data transmission rate in network communication to avoid data loss and network congestion.

[0044] In flow control, flow control signals are usually closely related to scheduling circuits. By working together, flow control signals and scheduling circuits can prevent congestion and data loss and improve the overall performance and efficiency of the flow control system.

[0045] The technical solutions in the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0046] See also Figure 1 An embodiment of the present invention provides a flow control method, which is applied to a flow control system. The flow control system includes a scheduling circuit, a DMA and a token management circuit. The method may include the following steps S10 to S40: Step S10: When the scheduling circuit receives multiple message descriptors with destinations being different channels, each message descriptor is sent to the DMA according to a preset scheduling rule.

[0047] The message descriptor is a data structure used to describe the message, which may include the message size, message quantity, data type and purpose, etc. It can ensure the correct parsing, processing and transmission of the message.

[0048] Each message descriptor may correspond to a specific channel or destination. The destination can be used to guide the routing of the message in the network.

[0049] The message corresponding to the message descriptor indicates an actual data packet, which is transmitted according to the information in the message descriptor.

[0050] In network communications, a message is a unit of data transmitted from a source to a destination. It can be a simple signal, a data packet, or a more complex data structure. A message is the actual data sent according to a message descriptor.

[0051] Preset scheduling rules can be used to optimize the transmission order of messages for pre-set scheduling algorithms (such as priority queues, polling, etc.). In some cases, priority queues and polling can be used in combination to improve the performance and responsiveness of the system.

[0052] In Priority Queuing (PQ), packets are placed in different queues according to their priorities. Queues with higher priorities are always processed before queues with lower priorities. It is usually applicable to scenarios that require differentiated quality of service (QOS), such as real-time voice or video communications.

[0053] Round-Robin (RR) is a fair scheduling algorithm that takes packets from each queue in order for processing. It ensures that all queues receive fair service and is suitable for scenarios where all traffic needs to be treated equally.

[0054] In a specific implementation, the traffic control system includes a scheduling circuit, a DMA and a token management circuit; when the scheduling circuit receives multiple message descriptors with destinations being different channels, it can determine the processing order of messages in each channel according to the channels corresponding to each message descriptor using preset scheduling rules (such as priority queues, polling, etc.); and then, it can send each message descriptor to the DMA in turn according to the processing order of the message, to ensure that the message is processed and sent in the correct processing order.

[0055] In step S20, the DMA obtains the packet length of the message corresponding to each message description according to each message descriptor, and inputs the packet length of each message into the token management circuit.

[0056] Among them, DMA can obtain the packet length of the message from the message descriptor, and obtain the storage location of the message in the message processor cache; then, according to the packet length and storage location, the message can be moved from the message processor cache to the egress message cache for sending to the destination.

[0057] Packet length refers to the length of the message, that is, the total number of bytes in the message.

[0058] In a specific implementation, after receiving each message descriptor output by the scheduling circuit, the DMA can obtain the packet length of the corresponding message from each message descriptor; and then transmit the packet length of each message to the token management circuit.

[0059] Step S30: the token management circuit determines the number of tokens to be consumed required by the channel corresponding to each message according to each packet length, and obtains the number of currently available tokens for each channel.

[0060] The number of tokens to be consumed may be the number of tokens required to be consumed by each message calculated according to the packet length of each message.

[0061] The current number of available tokens may be the number of remaining tokens of each channel in the current token management circuit when scheduling the current message descriptor.

[0062] If the scheduling circuit schedules the message descriptor for the first time, the current number of available tokens is the preset available token quota of each channel.

[0063] If it is not the first time for the scheduling circuit to schedule a message descriptor, the difference between the available token amount of each channel and the number of tokens consumed when the message corresponding to the last message descriptor is scheduled can be determined as the current number of available tokens.

[0064] In a specific implementation, the token management circuit also includes a byte counter and a channel counter; when the DMA sends the packet length of each message to the byte counter, the byte counter can convert it into a certain number of tokens (that is, the number of tokens to be consumed) according to the packet length of the message. In addition, the current number of available tokens of each channel can also be obtained from the token management circuit. In addition, the channel token counter can accumulate the number of tokens consumed by the corresponding channel according to the number of tokens to be consumed of the message.

[0065] Step S40: The token management circuit determines whether to notify the scheduling circuit to continue scheduling the next message descriptor according to a judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

[0066] In a specific implementation, the token management circuit can determine whether the current number of available tokens in each channel is greater than or equal to the number of tokens to be consumed. Among them, when the current number of available tokens is greater than or equal to the number of tokens to be consumed, it means that the storage space of the corresponding channel has not been completely consumed by the message, and it is determined that the scheduling circuit can continue to schedule new message descriptors to the corresponding channel. When it is detected that the current number of available tokens in a channel is less than the number of tokens to be consumed, it means that the storage space of the corresponding channel has been completely consumed by the message, and then the token management circuit outputs a flow control signal to the scheduling circuit, and the flow control signal is used to notify the scheduling circuit to prohibit scheduling new message descriptors to the channel.

[0067] In this embodiment, when the scheduling circuit receives multiple message descriptors with destinations of different channels, each message descriptor is sent to the DMA according to the preset scheduling rules; the DMA obtains the packet length of the target message corresponding to each message descriptor according to each message descriptor, and inputs the packet length of each target message into the token management circuit; the token management circuit determines the number of tokens to be consumed required by the channel corresponding to each target message according to each packet length, and obtains the current number of available tokens of each channel; the token management circuit determines whether to notify the scheduling circuit to continue scheduling the next message descriptor according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed. The present invention reduces the resources consumed by the step-by-step FIFO by adding a token management circuit at the QOS position and realizing the correspondence between the token and the remote cache quota storage space according to the control logic of the token management circuit.

[0068] To more clearly describe the working principle of a flow control method of this embodiment, please refer to Figure 2 , Figure 2 The transmission process of the message corresponding to the multi-channel message descriptor is shown in the figure; the transmission process of the message corresponding to the multi-channel message descriptor is described in detail as follows: First, when the scheduling circuit receives multiple message descriptors with destinations of different channels, it sends each message descriptor to the DMA according to the preset scheduling rules (such as priority queue, polling scheduling, etc.). Among them, the DMA is responsible for carrying messages according to the message descriptors.

[0069] Secondly, DMA obtains the packet length of the corresponding message from each message descriptor and inputs each packet length into the token management circuit. The token management circuit accumulates the number of tokens to be consumed required by the corresponding channel according to the packet length of the message.

[0070] Then, DMA can also obtain the storage location of the corresponding message in the message processor cache according to each message descriptor; and then, according to the channel corresponding to each message descriptor, the message can be moved from the storage location in the message processor cache to different storage spaces of the egress message cache.

[0071] Then, when the output physical interface does not receive flow control, the egress message buffer can output the internally cached message from the corresponding channel through the physical interface. When the message is output from the physical interface, the egress message buffer will feedback the space release signal (that is, a taken signal) to the token management circuit, and the corresponding token management circuit completes token recovery. Among them, a taken signal indicates that the cache space corresponding to 1 token has been released, that is, feedback to the token management circuit to recover 1 token.

[0072] Finally, the token management circuit outputs a flow control signal to the scheduling circuit based on the usage of tokens in each channel and the usage of tokens in the shared pool, which is used to inform the scheduling circuit whether it can continue to schedule new message descriptors to a certain channel, thereby realizing multi-channel flow control. It should be noted that once the token quota of the corresponding channel is restored, the scheduling circuit will continue to schedule new message descriptors based on the new traffic situation and priority queue.

[0073] Based on the above embodiments, a second embodiment of the flow control method of the present invention is proposed. Figure 3 In this embodiment, step S30 may further include the following sub-steps S301-S302: Sub-step S301, if the message descriptor is scheduled for the first time, obtaining the first available token amount configured for each channel in the channel token counter, and determining the first available token amount as the current available token number.

[0074] The first available token amount refers to the number of available tokens pre-configured for each channel in the channel token counter.

[0075] As an example, assume that there are 3 channels configured, and each token is set to a packet length of 1024kb; the storage space of channel 0 is set to a packet length of 3072kb, the storage space of channel 1 is set to a packet length of 1024kb, and the storage space of channel 2 is set to a packet length of 1024kb. Then, the available token quota of channel 0 can be set to 3, the available token quota of channel 1 to 1, and the available token quota of channel 2 to 1.

[0076] It should be noted that the limit value configured for each channel is associated with the storage space allocated to the corresponding channel in the egress message buffer. The larger the storage space allocated to a channel, the larger the token limit configured for the corresponding channel.

[0077] In a specific implementation, the token management circuit also includes a channel counter; when it is detected that the scheduling circuit is scheduling the message descriptor for the first time, the first available token amount configured for each channel can be obtained from the channel counter; and the first available token amount can be determined as the current number of available tokens. By setting the available token amount of each channel, it is possible to prevent the data flow of a single channel from being too large, thereby affecting the performance of other channels.

[0078] Sub-step S302, if it is not the first time to schedule the message descriptor, then obtain the first available token amount configured for each channel from the channel token counter, and obtain the token count value of each channel from the channel token counter; determine the current number of available tokens based on the first available token amount and the token count value; wherein the token count value is the number of tokens consumed when transmitting the message corresponding to the last message descriptor.

[0079] The token count value may be the number of tokens consumed when transmitting the message corresponding to the last message descriptor.

[0080] In a specific implementation, when it is detected that the scheduling circuit is not the first scheduling message descriptor, the first available token amount configured for each channel can be obtained from the channel counter, and the token count value of each channel can be obtained from the channel token counter; then the difference between the first available token amount and the token count value is calculated, and the difference is determined as the current number of available tokens.

[0081] As an example, when the first available amount is greater than or equal to the token count value, the difference between the first available token amount and the token count value is determined as the current available token number of each channel in the token management circuit. The current available token number corresponds to the remaining available storage address in the channel storage space.

[0082] It should be noted that when the first available token amount of a channel is less than the token count value, the channel will output an overlimit flag, which is used to indicate that the storage space of the current channel in the subsequent cache (ie, the egress cache) has been completely exhausted.

[0083] When a channel token counter outputs an over-limit flag, the scheduling circuit will no longer schedule the output of new message descriptors to the channel.

[0084] In this embodiment, when the message descriptor is scheduled for the first time, the current number of available tokens can be determined according to the first available amount of each channel in the channel token counter; or, when the message is not scheduled for the first time, the number of tokens consumed when the message corresponding to the previous message descriptor is transmitted (that is, the token count value) can be obtained, and then the current number of available tokens can be determined according to the first available token amount and the token count value. In this way, the current number of available tokens of each channel in the token management circuit can be accurately determined according to the usage of the tokens of each channel.

[0085] Based on the above embodiments, a third embodiment of the flow control method of the present invention is proposed. Figure 3 In this embodiment, step S40 may include the following sub-steps S401-S402: Sub-step S401, when there is a channel token counter whose current available token number is less than the to-be-consumed token number, the difference between the to-be-consumed token number and the current available token number is taken as the excess token number.

[0086] The excess token number may be a difference between the number of tokens to be consumed and the number of currently available tokens when the number of currently available tokens in a certain channel is less than the number of tokens to be consumed.

[0087] In a specific implementation, the current number of available tokens in each channel is compared with the number of tokens to be consumed, and when it is detected that the current number of tokens in a certain channel is less than the number of tokens to be consumed, the difference between the number of tokens to be consumed and the current number of tokens in the channel is calculated, and the difference is determined as the excess token number.

[0088] Sub-step S402, obtains the second available token quota configured in the shared pool token counter, and when the second available token quota is greater than or equal to the excess token number, subtracts the excess token number from the second available token quota so that the scheduling circuit continues to schedule the next message descriptor of the output channel.

[0089] The second available token quota refers to the number of available tokens pre-configured for the shared pool token counter.

[0090] As an example, assume that the packet length of each token is set to 1024kb, and the packet length of the storage space of the shared pool is set to 5125kb; and then the available token amount of the shared pool token counter can be set to 5.

[0091] It should be noted that the shared pool token limit value configured for the shared pool storage space is associated with the storage space allocated to all channels in the egress message cache. The larger the storage space allocated to all channels, the smaller the corresponding contribution token limit value.

[0092] In a specific implementation, the token management circuit includes a channel token counter and a shared pool token counter; the second available token amount configured in the shared pool token counter is obtained; the second available token amount can be compared with the excess token number, and when the second available token amount is greater than or equal to the excess token number, the excess token number is subtracted from the second available token amount, so that the scheduling circuit continues to schedule and output the next message descriptor of the corresponding channel. Thus, by setting the shared pool token amount, it is helpful to realize the flow shaping and rate limiting of the entire flow control system, and ensure the overall performance and stability of the system.

[0093] It should be noted that when the overlimit flag is on, the corresponding channel token counter will reduce 1 token from the corresponding channel token counter when receiving the taken signal sent by the subsequent cache; and the shared pool token count will be updated synchronously, and the shared pool token counter will reduce 1 token at this time. This means that the space released in the current subsequent cache belongs to the shared space.

[0094] Furthermore, in one embodiment, after sub-step S401, the flow control method may further include the following sub-step S403: In sub-step S403, the token management circuit outputs an overlimit flag of the corresponding channel to the scheduling circuit to instruct the scheduling circuit to no longer schedule the output of the next message descriptor of the channel.

[0095] Among them, the over-limit flag is used to indicate that a certain channel exceeds the preset flow limit, indicating that the storage space of the corresponding channel in the subsequent cache has been completely exhausted.

[0096] In a specific implementation, when it is detected that the current number of available tokens in a channel token counter is less than the number of tokens to be consumed, the token management circuit will output the over-limit flag of the corresponding channel to the scheduling circuit; further, after the over-limit flag of the channel token counter is output, the scheduling circuit will no longer schedule the output of a new message descriptor (that is, the next message descriptor) to the channel. Thus, by limiting the channel token quota of a single channel, it is possible to prevent the data flow of some channels from being too large, thereby affecting the performance of other channels.

[0097] Furthermore, in one embodiment, after sub-step S402, the flow control method may further include the following sub-steps S404 to S405: Sub-step S404: determining the difference between the second available token number and the excess token number as the remaining token number in the shared pool token counter.

[0098] Sub-step S405, when the storage space corresponding to the remaining number of tokens is less than the preset packet length, the token management circuit outputs a flow control signal to the scheduling circuit to instruct the scheduling circuit to no longer schedule the output of the next message descriptor of all channels.

[0099] The remaining number of tokens may be the number of tokens remaining after deducting the number of excess tokens from the second number of available tokens.

[0100] The preset packet length may be a preset maximum packet length (eg, usually the number of tokens corresponding to 16 kb bytes).

[0101] It should be noted that when the storage space corresponding to the number of remaining tokens in the shared pool is less than the longest packet length, the scheduling circuit will face the situation of being unable to provide enough tokens for the data packet of the longest packet length. At this time, the scheduling circuit will temporarily stop scheduling new message descriptors (that is, temporarily stop sending new data packets).

[0102] Flow control signal, used to instruct the scheduling circuit to no longer schedule the output of new message descriptors to all channels.

[0103] In a specific implementation, when the second available token amount is greater than or equal to the number of excess tokens, the number of excess tokens will be subtracted from the second available token amount, and the difference between the second available token number and the number of excess tokens will be calculated, and the difference will be determined as the remaining number of tokens in the shared pool token counter; and then, when it is detected that the storage space corresponding to the remaining number of tokens is less than the preset packet length, the token management circuit will output a flow control signal to the scheduling circuit, and the scheduling circuit will no longer schedule the next message descriptor of any channel; thereby, traffic congestion can be prevented.

[0104] In addition, in extreme cases, before the scheduling is completed, it is impossible to determine which channel the scheduled output message belongs to. When the channel exceeds the limit and the number of remaining tokens in the shared pool is insufficient to store the message, the remaining message will be discarded.

[0105] In this embodiment, when the current available token number of a channel is less than the number of tokens to be consumed, the difference between the number of tokens to be consumed and the current available token number is used as the number of excess tokens; the second available token amount configured in the shared pool token counter is obtained, and when the second available token amount is greater than or equal to the number of excess tokens, the number of excess tokens is subtracted from the second available token amount, so that the scheduling circuit continues to schedule the next message descriptor of the channel. Thus, the first available token amount in each channel counter and the second available token amount in the shared pool token counter are used in combination to ensure the stability of flow control.

[0106] Based on the above embodiments, a fourth embodiment of the flow control method of the present invention is proposed. Figure 4 In this embodiment, after step S10, the flow control method may further include the following steps S50-S60: Step S50: the DMA determines the number of tokens to be consumed required by the channel corresponding to each message according to each message descriptor, and sends the number of consumed tokens of each channel to the token management circuit.

[0107] The number of tokens to be consumed may be the number of tokens required to be consumed by the message calculated according to the number of messages in each channel.

[0108] It should be noted that, in this embodiment, the message corresponding to each message descriptor is transmitted as a data packet, that is, the transmission of one message needs to consume one token of the channel corresponding to the message.

[0109] In a specific implementation, DMA can determine the channel corresponding to the message according to the message descriptor; and further, by using the fact that each message needs to consume one token of the corresponding channel, the number of tokens to be consumed by each channel can be determined.

[0110] Step S60, the token management circuit obtains the current number of available tokens for each channel, and determines whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor for each channel based on the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

[0111] The current number of available tokens may be the number of remaining tokens of each channel in the current token management circuit when scheduling the current message descriptor.

[0112] If the scheduling circuit schedules the message descriptor for the first time, the current number of available tokens is the preset available token quota of each channel.

[0113] If it is not the first time for the scheduling circuit to schedule a message descriptor, the difference between the available token amount of each channel and the number of tokens consumed when the message corresponding to the last message descriptor is scheduled can be determined as the current number of available tokens.

[0114] In a specific implementation, the token management circuit also includes a channel counter; the current number of available tokens of each channel is obtained from the channel counter; and then it can be determined whether the current number of available tokens in each channel is greater than or equal to the number of tokens to be consumed. Among them, when the current number of available tokens is greater than or equal to the number of tokens to be consumed, it means that the storage space of the corresponding channel has not been completely consumed by the message, and it is determined that the scheduling circuit can continue to schedule new message descriptors to the corresponding channel. When it is detected that the current number of available tokens in a channel is less than the number of tokens to be consumed, it means that the storage space of the corresponding channel has been completely consumed by the message, and then the token management circuit outputs a flow control signal to the scheduling circuit, and the flow control signal is used to notify the scheduling circuit to prohibit scheduling new message descriptors to the channel.

[0115] For further information, see Figure 5 In one embodiment, step S60 may include the following sub-steps S601-S602: Sub-step S601: when the number of currently available tokens in a channel token counter is less than the number of tokens to be consumed, the difference between the number of tokens to be consumed and the currently available tokens is taken as the number of excess tokens.

[0116] Sub-step S602, obtains the second available token quota configured in the shared pool token counter, and when the second available token quota is greater than or equal to the excess token number, subtracts the excess token number from the second available token quota so that the scheduling circuit continues to schedule the next message descriptor of the output channel.

[0117] The first available token amount refers to the number of available tokens pre-configured for each channel in the channel token counter.

[0118] The second available token quota refers to the number of available tokens pre-configured for the shared pool token counter.

[0119] The number of exceeded tokens may be the difference between the number of tokens to be consumed and the number of currently available tokens when the number of currently available tokens of a certain channel is less than the number of tokens to be consumed.

[0120] In a specific implementation, the token management circuit also includes a channel counter and a shared pool token counter; compare the current available token number in each channel with the number of tokens to be consumed, and when it is detected that the current token number of a channel is less than the number of tokens to be consumed, calculate the difference between the number of tokens to be consumed and the current number of tokens in the channel, and determine the difference as the number of excess tokens; obtain the second available token amount configured in the shared pool token counter; then compare the second available token amount with the number of excess tokens, and when the second available token amount is greater than or equal to the number of excess tokens, subtract the number of excess tokens from the second available token amount, so that the scheduling circuit continues to schedule and output the next message descriptor of the corresponding channel. Therefore, by setting the shared pool token amount, it is helpful to realize the flow shaping and rate limiting of the entire flow control system, and ensure the overall performance and stability of the system.

[0121] For further information, see Figure 5 In one embodiment, after sub-step S601, the flow control method may further include the following sub-step S603: In sub-step S603, the token management circuit outputs the number of exceeded tokens of the corresponding channel to the scheduling circuit to instruct the scheduling circuit to no longer schedule the output of the next message descriptor of the channel.

[0122] The number of excess tokens may be a value of the channel token counter that exceeds the first available token quota, indicating the amount of space occupied by the messages that cannot be stored in the current channel in the shared pool storage space.

[0123] It should be noted that when the number of excess tokens is not 0, the corresponding channel will subtract 1 token from the corresponding channel token counter when receiving the taken signal sent by the subsequent cache, and will synchronously update the shared pool token count. At this time, the shared pool token counter will be subtracted by 1 token.

[0124] In a specific implementation, the token management circuit outputs the number of tokens that have exceeded the limit of the corresponding channel to the scheduling circuit, instructing the scheduling circuit to no longer schedule the next message descriptor of the corresponding channel. Thus, by limiting the channel token quota of a single channel, it is possible to prevent the data flow of some channels from being too large, thereby affecting the performance of other channels.

[0125] When the number of tokens exceeding the limit of a channel is greater than 0, the scheduling circuit will no longer schedule the output of new message descriptors for the channel. Therefore, the number of tokens carried by taken must be greater than or equal to the number of tokens exceeding the limit. At this time, it is only necessary to subtract the number of tokens exceeding the limit from the shared pool token counter.

[0126] For further information, see Figure 5 In one embodiment, after sub-step S602, the flow control method may further include the following sub-step S604: Sub-step S604, when it is detected that the number of remaining shared pool tokens in the shared pool token counter is 0, the token management circuit outputs a flow control signal to the scheduling circuit to instruct the scheduling circuit to no longer schedule the output of the next message descriptor of all channels.

[0127] The remaining number of tokens in the shared pool may be the number of tokens remaining in the shared pool timer after the excess number of tokens is subtracted from the second available token amount.

[0128] In a specific implementation, when it is detected that the number of remaining tokens in the shared pool is 0, the token management circuit will output a flow control signal to the scheduling circuit, and the scheduling circuit will no longer schedule the next message descriptor of any channel; thereby preventing traffic congestion.

[0129] In this embodiment, when the scheduling circuit receives multiple message descriptors with different destinations, each message descriptor is sent to the DMA according to the preset scheduling rules; the DMA determines the number of tokens to be consumed required by the channel corresponding to each message according to each message descriptor, and sends the number of consumed tokens of each channel to the token management circuit; the token management circuit obtains the current number of available tokens of each channel, and determines whether to notify the scheduling circuit to continue scheduling and outputting new message descriptors for each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed. By treating each entire message as a whole data packet for token calculation, the number of token feedbacks can be reduced, data loss can be reduced, and the throughput of the system can be improved.

[0130] Based on the same inventive concept, the fifth embodiment of the present invention also provides a flow control system corresponding to the flow control method of the previous embodiment. Since the principle of the system in the fifth embodiment of the present invention to solve the problem is similar to the flow control method of the previous embodiment of the present invention, the implementation of the system can refer to the implementation of the method, and the repeated parts will not be repeated. Figure 6 , the flow control system of the present invention may include: The scheduling circuit 10 is used to send each message descriptor to the DMA according to a preset scheduling rule when receiving multiple message descriptors with destinations being different channels; DMA 20, used to obtain the packet length of the message corresponding to each message description according to each message descriptor, and input the packet length of each message into the token management circuit; The token management circuit 30 is used to determine the number of tokens to be consumed by the channel corresponding to each message according to each packet length, and to obtain the current number of available tokens for each channel; The token management circuit 30 is further used to determine whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

[0131] In addition, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned flow control method is implemented.

[0132] Figure 7 is a schematic block diagram of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device includes: at least one processor 401, a memory 402, at least one network interface 403 and a user interface 405. The various components in the electronic device are coupled together through a bus system 404. It can be understood that the bus system 404 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 404 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 7 In the specification, various buses are labeled as bus systems.

[0133] The user interface 405 may include a display, a keyboard, a mouse, a trackball, a click gun, keys, buttons, a touch pad or a touch screen.

[0134] It is understood that the memory 402 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM). The memory described in the embodiments of the present invention is intended to include but is not limited to these and any other suitable categories of memory.

[0135] The memory 402 in the embodiment of the present invention is used to store various categories of data to support the operation of the electronic device 400. Examples of these data include: any executable program for operating on the electronic device 400, such as an operating system 4021 and an application 4022; the operating system 4021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application 4022 may include various applications, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services. The flow control method provided by the embodiment of the present invention may be included in the application 4022.

[0136] The method disclosed in the above embodiment of the present invention can be applied to the processor 401, or implemented by the processor 401. The processor 401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 401 or the instruction in the form of software. The above processor 401 may be a general processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 401 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiment of the present invention. The general processor 401 can be a microprocessor or any conventional processor, etc. In combination with the steps of the flow control method provided in the embodiment of the present invention, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0137] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD) to execute the aforementioned method.

[0138] In summary, the present invention reduces the resources consumed by the step-by-step FIFO by adding a token management circuit at the QOS position and matching the token with the remote cache quota storage space according to the control logic of the token management circuit.

[0139] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A flow control method, It is characterized in that Applied to a flow control system, the flow control system includes a scheduling circuit, a DMA and a token management circuit, and the method includes: When the scheduling circuit receives multiple message descriptors with destinations being different channels, it sends each message descriptor to the DMA according to a preset scheduling rule; The DMA obtains the packet length of the message corresponding to each message description according to each message descriptor, and inputs the packet length of each message into the token management circuit; The token management circuit determines the number of tokens to be consumed required by the channel corresponding to each message according to each packet length, and obtains the number of currently available tokens for each channel; The token management circuit determines whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

2. The method according to claim 1, It is characterized in that The token management circuit includes a channel token counter, and obtaining the current number of available tokens for each channel includes: If the message descriptor is scheduled for the first time, obtaining the first available token amount configured for each channel in the channel token counter, and determining the first available token amount as the current available token number; If it is not the first time to determine the scheduling message descriptor, the first available token amount configured for each channel is obtained from the channel token counter, and the token count value of each channel is obtained from the channel token counter; based on the first available token amount and the token count value, the current number of available tokens is determined; wherein the token count value is the number of tokens consumed when transmitting the message corresponding to the last message descriptor.

3. The method according to claim 1 or 2, It is characterized in that The token management circuit includes a channel token counter and a shared pool token counter. The token management circuit determines whether to notify the scheduling circuit to continue scheduling the next message descriptor according to a judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed, including: When there is a channel token counter whose current available token number is less than the number of tokens to be consumed, the difference between the number of tokens to be consumed and the current available token number is taken as the excess token number; The second available token amount configured in the shared pool token counter is obtained, and when the second available token amount is greater than or equal to the excess token number, the excess token number is subtracted from the second available token amount so that the scheduling circuit continues to schedule the next message descriptor of the output channel.

4. The method according to claim 3, It is characterized in that After the step of taking the difference between the number of tokens to be consumed and the number of currently available tokens as the number of excess tokens when the number of currently available tokens of a channel token counter is less than the number of tokens to be consumed, the method further comprises: The token management circuit outputs the overlimit flag of the corresponding channel to the scheduling circuit to instruct the scheduling circuit to no longer schedule the output of the next message descriptor of the channel.

5. The method according to claim 3, It is characterized in that After the step of subtracting the excess token number from the second available token amount when the second available token amount is greater than or equal to the excess token number, the method further includes: Determine the difference between the second available token number and the excess token number as the remaining token number in the shared pool token counter; When the storage space corresponding to the remaining number of tokens is less than the preset packet length, the token management circuit outputs a flow control signal to the scheduling circuit to instruct the scheduling circuit to no longer schedule the output of the next message descriptor of all channels.

6. The method according to claim 1, It is characterized in that After the step of sending each message descriptor to the DMA according to a preset scheduling rule when the scheduling circuit receives multiple message descriptors with destinations being different channels, the method further includes: The DMA determines the number of tokens to be consumed required by the channel corresponding to each message according to each message descriptor, and sends the number of consumed tokens of each channel to the token management circuit; The token management circuit obtains the current number of available tokens of each channel, and determines whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

7. The method according to claim 6, It is characterized in that The token management circuit includes a channel token counter and a shared pool token counter, and the determination of whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed includes: When the number of currently available tokens in a channel token counter is less than the number of tokens to be consumed, the difference between the number of tokens to be consumed and the currently available tokens is taken as the number of excess tokens; The second available token amount configured in the shared pool token counter is obtained, and when the second available token amount is greater than or equal to the excess token number, the excess token number is subtracted from the second available token amount so that the scheduling circuit continues to schedule the next message descriptor of the output channel.

8. A flow control system, It is characterized in that The flow control system includes a scheduling circuit, a DMA and a token management circuit, wherein: A scheduling circuit, for sending each message descriptor to the DMA according to a preset scheduling rule when receiving multiple message descriptors with destinations being different channels; DMA, used for obtaining the packet length of the message corresponding to each message descriptor according to each message descriptor, and inputting the packet length of each message into the token management circuit; The token management circuit is used to determine the number of tokens to be consumed by the channel corresponding to each message according to each packet length, and to obtain the current number of available tokens for each channel; The token management circuit is further used to determine whether to notify the scheduling circuit to continue scheduling and outputting the next message descriptor of each channel according to the judgment result of whether the current number of available tokens is greater than or equal to the number of tokens to be consumed.

9. An electronic device, It is characterized in that The electronic device comprises: a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device performs the steps of the method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a program, and when the program is run, it is used to implement the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Flow control method with low resource consumption based on FPGA

    CN116389366A

  • Traffic management method and device, electronic equipment and storage medium

    CN116455828A

Cited By

  • Traffic scheduling method and device, electronic equipment and storage medium

    CN121418359A