Unmanned Vehicle Data Distribution Method Based on Fast Data Path Processing

By employing XDP and eBPF with zero-copy data transfers, the method addresses performance bottlenecks in DDS, enhancing latency and throughput for distributed real-time applications.

CN118869634BActive Publication Date: 2025-07-15ZHEJIANG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411354175.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-07-15
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

The existing DDS implementations have problems such as triggering interrupts, memory copying and context switching in network packet processing, resulting in insufficient performance and difficult to meet the needs of modern network communication middleware.

Method used

The fast data path XDP technology is used to process the early stage of data packet reception, combined with eBPF and UMEM mechanisms to achieve zero-copy data transmission, and the encapsulation, filtering and decomposition of data packets is completed in the user state, bypassing the kernel protocol stack, and optimizing CPU efficiency and memory usage.

Benefits of technology

Significantly improve DDS communication performance, reduce latency, increase throughput, improve data processing efficiency, and adapt to the needs of modern network communication middleware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118869634B_ABST
    Figure CN118869634B_ABST
Patent Text Reader

Abstract

The present invention discloses an unmanned vehicle data distribution method based on fast data path processing. Based on the fast data path processing module, packets are captured before they are received in the operating system kernel space; packets belonging to data distribution are verified through the fast data path processing module and forwarded from the kernel state to the user state; the program compiled by the fast data path processing module is loaded into the operating system kernel and mounted on a specified network interface; the user memory mapping mechanism of the fast data path processing module is utilized to create memory in the user state for data transmission between the kernel state program and the user state program; application programs are deployed in the user space, and data exchange is performed with the fast data path program in the kernel space through user memory mapping to receive and process packets; the communication process specified by the data distribution service protocol is processed in the user space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer network communication, and particularly relates to a method for distributing unmanned vehicle data based on fast data path processing. Background Art

[0002] Many distributed real-time applications, such as aerospace, air traffic control, and autonomous driving, require a data-centric middleware with quality of service (QoS). This middleware should provide the required data for the application and ensure the real-time and reliable data transmission. To meet these requirements, the Object Management Group (OMG) proposed the Data Distribution Service (DDS) specification to define the basic architecture of such middleware, which has now been widely recognized in the design of distributed real-time applications.

[0003] Existing DDS implementations (such as FastDDS, OpenDDS, and Cyclone DDS) often use the network communication interfaces provided by the operating system to receive and send network data packets. This means that the data packet processing will pass through the network protocol stack of the operating system. For a DDS implementation running in the user space to receive a network data packet, it needs to experience triggering an interrupt, memory copying, and system calls to obtain data from the network card, which will have a great impact on the performance of DDS and is difficult to meet the requirements of modern networks for communication middleware. Therefore, if the triggering of interrupts, memory copying, and context switching between the kernel space and the user space can be reduced, the performance of DDS will be increased to a great extent.

[0004] The Express Data Path (XDP) is a high-performance and programmable network data packet processing framework provided by the Linux kernel. It allows high-speed processing of network data packets when they reach the network card driver layer, bypassing the traditional TCP / IP protocol stack, thereby reducing the overhead of system calls and context switching.

[0005] Many existing studies have used avoiding network data packets from entering the kernel network protocol stack as a means to improve performance. Patent CN118055068A uses DPDK technology for kernel bypass packet processing, which utilizes the kernel bypass of DPDK to achieve the purpose of fast packet processing. Patent CN117527973A proposes a method and device for high-speed packet forwarding using XDP technology, which uses XDP technology to perform high-speed forwarding of network data packets. This method utilizes the characteristic that XDP can process network data packets before they reach the kernel protocol stack to preprocess network data packets to achieve the purpose of improving performance, but it has not been applied to the DDS protocol. Therefore, applying XDP to DDS will be able to improve the performance of DDS, such as latency and throughput. Summary of the Invention

[0006] To solve the deficiencies of the prior art and implement a more high-performance DDS protocol to better adapt to modern network communication middleware, the present invention adopts the following technical solutions:

[0007] An autonomous vehicle data distribution method based on fast data path processing, comprising the following steps:

