Message processing method, device, equipment, network card and computer program product

By determining and releasing the order-safe information in the order-safe queue in the FPGA module of the network card, the queue head blocking problem caused by packet loss in abnormal pressure scenarios is solved, and the delay and performance of packet forwarding is guaranteed.

CN119276790BActive Publication Date: 2025-03-11ALIBABA CLOUD COMPUTING CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411795755.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-11
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

When the network card is operating in abnormal pressure scenarios, it may cause packet loss in the sending direction to abnormally lose packets, resulting in blocking of the order-saving queue header, affecting the delay in subsequent message forwarding.

Method used

The current message to be processed is obtained through the FPGA module. When the current message is required to be discarded, a sequence-safe queue is determined for implementing message processing operations, and the current message is discarded to release the sequence-safe information of the current message in the sequence-safe queue.

Benefits of technology

It avoids the blocking of the order-saving queue header caused by abnormal packet loss of software, ensures the delay and performance of message forwarding, and improves the quality and efficiency of message processing operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276790B_ABST
    Figure CN119276790B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention relate to the field of network technology, and specifically provide a message processing method, device, equipment, network card and computer program product. The message processing method is applied to a field programmable gate array FPGA module, and the FPGA module is communicatively connected to a driver module, and the driver module is used to drive the data transmission between the FPGA module and the host memory; the method includes: the FPGA module obtains the current message to be processed through the driver module; when the current message is a message to be discarded, the FPGA module determines the order-preserving queue used to implement the message processing operation, wherein the order-preserving queue at least includes: the order-preserving information of each message that needs to be subjected to the order-preserving operation; the FPGA module discards the current message and releases the order-preserving information of the current message in the order-preserving queue. In this embodiment, the situation of head blocking in the order-preserving queue due to abnormal software packet loss operation is avoided, and the delay and performance affecting the message forwarding are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network technology, and in particular to a message processing method, device, equipment, network card and computer program product. Background Art

[0002] When there are pending messages in the network, the network card can receive messages from the network and notify the central processing unit (CPU) that new messages have arrived. The CPU can then obtain the pending messages from the buffer area of ​​the network card, process the pending messages, and forward the processed messages to the network card so that the network card can perform corresponding forwarding operations.

[0003] Since the network card can have different working states, when the network card works in an abnormal pressure scenario, it may cause abnormal packet loss in the sending direction. At this time, the order-keeping information in the order-keeping queue corresponding to the sending direction message will keep waiting for timeout and pop up, resulting in blocking of the head of the order-keeping queue and affecting the subsequent message forwarding delay. Summary of the invention

[0004] The embodiments of the present invention provide a message processing method, device, equipment, network card and computer program product, which can avoid the head blocking of the order-preserving queue, thereby ensuring the subsequent message forwarding delay.

[0005] In a first aspect, an embodiment of the present invention provides a message processing method, which is applied to a field programmable gate array (FPGA) module, wherein the FPGA module is communicatively connected to a driver module, and the driver module is used to drive data transmission between the FPGA module and a host memory; the method comprises:

[0006] The FPGA module obtains the current message to be processed through the driver module;

[0007] In the case where the current message is a message to be discarded, the FPGA module determines an order-preserving queue for implementing a message processing operation, wherein the order-preserving queue at least includes: order-preserving information of each message that needs to be subjected to an order-preserving operation;

[0008] The FPGA module discards the current message and releases the order preservation information of the current message in the order preservation queue.

[0009] In a second aspect, an embodiment of the present invention provides a message processing device, which is applied to a field programmable gate array FPGA module, wherein the FPGA module is communicatively connected to a driver module, and the driver module is used to drive data transmission between the FPGA module and a host memory; the device comprises:

[0010] A first acquisition module, used for acquiring a current message to be processed by the driving module;

[0011] A first determination module is used to determine an order-preserving queue for implementing a message processing operation when the current message is a message to be discarded, wherein the order-preserving queue at least includes: order-preserving information of each message that needs to be subjected to an order-preserving operation;

[0012] The first processing module is used to discard the current message and release the order preservation information of the current message in the order preservation queue.

[0013] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the message processing method in the above-mentioned first aspect.

[0014] In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement the message processing method in the first aspect when executed.

[0015] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer-readable storage medium storing computer instructions, which, when the computer instructions are executed by one or more processors, causes the one or more processors to execute the steps in the message processing method shown in the first aspect above.

[0016] In a sixth aspect, an embodiment of the present invention provides a message processing method, which is applied to a driver module, wherein the driver module is used to drive data transmission between a field programmable gate array FPGA module and a host memory; the method comprises:

[0017] Obtaining an idle message descriptor for implementing message processing operations;

[0018] When the driver module detects packet loss, based on the idle message descriptor, determine the number of non-discarded messages and discarded messages that need to be subjected to order preservation operations after the non-discarded messages;

[0019] The number of discarded messages is added to the tail field of the non-discarded message.

[0020] In a seventh aspect, an embodiment of the present invention provides a message processing device, which is applied to a driver module, wherein the driver module is used to drive data transmission between a field programmable gate array FPGA module and a host memory; the device comprises:

[0021] A second acquisition module, used for acquiring an idle message descriptor for implementing a message processing operation;

[0022] A second determination module is used to determine the number of non-discarded messages and discarded messages that need to be subjected to order preservation operations after the non-discarded messages based on the idle message descriptor when the driver module detects that there is packet loss;

[0023] The second processing module is used to add the number of discarded messages to the tail field of the non-discarded message.

[0024] In an eighth aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the message processing method in the above-mentioned sixth aspect.

[0025] In a ninth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement the message processing method in the sixth aspect when executed.

[0026] In the tenth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer-readable storage medium storing computer instructions, which, when the computer instructions are executed by one or more processors, causes the one or more processors to execute the steps in the message processing method shown in the sixth aspect above.

[0027] In an eleventh aspect, an embodiment of the present invention provides a network card, comprising: a field programmable gate array FPGA module and a driver module communicatively connected to the FPGA module, the driver module being used to drive data transmission between the FPGA module and a host memory;

[0028] The driver module is used to obtain an idle message descriptor for implementing a message processing operation; when the driver module detects that there is packet loss, based on the idle message descriptor, determine the number of non-discarded messages and discarded messages that need to be subjected to order preservation operations after the non-discarded messages; and add the number of discarded messages to the tail field of the non-discarded messages;

[0029] The FPGA module is used to obtain the current message to be processed through the driver module; when the current message is a message to be discarded, determine the order-preserving queue used to implement the message processing operation, wherein the order-preserving queue at least includes: the order-preserving information of each message that needs to be subjected to the order-preserving operation; discard the current message, and release the order-preserving information of the current message in the order-preserving queue.

[0030] The message processing method, device, equipment, network card and computer program product provided by the embodiments of the present invention obtain the current message to be processed through the driver module. When the current message is a message to be discarded, the order-preserving queue used to implement the message processing operation is determined, and then the current message can be discarded, and the order-preserving information of the current message in the order-preserving queue is released. This can avoid head blocking in the order-preserving queue due to abnormal software packet loss operations, and at the same time can ensure the delay and performance of message forwarding. Then, the order-preserving queue with the released order-preserving information can be used to analyze and process other messages to be processed, which is beneficial to improve the quality and efficiency of the message processing operation, and further ensure the practicality of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] 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.

[0032] Figure 1 Schematic diagram of the principle of the message processing method provided by the related technical embodiment Figure 1 ;

[0033] Figure 2 Schematic diagram of the principle of the message processing method provided by the related technical embodiment Figure 2 ;

[0034] Figure 3 A schematic diagram of the principle of a message processing method provided by an embodiment of the present invention;

[0035] Figure 4 A schematic diagram of a flow chart of a message processing method provided by an embodiment of the present invention;

[0036] Figure 5 A schematic diagram of a process for determining the number of discarded messages that need to be discarded after the previously processed message provided by an embodiment of the present invention;

[0037] Figure 6 A flowchart of another message processing method provided by an embodiment of the present invention;

[0038] Figure 7 A schematic diagram of a process for determining, in the set of messages to be processed, a plurality of messages that need to maintain order and are located after the non-discarded messages, provided in an embodiment of the present invention;

[0039] Figure 8A schematic diagram of the principle of a method for forwarding messages without blocking and preserving order provided by an application embodiment of the present invention;

[0040] Fig. 9 A flow chart of a method for forwarding messages without blocking the order provided by an application embodiment of the present invention;

[0041] Fig.10 A schematic diagram of the structure of a message processing device provided by an embodiment of the present invention;

[0042] Fig.11 For Fig.10 A schematic diagram of the structure of an electronic device corresponding to the message processing device provided in the embodiment is shown;

[0043] Fig.12 A schematic diagram of the structure of another message processing device provided by an embodiment of the present invention;

[0044] Fig.13 For Fig.12 A schematic diagram of the structure of an electronic device corresponding to the message processing device provided in the embodiment is shown;

[0045] Fig.14 A schematic diagram of the structure of a network card provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0046] In order to make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions 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.

[0047] 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", "an", 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 situation of including at least one.

[0048] It should be understood that the term "and / or" used in this article is only a way to describe the association relationship of associated devices, 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 devices before and after are in an "or" relationship.

[0049] 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 detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0050] 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.

[0051] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0052] Terminology explanation:

