Message forwarding method, message forwarding system and storage medium
By introducing caching, parsing, and replication modules into the message forwarding system, and utilizing the collaboration between the controller and the replication module to dynamically update the number of message copies, the problem of low message transmission flexibility is solved, and CPU processing performance is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUXI DAPU LIANXIN TECHNOLOGY CO LTD
- Filing Date
- 2025-12-29
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, the number of forwardings cannot be changed in real time during message transmission, resulting in low flexibility, increased CPU load, and reduced processing performance.
By introducing a caching module, a parsing module, a replication module, and a dequeue module into the message forwarding system, and by utilizing the controller of the parsing module to work in coordination with the replication module, the number of message copies can be dynamically updated, thereby improving transmission flexibility and avoiding CPU involvement.
This improves the flexibility of message transmission, avoids CPU occupancy, and ensures the CPU's performance in processing actual business operations.
Smart Images

Figure CN121967352A_ABST
Abstract
Description
A message forwarding method, a message forwarding system, and a storage medium Technical Field
[0001] The present invention relates to the field of message transmission technology, and in particular to a message forwarding method, a message forwarding system and a storage medium. Background Technology
[0002] During message transmission, depending on different service requirements, messages may be required to perform unicast, multicast, or broadcast operations. Because of the different service types, messages need to be forwarded to different receivers according to the number of forwarding attempts. Currently, the storage, forwarding, and release of identical messages with multiple destination addresses are inadequate.
[0003] Related technologies differentiate between unicast and multicast, and use CPU software configuration to fix the detection of unicast and multicast message addresses to set the number of message forwardings. However, the number of message forwardings cannot be changed in real time during transmission, resulting in low flexibility. This requires CPU involvement, increases CPU load, and reduces the performance of processing services. Summary of the Invention
[0004] In view of this, one objective of the embodiments of the present invention is to provide a message forwarding method, a message forwarding system, and a storage medium to improve the technical problems of low flexibility in message transmission and low performance in actual business processing in related technologies.
[0005] To solve the above-mentioned technical problems, embodiments of the present invention provide the following technical solutions: Firstly, embodiments of the present invention provide a message forwarding method applied to a message forwarding system. The message forwarding system includes a caching module, a parsing module, a copying module, and a dequeue module. The dequeue module is communicatively connected to the caching module, the parsing module, and the copying module. The parsing module is also communicatively connected to the caching module and the copying module. The parsing module includes a controller, which is communicatively connected to the copying module. The message forwarding method includes: the caching module receiving and storing message information and description information of a message, and sending the message information and description information to the parsing module; the controller sending multiple idle first register addresses to the parsing module; and the parsing module parsing the message information to obtain the message forwarding information and dequeue information. The message forwarding information is sent to the replication module. The forwarding information includes the target number of copies of the message and the target register address. The dequeue information includes descriptive information, the target replication identifier of the message, and the target register address, which can be any one of a plurality of first register addresses. In response to receiving the forwarding information, the replication module generates feedback information and sends the feedback information to the parsing module. The forwarding information is then sent to the controller. The feedback information indicates that the replication module has received the forwarding information. In response to receiving the forwarding information, the controller stores the target number of copies in the target register address. In response to receiving the feedback information, the parsing module sends dequeue information to the dequeue module. The dequeue module schedules the message to be dequeued from the buffer module according to the dequeue information.
[0006] In some embodiments, the parsing module parses the message information to obtain the message forwarding information and dequeue information, including: parsing the message information to extract the target replication identifier, target replication number and target register address of the message; combining the target replication number and target register address to obtain forwarding information; and combining the description information, target replication identifier and target register address to obtain dequeue information.
[0007] In some embodiments, the dequeue module schedules packets to be dequeued from the cache module based on the dequeue information, including: responding to the target replication identifier being a first replication identifier, and scheduling the packet to be dequeued, wherein the first replication identifier is used to indicate that the packet is a packet that does not need to be replicated.
[0008] In some embodiments, the dequeue module schedules packets to be dequeued from the cache module according to the dequeue information, including: responding to the target replication identifier being a second replication identifier, sending the target register address and description information to the replication module so that the replication module updates the target replication count according to the target register address, and sending the target register address and description information to the controller so that the controller updates the target replication count according to the target register address, wherein the second replication identifier is used to indicate that the packet is a packet that needs to be replicated; and scheduling the packet to be dequeued.
[0009] In some embodiments, the controller updates the target number of copies based on the target register address, including: in response to receiving the target register address, updating the target number of copies to the difference between the current number of copies stored at the target register address and 1; in response to the target number of copies being zero, controlling the cache module to delete message information and description information to release the storage space occupied by the message.
[0010] In some embodiments, controlling the caching module to delete message information and description information to release the storage space occupied by the message includes: generating a storage space release request based on the description information; deleting the target copy number stored at the target register address to obtain a free second register address, and resending the second register address to the parsing module; sending the storage space release request to the caching module so that the caching module deletes the message information and description information according to the storage space release request to release the storage space occupied by the message.
[0011] In some embodiments, the controller, in response to receiving forwarding information, stores the target number of copies to the target register address, including: in response to the first receipt of forwarding information, storing the target number of copies in the forwarding information to the target register address; and in response to any subsequent receipt of forwarding information, determining the sum of the target number of copies in each received forwarding information and the current number of copies stored at the target register address as the new target number of copies stored at the target register address.
[0012] In some embodiments, the message forwarding system further includes an enqueue module, which is communicatively connected to the cache module. The method further includes: the enqueue module receiving a message and storing the message in the cache module in response to the cache module being in a message-receiving state.
[0013] Secondly, embodiments of the present invention provide a message forwarding system, including: a caching module, a parsing module, a replication module, and a dequeue module. The dequeue module is communicatively connected to the caching module, the parsing module, and the replication module. The parsing module is also communicatively connected to the caching module and the replication module. The parsing module includes a controller, which is communicatively connected to the replication module. The message forwarding system is configured to execute any of the message forwarding methods proposed in the first aspect.
[0014] Thirdly, embodiments of the present invention provide a computer-readable storage medium storing processor-executable computer program instructions, which, when executed by a processor, cause the computer to perform any of the message forwarding methods proposed in the first aspect.
[0015] The embodiments of the present invention have the following beneficial effects: Unlike related technologies, the message forwarding method provided in the embodiments of the present invention is applied to a message forwarding system. The message forwarding system includes a caching module, a parsing module, a copying module, and a dequeueing module. The dequeueing module is communicatively connected to the caching module, the parsing module, and the copying module. The parsing module is also communicatively connected to the caching module and the copying module. The parsing module includes a controller, which is communicatively connected to the copying module. The method includes: a caching module receiving and storing message information and description information, sending the message information and description information to a parsing module, a controller sending multiple idle first register addresses to the parsing module, the parsing module parsing the message information to obtain the message forwarding information and dequeue information, and sending the forwarding information to a replication module. The forwarding information includes the target number of copies of the message and the target register address. The dequeue information includes description information, the target replication identifier of the message, and the target register address. The target register address is any one of the multiple first register addresses. In response to receiving the forwarding information, the replication module generates feedback information and sends the feedback information to the parsing module. The forwarding information is sent to the controller. The feedback information is used to indicate that the replication module has received the forwarding information. In response to receiving the forwarding information, the controller stores the target number of copies in the target register address. In response to receiving the feedback information, the parsing module sends dequeue information to the dequeue module. The dequeue module schedules messages to be dequeued from the caching module according to the dequeue information.
[0016] This invention, through the coordinated operation of the parsing module's controller and the replication module, dynamically updates the number of message copies, improving the flexibility of message transmission. Furthermore, the entire process does not require CPU involvement, thus not consuming the CPU's workload for processing actual business operations and ensuring the CPU's performance in processing actual business operations. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the accompanying drawings used in the description of the related technologies or embodiments will be briefly introduced below. Obviously, the drawings described below only show some embodiments of the present invention and should not be considered as limiting the scope of protection. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 is a schematic diagram of an application scenario of the packet forwarding method provided in some embodiments of the present invention; Figure 2 is a schematic diagram of the structure of the packet forwarding system provided in some embodiments of the present invention; Figure 3A is a schematic diagram of the flowchart of the packet forwarding method provided in some embodiments of the present invention; Figure 3B is a schematic diagram of the structure of the controller in the packet forwarding system provided in some embodiments of the present invention; Figure 4 is a schematic diagram of the structure of the packet forwarding system provided in other embodiments of the present invention; Figure 5 is a schematic diagram of the structure of the cache module in the packet forwarding system provided in some embodiments of the present invention; Figure 6 is an interactive schematic diagram of the packet forwarding system provided in some embodiments of the present invention when executing the packet forwarding method; Figure 7 is an interactive schematic diagram of the packet forwarding system provided in other embodiments of the present invention when executing the packet forwarding method.
[0019] Explanation of reference numerals in the attached diagram: 100, Message forwarding system; 101, Network interface card (NIC); 110, Buffer module; 111, First buffer unit; 112, Second buffer unit; 120, Parsing module; 121, Controller; 1211, Register array; 1212, Copy feedback buffer; 1213, Free pointer buffer; 1214, Space release buffer; 130, Copy module; 140, Dequeue module; 150, Enqueue module; 200, Host. Detailed Implementation
[0020] To make the objectives and advantages of the embodiments of the present invention more readily understood, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. The detailed description of the embodiments of the present invention in the accompanying drawings is not intended to limit the scope of protection claimed by the present invention, but only to illustrate selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] It should be noted that, unless there is a conflict, the various technical features involved in the embodiments of the present invention described below can be combined with each other, and all are within the protection scope of the present invention. Furthermore, although functional modules are divided in the device or structural schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. In addition, the terms "first," "second," "third," and other similar expressions used herein do not limit the data or execution order, but are only for illustrative purposes and to distinguish identical or similar items with substantially the same function and effect, and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features.
[0022] Unless otherwise defined, the technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. It should be understood that the term "and / or" as used herein includes any and all combinations of one or more of the listed items.
[0023] During message transmission, depending on different service requirements, messages may be required to perform unicast, multicast, or broadcast operations. Because of the different service types, messages need to be forwarded to different receivers according to the number of forwarding attempts. Currently, the storage, forwarding, and release of identical messages with multiple destination addresses are inadequate.
[0024] Related technologies differentiate between unicast and multicast, and use CPU software configuration to fix the packet forwarding count by detecting unicast and multicast packet addresses. However, the packet forwarding count cannot be changed in real time during packet transmission, resulting in low flexibility. This requires CPU involvement, increases CPU load, and reduces the performance of processing actual business operations.
[0025] In view of this, embodiments of the present invention provide a message forwarding method applied to a message forwarding system. The message forwarding system includes a caching module, a parsing module, a replication module, and a dequeue module. The dequeue module is communicatively connected to the caching module, the parsing module, and the replication module. The parsing module is also communicatively connected to the caching module and the replication module. The parsing module includes a controller, which is communicatively connected to the replication module. Embodiments of the present invention achieve dynamic updating of the number of message copies by coordinating the controller of the parsing module and the replication module, improving the flexibility of message transmission. The entire process does not require the host CPU's involvement, does not occupy the host CPU's load for processing actual business operations, and ensures the performance of the host CPU in processing actual business operations.
[0026] Please refer to Figures 1 and 2 together. Figure 1 schematically shows an application scenario of the message forwarding method provided by some embodiments of the present invention, and Figure 2 schematically shows the structure of the message forwarding system provided by some embodiments of the present invention.
[0027] As shown in Figure 1, this application scenario includes a network interface card (NIC) 101 and a host 200. The NIC 101 communicates with the host 200 via a network. The NIC 101 includes a packet forwarding system (not shown in Figure 1). Examples of networks include, but are not limited to, the Internet, corporate intranets, local area networks (LANs), mobile communication networks, and combinations thereof.
[0028] Referring to Figure 2, the message forwarding system 100 includes a caching module 110, a parsing module 120, a replication module 130, and a dequeue module 140. The dequeue module 140 is communicatively connected to the caching module 110, the parsing module 120, and the replication module 130. The parsing module 120 is also communicatively connected to the caching module 110 and the replication module 130. The parsing module 120 includes a controller 121, which is communicatively connected to the replication module 130.
[0029] The general processing flow of the message forwarding method provided in this embodiment of the invention is as follows: For example, after receiving the message transmitted by the host 200, the network card 101 transmits the message to the message forwarding system 100 for forwarding processing.
[0030] The message forwarding system 100 receives messages and stores them in the cache module 110. The cache module 110 receives and stores the message information and description information of the messages, and sends the message information and description information to the parsing module 120.
[0031] The controller 121 sends multiple idle first register addresses to the parsing module 120.
[0032] Specifically, the parsing module 120 parses the message information to obtain the message forwarding information and dequeue information, and sends the forwarding information to the replication module 130. It should be understood that the forwarding information includes the target number of copies of the message and the target register address.
[0033] For example, in response to receiving forwarding information, the copying module 130 generates feedback information and sends the feedback information to the parsing module 120, and sends the forwarding information to the controller 121.
[0034] For example, in response to receiving forwarding information, controller 121 parses out the target number of copies and the target register address in the forwarding information, and stores the target number of copies in the target register address.
[0035] Specifically, in response to receiving feedback information, parsing module 120 sends dequeue information to dequeue module 140, causing dequeue module 140 to schedule message dequeueing.
[0036] The dequeue module 140 schedules messages to be dequeued from the cache module 110 based on dequeue information (such as the storage address of message information, the target copy identifier of the message, etc.).
[0037] In some embodiments, the target number of copies is 3, which means that the message needs to be copied and forwarded 3 times. After executing the above message forwarding process, as shown in Figure 1, the message is finally copied and forwarded 3 times.
[0038] The following describes in detail the message forwarding method provided by the embodiments of the present invention. It can be understood that the message forwarding method is applied to a message forwarding system (such as the message forwarding system 100 mentioned above). Please refer to Figure 3A, which schematically shows a flowchart of the message forwarding method provided by some embodiments of the present invention.
[0039] As shown in Figure 3A, the message forwarding method includes, but is not limited to, the following steps S31-S37: S31: The buffer module receives and stores the message information and description information of the message, and sends the message information and description information to the parsing module.
[0040] The description information includes the message length, a first storage address, and a second storage address. The first storage address is where the message information is stored in the caching module, and the second storage address is where the description information is stored in the caching module. Message information refers to the data portion of the message, such as the message header and the data it carries.
[0041] For example, after receiving a message, the message forwarding system sends the message to the caching module. The caching module receives and stores the message information and description information of the message, and then sends the message information and description information to the parsing module.
[0042] In some embodiments, the caching module sends message information and description information of a fixed message length to the parsing module according to a fixed message length.
[0043] In other embodiments, the total length of the message information and the description information is the maximum message length or the first message length.
[0044] For example, the caching module determines the message length when sending a message according to a preset maximum message length or a configured first message length (such as the first message length being configured in the message header length configuration information). The caching module sends the message information and description information of the maximum message length or the first message length to the parsing module according to the maximum message length or the first message length.
[0045] The maximum message length refers to the length of the message to be sent if no specific message length is configured. If so, the message will be sent according to the maximum message length (e.g., 512 bytes). If the entire length of the current message is less than 512 bytes, the entire message will be sent to the parsing module. The first message length refers to the length of the message to be sent if the specific message length is configured as the first message length. If so, the message will be sent to the parsing module according to the first message length. If the first message length is greater than the actual message length, the message will be sent to the parsing module according to the actual message length.
[0046] S32: The controller sends multiple idle first register addresses to the parsing module.
[0047] For example, after the parsing module has completed its reset and release, the controller sends an enable signal to the replication module to enable it. Simultaneously, the controller sends multiple free first register addresses to the parsing module. Referring to Figure 3B, for instance, the controller 121 includes a register array 1211, a replication feedback buffer 1212, a free pointer buffer 1213, and a space release buffer 1214. The controller 121 filters out one or more free first register addresses from the register array 1211 and sends these addresses sequentially to the parsing module via the free_idx_req interface.
[0048] It is understandable that parsing module reset release means that the parsing module and the copying module may be in different clock domains, and the reset releases in different clock domains are not synchronized. The basis for determining that the parsing module reset release is complete is that the parsing module must be released first in chip operation, and the copying module enable signal can only be configured after waiting for at least 3 clock cycles. For example, the copying module enable signal can be configured through the register while waiting for 4 clock cycles.
[0049] S33: The parsing module parses the message information, obtains the message forwarding information and dequeue information, and sends the forwarding information to the replication module.
[0050] The forwarding information includes the target number of copies of the message and the target register address. The dequeue information includes descriptive information, the target copy identifier of the message, and the target register address. The target register address is any one of a plurality of first register addresses. At this time, the message is still stored in the buffer module.
[0051] For example, the parsing module parses packets of fixed length, actual length, first length, or maximum length to obtain forwarding and dequeue information, and then sends the forwarding information to the replication module. For instance, referring to Figure 3B, the parsing module transmits the forwarding information to the replication module via the rel_req interface of controller 121.
[0052] S34: Upon receiving the forwarding information, the copy module generates feedback information and sends the feedback information to the parsing module, which then sends the forwarding information to the controller.
[0053] In this embodiment, the feedback information is used to indicate that the replication module has received the forwarding information, that is, the replication module has received the total number of copies of the replication message that need to be copied and forwarded.
[0054] For example, after receiving the forwarding information, the replication module generates feedback information and sends the feedback information to the parsing module, and also sends the forwarding information to the controller. For example, referring to Figure 3B, the replication module transmits the feedback information (i.e., rel_ack information) to the parsing module through the controller 121, and transmits the forwarding information to the controller 121 through the rel_req interface of the controller 121.
[0055] It is understandable that the replication module will only generate and send feedback information to the parsing module when the parsing module requests a replicated packet. Specifically, the replication module will only generate and send feedback information to the parsing module if the target number of replicates in the forwarding information is greater than or equal to 2. If the parsing module requests a non-replicated packet, the replication module will not generate and send feedback information; that is, the replication module will not generate and send feedback information if the target number of replicates in the forwarding information is less than 2. Specifically, the parsing module will only send forwarding information to the replication module when the requested packet is a replicated packet, thus enabling the replication module to generate and send feedback information to the parsing module after receiving the forwarding information.
[0056] S35: In response to receiving the forwarding information, the controller stores the target number of copies in the target register address.
[0057] For example, after receiving the forwarding information, the controller finds the target register address among a plurality of idle first register addresses and stores the target copy number in the target register address.
[0058] In some embodiments, in response to receiving forwarding information, the controller stores the target number of copies to the target register address, specifically including but not limited to the following steps S351-S352: S351: In response to receiving forwarding information for the first time, the controller stores the target number of copies in the forwarding information to the target register address.
[0059] S352: In response to any subsequent received forwarding information, the sum of the target copy number in each received forwarding information and the current copy number stored at the target register address is determined as the new target copy number stored at the target register address.
[0060] For example, if it is the first time forwarding information is received, the controller parses the forwarding information, extracts the target number of copies and the target register address from the forwarding information, and stores the target number of copies in the target register address. If it is any subsequent time forwarding information is received (i.e., any number of times other than the first time forwarding information is received), the controller obtains the current number of copies stored in the target register address, adds the current number of copies stored in the target register address to the target number of copies in each received forwarding information, and obtains a reference copy value (i.e., the sum of the target number of copies in each received forwarding information and the current number of copies stored in the target register address). The reference copy value is determined as the new target number of copies stored in the target register address. Each time a forwarding message is received and the target copy number stored in the target register address is updated, the new target copy number stored in the target register address after the previous update is the current copy number stored in the target register address during this update. For example, when the forwarding message is received for the first time, the target copy number (e.g., 3 times) is directly stored in the target register address. When the forwarding message is received for the second time (where the target copy number is 2 times and the target register address remains unchanged), when the target copy number stored in the target register address is updated, the new target copy number stored in the target register address after the previous (i.e., the first) update (i.e., 3 times) is the current copy number stored in the target register address during this update. After this update, the new target copy number stored in the target register address is the sum of the current copy number 3 times stored in the target register address and the target copy number 2 times in the second forwarding message (i.e., 5 times).
[0061] In some embodiments, referring to Figure 3B, if forwarding information is received for any subsequent time, the controller 121 updates the target replication count and writes the target register address into the replication feedback buffer 1212, waiting for the parsing module to receive feedback information (i.e., rel_ack information). It should be understood that the parsing module is only allowed to send dequeue information to the dequeue module after receiving feedback information from the replication module, thus enabling the dequeue module to schedule message dequeueing. The requirement that the parsing module is only allowed to send dequeue information to the dequeue module after receiving feedback information from the replication module applies to messages that require replication. For messages that do not require replication, the parsing module can directly send dequeue information to the dequeue module.
[0062] It is understandable that the parsing module may perform multiple copying operations during message processing. Each time the current message is copied, the target number of copies is written to the copying module via the controller's rel_req interface (e.g., the rel_req interface of controller 121 shown in Figure 3B), awaiting feedback from the controller. If the parsing module needs to copy the message again, it updates the target number of copies to the same target register address again via the controller's rel_req interface. Different message copying requests are considered different message editing operations by both the dequeue module and the controller. However, since there is only one copy of the current message, multiple copying operations will not increase the message buffer space.
[0063] The multiple copying instances during message processing by the parsing module are due to the number of table lookups. When the original message enters the parsing module, an initial table lookup is performed. If copying is required, the target number of copies is written to the target register address. Subsequent processing involves further table lookups to determine if copying is necessary. In these follow-up instances, one or more copies of the message are copied, the number determined by the target number of copies. Each subsequent write to the target register address represents the target number of copies. The new target number of copies stored at the target register address is the sum of the current number of copies stored thereand and the target number of copies written each time.
[0064] S36: Upon receiving feedback information, the parsing module sends dequeue information to the dequeue module.
[0065] For example, after receiving feedback information from the module copy module, it indicates that the copy module has received the forwarding information and is ready to forward the message, and the parsing module sends dequeue information to the dequeue module.
[0066] The feedback information refers to the fact that each time the target number of copies is written to the target register address, the copy module needs to return a copy write completion response as feedback information. The parsing module can only send the dequeue information of the current message to the dequeue module after receiving the feedback information.
[0067] S37: The dequeue module schedules messages to be dequeued from the cache module based on the dequeue information.
[0068] For example, after receiving the dequeue information, the dequeue module reads the packets that need to be dequeued from the dequeue packet queue in the cache module according to the target replication identifier and target register address of the packets in the dequeue information, and schedules the packets that need to be dequeued to be dequeued.
[0069] This invention, through the coordinated operation of the parsing module's controller and the replication module, dynamically updates the number of message copies, improving the flexibility of message transmission. Furthermore, the entire process does not require CPU involvement, thus not consuming the CPU's workload for processing actual business operations and ensuring the CPU's performance in processing actual business operations.
[0070] In some embodiments, the parsing module parses the message information to obtain the message forwarding information and dequeue information, specifically including but not limited to the following steps S331-S333: S331: Parse the message information and extract the message's target replication identifier, target replication number and target register address.
[0071] For example, the parsing module parses message information of fixed message length, actual message length, maximum message length, or first message length, and extracts the target replication identifier, target replication count, and target register address. The target replication identifier indicates whether the message needs to be replicated, and the target replication count refers to the total number of copies (i.e., the total number of replication and forwarding times) required to replicate the message. The target replication count is a positive integer greater than or equal to 2.
[0072] S332: Combine the number of target copies and the target register address to obtain forwarding information.
[0073] S333: Combine the description information, target copy identifier, and target register address to obtain the dequeue information.
[0074] In this embodiment, the target copy number and target register address are combined and packaged together to obtain forwarding information, and the description information, target copy identifier and target register address are combined and packaged together to obtain dequeue information.
[0075] In some embodiments, the dequeue module schedules packets to be dequeued from the cache module according to the dequeue information, including but not limited to the following steps S371: S371: If the target replication identifier is the first replication identifier, the packet is scheduled to be dequeued.
[0076] The first replication identifier is used to indicate that the message does not need to be replicated.
[0077] Specifically, the dequeue module parses the dequeue information, extracts the description information, target replication identifier and target register address from the dequeue information, and checks whether the target replication identifier is the first replication identifier. When the target replication identifier is the first replication identifier, it means that the message does not need to be replicated and can be directly scheduled for dequeue. The dequeue module directly schedules the message for dequeue from the cache module.
[0078] In some embodiments, the dequeue module schedules messages to be dequeued from the cache module according to the dequeue information, specifically including but not limited to the following steps S372-S373: S372: In response to the target replication identifier being the second replication identifier, the module sends the target register address and description information to the replication module so that the replication module updates the target replication count according to the target register address, and sends the target register address and description information to the controller so that the controller updates the target replication count according to the target register address.
[0079] The second replication identifier is used to indicate that the message is a message that needs to be replicated.
[0080] Specifically, the dequeue module parses the dequeue information, extracts the description information, target replication identifier, and target register address, and checks whether the target replication identifier is the second replication identifier. If the target replication identifier is the second replication identifier, it means that the message needs to be replicated and cannot be directly scheduled for dequeueing. The dequeue module then sends the target register address and description information to the replication module. Upon receiving the target register address and description information, the replication module updates the target replication count based on the target register address. That is, it subtracts 1 from the current replication count to update the new target replication count. Subtracting 1 indicates that the dequeue module has scheduled one dequeue forwarding of the message this time.
[0081] For example, the replication module also sends the target register address and description information to the controller. Referring to Figure 3B, the replication module writes the target register address and description information to the controller 121 via the rel_dec interface. After receiving the target register address and description information, the controller updates the target replication count based on the target register address. That is, it subtracts 1 from the current replication count to update the new target replication count. Similarly, subtracting 1 indicates that the dequeue module forwards the scheduled message once this time.
[0082] S373: Dequeue the message.
[0083] Specifically, after the above operations are completed (i.e., after both the replication module and the controller update the target number of copies), the dequeue module schedules the packets out of the cache module.
[0084] In some embodiments, the controller updates the target number of copies based on the target register address, including but not limited to the following steps S38-S39: S38: In response to receiving the target register address, the target number of copies is updated to the difference between the current number of copies stored at the target register address and 1.
[0085] Specifically, after receiving the target register address, the controller obtains the current number of copies stored in the target register address, subtracts 1 from the current number of copies stored in the target register address to obtain the updated number of copies, and updates the target number of copies to the updated number of copies.
[0086] For example, if the current replication count is 5, after receiving the target register address, the controller subtracts 1 from the current replication count of 5 to obtain the updated replication count value. Update the target number of copies to the copy number update value of 4.
[0087] S39: In response to the target number of copies being zero, control the cache module to delete message information and description information to release the storage space occupied by the message.
[0088] For example, when the target number of copies is zero, it indicates that all original and copied messages in the cache module have been processed (i.e., all messages have been forwarded to the corresponding receivers). The cache module is then controlled to delete message information and description information to release the storage space occupied by the messages. For example, referring to Figure 3B, the controller 121 generates a storage space release request based on the description information and writes the storage space release request into the storage space release cache 1214. The storage space release request is sent to the cache module through the rls_req interface, thereby the cache module deletes message information and description information according to the storage space release request, releasing the storage space occupied by the messages.
[0089] In some embodiments, the control cache module deletes message information and description information to release the storage space occupied by the message, including but not limited to the following steps S391-S393: S391: Generate a storage space release request based on the description information.
[0090] S392: Delete the number of target copies stored at the target register address, obtain the free second register address, and resend the second register address to the parsing module.
[0091] S393: Send a storage space release request to the cache module so that the cache module can delete the message information and description information according to the storage space release request, so as to release the storage space occupied by the message.
[0092] For example, the controller generates a storage space release request based on the description information, and the storage space release request includes the description information. The controller deletes the number of target copies stored at the target register address to obtain the free second register address, and resends the second register address to the parsing module. For example, referring to Figure 3B, the controller 121 writes the second register address to the free pointer cache 1213, and sends the free pointer of the second register address to the parsing module again through the free_idx_req interface according to the FIFO write order, waiting for the parsing module to receive the free pointer.
[0093] The controller sends a storage space release request to the caching module, which then deletes the message information and description information based on the request to release the storage space occupied by the message. Specifically, the caching module parses the storage space release request, extracts the description information from it, determines the message's storage location and data information based on the description information, and then deletes the message information and description information, thereby releasing the storage space occupied by the message.
[0094] Please refer to Figure 4, which schematically illustrates the structure of a message forwarding system provided in some other embodiments of the present invention.
[0095] Referring to Figure 4, the message forwarding system 100 also includes an enqueue module 150, which is communicatively connected to the buffer module 110.
[0096] In some embodiments, the message forwarding method further includes, but is not limited to, the following step S40: S40: The queuing module responds to the cache module being in a message-receiving state, receives the message, and stores the message in the cache module.
[0097] It is understood that the message-receiving state refers to the state in which the cache module has storage space to store messages. In some embodiments, a status flag is used to characterize whether the cache module is in the message-receiving state. For example, when the status flag of the cache module is the first flag, the cache module is in the message-receiving state; when the status flag of the cache module is the second flag or other conditions, the cache module is not in the message-receiving state. It should be understood that the enqueue module only receives and stores messages when the cache module is in the message-receiving state.
[0098] In this embodiment of the invention, when the caching module is detected to be in a message-receiving state, the enqueue module receives the message and stores it in the caching module. When the caching module is detected to be not in a message-receiving state, the enqueue module refuses to receive the message.
[0099] Please refer to Figure 5, which schematically illustrates the structure of a cache module in a message forwarding system provided in some embodiments of the present invention.
[0100] As shown in Figure 5, the cache module 110 includes a first cache unit 111 and a second cache unit 112.
[0101] In some embodiments, the queuing module responds to the cache module being in a message-receiving state, receives the message and stores the message in the cache module, specifically including but not limited to the following steps S401-S404: S401: In response to not receiving the message discard flag or pause storage flag of the first cache unit, it is determined that the cache module is in a message-receiving state.
[0102] S402: Receive a message and store the message information in the first buffer unit.
[0103] S403: Generate description information based on the storage address of the message information in the first buffer unit.
[0104] S404: Store the description information in the second cache unit.
[0105] In this embodiment of the invention, the message information is stored in the first cache unit, and the message description information is stored in the second cache unit.
[0106] It should be understood that the first cache unit is divided into three storage spaces: dedicated storage space, shared storage space, and spare storage space (i.e., headroom space). During the caching process, the first cache unit will allocate upper and lower limits for the attributes of each storage space to each message queue, and set a discardable attribute for each message queue.
[0107] When a message queue is deemed non-discardable, it continues to use the shared storage waterline after its dedicated storage space is used. When the allocated shared storage space is also used by the same message queue and reaches the waterline, a pause storage flag is generated to indicate that the message queue can no longer store messages. After receiving the pause storage flag, the enqueue module must wait for space to be released before accepting message storage requests.
[0108] For message queues that can be discarded, once the exclusive storage space of the message queue reaches the waterline, a message discard flag is generated directly to indicate that the message queue can no longer store messages. After receiving the message discard flag, the enqueue module will directly determine that any messages requesting to continue entering the message queue are discarded and will not store the message queue in the first buffer unit.
[0109] If no message discard flag or pause storage flag is received from the first cache unit, it indicates that the first cache unit has sufficient storage space to store messages. Therefore, the cache module is determined to be in a message-receiving state. At this time, the enqueue module receives the message and stores its message information in the first cache unit. The enqueue module obtains the storage address of the message information in the first cache unit, generates description information based on this address, and stores the description information in the second cache unit.
[0110] If a message drop flag or a pause storage flag is received from the first buffer unit, it indicates that the first buffer unit does not have sufficient storage space to store messages. In this case, the buffer module is determined to be in an unreceiveable message state. For the non-droppable message queue, when the shared storage space reaches the waterline, the enqueue module sends a request to postpone message transmission to the peer network card. After receiving the request, the peer network card will not continue to send messages to the local network card. The existence of the spare storage space is to buffer the number of messages sent during the period from when the shared storage space waterline is reached until the peer network card receives the request to postpone message transmission and pauses message transmission. The size of the spare storage space needs to be determined based on the number of messages sent by the peer network card during this period. The purpose of the spare storage space is to completely absorb the messages sent by the peer network card during this period, thereby ensuring that non-droppable messages are not dropped.
[0111] In some embodiments, before determining whether to receive a message, the enqueue module prefetches the free pointer of the first buffer unit. Prefetching means sending a message storage request to the first buffer unit in advance. If the first buffer unit has available storage space, it will respond to the message storage request and return the storage address of the available message to the enqueue module. If there is no available storage space, the first buffer unit will not return a free storage address.
[0112] In this context, the free pointer of the first cache unit refers to the smallest contiguous storage unit within the first cache unit. One free pointer represents 128 bytes of contiguous storage space. For example, if a free pointer 0 is obtained, the contiguous storage locations within the first cache unit are address 0, address 1, address 2, and address 3. One address represents one storage space, and one storage space can store 32 bytes of data.
[0113] The storage addresses of the description information in the second buffer unit are discrete and unrelated; there is no connection between the description information of each message. The storage addresses of the first buffer unit are implemented using a linked list structure. According to the linked list structure, a consecutive message may be stored in a non-consecutive address. For example, a message with a length of 4KB, when stored in the first buffer unit, is not necessarily stored in the range of addresses 0 to 127, but may be stored in a range of 128 non-consecutive memory locations, such as 1, 3, 4, 9, 11, ... . The second buffer unit stores the first storage address of the message, the storage address of the last data segment, and the length of the message.
[0114] The following is a brief description of the general process of the message forwarding method provided in the embodiment of the present invention, with reference to Figures 6 and 7: 1) The queuing module receives the message and transmits the message to the caching module in response to the caching module being in a message-receiving state.
[0115] 2) The caching module receives and stores the message information and description information of the message, and sends the message information and description information to the parsing module.
[0116] 3) The controller sends an enable signal to the replication module to enable the replication module, and at the same time, sends multiple free first register addresses to the parsing module.
[0117] 4) The parsing module parses the message information, obtains the forwarding information and dequeue information, and sends the forwarding information to the replication module.
[0118] 5) After receiving the forwarding information, the copying module generates feedback information, sends the feedback information to the parsing module, and sends the forwarding information to the controller.
[0119] 6) The controller stores the target number of copies in the target register address.
[0120] 7) After receiving the feedback information, the parsing module sends the dequeue information to the dequeue module.
[0121] 8) The dequeue module schedules messages to be dequeued from the cache module based on the dequeue information.
[0122] 9) The dequeue module checks the replication identifier carried in the message. When the replication identifier carried in the message is the first replication identifier, the message is dequeued from the buffer module and sent to the receiving end. When the replication identifier carried in the message is the second replication identifier, the message is dequeued from the buffer module and sent to the receiving end, and the destination register address and description information are sent to the replication module.
[0123] 10) The copy module sends the target register address and description information to the controller.
[0124] 11) The controller updates the target copy number according to the target register address. When the target copy number drops to zero, the controller deletes the message information and description information to release the storage space occupied by the message. That is, the controller generates a storage space release request according to the description information and sends the storage space release request to the cache module.
[0125] 12) The cache module deletes the message information and description information of the message based on the storage space release request.
[0126] In summary, the message forwarding method provided in this embodiment of the invention is applied to a message forwarding system. The message forwarding system includes a caching module, a parsing module, a replication module, and a dequeue module. The dequeue module is communicatively connected to the caching module, the parsing module, and the replication module. The parsing module is also communicatively connected to the caching module and the replication module. The parsing module includes a controller, which is communicatively connected to the replication module.
[0127] This invention, through the coordinated operation of the parsing module's controller and the replication module, dynamically updates the number of message copies, improving the flexibility of message transmission. Furthermore, the entire process does not require CPU involvement, thus not consuming the CPU's workload for processing actual business operations and ensuring the CPU's performance in processing actual business operations.
[0128] This invention provides a computer-readable storage medium storing processor-executable computer program instructions. When executed by a processor, the computer program instructions cause the computer to perform any of the message forwarding methods provided in this invention, or to perform the steps in any possible implementation of any of the message forwarding methods provided in this invention.
[0129] In some embodiments, the storage medium may be a flash memory, a hard disk, an optical disk, a register, a magnetic surface memory, a removable disk, a CD-ROM, a random access memory (RAM), a read-only memory (ROM), an electrically programmable ROM, and an electrically erasable programmable ROM, or any other form of storage medium known in the art, or various devices including one or any combination of the above storage media.
[0130] In some embodiments, computer program instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0131] As an example, computer program instructions may, but do not necessarily, correspond to files in a file system, and may be stored as part of a file that holds other programs or data, for example, in one or more scripts in an HTML (Hypertext Markup Language) document, or in a single file dedicated to the program in question, or in multiple collaborative files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0132] As an example, computer program instructions can be deployed to execute on a single computing device (including devices such as smart terminals and servers), or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network. It is readily understood that all or part of the steps of the methods described in the embodiments of the present invention above can be implemented directly using electronic hardware or processor-executable computer program instructions, or a combination of both.
[0133] Those skilled in the art will understand that the embodiments provided by this invention are merely illustrative. The order in which the steps in the methods of the embodiments are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The order can be adjusted, merged, and deleted according to actual needs. Modules or sub-modules, units or sub-units in the apparatus or system of the embodiments can be merged, divided, and deleted according to actual needs. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0134] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, and of course, it can also be implemented using hardware. Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. It should be understood that the storage medium can be flash memory, hard disk, optical disk, register, magnetic surface memory, removable disk, CD-ROM, random access memory (RAM), read-only memory (ROM), electrically programmable ROM, and electrically erasable programmable ROM, etc.
[0135] It should be noted that the above embodiments are for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. Those skilled in the art can understand that all or part of the processes of the above embodiments can be implemented by modifying the technical solutions described in the embodiments of the present invention, or by making equivalent substitutions for some of the technical features. It is understood that these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and should be considered as equivalent changes and modifications made based on the embodiments of the present invention, all of which should fall within the scope of the claims of the present invention.
Claims
1. A message forwarding method, characterized in that, An application is provided in a message forwarding system. The message forwarding system includes a caching module, a parsing module, a replication module, and a dequeue module. The dequeue module is communicatively connected to the caching module, the parsing module, and the replication module. The parsing module is also communicatively connected to the caching module and the replication module. The parsing module includes a controller, which is communicatively connected to the replication module. The message forwarding method includes: the caching module receiving and storing message information and description information of the message, and sending the message information and description information to the parsing module; the controller sending multiple idle first register addresses to the parsing module; the parsing module parsing the message information to obtain forwarding information and dequeue information of the message, and sending the forwarding information to the replication module. The forwarding information includes the message... The target number of copies and the target register address are specified. The dequeue information includes the description information, the target copy identifier of the packet, and the target register address, which is any one of a plurality of the first register addresses. In response to receiving the forwarding information, the replication module generates feedback information and sends it to the parsing module. The forwarding information is also sent to the controller. The feedback information indicates that the replication module has received the forwarding information. In response to receiving the forwarding information, the controller stores the target number of copies in the target register address. In response to receiving the feedback information, the parsing module sends the dequeue information to the dequeue module. The dequeue module schedules the packet to be dequeued from the cache module according to the dequeue information.
2. The message forwarding method according to claim 1, characterized in that, The parsing module parses the message information to obtain the message's forwarding information and dequeue information, including: parsing the message information to extract the message's target replication identifier, target replication count, and target register address; combining the target replication count and the target register address to obtain the forwarding information; and combining the description information, the target replication identifier, and the target register address to obtain the dequeue information.
3. The message forwarding method according to claim 1, characterized in that, The dequeue module schedules the packet to be dequeued from the cache module according to the dequeue information, including: responding to the target replication identifier being a first replication identifier, scheduling the packet to be dequeued, wherein the first replication identifier is used to indicate that the packet is a packet that does not need to be replicated.
4. The message forwarding method according to claim 1, characterized in that, The dequeue module schedules the packet to be dequeued from the cache module according to the dequeue information, including: responding to the target replication identifier being a second replication identifier, sending the target register address and the description information to the replication module, so that the replication module updates the target replication count according to the target register address, and sending the target register address and the description information to the controller, so that the controller updates the target replication count according to the target register address, wherein the second replication identifier is used to indicate that the packet is a packet that needs to be replicated; and scheduling the packet to be dequeued.
5. The message forwarding method according to claim 4, characterized in that, The controller updates the target number of copies based on the target register address, including: in response to receiving the target register address, updating the target number of copies to the difference between the current number of copies stored at the target register address and 1; in response to the target number of copies being zero, controlling the cache module to delete the message information and the description information to release the storage space occupied by the message.
6. The message forwarding method according to claim 5, characterized in that, The step of controlling the cache module to delete the message information and the description information to release the storage space occupied by the message includes: generating a storage space release request based on the description information; deleting the target copy number stored at the target register address to obtain a free second register address, and resending the second register address to the parsing module; and sending the storage space release request to the cache module so that the cache module deletes the message information and the description information according to the storage space release request to release the storage space occupied by the message.
7. The message forwarding method according to claim 1, characterized in that, The controller, in response to receiving the forwarding information, stores the target number of copies in the target register address, including: in response to the first receipt of the forwarding information, storing the target number of copies in the forwarding information in the target register address; in response to any subsequent receipt of the forwarding information, determining the sum of the target number of copies in each received forwarding information and the current number of copies stored in the target register address as the new target number of copies stored in the target register address.
8. The message forwarding method according to claim 1, characterized in that, The message forwarding system further includes an enqueue module, which is communicatively connected to the cache module. The method further includes: the enqueue module responding to the cache module being in a message-receiving state, receiving the message, and storing the message in the cache module.
9. A message forwarding system, characterized in that, include: The system includes a caching module, a parsing module, a replication module, and a dequeue module. The dequeue module is communicatively connected to the caching module, the parsing module, and the replication module. The parsing module is also communicatively connected to the caching module and the replication module. The parsing module includes a controller, which is communicatively connected to the replication module. The packet forwarding system is configured to perform the packet forwarding method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores processor-executable computer program instructions, which, when executed by the processor, cause the computer to perform the message forwarding method as described in any one of claims 1-8.