[0008] Step S1: Based on the fast data path XDP processing module, capture the data packet before it is received by the network protocol stack in the kernel space of the operating system, so as to perform subsequent processing on it through the XDP processing module at the early stage of data packet reception;

[0009] Step S2: Through the fast data path XDP processing module, verify the data packets belonging to data distribution and forward them from the kernel state to the user state;

[0010] Step S3: Use the corresponding instructions provided by the eBPF (extended Berkeley Packet Filter) tool to load the compiled XDP program of the fast data path XDP processing module into the Linux kernel of the operating system and mount it on the specified network interface card (NIC), so as to complete efficient processing at the early stage of data packet reception;

[0011] Step S4: Using the User Memory Mapping (UMEM) mechanism of the Fast Data Path XDP processing module, create a block of memory in the user space for data transfer between the kernel-space program and the user-space program, aiming to achieve zero-copy, thereby reducing the number of packet copies during processing and optimizing the CPU operation efficiency; by tightly integrating the user-space memory and the kernel-space memory through UMEM, the present invention enables direct processing of packets in the buffer of the user space without additional data copy operations. This design not only reduces the CPU usage rate but also decreases the memory occupancy, enabling the system to handle more concurrent data streams;

[0012] Step S5: Deploy an application using AF_XDP in the user space, and exchange data with the Fast Data Path XDP program in the kernel space through the User Memory Mapping UMEM, receiving and processing packets from the Fast Data Path XDP program; XDP and AF_XDP cross the kernel protocol stack through the User Memory Mapping UMEM and XDP_MAP, and exchange data between the kernel and the user space through TXRING, RX RING, FILL RING, and COMPLETION RING to avoid system calls, enabling packet encapsulation, filtering, and decomposition to be completed in the user space;

[0013] Step S6: Process the communication process specified by the Data Distribution Service DDS protocol in the user space.

[0014] Further, in the step S2, the Fast Data Path XDP processing module constructs a whitelist based on the IP address, verifies the captured packets according to the whitelist, performs fast receive path operations on the packets belonging to the Data Distribution Service DDS protocol, and forwards the packets to the AF_XDP socket in the user space.

[0015] Further, discard the packets outside the whitelist, and for the packets within the whitelist that do not belong to the data distribution service protocol, let them pass through the operating system kernel protocol stack for packet reception.

[0016] Further, in the step S5, use the TCP / IP protocol to parse the packets, and according to the requirements of the Data Distribution Service DDS protocol, encapsulate the data into the corresponding message format. This step not only includes the processing of the data payload but also involves data serialization and deserialization, as well as the implementation of the data distribution strategy. The present invention ensures the accuracy of the data and the reliability of the transmission by optimizing the data parsing and encapsulation process; in the step S6, parse the Data Distribution Service DDS protocol of the packets and perform the corresponding data distribution service processing, including dynamic service discovery, topic creation, publisher creation, subscriber creation, message transmission, etc.

[0017] Further, in step S6, the communication of the data distribution service is divided into service discovery and data transmission, and the user-space packet processing in these two stages is implemented separately at the application layer;

[0018] In the service discovery stage, each service provides its own information and topic information, and performs service discovery through the participant discovery stage and the endpoint discovery stage;

[0019] In the data transmission stage, the requester uses the service provider information obtained from the discovery stage, encapsulates the serialized data, and sends it to the send queue of the network card;

[0020] When the service provider receives the data packet, it unpacks it in the user space and provides services according to the corresponding parameters.

[0021] Further, in step S5, the user-space data distribution service DDS protocol implements all the contents specified by the data distribution service DDS protocol for DDS protocol transmission. At the same time, it adapts to the user-space AF_XDP socket and the operating system socket. The user-space AF_XDP socket and the operating system socket will send the data packet parsed by the TCP / IP protocol stack to the protocol implementation of the data distribution service DDS, and then the protocol implementation of the data distribution service DDS will parse the data distribution service DDS protocol in the data packet.

[0022] Further, in step S1, after the network interface card receives the data packet, it operates on the RX_RING buffer before allocating SK_BUFF, so that the network protocol stack of the operating system can capture the data packet through the fast data path XDP processing module before receiving the data packet.