[0053] Field-Programmable Gate Array: Field-Programmable Gate Array, referred to as FPGA, is an integrated circuit that can be reconfigured at the hardware level.

[0054] Dynamic load balancing: dynamic load balancing, referred to as DLB, is a message forwarding mode that can evenly distribute messages to each core processor (Central Processing Unit, referred to as CPU) for processing, ensuring CPU load balance and message forwarding in order.

[0055] Packet Sequence Numbers: Packet Sequence Numbers, referred to as PSN, are used to mark the sequence numbers assigned to data packets in hardware.

[0056] Meta: refers to the metadata in the message, which is used to record relevant internal data information for message forwarding.

[0057] In order to facilitate understanding of the specific implementation process and implementation effect of the message processing method, device, equipment, network card and computer program product in this embodiment, the relevant technology is briefly described below:

[0058] Reference Figure 1-Figure 2As shown, when there are messages to be processed, the network card can receive messages from the network and notify the host that a new message has arrived. The network card can then distribute the message to the host, so that the host can obtain the messages to be processed from the buffer area of ​​the network card, process the messages to be processed, and forward the processed messages to the network card, so that the network card can perform corresponding forwarding operations.

[0059] After the network card obtains the message to be processed from the host, the FPGA in the network card can compare the message with the head element in the order-preserving queue to perform an order-preserving detection operation. Specifically, the message to be processed can be analyzed and matched with the PSN in the order-preserving queue. If they match, the relevant data in the order-preserving queue is taken out and the message to be processed is passed backward to realize the message sending processing operation; if they do not match, the currently received message information can be temporarily stored, and the opponent's message can be blocked and waited for to arrive.

[0060] Since the DLB message sent to the host often has a corresponding forwarding message, if the forwarding message is determined by the software to be a message that needs to be discarded, for example: rate limit packet loss, policy packet loss, etc., the forwarding message can be returned to the FPGA so that the FPGA can release the order-preserving information in the order-preserving queue and release the FPGA cache resources based on the received forwarding message, where the order-preserving information may include at least one of the following: the data packet sequence number psn, the address buf_ptr of the stored message, the storage length payload_len of the message, and the message timestamp timestamp.

[0061] However, when the driver side of the network card encounters abnormal pressure scenarios such as insufficient descriptors in the sending direction (such as active packet sending and jumbo forwarding by the protocol stack under pressure), abnormal packet loss in the sending direction will occur. At this time, the order-keeping information in the order-keeping queue corresponding to the abnormal packet loss message will wait for the timeout to pop up, causing the order-keeping queue head to be blocked, thereby affecting the forwarding delay of all subsequent messages. In addition, due to the accumulation of order-keeping information, the order-keeping queue is easily filled up, which will also affect the message receiving rate, and thus affect the overall message forwarding performance.

[0062] In order to solve the above technical problems, this embodiment provides a message processing method, device, equipment, network card and computer program product, refer to the attached Figure 3As shown, the execution subject of the message processing method is a message processing device 200, which is communicatively connected with a client 100 and a CPU unit 300, so as to obtain the message to be processed through the client 100, and then forward the message to be processed to the CPU unit 300 for corresponding message processing operations. Among them, the message processing device 200 can be implemented as a network card, a server or a cloud server, etc.; when the message processing device 200 is implemented as a cloud server, the message processing method can be executed in the cloud, and several computing nodes (cloud servers) can be deployed in the cloud, and each computing node has computing, storage and other processing resources. In the cloud, multiple computing nodes can be organized to provide a certain service. Of course, a computing node can also provide one or more services. The way to provide the service in the cloud can be to provide a service interface to the outside, and the user calls the service interface to use the corresponding service. The service interface includes a software development kit (Software Development Kit, referred to as SDK), an application programming interface (Application Programming Interface, referred to as API), and the like.

[0063] The message processing device 200 refers to a device that can provide message processing operations in a network virtual environment, and generally refers to a device that uses the network to perform information planning and message processing operations. In physical implementation, the message processing device 200 can be any device that can provide computing services, respond to message processing requests, and perform message processing operations. The device can be integrated on a preset device, for example, it can be a cluster server, a conventional server, a cloud server, a cloud host, a virtual center, etc. The composition of the message processing device 200 mainly includes a processor, a hard disk, a memory, a system bus, etc., which is similar to a general computer architecture.

[0064] The client 100 can be implemented as a mobile phone, a personal computer PC, a tablet computer, a setting application, etc. In addition, the basic structure of the client 100 may include: at least one processor. The number of processors depends on the configuration and type of the client 100. The client 100 may also include a memory, which may be volatile, such as: random access memory (Random Access Memory, referred to as RAM), or non-volatile, such as: read-only memory (Read-Only Memory, referred to as ROM), flash memory, etc., or may include both types. The memory usually stores an operating system (Operating System, referred to as OS), one or more application programs, and may also store program data, etc. In addition to the processing unit and the memory, the client 100 also includes some basic configurations, such as: a network card chip, an IO bus, a display component, and some peripheral devices, etc. Optionally, some peripheral devices may include, for example: a keyboard, a mouse, an input pen, a printer, etc. Other peripheral devices are well known in the art and will not be described in detail here.

[0065] In the above embodiment, the client 100 and the message processing device 200, and the message processing device 200 and the CPU unit 300 are connected to each other through a network, and the network connection can be a wireless or wired network connection. If the client 100 and the message processing device 200, and the message processing device 200 and the CPU unit 300 are connected through a communication connection, the network standard of the mobile network can be any one of 2G (GSM), 2.5G (GPRS), 3G (WCDMA, TD-SCDMA, CDMA2000, UTMS), 4G (LTE), 4G+ (LTE+), WiMax, 5G, 6G, etc.

[0066] The client 100 is used for users to use so as to start, call or implement message processing operations. Specifically, the client 100 can generate and obtain a message processing request, wherein the message processing request can correspond to a message to be processed. In some instances, the message processing request can be obtained through human-computer interaction or voice interaction. In order to implement the corresponding message processing operation, the message processing request can be sent to the message processing device 200, so that the message processing device 200 can perform the corresponding message processing operation on the message processing request.

[0067] The message processing device 200 is communicatively connected to the client 100, and is used to obtain a message processing request sent by the client 100, wherein the message processing request may correspond to a current message to be processed. In order to implement the message processing operation, after obtaining the current message, it is identified whether the current message is a message to be discarded; when it is determined that the current message is not a message to be discarded, an order-preserving queue for implementing the message processing operation can be determined, wherein the order-preserving queue includes at least order-preserving information of each message that needs to be subjected to the order-preserving operation, and the order-preserving information may include at least one of the following: a data packet sequence number, an address for storing the message, a storage length of the message, and a message timestamp; then, the current message can be forwarded and processed based on the order-preserving queue, for example, the current message can be forwarded to the CPU unit 300 for analysis and processing operations. When it is determined that the current message is a message that needs to be discarded, an order-preserving queue for implementing message processing operations can be determined. In order to avoid head blocking in the order-preserving queue, the current message can be discarded and the order-preserving information corresponding to the current message in the order-preserving queue can be released. This effectively avoids head blocking problems in the hardware queue due to software abnormal packet loss, while avoiding affecting the message forwarding delay and performance. The quality and efficiency of message processing operations on subsequent messages can then be improved based on the order-preserving queue, further ensuring the practicality of this method.

[0068] 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.

[0069] Figure 4 A flow chart of a message processing method provided by an embodiment of the present invention; see attached Figure 4 As shown, this embodiment provides a message processing method, the execution subject of the method is a message processing device, and the message processing device can be implemented as software, or a combination of software and hardware. When the message processing device is implemented as hardware, it can be various electronic devices with message processing capabilities. When the message processing device is implemented as software, it can be installed in the electronic devices listed above. In some instances, the message processing device can be implemented as a field programmable gate array FPGA module in a network card, that is, the message processing method can be applied to the field programmable gate array FPGA module in the network card, and the FPGA module is communicatively connected to a driver module, and the driver module is used to drive the FPGA module to perform data transmission with the host memory; based on the above-mentioned message processing device, the message processing method in this embodiment includes:

[0070] Step S401: The FPGA module obtains the current message to be processed through the driver module.

[0071] Step S402: when the current message is a message to be discarded, the FPGA module determines an order-preserving queue for implementing a message processing operation, wherein the order-preserving queue at least includes: order-preserving information of each message that needs to be subjected to an order-preserving operation.

[0072] Step S403: the FPGA module discards the current message and releases the order preservation information of the current message in the order preservation queue.

[0073] The specific implementation process and effects of each of the above steps are described in detail below:

[0074] Step S401: The FPGA module obtains the current message to be processed through the driver module.

[0075] Among them, the message processing device is taken as an example of an FPGA module. When there is a message processing demand, the FPGA module can obtain the current message to be processed. In some instances, the current message to be processed can be a forwarding message returned by the CPU. At this time, obtaining the current message to be processed may include: the FPGA module can obtain the current message to be processed sent by the client through the driver module; send the current message to be processed to the CPU unit for processing to obtain the processed message; the CPU unit returns the processed message to the FPGA module through the driver module, so that the FPGA module can obtain the current message to be processed through the driver module.

[0076] In addition, for the current messages to be processed, the number of current messages to be processed can be one or more. When the number of current messages is multiple, the number of processing cores corresponding to the multiple current messages can be one or more. When the number of processing cores corresponding to the multiple current messages is multiple, separate analysis and processing operations can be performed on the corresponding multiple current messages based on each processing core.

