Message forwarding methods, network cards, gateways, media and products
By determining the packets to be discarded in network communication and updating the queue, the problem of message discarding affects transmission efficiency is solved, and the transmission efficiency is improved while achieving order-keeping transmission of packets.
Patent Information
- Application Number
- CN202411676705.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-21
AI Technical Summary
When performing message order-saving transmission, message discarding will reduce transmission efficiency. How to improve the impact of message order-saving transmission while ensuring message order-saving transmission.
In an alternative ordered message that has not been acquired by the processor, determine the message to be discarded and delete its meta information from the pre-update queue to obtain the post-update queue. Then, for the undiscarded packet, if its meta information was first written to the updated queue, the processing result will be forwarded to the message receiver.
Through the use of the updated queue, the order-proof transmission of undiscarded messages is realized, and the real-time performance of gateway acknowledgement packet discarding is improved, thereby improving the transmission efficiency of orderly messages.
Smart Images

Figure CN119182732B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communication technology, and in particular to a message forwarding method, a network card, a gateway, a medium and a product. Background Art
[0002] In network communications, data consistency and integrity are key factors in ensuring data accuracy, and data consistency and integrity are very important in many scenarios, such as real-time communications, transaction processing in databases, etc. Data integrity and consistency can usually be achieved using a message order preservation mechanism. Message order preservation refers to a mechanism in network communications that ensures that ordered messages with strict requirements on the order in which they are sent can be received, processed, and forwarded in the order in which they are sent.
[0003] In practice, the reliability of network communication can often be ensured by discarding packets. However, packet discarding will reduce the transmission efficiency of message order-preserving transmission. Based on this, when packet discarding occurs during message order-preserving transmission, how to improve the impact of packet discarding on message transmission efficiency while ensuring message order-preserving transmission becomes an urgent problem to be solved. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a message forwarding method, a network card, a gateway, a medium and a product, which are used to ensure that messages are sent in order while improving the impact of message discard on message transmission efficiency.
[0005] In a first aspect, an embodiment of the present invention provides a network attack processing method, including:
[0006] Determine a message to be discarded from candidate ordered messages that are not acquired by the processor, wherein the candidate ordered messages are included in the original ordered messages sent by the message sender;
[0007] Deleting the meta information of the to-be-discarded message from the pre-update queue to obtain a post-update queue, wherein the pre-update queue contains the meta information of the original ordered messages, and the writing order of the meta information in the queue is the same as the sending order of the messages carrying the meta information;
[0008] For any message that is not discarded in the original ordered messages, if the meta-information of the message is the meta-information written into the updated queue earliest, the processing result generated by the processor after processing the message is forwarded to the message receiver.
[0009] In a second aspect, an embodiment of the present invention provides a network card, including: an I / O system and a message transceiver system;
[0010] The I / O system is used to transmit the original ordered message sent by the message sender to the processor; determine the message to be discarded among the candidate ordered messages not transmitted to the processor, and the candidate ordered messages are included in the original ordered messages;
[0011] The message transceiver system is used to send the original ordered message to the I / O system;
[0012] Deleting the meta information of the to-be-discarded message from the pre-update queue to obtain a post-update queue, wherein the pre-update queue contains the meta information of the original ordered messages, and the writing order of the meta information in the queue is the same as the sending order of the messages carrying the meta information;
[0013] For any message that is not discarded in the original ordered messages, if the meta-information of the message is the meta-information written into the updated queue earliest, the processing result generated by the processor after processing the message is forwarded to the message receiver.
[0014] In a third aspect, an embodiment of the present invention provides a gateway, including: a network card and a processor;
[0015] The processor is used to process the message sent by the network card; and send the processing result of the message to the network card;
[0016] The network card is used to determine the message to be discarded from the candidate ordered messages that have not been transmitted to the processor, the candidate ordered messages being included in the original ordered messages sent by the message sender;
[0017] Deleting the meta information of the to-be-discarded message from the pre-update queue to obtain a post-update queue, wherein the pre-update queue contains the meta information of the original ordered messages, and the writing order of the meta information in the queue is the same as the sending order of the messages carrying the meta information;
[0018] For any message in the original ordered messages that is not discarded, if the meta information of the message is the meta information written into the updated queue earliest, the processing result of the message is forwarded to the message receiver.
[0019] In a fourth 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 processor of an electronic device, the processor can at least implement the message forwarding method described in the first aspect.
[0020] In a fifth aspect, an embodiment of the present invention provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the processor can implement the message forwarding method described in the first aspect above.
[0021] The message forwarding method provided by the embodiment of the present invention comprises: determining the message to be discarded from the candidate ordered messages that are not obtained by the processor, and deleting the metadata of the message to be discarded from the queue before updating to obtain the queue after updating. The candidate ordered message is included in the original ordered message sent by the message sender, and the queue before updating contains the metadata of the original ordered message. And whether it is the queue before updating or the queue after updating, the writing order of the metadata in the queue is the same as the sending order of the message carrying the metadata. Based on the above-mentioned queue after updating, when the processing result generated by the processor after processing any message that is not discarded is obtained, if the metadata of the message is the earliest written into the queue after updating, the processing result of the message can be further sent to the message receiver.
[0022] In the above method, since the writing order of the meta-information in the updated queue is the same as the sending order of the non-discarded messages, the gateway can still achieve the order-preserving transmission of the non-discarded messages by using the updated queue. In addition, the real-time confirmation of the occurrence of message discarding by the gateway can also be improved by updating the meta-information, and the message discarding can be confirmed without having to wait for a long time without receiving the processing result of the message. Since the waiting time required to confirm the discarding of the message is omitted, the gateway can transmit the ordered messages more timely, that is, improve the transmission efficiency of the ordered messages. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. 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 paying creative work.
[0024] Figure 1 A schematic diagram of the structure of a gateway provided by an embodiment of the present invention;
[0025] Figure 2 A schematic diagram of a data structure of a queue provided by an embodiment of the present invention;
[0026] Figure 3 A schematic diagram of the structure of a processor in a gateway provided by an embodiment of the present invention;
[0027] Figure 4 A schematic diagram of the structure of a network card in a gateway provided by an embodiment of the present invention;
[0028] Figure 5 A schematic diagram of the structure of another network card in a gateway provided by an embodiment of the present invention;
[0029] Figure 6 A schematic diagram of the structure of another network card in a gateway provided by an embodiment of the present invention;
[0030] Figure 7 A schematic diagram of the structure of another gateway provided by an embodiment of the present invention;
[0031] Figure 8 A flowchart of a message forwarding method provided by an embodiment of the present invention;
[0032] Fig. 9 A schematic structural diagram of a message forwarding device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0033] 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.
[0034] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.
[0035] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0036] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to identifying", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is identified" may be interpreted as "when determining" or "in response to determining" or "when identifying (stated condition or event)" or "in response to identifying (stated condition or event)", depending on the context.
[0037] 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 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.
[0038] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.
[0039] 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.
[0040] In addition, the message processing methods provided in the following embodiments of the present invention can be specifically executed by a gateway. In order to facilitate understanding of the solution content, the working process of the gateway can be described below in conjunction with the internal structure of the gateway. Figure 1 to Figure 7 A detailed description of the illustrated embodiments.
[0041] Figure 1 A schematic diagram of the structure of a gateway provided by an embodiment of the present invention. Figure 1 As shown, the gateway may include: a network card and a processor.
[0042] In the process of network communication, the working process of the gateway can be summarized as follows: the processor can process the message received by the network card and sent by the message sender to obtain the processing result of the message. The network card can receive the message sent by the message sender and forward the processing result of the message to the message receiver.
[0043] The specific working process of the gateway can be described in detail below:
[0044] The network card can receive the ordered messages continuously sent by the message sender, which can be called the original ordered messages, and further forward the original ordered messages to the processor. The processor can process the received messages. Optionally, the message processing process of the processor can include parsing the integrity of the message, parsing the message header, routing decision, etc. In the process of continuously receiving the original ordered messages, the network card can also create a pre-update queue for the received original ordered messages. Optionally, the creation method can be: the network card can write the meta information of the original ordered messages into the pre-update queue in sequence according to the order in which the message sender sends the original ordered messages.
[0045] Optionally, the meta information of the message may include a sequence number and / or a sending timestamp of the message. Optionally, the internal structure of the queue provided in each embodiment of the present invention may also be as follows: Figure 2 As shown. Figure 2 In the queue shown, the first column in the queue indicates the sequence number of the message, and the second column indicates the sending timestamp of the message. A head pointer may be set at the top of the queue, and a tail pointer may be set at the bottom of the queue.
[0046] For the pre-update queue created in the above manner, the message carrying the earliest meta-information written into the queue should be the earliest message forwarded to the message receiver. Therefore, based on the storage position of the meta-information in the queue, the network card can achieve the order-preserving transmission of the ordered messages. And in an ideal situation, the order in which the message sender sends the original ordered messages, the order in which the network card forwards the original ordered messages, and the order in which the message receiver receives the original ordered messages should all be the same.
[0047] However, in practice, considering the processing power of the processor and the input / output (I / O) bandwidth between the processor and the network card, when the I / O bandwidth is higher than the processing power of the processor, the processor often cannot obtain all the original ordered messages sent by the network card, and the ordered messages in the original ordered messages that are not obtained by the processor can be called candidate ordered messages. In order to ensure the reliability of network communication and reduce latency, the network card can further determine the message to be discarded from the candidate ordered messages, and when discarding the message to be discarded, the meta information of the message to be discarded is also deleted from the queue before update to obtain the queue after update.
[0048] In the case where the ordered message is discarded, the processor can still process any message normally obtained by the processor in the original ordered message to obtain the processing result. When the gateway obtains the processing result of any message, if the metadata of any message is the metadata written into the updated queue the earliest, indicating that the any message is the earliest message to be sent among the ordered messages obtained by the processor, the network card can further forward the processing result of the processing of the any message to the message receiver, and at this time, the network communication of the any message between the message sender and the message receiver is completed.
[0049] It is easy to understand that, since the writing order of the meta-information in the queue before the update is the same as the sending order of the original ordered messages, the writing order of the meta-information in the queue after the update is also the same as the sending order of the messages obtained by the processor in the original ordered messages. Therefore, even if the message is discarded and the meta-information is deleted, the use of the updated queue can still ensure that the messages obtained by the processor are transmitted in an orderly manner.
[0050] Optionally, the gateway provided in each embodiment of the present invention may be a physical gateway or a virtual gateway, and the virtual gateway may be deployed in a physical network or a cloud network. Optionally, the network card may also be a virtual network card or a physical network card. An optional implementation of a physical network card may be a field programmable gate array (FPGA). Optionally, the processor may be a central processing unit (CPU) or a graphics processing unit (GPU), a microcontroller such as an FPGA.
[0051] Optionally, the network card and the processor can use the high-speed communication path provided by Peripheral Component Interconnect Express (PCIe) to transmit the message and its processing results. Optionally, while using the communication path provided by PCIe, the network card and the processor can also use the direct memory access (DMA) mechanism to transmit the message and its processing results.
[0052] In this embodiment, the gateway can determine the message to be discarded from the candidate ordered messages that are not obtained by the processor, and delete the metadata of the message to be discarded from the pre-update queue to obtain the post-update queue. Among them, whether it is the pre-update queue or the post-update queue, the writing order of the metadata in the queue is the same as the sending order of the message carrying the metadata. Based on the above-mentioned post-update queue, when the gateway obtains the processing result generated by the processor after processing any message that is not discarded, if the metadata of the message is the earliest written into the post-update queue, the gateway can forward the processing result of the message to the message receiver.
[0053] In the above method, since the writing order of the meta-information in the updated queue is the same as the sending order of the non-discarded messages, the gateway can still achieve the order-preserving transmission of the non-discarded messages by using the updated queue. In addition, the real-time confirmation of the occurrence of message discarding by the gateway can also be improved by updating the meta-information, and the message discarding can be confirmed without having to wait for a long time without receiving the processing result of the message. Since the waiting time required to confirm the discarding of the message is omitted, the gateway can transmit the ordered messages more timely, that is, improve the transmission efficiency of the ordered messages.
[0054] exist Figure 1 In the illustrated embodiment, when ordered message discard occurs, the gateway may update the queue, and the update of the queue may enable the gateway to promptly confirm the discard of the message, so that the gateway may save the waiting time required to confirm the discard of the message, thereby improving the transmission efficiency of the ordered messages.
[0055] In order to further improve the transmission efficiency of ordered messages, the gateway may optionally also perform a timeout detection on the processing result fed back by the processor, and use the detection result to determine whether to further update the updated queue.
[0056] Specifically, for any message in the original ordered messages that is processed normally, after the gateway obtains the processing result of the any message, the gateway can compare the receiving time of the processing result with the sending timestamp of the any message in the updated queue.
[0057] If the first time difference between the two timestamps is less than the preset duration, it indicates that the time spent by the processor to process any message and feedback the processing result has not timed out, and the metadata of any message is the metadata written into the updated queue earliest, then the gateway can forward the processing result of any message to the message receiver.
[0058] If the first time difference between the two timestamps is greater than or equal to the preset duration, it indicates that the time taken by the processor to process any message and feed back the processing result has timed out. And before reaching the target timestamp, the gateway has obtained the processing result of another message after the message fed back by the processor. When reaching the target timestamp, the gateway can assume that an exception occurred when the processor was processing the message. Among them, the target timestamp is earlier than the receiving timestamp of the processing result of any message, and the time difference between the target timestamp and the sending timestamp of any message is equal to the preset duration, which is also the maximum time taken by the processor to process the message and feed back the message result.
[0059] In the above case, the gateway can delete the processing result of any message and forward the processing result of another message to the message receiver. In addition, since the processing result of any message has timed out, the gateway can also delete the meta information of any message from the updated queue and discard the processing result of any message.
[0060] In this embodiment, when the gateway receives the processing result of the message, the gateway can use the first time difference to determine whether the processing result has timed out. The timed-out processing result can be considered as meaningless and unnecessary to be forwarded to the message receiver. It is precisely because the meaningless timed-out processing result is not sent to the message receiver that the message transmission efficiency can be improved, and at the same time, the receiver can be unaffected by the timed-out processing result when processing the processing result that has not timed out.
[0061] For the updated queue, optionally, the gateway may also periodically determine whether to further update the updated queue according to the system timestamp of the gateway.
[0062] Specifically, when the gateway has not received the processing result of the message and reaches the detection period, the gateway can obtain the sending timestamp of any message and its own system timestamp. If the second time difference between the two timestamps is less than the preset duration, indicating that the time consumed by the processor to process the message and feedback the processing result has not timed out, the gateway can keep the updated queue unchanged and continue to wait for the processor to feedback the processing result of any message. If the second time difference is greater than or equal to the preset duration, indicating that the time consumed by the processor to process the message and feedback the processing result has timed out, the gateway can delete the metadata of any message from the updated queue. Optionally, the length of the detection period is less than the preset duration.
[0063] In this embodiment, the gateway may periodically compare the reception timestamp of the message with the gateway system timestamp, and use the time difference between the timestamps to determine whether to further update the updated queue.
[0064] The above embodiments are actually timeout detection mechanisms executed in the gateway, and it should be noted that the process in which the gateway uses the first time difference and the second time difference to determine whether to update the updated queue can be executed independently, that is, when receiving the processing result of the message, the gateway can use the first time difference to determine whether to update the queue. When the detection period is reached, the gateway can use the second time difference to determine whether to update the queue.
[0065] It should also be noted that the above embodiments disclose that when the original ordered message is discarded, the gateway can update the queue after the update periodically or after receiving the processing result of the message, but optionally, the above queue update process can be performed even if the original ordered message is not discarded, except that the queue before the update is updated instead of the queue after the update.
[0066] In summary, on the one hand, when ordered messages are discarded, the gateway can promptly confirm the discard of messages in the original ordered messages by updating the queue before updating, without having to confirm the discard of messages after not receiving the processing results of the messages for a long time. This allows the gateway to transmit the ordered messages that have not been discarded more promptly, thereby improving the transmission efficiency of the messages.
[0067] On the other hand, the gateway can periodically detect whether the time taken by the processor to process the message and feedback the processing result has timed out. For the message that has timed out, the gateway can consider that the message cannot be sent normally, and send the processing result of the subsequent message to the message receiver. Since the gateway does not need to wait for a long time without receiving the processing result of the message before confirming that the message cannot be sent, the transmission efficiency of the gateway's message can also be improved.
[0068] On the other hand, when receiving the processing result of the message, the gateway can also determine whether the processing result is meaningful, so as to improve the impact of sending meaningless processing results on the message receiver.
[0069] The above overall description of the working process of the gateway, the following will describe in detail the internal structure and working process of the processor and network card in the gateway.
[0070] Figure 3 A schematic diagram of the structure of a processor provided in an embodiment of the present invention. The processor is also Figure 1 The processor in the gateway shown is Figure 3 As shown, a processor may include a memory system and a core.
[0071] After receiving the original ordered message sent by the message sender, the network card can optionally respond to the data write instruction and write the original ordered message into the storage system inside the processor in sequence. The storage system may include a register. Correspondingly, when the register is full, it indicates that the processing limit of the processor has been reached. At this time, the network card can respond to the interrupt signal and stop writing the original ordered message. The message in the original ordered message that has not been written into the storage space is the candidate ordered message. Optionally, the data write instruction and the interrupt signal can be generated by the network card in the gateway.
[0072] Alternatively, the network card may also write the original ordered message into the storage system of the processor in response to the acquisition of the write descriptor, and the storage system may include a memory. The write descriptor may be regarded as a token, which is used to indicate that the network card can write data into the memory. The write descriptor may be generated by the network card. Correspondingly, when the network card does not obtain the write descriptor, it indicates that the processing limit of the processor has been reached. Since there is no write descriptor, the original ordered message cannot continue to be written into the memory of the processor, and the ordered data packets in the original ordered message that cannot be written into the memory can be used as alternative ordered messages.
[0073] In this embodiment, the network card can control the orderly writing of messages into the storage system in the processor in different ways, and the data volume of the written messages will not exceed the processing upper limit of the processor, thus ensuring efficient processing of the messages by the processor.
[0074] like Figure 3 As shown, optionally, the number of cores in the processor may be at least one, and different cores may be allocated different ordered messages. A core may read the ordered message allocated to it from the storage system and process it.
[0075] For the distribution of messages, an optional method is to distribute them in the order in which the ordered messages are written into the storage system. For example, if the processor includes cores 1 to 4, the first ordered message written into the storage system can be distributed to core 1, the second ordered message written into the storage system can be distributed to core 2, and so on.
[0076] Alternatively, the message data in the ordered message may be hashed and distributed according to the association between the value range of the hash calculation result and the core. For example, the processor includes cores 1 to 4, core 1 is associated with value range 1, core 2 is associated with value range 2, and so on. If the hash calculation result of the ordered message falls within value range 1, the ordered message may be distributed to core 1.
[0077] In practice, the above message distribution method can be selected according to needs.
[0078] In this embodiment, the network card can distribute the ordered messages in any manner so that at least one core in the processor processes the messages distributed to it. The above distribution method can ensure that the workload of different cores in the processor is relatively even, reduce the load pressure of a single core, and improve the processor's processing efficiency of messages. And when the ordered messages sent by the message sender are elephant flows, the network card's distribution of messages can more significantly improve the message processing efficiency.
[0079] Figure 4 A schematic diagram of the structure of a network card provided by an embodiment of the present invention. The processor is also Figure 1 The network card in the gateway shown is Figure 4 As shown, the network card in the gateway may include: an input / output (ie, I / O) system and a message receiving and sending system.
[0080] Figure 1 In the illustrated embodiment, the work contents of the network card can be split and executed by the I / O system and the message transceiver system respectively.
[0081] Specifically, the message transceiver system can receive and forward the original ordered message sent by the message sender to the I / O system. The I / O system can further send the original ordered message to the processor. The message transceiver system can delete the meta-information of the message to be discarded from the queue before the update to obtain the queue after the update. The I / O system can discard the message to be discarded. For any message that has not been discarded in the original ordered message, the processing result obtained by the processor after processing the any message can also be fed back to the message transceiver system with the help of the I / O system. If the meta-information of any message is the meta-information written into the queue after the update earliest, the message transceiver system can also forward the processing result of any message to the message receiver.
[0082] In addition, the contents not described in detail in this embodiment and the beneficial effects that can be achieved can be found in Figure 1 The relevant description in the illustrated embodiment will not be repeated here.
[0083] The internal structure and working process of the I / O system and the message receiving and sending system in the network card can also be described in detail below.
[0084] Figure 5 A schematic diagram of the structure of another network card provided by an embodiment of the present invention. Figure 4 Based on the embodiment shown, Figure 5 As shown, the message transceiving system in the network card may specifically include a message transceiving module.
[0085] Optionally, in addition to ordered messages with requirements on the sending order, the message sender may also send ordinary messages with no requirements on the sending order to the network card, and the different types of messages sent by the message sender to the network card may be collectively referred to as messages to be processed. Since the various embodiments of the present invention focus on the processing of ordered messages, after obtaining the message to be processed, the message transceiver module may optionally determine whether the message to be processed is an ordered message or an ordinary message based on the meta-information carried by the message.
[0086] Specifically, if the meta-information carried by the message contains an ordered identifier, the message transceiver module can determine that the message to be processed is an original ordered message. As the name implies, the ordered identifier is used to indicate that the message is ordered and needs to be transmitted in order. It is easy to understand that the ordered identifier can also be stored in the queue as an item in the meta-information. Figure 2 As shown, the third column in the queue indicates the order mark of the message, which can be represented by order_vld. For this original ordered message, the network card can further process it according to the methods provided by the embodiments of the present invention.
[0087] In an optional situation, for any message in the original ordered message that is not discarded, when the message transceiver module receives the processing result of any message, and the metadata of the message is the metadata written into the updated queue earliest, the message transceiver module can also forward the processing result to the message receiver.
[0088] like Figure 4 As shown, optionally, the message transceiver system may further include a cache. In another optional case, when the message transceiver module receives the processing result of any message, but the meta information of the message is not the meta information written into the updated queue earliest, the message transceiver module may also cache the processing result to the local cache.
[0089] In another optional situation, for multiple messages that are not discarded in the original ordered messages, the message transceiver module can also receive the processing results of each of the multiple messages at the same time. Then, the message transceiver module can forward the processing results of each of the multiple messages to the message receiver in sequence according to the order of their respective metadata in the updated queue.
[0090] Optionally, the message transceiver module may also distribute corresponding original ordered messages to at least one core in the processor.
[0091] In this embodiment, the message transceiving module in the message transceiving system can realize the sending and receiving of messages and message processing results, and can also identify ordered messages using its own identification function, thereby ensuring the correct processing of ordered messages and ordinary messages.
[0092] like Figure 4As shown, optionally, the message transceiver system may further include a queue management module. The queue management module may create a pre-update queue for the original ordered message during the process of the message transceiver module receiving the original ordered message.
[0093] Specifically, the queue management module may write the meta information of the original ordered messages in sequence according to the order in which the message sender sends the original ordered messages, so as to obtain the queue before the update. Optionally, the meta information of the ordered messages may include the sequence number and / or the sending timestamp of the messages, and the meta information may also reflect the sending order of the original ordered messages. The queue management module may sort the meta information in ascending order, and create the queue before the update according to the ascending sorting result. The meta information of an ordered message may be used as an element in the queue.
[0094] Since the queue before update is created according to the ascending sorting result of the meta-information, the meta-information of the ordered message that is sent earliest by the message sender and needs to be forwarded first can be located at the top of the queue. At this time, for the processing result of the message fed back by the processor, if the meta-information of the message is at the top of the queue, the message transceiver module can directly forward the processing result of any message to the message receiver. It is easy to understand that if the queue before update is created according to the descending sorting result of the meta-information, the meta-information of the ordered message that is sent earliest by the message sender and needs to be forwarded first can be located at the bottom of the queue.
[0095] When it happens Figure 1 When the ordered messages mentioned in the illustrated embodiment are discarded, optionally, the queue management module can also create an abnormal queue by sorting the meta information of the messages to be discarded, and compare the elements contained in the queue before updating and the abnormal queue respectively, and finally, delete the meta information of the messages to be discarded from the queue before updating according to the comparison result, so as to obtain the queue after updating. Wherein, the abnormal queue can include the meta information of the messages to be discarded. And in order to ensure the accuracy of the queue after updating, when creating the queue before updating and the abnormal queue, the queue management module can use the same sorting method for the meta information. Optionally, the queue before updating and the abnormal queue can compare the elements at the top of the queue, or all the elements in the queue. And in practice, the messages to be discarded can usually be multiple, so it is more appropriate to compare all the elements of the queue, because all the elements can be compared to determine all the messages to be discarded at one time.
[0096] In this embodiment, when a packet is discarded, the queue management module in the packet transceiver system can update the meta information in the queue to obtain an updated queue that can reflect the packet loss situation.
[0097] like Figure 4As shown, optionally, the message transceiver system may further include a timeout processing module. The coordinated work of the timeout processing module and the queue management module may enable the network card to implement the timeout detection mechanism mentioned in the above-mentioned related embodiments.
[0098] Specifically, when the message transceiver module receives the processing result of any message that is not discarded and is fed back by the processor, the timeout processing module can obtain the receiving timestamp of the processing result of any message and the sending timestamp of any message in the updated queue. If the first time difference between the two timestamps is less than the preset time length, and the meta-information of any message is the meta-information written into the updated queue the earliest, the timeout processing module can control the message transceiver module to forward the processing result to the message receiver; otherwise, the timeout processing module can discard the processing result and control the queue management module to delete the meta-information of any message from the updated queue.
[0099] When the gateway does not receive the processing result of the message and reaches the detection period, the timeout processing module can obtain the sending timestamp of any message and the system timestamp corresponding to the gateway. If the second time difference between the two timestamps is less than the preset time length, the timeout processing module will continue to wait for the processing result of any message and control the queue management module to keep the updated queue unchanged; otherwise, the timeout processing module can control the queue management module to delete the metadata of any message from the updated queue.
[0100] In this embodiment, the coordinated work of the timeout processing module and the queue management module can realize further updating of the updated queue so that the network card has a timeout detection mechanism. For the contents not described in detail in this embodiment, please refer to the relevant description in the above embodiment, which will not be repeated here.
[0101] Figure 6 A schematic diagram of the structure of another network card provided by an embodiment of the present invention. Figure 4 Based on the embodiment shown, Figure 6 As shown, the I / O system may include an I / O controller, a packet loss processing module, and a cache. And for the sake of distinction, the cache in the I / O system may be referred to as a first cache, and the cache in the message transceiver system may be referred to as a second cache.
[0102] The I / O controller may transmit the original ordered message sent by the message sender to the processor so that the core in the processor can process the message. The first cache may store the candidate ordered messages that are not received by the processor in the original ordered message. The packet loss processing module may determine the message to be discarded from the candidate ordered messages.
[0103] As for determining the messages to be discarded, in an optional manner, the packet loss processing module may directly use all candidate ordered messages as the messages to be discarded.
[0104] Although the discard of a large number of messages will not affect the orderly transmission of messages, it will affect the integrity of the data. Therefore, in another optional way, the packet loss processing module can first determine the total length of the candidate ordered messages in the first cache, and calculate the length difference between the total length and the preset length. If the total length of the candidate ordered messages is greater than the preset length, indicating that the occupancy rate of the first cache has reached the preset upper limit, the packet loss processing module can determine the target element closest to the top of the queue in the queue before the update based on the length difference, and determine the message corresponding to the target element as the message to be discarded. The packet loss processing module can also delete the message to be discarded from the first cache.
[0105] The meta information written into the queue the earliest is at the top of the queue. The total length of the messages to be discarded is equal to the difference between the total length of the candidate ordered messages and the preset length. Optionally, the message length can also be stored in the queue as an item in the meta information. Figure 2 As shown, the fourth column in the queue indicates the message length.
[0106] In this embodiment, the packet loss processing module can start the message discarding mechanism in a timely manner to ensure that the occupancy rate of the first cache is at a reasonable level.
[0107] In addition, according to Figure 5 As can be seen from the illustrated embodiment, the queue management module can sort the meta information of the messages to be discarded to create an abnormal queue. Optionally, the I / O system may include a meta information recovery module. After the packet loss processing module determines the messages to be discarded, the meta information recovery module can obtain the meta information of the messages to be discarded, and send the meta information of the messages to be discarded to the queue management module, so that the queue management module can create an abnormal queue.
[0108] In this embodiment, the coordinated work of the queue management module and the meta-information recovery module can realize the update of the meta-information in the queue to obtain an updated queue that can reflect the packet loss situation.
[0109] In addition, the above Figure 1 to Figure 6 The specific working process of each device in the embodiment shown can also be combined with Figure 7 Understand. And combine Figure 1 to Figure 7 The description in the illustrated embodiments and the technical effects that can be achieved by using the gateway provided by each embodiment of the present solution can also be understood in conjunction with the following contents:
[0110] In practice, the order-preserving transmission of ordered messages can be achieved with the help of a gateway. Specifically, the packet loss processing module in the gateway is used to discard messages. The processor in the gateway is used to perform various pre-transmission processing on the non-discarded messages to obtain processing results. The message transceiver module in the gateway can achieve order-preserving transmission of messages according to the metadata written in the queue. However, the message transceiver module needs to determine that the message has been discarded and send subsequent messages only after not receiving the processing results of the message for a long time.
[0111] However, in the above process, since different modules in the gateway discard, process, and send and receive messages, and the interaction process between the modules in the gateway is relatively simple, the message sending and receiving module cannot confirm whether the message is discarded in time. Before confirming that the message is discarded, the message sending and receiving module is always in a waiting state, during which the gateway cannot complete the transmission of any message, thus greatly reducing the efficiency of message transmission.
[0112] By using the solutions provided by the embodiments of the present invention, the metadata recovery module in the gateway can update the metadata of the discarded message to the queue in time. Since the updated queue no longer contains the metadata of the discarded message, the updated queue can reflect the discarding of the ordered message in real time. And with the help of this updated queue, the message transceiver module can confirm the discarding of the message in time, without having to confirm the discarding of the message after a long wait, that is, the waiting time of the message transceiver module is saved, thereby improving the transmission efficiency of the ordered message.
[0113] In addition, in the schemes provided by the embodiments of the present invention, since the meta-information in the queue before the update is sorted according to the message sending order slice, when no message discarding occurs, the transmission module can realize the order-preserving transmission of the messages to be processed based on the queue before the update. Similarly, after message discarding occurs, using the schemes provided by the embodiments of the present invention, the message transceiver module can also realize the order-preserving transmission of the ordered messages that have not been discarded using the queue after the update.
[0114] Above Figure 1 to Figure 7 The illustrated embodiment has described the process of the gateway efficiently transmitting the ordered messages that have not been discarded when the ordered messages are discarded from the perspective of the internal structure. On this basis, the working process of the gateway can also be described from the perspective of the process.
[0115] Figure 8 The flowchart of a message forwarding method provided by an embodiment of the present invention. The method provided by an embodiment of the present invention can be executed by the gateway provided by the above embodiments. Figure 1 As shown, the method may include the following steps:
[0116] S101, determining a message to be discarded from candidate ordered messages that are not acquired by a processor, wherein the candidate ordered messages are included in an original ordered message sent by a message sender.
[0117] S102, deleting the meta information of the message to be discarded from the pre-update queue to obtain the post-update queue, wherein the pre-update queue contains the meta information of the original ordered messages, and the writing order of the meta information in the queue is the same as the sending order of the messages carrying the meta information.
[0118] S103, for any message that is not discarded in the original ordered messages, if the meta information of any message is the meta information written into the updated queue earliest, forward the processing result generated by the processor after processing any message to the message receiver.
[0119] For the original ordered message sent by the message sender, the gateway can forward it to the processor so that the processor can process the original ordered message. However, when the I / O bandwidth between the processor and the network card is higher than the processing capacity of the processor, the processor often cannot obtain all the original ordered messages sent by the network card, and the ordered messages in the original ordered messages that are not obtained by the processor can be called alternative ordered messages. Optionally, the alternative ordered messages can be cached in the gateway. In this case, the gateway can further determine the message to be discarded in the alternative ordered messages and discard the message to be discarded. At the same time, the gateway can also delete the metadata of the message to be discarded from the queue before the update, thereby obtaining the queue after the update.
[0120] Based on the updated queue, in one case, for any message in the original ordered message that is normally obtained by the processor, if the gateway obtains the processing result of the any message fed back by the processor, and the meta-information of the any message is the meta-information written into the updated queue earliest, then the gateway can directly forward the processing result of the any message to the message receiver.
[0121] Optionally, in another case, if the meta-information of any message is not the earliest meta-information written into the updated queue, the gateway may cache the processing result of any message.
[0122] Optionally, in another case, for multiple messages that are not discarded in the original ordered messages, the gateway can also obtain the processing results of each of these multiple messages at the same time. At this time, the gateway can forward the processing results of each of the multiple messages to the message receiver in sequence according to the order of their respective metadata in the updated queue.
[0123] Optionally, the specific creation process of the pre-update queue and the post-update queue mentioned in this embodiment can also refer to the description in the above-mentioned related embodiments, which will not be repeated here.
[0124] In this embodiment, the gateway can determine the message to be discarded from the candidate ordered messages that are not obtained by the processor, and delete the meta information of the message to be discarded from the pre-update queue to obtain the post-update queue. Among them, whether it is the pre-update queue or the post-update queue, the writing order of the meta information in the queue is the same as the sending order of the message carrying the meta information. Based on the above post-update queue, when the processing result generated by the processor after processing any message that is not discarded is obtained, if the meta information of the message is the earliest written into the post-update queue, the processing result of the message can be forwarded to the message receiver.
[0125] In the above method, since the writing order of the meta-information in the updated queue is the same as the sending order of the non-discarded messages, the gateway can still achieve the order-preserving transmission of the non-discarded messages using the updated queue. In addition, the real-time confirmation of message discard can also be improved by updating the meta-information, and the message discard can be confirmed without having to wait for a long time without receiving the message processing result. Since the gateway saves the waiting time required to confirm the message discard, the orderly message transmission can be carried out more timely, that is, the message transmission efficiency is improved.
[0126] Optionally, according to the description in the above embodiments, the message sender can send a message to be processed to the gateway, and the message to be processed can be an ordered message or a common message. Optionally, after receiving the message to be processed, the gateway can identify whether the message to be processed is an ordered message based on the meta-information of the message to be processed, that is, identify whether the message to be processed is the original ordered message in the above embodiments. Specifically, if the meta-information of the message to be processed includes an ordered identifier, it can be determined that the message to be processed is an original ordered message.
[0127] As Figure 8 As described in the illustrated embodiment, for the original ordered message sent by the message sender, the gateway may forward it to the processor so that the processor processes the original ordered message.
[0128] Regarding the processing of the ordered messages by the processor, the processor may optionally use its own core to process the messages, and the processor may have at least one core, and each core may process the messages distributed to it respectively.
[0129] The distribution of the original ordered messages to the kernel may optionally be performed by hash calculation or average distribution. For details, please refer to the description in the above-mentioned related embodiments, which will not be repeated here.
[0130] For the distribution of the original ordered message to the kernel, the gateway may optionally send the original ordered message to the corresponding kernel in the processor in response to a data write instruction or in response to the acquisition of a write descriptor. When the memory occupancy rate of the processor reaches an upper limit, the gateway may optionally respond to an interrupt message to stop the distribution of the original ordered message. Optionally, the gateway may also stop the distribution of the original ordered message when the write descriptor is not acquired. For the specific content, please refer to the relevant description in the above embodiments, which will not be repeated here.
[0131] In order to ensure the transmission efficiency of the ordered messages, the gateway may optionally also implement a timeout detection mechanism. Optionally, the gateway may determine whether to further update the updated queue according to the time when the processor feeds back the message processing result.
[0132] Specifically, for any message in the original ordered messages that is processed normally, after the gateway obtains the processing result of the any message, the gateway can compare the receiving time of the processing result with the sending timestamp of the any message in the updated queue.
[0133] If the first time difference between the two timestamps is less than the preset duration, the gateway may forward the processing result of any message to the message receiver.
[0134] If the first time difference between the two timestamps is greater than or equal to the preset time length, the gateway may consider that an exception occurred in the processor when processing any message, and the gateway may forward the processing result of another message after any message to the message receiver. The gateway may also delete the metadata of any message from the updated queue and discard the processing result of any message.
[0135] In this embodiment, when the gateway receives the processing result of the message, the gateway can use the first time difference to determine whether the processing result has timed out. The timed-out processing result can be considered as meaningless and unnecessary to be forwarded to the message receiver. It is precisely because the meaningless timed-out processing result is not sent to the message receiver that the message transmission efficiency can be improved, and at the same time, the receiver can be unaffected by the timed-out processing result when processing the processing result that has not timed out.
[0136] Optionally, the gateway may also periodically determine whether to further update the updated queue according to the system timestamp of the gateway.
[0137] Specifically, when the gateway does not receive the processing result of the message and reaches the detection period, the gateway can obtain the sending timestamp of any message and its own system timestamp. If the second time difference between the two timestamps is less than the preset duration, the gateway can keep the updated queue unchanged and continue to wait for the processor to feedback the processing result of any message. If the second time difference is greater than or equal to the preset duration, indicating that the time spent by the processor to process the message and feedback the processing result has timed out, the gateway can delete the metadata of any message from the updated queue.
[0138] In this embodiment, the gateway may periodically compare the reception timestamp of the message with the gateway system timestamp, and use the time difference between the timestamps to determine whether to further update the updated queue.
[0139] The message forwarding device of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that the device can be configured using commercially available hardware components through the steps taught in this solution.
[0140] Fig. 9 The structure diagram of a message forwarding device provided by an embodiment of the present invention is shown in FIG. The device can function as a gateway. Fig. 9 As shown, the device may include:
[0141] The packet loss processing module 11 is used to determine a message to be discarded from candidate ordered messages not acquired by the processor, wherein the candidate ordered messages are included in the original ordered messages sent by the message sender.
[0142] The queue management module 12 is used to delete the meta-information of the to-be-discarded message from the pre-update queue to obtain the post-update queue, wherein the pre-update queue contains the meta-information of the original ordered message, and the writing order of the meta-information in the queue is the same as the sending order of the message carrying the meta-information.
[0143] The message transceiver module 13 is used for forwarding the processing result generated by the processor after processing any message that is not discarded in the original ordered messages to the message receiver if the metadata of the message is the metadata written into the updated queue earliest.
[0144] Optionally, the meta information of any ordered message is used as an element of the queue, and the meta information written into the queue earliest is at the top of the queue.
[0145] The packet loss processing module 11 is used to determine the total length of the candidate ordered messages in the cache;
[0146] If the total length of the candidate ordered messages is greater than the preset length, determining the target element closest to the head of the queue in the queue before update according to the length difference between the total length and the preset length;
[0147] Determine a message carrying the meta information corresponding to the target element as the message to be discarded, wherein the length of the message to be discarded is equal to the length difference;
[0148] The to-be-discarded message is discarded.
[0149] Optionally, the message transceiver module 13 is used to receive a message to be processed sent by the message sender.
[0150] The queue management module 12 is used to sort the meta-information of the to-be-processed message in ascending order to obtain the pre-update queue when the meta-information of the to-be-processed message indicates that the to-be-processed message is the original ordered message, and the meta-information includes the sending timestamp and / or sequence number of the message.
[0151] Optionally, the queue management module 12 is used to sort the meta information of the to-be-discarded messages in ascending order to obtain an abnormal queue;
[0152] The elements contained in the original queue and the elements contained in the abnormal queue are compared to delete the meta-information of the message to be discarded from the original queue.
[0153] Optionally, the device also includes: a timeout detection module 14, which is used to obtain a receiving timestamp of a processing result of any message and a sending timestamp of any message in the updated queue; and determine a first time difference between the sending timestamp and the receiving timestamp.
[0154] The message transceiver module 13 is used to forward the processing result to the message receiver if the first time difference between the sending timestamp and the receiving timestamp is less than a preset duration, and the metadata of any message is the metadata written into the updated queue earliest.
[0155] The queue management module 12 is configured to delete the metadata of any message from the updated queue if the first time difference is greater than or equal to the preset duration.
[0156] Optionally, the message transceiver module 13 is configured to discard the processing result if the first time difference is greater than or equal to the preset duration.
[0157] Optionally, the timeout detection module 14 is used to obtain the sending timestamp of any message and the system timestamp corresponding to the gateway in response to the arrival of the detection period; and determine the second time difference between the sending timestamp and the system timestamp.
[0158] The queue management module 12 is configured to keep the updated queue unchanged and wait for the processing result of any message if the second time difference between the sending timestamp and the system timestamp is less than a preset duration;
[0159] If the second time difference is greater than or equal to the preset duration, the meta-information of any message is deleted from the updated queue.
[0160] Optionally, the message transceiver module 13 is used to receive the original ordered message sent by the message sender;
[0161] In response to a data write instruction or in response to obtaining a write descriptor, the original ordered message is distributed to a processor so that at least one core in the processor performs message processing;
[0162] In response to an interrupt signal, the distribution of the original ordered messages is stopped, so as to cache the candidate ordered messages in the original ordered messages that are not acquired by the processor.
[0163] Optionally, the message transceiver module 13 is configured to cache a processing result of any message if the meta-information of any message is not the meta-information written earliest into the updated queue.
[0164] Optionally, the message transceiver module 13 is used to forward the processing results of each of the multiple messages that are not discarded in the original ordered messages to the message receiver in the order of their respective metadata in the updated queue if the processing results of each of the multiple messages are received.
[0165] Fig. 9 The device shown can perform Figure 8 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 8 The implementation process and technical effects of this technical solution refer to Figure 8 The description in the illustrated embodiment will not be repeated here.
[0166] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium for storing a computing device instruction used by the above electronic device, which includes instructions for executing the above Figure 8 The procedures involved in the message forwarding method shown.
[0167] In addition, an embodiment of the present invention provides a computer program product. The computer program product includes a computer program or an instruction. When the computer program or the instruction is executed by a processor, the processor is enabled to implement the above Figure 8 The steps or functions of the message forwarding method shown.
[0168] 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 message forwarding method, characterized in that: The method comprises: Determine a message to be discarded from candidate ordered messages that are not acquired by the processor, wherein the candidate ordered messages are included in the original ordered messages sent by the message sender; Deleting the meta information of the to-be-discarded message from the pre-update queue to obtain a post-update queue, wherein the pre-update queue contains the meta information of the original ordered messages, and the writing order of the meta information in the queue is the same as the sending order of the messages carrying the meta information; For any message in the original ordered message that has not been discarded, if the first time difference between the sending timestamp of any message in the updated queue and the receiving timestamp of the processing result of any message is less than the preset duration, and the metadata of any message is the metadata written into the updated queue earliest, then the processing result generated by the processor after processing any message is forwarded to the message receiver.
2. The method according to claim 1, characterized in that The metadata of an ordered message is an element of the queue, and the metadata written into the queue earliest is at the top of the queue; The step of determining the message to be discarded from the candidate ordered messages not acquired by the processor includes: Determine the total length of the candidate ordered messages in the cache; If the total length of the candidate ordered messages is greater than the preset length, determining the target element closest to the head of the queue in the queue before update according to the length difference between the total length and the preset length; Determine the message carrying the meta information corresponding to the target element as the message to be discarded, wherein the length of the message to be discarded is equal to the length difference; The method further comprises: The to-be-discarded message is discarded.
3. The method according to claim 1, characterized in that The method further comprises: Receiving a message to be processed sent by the message sender; When the meta information of the to-be-processed message indicates that the to-be-processed message is the original ordered message, the meta information of the original ordered message is sorted in ascending order to obtain the pre-update queue, wherein the meta information includes a sending timestamp and / or a sequence number of the message.
4. The method according to claim 3, characterized in that The method further comprises: Sorting the meta information of the to-be-discarded messages in ascending order to obtain an abnormal queue; The step of deleting the meta information of the to-be-discarded message from the pre-update queue to obtain the post-update queue includes: The elements contained in the queue before updating and the elements contained in the abnormal queue are compared to delete the meta-information of the message to be discarded from the queue before updating.
5. The method according to claim 1, characterized in that The method further comprises: If the first time difference is greater than or equal to the preset duration, the metadata of any message is deleted from the updated queue, and the processing result is discarded.
6. The method according to claim 1, characterized in that The method further comprises: In response to the arrival of the detection period, obtaining a sending timestamp and a system timestamp of any of the messages; If the second time difference between the sending timestamp and the system timestamp is less than the preset duration, keeping the updated queue unchanged and waiting for the processing result of any message; If the second time difference is greater than or equal to the preset duration, the meta-information of any message is deleted from the updated queue.
7. The method according to claim 1, characterized in that The method further comprises: Receiving an original ordered message sent by the message sender; In response to a data write instruction or in response to obtaining a write descriptor, the original ordered message is distributed to a processor so that at least one core in the processor performs message processing; In response to an interrupt signal, the distribution of the original ordered messages is stopped, so as to cache the candidate ordered messages in the original ordered messages that are not acquired by the processor.
8. The method according to claim 1, characterized in that The method further comprises: For multiple messages that are not discarded in the original ordered messages, if the processing results of each of the multiple messages are received, the processing results of each of the multiple messages are forwarded to the message receiver according to the order of their respective meta-information in the updated queue.
9. A network card, characterized in that: include: I / O system and message receiving and sending system; The I / O system is used to transmit the original ordered message sent by the message sender to the processor; Determine a message to be discarded among candidate ordered messages that have not been transmitted to the processor, wherein the candidate ordered messages are included in the original ordered messages; The message transceiver system is used to send the original ordered message to the I / O system; Deleting the meta information of the to-be-discarded message from the pre-update queue to obtain a post-update queue, wherein the pre-update queue contains the meta information of the original ordered messages, and the writing order of the meta information in the queue is the same as the sending order of the messages carrying the meta information; For any message in the original ordered message that has not been discarded, if the first time difference between the sending timestamp of any message in the updated queue and the receiving timestamp of the processing result of any message is less than the preset duration, and the metadata of any message is the metadata written into the updated queue earliest, then the processing result generated by the processor after processing any message is forwarded to the message receiver.
10. The network card according to claim 9, characterized in that: The I / O system includes: an I / O controller and a packet loss processing module; The I / O controller is used to transmit the original ordered message to the processor so that the core in the processor performs message processing; The packet loss processing module is used to determine the message to be discarded among the candidate ordered messages that have not been transmitted to the processor.
11. The network card according to claim 10, characterized in that: The I / O system includes a first cache; The I / O controller is used to cache the candidate ordered messages in the first cache; The packet loss processing module is used to determine the total length of the candidate ordered messages; If the total length of the candidate ordered messages is greater than the preset length, determining the target element closest to the head of the queue in the queue before update according to the length difference between the total length and the preset length; Determine the message carrying the meta information corresponding to the target element as the message to be discarded, wherein the length of the message to be discarded is equal to the length difference; The to-be-discarded message is deleted from the first cache.
12. The network card according to claim 9, characterized in that: The message transceiving system comprises a message transceiving module, which is used to receive the message to be processed sent by the message sender; if the meta information of the message to be processed includes an ordered identifier, it is determined that the message to be processed is the original ordered message.
13. The network card according to claim 12, characterized in that: The message transceiver system further includes: a queue management module; The queue management module is used to delete the meta-information of the to-be-discarded message from the pre-update queue to obtain the post-update queue, wherein the pre-update queue contains the meta-information of the original ordered messages, and the writing order of the meta-information in the queue is the same as the sending order of the messages carrying the meta-information; The message transceiver module is used for forwarding the processing result of any message that is not discarded in the original ordered messages to the message receiver if the metadata of any message is the metadata written into the updated queue earliest.
14. The network card according to claim 13, characterized in that: The I / O system comprises: a meta information recovery module, used for sending the meta information of the to-be-discarded message to the queue management module; The queue management module is used to sort the meta information of the original ordered messages in ascending order to obtain the queue before updating, wherein the meta information includes a sending timestamp and / or a sequence number of the messages; The meta information of the to-be-discarded messages is sorted in ascending order to obtain an abnormal queue; The elements contained in the queue before updating and the elements contained in the abnormal queue are compared to delete the meta-information of the message to be discarded from the queue before updating.
15. The network card according to claim 13, characterized in that: The message transceiver system comprises: a timeout processing module, which is used to obtain a receiving timestamp of a processing result of any message and a sending timestamp of any message in the updated queue; If the first time difference between the sending timestamp and the receiving timestamp is less than a preset time length, and the meta-information of any message is the meta-information written into the updated queue earliest, then controlling the message transceiver module to forward the processing result to the message receiver; If the first time difference is greater than the preset duration, the processing result is discarded, and the queue management module is controlled to delete the metadata of any message from the updated queue.
16. The network card according to claim 15, characterized in that: The timeout processing module is used to obtain the sending timestamp of any message and the system timestamp corresponding to the gateway in response to the arrival of the detection period; If the second time difference between the sending timestamp and the system timestamp is less than the preset duration, waiting for the processing result of any message, and controlling the queue management module to keep the updated queue unchanged; If the second time difference is greater than the preset duration, the queue management module is controlled to delete the meta-information of any message from the updated queue.
17. The network card according to claim 9, characterized in that: The message transceiver system includes a second cache; The message transceiver system is used to cache the processing result of any message in the second cache if the meta-information of any message is not the meta-information written into the updated queue earliest.
18. A gateway, characterized in that: Including network card and processor; The processor is used to process the message sent by the network card; Sending the processing result of the message to the network card; The network card is used to determine the message to be discarded from the candidate ordered messages that have not been transmitted to the processor, the candidate ordered messages being included in the original ordered messages sent by the message sender; Deleting the meta information of the to-be-discarded message from the pre-update queue to obtain a post-update queue, wherein the pre-update queue contains the meta information of the original ordered messages, and the writing order of the meta information in the queue is the same as the sending order of the messages carrying the meta information; For any message in the original ordered message that has not been discarded, if the first time difference between the sending timestamp of any message in the updated queue and the receiving timestamp of the processing result of any message is less than the preset duration, and the metadata of any message is the metadata written into the updated queue earliest, then the processing result of any message is forwarded to the message receiver.
19. The gateway according to claim 18, characterized in that: The processor includes a core and a storage system, and the network card includes a cache; The network card is used to receive the original ordered message; In response to a data write instruction or in response to obtaining a write descriptor, writing the original ordered message into a storage system within the processor; In response to an interrupt signal, stop writing the original ordered message to cache the candidate ordered message in the original ordered message into a cache of the network card; The processor is used to process the message read from the storage system using the core in the processor.
20. A non-transitory machine-readable storage medium, characterized in that The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor executes the message forwarding method according to any one of claims 1 to 8.
21. A computer program product, characterized in that The computer program product includes a computer program or instructions, so that the computer program or instructions can implement the steps in the message forwarding method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Data processing method and device, electronic equipment and computer readable storage medium
CN112235234A