[0023] Further, in step S3, using the eBPF tool, the compiled XDP program of the fast data path XDP processing module is mounted into the eBPF virtual machine. The eBPF is responsible for verifying and running the XDP program to ensure that it will not affect the stable operation of the kernel, and automatically executes the fast data path XDP processing during the data packet reception process.

[0024] Further, in step S5, multiple AF_XDP applications correspond to a single user memory mapping UMEM to reduce the probability of CPU cache misses and the performance degradation caused by lock contention between different AF_XDPs in the same UMEM. Whether it is RX RING or TX RING, it will not fall into the race condition of UMEM, avoiding lock contention.

[0025] Furthermore, in step S5, on a multi-core CPU, threads being scheduled to other physical cores often leads to CPU cache misses and other additional overheads. Therefore, this method constructs a CPU model exclusive to a thread and uses CPU affinity to solve this problem. In the initialization stage, the thread is bound to a fixed CPU core and runs a specific function to interact with the fast data path XDP program, thereby avoiding contention for CPU resources and improving the parallelism of packet processing.

[0026] The advantages and beneficial effects of the present invention are as follows:

[0027] The method for distributing unmanned vehicle data based on fast data path processing proposed by the present invention combines eBPF, XDP, and DDS protocols, fully utilizes the characteristics of the XDP technology such as zero-copy and high-speed packet processing at the driver layer, designs a high-performance DDS implementation method on this basis, and further significantly improves DDS communication performance, reduces latency, increases throughput, and improves the efficiency of data processing by using the exclusivity design of AF_XDP, UMEM, and the CPU. Description of the Drawings

[0028] Figure 1 is a flowchart of the method in the present invention.

[0029] Figure 2 is a schematic diagram of the mounting of XDP in the kernel in the present invention.

[0030] Figure 3 is a flowchart of the XDP module's processing of packets in the present invention.

[0031] Figure 4 is a schematic diagram of the interaction between XDP and AF_XDP in the present invention.

[0032] Figure 5 is a relationship diagram between UMEM and AF_XDP in the present invention.

[0033] Figure 6 is a relationship diagram between XDP and DDS in the present invention. Detailed Embodiments

[0034] The following details the specific embodiments of the present invention with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for the purpose of illustrating and explaining the present invention, and are not intended to limit the present invention.

[0035] As Figure 1 shown, the method for distributing unmanned vehicle DDS data based on fast data path XDP processing includes the following steps:

[0036] Step S1: Use XDP (eXpress Data Path) technology to capture network packets in the kernel space;

[0037] Specifically, use an XDP program to capture and process packets before the operating system kernel network protocol stack receives them.

[0038] In the embodiment of the present invention, as Figure 2 shown, the XDP program is loaded into the eBPF virtual machine of the operating system kernel. eBPF is responsible for verifying and running the XDP program to ensure that it does not affect the stable operation of the kernel. After the network interface card receives a packet, it operates on the RX_RING buffer before allocating SK_BUFF. This design allows the XDP handler to process packets early in the packet reception process.

[0039] Step S2: Use the XDP processing module to perform environment initialization and preprocess the captured packets, including but not limited to routing, forwarding, and discarding;

[0040] Specifically, the XDP processing module includes: a rule configuration unit for defining and managing packet processing rules; a data processing unit for executing the processing rules defined by the rule configuration unit.

[0041] By setting instructions for packet processing rules, define the preprocessing logic of packets, such as forwarding decisions, packet dropping policies, and security checks; by executing instructions for packet forwarding, use XDP_REDIRCT to forward the packet from the kernel state to the user state; by executing instructions for packet dropping, use XDP_DROP to drop the packet; by executing instructions for sending the packet to the operating system kernel network protocol stack, use XDP_PASS to send the packet to the operating system kernel network protocol stack.

[0042] In the embodiment of the present invention, as Figure 3 shown, the IP address expected to be received is hard-coded in the XDP program, added to the whitelist, and the IP is verified when a packet is received. If the IP is not in the whitelist, the XDP program will perform the XDP_DROP action to drop this packet. If the IP is in the whitelist, the XDP program will verify whether the packet belongs to the DDS protocol. If it belongs to the DDS protocol, the packet will execute the fast reception path, that is, forward the packet to the AF_XDP socket in the user state by performing the XDP_REDIRECT action. This step is optimized for zero-copy through UMEM. For non-DDS packets received, they still go through the original operating system kernel protocol stack for the packet reception process. For this part of the packets, the XDP program will perform the XDP_PASS action.

