Message scheduling method, device and system
By obtaining the message and its congestion status, if the port is congested, it is stored in the software queue, and if it is not congested, it is forwarded. This solves the problem of low message forwarding efficiency in the existing technology and achieves more efficient message processing.
Patent Information
- Application Number
- CN202310014513.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-05
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2043-01-05
AI Technical Summary
In the prior art, when the software performs routing search or forwarding, the processing of failed packets is complicated, resulting in low forwarding efficiency and the possibility of packet loss.
By obtaining the packets to be sent and their corresponding congestion status, if the port is congested, the packets are stored in the software queue; if the port is not congested, the packets are forwarded.
By accurately sensing the congestion status of the port, the correct packet scheduling strategy can be implemented to avoid mistransmissions leading to transmission failures and improve packet forwarding efficiency.
Smart Images

Figure CN116016349B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data transmission, and in particular to a message scheduling method, device and system. Background Art
[0002] In existing software that performs route lookup or forwarding, messages that fail to be sent (Transport, TX for short) are usually processed through emergency queues and other methods. However, the implementation process of this method is relatively complicated, which reduces the software forwarding efficiency and there is a possibility of packet loss during the transmission process.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a message scheduling method, device and system to at least solve the technical problem of low message forwarding efficiency caused by a complex sending process.
[0005] According to one aspect of an embodiment of the present invention, a message scheduling method is provided, including: obtaining a first message to be sent; obtaining a first congestion state corresponding to the first message from a cache or a memory, wherein the first congestion state is used to characterize whether a first port corresponding to the first message is congested; in response to congestion occurring at the first port, storing the first message in a software queue; in response to no congestion occurring at the first port, forwarding the first message.
[0006] Optionally, forwarding the first message includes: determining the number of historical messages stored in the software queue; in response to the number being less than a preset number, forwarding the first message; in response to the number being greater than or equal to the preset number, storing the first message in the software queue.
[0007] Optionally, after storing the first message in the software queue, the method also includes: obtaining a second message stored in the software queue; obtaining a second congestion status corresponding to the second message from a cache or a memory, wherein the second congestion status is used to characterize whether congestion occurs at a second port corresponding to the second message; in response to congestion occurring at the second port, storing the second message in an emergency queue; and in response to no congestion occurring at the second port, forwarding the second message.
[0008] Optionally, after storing the second message in the emergency queue, the method also includes: obtaining a third message stored in the emergency queue; obtaining a third congestion state corresponding to the third message from a cache or a memory, wherein the third congestion state is used to characterize whether congestion occurs at a third port corresponding to the third message; in response to congestion occurring at the third port, discarding the third message; in response to no congestion occurring at the third port, forwarding the third message.
[0009] Optionally, a first congestion state corresponding to a message to be sent is obtained from a cache or a memory, including: obtaining a first number of free descriptors in a transmission ring buffer from the cache or the memory; in response to the first number being less than a first preset number, determining that congestion occurs on the first port; in response to the first number being greater than a second preset number, determining that congestion does not occur on the first port.
[0010] Optionally, the method also includes: obtaining an update instruction for updating a first number of free descriptors; updating the first number of free descriptors based on the update instruction to obtain a second number of free descriptors; in response to the second number being less than a first preset number, determining that the first congestion state has changed from no congestion on the first port to congestion on the first port; in response to the second number being greater than a second preset number, determining that the first congestion state has changed from congestion on the first port to no congestion on the first port.
[0011] Optionally, in response to a change in the first congestion state, the method further includes at least one of the following: sending an interrupt message to a processor, wherein the interrupt message is used by the processor to obtain the changed congestion state from a memory to update a historical congestion state stored in the processor; and storing the changed congestion state in a cache.
[0012] According to another aspect of an embodiment of the present invention, a message scheduling device is also provided, including: a message acquisition module, used to acquire a first message to be sent; a status acquisition module, used to acquire a first congestion state corresponding to the first message from a cache or a memory, wherein the first congestion state is used to characterize whether congestion occurs at a first port corresponding to the first message; a message storage module, used to store the first message in a software queue in response to congestion occurring at the first port; and a message forwarding module, used to forward the first message in response to no congestion occurring at the first port.
[0013] According to another aspect of an embodiment of the present invention, a message scheduling system is also provided, including: a cache or a memory, used to store congestion status of whether different ports are sending congestion; a processor, connected to the cache or the memory, used to obtain a first message to be sent, and obtain a first congestion status corresponding to the first message from the cache or the memory, in response to congestion occurring at the first port, storing the first message in a software queue, and in response to no congestion occurring at the first port, forwarding the first message, wherein the first congestion status is used to characterize whether congestion occurs at the first port corresponding to the first message.
[0014] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, the computer-readable storage medium including a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the methods in the embodiments of the present application.
[0015] According to another aspect of an embodiment of the present invention, a processor is further provided, and the processor is used to run a program, wherein the program executes any one of the methods in the embodiments of the present application when running.
[0016] Through the above steps, it is possible to obtain the first message to be sent; obtain the first congestion state corresponding to the first message from the cache or the memory, wherein the first congestion state is used to characterize whether the first port corresponding to the first message is congested; in response to congestion occurring at the first port, store the first message in the software queue; in response to no congestion occurring at the first port, forward the first message, thereby accurately obtaining the congestion state of the first port from the cache or the memory, achieving the purpose of hardware-assisted software accurately perceiving the congestion state, and then making a correct message scheduling strategy, avoiding sending failures caused by mis-sending, achieving the technical effect of improving message forwarding efficiency, and solving the technical problem of low message forwarding efficiency caused by a complex sending process. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0018] Figure 1 It is a flow chart of a message scheduling method in an embodiment of the present application;
[0019] Figure 2 It is another flow chart of a message scheduling method in an embodiment of the present application;
[0020] Figure 3 It is another flow chart of a message scheduling method in an embodiment of the present application;
[0021] Figure 4 It is a structural schematic diagram of a message scheduling device in an embodiment of the present application;
[0022] Figure 5 It is a structural diagram of a message dispatching system in an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] According to an embodiment of the present invention, a message scheduling method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0026] Figure 1 It is a flow chart of a message scheduling method in an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0027] Step S102, obtaining a first message to be sent.
[0028] Step S104: Acquire a first congestion state corresponding to the first message from a cache or a memory, wherein the first congestion state is used to indicate whether congestion occurs at a first port corresponding to the first message.
[0029] Specifically, the cache, i.e., Cache, may represent a CPU (Central Processing Unit) high-speed buffer. The memory may be a DDR (Double Data Rate), and the first port may be a CPU Reg I / O (Input / Output).
[0030] As an optional implementation, the hardware can count the number of descriptors of the controls in the TX Ring in real time. According to the configuration information, if the idle descriptor is less than the on-Threshold, it is considered to have entered the congestion state; if the idle descriptor is greater than the off-Threshold, it is considered to have exited the congestion state.
[0031] Secondly, the DMA (Direct Memory Access) controller interacts with the CPU through the ring queue space. The DMA TX RING usually obtains descriptors in the form of tail pointers to complete data transmission, in which the DMA controller maintains the number of valid and available descriptors in the TX RING, namely vldNum. When vldNum is non-zero, DMA TX can obtain descriptors to perform data transmission. Every time the software needs to notify the hardware that the number of available descriptors has increased, it needs to update vldNum by configuring Reg I / O. The vldNum updated by the software will be accumulated to the real vldNum inside the chip. In the message sending direction, the vldNum in the chip indicates how many DMA descriptors are waiting to be executed by the hardware on the DMA TX RING. After each message is sent, vldNum decreases by 1. At the same time, the DMA controller also maintains the number of free TX descriptors, namely TxFreeFesc. Figure 2 This is another flow chart of a message scheduling method in an embodiment of the present application, see Figure 2 In the lower right corner, the black part of the descriptor refers to the descriptor that the CPU has completed but has not yet sent to the TX hardware, and the gray part of the descriptor refers to the idle TX descriptor. Figure 2 The Thrd in is used to represent the Threshold.
[0032] That is to say, since the event that causes the TX direction to enter the congestion state must be the RegI / O from the CPU updating vldNum, it is determined whether the On-Threshold is reached after each CPU Reg I / O, and since the event that causes the TX direction to release the congestion state must be the DMA TX RING updating and reducing vldNum after completing data transmission, it is determined whether it is less than the Off-Threshold after each packet is sent to release the congestion state.
[0033] In addition, each time the congestion state is entered or the congestion state is released, causing the congestion state to change, the hardware will update the Congestion state. This congestion state can be reflected in the form of a bitmap on the hardware. Each bit represents the congestion state of a DMA TX Ring. Setting 1 indicates congestion, and setting 0 indicates no congestion. Among them, the way to notify the software of the congestion state bitmap includes two ways: interruption and chip writing congestion status to a specific address. In the interrupt mode, DMA reports an interrupt to notify the CPU of the change in congestion state. The CPU processes the interrupt to obtain the congestion state from the DDR to complete the CPU congestion information update; in the write specific address mode, the congestion state of any TX RING of N TX RINGs changes, and the chip will update the congestion state of the N-bit bitmap to the memory corresponding to the configured address, that is, the Cache Memory, and the CPU directly obtains the congestion state of the DMA TX RING from the Cache at high speed.
[0034] Step S106: In response to congestion occurring at the first port, storing the first message in a software queue.
[0035] Step S108: In response to no congestion occurring at the first port, forwarding the first message.
[0036] As an optional implementation, Figure 3 is another flow chart of a message scheduling method in an embodiment of the present application, such as Figure 3 As shown, when congestion occurs at the first port, the first message can be stored for Enqueue processing and then stored in the Service Queue (i.e., the above-mentioned software queue). When congestion does not occur at the first port, the Queue is determined to be empty and the first message is forwarded.
[0037] Through the above steps, it is possible to obtain the first message to be sent; obtain the first congestion state corresponding to the first message from the cache or the memory, wherein the first congestion state is used to characterize whether the first port corresponding to the first message is congested; in response to congestion occurring at the first port, store the first message in the software queue; in response to no congestion occurring at the first port, forward the first message, thereby accurately obtaining the congestion state of the first port from the cache or the memory, achieving the purpose of hardware-assisted software accurately perceiving the congestion state, and then making a correct message scheduling strategy, avoiding sending failures caused by mis-sending, achieving the technical effect of improving message forwarding efficiency, and solving the technical problem of low message forwarding efficiency caused by a complex sending process.
[0038] Optionally, forwarding the first message includes: determining the number of historical messages stored in the software queue; in response to the number being less than a preset number, forwarding the first message; in response to the number being greater than or equal to the preset number, storing the first message in the software queue.
[0039] Specifically, the number of the historical messages may be vldNum, and the preset number may be On-Threshold.
[0040] Optionally, after storing the first message in the software queue, the method also includes: obtaining a second message stored in the software queue; obtaining a second congestion status corresponding to the second message from a cache or a memory, wherein the second congestion status is used to characterize whether congestion occurs at a second port corresponding to the second message; in response to congestion occurring at the second port, storing the second message in an emergency queue; and in response to no congestion occurring at the second port, forwarding the second message.
[0041] Specifically, Figure 3 As shown, the urgent queue can be a Critical Queue.
[0042] Optionally, after storing the second message in the emergency queue, the method also includes: obtaining a third message stored in the emergency queue; obtaining a third congestion state corresponding to the third message from a cache or a memory, wherein the third congestion state is used to characterize whether congestion occurs at a third port corresponding to the third message; in response to congestion occurring at the third port, discarding the third message; in response to no congestion occurring at the third port, forwarding the third message.
[0043] Specifically, the third port may be a port corresponding to the critical queue. If congestion occurs on the port corresponding to the critical queue, the third message is discarded.
[0044] Optionally, a first congestion state corresponding to a message to be sent is obtained from a cache or a memory, including: obtaining a first number of free descriptors in a transmission ring buffer from the cache or the memory; in response to the first number being less than a first preset number, determining that congestion occurs on the first port; in response to the first number being greater than a second preset number, determining that congestion does not occur on the first port.
[0045] Specifically, the first number may be TxFreeFesc, the first preset number may be On-Threshold, and the second preset number may be off-Threshold.
[0046] Optionally, the method also includes: obtaining an update instruction for updating a first number of free descriptors; updating the first number of free descriptors based on the update instruction to obtain a second number of free descriptors; in response to the second number being less than a first preset number, determining that the first congestion state has changed from no congestion on the first port to congestion on the first port; in response to the second number being greater than a second preset number, determining that the first congestion state has changed from congestion on the first port to no congestion on the first port.
[0047] Specifically, each time a message is sent, the number of valid idle descriptors in the TX Ring is reduced once, and the first number is increased once synchronously to obtain the second number of idle descriptors. The first preset number and the second user number can be configured by the user.
[0048] Optionally, in response to a change in the first congestion state, the method further includes at least one of the following: sending an interrupt message to a processor, wherein the interrupt message is used by the processor to obtain the changed congestion state from a memory to update a historical congestion state stored in the processor; and storing the changed congestion state in a cache.
[0049] Specifically, the DMA may send an interrupt message to the CPU, and the CPU may know that the congestion state of the CPU has changed. Then, the CPU may obtain the changed congestion state from the DDR and store the changed congestion state in the cache.
[0050] In addition, this method can also be used to update the congestion status. When the congestion status of any TX RING of N TX RINGs changes, the chip will update the congestion status of the N-bit bitmap to the memory corresponding to the configured address, that is, the Cache Memory, and the CPU directly obtains the congestion status of the DMA TX RING at high speed from the Cache.
[0051] The present application also provides a message scheduling device, Figure 4 is a structural diagram of a message scheduling device in an embodiment of the present application, such as Figure 4 As shown, the device comprises:
[0052] A message acquisition module 42, used to acquire a first message to be sent;
[0053] A state acquisition module 44, configured to acquire a first congestion state corresponding to the first message from a cache or a memory, wherein the first congestion state is used to indicate whether congestion occurs at a first port corresponding to the first message;
[0054] The message storage module 46 is used to store the first message in the software queue in response to congestion occurring at the first port;
[0055] The message forwarding module 48 is configured to forward the first message in response to no congestion occurring at the first port.
[0056] Through the above embodiments, it is possible to obtain a first message to be sent; obtain a first congestion state corresponding to the first message from a cache or a memory, wherein the first congestion state is used to characterize whether congestion occurs at a first port corresponding to the first message; in response to congestion occurring at the first port, store the first message in a software queue; in response to no congestion occurring at the first port, forward the first message, thereby accurately obtaining the congestion state of the first port from the cache or the memory, thereby achieving the purpose of hardware-assisted software accurately perceiving the congestion state, and further making a correct message scheduling strategy, thereby avoiding sending failures caused by mis-sending, and achieving the technical effect of improving message forwarding efficiency, and solving the technical problem of low message forwarding efficiency caused by a complex sending process.
[0057] Optionally, the message forwarding module includes: a quantity confirmation unit, used to determine the number of historical messages stored in the software queue; a forwarding unit, used to forward the first message in response to the number being less than a preset number; and a storage unit, used to store the first message in the software queue in response to the number being greater than or equal to a preset number.
[0058] Optionally, the device also includes: a second message acquisition module, used to acquire a second message stored in the software queue after storing the first message in the software queue; a second congestion status acquisition module, used to acquire a second congestion status corresponding to the second message from a cache or a memory, wherein the second congestion status is used to characterize whether congestion occurs at a second port corresponding to the second message; a second storage module, used to store the second message in an emergency queue in response to congestion occurring at the second port; and a second message forwarding module, used to forward the second message in response to no congestion occurring at the second port.
[0059] Optionally, the device also includes: a third message acquisition module, used to acquire a third message stored in the emergency queue after storing the second message in the emergency queue; a third congestion status acquisition module, used to acquire a third congestion status corresponding to the third message from a cache or a memory, wherein the third congestion status is used to characterize whether congestion occurs at a third port corresponding to the third message; a discarding module, used to discard the third message in response to congestion occurring at the third port; and a third forwarding module, used to forward the third message in response to no congestion occurring at the third port.
[0060] Optionally, the status acquisition module includes: a quantity acquisition unit, used to obtain a first number of free descriptors in a transmission ring buffer from a cache or a memory; a first congestion confirmation unit, used to determine that congestion occurs on the first port in response to the first number being less than a first preset number; and a second non-congestion confirmation unit, used to determine that congestion does not occur on the first port in response to the first number being greater than a second preset number.
[0061] Optionally, the device also includes: an update instruction acquisition module, used to acquire an update instruction for updating the first number of free descriptors; a quantity update module, used to update the first number of free descriptors based on the update instruction to obtain a second number of free descriptors; a second congestion confirmation module, used to determine, in response to the second number being less than the first preset number, that the first congestion state has changed from no congestion on the first port to congestion on the first port; and a second non-congestion confirmation module, used to determine, in response to the second number being greater than the second preset number, that the first congestion state has changed from congestion on the first port to no congestion on the first port.
[0062] Optionally, the device also includes: a status update module, used to send an interrupt message to the processor in response to a change in the first congestion state, wherein the interrupt message is used for the processor to obtain the changed congestion state from the memory to update the historical congestion state stored in the processor; and store the changed congestion state in the cache.
[0063] The present application also provides a message dispatching system. Figure 5 is a structural diagram of a message dispatching system in an embodiment of the present application, such as Figure 5 As shown, the system includes:
[0064] A cache or memory 52 for storing the congestion status of different ports indicating whether they are sending congestion;
[0065] The processor 54 is connected to the cache or memory, and is used to obtain a first message to be sent, and obtain a first congestion status corresponding to the first message from the cache or the memory, in response to congestion occurring at the first port, store the first message in a software queue, and in response to no congestion occurring at the first port, forward the first message, wherein the first congestion status is used to characterize whether congestion occurs at the first port corresponding to the first message.
[0066] Through the above embodiments, it is possible to obtain a first message to be sent; obtain a first congestion state corresponding to the first message from a cache or a memory, wherein the first congestion state is used to characterize whether congestion occurs at a first port corresponding to the first message; in response to congestion occurring at the first port, store the first message in a software queue; in response to no congestion occurring at the first port, forward the first message, thereby accurately obtaining the congestion state of the first port from the cache or the memory, thereby achieving the purpose of hardware-assisted software accurately perceiving the congestion state, and further making a correct message scheduling strategy, thereby avoiding sending failures caused by mis-sending, and achieving the technical effect of improving message forwarding efficiency, and solving the technical problem of low message forwarding efficiency caused by a complex sending process.
[0067] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, the computer-readable storage medium including a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the methods in the embodiments of the present application.
[0068] According to another aspect of an embodiment of the present invention, a processor is further provided, and the processor is used to run a program, wherein the program executes any one of the methods in the embodiments of the present application when running.
[0069] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0070] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0071] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0072] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0073] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0074] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0075] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A message scheduling method, characterized in that: include: Obtaining a first message to be sent; Acquire a first congestion state corresponding to the first message from a cache or a memory, wherein the first congestion state is used to indicate whether congestion occurs at a first port corresponding to the first message; In response to congestion occurring at the first port, storing the first message in a software queue; In response to no congestion occurring on the first port, forwarding the first message; The forwarding of the first message includes: determining the number of historical messages stored in the software queue; in response to the number being less than a preset number, forwarding the first message; in response to the number being greater than or equal to the preset number, storing the first message in the software queue; After storing the first message in the software queue, the method further includes: acquiring a second message stored in the software queue; acquiring a second congestion state corresponding to the second message from the cache or the memory, wherein the second congestion state is used to indicate whether congestion occurs at a second port corresponding to the second message; in response to congestion occurring at the second port, storing the second message in an emergency queue; in response to no congestion occurring at the second port, forwarding the second message; After storing the second message in the emergency queue, the method further includes: obtaining a third message stored in the emergency queue; obtaining a third congestion state corresponding to the third message from the cache or the memory, wherein the third congestion state is used to characterize whether congestion occurs at a third port corresponding to the third message; in response to congestion occurring at the third port, discarding the third message; and in response to no congestion occurring at the third port, forwarding the third message.
2. The method according to claim 1, characterized in that Acquiring a first congestion state corresponding to the message to be sent from a cache or a memory includes: Obtaining a first number of free descriptors in a transmission ring buffer from the cache or the memory; In response to the first number being less than a first preset number, determining that congestion occurs on the first port; In response to the first number being greater than a second preset number, it is determined that no congestion occurs on the first port.
3. The method according to claim 2, characterized in that The method further comprises: Obtaining an update instruction for updating a first number of free descriptors; updating the first number of the idle descriptors based on the update instruction to obtain the second number of the idle descriptors; In response to the second number being less than the first preset number, determining that the first congestion state changes from no congestion occurring at the first port to congestion occurring at the first port; In response to the second number being greater than the second preset number, it is determined that the first congestion state is changed from congestion occurring at the first port to no congestion occurring at the first port.
4. The method according to claim 1, characterized in that: In response to a change in the first congestion state, the method further includes at least one of the following: Sending an interrupt message to the processor, wherein the interrupt message is used by the processor to obtain the changed congestion state from the memory to update the historical congestion state stored in the processor; The changed congestion status is stored in the cache.
5. A message scheduling device, characterized in that: include: A message acquisition module, used to acquire a first message to be sent; A state acquisition module, used to acquire a first congestion state corresponding to the first message from a cache or a memory, wherein the first congestion state is used to indicate whether congestion occurs at a first port corresponding to the first message; a message storage module, configured to store the first message in a software queue in response to congestion occurring at the first port; a message forwarding module, configured to forward the first message in response to no congestion occurring on the first port; The message forwarding module includes: a quantity confirmation unit, used to determine the number of historical messages stored in the software queue; a forwarding unit, used to forward the first message in response to the number being less than a preset number; a storage unit, used to store the first message in the software queue in response to the number being greater than or equal to the preset number; a second message acquisition module, used for acquiring a second message stored in the software queue after the first message is stored in the software queue; a second congestion status acquisition module, used for acquiring a second congestion status corresponding to the second message from the cache or the memory, wherein the second congestion status is used to characterize whether congestion occurs in the second port corresponding to the second message; a second storage module, used for storing the second message in an emergency queue in response to congestion occurring in the second port; a second message forwarding module, used for forwarding the second message in response to no congestion occurring in the second port; A third message acquisition module is used to acquire the third message stored in the emergency queue after the second message is stored in the emergency queue; a third congestion status acquisition module is used to acquire the third congestion status corresponding to the third message from the cache or the memory, wherein the third congestion status is used to characterize whether the third port corresponding to the third message is congested; a discarding module is used to discard the third message in response to congestion occurring at the third port; and a third forwarding module is used to forward the third message in response to no congestion occurring at the third port.
6. A message dispatching system, characterized in that: include: A cache or memory for storing the congestion status of different ports indicating whether they are sending congestion; a processor connected to the cache or the memory, configured to obtain a first message to be sent, and obtain a first congestion state corresponding to the first message from the cache or the memory, and in response to congestion occurring at the first port, store the first message in a software queue, and in response to no congestion occurring at the first port, forward the first message, wherein the first congestion state is used to indicate whether congestion occurs at the first port corresponding to the first message; The forwarding of the first message includes: determining the number of historical messages stored in the software queue; in response to the number being less than a preset number, forwarding the first message; in response to the number being greater than or equal to the preset number, storing the first message in the software queue; The processor is further configured to, after storing the first message in the software queue, obtain a second message stored in the software queue; obtain a second congestion state corresponding to the second message from the cache or the memory, wherein the second congestion state is used to indicate whether congestion occurs in a second port corresponding to the second message; in response to congestion occurring at the second port, store the second message in an emergency queue; in response to no congestion occurring at the second port, forward the second message; The processor is further configured to, after storing the second message in the emergency queue, obtain a third congestion state corresponding to a third message from the cache or the memory, wherein the third congestion state is used to characterize whether a third port corresponding to the third message is congested; in response to congestion occurring at the third port, discard the third message; and in response to no congestion occurring at the third port, forward the third message.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 4.
8. A processor, characterized in that: The processor is used to run a program, wherein the program executes the method according to any one of claims 1 to 4 when running.
Citation Information
Patent Citations
Port congestion management method and device
CN105812285A