[0077] Step S402: when the current message is a message to be discarded, the FPGA module determines an order-preserving queue for implementing a message processing operation, wherein the order-preserving queue at least includes: order-preserving information of each message that needs to be subjected to an order-preserving operation.

[0078] After obtaining the current message, you can first identify whether the current message is a message to be discarded. In some instances, a message identifier for identifying whether the current message is a message to be discarded is added to the message to be processed. At this time, you can identify whether the current message is a message to be discarded based on the message identifier. Specifically, it can include: obtaining the message identifier corresponding to the current message, the message identifier is used to identify whether the current message is a message to be discarded; determining whether the current message is a message to be discarded based on the message identifier; specifically, when the message identifier is a first identifier, it is determined that the current message is a message to be discarded; when the message identifier is a second identifier, it is determined that the current message is not a message to be discarded.

[0079] In other instances, whether the current message is a message to be discarded can be identified not only by the message identifier, but also based on the previously processed message before the current message. In this case, after obtaining the current message to be processed, the method in this embodiment may further include: obtaining the previously processed message before the current message; determining the number of discarded messages that need to be discarded after the previously processed message; and identifying whether the current message is a message to be discarded based on the number of discarded messages.

[0080] Among them, after obtaining the current message to be processed, in order to accurately identify whether the current message is a message to be discarded, the previous processed message before the current message can be obtained first, and the previous processed message can be the last message to be processed normally. After obtaining the previous processed message before the current message, the number of discarded messages that need to be discarded after the previous processed message can be determined. In some examples, the number of discarded messages can be determined by a preset mapping relationship and the previous processed message.

[0081] After determining the number of discarded messages that need to be discarded and are located after the previous processed message, the number of discarded messages can be analyzed and processed to identify whether the current message is a message that needs to be discarded; in some instances, whether the current message is a message that needs to be discarded is identified by identifying whether the number of discarded messages is 0. At this time, based on the number of discarded messages, identifying whether the current message is a message that needs to be discarded may include: when the number of discarded messages is non-zero, determining the current message as a message that needs to be discarded; when the number of discarded messages is 0, determining the current message as not a message that needs to be discarded.

[0082] Specifically, after obtaining the number of discarded messages, it can be identified whether the number of discarded messages is 0. When the number of discarded messages is not 0, it means that there are messages that need to be discarded that meet the number of discarded messages after the previously processed message. Since the current message is after the previously processed message, the current message can be determined as a message to be discarded. For example, the number of discarded messages that need to be discarded corresponding to the previously processed message is 3, which means that there are 3 messages that need to be discarded after the previously processed message. In this way, not only can it be determined that the current message is a message to be discarded, but it can also be determined that the two messages after the current message are also messages to be discarded. In this way, it is possible to accurately identify whether the message is a message to be discarded.

[0083] When the number of discarded messages is 0, it means that there is no discarded message that needs to be discarded after the previous processed message, and the current message can be determined as not a message to be discarded. This effectively realizes the accurate identification operation of whether the current message is a message to be discarded, which is beneficial to improve the quality and efficiency of message processing operations based on the identification results.

[0084] When it is determined that the current message is a message that needs to be discarded, in order to avoid head blocking problems caused by the order-preserving queue, the FPGA module can determine the order-preserving queue used to implement the message processing operation, and the determined order-preserving queue is used to perform normal message processing operations. Specifically, the order-preserving queue can be determined by the message identifier of the current message and the preset mapping relationship, wherein the order-preserving queue can at least include: the order-preserving information of each message that needs to be subjected to the order-preserving operation. In some instances, the order-preserving information can at least include: the sequence number psn of the message data packet, or the order-preserving information can also include: the address buf_ptr for storing the message information, the storage length payload_len of the message, and the storage timestamp timestamp.

[0085] Step S403: the FPGA module discards the current message and releases the order preservation information of the current message in the order preservation queue.

[0086] After determining the order-preserving queue for implementing the message processing operation, the FPGA module can discard the current message, that is, delete the current message, and then release the order-preserving information of the current message in the order-preserving queue, so as to avoid head blocking in the order-preserving queue.

[0087] For example, the FPGA module can obtain a set of messages to be processed, which includes 64 messages to be processed. The order-preserving queue corresponding to the message set can sequentially store the order-preserving information corresponding to each of the 64 messages to be processed. When the current message is the first message to be processed and the current message is a message to be discarded, the first message to be processed can be discarded, and the order-preserving information corresponding to the first message to be processed in the order-preserving queue can be deleted, so that the order-preserving information of the current message in the order-preserving queue can be released, so that the order-preserving queue can store the order-preserving information corresponding to the 63 messages to be processed that are located after the first message to be processed. When the current message is the second message to be processed, and the current message is not a message to be discarded, the order-preserving queue can be used to forward the current message, which can improve the quality and efficiency of the message processing operation.

[0088] In some other instances, the method in this embodiment may further include: when the current message is not a message that needs to be discarded, forwarding processing operations are performed on the current message based on the order preservation queue. After the forwarding processing operation is performed on the current message, the order preservation information corresponding to the current message in the order preservation queue can be released, thereby completing the normal message processing operation.

[0089] The message processing method provided in this embodiment obtains the current message to be processed, and when the current message is a message to be discarded, determines the order-preserving queue used to implement the message processing operation, and then discards the current message and releases the order-preserving information of the current message in the order-preserving queue. This can avoid head blocking in the order-preserving queue due to abnormal software packet loss operations, while ensuring the delay and performance of message forwarding. Then, the order-preserving queue that has released the order-preserving information can be used to analyze and process other messages to be processed, which is beneficial to improving the quality and efficiency of message processing operations, and further ensuring the practicality of the method.

[0090] Figure 5 A flow chart of determining the number of discarded messages that need to be discarded after a previously processed message provided by an embodiment of the present invention; based on the above embodiment, refer to the attached Figure 5 As shown, for the number of discarded messages that need to be discarded after the previous processed message, it can be determined not only by a preset mapping relationship, but also by a preset information queue. At this time, determining the number of discarded messages that need to be discarded after the previous processed message may include:

[0091] Step S501: obtaining a preset information queue, in which the message information of the processed message and the number of discarded messages after the processed message are stored.

[0092] A preset queue for adding message data is configured in the FPGA to generate a preset information queue, in which the message information of the processed file and the number of discarded messages after the processed message are stored. In order to facilitate the reading and calling operations of the number of discarded messages, the number of discarded messages can be written and stored in the preset information queue. At this time, before obtaining the preset information queue, the method in this embodiment can also include: obtaining the tail field used to identify the number of discarded messages in the previous processed message; reading the tail field to obtain the number of discarded messages; storing the message information of the previous processed message and the number of discarded messages in the preset queue to generate the preset information queue, so as to facilitate the reading operation of the number of discarded messages based on the preset information queue.

[0093] Specifically, in order to generate a preset information queue, after the FPGA module obtains the previous processed message, since the tail field of the previous processed message can identify the number of discarded messages, the tail field used to identify the number of discarded messages in the previous processed message can be obtained, and then the tail field is read to obtain the number of discarded messages; after obtaining the number of discarded messages, the message information of the previous processed message and the number of discarded messages can be stored in the preset queue, wherein the message information can include at least one of the following: the destination address of the message, the source address of the message, the type / length of the message, the message data, etc., so that the preset information queue can be generated.

[0094] After the preset information queue is generated, the preset information queue can be stored in a preset area in the FPGA. When it is necessary to determine the number of discarded messages that need to be discarded after the previously processed message, the preset information queue can be obtained to determine the number of discarded messages that need to be discarded after the previously processed message through the preset information queue.

[0095] Step S502: Based on the preset information queue and the last processed message, determine the number of discarded messages that need to be discarded and are located after the last processed message.

[0096] Since the preset information queue stores the message information of the processed message and the number of discarded messages after the processed message, in order to accurately determine the number of discarded messages that need to be discarded after the previous processed message, after obtaining the preset information queue, the preset information queue and the previous processed message can be analyzed and processed to determine the number of discarded messages that need to be discarded after the previous processed message, thereby effectively ensuring the accuracy and reliability of determining the number of discarded messages.

[0097] In some other instances, after the FPGA module discards the current message, the number of discarded messages can be updated based on the discard operation on the current message. At this time, the method in this embodiment can also include: subtracting 1 from the number of discarded messages to obtain an updated number of discarded messages corresponding to the previously processed message.

[0098] For example, when the previously processed message is message a, and the number of discarded messages corresponding to message a is 2, it means that there are two messages after the previously processed message that need to be discarded. When message a is followed by message b, since the number of discarded messages is non-zero, it can be determined that message b is the message that needs to be discarded, and then the order preservation information corresponding to message b in the order preservation queue can be released; and then the above-mentioned number of discarded messages can be updated from 2 to 1, so that subsequent messages can be analyzed and processed based on the updated number of discarded messages.

[0099] For example: when message c is after message b, since the updated number of discarded messages is non-zero, message c can be determined as a message to be discarded, and then the order preservation information corresponding to message c in the order preservation queue can be released; and then the above-mentioned number of discarded messages can be updated from 1 to 0, so that subsequent messages can be analyzed and processed based on the updated number of discarded messages.

