Fragmented message tuple recovery method, network card, gateway, storage medium and program
By cache and restore the tuple information of message shards in the programmable chip of the network card, the problem of difficulty in recovering the subsequent shard message tuple information in elephant streaming is solved, and the accuracy of message distribution processing is achieved.
Patent Information
- Application Number
- CN202411730171.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-28
AI Technical Summary
In Elephant streaming, when packets are transmitted in fragmented, it is difficult to recover the tuple information of subsequent fragmented packets, resulting in inaccurate message distribution processing.
By creating a cache information table in the programmable chip of the network card, the first tuple information of the first shard message is cached and divided into the first subtuple information and the second subtuple information. When receiving the subsequent shard message, the second tuple information is extracted, the matching first subtuple information is queried from the cache information table, and the second subtuple information is filled to restore the first tuple information of the subsequent shard message.
It realizes accurate recovery of subsequent sharded message tuple information, ensures the accuracy of message distribution processing, and is suitable for various message forwarding modes, especially modes that require accurate five-tuple information such as RSS.
Smart Images

Figure CN119232668B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology, and in particular to a fragment message tuple recovery method, a network card, a gateway, a storage medium and a program. Background Art
[0002] The communication traffic carried on various Internet networks is continuously growing and changing. Among them, the transmission of elephant flows will occupy more network resources. Elephant flows refer to network traffic with a long duration and large data volume in the network. For example, elephant flows with a message share of about 5% may account for about 40% of the network bandwidth. Common elephant flows include virtual machine migration, data migration, distributed database data processing, etc. In scenarios such as data centers, there is often a demand for forwarding elephant flows. For example, a gateway device in a data center forwards the elephant flow received from a switch to the corresponding cloud server. Therefore, gateway devices that can bear the demand for forwarding large-volume messages have become an important development trend.
[0003] At present, a gateway device is usually equipped with multiple network cards, which usually use the network card multi-queue technology. The so-called network card multi-queue, as the name implies, means that the high-speed network card has multiple direct memory access (Direct Memory Access, referred to as DMA) queues. The network card has an allocation mechanism based on multiple DMA queues. A DMA queue can be bound to a processor core (usually a CPU core) in the gateway device. At present, the network card can use the receive side scaling (receive sidescaling, referred to as RSS) mode to distribute the received message to the CPU core.
[0004] In actual applications, a message sent from a source device to a gateway device may have a large amount of data. In this case, the message can be split into multiple fragmented messages for transmission. At this time, the first fragmented message will carry complete tuple information (such as a five-tuple, etc.), while the subsequent fragmented messages will only carry partial tuple information. Based on this, how to recover the tuple information of subsequent fragmented messages in the case of message fragment transmission so as to perform accurate message distribution and processing later is an urgent problem to be solved. Summary of the invention
[0005] The embodiment of the present invention provides a fragment message tuple recovery method, a network card, a gateway, a storage medium and a program, which are used to realize accurate recovery of tuple information of a fragment message.
[0006] In a first aspect, an embodiment of the present invention provides a fragment message tuple recovery method, the method is applied to a programmable chip in a network card, the network card is located in a gateway device, and is communicatively connected to multiple processor cores in the gateway device, the method comprising:
[0007] In response to receiving a first fragment message of a target message, cache first tuple information of the first fragment message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information;
[0008] Sending the first fragment message to the first processor core through a target message forwarding mode;
[0009] In response to receiving a subsequent fragment message of the target message, extracting second tuple information of the subsequent fragment message;
[0010] Querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by using the second sub-tuple information to restore the first tuple information of the subsequent fragment message;
[0011] The subsequent fragment message from which the first tuple information is restored is sent to a second processor core through the target message forwarding mode. The first processor core is the same as or different from the second processor core.
[0012] In a second aspect, an embodiment of the present invention provides a fragment message tuple recovery device, the device is applied to a programmable chip in a network card, the network card is located in a gateway device, and is communicatively connected to multiple processor cores in the gateway device, the device comprising:
[0013] A cache module, configured to cache first tuple information of a first fragment message in response to receiving the first fragment message of the target message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information;
[0014] A first fragment message sending module, used for sending the first fragment message to the first processor core through a target message forwarding mode;
[0015] An extraction module, configured to extract second tuple information of a subsequent fragment message in response to receiving a subsequent fragment message of the target message;
[0016] A recovery module, used for querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by the second sub-tuple information to recover the first tuple information of the subsequent fragment message;
[0017] A subsequent fragment message sending module is used to send the subsequent fragment message restored from the first tuple information to a second processor core through the target message forwarding mode, and the first processor core is the same as or different from the second processor core.
[0018] In a third aspect, an embodiment of the present invention provides a network card, wherein the network card includes a programmable chip, and the network card is respectively communicatively connected to a plurality of processor cores in a gateway device;
[0019] The programmable chip is used for caching first tuple information of the first fragment message in response to receiving the first fragment message of the target message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information;
[0020] Sending the first fragment message to the first processor core through a target message forwarding mode;
[0021] In response to receiving a subsequent fragment message of the target message, extracting second tuple information of the subsequent fragment message;
[0022] Querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by using the second sub-tuple information to restore the first tuple information of the subsequent fragment message;
[0023] The subsequent fragment message from which the first tuple information is restored is sent to a second processor core through the target message forwarding mode. The first processor core is the same as or different from the second processor core.
[0024] In a fourth aspect, an embodiment of the present invention provides a gateway device, the gateway device comprising:
[0025] Multiple processor cores;
[0026] A network card, wherein the network card includes a programmable chip and the network card is communicatively connected to the multiple processor cores respectively;
[0027] The programmable chip is used to: in response to receiving a first fragment message of a target message, cache first tuple information of the first fragment message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information;
[0028] Sending the first fragment message to the first processor core through a target message forwarding mode;
[0029] In response to receiving a subsequent fragment message of the target message, extracting second tuple information of the subsequent fragment message;
[0030] Querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by using the second sub-tuple information to restore the first tuple information of the subsequent fragment message;
[0031] The subsequent fragment message from which the first tuple information is restored is sent to a second processor core through the target message forwarding mode. The first processor core is the same as or different from the second processor core.
[0032] In the fifth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium, on which executable code is stored. When the executable code is executed by a programmable chip in a gateway device, the programmable chip executes the fragmented message tuple recovery method as described in the first aspect.
[0033] In a sixth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer program, which, when executed by a programmable chip in a gateway device, enables the programmable chip to execute the fragmented message tuple recovery method as described in the first aspect.
[0034] The fragment message tuple recovery method provided by the embodiment of the present invention caches the first tuple information of the first fragment message after receiving the first fragment message of the target message, and divides the first tuple information into the first sub-tuple information and the second sub-tuple information, thereby laying a foundation for the recovery of the subsequent fragment message tuple information. It can be understood that after the target message is segmented, the first fragment message and one or more subsequent fragment messages will be obtained, and only the first fragment message will carry all the tuple information, such as the source IP address, the destination IP address, the source port number, the destination port number, the protocol type and the message identifier, and the subsequent fragment messages usually only contain part of the tuple information (called the second tuple information), for example, the source port number and the destination port number in the above tuple information will not be carried. Therefore, when a subsequent fragment message of the target message is subsequently received, the first sub-tuple information that is the same as the second tuple information of the subsequent fragment message can be queried from the cache information table, and then the complete tuple information of the first fragment message that belongs to the target message together with the subsequent fragment message can be determined (equivalent to using the first sub-tuple information as an index in the cache information table to find the complete tuple information of the first fragment message that belongs to the target message together with the subsequent fragment message). The second tuple information can be completed by the second sub-tuple information in the first fragment message, and the first tuple information of the subsequent fragment message can be accurately restored.
[0035] Afterwards, through the target message forwarding mode, the subsequent fragmented messages with the first tuple information restored are sent to the second processor core for processing. It should be noted that since the implementation of some message forwarding modes requires the use of accurate tuple information (such as a five-tuple consisting of source IP address, destination IP address, source port number, destination port number, and protocol type), such as the receive side scaling (RSS) mode, therefore, by restoring the first tuple information of the subsequent fragmented messages, it can be ensured that more accurate message distribution processing can be performed later. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0037] Figure 1 A flowchart of a fragment message tuple recovery method provided by an embodiment of the present invention;
[0038] Figure 2 A schematic diagram of an application of a cache information table provided by an embodiment of the present invention;
[0039] Figure 3 Another flow chart of a fragment message tuple recovery method provided by an embodiment of the present invention;
[0040] Figure 4 A schematic diagram of an application of a gateway device provided by an embodiment of the present invention;
[0041] Figure 5 A schematic diagram of an application of a fragment message tuple recovery method provided by an embodiment of the present invention;
[0042] Figure 6 A structural schematic diagram of a fragmented message tuple recovery device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 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 are within the scope of protection of the present invention.
[0044] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0045] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0046] First, the terms or concepts involved in the embodiments of the present invention are explained:
[0047] Gateway device: can be a gateway-type forwarding node in application scenarios such as data centers, and is a traffic convergence point. The gateway device in the embodiment of the present invention can also be a network device such as a switch, a router, etc. that can forward messages.
[0048] Field-Programmable Gate Array (FPGA) is a programmable chip, an integrated circuit that can be reconfigured at the hardware level.
[0049] The embodiment of the present invention provides the following ideas for recovering the tuple information of subsequent fragment messages outside the first fragment message in the case of message fragment transmission: after receiving the first fragment message of the target message, cache the first tuple information (i.e., complete tuple information) of the first fragment message, and send the first fragment message to the first processor core based on the target message forwarding mode. It can be understood that after the target message is segmented, the first fragment message and one or more subsequent fragment messages will be obtained, and only the first fragment message will carry: source IP address, destination IP address, source port number, destination port number, protocol type and message identifier (also called IP-ID) and other complete tuple information, and some tuple information will be omitted in the subsequent fragment messages, such as not carrying the source port number and destination port number in the above tuple information.
[0050] In view of this, the embodiment of the present invention divides the cached first tuple information into two parts: first sub-tuple information (including source IP address, destination IP address, protocol type and fragmentation identifier) and second sub-tuple information (source port number and destination port number), wherein the first sub-tuple information is actually the tuple information that will also be carried in the subsequent fragmentation message. Afterwards, after receiving the subsequent fragmentation message of the target message, the second tuple information of the subsequent fragmentation message is extracted (it should be understood that the second tuple information at this time does not include the source port number and the destination port number), and is queried from the cache information table. If the first sub-tuple information that is the same as the second tuple information can be queried, it means that the current fragmentation message and the first fragmentation message corresponding to the first sub-tuple information belong to the same target message. At this time, the second tuple information in the first tuple information is supplemented with the second sub-tuple information, and the first tuple information of the subsequent fragmentation message can be restored, that is, the complete tuple information that the subsequent fragmentation message should correspond to is obtained. Afterwards, based on the same target message forwarding mode, the subsequent fragmented messages with the first tuple information restored are sent to the second processor core for processing. Based on the different target message forwarding modes, the first processor core and the second processor core may be the same or different. It should be understood that some message forwarding modes require the use of accurate and complete tuple information (such as source IP address, destination IP address, source port number, destination port number, and protocol type) to achieve the distribution of message fragments, such as the receive side scaling (RSS) mode. Therefore, by restoring the first tuple information of the subsequent fragmented messages, it can be ensured that the message fragments can be distributed to the processor core more accurately.
[0051] Figure 1 A flowchart of a fragment message tuple recovery method provided by an embodiment of the present invention is applied to a programmable chip in a network card, the network card is located in a gateway device, and is connected to multiple processor cores in the gateway device. Figure 1 As shown, the method comprises the following steps:
[0052] 101. In response to receiving a first fragment message of a target message, the programmable chip caches first tuple information of the first fragment message, where the first tuple information includes first sub-tuple information and second sub-tuple information.
[0053] 102. The programmable chip sends the first fragment message to the first processor core through the target message forwarding mode.
[0054] 103. In response to receiving a subsequent fragment message of the target message, the programmable chip extracts second tuple information of the subsequent fragment message.
[0055] 104. The programmable chip searches the cache information table for first sub-tuple information identical to the second tuple information, and completes the second tuple information with the second sub-tuple information to restore the first tuple information of the subsequent fragment message.
[0056] 105. The programmable chip sends the subsequent fragmented messages recovered from the first tuple information to the second processor core through the target message forwarding mode. The first processor core is the same as or different from the second processor core.
[0057] It should be noted that when the source device forwards a message to the destination device through the gateway device, if the data volume of the message is relatively large, the message can be split based on the set data volume at the source device to obtain multiple fragmented messages in sequence, the first of which is called the first fragmented message, and the other fragmented messages are collectively referred to as subsequent fragmented messages. It can be understood that one or more subsequent fragmented messages can be split according to the size of the data volume of a complete message. Among them, the source device and the destination device refer to two devices that need to communicate through the gateway device, such as a terminal device that uses the target service and a cloud server that provides the target service. The first processor core and the second processor core can be CPU cores. The following is an example of the first processor core and the second processor core being CPU cores and the programmable chip being an FPGA chip.
[0058] In actual applications, the programmable chip receives the first fragment message of the target message sent by the source device, divides the first tuple information of the first fragment message into the first sub-tuple information and the second sub-tuple information, and caches the first tuple information of the first fragment message. The specific process is as follows: determine the first hash value corresponding to the first sub-tuple information; determine the table entry with the first hash value as the address index in the cache information table, and store the first tuple information in the table entry. Optionally, the first sub-tuple information includes: source IP address, destination IP address, protocol type and message identifier, the message identifier is used to distinguish different messages, and the second sub-tuple information includes: source port number and destination port number.
[0059] It should be noted that, in actual applications, the complete first tuple information contained in the first fragment message is not limited to this example. Here, it is only emphasized that the complete tuple information contained in the first fragment message needs to be cached, and it is divided into the first sub-tuple information that will also be carried in the subsequent fragment messages and the remaining second sub-tuple information. Moreover, "complete tuple information" mainly refers to the complete tuple information required for the distribution process of the fragment message to the processor core. In actual applications, the first fragment message may also carry other tuple information for other purposes, such as message type, service identifier, etc., which is not limited in the embodiments of the present invention. In the following embodiments of the present invention, when introducing the first tuple information composed of the first sub-tuple information and the second sub-tuple information, the above examples are used for illustration.
[0060] In the specific implementation, the corresponding hash value, i.e., the first hash value, is calculated based on the first sub-tuple information (including: source IP address, destination IP address, protocol type, and message identifier). Then, a table entry with the first hash value as the address index is determined in the cache information table, and the first tuple information is stored in the table entry. For ease of understanding, for example, assuming that the cache information table is a data table consisting of 4 rows and 8 columns, please refer to Figure 2 . In this data table, a "row" is a table item corresponding to one of the above address indexes, that is, each row corresponds to a hash value. In actual applications, assuming that the third row is a table item with the first hash value as the address index, then the first tuple information can be directly stored in the entity item in the third row. Among them, the entity item can be understood as: 32 "cells" composed of the above 4 rows and 8 columns of the data table, and each "cell" is called an entity item. Based on the above description, by using a determined hash value and storing the first tuple information in a manner that uses the hash value as the address index, it ensures that the data stored in the cache information table is clearly classified, thereby improving the speed of subsequent data searches in the cache information table.
[0061] Among them, the reason why multiple entity items can be set in one table item is mainly due to the consideration of "hash conflict", that is, two different first sub-tuple information may be mapped to the same hash value, that is, hitting the same table item, then the corresponding two tuple information needs to be stored in the table item - respectively stored in two different entity items in this table item.
[0062] Further, in order to ensure that the first tuple information can be stored in a table item smoothly and orderly, the use status of multiple entity items in the table item can be determined in the process of storing the first tuple information in the table item. If it is determined that there is an idle first entity item in the table item, the first tuple information is stored in the first entity item, wherein the table item includes multiple entity items used in sequence, and each entity item before the first entity item has been used. In other words, the multiple entity items corresponding to the table item are used in sequence. When there is an idle entity item, it means that the table item has not been filled, then the first tuple information is written into the above-mentioned first entity item in the order of use. If it is determined that there is no idle first entity item in the table item, the tuple information written in the second entity item is deleted to store the first tuple information in the second entity item, wherein the writing time of the tuple information in the second entity item is earlier than the writing time of the tuple information in other entity items. In other words, if it is found that the multiple entity items in the above-mentioned table item have all been written with tuple information when the above-mentioned first tuple information needs to be written, then the entity item needs to be recycled, that is, aging treatment. In simple terms, according to the time sequence of the tuple information written in the entity item, the tuple information written earlier is deleted first to free up the entity item for writing the first tuple information.
[0063] For ease of understanding, the following example is given: Figure 2 As shown, assuming that the table entry is the third row of the cache information table, it contains 8 entity items, which are numbered in the order of use: No. 1, No. 2, No. 3, No. 4, No. 5, No. 6, No. 7, No. 8. When storing the first tuple information into the table entry, determine the entity items that have been used in the table entry (assuming No. 1, No. 2, No. 3, No. 4), then at this time, the first tuple information can be stored in the No. 5 entity item, and the No. 5 entity item is the above-mentioned first entity item. What is illustrated here is the case where there are idle entity items in the above-mentioned table items, and the following example illustrates the case where there are no idle entity items.
[0064] Assume that the table entry contains 8 entity items, numbered as follows: No. 1 (tuple information is written at t1), No. 2 (tuple information is written at t2), No. 3 (tuple information is written at t3), No. 4 (tuple information is written at t4), No. 5 (tuple information is written at t5), No. 6 (tuple information is written at t6), No. 7 (tuple information is written at t7), No. 8 (tuple information is written at t8). Among them, the tuple information writing time is from early to late: t1, t2...t8. Assume that the 8 entity items in the above table entry are currently in use, and entity item No. 1 is the entity item with the earliest tuple information writing time among the 8 entity items. At this time, the tuple information written in entity item No. 1 is deleted, and the first tuple information is stored in entity item No. 1. It can be understood that at this time, the tuple information writing time corresponding to entity item No. 1 will be updated to the time t9 when the first tuple information is written. If new tuple information needs to be written into the table item later, and entity items No. 1 to No. 8 are still in use at this time, the tuple information written in entity item No. 2 with the earliest writing time will be deleted, and the new tuple information will be stored in entity item No. 2, and so on. They are not listed one by one here.
[0065] By managing the cache and aging of the cache information table in the programmable chip, the cache information table does not need to occupy too many resources of the programmable chip. Generally, a smaller table can meet the large traffic forwarding requirements of data centers.
[0066] The programmable chip can store the first tuple information of the first fragment message into the cache information table, and can send the first fragment message to the first processor core through the target message forwarding mode. The target message forwarding mode can be a dynamic load balancing mode (Dynamic Load Balancer, DLB for short), a receive side scaling (receive sidescaling, RSS for short), etc.
[0067] Let's first briefly introduce the two message forwarding modes mentioned above. The RSS mode has a natural message order preservation function. In the RSS mode, different messages under the same network flow have the same five-tuple (including source IP address, source port number, destination IP address, destination port number and protocol type), so in the RSS mode, different messages under the same network flow will be distributed to the same processor core for processing, that is, each fragment message in each message under the same network flow will be distributed to the same processor core for processing.
[0068] In the DLB mode, different messages of the same network flow are no longer distributed to the same processor core for processing, but are processed by different processor cores in a round-robin manner. In addition, an order-preserving queue is introduced in the DLB mode to realize the function of message order preservation during message forwarding. In summary, based on the order in which the messages are received, message sequence numbers will be assigned to them, and the message sequence numbers will be stored in the order-preserving queue to achieve orderly forwarding of messages. For the specific application process of the DLB mode in the embodiments of the present invention, please refer to the following embodiments, which will not be described in detail here.
[0069] For ease of description, it is assumed here that the target message forwarding mode used by the first fragment message is the RSS mode.
[0070] Among them, in RSS mode, when the programmable chip receives the first fragment message, it can calculate the hash value X according to the five-tuple in the first tuple information (including the five fields of source IP address, source port number, destination IP address, destination port number and protocol type), and query the forwarding table based on multiple low-significant bits of the hash value X, that is, the index indirection table (indirection table), to determine the number of the corresponding DMA receiving queue, so as to allocate the first fragment message to the corresponding processor core (assuming it is the first processor core) bound to the DMA receiving queue for processing. It should be noted that in the process of distributing the above-mentioned first fragment message to the processor core, not all the information in the first tuple information is used, such as the message identifier is not used. That is why, because different messages under the same network flow have different message identifiers, but have the same five-tuple, when distributing fragment messages based on the above five-tuple, each fragment message of different messages under the same network flow can be distributed to the same processor core. The message identifier contained in the first tuple information is mainly used to identify different fragment messages under the same message, so as to restore the tuple information of subsequent fragment messages.
[0071] After sending the first fragment message to the first processor core, the programmable chip responds to the reception of the subsequent fragment message of the target message, and extracts the second tuple information of the subsequent fragment message after receiving the subsequent fragment message. It should be understood that since the subsequent fragment message lacks the source port number and the destination port number, the second tuple information includes: the source IP address, the destination IP address, the protocol type and the message identifier.
[0072] In actual application, the programmable chip queries the cache information table for the first sub-tuple information that is identical to the second tuple information, and completes the second tuple information with the second sub-tuple information to restore the first tuple information of the subsequent fragmented message. The specific process is as follows: determine the second hash value corresponding to the second tuple information; if a table entry with the second hash value as the address index is queried in the cache information table, and the first sub-tuple information and the second tuple information in the table entry are the same, then complete the second tuple information with the second sub-tuple information in the table entry to restore the first tuple information of the subsequent fragmented message.
[0073] In the specific implementation, the programmable chip calculates the corresponding hash value, i.e., the second hash value, based on the second tuple information (including: source IP address, destination IP address, protocol type and message identifier), and performs a query operation in the cache information table. If a table item with the second hash value as the address index is queried in the cache information table, it is assumed here that the hit is the table item corresponding to the above-mentioned first hash value, and it is assumed that the first tuple information of the first fragment message in the above text is stored in the entity item i of the table item. Therefore, it is necessary to further determine whether the first sub-tuple information and the second tuple information in the entity item i of the table item are the same. If they are the same, it means that the current subsequent fragment message and the aforementioned first fragment message belong to the same target message. At this time, the second sub-tuple information (source port number and destination port number) in the first tuple information of the first fragment message stored in the entity item i is added to the second tuple information, and the first tuple information of the subsequent fragment message can be restored. If the first sub-tuple information and the second tuple information in the entity item i are different, it means that the current subsequent fragment message and the aforementioned first fragment message do not belong to the same message, and the tuple information can continue to be matched in other entity items j of the table item until the first sub-tuple information that is the same as the second tuple information is found in the table item, and then the second sub-tuple information in the first tuple information of the corresponding first fragment message can be added to the second tuple information.
[0074] After the subsequent fragment messages recover the complete first tuple information, the programmable chip can send the subsequent fragment messages that recover the first tuple information to the second processor core through the target message forwarding mode. It should be noted that the first processor core and the second processor core may be the same or different. Specifically, if the target message forwarding mode is the RSS mode, it means that the first fragment message and the subsequent fragment messages will be sent to the same processor core for processing. In this case, the first processor core is the same as the second processor core. If the target message forwarding mode is the DLB mode, it means that the first fragment message and the subsequent fragment messages will be sent to different processor cores for processing in a polling manner. In this case, the first processor core is different from the second processor core.
[0075] Still taking the target message forwarding mode as RSS mode as an example, since the subsequent fragmented messages have restored the complete first tuple information, then as described above, a hash value can be calculated based on the above five-tuple information. The hash value will hit a DMA receive queue in the forwarding table, and the DMA receive queue is the same as the DMA receive queue hit when distributing the first fragmented message. Therefore, the subsequent fragmented messages will be distributed to the first processor core bound to the DMA receive queue.
[0076] In simple terms, after receiving the first fragment message and its subsequent fragment messages, the first processor core needs to reassemble the message to obtain the reassembled message, and then process the reassembled message (such as generating the corresponding response message, performing encapsulation processing, etc.). Among them, taking the target message as an example, when the source device splits the fragments, it will number the fragments corresponding to each fragment message fragment. The first processor core can identify all the fragment messages under the same message identifier based on the message identifier, and further reassemble the target message based on the order of the fragment numbers corresponding to these fragment messages. The specific reassembly process refers to the existing relevant technology implementation and will not be repeated here.
[0077] It is understandable that in practical applications, such as when distributing fragmented messages in RSS mode, it is necessary to use accurate five-tuple information (source IP address, destination IP address, protocol type, source port number and destination port number). The above scheme is used to recover the complete tuple information of subsequent fragmented messages, which can ensure the accurate distribution of each fragmented message in this mode. However, some message forwarding modes do not require the use of accurate five-tuple information, such as DLB mode. Therefore, optionally, when the programmable chip receives a fragmented message, it can first determine the message forwarding mode that the fragmented message should adopt. If it is RSS mode, the first tuple information of the first fragmented message is cached and the first tuple information of its subsequent fragmented messages is recovered. If it is DLB mode, the tuple information caching and recovery process may not be performed. Of course, when the complete tuple information of each fragmented message is also needed in the message processing process in DLB mode, the tuple information caching and recovery process can also be performed. In addition, the target message forwarding mode adopted by the fragment message may be determined based on message type feature information corresponding to the fragment message, which will be introduced in subsequent embodiments.
[0078] In summary, the fragmented message tuple recovery method provided by the embodiment of the present invention creates a cache information table in the programmable chip at the hardware level of the network card to cache the complete tuple information of the first fragmented message, thereby accurately recovering the tuple information of subsequent fragmented messages, and providing reliability for fragmented message distribution processing that does not rely on complete tuple information.
[0079] Figure 3Another flow chart of a fragment message tuple recovery method provided by an embodiment of the present invention. Figure 3 As shown, the method comprises the following steps:
[0080] 301. In response to receiving a first fragment message of a target message, the programmable chip caches first tuple information of the first fragment message, where the first tuple information includes first sub-tuple information and second sub-tuple information.
[0081] 302. The programmable chip determines a target message forwarding mode according to first message type characteristic information in the first fragment message, where the first message type characteristic information is included in the first tuple information.
[0082] 303. The programmable chip sends the first fragment message to the first processor core through the target message forwarding mode.
[0083] 304. In response to receiving a subsequent fragment message of the target message, the programmable chip extracts second tuple information of the subsequent fragment message.
[0084] 305. The programmable chip searches the cache information table for first sub-tuple information identical to the second tuple information, and completes the second tuple information with the second sub-tuple information to restore the first tuple information of the subsequent fragment message.
[0085] 306. The programmable chip determines a target message forwarding mode according to second message type characteristic information in the first tuple information restored from subsequent fragmented messages, where the second message type characteristic information is the same as or different from the first message type characteristic information.
[0086] 307. The programmable chip sends the subsequent fragmented messages recovered from the first tuple information to the second processor core through the target message forwarding mode. The first processor core is the same as or different from the second processor core.
[0087] In actual applications, there can be two types of target messages corresponding to target services, namely control messages and data messages, wherein control messages are generally processed by the kernel protocol stack in the processor core, while data messages are generally processed by the service handler in the processor core. Moreover, control messages are generally consumed by the gateway device itself, that is, control messages received from the source device, after being processed by the gateway device, will not be sent to the destination device that communicates with the source device, while data messages are messages that carry data information transmitted between the source device and the destination device, and need to be forwarded to the destination device through the gateway device. Therefore, the processing of the two types of messages will be different. It can be understood that the network card used to receive control messages and data messages in the gateway device and the ports on the network card are different, which results in different tuple information for control messages and data messages. Therefore, the message type of the target message can be distinguished according to the tuple information. Specifically:
[0088] If the target message is determined to be a control message based on the first message type characteristic information in the first fragment message, the target message forwarding mode is determined to be the receiver scaling mode. At this time, the first fragment message of the target message and its subsequent fragment messages will be distributed to the same processor core, that is, the first processor core and the second processor core mentioned above are the same. If the target message is determined to be a data message based on the first message type characteristic information in the first fragment message, the target message forwarding mode is determined to be the dynamic load balancing mode. At this time, the first fragment message of the target message and its subsequent fragment messages will be distributed to different processor cores, that is, the first processor core and the second processor core mentioned above are different.
[0089] In specific implementation, as an implementation method, the first message type characteristic information can be the destination IP address and / or protocol type contained in the first tuple information. Based on this, when determining the target message forwarding mode of the first fragment message, it can be determined whether the protocol type carried in the first fragment message is consistent with the protocol type set in the set matching rule. If they are consistent, the target message is determined to be a control message. At this time, the target message forwarding mode of the first fragment message is the receiver scaling mode (RSS mode). If they are inconsistent, the target message is determined to be a data message. At this time, the target message forwarding mode of the first fragment message is the dynamic load balancing mode (DLB mode). Among them, the set protocol type can be the Link Layer Discovery Protocol (LLDP for short), the Address Resolution Protocol (ARP for short), etc., which can be set according to actual needs and are not limited here. In addition, it is also possible to determine whether the destination IP address carried in the first fragment message corresponds to the matching rule, that is, to determine whether the destination IP address carried in the first fragment message is consistent with the destination IP address set in the matching rule. If they are consistent, the target message is determined to be a control message, and at this time, the target message forwarding mode of the first fragment message is the RSS mode. If they are inconsistent, the target message is determined to be a data message, and at this time, the target message forwarding mode of the first fragment message is the DLB mode.
[0090] As another implementation method, the first message type characteristic information may be other fields not included in the first tuple information, such as a type definition field used to define the message type. In specific implementation, it can be determined whether the type definition field carried in the first fragment message is consistent with the set control message type definition field. If they are consistent, the target message is determined to be a control message. At this time, the target message forwarding mode of the first fragment message is the RSS mode. If they are inconsistent, the target message is determined to be a data message. At this time, the target message forwarding mode of the first fragment message is the DLB mode.
[0091] Based on the same method as above, the programmable chip can determine the corresponding target message forwarding mode according to the second message type characteristic information in the first tuple information recovered from the subsequent fragment message, wherein the second message type characteristic information is the same as or different from the first message type characteristic information.
[0092] When the second message type characteristic information is the same as the first message type characteristic information, the target message forwarding mode of the subsequent fragment message can be determined completely in accordance with the above-mentioned method of determining the target message forwarding mode of the first fragment message. When the second message type characteristic information is different from the first message type characteristic information, for example, the first message type characteristic information includes the destination IP address and the protocol type, and the second message type characteristic information includes a message identifier. Since the second message type characteristic information is in the subsequent fragment message, the message forwarding mode used by the first fragment message with the same message identifier can be found according to the message identifier contained in the second message type characteristic information, so as to determine that the subsequent fragment message directly uses the same message forwarding mode as the first fragment message corresponding to it. That is to say, when determining the target message forwarding mode of the subsequent fragment message, it can be determined that it uses the same message forwarding mode as the first fragment message, and since the subsequent fragment message corresponding to the target message carries the same message identifier (IP-ID) as the first fragment message, the first fragment message corresponding to the subsequent fragment message can be identified based on the message identifier. In actual applications, after determining the target message forwarding mode corresponding to the first fragment message, the correspondence between the message identifier corresponding to the first fragment message and the target message forwarding mode can be stored. Thus, when subsequent fragment messages with the same message identifier are received, the stored correspondence can be queried to directly determine the target message forwarding mode adopted by the subsequent fragment messages.
[0093] After determining the target message forwarding mode of the subsequent fragmented messages, the subsequent fragmented messages that restore the first tuple information can be sent to the second processor core. It can be understood that if the target message forwarding mode is the RSS mode, all the fragmented messages corresponding to the target message will be sent to the same processor core for processing, reducing the message reassembly overhead of the processor core, because all the fragmented messages corresponding to the target message are located locally in the same processor core, and the target message can be reassembled directly according to the message identifier and fragment number in each fragmented message. If the target message forwarding mode is determined to be the DLB mode, different fragmented messages of the target message will be distributed to different processor cores. At this time, when the target message is reassembled, it involves the communication between these different processor cores, so that one of the processor cores obtains the fragmented messages distributed on other processor cores to reassemble the target message.
[0094] It should be noted that the execution sequence of the above steps 301-307 is only an optional implementation method and is not limited to this. For example, when receiving the first fragment message and the subsequent fragment messages, the message type of the target message can be determined first, and then the first tuple information is cached and the tuple information of the subsequent fragment messages is restored. Because as introduced in the above embodiments, in some embodiments, the identification of the message type does not necessarily rely on the recovery of the complete tuple information, but when the matching rule of the message type involves information that can only be used after the tuple information of the subsequent fragment messages is restored, it is also necessary to restore the tuple information first and then perform the classification and identification of the message type.
[0095] In summary, in the embodiment of the present invention, two different message forwarding modes are provided to meet the forwarding requirements of different types of messages. Specifically, compared with data messages, the scale of control messages is very small, and is used locally by the gateway device. Therefore, based on the RSS mode, different fragment messages of the same control message are distributed to the same processor core, which can reduce the communication overhead of the processor core to reorganize the control message. However, at this time, the recovery of the accurate and complete tuple information based on the subsequent fragment message is required to ensure the realization of this purpose. Data messages are usually larger, especially in the case of elephant flows. Therefore, for data messages, based on the DLB mode, different fragment messages are distributed to different processor cores for processing, which can balance the load of different processor cores, reduce the risk of single-core high-speed, and improve message forwarding efficiency.
[0096] The following specifically describes the process of sending the first fragment message of the target message corresponding to the target service to the first processor core and the process of sending the subsequent fragment messages to the second processor core in the DLB mode:
[0097] As a first implementation method, the first fragment message is sent to the first processor core through the DLB mode, including: allocating the first message sequence number corresponding to the first fragment message in the order-preserving queue corresponding to the target service, and sending the first fragment message carrying the first message sequence number to the first processor core in a polling manner.
[0098] In the specific implementation, the message sequence numbers that have been allocated in the order-preserving queue are determined, and based on the allocated message sequence numbers, the first message sequence numbers corresponding to the first fragment message are sequentially allocated. For ease of understanding, for example, assume that before the first fragment message, two message sequence numbers have been allocated consecutively (No. 1 and No. 2, respectively, where No. 1 is the message sequence number of the first fragment message of message A, and No. 2 is the message sequence number of the subsequent fragment message of message B, and message A and message B are the other two messages under the target service), then, at this time, the first message sequence number corresponding to the first fragment message of the target message in the order-preserving queue is 3. One point needs to be emphasized here: the message sequence numbers stored in the order-preserving queue will not be repeated. Specifically, assuming that the order-preserving queue can accommodate a maximum of 1000 message sequence numbers, then the message sequence numbers can be, for example, consecutive integers starting from 1, and when it reaches 1000, it will be reallocated from 1. Moreover, whenever a fragment message with an assigned message sequence number is sent to a corresponding destination device, the message sequence number will be deleted from the sequence-preserving queue.
[0099] Afterwards, the first fragment message carrying the first message sequence number is sent to the first processor core in a polling manner. Specifically,
[0100] The network card receiving queues corresponding to the target service have a set correspondence with the processor core. For ease of understanding, you can refer to Figure 4 , Figure 4 A schematic diagram of an application of a gateway device provided by an embodiment of the present invention. Figure 4 In the DMA receive queue, queue 1 corresponds to CPU core 1, queue 2 corresponds to CPU core 2, and queue n corresponds to CPU core n. Assuming that the currently polled DMA receive queue is queue 1, the first fragment message is sent to CPU core 1 (i.e., the first processor core) bound to it through queue 1.
[0101] Based on this, the subsequent fragmented messages that restore the first tuple information are sent to the second processor core, including: allocating the second message sequence number corresponding to the subsequent fragmented message in the order-preserving queue, and sending the subsequent fragmented messages carrying the second message sequence number to the second processor core in a polling manner, so that the first processor core and the second processor core can realize the reorganization of the first fragmented message and the subsequent fragmented messages, and process the reorganized target message, wherein the reorganized target message includes the first message sequence number.
[0102] During specific implementation, determine the message sequence numbers that have been allocated in the order-preserving queue, and sequentially allocate the corresponding second message sequence numbers to the subsequent fragmented messages based on the allocated message sequence numbers. For ease of understanding, following the above example, assume that the second message sequence number corresponding to a subsequent fragmented message received at this time in the order-preserving queue is 4. Afterwards, the first fragmented message carrying the second message sequence number is sent to the second processor core in a polling manner. Specifically, assuming that the DMA receiving queue currently polled is queue No. 2, the subsequent fragmented message is sent to the CPU core 2 (i.e., the second processor core) bound to it through queue No. 2.
[0103] For ease of description, it is assumed that the target message is only split into the above-mentioned first fragment message and a subsequent fragment message. At this time, inter-core communication can be performed between the first processor core and the second processor core to realize the reorganization of the first fragment message and the subsequent fragment message. In specific implementation, the first processor core can send a fragment message acquisition request to other processor cores based on the message identifier. Assuming that only the second processor core contains the message identifier of the target message among the multiple processor cores of the current gateway device, the second processor core will send the subsequent fragment message to the first processor core based on the fragment message acquisition request sent by the first processor core. After receiving the subsequent fragment message, the first processor core can reorganize with the first fragment message based on the fragment number of the fragment message carried in the subsequent fragment message. In addition, since each fragment message carries the message sequence number assigned to each, but the reorganized target message only needs to carry one message sequence number, therefore, the first message sequence number in the first fragment message can be used as the message sequence number carried in the reorganized target message. At this time, after the target message is reassembled and the reassembled target message is processed by the processor core (the processor core that performs the reassembly), it is sent to the programmable chip. The programmable chip responds to the reception of the corresponding processed target message, and determines the sending order of the processed target message according to the first message sequence number carried in the processed target message and the message sequence number currently stored in the sequence-preserving queue, so as to send the processed target message to the corresponding destination device according to the sending order, and delete the message sequence number corresponding to the processed target message from the sequence-preserving queue. Among them, the message sequence number corresponding to the processed target message includes the message sequence number assigned to each fragment message of the target message, that is, in the above example, it includes the first message sequence number and the second message sequence number.
[0104] In specific implementation, after receiving the processed target message, the programmable chip judges the first message sequence number carried in the processed target message. If the first message sequence number in the processed target message is the smallest message sequence number among the message sequence numbers currently stored in the order-preserving queue, it is determined to directly send the processed target message. If there is a message sequence number less than the first message sequence number among the currently stored message sequence numbers, the processed target message is cached, and it is determined that the sending order of the processed target message is located after the processed message corresponding to the message sequence number less than the first message sequence number.
[0105] For ease of understanding, for example, assume that the first message sequence number is 3. If the message sequence numbers currently stored in the sequence-preserving queue include 3, 4, and 5, it means that the first message sequence number is the smallest message sequence number among the currently stored message sequence numbers. At this time, the processed target message can be directly sent to the destination device. If the message sequence numbers currently stored in the sequence-preserving queue include 1 and 2, it means that there is a message sequence number that is smaller than the first message sequence number among the currently stored message sequence numbers. At this time, the processed target message is cached, and after determining that the messages corresponding to 1 and 2 have been sent out, the processed target message is sent to the destination device. In this way, it is ensured that the target message can be sent to the destination device smoothly and accurately in the set sending order.
[0106] As a second implementation method, in DLB mode, the first fragment message is sent to the first processor core, including: allocating the first message sequence number corresponding to the first fragment message in the order-preserving queue corresponding to the target service, and sending the first fragment message carrying the first message sequence number to the first processor core in a polling manner.
[0107] Refer to the above example, for example Figure 4 In the example, assuming that the DMA receiving queue currently polled is queue No. 1, the first fragment message is sent to the bound CPU core 1 (i.e., the first processor core) through queue No. 1. Afterwards, when distributing the subsequent fragment messages that recover the first tuple information, it is determined that the message sequence number used by the subsequent fragment messages is the first message sequence number, and the subsequent fragment messages carrying the first message sequence number are sent to the second processor core in a polling manner, so that the first processor core and the second processor core realize the reassembly of the first fragment message and the subsequent fragment messages, and process the reassembled target message, wherein the reassembled target message includes the first message sequence number.
[0108] During specific implementation, based on the message identifier carried in the subsequent fragment message and the message identifier carried in the first fragment message, it is determined that the subsequent fragment message and the above-mentioned first fragment message belong to the same target message. At this time, a new message sequence number is no longer allocated for the subsequent fragment message in the order-keeping queue, but the first message sequence number that is the same as the message sequence number of the first fragment message is used for the subsequent fragment message, that is, the message sequence number of the first fragment message is reused. For ease of understanding, combined with the above example, it is assumed that before the subsequent fragment message, 3 message sequence numbers have been continuously allocated, namely No. 1, No. 2 and No. 3, wherein No. 1 is the message sequence number of the first fragment message of message A, No. 2 is the message sequence number of the subsequent fragment message of message B, and No. 3 is the message sequence number of the first fragment message of the target message, then, at this time, the message sequence number corresponding to the subsequent fragment message in the order-keeping queue is No. 3.
[0109] Afterwards, the subsequent fragment messages carrying the first message sequence number are sent to the second processor core in a polling manner. Specifically, assuming that the DMA receiving queue currently polled is queue No. 2, the subsequent fragment messages are sent to the bound CPU core 2 (i.e., the second processor core) through queue No. 2.
[0110] For ease of description, it is assumed that the target message is only split into the above-mentioned first fragment message and a subsequent fragment message. At this time, inter-core communication can be performed between the first processor core and the second processor core to realize the reassembly of the first fragment message and the subsequent fragment message. It can be understood that since the first message sequence number is used in each fragment message, the reassembled target message can directly carry the first message sequence number.
[0111] After the target message is reassembled and the reassembled target message is processed by the processor core (the processor core that performs the reassembly), it is sent to the programmable chip. In response to the reception of the corresponding processed target message, the programmable chip determines the sending order of the processed target message according to the first message sequence number carried in the processed target message and the message sequence number currently stored in the sequence-preserving queue, so as to send the processed target message to the corresponding destination device according to the sending order, and delete the message sequence number corresponding to the processed target message from the sequence-preserving queue. Among them, the message sequence number corresponding to the processed target message includes the message sequence number assigned to each fragment message of the target message, that is, in the example of the second method mentioned above, only the first message sequence number is included.
[0112] Figure 5 A schematic diagram of an application of a fragment message tuple recovery method provided by an embodiment of the present invention. Figure 5From the perspective of the working process of the programmable chip, it can be considered that it includes the following functional units: hash calculation unit, information reorganization unit, classification processing unit, table entry aging unit (the implementation method can be Least Recently Used (LRU)), and information cache unit (the representation form can be a cache information table).
[0113] During specific implementation, S1, the programmable chip receives the first fragment message sent by the source device.
[0114] S2. The programmable chip calculates a first hash value corresponding to the first sub-tuple information in the first tuple information through a hash calculation unit, determines a table entry with the first hash value as an address index in the information cache unit, and stores the first tuple information in the table entry.
[0115] In the process of storing the first tuple information into the table item, the usage status of multiple entity items in the table item is first determined. If it is determined based on the table item aging unit that there is no idle first entity item in the table item, the tuple information written in the second entity item is deleted to store the first tuple information in the second entity item, wherein the writing time of the tuple information in the second entity item is earlier than the writing time of the tuple information in other entity items.
[0116] S3. The programmable chip determines a target message forwarding mode corresponding to the target message based on the classification processing unit, and sends the first fragment message to the first processor core through the target message forwarding mode.
[0117] S4. The programmable chip receives subsequent fragment messages of the target message, and extracts second tuple information of the subsequent fragment messages.
[0118] S5. The programmable chip calculates a second hash value corresponding to the second tuple information through a hash calculation unit, and determines in the information cache unit that a table entry using the second hash value as an address index is a table entry corresponding to the first hash value.
[0119] S6. The programmable chip determines whether the first sub-tuple information and the second tuple information in the table entry are the same. If they are the same, the second sub-tuple information in the first tuple information of the first fragment message is added to the second tuple information through the information reorganization unit to restore the first tuple information of the subsequent fragment message.
[0120] S7. The programmable chip determines a target message forwarding mode corresponding to the target message based on the classification processing unit, and sends subsequent fragment messages from which the first tuple information is restored to the second processor core through the target message forwarding mode.
[0121] Based on the above, the fragment message tuple recovery method provided by the embodiment of the present invention can recover the first tuple information of the subsequent fragment messages, thereby ensuring that more accurate message distribution and processing can be performed later. In addition, since the fragment messages are often sent adjacently and the paths they pass through (i.e., the paths formed by multiple routers, switches, etc. during message forwarding) are basically the same, the time interval between each fragment message is small, and the information storage and recovery of the fragment messages with a large flow can be satisfied through a small table entry.
[0122] The fragment message tuple recovery device of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these devices can be configured using commercially available hardware components through the steps taught in this solution.
[0123] Figure 6 The present invention provides a schematic diagram of the structure of a fragment message tuple recovery device, which is applied to a programmable chip in a network card, and the network card is located in a gateway device and is connected to multiple processor cores in the gateway device. Figure 6 As shown, the device includes: a cache module 11, a sending module 12, an extraction module 13, and a recovery module 14.
[0124] The cache module 11 is used for caching first tuple information of the first fragment message in response to receiving the first fragment message of the target message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information.
[0125] The sending module 12 is used to send the first fragment message to the first processor core through a target message forwarding mode.
[0126] The extraction module 13 is used to extract the second tuple information of the subsequent fragment message in response to receiving the subsequent fragment message of the target message.
[0127] The recovery module 14 is used to query the first sub-tuple information that is the same as the second tuple information from the cache information table, and complete the second tuple information with the second sub-tuple information to recover the first tuple information of the subsequent fragment message.
[0128] The sending module 12 is further used to send the subsequent fragment message restored from the first tuple information to the second processor core through the target message forwarding mode, and the first processor core is the same as or different from the second processor core.
[0129] Optionally, the cache module 11 is specifically used to: determine a first hash value corresponding to the first sub-tuple information; determine a table entry with the first hash value as an address index in the cache information table, and store the first tuple information in the table entry.
[0130] Among them, optionally, the cache module 11 is specifically used to: determine the second hash value corresponding to the second tuple information; if the table entry with the second hash value as the address index is queried in the cache information table, and the first sub-tuple information and the second tuple information in the table entry are the same, then the second sub-tuple information is used to complete the second tuple information to restore the first tuple information of the subsequent fragment message.
[0131] Among them, optionally, the cache module 11 is also used for: if it is determined that there is an idle first entity item in the table item, the first tuple information is stored in the first entity item, wherein the table item includes multiple entity items used sequentially, and the entity items before the first entity item have been used; and if it is determined that there is no idle first entity item in the table item, the tuple information written in the second entity item is deleted to store the first tuple information in the second entity item, wherein the writing time of the tuple information in the second entity item is earlier than the writing time of the tuple information in other entity items.
[0132] Among them, optionally, the first sub-tuple information and the second sub-tuple information include: source IP address, destination IP address, protocol type and message identifier, and the message identifier is used to distinguish different messages; the second sub-tuple information includes: source port number and destination port number.
[0133] Among them, optionally, the device also includes: a determination module, used to determine the target message forwarding mode based on the first message type characteristic information in the first fragment message, the first message type characteristic information is included in the first tuple information; and determine the target message forwarding mode based on the second message type characteristic information in the first tuple information recovered from the subsequent fragment message, the second message type characteristic information is the same as or different from the first message type characteristic information.
[0134] Among them, optionally, the determination module is specifically used for: if the target message is determined to be a control message according to the first message type characteristic information in the first fragment message, then the target message forwarding mode is determined to be a receiver scaling mode, and the first processor core is the same as the second processor core; and if the target message is determined to be a data message according to the first message type characteristic information in the first fragment message, then the target message forwarding mode is determined to be a dynamic load balancing mode, and the first processor core is different from the second processor core.
[0135] Among them, optionally, the target message forwarding mode is a dynamic load balancing mode; the sending module 12 is specifically used to: assign the first message sequence number corresponding to the first fragment message in the order-preserving queue corresponding to the target service, and the target message corresponds to the target service; send the first fragment message carrying the first message sequence number to the first processor core in a polling manner; the subsequent fragment message sending module is specifically used to: assign the second message sequence number corresponding to the subsequent fragment message in the order-preserving queue; send the subsequent fragment message carrying the second message sequence number to the second processor core in a polling manner, so that the first processor core and the second processor core realize the reorganization of the first fragment message and the subsequent fragment message, and process the reorganized target message, wherein the reorganized target message includes the first message sequence number.
[0136] Among them, optionally, the target message forwarding mode is a dynamic load balancing mode; the sending module is also used to: assign the first message sequence number corresponding to the first fragment message in the order-preserving queue corresponding to the target service, and the target message corresponds to the target service; send the first fragment message carrying the first message sequence number to the first processor core in a polling manner; the subsequent fragment message sending module is specifically used to: determine that the message sequence number used by the subsequent fragment message is the first message sequence number; send the subsequent fragment message carrying the first message sequence number to the second processor core in a polling manner, so that the first processor core and the second processor core realize the reorganization of the first fragment message and the subsequent fragment message, and process the reorganized target message, wherein the reorganized target message includes the first message sequence number.
[0137] Among them, optionally, the determination module is also used to respond to the reception of the processed target message corresponding to the reorganized target message, determine the sending order of the processed target message according to the first message sequence number carried in the processed target message and the message sequence number currently stored in the order-preserving queue, and send the processed target message to the corresponding destination device in accordance with the sending order, and delete the message sequence number corresponding to the processed target message from the order-preserving queue, and the message sequence number corresponding to the processed target message includes the message sequence numbers assigned to each fragment message of the target message.
[0138] Figure 6 The device shown can execute the steps provided in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.
[0139] In addition, an embodiment of the present invention provides a network card, wherein the network card includes a programmable chip, and the network card is respectively communicatively connected with a plurality of processor cores in a gateway device;
[0140] The programmable chip is used for caching first tuple information of the first fragment message in response to receiving the first fragment message of the target message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information;
[0141] Sending the first fragment message to the first processor core through a target message forwarding mode;
[0142] In response to receiving a subsequent fragment message of the target message, extracting second tuple information of the subsequent fragment message;
[0143] Querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by using the second sub-tuple information to restore the first tuple information of the subsequent fragment message;
[0144] The subsequent fragment message from which the first tuple information is restored is sent to a second processor core through the target message forwarding mode. The first processor core is the same as or different from the second processor core.
[0145] The network card can execute the steps provided in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.
[0146] In addition, an embodiment of the present invention provides a gateway device, the gateway device comprising: a plurality of processor cores, including a first processor core running a driver program and a second processor core running a message processing program of a target service;
[0147] A network card includes a programmable chip, and the network card is respectively connected to multiple processor cores for communication;
[0148] The programmable chip is used for: in response to receiving a first fragment message of a target message, caching first tuple information of the first fragment message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information;
[0149] Sending the first fragment message to the first processor core through a target message forwarding mode;
[0150] In response to receiving a subsequent fragment message of the target message, extracting second tuple information of the subsequent fragment message;
[0151] Querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by using the second sub-tuple information to restore the first tuple information of the subsequent fragment message;
[0152] The subsequent fragment message from which the first tuple information is restored is sent to a second processor core through the target message forwarding mode. The first processor core is the same as or different from the second processor core.
[0153] The gateway device can execute the steps provided in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.
[0154] In addition, an embodiment of the present invention provides a non-temporary machine-readable storage medium, on which executable code is stored. When the executable code is executed by a programmable chip in a gateway device, the programmable chip can at least implement the fragmented message tuple recovery method provided in the aforementioned embodiment.
[0155] In addition, an embodiment of the present invention provides a computer program product, which includes: a computer program, when the computer program is executed by a programmable chip in a gateway device, the programmable chip can at least implement the fragmented message tuple recovery method provided in the aforementioned embodiment.
[0156] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0157] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and application programs. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A fragment message tuple recovery method, characterized in that: A programmable chip applied to a network card, wherein the network card is located in a gateway device and is communicatively connected to a plurality of processor cores in the gateway device, wherein the method comprises: In response to receiving a first fragment message of a target message, cache first tuple information of the first fragment message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information; Sending the first fragment message to the first processor core through a target message forwarding mode; In response to receiving a subsequent fragment message of the target message, extracting second tuple information of the subsequent fragment message; Querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by using the second sub-tuple information to restore the first tuple information of the subsequent fragment message; Based on the first tuple information recovered from the subsequent fragment message, determine to send the subsequent fragment message from which the first tuple information is recovered to a second processor core through the target message forwarding mode, where the first processor core is the same as or different from the second processor core; Wherein, if the target message forwarding mode is a dynamic load balancing mode, the first fragment message is sent to the first processor core through the target message forwarding mode, including: allocating a first message sequence number corresponding to the first fragment message in the order-preserving queue corresponding to the target service, and sending the first fragment message carrying the first message sequence number to the first processor core in a polling manner, and the target message corresponds to the target service; and The method of sending the subsequent fragmented message that recovers the first tuple information to the second processor core through the target message forwarding mode includes: allocating the second message sequence number corresponding to the subsequent fragmented message in the order-preserving queue, or determining that the message sequence number used by the subsequent fragmented message is the first message sequence number; sending the subsequent fragmented message carrying the second message sequence number or the first message sequence number to the second processor core in a polling manner, so that the first processor core and the second processor core realize the reorganization of the first fragmented message and the subsequent fragmented message, and process the reorganized target message, wherein the reorganized target message includes the first message sequence number, and in the dynamic load balancing mode, the first processor core is different from the second processor core.
2. The method according to claim 1, characterized in that The first tuple information of the first fragment message is cached, including: Determine a first hash value corresponding to the first sub-tuple information; Determine a table entry with the first hash value as an address index in the cache information table, and store the first tuple information in the table entry.
3. The method according to claim 2, characterized in that The querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by the second sub-tuple information to restore the first tuple information of the subsequent fragment message includes: Determine a second hash value corresponding to the second tuple information; If the table entry with the second hash value as the address index is queried in the cache information table, and the first sub-tuple information and the second tuple information in the table entry are the same, the second tuple information is completed with the second sub-tuple information to restore the first tuple information of the subsequent fragment message.
4. The method according to claim 2, characterized in that: The storing the first tuple information into the table entry includes: If it is determined that there is an idle first entity item in the table item, the first tuple information is stored in the first entity item, wherein the table item includes a plurality of entity items used sequentially, and the entity items before the first entity item have been used.
5. The method according to claim 4, characterized in that The storing the first tuple information into the table entry includes: If it is determined that there is no idle first entity item in the table item, the tuple information written in the second entity item is deleted to store the first tuple information in the second entity item, wherein the writing time of the tuple information in the second entity item is earlier than the writing time of the tuple information in other entity items.
6. The method according to any one of claims 1 to 5, characterized in that The first sub-tuple information and the second sub-tuple information include: a source IP address, a destination IP address, a protocol type and a message identifier, where the message identifier is used to distinguish different messages; The second sub-tuple information includes: a source port number and a destination port number.
7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Determining the target message forwarding mode according to first message type characteristic information in the first fragment message, wherein the first message type characteristic information is included in the first tuple information; The target message forwarding mode is determined according to the second message type characteristic information in the first tuple information recovered from the subsequent fragment message, and the second message type characteristic information is the same as or different from the first message type characteristic information.
8. The method according to claim 7, characterized in that The determining the target message forwarding mode according to the first message type characteristic information in the first fragment message includes: If the target message is determined to be a control message according to the first message type characteristic information in the first fragment message, the target message forwarding mode is determined to be a receiver scaling mode, and the first processor core is the same as the second processor core.
9. The method according to claim 7, characterized in that: The determining the target message forwarding mode according to the first message type characteristic information in the first fragment message includes: If the target message is determined to be a data message based on the first message type characteristic information in the first fragment message, the target message forwarding mode is determined to be a dynamic load balancing mode, and the first processor core is different from the second processor core.
10. The method according to claim 1, characterized in that The method further comprises: In response to receiving a processed target message corresponding to the reorganized target message, determining a sending order of the processed target message according to the first message sequence number carried in the processed target message and the message sequence number currently stored in the order-preserving queue; Sending the processed target message to the corresponding destination device according to the sending order; The message sequence number corresponding to the processed target message is deleted from the sequence-preserving queue, wherein the message sequence number corresponding to the processed target message includes the message sequence number assigned to each fragment message of the target message.
11. A network card, characterized in that: The network card includes a programmable chip, and the network card is respectively connected to multiple processor cores in the gateway device; The programmable chip is used for caching first tuple information of the first fragment message in response to receiving the first fragment message of the target message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information; Sending the first fragment message to the first processor core through a target message forwarding mode; In response to receiving a subsequent fragment message of the target message, extracting second tuple information of the subsequent fragment message; Querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by using the second sub-tuple information to restore the first tuple information of the subsequent fragment message; Based on the first tuple information recovered from the subsequent fragment message, determine to send the subsequent fragment message from which the first tuple information is recovered to a second processor core through the target message forwarding mode, where the first processor core is the same as or different from the second processor core; Among them, if the target message forwarding mode is a dynamic load balancing mode, the programmable chip is specifically used to: assign a first message sequence number corresponding to the first fragment message in the order-preserving queue corresponding to the target service, and send the first fragment message carrying the first message sequence number to the first processor core in a polling manner, and the target message corresponds to the target service; and assign a second message sequence number corresponding to the subsequent fragment message in the order-preserving queue, or determine that the message sequence number used by the subsequent fragment message is the first message sequence number; send the subsequent fragment message carrying the second message sequence number or the first message sequence number to the second processor core in a polling manner, so that the first processor core and the second processor core realize the reorganization of the first fragment message and the subsequent fragment message, and process the reorganized target message, wherein the reorganized target message includes the first message sequence number, and in the dynamic load balancing mode, the first processor core is different from the second processor core.
12. A gateway device, characterized in that: include: Multiple processor cores; A network card, wherein the network card includes a programmable chip and the network card is communicatively connected to the multiple processor cores respectively; The programmable chip is used to: in response to receiving a first fragment message of a target message, cache first tuple information of the first fragment message, wherein the first tuple information includes first sub-tuple information and second sub-tuple information; Sending the first fragment message to the first processor core through a target message forwarding mode; In response to receiving a subsequent fragment message of the target message, extracting second tuple information of the subsequent fragment message; Querying the first sub-tuple information identical to the second tuple information from the cache information table, and completing the second tuple information by using the second sub-tuple information to restore the first tuple information of the subsequent fragment message; Based on the first tuple information recovered from the subsequent fragment message, determine to send the subsequent fragment message from which the first tuple information is recovered to a second processor core through the target message forwarding mode, where the first processor core is the same as or different from the second processor core; Among them, if the target message forwarding mode is a dynamic load balancing mode, the programmable chip is specifically used to: assign the first message sequence number corresponding to the first fragment message in the order-preserving queue corresponding to the target service, and send the first fragment message carrying the first message sequence number to the first processor core in a polling manner, and the target message corresponds to the target service; and assign the second message sequence number corresponding to the subsequent fragment message in the order-preserving queue, or determine that the message sequence number used by the subsequent fragment message is the first message sequence number; send the subsequent fragment message carrying the second message sequence number or the first message sequence number to the second processor core in a polling manner, so that the first processor core and the second processor core realize the reorganization of the first fragment message and the subsequent fragment message, and process the reorganized target message, wherein the reorganized target message includes the first message sequence number, and in the dynamic load balancing mode, the first processor core is different from the second processor core.
13. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable codes, and when the executable codes are executed by a programmable chip in a gateway device, the programmable chip executes the method according to any one of claims 1 to 10.
14. A computer program product, characterized in that include: A computer program, when the computer program is executed by a programmable chip in a gateway device, causes the programmable chip to execute the method as described in any one of claims 1-10.
Citation Information
Patent Citations
Message shunting method and device
CN110601990A
Message processing method and device
CN115580584A