[0043] Step S3: Use the corresponding instructions provided by the eBPF (extended Berkeley Packet Filter) tool to load the compiled XDP program of the XDP processing module into the Linux kernel and mount it to the specified network interface card (NIC).

[0044] Specifically, after executing Steps S1 and S2, an XDP program that performs different operations on different data packets is obtained. The loading function of the XDP program is used to initialize the XDP environment and configure the data packet processing rules. The processing function of the XDP program is used to perform the actual processing operations of the data packets. The unloading function of the XDP program is used to clean up the XDP environment and resources. The XDP program can perform efficient processing at the early stage of data packet reception. Use the eBPF tool to mount it into the eBPF virtual machine and automatically execute the receiving logic of XDP during the data packet reception process.

[0045] Step S4: Use the UMEM mechanism of XDP to create a piece of memory in the user space for data transfer between the kernel space program and the user space program to achieve the purpose of zero-copy and optimize the CPU operation efficiency.

[0046] By tightly integrating the user space memory and the kernel space memory through UMEM, the present invention realizes the direct processing of data packets in the buffer of the user space without additional data copy operations. This design not only reduces the CPU usage rate but also reduces the memory occupancy, enabling the system to handle more concurrent data streams.

[0047] Step S5: Deploy an application using AF_XDP in the user space to exchange data with XDP through UMEM for receiving and further processing the data packets from XDP.

[0048] Specifically, the application in the user space includes: a service discovery module for dynamically discovering DDS services in the network; a service proxy module for communicating with DDS services on behalf of the application; a data processing module for initializing AF_XDP, allocating UMEM, processing the data packets received from XDP, and executing the corresponding business logic.

[0049] Parse the data packets using the TCP / IP protocol and encapsulate the data into the corresponding message format according to the requirements of the DDS protocol. This step not only includes the processing of the data payload but also involves the serialization and deserialization of the data, as well as the implementation of the data distribution strategy. The present invention ensures the accuracy of the data and the reliability of the transmission by optimizing the data parsing and encapsulation process.

[0050] Create two ring queues, TX_RING and RX_RING, through AF_XDP; create a continuous virtual memory in the user space, and divide this virtual memory into frames of the same size; reference the frames in the virtual memory through offsets (addresses) in TX_RING and RX_RING; use the XDP_UMEM_REG option of the socket to register it to the part used by the kernel.

[0051] In the embodiment of the present invention, as Figure 4 shown, XDP and AF_XDP cross the kernel protocol stack through user memory mapping (UMEM) and XDP_MAP, and exchange data between the kernel and the user space through TX RING, RX RING, FILL RING, and COMPLETION RING to avoid system calls. In this way, the encapsulation, filtering, and decomposition of data packets can be completed in the user space. For the design of UMEM and AF_XDP, as Figure 5 shown, each AF_XDP corresponds to a separate UMEM to reduce the probability of CPU cache misses and the performance degradation caused by lock contention between different AF_XDPs in the same UMEM. In this solution, neither RX RING nor TX RING will fall into the race condition of UMEM, avoiding lock contention. In addition, on a multi-core CPU, threads being scheduled to other physical cores often causes CPU cache misses and other additional overheads. Therefore, this solution designs a CPU model exclusive to threads and uses CPU affinity to solve this problem. In the initialization stage, the thread is bound to a fixed CPU core and runs specific functions to interact with XDP. This method can avoid the contention of CPU resources and improve the parallelism of data packet processing.

[0052] Step S6: Implement the DDS protocol in the user space to handle the communication process specified by the DDS protocol;

[0053] Parse the part of the DDS protocol in the data packet and execute the corresponding DDS processing logic, including dynamic service discovery, topic creation, publisher creation, subscriber creation, message transmission, etc.