[0100] For example: when message c is followed by message d, since the updated number of discarded messages is 0, message d can be determined as not a message that needs to be discarded, and then a matching operation can be performed with message c based on the order-preserving queue, and then message c can be forwarded based on the order-preserving information corresponding to message c in the order-preserving queue, which is beneficial to improving the quality and efficiency of message processing operations.

[0101] In this embodiment, by obtaining a preset information queue, the number of discarded messages that need to be discarded and are located after the previously processed message can be determined based on the preset information queue and the previously processed message. This effectively ensures the accuracy and reliability of determining the number of discarded messages, which is beneficial to improving the accuracy and reliability of identifying whether the current message is a message that needs to be discarded based on the number of discarded messages, and further improves the accuracy and reliability of message processing.

[0102] Figure 6 A flow chart of another message processing method provided by an embodiment of the present invention; Figure 6As shown, this embodiment provides a message processing method, the execution subject of the method is a message processing device, and the message processing device can be implemented as software, or a combination of software and hardware. When the message processing device is implemented as hardware, it can be various electronic devices with message processing capabilities. When the message processing device is implemented as software, it can be installed in the electronic devices listed above. In some instances, the message processing device can be implemented as a driver module in a network card, and the driver module can be connected to the FPGA module in the network card for communication, that is, the message processing method can be applied to the driver module in the network card, and the driver module is used to drive the field programmable gate array FPGA module to transmit data with the host memory; based on the above-mentioned message processing device, the message processing method in this embodiment includes:

[0103] Step S601: Acquire an idle message descriptor for implementing a message processing operation.

[0104] Among them, the network card is configured with multiple message descriptors for implementing message processing operations. In the scenario of data packet loss, in order to be able to add the tail field of the last normally processed message and perform the discard operation, an idle message descriptor for implementing the message processing operation can be first obtained. In some instances, the idle message descriptor can be determined by a preset occupation flag. At this time, obtaining the idle message descriptor for implementing the message processing operation can include: obtaining multiple message descriptors for implementing the message processing operation; determining the occupation flags corresponding to each of the multiple message descriptors; and determining the idle message descriptor for implementing the message processing operation based on the occupation flag, wherein the message descriptor corresponding to the non-occupancy flag can be determined as the idle descriptor.

[0105] In other instances, the idle packet descriptor can be determined by aligning the tail pointer tail of the tail data. At this time, obtaining the idle packet descriptor for implementing the packet processing operation may include: obtaining a packet descriptor list in the network card for implementing the packet forwarding operation; performing an alignment operation on the tail pointer tail of the tail data based on the packet descriptor list, so as to be able to organize and calculate the descriptor space, and obtain the idle packet descriptor for implementing the packet processing operation, thereby effectively ensuring the accuracy and reliability of obtaining the idle packet descriptor.

[0106] In some other instances, after obtaining an idle message descriptor for implementing a message processing operation, a detection operation can be performed based on the idle message descriptor to determine whether there is a packet loss situation. At this time, the method in this embodiment may further include: obtaining a current message to be processed; when the idle message descriptor is not sufficient to analyze and process the current message to be processed, it means that the idle message descriptor at this time is insufficient to perform an analysis and processing operation on the current message to be processed, and then it can be determined that the driver module detects that there is packet loss at this time; when the idle message descriptor is sufficient to analyze and process the current message to be processed, it means that the idle message descriptor at this time is sufficient to perform an analysis and processing operation on the current message to be processed, and then it can be determined that the driver module detects that there is no packet loss at this time.

[0107] In addition, not only can it be identified whether there is packet loss in the current network card by whether the idle message descriptors are sufficient to process the current messages to be processed, but it can also be determined whether there is packet loss in the current network card by whether there are idle message descriptors. At this time, the method in this embodiment may include: obtaining the number of idle message descriptors; when the number of idle message descriptors is 0, determining that the driver module detects that there is packet loss in the current network card; when the number of idle message descriptors is non-zero, determining that the driver module detects that there is no packet loss in the current network card.

[0108] Alternatively, not only can it be identified whether there is packet loss in the current network card by whether the idle message descriptor is sufficient to process the current to-be-processed message, but it can also be determined whether there is packet loss in the current network card by the message receiving speed and the message forwarding speed. At this time, the method in this embodiment may include: obtaining the message receiving speed and the message forwarding speed corresponding to the network card; based on the message receiving speed and the message forwarding speed, determining whether there is packet loss in the network card. Specifically, based on the message receiving speed and the message forwarding speed, determining whether there is packet loss in the network card includes: when the message receiving speed is greater than the message forwarding speed, it means that the speed of receiving the message in the network card is fast and the speed of processing the message is slow, and then it can be determined with a high probability that there is packet loss in the network card; when the message receiving speed is less than or equal to the message forwarding speed, it means that the speed of receiving the message in the network card is slow and the speed of processing the message is fast, and then it can be determined with a high probability that there is no packet loss in the network card, so that a flexible detection operation of whether there is packet loss is achieved.

[0109] Step S602: When the driver module detects packet loss, it determines the number of non-discarded packets and discarded packets that need to be subjected to order preservation operations and are located after the non-discarded packets based on the idle packet descriptors.

[0110] When the driver module detects packet loss, in order to avoid head blocking in the order-preserving queue due to packet loss operations, the number of non-discarded messages and discarded messages that need to be subjected to order-preserving operations after the non-discarded messages can be determined based on the idle message descriptors, where the non-discarded messages can refer to the processed messages corresponding to the last idle message descriptor.

[0111] In some instances, determining non-discarded messages and the number of discarded messages that need to be sequence-preserving and are located after the non-discarded messages based on idle message descriptors may include: obtaining a set of messages to be processed; in the set of messages to be processed, determining the message to be processed corresponding to the last idle message descriptor as a non-discarded message; in the set of messages to be processed, determining multiple messages that need to be sequence-preserving and are located after the non-discarded messages; and determining the number of the multiple messages that need to be sequence-preserving as the number of discarded messages.

[0112] Specifically, in order to accurately determine the number of non-discarded messages and discarded messages that need to be processed after the non-discarded messages, a set of pending messages can be obtained first, wherein the set of pending messages includes multiple pending messages, and different pending messages can correspond to different processing cores, and then corresponding message processing operations can be performed according to different processing cores, thereby improving the quality and efficiency of message processing. After obtaining the set of pending messages, the set of pending messages can be analyzed and processed to determine the pending message corresponding to the last idle message descriptor in the set of pending messages as a non-discarded message, which effectively ensures the accuracy and reliability of obtaining the non-discarded messages.

[0113] The above-mentioned set of pending messages includes multiple pending messages, and the multiple pending messages may include non-order-preserving messages that do not need to be processed and need-order-preserving messages that need to be processed, for example: messages in load balancing mode will have disordered characteristics, therefore, messages in load balancing mode are need-order-preserving messages; messages in multi-queue receiving mode will have sequential characteristics, therefore, messages in multi-queue receiving mode are not need-order-preserving messages. In order to improve the quality and efficiency of message processing operations, after obtaining non-discarded messages, multiple need-order-preserving messages that are located after non-discarded messages can be determined in the set of pending messages, and then the number of multiple need-order-preserving messages can be counted, and the number of multiple need-order-preserving messages can be determined as the number of discarded messages, which effectively ensures the accuracy and reliability of determining the number of non-discarded messages and discarded messages.

[0114] In other instances, the number of non-discarded messages and discarded messages can be determined by the number of descriptors of idle message descriptors. At this time, based on the idle message descriptors, determining the number of non-discarded messages and the number of discarded messages that need to be subjected to order preservation operations after the non-discarded messages can include: obtaining a set of messages to be processed, the set of messages to be processed including a preset number of messages to be processed; determining the number of descriptors of idle message descriptors; based on the number of descriptors and the preset number, determining the number of non-discarded messages and the number of discarded messages that need to be subjected to order preservation operations in the set of messages to be processed, wherein the number of discarded messages can be determined by the difference between the preset number of messages to be processed in the set of messages to be processed and the number of descriptors of the idle message descriptors. Specifically, the number of discarded messages = preset number - number of descriptors.

[0115] Step S603: Add the number of discarded messages to the tail field of the non-discarded messages.

[0116] After obtaining the number of discarded messages that need to be subjected to order preservation operations after the non-discarded messages, the number of discarded messages can be added to the tail field of the non-discarded messages, so that during the message processing operation, the number of discarded messages can be obtained based on the tail field of the non-discarded messages, and then the corresponding order preservation information in the order preservation queue can be released based on the number of discarded messages. This can effectively avoid the situation where the message processing efficiency is reduced due to head blocking in the order preservation queue.

[0117] The message processing method provided in this embodiment obtains an idle message descriptor for implementing message processing operations. When the driver module detects that there is packet loss, the number of non-discarded messages and discarded messages that need to be processed based on the idle message descriptor can be determined, and then the number of discarded messages is added to the tail field of the non-discarded message. This effectively realizes that when the driver module detects that there is packet loss, the number of discarded messages added to the tail field of the non-discarded message can be used to accurately identify whether subsequent messages are messages that need to be discarded. Then, based on the identification result, it can be selected whether the order-preserving information in the order-preserving queue needs to be released, thereby avoiding the situation where the head of the order-preserving queue is blocked, thereby ensuring the quality and efficiency of message processing.

