FPGA algorithm card call processing method and system based on NETMAP
Through the FPGA algorithm card call processing method based on NETMAP, using zero-copy technology and business processing program analysis and filling, the problem of low FPGA algorithm card performance and high CPU pressure is solved, and the network data packet processing performance is improved.
Patent Information
- Application Number
- CN202410283482.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-12
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-03-12
AI Technical Summary
In the existing technology, the calling performance of the FPGA algorithm card is low and the network packet processing performance is poor, resulting in high pressure on the CPU. Especially in small server cryptographic machines, high-speed interfaces such as PCI-e cannot be used because the CPU interfaces are not abundant.
The FPGA algorithm card call processing method based on NETMAP is used to receive network data packets from the first network port through the data receiving module. The NETMAP kernel driver copies the data packets to the kernel data packet pool. The business processing program parses and fills the protocol header, using a zero-copy method. Send and receive data packets, and the FPGA algorithm card performs algorithm calculations to reduce CPU pressure.
It improves the calling performance of the FPGA algorithm card, improves the processing performance of network data packets, reduces the pressure on the CPU, and achieves efficient data packet processing.
Smart Images

Figure CN118200417B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer network communication, and in particular to a NETMAP-based FPGA algorithm card calling processing method and system. Background Art
[0002] NETMAP is a high-performance framework for sending and receiving raw data packets, developed by Luigi Rizzo and others. It includes kernel modules and user-mode library functions. Its goal is to achieve high-performance transmission of data packets between user mode and network cards without modifying existing operating system software or requiring special hardware support.
[0003] FPGA (Field-Programmable Gate Array) is a field programmable gate array, which is a further development product based on programmable devices such as PAL, GAL, CPLD, etc. It appears as a semi-custom circuit in the field of application-specific integrated circuits (ASICs), which not only solves the shortcomings of custom circuits, but also overcomes the disadvantage of the limited number of gate circuits of the original programmable devices.
[0004] At present, in the prior art, server cryptographic machines mainly implement algorithm call services through hardware algorithm cards. For small server cryptographic machines, the CPU interfaces are often not rich, and high-speed interfaces such as PCI-e cannot be used.
[0005] How to improve the calling performance of FPGA algorithm cards, enhance the processing performance of network data packets, and reduce CPU pressure are issues that need to be addressed urgently. Summary of the invention
[0006] To this end, the present invention provides a NETMAP-based FPGA algorithm card call processing method and system to solve the problems of low FPGA algorithm card call performance, poor network data packet processing performance, and high CPU pressure.
[0007] In order to achieve the above object, the present invention provides the following technical solution: a NETMAP-based FPGA algorithm card call processing method, comprising:
[0008] Calling the data receiving module to receive the network data packet sent by the client from the first network port;
[0009] The NETMAP kernel driver extracts a data packet from the kernel data packet pool, and copies the data of the network data packet received from the first network port to the data packet extracted from the kernel data packet pool; when copying the data, the first number of bytes of the data packet extracted from the kernel data packet pool are used as reserved space, and the data of the network data packet is after the first number of bytes;
[0010] The service processing program receives the data packet extracted from the kernel data packet pool by calling the NETMAP user state lib library; the service processing program parses the data packet extracted from the kernel data packet pool, determines the network data packet type, identifies the user-defined protocol message, non-IP message and IP message and parses them to obtain corresponding information;
[0011] The business processing program fills the first number of bytes of the data packet extracted from the kernel data packet pool as needed according to the corresponding information parsed; the first number of bytes of the data packet extracted from the kernel data packet pool is the control protocol header for communication between the CPU and the FPGA algorithm card;
[0012] The service processing program sends the data packet extracted from the kernel data packet pool to the second network port by calling the NETMAP user state lib library in a zero-copy manner;
[0013] The FPGA algorithm card receives the data packet extracted from the kernel data packet pool from the second network port, and the FPGA algorithm card performs algorithm calculation on the actual network data packet content after the first number of bytes of the data packet extracted from the kernel data packet pool through the first first number of bytes of the data packet extracted from the kernel data packet pool. After the calculation is completed, the FPGA algorithm card sends the calculated data packet to the second network port;
[0014] The service processing program receives the calculated data packet of the second network port by calling the NETMAP user state lib library; and sends the calculated data packet to the first network port in a zero-copy manner;
[0015] The NETMAP kernel driver detects that there is the calculated data packet to be sent in the sending buffer queue of the first network port. The NETMAP kernel driver offsets the storage physical address of the calculated data packet after the first number of bytes and assigns it to the corresponding position of the BD array of the DMA ENGINE. After completion, the NETMAP kernel driver notifies the first network port to send the data.
[0016] As a preferred solution of the FPGA algorithm card call processing method based on NETMAP, the corresponding information includes: protocol number, source IP, destination IP, source port number, and destination port number information.
[0017] As a preferred solution of the FPGA algorithm card call processing method based on NETMAP, the IP message identifies TCP messages, UDP messages and designated type messages through the protocol field in the IP header, and parses out the protocol number, the source IP and the destination IP information.
[0018] As a preferred solution of the FPGA algorithm card call processing method based on NETMAP, the business processing program parses the TCP message according to the format of the TCP message to parse out the source port number and the destination port number information.
[0019] As a preferred solution of the FPGA algorithm card call processing method based on NETMAP, the business processing program parses the UDP message through the UDP message format to parse out the source port number and the destination port number information.
[0020] The present invention also provides a NETMAP-based FPGA algorithm card call processing system, comprising:
[0021] A data receiving module, used for receiving a network data packet sent by a client from the first network port;
[0022] The NETMAP kernel driver data copy module is used to extract a data packet from the kernel data packet pool, and copy the data of the network data packet received from the first network port to the data packet extracted from the kernel data packet pool; when copying the data, the first number of bytes of the data packet extracted from the kernel data packet pool are used as reserved space, and the data of the network data packet is after the first number of bytes;
[0023] The business processing program data judgment and parsing module is used to receive the data packet extracted from the kernel data packet pool by calling the NETMAP user state lib library; the business processing program parses the data packet extracted from the kernel data packet pool, determines the type of network data packet, identifies user-defined protocol packets, non-IP packets and IP packets and parses them to obtain corresponding information;
[0024] A business processing program data filling module is used to fill the first number of bytes of the data packet extracted from the kernel data packet pool as needed according to the corresponding information parsed; the first number of bytes of the data packet extracted from the kernel data packet pool is a control protocol header for communication between the CPU and the FPGA algorithm card;
[0025] A service processing program data sending module is used to send the data packet extracted from the kernel data packet pool to the second network port by calling the NETMAP user state lib library in a zero copy manner;
[0026] The FPGA algorithm card data calculation module is used to receive the data packet extracted from the kernel data packet pool from the second network port, and the FPGA algorithm card performs algorithm calculation on the actual network data packet content after the first number of bytes of the data packet extracted from the kernel data packet pool through the first first number of bytes of the data packet extracted from the kernel data packet pool. After the calculation is completed, the FPGA algorithm card sends the calculated data packet to the second network port;
[0027] A business processing program data forwarding module is used to receive the calculated data packet of the second network port by calling the NETMAP user state lib library; and send the calculated data packet to the first network port in a zero-copy manner;
[0028] The NETMAP kernel driver sends a data processing module, which is used for the NETMAP kernel driver to detect that there is a calculated data packet to be sent in the sending buffer queue of the first network port. The NETMAP kernel driver offsets the storage physical address of the calculated data packet after the first number of bytes and assigns it to the corresponding position of the BD array of the DMA ENGINE. After completion, the NETMAP kernel driver notifies the first network port to send the data.
[0029] As a preferred solution of the FPGA algorithm card call processing system based on NETMAP, in the business processing program data judgment and analysis module, the corresponding information includes: protocol number, source IP, destination IP, source port number, and destination port number information.
[0030] As a preferred solution for the FPGA algorithm card call processing system based on NETMAP, in the business processing program data judgment and parsing module, the IP message identifies the TCP message, UDP message and the specified type message through the protocol field in the IP header, and parses the protocol number, the source IP and the destination IP information.
[0031] As a preferred solution of the FPGA algorithm card call processing system based on NETMAP, in the business processing program data judgment and analysis module, the business processing program parses the TCP message according to the format of the TCP message to parse out the source port number and destination port number information.
[0032] As a preferred solution of the FPGA algorithm card call processing system based on NETMAP, in the business processing program data judgment and analysis module, the business processing program parses the UDP message according to the UDP message format to parse out the source port number and destination port number information.
[0033] The present invention has the following advantages: calling a data receiving module to receive a network data packet sent by a client from a first network port; a NETMAP kernel driver extracts a data packet from a kernel data packet pool, and copies the data of the network data packet received from the first network port to the data packet extracted from the kernel data packet pool; when copying data, the first number of bytes of the data packet extracted from the kernel data packet pool are used as reserved space, and the data of the network data packet follows the first number of bytes; a business processing program receives the data packet extracted from the kernel data packet pool by calling a NETMAP user state lib library; the business processing program parses the data packet extracted from the kernel data packet pool, determines the type of the network data packet, identifies the user-defined protocol message, the non-IP message and the IP message, and parses them to obtain corresponding information; the business processing program fills the first number of bytes of the data packet extracted from the kernel data packet pool as needed according to the parsed corresponding information; the first number of bytes of the data packet extracted from the kernel data packet pool are CPU and FPGA algorithm cartoons The control protocol header of the signal; the business processing program sends the data packet extracted from the kernel data packet pool to the second network port in a zero-copy manner by calling the NETMAP user state lib library; the FPGA algorithm card receives the data packet extracted from the kernel data packet pool from the second network port, and the FPGA algorithm card performs algorithm calculation on the actual network data packet content after the first number of bytes of the data packet extracted from the kernel data packet pool through the first first number of bytes of the data packet extracted from the kernel data packet pool; after the calculation is completed, the FPGA algorithm card sends the calculated data packet to the second network port; the business processing program receives the calculated data packet of the second network port by calling the NETMAP user state lib library; and sends the calculated data packet to the first network port in a zero-copy manner; the NETMAP kernel driver detects that there is the calculated data packet to be sent out in the sending buffer queue of the first network port, and the NETMAP kernel driver offsets the storage physical address of the calculated data packet after the first number of bytes, and assigns it to the corresponding position of the BD array of the DMA ENGINE, and after completion, the NETMAP kernel driver notifies the first network port to send data. The present invention improves the calling performance of the FPGA algorithm card, improves the processing performance of the network data packet, and reduces the CPU pressure. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the drawings required for the implementation methods or the prior art descriptions are briefly introduced below. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.
[0035] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.
[0036] Figure 1 A logical schematic diagram of a FPGA algorithm card call processing method based on NETMAP provided in Example 1 of the present invention;
[0037] Figure 2 A schematic diagram of the NETMAP kernel driver logic in the NETMAP-based FPGA algorithm card call processing method provided in Example 1 of the present invention;
[0038] Figure 3 A logical schematic diagram of a business processing program in a FPGA algorithm card call processing method based on NETMAP provided in Example 1 of the present invention;
[0039] Figure 4 A logical schematic diagram of an FPGA algorithm card in a NETMAP-based FPGA algorithm card calling processing method provided in Example 1 of the present invention;
[0040] Figure 5 A schematic diagram of the structure of the FPGA algorithm card call processing system based on NETMAP provided in Example 2 of the present invention;
[0041] Figure 6 A schematic diagram of a NETMAP-based FPGA algorithm card calling and processing system provided in Example 2 of the present invention. DETAILED DESCRIPTION
[0042] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. 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.
[0043] Since the current server cryptographic machines mainly implement algorithm call services through hardware algorithm cards, for small server cryptographic machines, the CPU interfaces are often not rich and high-speed interfaces such as PCI-e cannot be used.
[0044] In view of this, the present invention solves the problems of low FPGA algorithm card calling performance, poor network data packet processing performance, and high CPU pressure. The following is a specific implementation of the technical solution of the present invention.
[0045] Example 1
[0046] See also Figure 1 , Figure 2 , Figure 3 and Figure 4 Embodiment 1 of the present invention provides a FPGA algorithm card call processing method based on NETMAP, and the processing process includes the following steps:
[0047] S1: calling the data receiving module to receive the network data packet sent by the client from the first network port;
[0048] S2: The NETMAP kernel driver extracts a data packet from the kernel data packet pool, and copies the data of the network data packet received from the first network port to the data packet extracted from the kernel data packet pool; when copying the data, the first number of bytes of the data packet extracted from the kernel data packet pool are used as reserved space, and the data of the network data packet is after the first number of bytes;
[0049] S3: The service processing program receives the data packet extracted from the kernel data packet pool by calling the NETMAP user state lib library; the service processing program parses the data packet extracted from the kernel data packet pool, determines the network data packet type, and identifies the user-defined protocol message, the non-IP message, and the IP message; the service processing program parses the user-defined protocol message, the non-IP message, and the IP message to obtain corresponding information;
[0050] S4: the business processing program fills the first number of bytes of the data packet extracted from the kernel data packet pool as needed according to the corresponding information parsed; the first number of bytes of the data packet extracted from the kernel data packet pool is the control protocol header for communication between the CPU and the FPGA algorithm card;
[0051] S5: The service processing program sends the data packet extracted from the kernel data packet pool to the second network port in a zero-copy manner by calling the NETMAP user state lib library;
[0052] S6: the FPGA algorithm card receives the data packet extracted from the kernel data packet pool from the second network port, and the FPGA algorithm card performs algorithm calculation on the actual network data packet content after the first number of bytes of the data packet extracted from the kernel data packet pool through the first first number of bytes of the data packet extracted from the kernel data packet pool. After the calculation is completed, the FPGA algorithm card sends the calculated data packet to the second network port;
[0053] S7: The service processing program receives the calculated data packet of the second network port by calling the NETMAP user state lib library; the service processing program sends the calculated data packet to the first network port by calling the NETMAP user state lib library in a zero copy manner;
[0054] S8: The NETMAP kernel driver detects that there is the calculated data packet to be sent in the sending buffer queue of the first network port. The NETMAP kernel driver offsets the storage physical address of the calculated data packet after the first number of bytes and assigns it to the corresponding position of the BD array of the DMA ENGINE. After completion, the NETMAP kernel driver notifies the first network port to send the data.
[0055] In this embodiment, the corresponding information includes: protocol number, source IP, destination IP, source port number, and destination port number information.
[0056] In this embodiment, the IP message identifies the TCP message, UDP message and the specified type message through the protocol field in the IP header, and parses the protocol number, the source IP and the destination IP information.
[0057] In this embodiment, the service processing program parses the TCP message according to the format of the TCP message to parse out the source port number and the destination port number information.
[0058] In this embodiment, the service processing program parses the UDP message according to the UDP message format to parse out the source port number and the destination port number information.
[0059] In summary, the present invention calls a data receiving module to receive a network data packet sent by a client from a first network port; the NETMAP kernel driver extracts a data packet from a kernel data packet pool, and copies the data of the network data packet received from the first network port to the data packet extracted from the kernel data packet pool; when copying data, the first number of bytes of the data packet extracted from the kernel data packet pool are used as reserved space, and the data of the network data packet follows the first number of bytes; the business processing program receives the data packet extracted from the kernel data packet pool by calling the NETMAP user state lib library; the business processing program parses the data packet extracted from the kernel data packet pool, determines the type of network data packet, and identifies user-defined protocol messages, non-IP messages, and IP messages; the business processing program parses the user-defined protocol messages, the non-IP messages, and the IP messages to obtain corresponding information; the business processing program fills the first number of bytes of the data packet extracted from the kernel data packet pool as needed according to the parsed corresponding information; the first number of bytes of the data packet extracted from the kernel data packet pool is the CPU and FPGA calculation The control protocol header of the card communication; the business processing program sends the data packet extracted from the kernel data packet pool to the second network port in a zero-copy manner by calling the NETMAP user state lib library; the FPGA algorithm card receives the data packet extracted from the kernel data packet pool from the second network port, and the FPGA algorithm card performs algorithm calculation on the actual network data packet content after the first number of bytes of the data packet extracted from the kernel data packet pool through the first first number of bytes of the data packet extracted from the kernel data packet pool; after the calculation is completed, the FPGA algorithm card sends the calculated data packet to the second network port; the business processing program receives the calculated data packet of the second network port by calling the NETMAP user state lib library; the business processing program sends the calculated data packet to the first network port in a zero-copy manner by calling the NETMAP user state lib library; the NETMAP kernel driver detects that there is the calculated data packet to be sent out in the sending buffer queue of the first network port, and the NETMAP kernel driver offsets the storage physical address of the calculated data packet after the first number of bytes, and assigns it to the corresponding position of the BD array of the DMA ENGINE, and after completion, the NETMAP kernel driver notifies the first network port to send data. The present invention improves the calling performance of FPGA algorithm card, enhances the processing performance of network data packets, and reduces CPU pressure.
[0060] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0061] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0062] Example 2
[0063] See also Figure 5 and Figure 6 Embodiment 2 of the present invention provides a NETMAP-based FPGA algorithm card call processing system, comprising:
[0064] Data receiving module 01, used to receive network data packets sent by the client from the first network port;
[0065] The NETMAP kernel driver data copy module 02 is used to extract a data packet from the kernel data packet pool, and copy the data of the network data packet received from the first network port to the data packet extracted from the kernel data packet pool; when copying the data, the first number of bytes of the data packet extracted from the kernel data packet pool are used as reserved space, and the data of the network data packet is after the first number of bytes;
[0066] The business processing program data judgment and analysis module 03 is used to receive the data packet extracted from the kernel data packet pool by calling the NETMAP user state lib library; the business processing program analyzes the data packet extracted from the kernel data packet pool, determines the network data packet type, and identifies the user-defined protocol message, non-IP message and IP message; the business processing program analyzes the user-defined protocol message, the non-IP message and the IP message to obtain corresponding information;
[0067] The business processing program data filling module 04 is used to fill the first number of bytes of the data packet extracted from the kernel data packet pool as needed according to the corresponding information parsed; the first number of bytes of the data packet extracted from the kernel data packet pool is the control protocol header for communication between the CPU and the FPGA algorithm card;
[0068] The service processing program data sending module 05 is used to send the data packet extracted from the kernel data packet pool to the second network port by calling the NETMAP user state lib library in a zero copy manner;
[0069] The FPGA algorithm card data calculation module 06 is used to receive the data packet extracted from the kernel data packet pool from the second network port, and the FPGA algorithm card performs algorithm calculation on the actual network data packet content after the first number of bytes of the data packet extracted from the kernel data packet pool through the first first number of bytes of the data packet extracted from the kernel data packet pool. After the calculation is completed, the FPGA algorithm card sends the calculated data packet to the second network port;
[0070] The service processing program data forwarding module 07 is used to receive the calculated data packet of the second network port by calling the NETMAP user state lib library; the service processing program sends the calculated data packet to the first network port by calling the NETMAP user state lib library in a zero copy manner;
[0071] The NETMAP kernel driver sends data processing module 08, which is used for the NETMAP kernel driver to detect that there is the calculated data packet to be sent in the sending buffer queue of the first network port. The NETMAP kernel driver offsets the storage physical address of the calculated data packet after the first number of bytes and assigns it to the corresponding position of the BD array of the DMA ENGINE. After completion, the NETMAP kernel driver notifies the first network port to send data.
[0072] In this embodiment, in the business processing program data judgment and analysis module 03, the corresponding information includes: protocol number, source IP, destination IP, source port number, and destination port number information.
[0073] In this embodiment, in the business processing program data judgment and analysis module 03, the IP message identifies the TCP message, UDP message and the specified type message through the protocol field in the IP header, and parses the protocol number, the source IP and the destination IP information.
[0074] In this embodiment, in the service processing program data judgment and analysis module 03, the service processing program parses the TCP message according to the format of the TCP message to parse out the source port number and the destination port number information.
[0075] In this embodiment, in the service processing program data judgment and analysis module 03, the service processing program parses the UDP message according to the UDP message format to parse out the source port number and the destination port number information.
[0076] It should be noted that the information interaction, execution process, etc. between the modules / units of the above-mentioned system are based on the same concept as the method embodiment in Example 1 of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown in the previous part of the present application, and will not be repeated here.
[0077] Example 3
[0078] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, in which a program code of a NETMAP-based FPGA algorithm card calling processing method is stored. The program code includes instructions for executing the NETMAP-based FPGA algorithm card calling processing method of Embodiment 1 or any possible implementation thereof.
[0079] The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0080] Example 4
[0081] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;
[0082] The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the NETMAP-based FPGA algorithm card calling processing method of Example 1 or any possible implementation thereof.
[0083] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor implemented by reading software codes stored in a memory. The memory can be integrated in the processor or can be located outside the processor and exist independently.
[0084] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.
[0085] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0086] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.
Claims
1. A FPGA algorithm card call processing method based on NETMAP, It is characterized in that include: Calling the data receiving module to receive the network data packet sent by the client from the first network port; The NETMAP kernel driver extracts a data packet from the kernel data packet pool, and copies the data of the network data packet received from the first network port to the data packet extracted from the kernel data packet pool; when copying the data, the first number of bytes of the data packet extracted from the kernel data packet pool are used as reserved space, and the data of the network data packet is after the first number of bytes; The service processing program receives the data packet extracted from the kernel data packet pool by calling the NETMAP user state lib library; the service processing program parses the data packet extracted from the kernel data packet pool, determines the network data packet type, identifies the user-defined protocol message, non-IP message and IP message and parses them to obtain corresponding information; The business processing program fills the first number of bytes of the data packet extracted from the kernel data packet pool as needed according to the corresponding information parsed; the first number of bytes of the data packet extracted from the kernel data packet pool is the control protocol header for communication between the CPU and the FPGA algorithm card; The service processing program sends the data packet extracted from the kernel data packet pool to the second network port by calling the NETMAP user state lib library in a zero-copy manner; The FPGA algorithm card receives the data packet extracted from the kernel data packet pool from the second network port, and the FPGA algorithm card performs algorithm calculation on the actual network data packet content after the first number of bytes of the data packet extracted from the kernel data packet pool through the first first number of bytes of the data packet extracted from the kernel data packet pool; after the calculation is completed, the FPGA algorithm card sends the calculated data packet to the second network port; The service processing program receives the calculated data packet of the second network port by calling the NETMAP user state lib library; and sending the calculated data packet to the first network port in a zero-copy manner; The NETMAP kernel driver detects that there is the calculated data packet to be sent in the sending buffer queue of the first network port, and assigns the storage physical address of the calculated data packet after offsetting the first number of bytes to the corresponding position of the BD array of the DMA ENGINE. After completion, the NETMAP kernel driver notifies the first network port to send the data.
2. According to the FPGA algorithm card calling processing method based on NETMAP described in claim 1, It is characterized in that The corresponding information includes: protocol number, source IP, destination IP, source port number, and destination port number information.
3. According to the FPGA algorithm card calling processing method based on NETMAP described in claim 2, It is characterized in that The IP message identifies the TCP message, UDP message and the specified type message through the protocol field in the IP header, and parses the protocol number, the source IP and the destination IP information.
4. According to the FPGA algorithm card calling processing method based on NETMAP as claimed in claim 3, It is characterized in that The service processing program parses the TCP message according to the format of the TCP message, and parses out the source port number and the destination port number information.
5. According to the NETMAP-based FPGA algorithm card calling processing method of claim 3, It is characterized in that The service processing program parses the UDP message according to the UDP message format to parse out the source port number and the destination port number information.
6. FPGA algorithm card call processing system based on NETMAP, It is characterized in that include: A data receiving module, used for receiving a network data packet sent by a client from the first network port; The NETMAP kernel driver data copy module is used to extract a data packet from the kernel data packet pool, and copy the data of the network data packet received from the first network port to the data packet extracted from the kernel data packet pool; when copying the data, the first number of bytes of the data packet extracted from the kernel data packet pool are used as reserved space, and the data of the network data packet is after the first number of bytes; The business processing program data judgment and parsing module is used to receive the data packet extracted from the kernel data packet pool by calling the NETMAP user state lib library; parse the data packet extracted from the kernel data packet pool, judge the network data packet type, identify the user-defined protocol message, non-IP message and IP message and parse them to obtain corresponding information; A business processing program data filling module is used to fill the first number of bytes of the data packet extracted from the kernel data packet pool as needed according to the corresponding information parsed; the first number of bytes of the data packet extracted from the kernel data packet pool is a control protocol header for communication between the CPU and the FPGA algorithm card; A service processing program data sending module is used to send the data packet extracted from the kernel data packet pool to the second network port by calling the NETMAP user state lib library in a zero-copy manner; The FPGA algorithm card data calculation module is used to receive the data packet extracted from the kernel data packet pool from the second network port, and the FPGA algorithm card performs algorithm calculation on the actual network data packet content after the first number of bytes of the data packet extracted from the kernel data packet pool through the first first number of bytes of the data packet extracted from the kernel data packet pool. After the calculation is completed, the FPGA algorithm card sends the calculated data packet to the second network port; A business processing program data forwarding module is used to receive the calculated data packet of the second network port by calling the NETMAP user state lib library; and send the calculated data packet to the first network port in a zero-copy manner; The NETMAP kernel driver sends a data processing module, which is used for the NETMAP kernel driver to detect that there is a calculated data packet to be sent in the sending buffer queue of the first network port. The NETMAP kernel driver offsets the storage physical address of the calculated data packet after the first number of bytes and assigns it to the corresponding position of the BD array of the DMA ENGINE. After completion, the NETMAP kernel driver notifies the first network port to send the data.
7. The FPGA algorithm card call processing system based on NETMAP according to claim 6, It is characterized in that In the business processing program data judgment and analysis module, the corresponding information includes: protocol number, source IP, destination IP, source port number, and destination port number information.
8. The FPGA algorithm card call processing system based on NETMAP according to claim 7, It is characterized in that In the business processing program data judgment and analysis module, the IP message identifies the TCP message, UDP message and the specified type message through the protocol field in the IP header, and parses the protocol number, the source IP and the destination IP information.
9. The FPGA algorithm card call processing system based on NETMAP according to claim 8, It is characterized in that In the business processing program data judgment and analysis module, the business processing program parses the TCP message according to the format of the TCP message to parse out the source port number and the destination port number information.
10. The NETMAP-based FPGA algorithm card calling processing system according to claim 8, It is characterized in that In the business processing program data judgment and analysis module, the business processing program parses the UDP message according to the UDP message format to parse out the source port number and destination port number information.
