A data packet processing method and related apparatus
By acquiring and parsing the target descriptor and performing format conversion, the problem of poor compatibility of offloading devices was solved, enabling effective offloading of interface packets for different types of devices and expanding the scope of application.
Patent Information
- Application Number
- CN202310606772.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-25
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-05-25
AI Technical Summary
The existing offloading equipment cannot handle the message formats corresponding to different types of device interfaces, resulting in poor compatibility.
By acquiring the target descriptor and descriptor format, parsing the target description information, acquiring and offloading target packets of different formats, and passing the descriptor between the offloading device and the network device to achieve compatibility, a format conversion device is used as a proxy intermediate device for the offloading device to perform format conversion.
It improves the compatibility of the offloading device with different types of device interfaces, expands its applicability, and enables effective offloading of various network device interface message formats.
Smart Images

Figure CN116567076B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of message communication and message offloading, in particular to a data message processing method and related device. BACKGROUND
[0002] Offloading refers to separately setting other offloading devices to process non-service content in data packets (also referred to as messages) in order to reduce the load of the CPU of a server on the data packets. The non-service content specifically includes, for example, the load of performing network address port translation (NAPT) on the data packets, the performance load of performing quality of service (QoS) processing on the data packets, and the like.
[0003] Currently, offloading of data messages is mostly accelerated by a hardware manner of an offloading device. The device interface (for example, a network device interface) supported by the offloading device is mostly single and fixed, for example, only supports an optical Ethernet interface or a specific universal serial bus (USB) interface. Since the message formats corresponding to different types of device interfaces and the network device interface connected to the offloading device are usually single and fixed, once the hardware development engineer completes the development of the network device interface supported by the offloading device, it is difficult to change the message format corresponding to the network device interface connected to the interface. That is, the current offloading device cannot process the message formats corresponding to different types of device interfaces, and therefore the compatibility of the offloading device for offloading messages is poor. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a data message processing method and related device for improving the problem of poor compatibility of offloading devices for offloading messages.
[0005] In a first aspect, the embodiments of the present application provide a data message processing method applied to an offloading device, including: obtaining a target descriptor and a descriptor format, and parsing target description information in the target descriptor according to the descriptor format; obtaining a target message corresponding to the target description information, and performing offloading processing on the target message to obtain an offloaded message. In the implementation process of the above scheme, the message format corresponding to different types of device interfaces is described by using the descriptor format, and the target message of different formats is obtained by using the message description information parsed from the data descriptor by using the descriptor format, so that the offloading device can perform offloading processing on the target message of different formats, thereby effectively improving the compatibility of the offloading device.
[0006] In an optional implementation of the first aspect, the data packet processing method further includes: obtaining a response packet corresponding to the offloaded packet, and performing loading processing on the response packet to obtain a loaded packet; and generating a descriptor corresponding to the loaded packet according to the descriptor format of the original descriptor, the descriptor being used to obtain the loaded packet. In the implementation process of the foregoing solution, the descriptor corresponding to the loaded packet is generated according to the descriptor format of the original descriptor to obtain the loaded packet, thereby implementing the loading operation of the packet, that is, implementing the reverse operation function of offloading, and effectively improving the compatibility of the offloading device.
[0007] In an optional implementation of the first aspect, the obtaining of the target descriptor and the descriptor format of the target descriptor includes: receiving the target descriptor through a port bound by the offloading device and the network device; obtaining a port attribute of the port, and determining a register group identifier according to the port attribute; and reading out the descriptor format from a plurality of register groups of the offloading device according to the register group identifier, each register group of the plurality of register groups storing a corresponding descriptor format. In the implementation process of the foregoing solution, the descriptor format is read out from the plurality of register groups of the offloading device according to the register group identifier determined according to the port attribute, so that the offloading device can obtain the target packet according to the target description information parsed out according to the descriptor format, thereby effectively improving the compatibility of the offloading device with different network devices.
[0008] In an optional implementation of the first aspect, the data packet processing method further includes: performing loading processing on the to-be-processed packet to obtain a loaded packet; storing the loaded packet into a shared memory of the offloading device and the network device; encapsulating first description information of the loaded packet in the shared memory into a first descriptor according to the descriptor format of the target descriptor; and sending the first descriptor to the network device through a port bound by the offloading device and the network device, the first descriptor being used by the network device to obtain the loaded packet in the shared memory. In the implementation process of the foregoing solution, the first descriptor is sent to the network device through the port bound by the offloading device and the network device, so that the network device obtains the loaded packet in the shared memory, thereby implementing the loading operation of the packet, that is, implementing the reverse operation function of offloading, and effectively improving the compatibility of the offloading device.
[0009] In an optional implementation of the first aspect, the obtaining of the target descriptor and the descriptor format of the target descriptor comprises: receiving the target descriptor from a port of the offloading device that is bound to the format conversion device, and obtaining the descriptor format that is preset on the offloading device, the target descriptor being obtained by the format conversion device processing an original descriptor sent by the network device. In the implementation process of the above scheme, the format conversion device is used as a proxy intermediate device of the offloading device to complete the processing of the original descriptor to the target descriptor, so that the offloading device does not need to care about the format difference of the messages corresponding to different types of device interfaces, and the target message of the different types of device interfaces can be obtained by directly using the target descriptor sent by the format conversion device, thereby effectively improving the compatibility of the offloading device.
[0010] In an optional implementation of the first aspect, the obtaining of the target message corresponding to the target description information comprises: searching for the target message corresponding to the target description information in a shared memory of the format conversion device and the offloading device, the target message being stored in the shared memory by the format conversion device or the network device. In the implementation process of the above scheme, the target message corresponding to the target description information is searched for in the shared memory of the format conversion device and the offloading device, so that the performance of data processing is improved in a zero-copy manner of data packets, where the zero-copy means that the data is not copied in the shared memory, that is, the same data is not stored, and only different data is read and stored.
[0011] In an optional implementation of the first aspect, the data message processing method further comprises: performing loading processing on the to-be-processed message to obtain a loaded message; storing the loaded message in a shared memory of the offloading device and the format conversion device; encapsulating second description information of the loaded message in the shared memory into a second descriptor according to the descriptor format of the original descriptor; and sending the second descriptor to the format conversion device through a port bound to the format conversion device of the offloading device, the second descriptor being used by the format conversion device or the network device to obtain the loaded message in the shared memory.
[0012] In the second aspect, the embodiments of the present application provide a data message processing method, applied to a format conversion device, comprising: receiving an original descriptor sent by a network device; converting the original descriptor into a target descriptor according to a preset descriptor format; and forwarding the target descriptor to an offloading device. In the implementation process of the above scheme, the format conversion device is used as a proxy intermediate device of the offloading device to complete the processing of the original descriptor to the target descriptor corresponding to the target message, so that the offloading device does not need to care about the format difference of the messages corresponding to different types of device interfaces, and the target message of the different types of device interfaces can be obtained by directly using the target descriptor sent by the format conversion device, thereby effectively improving the compatibility of the offloading device.
[0013] In an optional implementation of the second aspect, converting the original descriptor into the target descriptor according to the preset descriptor format comprises: parsing original description information from the original descriptor; finding an original message corresponding to the original description information from the shared memory of the network device and the format conversion device; storing the original message into the shared memory of the format conversion device and the offload device to obtain a target message; and converting the original description information into target description information corresponding to the target message according to the descriptor format, and encapsulating the target description information into the target descriptor. In the implementation process of the above solution, in the case that the shared memory of the network device and the format conversion device and the shared memory of the format conversion device and the offload device are different physical memories, the original description information is converted into the target description information corresponding to the target message according to the descriptor format, and the target description information is encapsulated into the target descriptor, so that the offload device can obtain the target message according to the target description information parsed according to the descriptor format, thereby effectively improving the compatibility of the offload device with different network devices.
[0014] In an optional implementation of the second aspect, converting the original descriptor into the target descriptor according to the preset descriptor format comprises: parsing original description information from the original descriptor; converting the original description information into target description information according to the descriptor format, and encapsulating the target description information into the target descriptor. In the implementation process of the above solution, the original description information is converted into the target description information according to the descriptor format, and the target description information is encapsulated into the target descriptor, so that the offload device can obtain the target message according to the target description information parsed according to the descriptor format, thereby effectively improving the compatibility of the offload device with different network devices.
[0015] In an optional implementation of the second aspect, the format conversion device is a virtual device; and / or, forwarding the target descriptor to the offload device comprises: storing the target descriptor into a descriptor queue, and the descriptor queue is used for the offload device to obtain the target descriptor. In the implementation process of the above solution, the descriptor is delivered by using the descriptor queue, so that the offload device can obtain the target message of different formats according to the descriptor in the descriptor queue, thereby effectively improving the compatibility of the offload device.
[0016] In the third aspect, the embodiments of the present application provide a data message processing system, comprising: a network device and an offload device; the offload device is configured to obtain a target descriptor and a descriptor format, and parse target description information in the target descriptor according to the descriptor format, the target descriptor being sent by the network device; the offload device is further configured to obtain a target message corresponding to the target description information, and perform offload processing on the target message to obtain an offload message.
[0017] In an optional implementation of the third aspect, the network device is configured to send the target descriptor to the offload device through a port to which the offload device is bound; the offload device is further configured to receive the target descriptor through the port to which the offload device is bound; the offload device is further configured to obtain a port attribute of the port, and determine the register group identifier according to the port attribute; and the offload device is further configured to filter out the descriptor format from the plurality of register groups of the offload device according to the register group identifier, each register group of the plurality of register groups storing a corresponding descriptor format.
[0018] In an optional implementation of the third aspect, the offload device is further configured to perform loading processing on the to-be-processed packet to obtain a loaded packet; the offload device is further configured to store the loaded packet in a shared memory of the offload device and the network device; the offload device is further configured to encapsulate first description information of the loaded packet in the shared memory into a first descriptor according to the descriptor format of the target descriptor; and the offload device is further configured to send the first descriptor to the network device through the port to which the offload device is bound, the first descriptor being used by the network device to obtain the loaded packet in the shared memory.
[0019] In an optional implementation of the third aspect, the data packet processing system further comprises a format conversion device; the offload device is further configured to receive the target descriptor from a port of the offload device to which the format conversion device is bound, and obtain a descriptor format pre-set on the offload device, the target descriptor being obtained by the format conversion device by processing an original descriptor sent by the network device.
[0020] In an optional implementation of the third aspect, the data packet processing system further comprises a shared memory; the offload device is further configured to find out a target packet corresponding to the target description information in the shared memory of the format conversion device and the offload device, the target packet being obtained by the format conversion device by converting an original packet forwarded by the network device and stored in the shared memory.
[0021] In an optional implementation of the third aspect, the offload device is further configured to perform loading processing on the to-be-processed packet to obtain a loaded packet; the offload device is further configured to store the loaded packet in a shared memory of the offload device and the format conversion device; the offload device is further configured to encapsulate second description information of the loaded packet in the shared memory into a second descriptor according to the descriptor format of the original descriptor; and the offload device is further configured to send the second descriptor to the format conversion device through a port of the offload device to which the format conversion device is bound, the second descriptor being used by the format conversion device to obtain the loaded packet in the shared memory.
[0022] In a fourth aspect, an embodiment of the present application provides a data packet processing apparatus applied to an offloading device, comprising: a target descriptor analysis module, configured to acquire a target descriptor and a descriptor format, and analyze target description information in the target descriptor according to the descriptor format; and a packet offloading processing module, configured to acquire a target packet corresponding to the target description information, and perform offloading processing on the target packet to obtain an offloaded packet.
[0023] In an optional implementation of the fourth aspect, the target descriptor analysis module comprises: a first descriptor receiving submodule, configured to receive the target descriptor through a port bound to the network device by the offloading device; a register identification determining submodule, configured to acquire a port attribute of the port, and determine a register group identification according to the port attribute; and a descriptor format reading submodule, configured to read the descriptor format from a plurality of register groups of the offloading device according to the register group identification, each register group of the plurality of register groups storing a corresponding descriptor format.
[0024] In an optional implementation of the fourth aspect, the data packet processing apparatus further comprises: a first loading processing module, configured to perform loading processing on a to-be-processed packet to obtain a loaded packet; a first information acquiring module, configured to store the loaded packet into a shared memory of the offloading device and the network device; a first descriptor encapsulating module, configured to encapsulate first description information of the loaded packet in the shared memory into a first descriptor according to the descriptor format of the target descriptor; and a first descriptor sending module, configured to send the first descriptor to the network device through the port bound to the network device by the offloading device, the first descriptor being used by the network device to acquire the loaded packet in the shared memory.
[0025] In an optional implementation of the fourth aspect, the target descriptor analysis module comprises: a second descriptor receiving submodule, configured to receive the target descriptor from a port bound to the format conversion device by the offloading device, and acquire a descriptor format pre-set on the offloading device, the target descriptor being obtained by processing an original descriptor sent by the network device by the format conversion device.
[0026] In an optional implementation of the fourth aspect, the packet offloading processing module comprises: a target packet searching submodule, configured to search for the target packet corresponding to the target description information in a shared memory of the format conversion device and the offloading device, the target packet being stored in the shared memory by the format conversion device or the network device.
[0027] In an optional implementation of the fourth aspect, the method further includes: performing loading processing on the to-be-processed packet to obtain a loaded packet; storing the loaded packet in a shared memory of the offloading device and the format conversion device; encapsulating, according to a descriptor format of the original descriptor, second description information of the loaded packet in the shared memory into a second descriptor; and sending the second descriptor to the format conversion device through a port bound to the offloading device and the format conversion device, the second descriptor being used by the format conversion device or the network device to obtain the loaded packet in the shared memory.
[0028] In a fifth aspect, an embodiment of the present application provides a data packet processing apparatus, applied to a format conversion device, and including: an original descriptor analysis module, configured to receive an original descriptor sent by a network device; a descriptor encapsulation module, configured to convert the original descriptor into a target descriptor according to a preset descriptor format; and a descriptor forwarding module, configured to forward the target descriptor to an offloading device.
[0029] In an optional implementation of the fifth aspect, the descriptor encapsulation module is further configured to: analyze original description information from the original descriptor; find an original packet corresponding to the original description information from a shared memory of the network device and the format conversion device; store the original packet in a shared memory of the format conversion device and the offloading device to obtain a target packet; and convert the original description information into target description information corresponding to the target packet according to the descriptor format, and encapsulate the target description information into the target descriptor.
[0030] In an optional implementation of the fifth aspect, the descriptor encapsulation module is further configured to: analyze original description information from the original descriptor; and convert the original description information into target description information according to the descriptor format, and encapsulate the target description information into the target descriptor.
[0031] In an optional implementation of the fifth aspect, the format conversion device is a virtual device; and / or, the descriptor forwarding module includes: a target descriptor storage submodule, configured to store the target descriptor in a descriptor queue, the descriptor queue being used by the offloading device to obtain the target descriptor.
[0032] In a sixth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, the memory storing machine readable instructions executable by the processor, and the machine readable instructions being executed by the processor to perform the method described above.
[0033] In a seventh aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing a computer program, and the computer program being executed by a processor to perform the method described above.
[0034] Other features and advantages of the embodiments of the present application will be set forth in the following description, and in part will become apparent from the description, or can be learned by practice of the embodiments of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be considered as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0036] Figure 1 The flowchart of the data packet processing method executed by the offloading device provided by the embodiments of the present application is shown in the figure;
[0037] Figure 2 The schematic diagram of the network device and the offloading device provided by the embodiments of the present application are shown in the figure;
[0038] Figure 3 The schematic diagram of the network device, the format conversion device and the offloading device provided by the embodiments of the present application are shown in the figure;
[0039] Figure 4 The flowchart of the data packet processing method executed by the format conversion device provided by the embodiments of the present application is shown in the figure;
[0040] Figure 5 The structural schematic diagram of the data packet processing system provided by the embodiments of the present application is shown in the figure;
[0041] Figure 6 The structural schematic diagram of the data packet processing device provided by the embodiments of the present application is shown in the figure;
[0042] Figure 7 The structural schematic diagram of the electronic device provided by the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION
[0043] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. It should be understood that the drawings in the embodiments of the present application are only intended to illustrate and describe the purposes, and are not used to limit the protection scope of the embodiments of the present application. In addition, it should be understood that the schematic drawings are not drawn according to the actual proportions. The flowcharts used in the embodiments of the present application show the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowcharts can not be implemented in sequence, and the steps without logical context relationship can be reversed in sequence or implemented simultaneously. In addition, one or more other operations can be added to the flowcharts or one or more operations can be removed from the flowcharts under the guidance of the contents of the embodiments of the present application.
[0044] In addition, the described embodiments are only part of the embodiments of the present application, not all the embodiments. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed embodiments of the present application, but only represents selected embodiments of the present application.
[0045] It can be understood that "first", "second" in the embodiments of the present application are used to distinguish similar objects. Those skilled in the art can understand that "first", "second" and the like do not limit the number and execution order, and "first", "second" and the like do not necessarily mean different. In the description of the embodiments of the present application, the term "and / or" is only used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which means that there are three cases of A alone, A and B together, and B alone. In addition, the character " / " in this paper generally means that the front and rear associated objects have an "or" relationship. The term "multiple" refers to more than two (including two), and similarly, "multiple groups" refers to more than two groups (including two groups).
[0046] It should be noted that the data packet processing method provided by the embodiments of the present application can be executed by an electronic device, and the electronic device herein refers to a device having the function of executing a computer program, for example: an x86 device or a non-x86 device for offloading packets. The non-x86 device includes: mainframe, minicomputer and UNIX device.
[0047] In order to improve the compatibility of the offload device in unloading the message, the main idea of the data message processing method provided by the embodiment of the application is to describe the message format corresponding to different types of device interfaces in descriptor format, and to obtain target messages of different formats using the message description information parsed from the data descriptor in descriptor format, so that the offload device can unload and process target messages of different formats, thereby effectively improving the compatibility of the offload device.
[0048] The application scenarios to which the data message processing method is applicable will be introduced below. The application scenarios include but are not limited to using the data message processing method to improve the compatibility of network devices. Since the device interfaces supported by network devices are usually single and fixed, it is difficult to unload and process network data packets of interfaces such as Peripheral Component Interconnect express (PCIe), Universal Serial Bus (USB), and Secure Digital Input and Output (SDIO). The network devices, such as mobile router devices, home router devices, or small and medium-sized enterprise router devices, usually adopt a single fixed interface. Although the device interfaces of the network devices cannot be changed, the message formats of the network data packets are different. However, the descriptor format in the data message processing method can be used to describe the message formats corresponding to different types of device interfaces, so that the offload device can obtain target messages of different network device formats according to the descriptor format, thereby completing the unloading of the target messages.
[0049] Please refer to Figure 1 The flowchart of the data message processing method executed by the offload device provided by the embodiment of the application is shown. The implementation of the method executed on the offload device can include:
[0050] Step S110: The offload device obtains a target descriptor and a descriptor format, and parses target description information in the target descriptor according to the descriptor format.
[0051] The offload device refers to a computing device that offloads data messages. The offload device can be provided with an Application Specific Integrated Circuit (ASIC) or a Field Programmable Gate Array (FPGA).
[0052] The target descriptor refers to a data descriptor obtained by the offload device, and the data descriptor can be used to describe each field information in a data packet.
[0053] It can be understood that the message formats (such as data address, length, and status) corresponding to different types of device interfaces are all different. For example, some systems are 64-bit addresses, and some systems are 32-bit addresses, 64-bit addresses can be segmented and stored, and the like. Therefore, it is difficult for the offload device to adapt to the message formats corresponding to different types of device interfaces. In order to adapt to the message formats corresponding to different types of device interfaces, the embodiment of the present application provides a descriptor format of a target descriptor, which can be stored in a register group of the offload device. For example, each register can store a field information in the data descriptor, and therefore, a register group can be used to store the descriptor format of all field information of the data descriptor.
[0054] Table 1 below illustrates a descriptor format for describing a message information descriptor, which can include a data buffer (buff) base address (denoted as Head_addr), a data field offset (Offset), a descriptor subclass code (Code), a reserved (Resv) field, a data packet length (Len), a data packet error (Error) status, type-related information 1 (Ext1), and type-related information 2 (Ext2).
[0055]
[0056]
[0057] Table 1
[0058] It can be understood that there are many ways for the offload device to obtain the target descriptor, including but not limited to: a first obtaining manner, in which the target descriptor can be directly received by the offload device through a port bound to the network device when the network device and the offload device are connected to each other; and a second obtaining manner, in which the target descriptor can be received from a second port bound to the format conversion device on the offload device when the network device, the format conversion device, and the offload device are connected in sequence, that is, when the network device and the format conversion device are connected through a first port, and the format conversion device and the offload device are connected through a second port. The first port and the second port can be physical ports, and the two manners will be described in detail below. Similarly, there are many ways for the offload device to obtain the descriptor format, which will be described in detail below.
[0059] Step S120: The offloading device acquires the target packet corresponding to the target description information, and performs offloading processing on the target packet to obtain an offloaded packet.
[0060] Since the target description information (e.g., the specific value of the data cache base address or the specific value of the data field offset) is parsed from the target descriptor according to the descriptor format, each field information of the target packet can be known from the target description information, such as the data cache (buff) base address of a certain field in the packet header and the data field offset, and thus the numerical content of the certain field in the packet header can be acquired according to the base address and the data field offset (e.g., the field is read from the memory, or the field is read from other storage locations). Similarly, all fields in the packet header and all fields in the packet body can be acquired according to the parsed target description information.
[0061] It can be understood that the offloading device can perform many kinds of offloading processing on the target packet, such as network address port translation (NAPT) load on the data packet, quality of service (QoS) processing performance load on the data packet, and the like. In the specific implementation process, the offloaded packet is acquired by other service devices (e.g., audit devices or security devices), which can read the offloaded packet through the bus or store the offloaded packet in the shared memory by the offloading device, and then read the offloaded packet from the shared memory.
[0062] In the above implementation process, the packet format corresponding to the device interface of different types is described by the descriptor format, and the target packet of different packet formats is acquired by using the packet description information parsed from the data descriptor according to the descriptor format, so that the offloading device can perform offloading processing on the target packet of different formats, and the compatibility of the offloading device is effectively improved. The compatibility of the offloading device refers to the wide application of the offloading device, and the offloading device can offload and process data packets of packet formats corresponding to many network device interfaces, such as 100M / 1000M level home routers or 10G level enterprise small routers.
[0063] In practical implementation, the data packet processing method may further include: obtaining the response packet corresponding to the unloading packet. For example, the unloading device can send an unloading packet to the service device, so that after receiving the unloading packet, the service device can perform business processing on the unloading packet (such as data query, modification, or addition, etc.), obtain and return the response packet corresponding to the unloading packet. The response packet is then loaded (i.e., the reverse process of unloading, such as the reverse process of network address translation, network port translation, etc.) to obtain a loaded packet; a descriptor corresponding to the loaded packet is generated according to the descriptor format of the original descriptor, and this descriptor is used to obtain the loaded packet. In the implementation of the above scheme, by generating the descriptor corresponding to the loaded packet according to the descriptor format of the original descriptor to obtain the loaded packet, the packet loading operation is realized, that is, the reverse operation function of unloading is realized, effectively improving the compatibility of the unloading device.
[0064] Please see Figure 2 The diagram shown illustrates the interconnection between the network device and the offloading device provided in this application embodiment. As a first optional implementation of step S110 above, when the offloading device and the network device are directly connected via a port, the implementation for obtaining the target descriptor and the descriptor format of the target descriptor may include:
[0065] Step S111: The unloading device receives the target descriptor through the port bound to the network device.
[0066] An example implementation of step S111 above is as follows: After acquiring the target packet, the network device can store the target packet in the shared memory of the network device and the offloading device, and obtain the target description information corresponding to the target packet based on the storage information of the target packet in the shared memory (e.g., the data cache base address of the target packet, and the data offset of each field). Then, the network device encapsulates the target description information into a target descriptor, and when the offloading device and the network device are directly connected through a physical port, the network device can directly send the target descriptor to the offloading device through that physical port. Similarly, the offloading device can also directly receive the target descriptor sent by the network device through the physical port bound to the network device.
[0067] It is understood that the shared memory in the embodiments of this application refers to memory shared among multiple devices, such as memory shared between a network device and an offloading device, or memory shared among a network device, a format conversion device, and an offloading device. The memory here can be random-access memory (RAM).
[0068] Step S112: The offloading device acquires the port attribute of the port, and determines the register group identification according to the port attribute.
[0069] The register group identification refers to the unique identification of the register group, and the register group is used to store a descriptor format. The descriptor format herein is, for example, a 16-byte descriptor, 0-5 bytes of which are an address, 6-7 bytes of which are a length, 8-9 bytes of which are a key value, and 10-11 bytes of which are a control code.
[0070] The implementation of the above step S112 is, for example, acquiring the port attribute of the physical port connected by the offloading device and the network device. The port attribute and the physical port can have a mapping relationship, and thus the port attribute corresponding to the physical port can be queried from a mapping relationship table (for example, a port attribute relationship table in a database) between the physical port and the port attribute. There are many implementation manners of determining the register group identification according to the port attribute. The first implementation manner is, for example, that the register identification configured by the user in advance can be parsed from the port attribute. The second implementation manner is, for example, that the register group identification corresponding to the port attribute can also be queried from a mapping relationship table (for example, a port attribute relationship table in a database) between the port attribute and the register group identification.
[0071] Step S113: The offloading device reads out the descriptor format from a plurality of register groups of the offloading device according to the register group identification. Each register group in the plurality of register groups stores a corresponding descriptor format.
[0072] The register group refers to a plurality of registers used to store a descriptor format. Each register can store one field of the descriptor format. For example, assuming that the descriptor is 16 bytes, a 0-5 byte register can be used to store a message address, a 6-7 byte register can be used to store a message length, an 8-9 byte register can be used to store a key value, and a 10-11 byte register can be used to store a control code.
[0073] The implementation of the above step S113 is, for example, that since the offloading device is provided with a plurality of register groups, and each register group in the plurality of register groups stores a corresponding descriptor format, the offloading device can find the register group corresponding to the register group identification according to the register group identification from the plurality of register groups of the offloading device, and then read out the descriptor format used to parse the target descriptor from the register group corresponding to the register group identification. After obtaining the descriptor format, the offloading device can also parse the target descriptor using the descriptor format, obtain target description information in the target descriptor, and find the target message corresponding to the target description information from the shared memory of the offloading device and the network device.
[0074] It can be understood that when the descriptor format in the whole register group of the offload device cannot be described clearly (for example, all fields of the data packet cannot be described), the Linux driver software can be used to convert the descriptor format of the data packet (for example, the descriptor format set in the Linux driver software), the Linux driver software specification defines a standard sending interface and a receiving interface, the sending interface can call the function of do_start_xmit, and the receiving interface can register a polling function (for example, the function of abc_poll) to the napi structure of the Linux operating system. Since the data packet itself is not modified in the descriptor format conversion process, the use of the Linux driver software to convert the descriptor format of the data packet can achieve very high data packet processing performance.
[0075] As an optional implementation manner of the data packet processing method, the data packet processing method can further include:
[0076] Step S114: The offload device performs loading processing on the to-be-processed data packet to obtain a loaded data packet.
[0077] The to-be-processed data packet refers to a data packet that needs to be loaded, and the data packet can be a response data packet returned by the service device after receiving the offload data packet, and of course, the data packet can also be a request data packet initiated by the service device to push to the terminal device.
[0078] The loading (On Load) processing refers to the reverse processing of the offload (Off Load) processing, for example, if the offload processing is decryption, then the loading processing is encryption; similarly, if the offload processing is the process of network address translation (NAT), then the loading processing is the process of reverse conversion of the network address of NAT. The loaded data packet refers to a data packet after the loading (On Load) processing, and the data packet corresponds to the offload data packet.
[0079] There are many embodiments of the above step S114, including but not limited to: a first embodiment, the offloading device can send the offloading message to the service device, so that the service device can perform service processing (such as data query, modification or addition, etc.) on the offloading message after receiving the offloading message, obtain and return the response message corresponding to the offloading message; then, the offloading device can perform loading processing (i.e. the reverse process of offloading processing, for example: the reverse process of network address port translation) on the response message to obtain the loading message. A second embodiment, the service device can actively read the offloading message from the offloading device, and perform service processing on the offloading message to obtain the response message, and then store the processed response message in the shared memory. After the service device stores the response message in the shared memory, the offloading device can obtain the response message from the shared memory and perform loading processing on the response message to obtain the loading message. A third embodiment, the offloading device receives the request message of the service device and performs loading processing on the request message to obtain the loading message, wherein the request message is a message pushed by the service device to the terminal device through the offloading device.
[0080] Step S115: The offloading device stores the loading message in the shared memory between the offloading device and the network device.
[0081] The embodiments of the above step S115 are, for example: after obtaining the loading message, the offloading device can store the loading message in the shared memory between the offloading device and the network device, and obtain the first description information of the loading message in the shared memory. The first description information here is similar to the target description information described above, including but not limited to: the specific value of the data cache base address or the specific value of the data field offset, wherein the data field offset refers to the offset of a data field from the data cache base address.
[0082] Step S116: The offloading device encapsulates the first description information of the loading message in the shared memory into a first descriptor according to the descriptor format of the target descriptor.
[0083] Step S117: The offloading device sends the first descriptor to the network device through the port bound to the offloading device and the network device, and the first descriptor is used by the network device to obtain the loading message in the shared memory.
[0084] The implementation of the steps S116 to S117 can be, for example, that the offloading device encapsulates the first description information of the load packet in the shared memory into a first descriptor according to the descriptor format (e.g., data cache base address or data field offset, etc.) of the target descriptor, and the first descriptor is a descriptor designed by the manufacturer of the network device according to a preset descriptor format. It can be understood that the descriptors designed by different types of network device manufacturers are different, and therefore, the ports bound by different network devices need to send descriptors of different descriptor formats.
[0085] Please refer to Figure 3 The network device, the format conversion device and the offloading device provided by the embodiments of the present application are connected in sequence, and the second optional implementation of the step S110 can include the following steps:
[0086] In step S118, the offloading device receives the target descriptor from the port bound with the format conversion device on the offloading device, and obtains the preset descriptor format on the offloading device, and the target descriptor is obtained by processing the original descriptor sent by the network device by the format conversion device.
[0087] The format conversion device is a device for processing the original descriptor sent by the network device, so as to perform format conversion on the original packet corresponding to the original descriptor, and the format conversion device can be a physical device (e.g., a server) or a virtual device.
[0088] The implementation of the step S118 can be, for example, that after obtaining the original packet, the network device stores the original packet in the shared memory of the network device and the format conversion device, and obtains the original description information corresponding to the original packet according to the storage information (e.g., data cache base address of the original packet and data offset of each field, etc.) of the original packet in the shared memory. Then, the network device encapsulates the original description information into an original descriptor, and in the case that the network device and the format conversion device are directly connected through a physical port, the network device can directly send the original descriptor to the format conversion device through the physical port.
[0089] Similarly, after the format conversion device receives the original descriptor through the physical port between the network device and the format conversion device, the format conversion device can parse the original description information in the original descriptor from the original descriptor, and find the original message corresponding to the original description information from the shared memory between the network device and the format conversion device. After obtaining the original message corresponding to the original description information, the format conversion device can obtain the target message according to the original message, and store the target message in the shared memory between the format conversion device and the offload device, and obtain the target description information corresponding to the target message according to the storage information of the target message in the shared memory (for example, the data cache base address of the target message, and the data offset of each field, etc.). Then, the format conversion device encapsulates the target description information into the target descriptor, and in the case that the format conversion device and the offload device are directly connected through the physical port, the format conversion device can directly send the target descriptor to the offload device through the physical port. Similarly, the offload device can also directly receive the target descriptor sent by the network device through the physical port bound between the offload device and the format conversion device.
[0090] Finally, the offload device receives the target descriptor from the port bound between the offload device and the format conversion device, obtains the descriptor format pre-set on the offload device, and then parses the target descriptor using the pre-set descriptor format to obtain the target description information, and finds the target message corresponding to the target description information from the shared memory between the offload device and the format conversion device. It can be understood that the first shared memory between the network device and the format conversion device and the second shared memory between the offload device and the format conversion device can be the same memory commonly used by the network device, the format conversion device and the offload device, and the first shared memory and the second shared memory can also be different memories used separately.
[0091] In the implementation process of the above scheme, by receiving the target descriptor from the port bound between the offload device and the format conversion device, and obtaining the descriptor format pre-set on the offload device, the offload device can obtain the target message according to the target description information parsed according to the pre-set descriptor format, so that the format conversion device acts as a proxy intermediate device of the offload device to complete the processing of the original descriptor to the target descriptor, and the compatibility of the offload device is effectively improved.
[0092] As an optional implementation of the above step S120, the implementation of obtaining the target message corresponding to the target description information can include:
[0093] Step S121: The offload device finds the target message corresponding to the target description information in the shared memory between the format conversion device and the offload device, and the target message is stored in the shared memory by the format conversion device or the network device.
[0094] It can be understood that the shared memory described above can also work in the manner of a shared memory pool, that is, the RAM in the shared memory pool can be applied for and released between the network device and the offloading device, and the RAM in the shared memory pool can also be applied for and released between the network device, the format conversion device and the offloading device. The register shared memory pool described above can be managed by a buffer manager (BMAN), and specifically, the pool information of each shared memory pool, such as the start address, the end address, the memory block size, the memory block quantity, the base address of the memory pool management first input first output (FIFO), can be configured to the BMAN, so that the BMAN manages the shared memory pool according to the pool information.
[0095] The implementation manner of the step S121 described above is, for example, after obtaining the descriptor format, the offloading device can also parse the target descriptor using the descriptor format, obtain the target description information in the target descriptor, and find the target packet corresponding to the target description information in the shared memory between the format conversion device and the offloading device. The target packet is stored in the shared memory by the format conversion device or the network device, and specific reference can be made to the implementation manner of the step S111 or the implementation manner of the step S114.
[0096] In the implementation process of the scheme described above, the target packet corresponding to the target description information is found in the shared memory between the format conversion device and the offloading device, so that the performance of data processing is improved in the manner of zero-copy of data packets. Here, zero-copy refers to not copying data in the shared memory, that is, not storing the same data, but only reading and storing different data.
[0097] As an optional implementation manner of the data packet processing method described above, the data packet processing method can further include:
[0098] Step S122: performing loading processing on the to-be-processed packet to obtain a loaded packet.
[0099] Step S123: storing the loaded packet into the shared memory between the offloading device and the format conversion device.
[0100] The implementation principle and implementation manner of the steps S122 to S123 are similar to those of the steps S114 to S115, and therefore, the implementation principle and implementation manner are not described here. If there is any unclear place, reference can be made to the description of the steps S114 to S115.
[0101] Step S124: encapsulating the second description information of the loaded packet in the shared memory into a second descriptor according to the descriptor format of the original descriptor.
[0102] Step S125: sending a second descriptor to the format conversion device through the port bound with the format conversion device by the offloading device, the second descriptor being used for the format conversion device or the network device to obtain the loaded packet in the shared memory.
[0103] The implementation principles and implementation manners of steps S124-S125 are similar to those of steps S116-S117, and thus the implementation principles and implementation manners are not described here. If there is any unclear place, please refer to the description of steps S116-S117.
[0104] Please refer to Figure 4 The data packet processing method provided by the format conversion device according to the embodiment of the present application is shown in the flowchart. The data packet processing method provided by the embodiment of the present application can be applied to the format conversion device, and the implementation manner of the method can include:
[0105] Step S210: The format conversion device receives the original descriptor sent by the network device.
[0106] The implementation manner of step S210 can be understood as follows: in the case where the network device, the format conversion device and the offloading device are connected in sequence, the network device can store the original packet into the shared memory between the network device and the format conversion device after obtaining the original packet, and obtain the original description information corresponding to the original packet according to the storage information (such as the data cache base address of the original packet and the data offset of each field) of the original packet in the shared memory. Then, the network device encapsulates the original description information into the original descriptor, and in the case where the network device and the format conversion device are directly connected through a physical port, the network device can directly send the original descriptor to the format conversion device through the physical port. Then, the format conversion device receives the original descriptor through the physical port between the network device and the format conversion device, and the format conversion device can parse the original description information in the original descriptor from the original descriptor after receiving the original descriptor.
[0107] Step S220: The format conversion device converts the original descriptor into a target descriptor according to a preset descriptor format.
[0108] Step S230: The format conversion device forwards the target descriptor to the offloading device.
[0109] The implementation of the step S230 can be, for example: the format conversion device can also convert the original descriptor into a target descriptor according to a pre-set descriptor format, and in the case that the format conversion device is directly connected with the offload device through a physical port, the format conversion device can directly send the target descriptor to the offload device through the physical port, and the target descriptor is used to offload the target message. After receiving the target descriptor, the offload device can obtain the target message corresponding to the target descriptor from the shared memory, and offload the target message to obtain the offloaded message.
[0110] In the implementation of the above scheme, the format conversion device is used as the proxy intermediate device of the offload device to complete the processing of the original descriptor into the target descriptor, so that the offload device does not need to care about the message format difference of different types of device interfaces, and the target descriptor sent by the format conversion device can be directly used to obtain the target message of different types of device interfaces, thereby effectively improving the compatibility of the offload device.
[0111] As the first optional implementation of the step S220, the implementation of converting the original descriptor into the target descriptor according to the pre-set descriptor format can include:
[0112] Step S221: The format conversion device parses the original descriptor information from the original descriptor.
[0113] Step S222: The format conversion device finds the original message corresponding to the original descriptor information from the shared memory between the network device and the format conversion device.
[0114] Step S223: The format conversion device stores the target message into the shared memory between the format conversion device and the offload device to obtain the target message.
[0115] It can be understood that if the shared memory between the network device and the format conversion device and the shared memory between the format conversion device and the offload device are different physical memories, the message needs to be copied across the memories, that is, the format conversion device needs to store the target message into the shared memory between the format conversion device and the offload device to obtain the target message.
[0116] Step S224: The format conversion device converts the original descriptor information into the target descriptor information corresponding to the target message according to the pre-set descriptor format, and encapsulates the target descriptor information into the target descriptor.
[0117] The implementation of the above steps S221 to S224, for example, the format conversion device parses the original description information in the original descriptor, and can find the original packet corresponding to the original description information in the shared memory of the network device and the format conversion device. After obtaining the original packet corresponding to the original description information, the format conversion device stores the target packet into the shared memory of the format conversion device and the offloading device to obtain the target packet. The format conversion device converts the original description information into target description information corresponding to the target packet according to the descriptor format, and encapsulates the target description information into a target descriptor.
[0118] As a second optional implementation of the above step S220, the implementation of the above converting the original descriptor into the target descriptor according to the preset descriptor format can include:
[0119] Step S225: The format conversion device parses the original description information from the original descriptor.
[0120] Step S226: The format conversion device converts the original description information into target description information according to the descriptor format, and encapsulates the target description information into a target descriptor.
[0121] The implementation of the above steps S225 to S226, for example, the format conversion device parses the original description information from the original descriptor using an executable program compiled or interpreted by a preset programming language, and the programming language that can be used includes C, C++, Java, BASIC, JavaScript, LISP, Shell, Perl, Ruby, Python, PHP and the like. The format conversion device converts the original description information into target description information according to the preset descriptor format, and encapsulates the target description information into a target descriptor.
[0122] As an optional implementation of the above step S250, it can be understood that the above format conversion device can be a virtual device, or the above format conversion device can also be a physical hardware device; and / or the implementation of the format conversion device forwarding the target descriptor to the offloading device can include:
[0123] Step S251: The format conversion device stores the target descriptor into a descriptor queue, and the descriptor queue is used for the offloading device to obtain the target descriptor.
[0124] The descriptor queue is a queue for storing descriptors, and the descriptors include, but are not limited to, the original descriptors sent by the network device to the format conversion device, the target descriptors sent by the format conversion device to the offload device, or the target descriptors sent by the network device to the offload device. In the following, only the implementation of forwarding the target descriptors from the format conversion device to the offload device is taken as an example, and the descriptor queue can also be used when the network device sends the original descriptors to the format conversion device, and the descriptor queue can also be used when the format conversion device sends the target descriptors to the offload device, and the principle of the specific implementation is similar, and thus is not described herein.
[0125] The implementation of the above step S251 is, for example, that the format conversion device stores the target descriptors into a descriptor queue, and the descriptor queue is used for the offload device to obtain the target descriptors, and the descriptor queue can be a data structure in the shared memory. That is, after the format conversion device stores the target descriptors into the descriptor queue, the offload device can read the target descriptors from the descriptor queue.
[0126] In the implementation of the above scheme, the descriptor queue in the shared memory is used to deliver the descriptors, so that the offload device can obtain the target packets in different formats according to the descriptors in the descriptor queue, thereby effectively improving the compatibility of the offload device.
[0127] As an optional implementation of the above data packet processing method, the format conversion device can be a virtual device or a physical device. The virtual device refers to a virtual network peripheral simulated by a driver (for example, a Linux driver) of an operating system, and the virtual device can be used to uniformly convert the original packets of the network device into target packets, and the original descriptors are changed into target descriptors, and theoretically, the virtual device can run on any hardware device, for example, an x86 server and a non-x86 server, and the non-x86 server includes a mainframe, a mini-computer and a UNIX server.
[0128] Of course, the format conversion device described above can also be a hardware entity device. For a chip design enterprise, any entity device is a chip composed of many electronic elements. Therefore, the network device, the format conversion device, and / or the offload device described above can also be a chip composed of electronic elements. At this time, the network device, the format conversion device, and / or the offload device can be driven by a Linux driver. Shared memory can be used to transmit the above data messages between the network device, the format conversion device, and / or the offload device. The descriptor queue described above can be a queue data structure in shared memory. Since the descriptor queue is stored in shared memory, the descriptor queue can be accessed by the network device, the format conversion device, and / or the offload device.
[0129] Please refer to Figure 5 The embodiment of the application provides a structural schematic diagram of a data message processing system. The embodiment of the application provides a data message processing system 300, which comprises a network device 310 and an offload device 320.
[0130] The offload device 320 is configured to acquire a target descriptor and a descriptor format, and parse target descriptor information in the target descriptor according to the descriptor format. The target descriptor is sent by the network device 310.
[0131] The offload device 320 is further configured to acquire a target message corresponding to the target descriptor information, and perform offload processing on the target message to obtain an offload message.
[0132] Optionally, in the embodiment of the application, the data message processing system comprises a network device and an offload device.
[0133] The network device 310 is further configured to send the target descriptor to the offload device through a port bound to the network device and the offload device.
[0134] The offload device 320 is further configured to receive the target descriptor through the port bound to the network device and the offload device.
[0135] The offload device 320 is further configured to acquire a port attribute of the port, and determine a register group identifier according to the port attribute.
[0136] The offload device 320 is configured to filter the descriptor format from a plurality of register groups of the offload device according to the register group identifier. Each register group in the plurality of register groups stores a corresponding descriptor format.
[0137] Optionally, in the embodiment of the application, the offload device is further configured to perform loading processing on the to-be-processed message to obtain a loading message.
[0138] The offload device is further configured to store the loading message in shared memory of the offload device and the network device.
[0139] The offloading device is further configured to encapsulate the first description information of the loading packet in the shared memory into a first descriptor according to a descriptor format of the target descriptor;
[0140] The offloading device is further configured to send the first descriptor to the network device through a port of the offloading device which is bound with the network device, and the first descriptor is used for the network device to obtain the loading packet in the shared memory.
[0141] Optionally, in the embodiment of the present application, the data packet processing system further comprises a format conversion device.
[0142] The offloading device is configured to receive a target descriptor from a port of the offloading device which is bound with the format conversion device, and obtain a descriptor format which is preset on the offloading device, and the target descriptor is obtained by processing an original descriptor sent by the network device by the format conversion device.
[0143] Optionally, in the embodiment of the present application, the data packet processing system further comprises a shared memory.
[0144] The offloading device is configured to find a target packet corresponding to the target description information in the shared memory of the format conversion device and the offloading device, and the target packet is stored in the shared memory by the format conversion device or the network device.
[0145] Optionally, in the embodiment of the present application, the offloading device is further configured to perform loading processing on the to-be-processed packet to obtain a loading packet.
[0146] The offloading device is further configured to store the loading packet into the shared memory of the offloading device and the format conversion device.
[0147] The offloading device is further configured to encapsulate second description information of the loading packet in the shared memory into a second descriptor according to a descriptor format of the original descriptor.
[0148] The offloading device is further configured to send the second descriptor to the format conversion device through a port of the offloading device which is bound with the format conversion device, and the second descriptor is used for the format conversion device to obtain the loading packet in the shared memory.
[0149] It should be noted that each of the embodiments of the present application is described in a progressive manner, and each embodiment mainly describes the difference from other embodiments, and the same and similar parts of each embodiment can be referred to. For system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.
[0150] Please refer to Figure 6A structural schematic diagram of a data packet processing apparatus provided by an embodiment of the application is shown; an embodiment of the application provides a data packet processing apparatus 400 applied to an offloading device, comprising:
[0151] A target description analysis module 410 is configured to acquire a target descriptor and a descriptor format, and analyze target description information in the target descriptor according to the descriptor format.
[0152] A packet offloading processing module 420 is configured to acquire a target packet corresponding to the target description information, and perform offloading processing on the target packet to obtain an offloaded packet.
[0153] Optionally, in an embodiment of the application, the target description analysis module comprises:
[0154] A first descriptor receiving submodule is configured to receive the target descriptor through a port bound to the network device by the offloading device.
[0155] A register group identification determining submodule is configured to acquire a port attribute of the port, and determine a register group identification according to the port attribute.
[0156] A descriptor format reading submodule is configured to read the descriptor format from a plurality of register groups of the offloading device according to the register group identification, and each register group of the plurality of register groups stores a corresponding descriptor format.
[0157] Optionally, in an embodiment of the application, the target description analysis module comprises:
[0158] A second descriptor receiving submodule is configured to receive the target descriptor from a port bound to the format conversion device on the offloading device, and acquire a descriptor format pre-set on the offloading device, the target descriptor being obtained by processing, by the format conversion device, an original descriptor sent by the network device.
[0159] Optionally, in an embodiment of the application, the packet offloading processing module comprises:
[0160] A target packet searching submodule is configured to search for the target packet corresponding to the target description information in a shared memory of the format conversion device and the offloading device, the target packet being stored in the shared memory by the format conversion device or the network device.
[0161] An embodiment of the application further provides a data packet processing apparatus applied to a format conversion device, which can comprise:
[0162] An original description analysis module is configured to receive an original descriptor sent by a network device, and analyze original description information from the original descriptor.
[0163] The target message conversion module is configured to find the original message corresponding to the original description information from the shared memory of the network device and the format conversion device, and convert the original message into a target message.
[0164] The target description acquisition module is configured to store the target message into the shared memory of the format conversion device and the offload device.
[0165] The descriptor encapsulation module is configured to encapsulate the target description information corresponding to the target message into a target descriptor according to a preset descriptor format.
[0166] The descriptor forwarding module is configured to forward the target descriptor to the offload device, the target descriptor including the target description information corresponding to the target message requiring offload processing.
[0167] Optionally, in the embodiment of the present application, the descriptor forwarding module comprises:
[0168] The target descriptor storage submodule is configured to store the target descriptor into a descriptor queue, the descriptor queue being used for the offload device to acquire the target descriptor.
[0169] Optionally, in the embodiment of the present application, the format conversion device is a virtual device.
[0170] It should be understood that the apparatus corresponds to the above-mentioned data message processing method embodiments, and can perform each step involved in the above-mentioned method embodiments. The specific functions of the apparatus can be referred to the description above, and the detailed description is appropriately omitted here. The apparatus comprises at least one software function module which can be stored in the memory in the form of software or firmware or solidified in the operating system (OS) of the apparatus.
[0171] Please refer to Figure 7 The electronic device 500 provided by the embodiment of the present application comprises a processor 510 and a memory 520. The memory 520 stores machine readable instructions executable by the processor 510. When the machine readable instructions are executed by the processor 510, the method described above is performed.
[0172] The embodiments of the present application further provide a computer readable storage medium 530, which stores a computer program. The computer program is run by the processor 510 to execute the method described above. The computer readable storage medium 530 can be implemented by any type of volatile or nonvolatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0173] It should be noted that each of the embodiments in the present specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same or similar parts of each embodiment can be understood by referring to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be understood by referring to the part of the method embodiment.
[0174] In several embodiments provided by the embodiments of the present application, it should be understood that the disclosed apparatus and method can also be implemented by other ways. The apparatus embodiments described above are only schematic, and the flowcharts and block diagrams in the drawings show the possible implementation architectures, functions and operation of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can be performed in a different order from that noted in the flowcharts. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved.
[0175] In addition, each function module in each embodiment in the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part. In addition, in the description of the specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are contained in at least one embodiment or example of the present application. In the specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, different embodiments or examples described in the specification and the features of different embodiments or examples can be combined and combined by those skilled in the art without contradiction.
[0176] The above description is only an optional implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered by the protection scope of the present application.
Claims
1. A data packet processing method, characterized in that, Applied to unloading devices, including: Obtain the target descriptor and the descriptor format of the target descriptor, and parse the target description information in the target descriptor according to the descriptor format; Obtain the target message corresponding to the target description information, and perform unloading processing on the target message to obtain an unloading message; The step of obtaining the target descriptor and its descriptor format includes: receiving the target descriptor through a port bound to the network device via the offloading device; obtaining the port attributes of the port and determining a register group identifier based on the port attributes; reading the descriptor format from multiple register groups of the offloading device based on the register group identifier, each of the multiple register groups storing a corresponding descriptor format; or, receiving the target descriptor from a port bound to a format conversion device on the offloading device and obtaining a pre-set descriptor format on the offloading device, wherein the target descriptor is obtained by the format conversion device processing the original descriptor sent by the network device, and the descriptor format includes a data cache base address or a data field offset.
2. The method according to claim 1, characterized in that, Also includes: The message to be processed is loaded to obtain the loaded message; The loading message is stored in the shared memory of the unloading device and the network device; According to the descriptor format of the target descriptor, the first description information of the loaded message in the shared memory is encapsulated into a first descriptor; The first descriptor is sent to the network device through the port bound to the network device by the unloading device. The first descriptor is used by the network device to obtain the load message in the shared memory.
3. The method according to claim 1, characterized in that, The step of obtaining the target message corresponding to the target description information includes: The target packet corresponding to the target description information is searched in the shared memory of the format conversion device and the offloading device. The target packet is stored in the shared memory by the format conversion device or the network device. And / or, The data packet processing method further includes: The message to be processed is loaded to obtain the loaded message; The loading message is stored in the shared memory of the unloading device and the format conversion device; According to the descriptor format of the original descriptor, the second description information of the loaded message in the shared memory is encapsulated into a second descriptor; The second descriptor is sent to the format conversion device through the port bound to the unloading device and the format conversion device. The second descriptor is used by the format conversion device or the network device to obtain the load message in the shared memory.
4. A data message processing method, characterized in that, Used in format conversion devices, including: Receive raw descriptors sent by network devices; The original descriptor is converted into a target descriptor according to a pre-set descriptor format; The target descriptor is forwarded to the unloading device so that the unloading device can obtain the target descriptor and the descriptor format of the target descriptor, and parse the target description information in the target descriptor according to the descriptor format; The step of obtaining the target descriptor and its descriptor format includes: receiving the target descriptor through a port bound to the network device via the offloading device; obtaining the port attributes of the port and determining a register group identifier based on the port attributes; reading the descriptor format from multiple register groups of the offloading device based on the register group identifier, each of the multiple register groups storing a corresponding descriptor format; or, receiving the target descriptor from a port bound to a format conversion device on the offloading device and obtaining a pre-set descriptor format on the offloading device, wherein the target descriptor is obtained by the format conversion device processing the original descriptor sent by the network device, and the descriptor format includes a data cache base address or a data field offset.
5. The method according to claim 4, characterized in that, The step of converting the original descriptor into a target descriptor according to a pre-set descriptor format includes: The original description information is parsed from the original descriptor; The original message corresponding to the original description information is retrieved from the shared memory of the network device and the format conversion device; The original message is stored in the shared memory of the format conversion device and the offloading device to obtain the target message; According to the descriptor format, the original description information is converted into target description information corresponding to the target message, and the target description information is encapsulated into the target descriptor; or, The original description information is parsed from the original descriptor; According to the descriptor format, the original description information is converted into target description information, and the target description information is encapsulated into the target descriptor.
6. The method according to claim 4, characterized in that, The format conversion device is a virtual device; And / or, the forwarding of the target descriptor to the offloading device includes: The target descriptor is stored in a descriptor queue, which is used by the offloading device to retrieve the target descriptor.
7. A data message processing system, characterized in that, include: Network equipment and offloading equipment; The offloading device is used to obtain the target descriptor and the descriptor format of the target descriptor, and parse the target description information in the target descriptor according to the descriptor format. The target descriptor is sent by the network device. The unloading device is also used to obtain the target message corresponding to the target description information, and to perform unloading processing on the target message to obtain an unloading message; The step of obtaining the target descriptor and its descriptor format includes: receiving the target descriptor through a port bound to the network device via the offloading device; obtaining the port attributes of the port and determining a register group identifier based on the port attributes; reading the descriptor format from multiple register groups of the offloading device based on the register group identifier, each of the multiple register groups storing a corresponding descriptor format; or, receiving the target descriptor from a port bound to a format conversion device on the offloading device and obtaining a pre-set descriptor format on the offloading device, wherein the target descriptor is obtained by the format conversion device processing the original descriptor sent by the network device, and the descriptor format includes a data cache base address or a data field offset.
8. The system according to claim 7, characterized in that, The network device is used to send the target descriptor to the offloading device through the port bound to the network device. The offloading device is also used to receive the target descriptor through the port bound to the network device; The unloading device is also used to obtain the port attributes of the port and determine the register group identifier based on the port attributes; The unloading device is further configured to filter the descriptor format from multiple register groups of the unloading device according to the register group identifier, wherein each register group stores a corresponding descriptor format; And / or, The unloading device is also used to load the message to be processed to obtain a loaded message; The offloading device is also used to store the loading message in a shared memory between the offloading device and the network device; The unloading device is further configured to encapsulate the first description information of the loading message in the shared memory into a first descriptor according to the descriptor format of the target descriptor; The unloading device is further configured to send the first descriptor to the network device through the port bound to the network device, the first descriptor being used by the network device to obtain the load message in the shared memory.
9. The system according to claim 7, characterized in that, The system also includes: a format conversion device; The offloading device is also configured to receive the target descriptor from the port bound to the format conversion device on the offloading device, and obtain the descriptor format preset on the offloading device. The target descriptor is obtained by the format conversion device processing the original descriptor sent by the network device.
10. The system according to claim 9, characterized in that, The system also includes: shared memory; The offloading device is further configured to locate the target packet corresponding to the target description information in the shared memory of the format conversion device and the offloading device, wherein the target packet is stored in the shared memory by the format conversion device or the network device; And / or, The unloading device is also used to load the message to be processed to obtain a loaded message; The unloading device is also used to store the loaded message in a shared memory between the unloading device and the format conversion device; The unloading device is further configured to encapsulate the second description information of the loaded message in the shared memory into a second descriptor according to the descriptor format of the original descriptor; The unloading device is further configured to send the second descriptor to the format conversion device through the port bound to the format conversion device, the second descriptor being used by the format conversion device to obtain the load message in the shared memory.
11. An electronic device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when executed by the processor, perform the method as described in any one of claims 1 to 6.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Data processing method and device and computer storage medium
CN114710572A
Network and edge acceleration tile (NEXT) architecture
CN115516832A