[0118] Figure 7 A schematic diagram of a process for determining a plurality of messages to be sequenced that are located after a non-discarded message in a set of messages to be processed provided by an embodiment of the present invention; based on the above embodiment, refer to the attached Figure 7 As shown, this embodiment provides an implementation scheme for determining multiple messages that need to maintain order based on message type. At this time, in this embodiment, in the message set to be processed, determining multiple messages that need to maintain order after the non-discarded message may include:

[0119] Step S701: in a set of to-be-processed messages, a plurality of to-be-processed messages that are located after the non-discarded messages are obtained.

[0120] After obtaining the set of messages to be processed, multiple messages to be processed that are located after the non-discarded messages can be obtained in the set of messages to be processed. Specifically, the multiple messages to be processed can be determined by the timestamps corresponding to the messages, that is, the multiple messages to be processed can be multiple messages received after the non-discarded messages.

[0121] Step S702: Determine the message type of each message to be processed.

[0122] After obtaining multiple messages to be processed that are located after the non-discarded messages, the multiple messages to be processed can be analyzed and processed to determine the message type of each message to be processed, wherein the message type can include a load balancing message or a multi-queue receiving message. In some instances, the message type can be determined by the current processing module corresponding to the driver module. At this time, determining the message type of each message to be processed can include: obtaining the current processing mode corresponding to the driver module; when the current processing mode is the load balancing mode, determining the messages to be processed in the load balancing mode as load balancing messages; when the current processing mode is the multi-queue receiving mode, determining the messages to be processed in the multi-queue receiving mode as multi-queue receiving messages.

[0123] For the driver module, in different application scenarios, the driver module may correspond to different processing modes, for example: in the application scenario of processing elephant flow, the driver module may work in load balancing mode; in the application scenario of processing non-elephant flow, the driver module may work in multi-queue receiving mode. Specifically, in order to accurately determine the message type of each to-be-processed message, the current processing mode corresponding to the driver module may be first obtained. In some instances, the current processing mode may be determined by a preset mode identifier. At this time, obtaining the current processing mode corresponding to the driver module may include: obtaining the current mode identifier corresponding to the driver module; determining the current processing mode corresponding to the driver module based on the current mode identifier. Specifically, when the current mode identifier is the first identifier, the current processing mode is determined to be the load balancing mode; when the current mode identifier is the second identifier, the current processing mode is determined to be the multi-queue receiving mode.

[0124] When the current processing mode is the load balancing mode, the messages to be processed in the load balancing mode are determined as load balancing messages; when the current processing mode is the multi-queue receiving mode, the messages to be processed in the multi-queue receiving mode are determined as multi-queue receiving messages, thereby effectively realizing the accurate determination of the message type of each message to be processed.

[0125] In some other instances, after determining the message type of each message to be processed, the method in this embodiment may further include: when the message to be processed is received for the first time, the message type can be directly scanned and identified to obtain the message type of the message to be processed, and then the message type of each message to be processed is stored in a preset cache structure in the driver module, which can reduce the interactive operations with the memory, thereby helping to improve the quality and efficiency of message processing.

[0126] Step S703: Based on the message type of each to-be-processed message, a plurality of messages requiring sequence preservation are determined.

[0127] After obtaining the message type of each message to be processed, the message type of each message to be processed can be analyzed and processed to determine multiple messages that need to be sequenced and are located after the non-discarded messages. In some instances, based on the message type of each message to be processed, determining multiple messages that need to be sequenced can include: when the message to be processed is a load balancing message, determining the message to be processed as a message that needs to be sequenced; when the message to be processed is a multi-queue reception message, determining the message to be processed as not a message that needs to be sequenced, thereby effectively achieving accurate identification of messages that need to be sequenced.

[0128] In other instances, not only can multiple messages that need to be sequence-preserved be determined based on the message type of each message to be processed, but multiple messages that need to be sequence-preserved can also be determined in combination with preset specific rules. At this time, based on the message type of each message to be processed, determining multiple messages that need to be sequence-preserved may include: when the message to be processed is a load balancing message, determining the message to be processed as an alternative sequence-preserving message; determining the preset specific rule for limiting the message; identifying whether the alternative sequence-preserving message complies with the preset specific rule; when the alternative sequence-preserving message complies with the preset specific rule, determining the alternative sequence-preserving message that complies with the preset specific rule as a non-alternative sequence-preserving message; when the alternative sequence-preserving message does not comply with the preset specific rule, determining the alternative sequence-preserving message that does not comply with the preset specific rule as the message that needs to be sequence-preserved. This also ensures accurate identification of the message that needs to be sequence-preserved.

[0129] In some other instances, after obtaining the set of messages to be processed, the present embodiment provides for storing the message processing status corresponding to the set of messages to be processed through a preset register. At this time, the method in the present embodiment may also include: detecting the message processing status corresponding to the set of messages to be processed; when all messages in the set of messages to be processed fail to be processed, obtaining the direct memory access queue information to which the set of messages to be processed belongs, the data packet sequence number of each message, and the number of discarded messages included in the set of messages to be processed; storing the direct memory access queue information, the data packet sequence number of each message, and the number of discarded messages in the preset register, so as to write the number of discarded messages into the preset information queue through the preset register.

[0130] Specifically, when performing processing operations on pending messages in a pending message set, the message processing status corresponding to the pending message set can be detected and obtained, wherein the message processing status may include: a completed status, a semi-completed status, and an uncompleted status, wherein the completed status is used to indicate that all pending messages in the pending message set have successfully completed the forwarding processing operation; the semi-completed status is used to indicate that some pending messages in the pending message set have successfully completed the forwarding processing operation, while another part of the pending messages have not successfully completed the forwarding processing operation; the uncompleted status is used to indicate that all pending messages in the pending message set have not successfully performed the forwarding processing operation.

[0131] Since the set of messages to be processed may correspond to different message processing states, in order to ensure the quality and efficiency of message processing in different message processing states, after obtaining the set of messages to be processed, the message processing state corresponding to the set of messages to be processed may be detected, wherein the message processing state may be determined by the message processing result corresponding to the messages to be processed in the set of messages to be processed.

[0132] When all the messages in the set of messages to be processed are processed successfully, the relevant order-preserving information corresponding to the messages in the order-preserving queue will be released synchronously during the process of analyzing and processing all the messages; when some of the messages in the set of messages to be processed are processed successfully, the messages that have not been processed successfully can be determined, and the above-mentioned messages that have not been processed successfully can be determined as messages to be discarded, and the relevant order-preserving information corresponding to the messages to be discarded in the order-preserving queue will be released. This can avoid the situation where the message forwarding efficiency is affected by head blocking in the order-preserving queue.

[0133] When all messages in the set of messages to be processed fail to be processed, the direct memory access queue information to which the set of messages to be processed belongs, the data packet sequence number of each message, and the number of discarded messages included in the set of messages to be processed can be obtained, wherein the direct memory access queue information and the data packet sequence number of each message can be obtained by scanning and configuring the received set of messages to be processed, and the number of discarded messages included in the set of messages to be processed can be determined by the message processing status in the set of messages to be processed. Since all messages in the set of messages to be processed fail to be processed, in order to ensure stable processing operations on subsequent messages, the direct memory access queue information, the data packet sequence number of each message, and the number of discarded messages can be directly stored in a preset register, so that the number of discarded messages can be written into the preset information queue through the preset register, so that in the scenario where all messages in the set of messages to be processed fail to be processed, the accuracy and reliability of obtaining the number of discarded messages can be guaranteed.

[0134] In this embodiment, in the set of messages to be processed, multiple messages to be processed that are located after the non-discarded messages are obtained, and then the message type of each message to be processed is determined, and based on the message type of each message to be processed, multiple messages that need to be sequenced are determined. This effectively ensures that the messages that need to be sequenced are accurately identified, and then message processing operations can be performed based on the messages that need to be sequenced, which is beneficial to improving the quality and efficiency of message processing operations.

[0135] In specific applications, this application embodiment provides a method for forwarding messages without blocking order preservation. The executor of the forwarding method is a network card, which includes a driver side (corresponding to the software part) and an FPGA side (hardware part) of the communication connection. When abnormal packet loss occurs in the software, the network card can use the software and hardware packet loss coordination mechanism to allow the FPGA module to actively release the order preservation information in the order preservation queue, thereby avoiding head blocking in the order preservation queue and timeout waiting for the order preservation information, and ensuring low-latency forwarding of messages.

[0136] For details, please refer to the attached Figure 8 As shown, the method may include an execution process on the driver side and an execution process on the FPGA side, wherein the execution process on the driver side may include the following steps:

[0137] Step 11: Obtain a set of messages to be processed, wherein the set of messages to be processed includes multiple messages to be processed.

[0138] Step 12: Determine an idle message descriptor for implementing the message processing operation.

[0139] Among them, determining the idle packet descriptors used to implement the packet processing operation may include: obtaining a packet descriptor list in the network card for implementing the packet forwarding operation; by performing statistical calculations on the packet descriptors in the packet descriptor list, specifically by performing an alignment operation through the tail data pointer tail to implement the arrangement operation of the packet descriptor space, so as to determine the idle packet descriptors used to implement the packet processing.

[0140] Step 13: Backfill the free message descriptor based on the message.

[0141] After obtaining the pending messages in the pending message set, the idle message descriptor can be filled in based on the pending messages. Specifically, the filling operation of the idle message descriptor may include: filling in the buffer address, filling in the data length, setting the flag bit, setting the status bit, setting the next descriptor pointer, etc.