[0054] In the embodiment of the present invention, the communication of DDS is divided into two parts: service discovery and data transmission, and the user-state packet processing of these two stages is implemented at the application layer respectively. Specifically, in the service discovery stage, each service provides its own information and Topic information, and performs service discovery through the participant discovery stage and the endpoint discovery stage. In the data transmission stage, the requester uses the service provider information obtained from the discovery stage to encapsulate the serialized data and send it to the send queue of the network card. When the service provider receives the data packet, it unpacks it in the user space and provides services according to the corresponding parameters. AsFigure 6 As shown, the user-space DDS protocol implementation realizes all the contents specified by the DDS protocol for DDS protocol transmission. At the same time, it adapts to the AF_XDP socket and the operating system socket. The AF_XDP socket and the operating system socket will send the data packets parsed by the TCP / IP protocol stack to the DDS implementation, and then the DDS implementation will parse the DDS protocol in the data packets.

[0055] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. An unmanned vehicle data distribution method based on fast data path processing, characterized in that The steps are as follows: Step S1: Based on the fast data path processing module, capture the data packet before it is received in the operating system kernel space; Step S2: Through the fast data path processing module, verify the data packets belonging to data distribution, and forward them from the kernel state to the user state; Step S3: Load the program compiled by the fast data path processing module into the operating system kernel, and mount it on the specified network interface; Step S4: Utilize the user memory mapping mechanism of the fast data path processing module to create memory in the user state for data transmission between the kernel state program and the user state program; Step S5: Deploy the application program in the user space, exchange data with the fast data path program in the kernel space through user memory mapping, and receive and process data packets; Parse the data packets using the TCP / IP protocol, and according to the requirements of the data distribution service protocol, encapsulate the data into the corresponding message format, which not only includes the processing of the data payload, but also involves the serialization and deserialization of the data, as well as the implementation of the data distribution strategy; Multiple application programs correspond to a single user memory mapping; On a multi-core CPU, by constructing a CPU model exclusive to a thread, during the initialization phase, the thread is bound to a fixed CPU core and runs specific functions to interact with the fast data path program; Step S6: Process the communication process specified by the data distribution service protocol in the user space; Parse the data distribution service protocol of the data packet and perform the corresponding data distribution service processing; The communication of the data distribution service is divided into service discovery and data transmission, and the user-state packet processing of these two stages is implemented separately at the application layer; In the service discovery stage, each service provides its own information and topic information, and conducts service discovery through the participant discovery stage and the endpoint discovery stage; In the data transmission stage, the requester encapsulates the serialized data using the service provider information obtained from the discovery stage and sends it to the send queue of the network card; When the service provider receives the data packet, it unpacks it in the user space and provides services according to the corresponding parameters.

2. The method for distributing unmanned vehicle data based on fast data path processing according to claim 1, wherein: In the said Step S2, the fast data path processing module constructs a whitelist based on the IP address, verifies the captured data packets according to the whitelist, performs fast receive path operations on the data packets belonging to the data distribution service protocol, and forwards the data packets to the socket in the user state.

3. The method for distributing unmanned vehicle data based on fast data path processing according to claim 2, wherein: Discard the data packets outside the whitelist, and for the data packets within the whitelist that do not belong to the data distribution service protocol, let them pass through the operating system kernel protocol stack for data packet reception.

4. The method for distributing unmanned vehicle data based on fast data path processing according to claim 1, wherein: In the said Step S5, the data distribution service protocol in the user state implements all the contents specified by the data distribution service protocol for data distribution service protocol transmission. At the same time, it adapts the socket in the user state and the socket of the operating system. The socket in the user state and the operating system socket will send the data packets parsed by the TCP / IP protocol stack to the protocol implementation of the data distribution service, and then the protocol implementation of the data distribution service parses the data distribution service protocol in the data packet.

5. The method for distributing unmanned vehicle data based on fast data path processing according to claim 1, characterized in that: In the step S1, after the network interface receives a data packet, an operation is performed on the buffer before allocation, so that the network protocol stack of the operating system can capture the data packet through the fast data path processing module before receiving the data packet.

6. The method for distributing unmanned vehicle data based on fast data path processing according to claim 1, wherein: In the step S3, using the eBPF tool, the program compiled by the fast data path processing module is mounted into the eBPF virtual machine, and the fast data path processing is automatically executed during the data packet reception.

Citation Information

Patent Citations

  • XDP-based radio astronomical data real-time acquisition and processing method

    CN118612288A