Computing device, packet receiving method, programmable network card and storage medium
By configuring the packet filtering rules and information requirements of the target application in the programmable network interface card and writing them into memory using DMA, the problem of low flexibility in traditional hardware offloading technology is solved, achieving flexible hardware offloading and efficient packet processing.
Patent Information
- Application Number
- CN202211348792.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2042-10-31
AI Technical Summary
Traditional hardware offloading techniques for protocol parsing are inflexible and cannot meet the network acceleration needs of various applications. In addition, software protocol parsing has poor performance, resulting in processing latency and memory copying issues.
By pre-configuring the packet filtering rules and information requirements of the target application in the programmable network interface card (NIC), the target data can be written to memory through direct memory access (DMA), enabling the application to flexibly configure hardware offloading functions according to its needs and reducing memory data copying.
It improves the flexibility of hardware offloading, reduces the memory wall problem caused by memory data copying, and enhances message processing efficiency and performance.
Smart Images

Figure CN115733832B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, in particular to a computing device, a packet receiving method, a programmable network card and a storage medium. BACKGROUND
[0002] In recent years, due to the increasing application of network function virtualization (NFV), the performance requirement of user transaction is increasing, which makes the 100G network card gradually popular. With the continuous improvement of network card performance and bandwidth, software protocol analysis cannot meet the growing network demand. In order to improve the protocol analysis performance of physical machine, protocol analysis hardware offload technology emerges as the times require.
[0003] The traditional protocol analysis hardware offload is for the specific processing of specific protocol in a specific scene, and other applications may not need these offload functions, so network acceleration cannot be achieved. SUMMARY
[0004] The present application provides a computing device, a packet receiving method, a programmable network card and a storage medium, which are used to realize application-based protocol hardware offload, and help to improve the flexibility of hardware offload.
[0005] The present application provides a computing device, which comprises a processor, a memory and a programmable network card; the processor, the memory and the programmable network card are connected through a data bus;
[0006] The target application runs on the processor; the memory comprises a target memory corresponding to the programmable network card;
[0007] The programmable network card is configured to receive a to-be-processed packet, filter the to-be-processed packet sent to the target application according to a packet filtering rule corresponding to the target application pre-configured in the programmable network card, and acquire target data required by the target application from the to-be-processed packet according to information requirement of the target application pre-configured in the programmable network card, and write the target data into the target memory in a direct memory access (DMA) mode;
[0008] The processor is configured to read the target data from the target memory, and process the target data according to the requirement of the target application.
[0009] Optionally, the processor is further configured to: in response to the start of the target application, configure the packet filtering rule and the information requirement of the target application in the programmable network card; and configure the target memory for the programmable network card.
[0010] The embodiment of the application further provides a message receiving method, comprising:
[0011] receiving a to-be-processed message;
[0012] screening the to-be-processed message sent to the target application according to a message screening rule corresponding to the target application preconfigured in a programmable network card of the computing device; the target application runs in a processor of the computing device;
[0013] for the to-be-processed message sent to the target application, obtaining target data required by the target application from the to-be-processed message according to information requirement of the target application preconfigured in the programmable network card;
[0014] writing the target data into a target memory corresponding to the programmable network card in a direct memory access (DMA) mode, so that the target application reads the target data from the target memory.
[0015] The embodiment of the application further provides an information configuration method, comprising:
[0016] in response to starting of a target application running in a processor, configuring a message screening rule of the target application in a programmable network card of a computing device, so that the programmable network card screens a to-be-processed message sent to the target application;
[0017] configuring information requirement of the target application in the programmable network card, so that the programmable network card obtains target data required by the target application from the to-be-processed message;
[0018] configuring a target memory for the programmable network card, so that the programmable network card writes the target data into the target memory.
[0019] The embodiment of the application further provides a message receiving method, comprising:
[0020] receiving a to-be-processed message; the to-be-processed message is a message received by a programmable network card of a computing device; the programmable network card is preconfigured with a message screening rule of a simple file transfer protocol (TFTP) application; the message screening rule comprises a transport layer protocol type and a destination port number;
[0021] screening the to-be-processed message sent to the TFTP application according to the transport layer protocol type and the destination port number; the TFTP application runs in a processor of the computing device;
[0022] for the to-be-processed message sent to the TFTP application, obtaining target data required by the TFTP application from the to-be-processed message according to information requirement of the TFTP application preconfigured in the programmable network card;
[0023] write the target data into the target memory corresponding to the programmable network card in a direct memory access (DMA) mode, so that the TFTP application reads the target data from the target memory.
[0024] The embodiment of the present application further provides a programmable network card, which is used to be installed in a computing device; when the programmable network card is installed in the computing device, a memory of the computing device comprises a target memory corresponding to the programmable network card;
[0025] The programmable network card comprises a communication module, a screening module, an information obtaining module and a writing module; the communication module, the screening module, the information obtaining module and the writing module are electrically connected;
[0026] The communication module is used to receive a to-be-processed packet;
[0027] The screening module is used to screen the to-be-processed packet sent to the target application according to a packet screening rule corresponding to the target application preconfigured in the programmable network card; the target application runs on a processor of the computing device;
[0028] The information obtaining module is used to obtain target data required by the target application from the to-be-processed packet according to an information requirement of the target application preconfigured in the programmable network card, for the to-be-processed packet sent to the target application;
[0029] The writing module is used to write the target data into the target memory in a direct memory access (DMA) mode, so that the processor reads the target data from the target memory and processes the target data according to the requirement of the target application.
[0030] The embodiment of the present application further provides a computer readable storage medium storing computer instructions, which, when executed by one or more processors, causes the one or more processors to perform the steps in the packet receiving method and / or the information configuring method.
[0031] In the embodiment of the present application, the packet screening rule and the information requirement of the target application can be preconfigured in the programmable network card; accordingly, the to-be-processed packet sent to the target application can be screened according to the preconfigured packet screening rule of the target application; and the target data required by the target application can be obtained from the to-be-processed packet according to the preconfigured information requirement of the target application; then, the target data is written into the memory in a DMA mode; the target application can obtain the target data from the memory and process the target data, so that the application can flexibly configure the hardware offload function according to the requirement, and the flexibility of the hardware offload is improved. BRIEF DESCRIPTION OF DRAWINGS
[0032] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
[0033] Figure 1 and Figure 2 a structural schematic diagram of a computing device provided for a conventional scheme;
[0034] Figure 3 a structural schematic diagram of a computing device and an information configuration process provided for an embodiment of the application;
[0035] Figure 4 a structural schematic diagram of a computing device and a packet receiving process provided for an embodiment of the application;
[0036] Figure 5 a structural schematic diagram of a computing device and another packet receiving process provided for an embodiment of the application;
[0037] Figure 6 a receiving process schematic diagram of a TFTP application packet provided for an embodiment of the application;
[0038] Figure 7 a flow schematic diagram of an information configuration method provided for an embodiment of the application;
[0039] Figure 8 a flow schematic diagram of a packet receiving method provided for an embodiment of the application;
[0040] Figure 9 a flow schematic diagram of another packet receiving method provided for an embodiment of the application;
[0041] Figure 10 a structural schematic diagram of a programmable network card provided for an embodiment of the application. DETAILED DESCRIPTION
[0042] In order to make the objects, technical solutions and advantages of the application clearer, the following will clearly and completely describe the technical solutions of the application with specific embodiments of the application and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the application.
[0043] Figure 1 a structural schematic diagram of a conventional computing device. As shown in Figure 1 , the conventional computing device can include a processor 11 and a network card 12. In Figure 1In this configuration, processor 11 is a serial processing unit, typically a central processing unit (CPU). Processor 11 and network card 12 can communicate via a data bus. The data bus can be a serial interface data bus, such as a Peripheral Component Interconnect Express (PCIe) interface, a Universal Serial Bus (USB) serial interface, an RS485 interface, or an RS232 interface, etc., but is not limited to these.
[0044] The application runs on processor 11. An application is a computer program designed to perform one or more specific tasks; it runs at the application layer. Figure 1 The computing device shown has a network interface card (NIC) 12 that does not have a hardware offloading function. Therefore, as... Figure 1 As shown, for computing devices without hardware offloading capabilities, network protocol parsing is performed by processor 11. Figure 1 As shown, network interface card 12 can receive packets sent to the application and transmit the packets to processor 11 via the data bus. Processor 11 processes network packets by parsing them through the protocol stack before transmitting them to the application layer for use. Protocol stack parsing includes, but is not limited to, parsing the protocol stacks of the link layer, network layer, and transport layer. This layer-by-layer parsing of software protocols results in poor performance and significant latency. Especially when processing long packets, the need for multiple CPU-to-memory copies severely impacts software processing performance.
[0045] To improve processing performance and reduce processing latency, some traditional solutions, such as Figure 2 As shown, network interface card 12 is designed to offload certain protocol stack functions. Figure 2 In the computing device shown, the network interface card 12 (NIC 12) can acquire data packets and performs specific protocol parsing functions. The NIC 12 can offload functions in both the data transmission and reception directions.
[0046] For example, in some solutions, network interface card 12 (NIC 12) can offload the function of Virtual Local Area Network (VLAN) processing. VLAN offloading means that NIC 12 can reduce the load on processor 11 by inserting VLAN tags when sending packets and removing VLAN tags when receiving packets.
[0047] For example, in some embodiments, the network card 12 can implement hardware offload of the Transmission Control Protocol (TCP) segment offload (TSO) function. This function is for the sending direction. As we know, the TCP protocol can negotiate to determine the size of the TCP segment to be sent. The network card 12 can perform fragmentation of the TCP packet according to the size of the TCP segment, and the like, to greatly reduce the burden of the processor 11 software on the TCP segment.
[0048] Tunnel hardware offload refers to the network card 12 identifying data packets of virtual extensible local area network (VxLAN) and network virtualization using generic routing encapsulation (NVGRE), and being able to provide a check sum function for the Internet Protocol (IP) protocol, TCP, or User Datagram Protocol (UDP) involved in these virtualization technologies, thereby reducing the burden of the processor 11.
[0049] The hardware function offload in the above conventional scheme can implement protocol analysis offload and hardware loading. However, the offload function of the above conventional scheme is specific processing for a certain protocol in a certain scenario, and the flexibility of the hardware offload is low. For many applications, these offload functions can not be used, and network acceleration cannot be achieved.
[0050] For example, for the network card 12 designed to have the TCP segment offload function, if the data amount of the TCP packet sent by an application A is small and does not need to be fragmented, the application A does not need the hardware offload of the TCP segment. For example, for the network card 12 designed to have the Tunnel hardware offload function, the data packet sent to an application B is not a VxLAN data packet, and the application B does not need the Tunnel hardware offload.
[0051] To improve the flexibility of hardware offloading, in some embodiments of the present application, the packet filtering rules and information requirements of the target application can be pre-configured in the programmable network card. Accordingly, the to-be-processed packet sent to the target application can be filtered according to the pre-configured packet filtering rules of the target application; and the target data required by the target application can be obtained from the to-be-processed packet according to the pre-configured information requirements of the target application; then the target data is written into the memory in a DMA manner; and the target application can obtain the target data from the memory and process it. On the one hand, the application can flexibly configure the hardware offloading function according to the requirements, which helps to improve the flexibility of hardware offloading; on the other hand, the programmable network card can obtain the target data required by the target application from the to-be-processed packet and write the target data into the memory in a DMA manner, which can realize data on-demand replication based on application requirements, and helps to reduce the large memory data replication and the memory wall problem caused by data replication.
[0052] The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0053] It should be noted that the same reference numerals in the following drawings and embodiments represent the same objects, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in subsequent drawings and embodiments.
[0054] Figures 3-5 A structural schematic diagram of a computing device provided by an embodiment of the present application is shown in FIG. 1. As shown in FIG. 1, the computing device includes a processor 11 and a programmable network card 13. The processor 11 and the programmable network card 13 are communicatively connected. Optionally, the processor 11 and the programmable network card 13 can be communicatively connected through a data bus. The data bus can be a serial interface data bus, such as a PCIe serial interface, a USB serial interface, an RS485 interface, an RS232 interface, etc., but is not limited thereto. Figures 3-5
[0055] In the embodiment, the processor 11 can be a CPU. The CPU can be a stand-alone chip, or a CPU integrated in a System on Chip (SoC), or a CPU integrated in a Microcontroller Unit (MCU), etc.
[0056] The programmable network card 13 refers to a network card provided with a hardware processor 131. The hardware processor 131 refers to a hardware processor that processes data by using a hardware description language (HDL). The hardware description language can be a very-high-speed integrated circuit hardware description language (VHDL), a Verilog HDL, a System Verilog, a System C or the like. The hardware processor in the programmable network card 13 can be a field-programmable gate array (FPGA), a programmable array logic (PAL), a general array logic (GAL), a complex programmable logic device (CPLD) or the like; or the hardware processor in the programmable network card 13 can also be an application specific integrated circuit (ASIC).
[0057] The programmable network card 13 can be installed on a computing device. Alternatively, the programmable network card 13 can be provided with a bus interface and installed on the computing device through the bus interface. The bus interface can be a serial bus interface such as a PCIe serial interface, a USB serial interface, an RS485 interface or an RS232 interface, but is not limited thereto.
[0058] In this embodiment, an application runs on the processor 11. The application running on the processor 11 can be one or more. More refers to two or more. In this embodiment, the application needs to receive data through the programmable network card 13. The programmable network card 13 can receive the message sent to the application through the network interface 132 of the network card.
[0059] In the embodiment, the communication component in the network interface 132 is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G, 5G, or a combination thereof. In an example embodiment, the communication component receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an example embodiment, the communication component can also be implemented based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology, or other technologies.
[0060] In the embodiment, in order to improve the flexibility of protocol analysis hardware offloading, an application-based hardware offloading scheme is proposed. The processes of protocol analysis hardware offloading of each application running on the processor 11 are the same or similar. Taking a target application running on the processor 11 as an example, the application-based protocol analysis hardware offloading scheme is exemplarily described below.
[0061] As shown in Figure 3 , the message screening rule of the target application and the information requirement of the target application can be pre-configured for the target application. The message screening rule of the target application is used to screen the message sent to the target application, and whether the message received by the programmable network card 13 is the message sent to the target application can be determined through the message screening rule. The information requirement of the target application is used to specify the content output by the programmable network card 13 and the data format of the output content, and is used to instruct the programmable network card 13 to obtain the application data required by the target application from the received message and the data format of the output application data.
[0062] As shown in Figure 3 , based on the message screening rule and the information requirement of the target application, the processor 11 can configure the message screening rule of the target application in the programmable network card 13 in response to the start of the target application. The message screening rule can be used by the programmable network card 13 to screen the message sent to the target application, i.e., the to-be-processed message. Correspondingly, the processor 11 can also configure the information requirement of the target application in the programmable network card 13. The information requirement of the target application can be used by the programmable network card 13 to obtain the target data required by the target application from the to-be-processed message.
[0063] In the embodiments of the present application, the processor 11 can configure the message filtering rule of the target application and the information requirement of the target application in the programmable network card 13 by using a hardware programming language. The message filtering rule of the target application and the information requirement of the target application can be set in the hardware processor 131.
[0064] Since the message is sent to the application running in the processor 11, the target data extracted from the message by the programmable network card 13 needs to be written into the memory 14 of the computing device. In order to improve the memory writing speed, the programmable network card 13 can also be pre-configured with a target memory. Accordingly, as shown in Figure 3 the processor 11 can also configure the programmable network card 13 with a target memory in response to the start of the target application. The programmable network card can write the target data into the target memory in a direct memory access (DMA) manner.
[0065] In some embodiments, as shown in Figure 3 the programmable network card 13 further includes a cache unit 133. The cache unit 133 is configured to cache the message received by the network interface 132 of the programmable network card 13. Accordingly, the programmable network card 13 can cache the to-be-processed message to the cache unit 133; and read the to-be-processed message from the cache unit 133 for message processing.
[0066] Based on the pre-configured message filtering rule, the requirement information of the target application and the target memory, as shown in Figure 4 the programmable network card 13 can filter the to-be-processed message sent to the target application according to the pre-configured message filtering rule of the target application in the programmable network card 13. Specifically, the programmable network card 13 can determine whether the received to-be-processed message is the message sent to the target application according to the message filtering rule corresponding to the target application. The to-be-processed message can be any message received by the programmable network card 13, which can be the message read from the cache unit 133.
[0067] In some embodiments, the message filtering rule can include an offset address and expected data of the offset address. The offset address is used to indicate the position of the expected data in the to-be-processed message. The expected data refers to what the data of the offset address specified by the target application is.
[0068] Optionally, an Access Control Lists (ACL) rule can be configured to set the offset address and the expected data. For example, the offset address can be an offset address of one or more of the following information in the packet: destination MAC address, source MAC address, Ethernet protocol type, destination IP address, source IP address, VLAN information, transport layer protocol type, source port number, and destination port number; and the expected data can be the data specified by the offset address. For example, if the offset address is the destination IP address of the packet, the expected data can be the specified destination IP address.
[0069] Based on the pre-configured offset address X and the expected data of the offset address X, the programmable network card 13 can obtain the actual data recorded by the offset address X of the received to-be-processed packet from the received to-be-processed packet, and compare the actual data of the offset address X with the expected data of the offset address X to determine whether the received to-be-processed packet is the to-be-processed packet for the target application. If the actual data of the offset address X is consistent with the expected data of the offset address X, it is determined that the received to-be-processed packet is the to-be-processed packet for the target application.
[0070] The above only takes the target application as an example to exemplarily describe the implementation of the to-be-processed packet screening application. For an embodiment in which multiple applications are running in the processor 11 and each application is pre-configured with a corresponding packet screening rule in the programmable network card 13, the to-be-processed packet of each application can be screened according to the pre-configured packet screening rule of each application. For the to-be-processed packet that does not pass the packet screening rule of any application, the programmable network card 13 can send the to-be-processed packet to the processor 11, and the processor 11 can perform protocol stack analysis on the to-be-processed packet.
[0071] For the to-be-processed packet for the target application, the programmable network card 13 can obtain the target data required by the target application from the to-be-processed packet according to the information requirement of the target application pre-configured in the programmable network card 13.
[0072] In some embodiments, the processor 11 can configure the information requirement of the target application by configuring the starting offset address and the data length of the data required by the target application. Correspondingly, the information requirement of the target application can include the starting offset address Y of the data required by the target application and the set data length. That is, the information requirement of the target application is represented by the starting offset address Y and the set data length. Correspondingly, the programmable network card 13 can obtain the data of the set data length starting from the starting offset address Y from the to-be-processed packet as the target data required by the target application according to the starting offset address.
[0073] In this embodiment, on one hand, the programmable network card 13 can improve the packet processing speed through the hardware acceleration function; on the other hand, the programmable network card 13 can obtain the target data from the to-be-processed packet through the starting offset address and the set data length, can skip the complex protocol stack processing process, reduce the delay caused by the protocol stack processing, and further improve the packet processing speed.
[0074] In some other embodiments, the processor 11 can specify the register of the programmable network card 13 for the target field, and represent the information requirement of the target application for the target field by configuring the state of the register. For example, the processor 11 can assign the target register of the programmable network card 13 to the target field in response to the start of the target application, and configure the target register to the target state to represent the information requirement of the target application for the target field. The target register can be any register of the programmable network card 13. For example, the target field is the payload of the packet, the processor 11 can assign the target register of the programmable network card 13 to the target field of the target application, and configure the state of the target register to “1”, that is, the target state is “1”, the state of the target register is “1”, which represents that the information requirement of the target application is the payload of the packet.
[0075] Correspondingly, the information requirement of the target application includes the information requirement of the target application for the target field. The target state of the target register of the programmable network card 13 represents the information requirement of the target application for the target field. Based on this, the programmable network card 13 can query the state of the target register, and if the state of the target register is the target state, determine that the data required by the target application is the target field. Further, the programmable network card 13 can parse the to-be-processed packet to obtain a parsing result of the to-be-processed packet, and then obtain the data corresponding to the target field from the parsing result of the to-be-processed packet as the target data required by the target application. For example, the target field is the payload of the packet, and the programmable network card 13 can obtain the payload part of the to-be-processed packet from the parsing result of the to-be-processed packet as the target data required by the target application.
[0076] Compared with the protocol stack parsing by the processor in the traditional scheme, the protocol stack parsing of the to-be-processed packet by the programmable network card 13 in this embodiment can realize hardware acceleration and improve the packet processing efficiency.
[0077] In some other embodiments, the corresponding packet processing mode can also be pre-configured. Correspondingly, as shown in Figure 5 The processor 11 can pre-configure a calculation unit 134 in the programmable network card 13. The calculation unit 134 is configured as the packet processing mode corresponding to the target application. The calculation unit 134 can be implemented as a hardware calculation unit written in a hardware description language, and can be arranged in the hardware processor 131. Correspondingly, as shown inFigure 5 As shown, for the received to-be-processed packet, the computing unit 134 can process the to-be-processed packet according to the pre-configured packet processing mode corresponding to the target application, and the like.
[0078] In some embodiments, the packet processing mode corresponding to the target application can be implemented as integrity verification of the packet. Accordingly, the programmable network card 13 can utilize the computing unit 134 to perform integrity verification on the to-be-processed packet according to the set integrity verification mode, and the like.
[0079] For example, the integrity verification mode can be Check Sum. The Check Sum is a field existing in various packets, and the purpose of its existence is to verify the integrity of the packet during network transmission. The sending end of the packet will calculate a Check Sum according to the header or data in the packet. For example, the Check Sum of the IP packet is calculated only for the header, the Internet Control Message Protocol (ICMP) packet is calculated for the header and data, and the like.
[0080] Accordingly, the programmable network card 13 can utilize the computing unit 134 to perform a Check Sum calculation on the header or data of the to-be-processed packet. If the Check Sum calculated by the computing unit 134 of the programmable network card 13 is consistent with the Check Sum in the to-be-processed packet, it means that the to-be-processed packet passes the integrity verification. If the Check Sum calculated by the computing unit 134 of the programmable network card 13 is inconsistent with the Check Sum in the to-be-processed packet, it means that the to-be-processed packet fails the integrity verification, and the programmable network card 13 can discard the to-be-processed packet.
[0081] Further, for the to-be-processed packet that passes the new verification, the programmable network card 13 can obtain the target data required by the target application from the to-be-processed packet according to the information requirement of the target application pre-configured in the programmable network card 13.
[0082] The implementation manner of the programmable network card 13 shown in the above embodiments for screening the to-be-processed packet of the target application and obtaining the target data required by the target application from the to-be-processed packet sent to the target application is only exemplary and does not constitute a limitation.
[0083] Further, the programmable network card 13 can write the target data required by the target application into the target memory in a DMA manner. In some embodiments, the information requirement of the target application further includes a target data format supported by the target application. Accordingly, the programmable network card 13 can convert the target data into the target data format according to the target data format, to obtain target data having the target data format; and write the target data having the target data format into the target memory in a DMA manner, for the target application to read the target data having the target data format from the target memory.
[0084] For the processor 11, the target data can be read from the target memory, and the target data can be processed according to the requirement of the target application. For the target data having the target data format, the processor 11 can read the target data having the target data format from the target memory; and process the target data having the target data format according to the requirement of the target application.
[0085] The specific implementation of the processor 11 processing the target data is mainly determined by the requirement of the target application. In some embodiments, the requirement of the target application is to render the target data, and the processor 11 can render the target data to display the target data, etc. In other embodiments, the requirement of the target application is to verify the target data, and the processor 11 can verify the target data according to a set verification manner, etc., which is not limited herein.
[0086] In the embodiments of the present application, in order to facilitate the management of the data stored in the target memory, as shown in Figure 4 and Figure 5 , a head pointer (Head) pointer and a tail (Tail) pointer can be set for the data stored in the target memory. The writing and reading of the target memory can be performed in a first input first output (FIFO) manner. Specifically, the programmable network card 13 can update the tail pointer when writing the target data into the target memory. For example, the programmable network card 13 can update the tail pointer to the storage position of the target data when writing the target data into the target memory. The processor 11 can also update the head pointer when reading the data from the target memory. That is, the processor 11 can update the head pointer to the next position of the read data when reading the data from the target memory. In this embodiment, when the head pointer and the tail pointer are equal, it indicates that there is no data in the target memory. Figure 4 and Figure 5 , the data entry represents the data stored in the target memory. Each data entry can occupy one or more memory pages.
[0087] In the embodiment, the message filtering rule and the information requirement of the target application can be preconfigured in the programmable network card. Correspondingly, the to-be-processed message sent to the target application can be filtered according to the preconfigured message filtering rule of the target application, and the target data required by the target application can be obtained from the to-be-processed message according to the preconfigured information requirement of the target application. Then, the target data is written into the memory in a DMA manner. The target application can obtain the target data from the memory and process the target data. On the one hand, the application can flexibly configure the hardware offload function according to the requirement, which helps to improve the flexibility of the hardware offload. On the other hand, the target data required by the target application is obtained from the to-be-processed message by the programmable network card, and the target data is written into the memory in a DMA manner, which can realize data on-demand replication based on the requirement of the application, and helps to reduce the large memory data replication and the memory wall problem caused by the data replication. The memory wall refers to the phenomenon that the memory performance seriously limits the CPU performance.
[0088] In the embodiment, in addition to preconfiguring the message filtering rule of the application and the information requirement of the application, the message filtering rule of the application and the information requirement of the application can also be deleted. Specifically, the processor 11 can delete the message filtering rule of the target application and the information requirement of the target application configured in the programmable network card 13 and release the target memory and the like in response to the end operation of the target application. For the target application preconfigured with the computing unit, the preconfigured computing unit of the target application can also be deleted.
[0089] In order to more clearly illustrate the protocol analysis hardware offload process provided by the embodiment, the application of a simple file transfer protocol (TFTP) is taken as an example, and the protocol analysis hardware offload process provided by the embodiment is described in combination with the application of the TFTP. Figure 6 The message receiving process provided by the embodiment is exemplarily described.
[0090] As Figure 6As shown, the TFTP application client 61 and the TFTP application server 62 each comprises a processor 11 and a programmable network card 13. The programmable network card 13 of the server 62 is preconfigured with a TFTP application packet filtering rule. The TFTP application packet filtering rule comprises a transport layer protocol of UDP packet and a destination port number of 69 of the UDP packet. The type of the transport layer protocol can be represented by an offset address X and an expected data 17 of the offset address X. Since the protocol number of the UDP packet is 17, the expected data of the offset address X is 17. Accordingly, the destination port number of the UDP packet can be represented by an offset address Y and an expected data 69 of the offset address Y. Accordingly, the preconfigured TFTP application packet filtering rule of the programmable network card 13 of the server 62 comprises the offset address X and the expected data 17 of the offset address X, and the offset address Y and the expected data 69 of the offset address Y.
[0091] The programmable network card 13 of the server 62 is also preconfigured with a TFTP application information requirement. The TFTP application information requirement comprises a payload of a packet. As shown, Figure 6 the payload of the packet can be represented by an offset address Z and a set data length L1.
[0092] As shown, Figure 6 For the server 62, the programmable network card 13 can receive the to-be-processed packet 1 sent by the client 61. The programmable network card 13 can acquire the actual data of the offset address X and the actual data of the offset address Y from the to-be-processed packet 1 according to the offset addresses X and Y in the packet filtering rule. Further, the programmable network card 13 can determine whether the actual data of the offset address X is consistent with the expected data 17 of the offset address X, and whether the actual data of the offset address Y is consistent with the expected data 69 of the offset address Y. If the determination result is that the actual data of the offset address X is consistent with the expected data 17 of the offset address X, and the actual data of the offset address Y is consistent with the expected data 69 of the offset address Y, the programmable network card 13 of the server 62 can acquire target data from the to-be-processed packet 1 according to the preconfigured TFTP application information requirement. Specifically, the programmable network card 13 of the server 62 can acquire data of the data length L1 starting from the offset address Z of the to-be-processed packet, i.e. Figure 6 target data 1 in the packet 1. Further, the programmable network card 13 can write the target data 1 into the target memory corresponding to the programmable network card 13 of the server 62 in a DMA manner. The processor 11 of the server 62 can read the target data 1 from the target memory and process the target data 1 according to the requirement of the TFTP application.
[0093] Accordingly, for client 61, the programmable network interface card 13 of client 61 is pre-configured with packet filtering rules for the TFTP application. The packet filtering rules for the TFTP application include: the transport layer protocol is UDP packets, and the destination port number of the UDP packets is M. M is the protocol port number used by the application. The type of transport layer protocol can be represented by offset address X and expected data 17 of offset address X. Correspondingly, the destination port number of the UDP packets can be represented by offset address P and expected data M of offset address P. Accordingly, the pre-configured packet filtering rules in the programmable network interface card 13 of client 61 include: offset address X and expected data 17 of offset address X, and offset address P and expected data M of offset address P.
[0094] The programmable network interface card 13 of client 61 is also pre-configured with information requirements for the TFTP application. These information requirements include: the message payload. For example, Figure 6 As shown, the payload of the message can be represented by the offset address Q and the set data length L2.
[0095] like Figure 6 As shown, for client 61, programmable network interface card 13 can receive the pending message 2 sent by server 62. Programmable network interface card 13 can obtain the actual data at offset address X and the actual data at offset address P from the pending message 2 according to the offset addresses X and P in the message filtering rules. Further, programmable network interface card 13 can determine whether the actual data at offset address X is consistent with the expected data 17 at offset address X; and determine whether the actual data at offset address P is consistent with the expected data M at offset address P. If the determination result is that the actual data at offset address X is consistent with the expected data 17 at offset address X, and the actual data at offset address P is consistent with the expected data M at offset address P, then the programmable network interface card 13 of client 61 can obtain data of length L2 starting from offset address Q of the pending message according to offset address Q and the set data length L2, i.e. Figure 6 Target data 2. Furthermore, the programmable network interface card 13 can write target data 2 into the target memory corresponding to the programmable network interface card 13 in the client 61 via DMA. The processor 11 of the client 61 can then read target data 2 from the target memory and process target data 2 according to the requirements of the TFTP application.
[0096] The processor 11 of the aforementioned server 62 and client 61 can directly obtain the payload data of the message without processing the Ethernet link layer protocol, network layer protocol and transport layer protocol, and the message data read is all valid data, which can reduce the amount of memory data copying and reduce the memory wall problem.
[0097] In addition to the computing device provided in the above embodiments, the embodiments of the present application also provide a packet receiving method and an information configuration method. The information configuration method and the packet receiving method provided in the embodiments of the present application are described below.
[0098] Figure 7 A flowchart of the information configuration method provided in the embodiments of the present application is shown in FIG. 6. As shown in FIG. 6, the information configuration method mainly includes the following steps. Figure 7
[0099] 701. In response to the start of a target application running in a processor, configuring a packet filtering rule of the target application in a programmable network card of a computing device, so that the programmable network card filters a to-be-processed packet sent to the target application.
[0100] 702. Configuring information requirements of the target application in the programmable network card, so that the programmable network card acquires target data required by the target application from the to-be-processed packet.
[0101] 703. Configuring a target memory for the programmable network card, so that the programmable network card writes the target data into the target memory.
[0102] Figure 8 A flowchart of the packet receiving method provided in the embodiments of the present application is shown in FIG. 7. As shown in FIG. 7, the packet receiving method mainly includes the following steps. Figure 8
[0103] 801. Receiving a to-be-processed packet.
[0104] 802. Filtering the to-be-processed packet sent to a target application according to a packet filtering rule corresponding to the target application and pre-configured in a programmable network card of a computing device; the target application runs in a processor of the computing device.
[0105] 803. For the to-be-processed packet sent to the target application, acquiring target data required by the target application from the to-be-processed packet according to information requirements of the target application and pre-configured in the programmable network card.
[0106] 804. Writing the target data into a target memory corresponding to the programmable network card in a DMA mode, so that the target application reads the target data from the target memory.
[0107] For the processor and the programmable network card in the embodiments of the present application, refer to the related content of the device embodiments described above, and the same or similar process of hardware offloading of protocol analysis of each application running on the processor is described below. Take the target application running on the processor as an example to exemplarily describe the application-based protocol analysis hardware offloading scheme.
[0108] Specifically, message filtering rules and information requirements of the target application can be pre-configured. For a description of the message filtering rules and information requirements of the target application, please refer to the relevant content in the above device embodiments, which will not be repeated here.
[0109] Based on the aforementioned message filtering rules and the information requirements of the target application, in step 701, in response to the startup of the target application, message filtering rules for the target application can be configured in the programmable network interface card (NIC). These message filtering rules allow the programmable NIC to filter messages sent to the target application, i.e., messages awaiting processing. Correspondingly, in step 702, the information requirements of the target application can also be configured in the programmable NIC. These information requirements allow the programmable NIC to obtain the target data required by the target application from the messages awaiting processing.
[0110] In this embodiment, the packet filtering rules and information requirements of the target application can be configured in the programmable network interface card using a hardware programming language. The packet filtering rules and information requirements of the target application can be set in the hardware processor.
[0111] Since the message is sent to an application running on the processor, the target data extracted from the message needs to be written into the memory of the computing device. To improve memory write speed, memory can also be pre-configured for the programmable network card in step 703. Accordingly, target memory can also be configured for the programmable network card in response to the startup of the target application. The programmable network card can write the target data into the target memory using DMA.
[0112] Based on the pre-configured message filtering rules, the target application's requirements, and the target memory, such as Figure 8 As shown, in step 801, a message to be processed can be received; and in step 802, the message to be processed to be sent to the target application can be filtered according to the message filtering rules corresponding to the target application pre-configured in the programmable network card. Specifically, it can be determined whether the received message to be processed is a message to be sent to the target application according to the message filtering rules corresponding to the target application. The message to be processed can be any message received by the programmable network card, and the message to be processed can be a message read from the buffer unit.
[0113] In some embodiments, message filtering rules may include an offset address and expected data at that offset address. The offset address indicates the position of the expected data within the message to be processed. The expected data refers to the data specified by the target application at that offset address.
[0114] Based on the pre-configured offset address X and the expected data of the offset address X, actual data recorded by the offset address X of the received pending message is obtained from the received pending message, and whether the actual data of the offset address X and the expected data of the offset address X are consistent is compared to determine whether the received pending message is the pending message for the target application. If the actual data of the offset address X and the expected data of the offset address X are consistent, it is determined that the received pending message is the pending message sent to the target application.
[0115] The above only takes the target application as an example to exemplarily describe the implementation of the pending message of the screening application. For the embodiment in which multiple applications run in the processor and each application is pre-configured with a corresponding message screening rule in the programmable network card, the pending message of each application can be screened according to the pre-configured message screening rule of each application. For the pending message that does not pass the message screening rule of any application, the pending message can be sent to the processor, and the processor can perform protocol stack analysis and the like on the pending message.
[0116] For the pending message sent to the target application, in step 803, the target data required by the target application can be obtained from the pending message according to the information requirement of the target application pre-configured in the programmable network card.
[0117] In some embodiments, the information requirement of the target application can be configured by configuring the starting offset address and the data length of the data required by the target application. Accordingly, the information requirement of the target application can include the starting offset address Y of the data required by the target application and the set data length. That is, the information requirement of the target application is represented by the starting offset address Y and the set data length. Accordingly, the data of the set data length can be obtained from the starting offset address Y in the pending message as the target data required by the target application according to the starting offset address.
[0118] In this embodiment, on the one hand, the programmable network card can improve the message processing speed through the hardware acceleration function; on the other hand, the programmable network card can obtain the target data from the pending message through the starting offset address and the set data length, can skip the complex protocol stack processing process, and reduce the delay caused by the protocol stack processing, thereby further improving the message processing speed.
[0119] In other embodiments, the register of the programmable network card can be specified for the target field, and the information requirement of the target application for the target field can be represented by configuring the state of the register. For example, in response to the start of the target application, the target register of the programmable network card can be allocated to the target field, and the target register can be configured to the target state to represent the information requirement of the target application for the target field.
[0120] Correspondingly, the information requirement of the target application includes: an information requirement of the target application on the target field. The target state of the target register of the programmable network card represents the information requirement of the target application on the target field. Based on this, the state of the target register can be queried; if the state of the target register is the target state, it is determined that the data required by the target application is the target field. Further, the programmable network card can parse the to-be-processed packet to obtain a parsing result of the to-be-processed packet; and then, the data corresponding to the target field can be obtained from the parsing result of the to-be-processed packet as the target data required by the target application.
[0121] Compared with the protocol stack parsing by the processor in the traditional scheme, the protocol stack parsing of the to-be-processed packet by the programmable network card in this embodiment can realize hardware acceleration and improve the packet processing efficiency.
[0122] In other embodiments, the corresponding packet processing mode can also be preconfigured. Correspondingly, a calculation unit can be preconfigured in the programmable network card. The calculation unit is configured as the packet processing mode corresponding to the target application. The calculation unit can be implemented as a hardware calculation unit written in a hardware description language and can be arranged in a hardware processor. Correspondingly, for the received to-be-processed packet, the to-be-processed packet can be processed according to the preconfigured packet processing mode corresponding to the target application, and the like.
[0123] In some embodiments, the packet processing mode corresponding to the target application can be implemented as integrity verification of the packet. Correspondingly, the calculation unit can be used to perform integrity verification on the to-be-processed packet according to the set integrity verification mode, and the like.
[0124] Further, for the to-be-processed packet that passes the new verification, the target data required by the target application can be obtained from the to-be-processed packet according to the preconfigured information requirement of the target application in the programmable network card.
[0125] The implementation manners of the programmable network card shown in the above embodiments for screening the to-be-processed packet of the target application and obtaining the target data required by the target application from the to-be-processed packet sent to the target application are only exemplary descriptions and do not constitute a limitation.
[0126] Further, in step 804, the target data required by the target application can be written into the target memory in a DMA manner. In some embodiments, the information requirement of the target application further includes: a target data format supported by the target application. Correspondingly, the target data can be converted into the target data format according to the target data format to obtain the target data with the target data format; and the target data with the target data format is written into the target memory in a DMA manner, so that the target application reads the target data with the target data format from the target memory.
[0127] For the processor, target data can be read from the target memory, and the target data can be processed according to the requirements of the target application. For target data with a target data format, target data with the target data format can be read from the target memory; and the target data with the target data format can be processed according to the requirements of the target application.
[0128] The specific implementation of processing the target data is mainly determined by the requirements of the target application. In some embodiments, the requirement of the target application is to render the target data, and the target data can be rendered to display the target data, etc. In other embodiments, the requirement of the target application is to verify the target data, and the target data can be verified according to a set verification manner, etc., which is not limited herein.
[0129] In this embodiment, the packet filtering rule and the information requirement of the target application can be pre-configured in the programmable network card. Accordingly, the to-be-processed packet sent to the target application can be filtered according to the pre-configured packet filtering rule of the target application; and the target data required by the target application can be obtained from the to-be-processed packet according to the pre-configured information requirement of the target application; then the target data is written into the memory in the DMA mode; and the target application can obtain the target data from the memory and process it. On the one hand, the application can flexibly configure the hardware offload function according to the requirements, which helps to improve the flexibility of hardware offload; on the other hand, the programmable network card obtains the target data required by the target application from the to-be-processed packet, and writes the target data into the memory in the DMA mode, which can realize data on-demand replication based on the requirements of the application, and helps to reduce the large memory data replication and the memory wall problem caused by data replication. The memory wall refers to the phenomenon that the memory performance seriously limits the performance of the CPU.
[0130] In the embodiments of the present application, in addition to pre-configuring the packet filtering rule of the application and the information requirement of the application, the packet filtering rule of the application and the information requirement of the application can also be deleted. Specifically, in response to the end operation of the target application, the packet filtering rule of the target application and the information requirement of the target application configured in the programmable network card can be deleted, and the target memory can be released, etc. For the target application pre-configured with a computing unit, the pre-configured computing unit of the target application can also be deleted.
[0131] In order to more clearly illustrate the protocol analysis hardware offload process provided by the present embodiment, the packet receiving method provided by the present embodiment is exemplarily described below taking the TFTP application as an example.
[0132] Figure 9 The flowchart of another packet receiving method provided by the present embodiment. The packet receiving method can be applied to the server of the TFTP application, and can also be applied to the client of the TFTP application. As shown in Figure 9As shown, the message receiving method mainly includes:
[0133] 901, receiving a to-be-processed message.
[0134] The to-be-processed message is a message received by a programmable network card of a computing device; the programmable network card is pre-configured with a message screening rule of a simple file transfer protocol (TFTP) application; the message screening rule includes a transport layer protocol type and a destination port number.
[0135] For a server of the TFTP application, the transport layer protocol type can be a UDP message, and the destination port number can be 69. For a client of the TFTP application, the transport layer protocol type can be a UDP message, and the destination port number can be M. M is a protocol port number used by the application.
[0136] 902, screening the to-be-processed message sent to the TFTP application according to the transport layer protocol type and the destination port number; the TFTP application runs on a processor of the computing device.
[0137] 903, for the to-be-processed message sent to the TFTP application, according to the information requirement of the TFTP application pre-configured in the programmable network card, obtaining target data required by the TFTP application from the to-be-processed message.
[0138] 904, writing the target data into a target memory corresponding to the programmable network card in a DMA manner, so that the TFTP application reads the target data from the target memory.
[0139] For specific implementation of steps 901-904, please refer to the related content of the above Figure 6 , which will not be repeated here. The message receiving method provided in this embodiment can pre-configure the message screening rule and the information requirement of the TFTP application in the programmable network card. Accordingly, the to-be-processed message sent to the TFTP application can be screened according to the pre-configured message screening rule of the TFTP application; and the target data required by the TFTP application can be obtained from the to-be-processed message according to the pre-configured information requirement of the target application; then, the target data is written into the memory in a DMA manner; the TFTP application can obtain the target data from the memory and process it, which can realize flexible configuration of hardware offloading function according to the requirement of the TFTP application, and helps to improve the flexibility of hardware offloading.
[0140] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can also be executed by different devices as the execution subject. For example, the execution subjects of steps 701 and 702 can be device A; for another example, the execution subject of step 701 can be device A, and the execution subject of step 702 can be device B; and so on.
[0141] In addition, in some of the processes described in the above embodiments and the accompanying drawings, a plurality of operations are included in a specific order, but it should be clear that the operations can be executed in the order in which they appear in this document or in parallel, and the serial numbers of the operations such as 701, 702, etc. are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes can include more or fewer operations, and the operations can be executed in sequence or in parallel.
[0142] Accordingly, the embodiments of the present application also provide a computer readable storage medium storing computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the above packet receiving method and / or information configuration method.
[0143] Figure 10 The structure schematic diagram of the programmable network card provided by the embodiments of the present application is shown in FIG. 1. As shown in the figure, the programmable network card can be installed on a computing device. The programmable network card is installed on the computing device in the form of a bus interface. The bus interface can be a PCIe interface, a PCI interface, a USB interface, an RS485 interface, or an RS232 interface, etc. When the programmable network card is installed on the computing device, the memory of the computing device includes the target memory corresponding to the programmable network card. The target memory is the memory pre-configured for the programmable network card. Figure 10
[0144] As shown in FIG. 2, the computing device can include a communication module 100a, a screening module 100b, an information acquisition module 100c, and a writing module 100d. The communication module 100a, the screening module 100b, the information acquisition module 100c, and the writing module 100d are electrically connected. In this embodiment, the communication module 100a, the screening module 100b, the information acquisition module 100c, and the writing module 100d refer to hardware function modules written in a hardware programming language supported by the programmable network card. Figure 10 In this embodiment, the communication module 100a is configured to receive a to-be-processed packet.
[0145] The screening module 100b is configured to screen the to-be-processed packet sent to the target application according to a packet screening rule corresponding to the target application pre-configured in the programmable network card; and the target application runs on a processor of the computing device.
[0146] The information acquisition module 100c is configured to, for the to-be-processed packet sent to the target application, acquire target data required by the target application from the to-be-processed packet according to an information requirement of the target application pre-configured in the programmable network card.
[0147]
[0148] The writing module 100d is configured to write the target data into the target memory in a DMA manner, so that the processor reads the target data from the target memory and processes the target data according to a requirement of the target application.
[0149] In some embodiments, the message screening rule includes a first offset address and expected data of the first offset address. Accordingly, the screening module 100b is configured to, when screening the to-be-processed message sent to the target application, acquire actual data recorded by the first offset address from the to-be-processed message according to the first offset address, and determine that the to-be-processed message is the to-be-processed message sent to the target application if the actual data recorded by the first offset address is consistent with the expected data of the first offset address.
[0150] Optionally, the information requirement of the target application includes a start offset address of the data required by the target application and a set data length. Accordingly, the information acquisition module 100c is configured to, when acquiring the target data required by the target application from the to-be-processed message, acquire data with the set data length from the to-be-processed message starting from the start offset address as the target data according to the start offset address.
[0151] Optionally, the information requirement of the target application includes an information requirement of the target field of the target application, and a target state of a target register of the programmable network card represents the information requirement of the target field of the target application. Accordingly, the information acquisition module 100c is configured to, when acquiring the target data required by the target application from the to-be-processed message, query the state of the target register, determine that the data required by the target application is the target field if the state of the target register is the target state, parse the to-be-processed message to obtain a parsing result of the to-be-processed message, and acquire data corresponding to the target field from the parsing result of the to-be-processed message as the target data.
[0152] In other embodiments, the information requirement of the target application includes a target data format supported by the target application. The information acquisition module 100c is further configured to convert the target data into the target data format according to the target data format to obtain target data with the target data format.
[0153] Accordingly, the writing module 100d is configured to, when writing the target data into the target memory corresponding to the programmable network card in a DMA manner, write the target data with the target data format into the target memory in a DMA manner, so that the target application reads the target data with the target data format from the target memory.
[0154] In some embodiments, the programmable network card further comprises a processing module 100d. The processing module 100d is electrically connected with the information acquisition module 100c. The processing module 100d is configured to process the to-be-processed packet according to the packet processing mode corresponding to the target application pre-configured in the programmable network card, and provide the processed to-be-processed packet to the information acquisition module 100c.
[0155] The programmable network card provided in the embodiment can filter the to-be-processed packet sent to the target application according to the packet filtering rule of the target application pre-configured, and can acquire the target data required by the target application from the to-be-processed packet according to the information requirement of the target application pre-configured. Then, the target data is written into the memory in a DMA mode. The target application can acquire the target data from the memory and process the target data, so that the application can flexibly configure the hardware offloading function according to the requirement, and the flexibility of the hardware offloading can be improved. It should be noted that the "first", "second", and the like in the present disclosure are used to distinguish different messages, devices, modules, and the like, and do not represent the order of sequence, nor limit the "first" and "second" to be different types.
[0156] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer usable storage media containing computer usable program code (including but not limited to disk storage, CD-ROM, optical storage, etc.).
[0157] The present application is described with reference to flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device implemented in the flowcharts and / or block diagrams. Figure 1 The device for implementing the functions specified in one flow or multiple flows and / or blocks. Figure 1 The device for implementing the functions specified in one flow or multiple flows and / or blocks.
[0158] These computer program instructions can also be stored in a computer readable storage medium capable of guiding the computer or other programmable data processing devices to work in a specific manner, so that the instructions stored in the computer readable storage medium produce a manufactured product including instruction devices, which implement the flowcharts and / or block diagrams. Figure 1 The device for implementing the functions specified in one flow or multiple flows and / or blocks.Figure 1 the function(s) specified in the block or blocks.
[0159] These computer program instructions can also be loaded into computer or other programmable data processing devices to cause a series of operational steps to be performed on the computer or other programmable devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable devices provide steps for implementing the flowchart block(s) or flowchart flow(s) and / or portions thereof. Figure 1 the flowchart block(s) or flowchart flow(s) and / or portions thereof. Figure 1 the function(s) specified in the block or blocks.
[0160] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0161] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, and / or non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory. The memory is an example of computer readable media.
[0162] The computer readable media can also be, comprises, and / or be non-transitory. The computer readable media can also be, comprises, and / or be non-transitory computer- readable media. In this context, non-transitory can also mean not entirely transitory. The computer readable media can also be, comprises, and / or be non-transitory. The computer readable media can also be, comprises, and / or be non-transitory computer- readable media. In this context, non-transitory can also mean not entirely transitory.
[0163] It is further noted that the terms "comprises" and / or "comprising", or "includes" and / or "including" when used in this specification, specify the presence of stated features, integers, steps, operations, elements, or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, or groups thereof.
[0164] The above merely provides example of the present application, but not for limiting the present application. For those skilled in the art, the present application can have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application, should be included in the scope of claims of the present application.
Claims
1. A computing device, comprising: The application comprises: a processor, a memory and a programmable network card; the processor, the memory and the programmable network card are connected through a data bus; a target application runs on the processor; the memory comprises a target memory corresponding to the programmable network card; the programmable network card is used to receive a to-be-processed packet; according to a packet screening rule corresponding to the target application pre-configured in the programmable network card, the to-be-processed packet sent to the target application is screened; for the to-be-processed packet sent to the target application, according to the information requirement of the target application pre-configured in the programmable network card, target data required by the target application is acquired from the to-be-processed packet; and the target data is written into the target memory in a direct memory access (DMA) mode; the processor is used to read the target data from the target memory; and the target data is processed according to the requirement of the target application; wherein the packet screening rule comprises a first offset address and expected data of the first offset address; when screening the to-be-processed packet sent to the target application, the programmable network card is used to acquire actual data recorded by the first offset address from the to-be-processed packet according to the first offset address; if the actual data recorded by the first offset address is consistent with the expected data of the first offset address, it is determined that the to-be-processed packet is the to-be-processed packet sent to the target application.
2. The apparatus of claim 1, wherein, The processor is further used to: in response to the start of the target application, the packet screening rule and the information requirement of the target application are configured in the programmable network card; and the target memory is configured for the programmable network card.
3. A packet receiving method characterized by comprising: The method comprises: receiving a to-be-processed packet; screening the to-be-processed packet sent to a target application according to a packet screening rule corresponding to the target application pre-configured in a programmable network card of a computing device; the target application runs on a processor of the computing device; for the to-be-processed packet sent to the target application, acquiring target data required by the target application from the to-be-processed packet according to an information requirement of the target application pre-configured in the programmable network card; writing the target data into a target memory corresponding to the programmable network card in a direct memory access (DMA) mode, so that the target application reads the target data from the target memory; wherein the packet screening rule comprises a first offset address and expected data of the first offset address; screening the to-be-processed packet sent to the target application according to a packet screening rule corresponding to the target application pre-configured in a programmable network card of a computing device, comprises: acquiring actual data recorded by the first offset address from the to-be-processed packet according to the first offset address; if the actual data recorded by the first offset address is consistent with the expected data of the first offset address, it is determined that the to-be-processed packet is the to-be-processed packet sent to the target application.
4. The method of claim 3, wherein, the information requirement of the target application comprises a starting offset address of the data required by the target application and a set data length; The target data required by the target application is obtained from the to-be-processed packet according to the information requirement of the target application pre-configured in the programmable network card, and the target data includes: Data of the set data length is obtained from the to-be-processed packet starting from the starting offset address as the target data according to the starting offset address.
5. The method of claim 3, wherein, The information requirement of the target application includes: information requirement of the target field by the target application; and a target state of a target register of the programmable network card representing the information requirement of the target field by the target application; The target data required by the target application is obtained from the to-be-processed packet according to the information requirement of the target application pre-configured in the programmable network card, and the target data includes: The state of the target register is queried; If the state of the target register is the target state, it is determined that the data required by the target application is the target field; The to-be-processed packet is parsed to obtain a parsing result of the to-be-processed packet; Data corresponding to the target field is obtained from the parsing result of the to-be-processed packet as the target data.
6. The method of claim 5, wherein, Further comprising: In response to the start of the target application, the target register is allocated to the target field; The target register is configured as a target state to represent the information requirement of the target field by the target application.
7. The method of claim 3, wherein, The information requirement of the target application includes: a target data format supported by the target application; and the method further includes: The target data is converted into the target data format according to the target data format to obtain target data with the target data format; The target data is written into the target memory corresponding to the programmable network card in a direct memory access (DMA) mode, so that the target application reads the target data from the target memory, and the writing includes: The target data with the target data format is written into the target memory in a DMA mode, so that the target application reads the target data with the target data format from the target memory.
8. The method of claim 3, wherein, Further comprising: The to-be-processed packet is processed according to a packet processing mode corresponding to the target application pre-configured in the programmable network card.
9. The method according to any one of claims 3-8, characterized in that, Further comprising: In response to the start of the target application, the packet filtering rule and the information requirement of the target application are configured in the programmable network card; And the target memory is configured for the programmable network card.
10. The method of claim 9, wherein, Further comprising: In response to the end operation of the target application, the packet filtering rule and the information requirement of the target application configured in the programmable network card are deleted; And the target memory is released.
11. A method of receiving a packet, the method comprising: Including: A to-be-processed packet is received; The to-be-processed packet is a packet received by a programmable network card of a computing device; The programmable network card is pre-configured with a packet filtering rule of a simple file transfer protocol (TFTP) application; The packet filtering rule includes: a transport layer protocol type and a destination port number; the type of the transport layer protocol is represented by a first offset address and expected data of the first offset address; and the destination port number is represented by a second offset address and expected data of the second offset address; According to the transmission layer protocol type and the destination port number, the to-be-processed message sent to the TFTP application is screened; the TFTP application runs on a processor of the computing device, and includes: according to the first offset address and the second offset address, actual data of the first offset address and actual data of the second offset address are respectively acquired from the to-be-processed message; it is judged whether the actual data of the first offset address is consistent with expected data of the first offset address; and it is judged whether the actual data of the second offset address is consistent with expected data of the second offset address; if the judgment result is that the actual data of the first offset address is consistent with the expected data of the first offset address, and the actual data of the second offset address is consistent with the expected data of the second offset address, it is determined that the to-be-processed message is the to-be-processed message sent to the TFTP application; According to the information requirement of the TFTP application pre-configured in the programmable network card, target data required by the TFTP application is acquired from the to-be-processed message; The target data is written into the target memory corresponding to the programmable network card in a direct memory access (DMA) mode, so that the TFTP application reads the target data from the target memory.
12. A programmable network card, comprising: The programmable network card is used to be installed in a computing device; when the programmable network card is installed in the computing device, a memory of the computing device includes a target memory corresponding to the programmable network card; The programmable network card includes a communication module, a screening module, an information acquisition module, and a writing module; the communication module, the screening module, the information acquisition module, and the writing module are electrically connected; The communication module is used to receive a to-be-processed message; The screening module is used to screen the to-be-processed message sent to the target application according to a message screening rule corresponding to the target application pre-configured in the programmable network card; the target application runs on a processor of the computing device; the message screening rule includes a first offset address and expected data of the first offset address; The information acquisition module is used to acquire target data required by the target application from the to-be-processed message according to an information requirement of the target application pre-configured in the programmable network card, for the to-be-processed message sent to the target application; The writing module is used to write the target data into the target memory in a direct memory access (DMA) mode, so that the processor reads the target data from the target memory and processes the target data according to the requirement of the target application; In the screening of the to-be-processed message sent to the target application, the screening module is specifically used to acquire actual data recorded by the first offset address from the to-be-processed message according to the first offset address; if the actual data recorded by the first offset address is consistent with the expected data of the first offset address, it is determined that the to-be-processed message is the to-be-processed message sent to the target application.
13. A computer readable storage medium having stored thereon computer instructions, wherein: When the computer instructions are executed by one or more processors, cause the one or more processors to perform steps of the method of any of claims 3-11.
Citation Information
Patent Citations
Message analysis method, device and equipment and computer readable storage medium
CN110381054A
Data processing method, programmable network card equipment, physical server and storage medium
CN113821310A
Message analysis method based on network card and related device
CN114363256A