[0142] In addition, before backfilling the idle descriptor based on the message, it is possible to detect whether there is currently a packet loss situation based on the idle message descriptor. Specifically, detecting whether there is currently a packet loss situation may include: identifying whether the idle message descriptors are sufficient to process the current pending message. When the idle message descriptors are not sufficient to analyze and process the current pending message, it can be determined that there is a packet loss situation; when the idle message descriptors are sufficient to analyze and process the current pending message, it can be determined that there is no packet loss situation.

[0143] Step 14: When it is detected that there is no packet loss, it is possible to detect whether the message is compliant.

[0144] Among them, detecting whether the message is compliant includes: obtaining the message length of the message to be processed; determining the upper limit of the length used to limit the compliance of the message; when the message length is less than or equal to the upper limit of the length, determining that the message is compliant; when the message length is greater than the upper limit of the length, determining that the message is non-compliant.

[0145] When the compliance of the message is detected, the current message to be processed is analyzed and processed. The analysis and processing operations may include: obtaining the Meta data of the message to be processed; analyzing and processing the Meta data to obtain the message information and message type of the message to be processed; filling in the idle message descriptor based on the message type and message information, and obtaining the descriptor information, so as to perform the corresponding message processing operation through the descriptor information, and then the PIDX position corresponding to the software ring buffer can be updated to detect whether there is the next message to be processed. If so, the corresponding message processing operation can be performed on the message to be processed; if not, the message statistics are updated based on the set of messages to be processed and the PIDX position is updated to the hardware.

[0146] Step 15: When packet loss is detected, the number of non-discarded packets and discarded packets that need to be subjected to order preservation operations and are located after the non-discarded packets are determined based on the idle packet descriptor.

[0147] When packet loss is detected, it means that some messages in the pending message set have not been successfully sent, that is, the messages have not been fully sent and processed. At this time, in order to ensure the quality and efficiency of subsequent message processing, the last normally processed message (that is, the non-discarded message) and the number of discarded messages that need to be maintained after the non-discarded message can be determined. Specifically, in the pending message set, the pending message corresponding to the last idle message descriptor is determined as a non-discarded message; in the pending message set, multiple messages that need to be maintained after the non-discarded message are determined; and then the number of multiple messages that need to be maintained is determined as the number of discarded messages.

[0148] Among them, determining multiple messages that need to be processed and are located after the non-discarded messages can include: in the set of messages to be processed, obtaining multiple messages to be processed that are located after the non-discarded messages; obtaining the current processing mode corresponding to the driving module; when the current processing mode is the load balancing mode, determining the messages to be processed in the load balancing mode as load balancing messages (i.e., DLB messages); when the current processing mode is the multi-queue receiving mode, determining the messages to be processed in the multi-queue receiving mode as multi-queue receiving messages (i.e., RSS messages); when the messages to be processed are load balancing messages, determining the messages to be processed as messages that need to be processed; when the messages to be processed are multi-queue receiving messages, determining the messages to be processed as not messages that need to be processed. After determining the messages that need to be processed, statistical operations can be performed on the messages that need to be processed, so as to stably obtain the number of discarded messages that need to be processed and are located after the non-discarded messages and need to be processed.

[0149] Specifically, after the driver side obtains the message to be processed for the first time, it can scan and process the message to be processed to obtain the message type of the message to be processed, where the message type may include a dlb message or a rss message. In order to quickly determine the message type of each message to be processed, the message type can be stored in the Meta data corresponding to the message to be processed. Scanning the meta field of the message to be processed to determine whether it is a dlb message will increase the CPU overhead and may even cause performance avalanche. In order to avoid the above situation, the Meta data can be stored in a preset cache data structure mbuf. This can avoid adding scanning operations again when forwarding the message to be processed, thereby helping to improve the quality and efficiency of message processing.

[0150] Step 16: Update the packet statistics based on the number of discarded packets and update the PIDX (ProducerIndex) position to the hardware.

[0151] Among them, updating the message statistics information based on the number of discarded messages may include: adding the number of discarded messages to the tail field of the non-discarded message, so that when the driver module detects packet loss, the number of discarded messages can be set in the tail field in the metadata meta in the non-discarded message. Specifically, the above-mentioned number of discarded messages can be written into the drop_bitmap data structure, and in order to accurately improve the quality and efficiency of message processing, the PIDX position can be updated to the hardware, thereby completing the message processing operation.

[0152] The execution process on the FPGA side may include the following steps:

[0153] Step 21: Get the current message to be processed.

[0154] Among them, obtaining the current message to be processed may include: the client may send the message to be processed to the driver module, wherein the message to be processed corresponds to a certain processing core and DMA queue, for example: the current queue may correspond to core O, and DMA queue Vf8, and then the driver module may send the current message to the FPGA module, so that the FPGA module can obtain the current message to be processed.

[0155] Step 22: Check whether the current message is a message to be discarded.

[0156] Among them, detecting whether the current message is a message that needs to be discarded may include: obtaining a previous processed message before the current message; determining the number of discarded messages that need to be discarded after the previous processed message; obtaining a preset information queue Head Array, wherein the preset information queue stores message information of the processed message and the number of discarded messages after the processed message; based on the preset information queue and the previous processed message, determining the number of discarded messages that need to be discarded after the previous processed message; when the number of discarded messages is non-zero, determining the current message as a message that needs to be discarded; when the number of discarded messages is 0, determining the current message as not a message that needs to be discarded.

[0157] Before obtaining the preset information queue, the method in this embodiment may include: obtaining the tail field (dlb_drop field) used to identify the number of discarded messages in the previous processed message, and specifically querying the corresponding drop_bitmap according to the direct memory access (Direct Memory Access, DMA for short) queue in the order preservation information, and then reading the tail field to obtain the number of discarded messages; storing the message information of the previous processed message and the number of discarded messages in the preset queue, and generating a preset information queue HEAD ARRAY, which can save the overhead of information resources.

[0158] Step 23: When the current message is a message to be discarded, the FPGA module determines an order-preserving queue for implementing the message processing operation, wherein the order-preserving queue at least includes: order-preserving information of each message that needs to be subjected to the order-preserving operation;

[0159] Step 24: The FPGA module discards the current message and releases the order preservation information of the current message in the order preservation queue.

[0160] Specifically, after releasing the order preservation information of the current message in the order preservation queue, the value corresponding to the number of discarded messages in the drop_bitmap data structure may be reduced by 1, so as to perform message processing operations on subsequent messages using the updated number of discarded messages.

[0161] Step 25: When the current message is not a message to be discarded, that is, the number of discarded messages in drop_bitmap is zero, the order-preserving queue corresponding to the current message is determined, and an order-preserving comparison operation is performed on the current message based on the order-preserving queue to complete the message processing operation.

[0162] It should be noted that in the scenario of abnormally high pressure, it may happen that all the messages in the message set to be processed are not sent successfully. Because the data stored in the FPGA module may have been read before the dlb_drop field of pidx is updated, the update of the dlb_drop field is not effective at this time, so the corresponding message may not be released correctly. At this time, in order to accurately perform the message processing operation, the packet loss information can be transmitted through the register, and specifically, the direct memory access queue information dma queue to which the message set to be processed belongs, the data packet sequence number psn of each message, and the number of dropped messages drop num included in the message set to be processed can be obtained; then the direct memory access queue information dma queue, the data packet sequence number psn of each message and the number of dropped messages drop num can be stored in the preset register, and the data in the preset register is defined as: dma queue+psn+drop num, so that the number of dropped messages is written into the preset information queue through the preset register.

[0163] Specifically, the preset register can be configured with a corresponding data storage identifier valid. The driver module needs to write the packet loss information into the register and set the data storage identifier valid. Subsequently, whether valid is set to 1 is used to determine whether the hardware has taken the data. The hardware side determines whether the data has been taken away through valid and sets it to 0. This can avoid software overwriting and repeated writing operations, further improving the quality and efficiency of message processing.

[0164] The technical solution provided by the present application embodiment adds the number of subsequent discarded messages to the descriptor corresponding to the last normally sent non-discarded message through the driver module of the network card. When the FPGA module obtains the current message, it identifies whether the current message is a message to be discarded by the number of discarded messages. When it is determined that the current message is a message to be aligned, the FPGA side can actively release the order-keeping information corresponding to the message to be discarded in the order-keeping queue, that is, it can release the corresponding message processing resources in the order-keeping queue. This effectively implements a software and hardware packet loss coordination mechanism to avoid the problem of head blocking of the hardware queue due to abnormal software packet loss, and avoids affecting the message forwarding delay and performance. In addition, for extreme scenarios with excessive message pressure, the hardware can be notified to release the order-keeping resources through the register coordination mechanism, thereby ensuring that the messages are forwarded in order while solving the problem of increased overall forwarding delay caused by abnormal pressure packet loss in the sending direction of the software side, further improving the quality and efficiency of message processing, and ensuring the practicality of the method.

[0165] Fig.10 A schematic diagram of a message processing device provided by an embodiment of the present invention; Fig.10 As shown, this embodiment provides a message processing device, which can be implemented as a field programmable gate array FPGA module, that is, the message processing device can be applied to a field programmable gate array FPGA module, the FPGA module is communicatively connected to a driver module, and the driver module is used to drive the FPGA module to perform data transmission with a host memory; the message processing device may include:

[0166] A first acquisition module 11, used to acquire the current message to be processed through the driving module;

[0167] The first determination module 12 is used to determine an order-preserving queue for implementing a message processing operation when the current message is a message to be discarded, wherein the order-preserving queue at least includes: order-preserving information of each message that needs to be subjected to an order-preserving operation;

[0168] The first processing module 13 is used to discard the current message and release the order preservation information of the current message in the order preservation queue.

[0169] In some examples, after obtaining the current message to be processed, the first obtaining module 11, the first determining module 12 and the first processing module 13 in this embodiment are used to perform the following steps:

[0170] A first acquisition module 11 is used to acquire a previously processed message before the current message;

[0171] A first determining module 12 is used to determine the number of discarded messages that need to be discarded and are located after the previously processed message;

[0172] The first processing module 13 is used to identify whether the current message is a message to be discarded based on the number of discarded messages.

[0173] In some instances, when the first processing module 13 identifies whether the current message is a message to be discarded based on the number of discarded messages, the first processing module 13 is used to execute: when the number of discarded messages is non-zero, the current message is determined as a message to be discarded; when the number of discarded messages is 0, the current message is determined as not a message to be discarded.

[0174] In some instances, when the first determination module 12 determines the number of discarded messages that need to be discarded and are located after the previous processed message, the first determination module 12 is used to execute: obtaining a preset information queue, in which the preset information queue stores message information of the processed message and the number of discarded messages located after the processed message; based on the preset information queue and the previous processed message, determining the number of discarded messages that need to be discarded and are located after the previous processed message.

[0175] In some examples, before obtaining the preset information queue, the first obtaining module 11 and the first processing module 13 in this embodiment are used to perform the following steps:

[0176] A first acquisition module 11 is used to acquire a tail field in a previously processed message for identifying the number of discarded messages;

[0177] The first processing module 13 is used to read the tail field to obtain the number of discarded messages; store the message information of the previous processed message and the number of discarded messages in a preset queue to generate a preset information queue.

[0178] Fig.10 The device shown can perform Figure 3-Figure 5 , Figure 8-Figure 9 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 3-Figure 5 , Figure 8-Figure 9 The implementation process and technical effects of this technical solution refer to Figure 3-Figure 5 , Figure 8-Figure 9 The description in the illustrated embodiment will not be repeated here.

[0179] In one possible design, Fig.10 The structure of the message processing device shown can be implemented as an electronic device, which can be a controller, a personal computer, a server, a field programmable gate array FPGA module, etc., wherein the FPGA module is communicatively connected to a driver module, and the driver module is used to drive the data transmission between the FPGA module and the host memory; Fig.11As shown, the electronic device may include: a first processor 21 and a first memory 22. The first memory 22 is used to store the corresponding electronic device to execute the above Figure 3-Figure 5 , Figure 8-Figure 9 The program of the message processing method provided in the illustrated embodiment, the first processor 21 is configured to execute the program stored in the first memory 22 .

[0180] The program includes one or more computer instructions, wherein one or more computer instructions, when executed by the first processor 21, can implement the following steps: obtain the current message to be processed by the driver module; when the current message is a message to be discarded, determine the order-preserving queue used to implement the message processing operation, wherein the order-preserving queue includes at least: the order-preserving information of each message that needs to be subjected to the order-preserving operation; discard the current message, and release the order-preserving information of the current message in the order-preserving queue.

[0181] Furthermore, the first processor 21 is also used to execute the aforementioned Figure 3-Figure 5 , Figure 8-Figure 9 All or part of the steps in the illustrated embodiments.

[0182] The structure of the electronic device may further include a first communication interface 23 for the electronic device to communicate with other devices or a communication network.

[0183] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by electronic devices, which includes instructions for executing the above Figure 3-Figure 5 , Figure 8-Figure 9 The program involved in the message processing method in the illustrated embodiment.

[0184] In addition, an embodiment of the present invention provides a computer program product, including: a computer-readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causing the one or more processors to execute the above Figure 3-Figure 5 , Figure 8-Figure 9 The steps in the message processing method in the method embodiment are shown.

[0185] Fig.12 A schematic diagram of the structure of another message processing device provided by an embodiment of the present invention; Fig.12 As shown, this embodiment provides another message processing device, which can be implemented as a driver module, that is, the message processing device can be applied to a driver module, which is used to drive data transmission between a field programmable gate array FPGA module and a host memory. Specifically, the message processing device may include:

[0186] A second acquisition module 31 is used to acquire an idle message descriptor for implementing a message processing operation;

[0187] A second determination module 32 is used to determine the number of non-discarded messages and discarded messages that need to be subjected to order preservation operations after the non-discarded messages based on the idle message descriptor when the driver module detects that there is packet loss;

[0188] The second processing module 33 is configured to add the number of discarded messages to the tail field of the non-discarded messages.

[0189] In some examples, after obtaining an idle message descriptor for implementing a message processing operation, the second obtaining module 31 and the second processing module 33 in this embodiment are used to perform the following steps:

[0190] The second acquisition module 31 is used to acquire the current message to be processed;

[0191] The second processing module 33 is used to drive the module to detect packet loss when the idle message descriptors are insufficient to analyze and process the current message to be processed; and to drive the module to detect no packet loss when the idle message descriptors are sufficient to analyze and process the current message to be processed.

[0192] In some instances, when the second determination module 32 determines the number of non-discarded messages and discarded messages that need to be sequence-preserving and are located after the non-discarded messages based on the idle message descriptors, the second determination module 32 is used to execute: obtaining a set of messages to be processed; in the set of messages to be processed, determining the message to be processed corresponding to the last idle message descriptor as a non-discarded message; in the set of messages to be processed, determining multiple messages that need to be sequence-preserving and are located after the non-discarded messages; and determining the number of the multiple messages that need to be sequence-preserving as the number of discarded messages.

[0193] In some instances, when the second determination module 32 determines, in the set of messages to be processed, a plurality of messages that require order preservation and are located after the non-discarded messages, the second determination module 32 is used to execute: in the set of messages to be processed, obtaining a plurality of messages to be processed that are located after the non-discarded messages; determining the message type of each message to be processed; and determining a plurality of messages that require order preservation based on the message type of each message to be processed.

[0194] In some instances, when the second determination module 32 determines the message type of each message to be processed, the second determination module 32 is used to execute: obtaining the current processing mode corresponding to the driving module; when the current processing mode is the load balancing mode, the message to be processed in the load balancing mode is determined as a load balancing message; when the current processing mode is the multi-queue receiving mode, the message to be processed in the multi-queue receiving mode is determined as a multi-queue receiving message.

[0195] In some instances, when the second determination module 32 determines multiple messages that require order preservation based on the message type of each message to be processed, the second determination module 32 is used to execute: when the message to be processed is a load balancing message, the message to be processed is determined as a message that requires order preservation; when the message to be processed is a multi-queue reception message, the message to be processed is determined as not a message that requires order preservation.

[0196] In some instances, after obtaining a set of messages to be processed, the second processing module 33 in this embodiment is used to perform the following steps: detecting the message processing status corresponding to the set of messages to be processed; when all messages in the set of messages to be processed fail to be processed, obtaining the direct memory access queue information to which the set of messages to be processed belongs, the data packet sequence number of each message, and the number of discarded messages included in the set of messages to be processed; storing the direct memory access queue information, the data packet sequence number of each message, and the number of discarded messages in a preset register, so as to write the number of discarded messages into the preset information queue through the preset register.

[0197] Fig.12 The device shown can perform Figure 6-Figure 9 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 6-Figure 9 The implementation process and technical effects of this technical solution refer to Figure 6-Figure 9 The description in the illustrated embodiment will not be repeated here.

[0198] In one possible design, Fig.12 The structure of the message processing device shown can be implemented as an electronic device, which can be a controller, a personal computer, a server, a drive module, etc. Fig.13 As shown, the electronic device may include: a second processor 41 and a second memory 42. The second memory 42 is used to store the corresponding electronic device executing the above Figure 6-Figure 9 The program of the message processing method provided in the illustrated embodiment, the second processor 41 is configured to execute the program stored in the second memory 42 .

[0199] The program includes one or more computer instructions, wherein when the one or more computer instructions are executed by the second processor 41, the following steps can be implemented: obtaining an idle message descriptor for implementing message processing operations; when the driver module detects that there is packet loss, determining the number of non-discarded messages and discarded messages that need to be subjected to order preservation operations based on the idle message descriptor; and adding the number of discarded messages to the tail field of the non-discarded message.

[0200] Furthermore, the second processor 41 is also used to execute the aforementioned Figure 6 All or part of the steps in the illustrated embodiments.

[0201] The structure of the electronic device may further include a second communication interface 43 for the electronic device to communicate with other devices or a communication network.

[0202] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by electronic devices, which includes instructions for executing the above Figure 6 The program involved in the message processing method in the illustrated embodiment.

[0203] In addition, an embodiment of the present invention provides a computer program product, including: a computer-readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causing the one or more processors to execute the above Figure 6 The steps in the message processing method in the method embodiment are shown.

[0204] Fig.14 A schematic diagram of the structure of a network card provided by an embodiment of the present invention; Fig.14 As shown, this embodiment provides a network card, which may include: a field programmable gate array FPGA module 52 and a driver module 51 that is communicatively connected to the FPGA module 52, and the driver module 51 is used to drive the FPGA module 52 to perform data transmission with a host memory;

[0205] The driver module 51 is used to obtain an idle message descriptor for implementing a message processing operation; when the driver module detects that there is packet loss, the number of discarded messages that are not discarded and that need to be subjected to an order preservation operation after the non-discarded messages is determined based on the idle message descriptor; and the number of discarded messages is added to the tail field of the non-discarded messages;

[0206] The FPGA module 52 is used to obtain the current message to be processed through the driver module 51; when the current message is a message that needs to be discarded, determine the order-preserving queue used to implement the message processing operation, wherein the order-preserving queue at least includes: the order-preserving information of each message that needs to be subjected to the order-preserving operation; discard the current message, and release the order-preserving information of the current message in the order-preserving queue.

[0207] The driving module 51 in this embodiment can be implemented as the above Fig.10 The corresponding message processing device, FPGA module 52 can be implemented as Fig.12 The corresponding message processing device, the network card in this embodiment can realize the above Fig.10 and Fig.12 For the functional operations shown in the embodiment not described in detail, please refer to Fig.10 , Fig.12The implementation process and technical effects of this technical solution refer to Fig.10 , Fig.12 The description in the illustrated embodiment will not be repeated here.

[0208] 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 application 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 the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0209] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the objectives of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement the scheme without creative effort.

[0210] 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 software. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a computer product, and the present invention can be implemented 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.

[0211] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0212] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide the functions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in the blocks or multiple blocks. In a typical configuration, the computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0213] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0214] 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 processing method, characterized in that: Applied to a field programmable gate array (FPGA) module, the FPGA module is communicatively connected to a driver module, the driver module is used to drive data transmission between the FPGA module and a host memory; the method comprises: The FPGA module obtains the current message to be processed through the driver module; In the case where the current message is a message to be discarded, the FPGA module determines an order-preserving queue for implementing a message processing operation, wherein the order-preserving queue at least includes: order-preserving information of each message that needs to be subjected to an order-preserving operation; The FPGA module discards the current message and releases the order preservation information of the current message in the order preservation queue; After obtaining the current message to be processed, the method further includes: Get the previous processed message before the current message; Determine the number of discarded messages that need to be discarded and are located after the previously processed message; Based on the number of discarded messages, it is identified whether the current message is a message that needs to be discarded.

2. The method according to claim 1, characterized in that Based on the number of discarded messages, identifying whether the current message is a message to be discarded includes: When the number of discarded messages is non-zero, the current message is determined as a message to be discarded; When the number of discarded messages is 0, the current message is determined as not being a message to be discarded.

3. The method according to claim 1, characterized in that Determining the number of discarded messages that need to be discarded and are located after the previously processed message, includes: Obtaining a preset information queue, wherein the preset information queue stores message information of a processed message and the number of discarded messages after the processed message; Based on the preset information queue and the previously processed message, the number of discarded messages that need to be discarded and are located after the previously processed message is determined.

4. The method according to claim 3, characterized in that Before obtaining the preset information queue, the method further includes: Obtaining a tail field in the previously processed message for identifying the number of discarded messages; Reading the tail field to obtain the number of discarded messages; The message information of the previously processed message and the number of discarded messages are stored in a preset queue to generate the preset information queue.

5. A message processing method, characterized in that: Applied to a driver module, the driver module is used to drive data transmission between a field programmable gate array FPGA module and a host memory; the method includes: Obtaining an idle message descriptor for implementing message processing operations; When the driver module detects that there is packet loss, based on the idle message descriptor, determine the number of non-discarded messages and discarded messages that need to be subjected to order preservation operations after the non-discarded messages; The number of discarded messages is added to the tail field of the non-discarded message, so that the FPGA module obtains the number of discarded messages based on the tail field of the non-discarded message, identifies whether subsequent messages are messages that need to be discarded based on the number of discarded messages, and selects whether it is necessary to release the order-preserving information in the order-preserving queue used to implement the message processing operation based on the identification result.

6. The method according to claim 5, characterized in that After obtaining an idle message descriptor for implementing the message processing operation, the method further includes: Get the current message to be processed; When the idle message descriptors are insufficient to analyze and process the current message to be processed, the driver module detects that there is packet loss; When the idle message descriptors are sufficient to analyze and process the current message to be processed, the driving module detects that there is no packet loss.

7. The method according to claim 5, characterized in that Determining, based on the idle message descriptor, the number of non-discarded messages and discarded messages that need to be subjected to an order-preserving operation and are located after the non-discarded messages, including: Get a collection of messages to be processed; In the set of to-be-processed messages, determining the to-be-processed message corresponding to the last idle message descriptor as a non-discarded message; In the set of to-be-processed messages, determine a plurality of messages that need to maintain order and are located after the non-discarded messages; The number of the multiple messages requiring sequence preservation is determined as the number of discarded messages.

8. The method according to claim 7, characterized in that In the set of to-be-processed messages, determining a plurality of messages that need to maintain order and are located after the non-discarded message, comprises: In the set of to-be-processed messages, a plurality of to-be-processed messages located after the non-discarded messages are obtained; Determine the message type of each message to be processed; The plurality of messages requiring sequence preservation are determined based on the message type of each to-be-processed message.

9. The method according to claim 8, characterized in that Determine the message type of each message to be processed, including: Obtaining the current processing mode corresponding to the driving module; When the current processing mode is a load balancing mode, the message to be processed in the load balancing mode is determined as a load balancing message; When the current processing mode is a multi-queue receiving mode, the to-be-processed message in the multi-queue receiving mode is determined as a multi-queue receiving message.

10. The method according to claim 8, characterized in that Determining the plurality of messages requiring sequence preservation based on the message type of each to-be-processed message includes: When the to-be-processed message is a load balancing message, the to-be-processed message is determined as a message requiring order preservation; When the message to be processed is a multi-queue received message, the message to be processed is determined as not a message requiring sequence preservation.

11. The method according to claim 8, characterized in that After obtaining the set of messages to be processed, the method further includes: Detecting the message processing status corresponding to the set of messages to be processed; When all the messages in the to-be-processed message set fail to be processed, obtaining the direct memory access queue information to which the to-be-processed message set belongs, the data packet sequence number of each message, and the number of discarded messages included in the to-be-processed message set; The direct memory access queue information, the data packet sequence number of each message and the number of discarded messages are stored in a preset register, so that the number of discarded messages is written into a preset information queue through the preset register.

12. A message processing device, characterized in that: Applied to a field programmable gate array (FPGA) module, the FPGA module is communicatively connected to a driver module, the driver module is used to drive data transmission between the FPGA module and a host memory; the device comprises: A first acquisition module, used for acquiring the current message to be processed through the driving module; A first determination module is used to determine an order-preserving queue for implementing a message processing operation when the current message is a message to be discarded, wherein the order-preserving queue at least includes: order-preserving information of each message that needs to be subjected to an order-preserving operation; A first processing module, used for discarding the current message and releasing the order preservation information of the current message in the order preservation queue; The first acquisition module is further used to acquire a previously processed message before the current message after acquiring the current message to be processed; The first determination module is further used to determine the number of discarded messages that need to be discarded and are located after the previously processed message; The first processing module is further configured to identify whether the current message is a message to be discarded based on the number of discarded messages.

13. A message processing device, characterized in that: Applied to a driving module, the driving module is used to drive data transmission between a field programmable gate array FPGA module and a host memory; the device comprises: A second acquisition module, used to acquire an idle message descriptor for implementing a message processing operation; A second determination module is used to determine the number of non-discarded messages and discarded messages that need to be subjected to order preservation operations after the non-discarded messages based on the idle message descriptor when the driver module detects that there is packet loss; The second processing module is used to add the number of discarded messages to the tail field of the non-discarded message, so that the FPGA module obtains the number of discarded messages based on the tail field of the non-discarded message, identifies whether subsequent messages are messages that need to be discarded based on the number of discarded messages, and selects whether it is necessary to release the order-preserving information in the order-preserving queue used to implement the message processing operation based on the identification result.

14. A network card, characterized in that: It includes: a field programmable gate array (FPGA) module and a driving module connected to the FPGA module for communication, wherein the driving module is used to drive the data transmission between the FPGA module and the host memory; The driver module is used to obtain an idle message descriptor for implementing a message processing operation; When the driver module detects packet loss, based on the idle message descriptor, determine the number of non-discarded messages and discarded messages that need to be subjected to order preservation operations after the non-discarded messages; and add the number of discarded messages to the tail field of the non-discarded messages; The FPGA module is used to obtain the current message to be processed through the driver module; In the case where the current message is a message that needs to be discarded, determine an order-preserving queue for implementing message processing operations, wherein the order-preserving queue includes at least: order-preserving information of each message that needs to be subjected to order-preserving operations; discard the current message, and release the order-preserving information of the current message in the order-preserving queue.

15. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any one of claims 1-11.

16. A computer storage medium, characterized in that: Used to store a computer program, which enables a computer to implement the method of any one of claims 1 to 11 when executed by the computer.

17. A computer program product, characterized in that include: A computer program, when executed by a processor of an electronic device, causes the processor to execute the steps of any one of the methods of claims 1-11.

Citation Information

Patent Citations

  • Data processing method and device, electronic equipment and computer readable storage medium

    CN112235234A