Data distribution service network communication method, apparatus, device, medium, and vehicle

By filtering data packets in the network card's memory and directly acquiring them through socket channels, the inefficiency problem in DDS network communication is solved, achieving efficient data packet reception and transmission.

CN122248079APending Publication Date: 2026-06-19SHANGHAI LIXIANG AUTOMOBILE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI LIXIANG AUTOMOBILE CO LTD
Filing Date
2024-12-18
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In existing DDS network communication, the communication performance of performance-sensitive applications is affected by the shared protocol stack and data packet copying of other applications, resulting in reduced efficiency.

Method used

By receiving and filtering data packets in the network card's memory, and directly acquiring target data packets using socket channels, the full protocol stack processing is bypassed, reducing the steps and copying processes of data packets sharing the protocol stack.

🎯Benefits of technology

It improves the communication efficiency of data distribution service applications, reduces processing steps and copying times, avoids competition with other application messages, and enhances performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122248079A_ABST
    Figure CN122248079A_ABST
Patent Text Reader

Abstract

This application discloses a data distribution service network communication method, apparatus, device, medium, and vehicle, belonging to the field of data distribution service network communication technology. The method includes: receiving data packets and storing them in the network card memory; filtering the data packets to obtain target data packets; and a data distribution service application acquiring the target data packets through a socket channel. This method obtains target data packets after filtering the received data packets, and the data distribution service application acquires the target data packets through a socket channel. The received data packets only undergo filtering, without requiring complete protocol stack processing to obtain the data packets needed by the data distribution service application. It also eliminates the need to share the protocol stack with data packets from other applications, resulting in higher communication efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data distribution service network communication technology, and specifically to a data distribution service network communication method, apparatus, equipment, medium and vehicle. Background Technology

[0002] Data Distribution Service (DDS) network communication is a standard and protocol for data communication in real-time systems. It aims to provide a distributed, high-performance data exchange mechanism, allowing different parts of a software system to share real-time data over a network. DDS is widely used in fields requiring high performance and real-time capabilities.

[0003] In existing DDS network communication, User Datagram Protocol (UDP) or Transmission Control Protocol (TCP) are mostly used for communication, and TCP / UDP sockets are used for packet sending and receiving. These socket TCP / UDP packets go through the complete kernel protocol stack, including Media Access Control (MAC), Internet Protocol (IP), and TCP / UDP layer processing. These processing processes share the protocol stack with other applications, and other packets will affect performance-sensitive applications. Moreover, they undergo two copies from the network card to the kernel space and from the kernel space to the user space, which will affect the communication performance of performance-sensitive data distribution service applications. Summary of the Invention

[0004] The purpose of this application is to provide a data distribution service network communication method, apparatus, device, medium, and vehicle to solve the problem of reduced communication performance of performance-sensitive DDS applications in the case of multiple applications coexisting in the prior art.

[0005] To achieve the above objectives, the first aspect of this application provides a data distribution service network communication method, the data distribution service network communication method comprising:

[0006] Receive data packets and store them in the network card's memory;

[0007] The data packets are filtered to obtain the target data packets;

[0008] The data distribution service application obtains the target data packet through the socket channel.

[0009] According to the above technical means, the data packets received by this method are filtered to obtain the target data packets. The data distribution service application obtains the target data packets through the socket channel. The received data packets are only filtered and do not need to go through the complete protocol stack processing to obtain the data packets that the data distribution service application needs to receive. There is no need to share the protocol stack with the data packets of other applications, resulting in higher communication efficiency.

[0010] In some feasible embodiments, the network card memory is shared network card memory, and the filtering of the data packets to obtain the target data packets includes:

[0011] Read data packets from the network interface card's shared memory, perform Layer 2 processing, and delete data packets from the network interface card's shared memory that the current device does not need to receive.

[0012] The remaining data packets are read from the shared memory of the network card, filtered according to rules, and data packets that do not conform to the rules in the shared memory of the network card are deleted to obtain the target data packet.

[0013] Based on the aforementioned technical means, when the network card supports direct memory access, setting the network card memory as shared memory allows direct reading of data packets from the shared memory for Layer 2 processing and rule filtering. Layer 2 processing filters out data packets that the current device does not need to receive, while rule filtering filters out data packets that do not conform to the receiving rules of the data distribution service application. There is no need to copy data packets from the network card to the kernel space for filtering; data packet filtering can be achieved simply by accessing the network card memory. The filtering process uses rule filtering, bypassing the processing of the network protocol stack, reducing processing steps, and eliminating the need to share the protocol stack with data packets from other applications, thus improving data packet receiving efficiency.

[0014] In some feasible embodiments, the data distribution service application obtains the target data packet through a socket channel, including:

[0015] The data distribution service application reads the target data packet from the network card's shared memory through the socket channel.

[0016] Based on the above technical means, the data distribution service application can directly read target data from the network card's shared memory through the socket channel. This means that the data packets are not copied during the process from when the network card receives the data packets to when the data distribution service application reads the data packets. The data distribution service application can read the data packets simply by accessing the network card's memory.

[0017] In some feasible embodiments, filtering the data packets to obtain the target data packets includes:

[0018] Copy the data packet from the network card memory to the kernel memory;

[0019] Read the data packet from the kernel memory, perform Layer 2 processing, and delete data packets from the kernel memory that the current device does not need to receive;

[0020] The remaining data packets are read from the kernel memory, filtered according to rules, and data packets that do not conform to the rules in the kernel memory are deleted to obtain the target data packet.

[0021] Based on the above technical means, when the network card does not support direct memory access, it is necessary to copy the data packets from the network card memory to the kernel memory, and then read the data packets from the kernel memory for Layer 2 processing and rule filtering. Layer 2 processing filters out data packets that the current device does not need to receive, and rule filtering can filter out data packets that do not conform to the receiving rules of the data distribution service application. The filtering process uses rule filtering, which avoids the processing of the network protocol stack, reduces the processing steps, and does not need to share the protocol stack with data packets of other applications, thus improving the efficiency of data packet reception.

[0022] In some feasible embodiments, the data distribution service application obtains the target data packet through a socket channel, including:

[0023] The target data packet is copied from the kernel memory to the user space memory via a socket channel;

[0024] The data distribution service application retrieves the target data packet from the user space memory.

[0025] Based on the above technical means, the target data packet is copied from kernel memory to user space memory through the socket channel, reducing the impact of other application packets and reducing the number of uploading steps.

[0026] In some feasible embodiments, the kernel memory is kernel shared memory;

[0027] The data distribution service application obtains the target data packet through a socket channel, including:

[0028] The data distribution service application reads the target data packet from the kernel shared memory through a socket channel.

[0029] Based on the above technical means, the data distribution service application can read target data directly from the kernel shared memory through the socket channel, which can reduce the copying from kernel memory to user space memory, reduce the impact of other application messages, and improve the data distribution service application's message receiving performance.

[0030] In some feasible embodiments, the socket channel includes a PF_PACKET socket channel or a PF_RING socket channel.

[0031] Based on the above technical means, using PF_PACKET socket channels or PF_RING socket channels to receive packets eliminates the need for the filtering process to go through the protocol stack, saving the network protocol stack's packet processing time and avoiding competition with other application packets.

[0032] In some feasible embodiments, receiving the data packet includes:

[0033] Data packets are received based on occupied communication resources, which are occupied through socket pairs;

[0034] The socket pairs include: socket pairs consisting of PF_PACKET sockets and User Datagram Protocol (UDP) sockets, socket pairs consisting of PF_PACKET sockets and Transmission Control Protocol (TCP) sockets, socket pairs consisting of PF_RING sockets and UDP sockets, or socket pairs consisting of PF_RING sockets and TCP sockets.

[0035] Based on the above technical means, socket pairs are used to occupy communication resources to receive data packets, and this is interoperated with the existing communication resource occupation of User Datagram Protocol (UDP) sockets or Transmission Control Protocol (TCP) sockets in the system to achieve compatible occupation of communication resources and avoid receiving messages from other applications.

[0036] A second aspect of this application provides a data distribution service network communication method, the data distribution service network communication method comprising:

[0037] The data distribution service application stores the data packets to be sent in the shared memory of the network card through the socket channel, and sends the data packets to be sent in the shared memory of the network card through the network card;

[0038] Alternatively, the data distribution service application stores the data packets to be sent in the kernel shared memory through the socket channel, copies the data packets to be sent from the kernel shared memory to the network card memory, and sends the data packets to be sent from the network card memory through the network card;

[0039] Alternatively, the data distribution service application stores the data packets to be sent in user space memory, copies the data packets to be sent from the user space memory to kernel memory through a socket channel, copies the data packets to be sent from the kernel memory to the network card memory, and sends the data packets to be sent from the network card memory through the network card.

[0040] Based on the above technical methods, when the network interface card (NIC) supports direct memory access, the data packets to be sent only need to be stored in the NIC's shared memory. The NIC can then obtain and send the data packets, reducing two copy operations, minimizing system overhead, and improving system efficiency. When the NIC does not support direct memory access, but the kernel supports shared memory, the data packets to be sent only need to be stored in the kernel's shared memory, and then copied from the kernel's shared memory to the NIC's memory. The NIC can then obtain and send the data packets, reducing one kernel copy operation, minimizing system overhead, and improving system efficiency. When the NIC does not support direct memory access and the kernel does not support shared memory, the data packets to be sent need to be stored in user space memory, and then copied twice to the NIC's memory. The NIC can then obtain and send the data packets. All three methods use socket channels for data packet transmission, eliminating the need for the complete network protocol stack, thus improving transmission efficiency.

[0041] In some feasible embodiments, the socket channel includes a PF_PACKET socket channel or a PF_RING socket channel.

[0042] Based on the above technical means, using PF_PACKET socket channels or PF_RING socket channels to send messages avoids competition with other application messages.

[0043] In some feasible embodiments, the network card sends the data packet to be sent by occupying communication resources, and the communication resources are occupied by socket pairs;

[0044] The socket pairs include: socket pairs consisting of PF_PACKET sockets and User Datagram Protocol (UDP) sockets, socket pairs consisting of PF_PACKET sockets and Transmission Control Protocol (TCP) sockets, socket pairs consisting of PF_RING sockets and UDP sockets, or socket pairs consisting of PF_RING sockets and TCP sockets.

[0045] Based on the above technical means, socket pairs are used to send data packets using the communication resources they occupy, and this is integrated with the existing communication resource occupancy in the system that uses User Datagram Protocol (UDP) sockets or Transmission Control Protocol (TCP) sockets, so as to achieve compatible occupancy of communication resources.

[0046] A third aspect of this application provides a data distribution service network communication apparatus, the apparatus comprising:

[0047] A network interface card (NIC) is used to receive data packets and store the received data packets in its memory; or to acquire and send data packets to be sent.

[0048] The processing unit is used to filter the received data packets to obtain the target data packets;

[0049] A socket channel is used to provide a channel for a data distribution service application to obtain the target data packet, or to provide a channel for a network interface card to obtain the data packet to be sent from a data distribution service application.

[0050] According to the above technical means, the data packets received by the device are filtered to obtain the target data packets. The data distribution service application obtains the target data packets through the socket channel. The received data packets are only filtered and do not need to go through the complete protocol stack processing to obtain the data packets that the data distribution service application needs to receive. There is no need to share the protocol stack with the data packets of other applications, avoiding competition with the messages of other applications, and the communication efficiency is higher.

[0051] A fourth aspect of this application provides an electronic device, comprising:

[0052] The memory is configured to store instructions; and

[0053] The processor is configured to retrieve the instructions from the memory and, when executing the instructions, to implement the data distribution service network communication method, or to implement the data distribution service network communication method.

[0054] The fifth aspect of this application provides a vehicle including a control system, wherein the control system applies the data distribution service network communication method described above, or applies the data distribution service network communication method described above.

[0055] A sixth aspect of this application provides a machine-readable storage medium storing instructions that cause a machine to perform the data distribution service network communication method, or to perform the data distribution service network communication method.

[0056] A seventh aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the data distribution service network communication method, or implements the data distribution service network communication method.

[0057] Through the above technical solution, the method of this application obtains the target data packet after filtering the received data packet. The data distribution service application obtains the target data packet through the socket channel. The received data packet only needs to be filtered and does not need to go through the complete protocol stack processing to obtain the data packet that the data distribution service application needs to receive. It does not need to share the protocol stack with the data packets of other applications, and the communication efficiency is higher.

[0058] Other features and advantages of the embodiments of this application will be described in detail in the following detailed description section. Attached Figure Description

[0059] The accompanying drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the following detailed description to explain the embodiments of this application, but do not constitute a limitation on the embodiments of this application. In the drawings:

[0060] Figure 1 The illustration shows a flowchart of a data distribution service network communication method according to an embodiment of this application;

[0061] Figure 2 This illustration schematically shows the architecture diagram upon which the data distribution service network communication method provided in Embodiment 1 of this application is based;

[0062] Figure 3 This illustration shows a schematic diagram of the data distribution service network communication method provided in Embodiment 1 of this application;

[0063] Figure 4 This illustration shows a schematic diagram of communication address occupancy in the data distribution service network communication method provided in this application;

[0064] Figure 5 This illustration schematically shows the architecture diagram upon which the data distribution service network communication method provided in Embodiment 2 of this application is based;

[0065] Figure 6 This illustration shows a schematic diagram of the data distribution service network communication method provided in Embodiment 2 of this application;

[0066] Figure 7 This schematic diagram illustrates the architecture of the data distribution service network communication method provided in Embodiment 3 of this application;

[0067] Figure 8 This illustration shows a schematic diagram of the data distribution service network communication method provided in Embodiment 3 of this application;

[0068] Figure 9 This illustration shows a schematic diagram of the data distribution service network communication method provided in Embodiment 4 of this application;

[0069] Figure 10 This illustration shows a schematic diagram of the data distribution service network communication method provided in Embodiment 5 of this application;

[0070] Figure 11 This illustration shows a schematic diagram of the network communication method for data distribution services provided in Embodiment Six of this application;

[0071] Figure 12 The schematic diagram illustrates the structure of a data distribution service network communication device according to an embodiment of this application.

[0072] Explanation of reference numerals in the attached figures

[0073] 100 - Socket channel, 200 - Processing unit, 300 - Network interface card. Detailed Implementation

[0074] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only for illustration and explanation of the embodiments of this application and are not intended to limit the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0075] It should be noted that if the embodiments of this application involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of the components in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.

[0076] Furthermore, if the embodiments of this application involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed in this application.

[0077] Terminology Explanation:

[0078] DDS (Data Distribution Service) is a middleware-oriented specification defined by the Object Management Group (OMG). It provides an efficient, scalable, real-time, and subscription-based data distribution mechanism, particularly suitable for data communication and exchange in real-time and large-scale systems.

[0079] UDP (User Datagram Protocol) is a connectionless transport layer protocol that allows applications to send messages encapsulated in IP packets between hosts.

[0080] TCP (Transmission Control Protocol): It is a connection-oriented, reliable, byte-stream-based transport layer communication protocol used to establish reliable sessions between two hosts in a network and ensure the correct and orderly transmission of data.

[0081] IP (Internet Protocol): The Internet Protocol is a set of rules or standards used to transmit data between networks.

[0082] MAC (Media Access Control Address): Also known as a LAN address, Ethernet address, hardware address, or physical address. A MAC address is used to uniquely identify a network interface card (NIC) within a network.

[0083] DMA (Direct Memory Access): Direct memory access is a feature provided by some computer bus architectures that allows data to be sent directly from an external device (such as a disk drive) to the computer's motherboard memory.

[0084] Figure 1 This illustration schematically depicts a flowchart of a data distribution service network communication method according to an embodiment of this application. This method can be applied to terminal devices that include data distribution service applications, such as in-vehicle systems, smartphones, PDAs, tablets, laptops, all-in-one computers, and autonomous driving devices. It is understood that the data distribution service network communication method provided in this disclosure can also be applied to other scenarios.

[0085] like Figure 1 As shown in the figure, this application provides a data distribution service network communication method, which includes:

[0086] S01: Receives data packets and stores them in the network card's memory. A data packet is a unit of data transmitted in a computer network, typically containing the address information of the sender and receiver. A network card (NIC) is a piece of computer hardware designed to allow computers to communicate on a computer network. It enables users to connect to each other via cable or wirelessly. The NIC contains a processor and memory (including RAM and ROM). Communication between the NIC and the local area network (LAN) is done serially via cable or twisted pair. Communication between the NIC and the computer is done in parallel via the I / O bus on the computer motherboard. Therefore, a crucial function of the NIC is to perform serial-to-parallel conversion. Because the data rate on the network and the data rate on the computer bus are different, the NIC must contain a memory chip to buffer the data.

[0087] In this embodiment, the network interface card (NIC) is a key hardware component for communication between the device and the computer network. During data reception, the NIC receives data packets from the network based on communication resources and stores the data packets in its memory. In this embodiment, communication resources include Internet Protocol (IP) addresses and port numbers. An IP address is a unified address format provided by the Internet Protocol (IP) to assign a logical address to every network and every host on the Internet, thereby masking differences in physical addresses and guiding the direction of data packet transmission and reception. A port number is an identifier for an application to communicate and send / receive data with the outside world; each program running on the same device will have a port number. In this embodiment, the port number is the port number corresponding to the data distribution service application.

[0088] These communication resources are occupied using socket pairs. Other applications use traditional TCP / UDP sockets to occupy communication addresses when sending and receiving data packets. In order to achieve compatibility between the data distribution service application and other applications, it is necessary to establish the association between the PF_PACKET socket or PF_RING socket and the TCP / UDP socket. Therefore, the PF_PACKET socket or PF_RING socket is paired with the corresponding TCP / UDP socket to occupy communication resources and receive data packets through the occupied communication resources.

[0089] For example, assuming that TCP socket A and PF_PACKET socket A' are a socket pair, and TCP socket A occupies the IP address 221.xxx.xxx.98 and the PORT address 1xx5, then data packets received through IP address 221.xxx.xxx.98 and PORT address 1xx5 need to be read or copied through the channel corresponding to PF_PACKET socket A'.

[0090] S02: Filter the data packets to obtain target data packets. In this embodiment, filtering includes layer 2 processing and rule-based filtering. Layer 2 processing determines whether a data packet should be received on the current device, mainly performing destination address filtering and other processing. Rule-based filtering mainly filters the remaining data packets after layer 2 processing based on configuration rules, removing data packets that do not conform to the filtering rules and retaining those that do. These data packets that conform to the filtering rules are the target data packets that need to be processed by the data distribution service application.

[0091] In this embodiment, a packet filter is used for rule-based filtering. In some feasible embodiments, the packet filter is a Berkeley Packet Filter (BPF), which provides the transmission and reception of raw link-layer packets. The BPF filter supports "filtering" packets, allowing "interesting" packets to be passed to upper-layer software, avoiding the copying of other packets from the operating system kernel space to user space, thereby reducing CPU load and packet loss rate. The filtering function of the BPF filter is implemented through its built-in BPF virtual machine machine language interpreter. Programs in this language can capture packet data, perform arithmetic operations on the data in the packets, and decide whether to accept or reject the packets based on the comparison results.

[0092] S03: The data distribution service application obtains the target data packet through the socket channel. In this embodiment, the socket channel refers to a channel composed of stackless sockets. In this application, a stackless socket refers to a socket whose processing does not go through a protocol stack, such as a PF_PACKET socket and a PF_RING socket. Once the data distribution service application obtains the target data packet, it has completed the transmission of the data packet from the sending object (the server or application sending the data packet at the other end of the network) to the target object (the data distribution service application of the current device), completing one round of communication. After obtaining the target data packet, the data distribution service application can then parse and process the data packet.

[0093] The data packets received by the above method are filtered to obtain the target data packets. The data distribution service application obtains the target data packets through the socket channel. The received data packets are only filtered and do not need to go through the complete protocol stack processing to obtain the data packets that the data distribution service application needs to receive. There is no need to share the protocol stack with the data packets of other applications, so the communication efficiency is higher.

[0094] Example 1

[0095] Figure 2This diagram illustrates the architecture of a data distribution service network communication method according to one embodiment of this application. In this embodiment, the network interface card (NIC) used by the device supports direct memory access. Under this architecture, the communication path of received data packets from the NIC to user space includes: NIC packet queues, packet filters, and socket channels. The packet filters can directly read data packets from the NIC packet queue. The data distribution service application can read target data packets from the NIC packet queue through the socket channels. The data packets are mapped from the NIC buffer to the kernel buffer and user buffer by the NIC packet queue. This eliminates the need for the kernel to copy data packets, freeing up some kernel space and improving system efficiency.

[0096] The data distribution service network communication method of this application is as follows: Figure 3 As shown, it includes the following steps:

[0097] S201: Receive data packets and store them in the network interface card (NIC) shared memory. In this embodiment, the NIC shared memory can be memory based on the NIC packet receiving queue. If the NIC supports direct memory access, the NIC packet receiving queue supports direct access by the kernel processing unit and user-space applications. Data packets received by the NIC from the network are stored in the NIC packet receiving queue.

[0098] S202: Filter the data packet to obtain the target data packet. After receiving a data packet, the network card stores it in the network card's shared memory and then notifies the kernel that the data packet has been received. If the network card supports direct memory access, the Layer 2 processing module and BPF filter in the kernel space can directly read the data packet from the network card's shared memory. Based on this, the data packet is filtered to obtain the target data packet, specifically including:

[0099] Data packets are read from the network card's shared memory and processed using Layer 2. Data packets that the current device does not need to receive are deleted from the network card's shared memory. Layer 2 processing includes media access control address filtering and other processing. Layer 2 processing is used to determine whether the data packets in the network card's shared memory are ones that the current device needs to receive. If not, the corresponding data packets are deleted from the network card's shared memory.

[0100] The remaining data packets are read from the network interface card's shared memory, and rule-based filtering is performed. Data packets that do not conform to the rules in the network interface card's shared memory are deleted, resulting in the target data packet. Rule-based filtering mainly relies on configured rules to filter the remaining data packets in the network interface card's shared memory after Layer 2 processing, deleting data packets that do not conform to the filtering rules and retaining data packets that do conform to the filtering rules.

[0101] In another feasible embodiment, data packets can be read from the network interface card's shared memory for continuous Layer 2 processing and rule filtering. Specifically, data packets are read from the network interface card's shared memory for Layer 2 processing. If the Layer 2 processing determines that the data packet is not needed by the current device, the corresponding data packet is deleted. If the data packet is determined to be needed by the current device, rule filtering continues on the read data packets, without needing to read data packets from the network interface card's shared memory again. Thus, when the network interface card supports direct memory access, setting the network interface card's memory as shared memory allows data packets to be read directly from the shared memory for Layer 2 processing and rule filtering. Layer 2 processing filters out data packets that the current device does not need to receive, and rule filtering filters out data packets that do not conform to the receiving rules of the data distribution service application. There is no need to copy data packets from the network interface card to the kernel space for filtering; data packet filtering can be achieved simply by accessing the network interface card's memory. The filtering process uses rule filtering, bypassing the processing of the network protocol stack, reducing processing steps, and eliminating the need to share the protocol stack with data packets from other applications, thereby improving data packet receiving efficiency.

[0102] S203: The data distribution service application reads the target data packet from the network interface card's shared memory via a socket channel. When the network interface card supports direct memory access, the data distribution service application directly reads the target data packet from the network interface card's shared memory via a socket channel. This allows the data packet to be read directly without copying during the process from when the network interface card receives the data packet to when the data distribution service application reads it; the data distribution service application can read the data packet simply by accessing the network interface card's memory.

[0103] In some feasible embodiments, the socket channel includes a PF_PACKET socket channel or a PF_RING socket channel. A PF_PACKET socket is a mechanism in Linux systems used to directly send and receive data frames at the data link layer. PF_PACKET sockets allow users to directly manipulate network packets in user space without going through the kernel's network stack, making them very useful in network monitoring, testing, and development. In the embodiments of this application, using a PF_PACKET socket allows a data distribution service application located in user space to directly read data packets without going through the kernel's network stack during packet reception.

[0104] PF_RING sockets are used to capture data packets into a circular buffer, significantly improving the speed and efficiency of packet capture. PF_RING is a high-efficiency packet capture technology based on the Linux kernel. By providing a consistent Application Programming Interface (API), it enables packet processing applications to process large numbers of data packets at extremely high speeds. In this embodiment, the data distribution service application can quickly process large numbers of data packets through the API provided by the PF_RING socket.

[0105] Therefore, by using the PF_PACKET socket channel or the PF_RING socket channel to receive packets, the filtering process does not need to go through the protocol stack, saving the network protocol stack's packet processing time and avoiding competition with other application packets.

[0106] A large number of data packets flow across the network, but not all of them are received by the network card of the current device. Therefore, it's necessary to determine which data needs to be received by the current device based on IP addresses. When receiving data packets, the network card needs to allocate communication resources accordingly; different applications will occupy different communication resources to receive data packets.

[0107] In some feasible embodiments, receiving the data packet includes:

[0108] Data packets are received based on occupied communication resources, which are occupied through socket pairs.

[0109] The socket pairs include: socket pairs consisting of PF_PACKET sockets and User Datagram Protocol (UDP) sockets, socket pairs consisting of PF_PACKET sockets and Transmission Control Protocol (TCP) sockets, socket pairs consisting of PF_RING sockets and UDP sockets, or socket pairs consisting of PF_RING sockets and TCP sockets.

[0110] One type of socket pair that occupies communication resources is a general-purpose socket for other applications, namely a User Datagram Protocol (UDP) socket or a Transmission Control Protocol (TCP) socket. These general-purpose sockets are only used to occupy communication resources and do not perform packet sending or receiving. The other type of socket pair is the socket used by the data distribution service application to obtain target data packets, namely the PF_PACKET socket or the PF_RING socket.

[0111] like Figure 4As shown, for data distribution service applications using PF_PACKET sockets, communication resources can be occupied using either a PF_PACKET socket and a User Datagram Protocol (UDP) socket, or a PF_PACKET socket and a Transmission Control Protocol (TCP) socket. Similarly, communication resources can be occupied using either a PF_RING socket and a UDP socket, or a PF_RING socket and a TCP socket. Therefore, the communication resources occupied by these socket pairs are used to receive data packets, interfacing with existing UDP or TCP socket usage in the system to achieve compatible resource allocation and avoid receiving messages from other applications.

[0112] Example 2

[0113] Figure 5 This diagram illustrates the architecture of a data distribution service network communication method according to one embodiment of this application. In this embodiment, the network interface card (NIC) used by the device does not support direct memory access, but the kernel memory is configured as kernel shared memory. Under this architecture, the communication path of received data packets from the NIC to user space includes: the NIC, the Media Access Control (MAC) layer, a packet filter, a socket channel, and kernel shared memory. Data packets received by the NIC are stored in the NIC buffer and then copied to the kernel shared memory. The MAC layer and the packet filter can read and process data packets from the kernel shared memory. The data distribution service application can read target data packets from the kernel shared memory through the socket channel. The target data packets are mapped from the kernel buffer to the user space buffer, eliminating the need for copying from kernel space to user space and improving system efficiency.

[0114] The data distribution service network communication method of this application is as follows: Figure 6 As shown, it includes the following steps:

[0115] S301: Receive data packets and store them in the network interface card (NIC) memory. In this embodiment, the NIC does not support direct memory access; therefore, neither the kernel space processing unit nor the user space data distribution service application can directly access the NIC's packet receiving queue. Data packets received by the NIC from the network are stored in the NIC's packet receiving queue.

[0116] S302: Filter the data packets to obtain the target data packets. After receiving a data packet, the network card stores the data packet in the network card memory, and then notifies the kernel that the data packet has been received. If the network card does not support direct memory access, but the kernel is configured with shared memory, the kernel will first copy the data packet from the network card memory to the kernel shared memory. Then, the media access control layer and BPF filter in the kernel space will read the data packet from the kernel shared memory for processing.

[0117] In some feasible embodiments, the data packets are filtered to obtain target data packets, specifically including:

[0118] The data packet is copied from the network card memory to the kernel shared memory.

[0119] The Media Access Control (Media Access Control) layer reads the data packets from the kernel shared memory and performs Layer 2 processing, deleting data packets from the kernel shared memory that the current device does not need to receive. Layer 2 processing includes Media Access Control address filtering and other procedures. It determines whether a data packet in the kernel shared memory is one that the current device needs to receive; if not, the corresponding data packet is deleted from the kernel shared memory.

[0120] Then, the BPF filter reads the remaining data packets from the kernel shared memory, performs rule-based filtering, deletes data packets that do not conform to the rules in the kernel shared memory, and obtains the target data packet. Rule-based filtering mainly relies on configuration rules to filter the remaining data packets in the kernel shared memory after Layer 2 processing, deleting data packets that do not conform to the filtering rules and retaining those that do.

[0121] In another feasible embodiment, the Media Access Control (MAC) layer can read data packets from the kernel shared memory for Layer 2 processing. If it is determined that the data packet is not needed by the current device, the MAC layer deletes the corresponding data packet from the kernel shared memory. If it is determined that the data packet is needed by the current device, the data packet is transmitted to the BPF filter. The BPF filter performs rule-based filtering on the received data packets. If the data packet does not conform to the filtering rules, the BPF filter deletes the corresponding data packet from the kernel shared memory. Ultimately, only the data packets needed by the data distribution service application are retained in the kernel shared memory. Thus, when the network card does not support direct memory access, but the kernel memory is kernel shared memory, data packets need to be copied from the network card memory to the kernel shared memory, and then read from the kernel shared memory for Layer 2 processing and rule-based filtering. Layer 2 processing filters out data packets that the current device does not need to receive, and rule-based filtering filters out data packets that do not conform to the receiving rules of the data distribution service application. The filtering process uses rule-based filtering, bypassing the processing of the network protocol stack, reducing processing steps, and eliminating the need to share the protocol stack with data packets from other applications, thereby improving data packet reception efficiency.

[0122] S303: The data distribution service application reads the target data packet from the kernel shared memory via a socket channel. When the network interface card (NIC) does not support direct memory access, but the kernel memory is shared memory, the data distribution service application can directly read the target data packet from the kernel shared memory via a socket channel. This reduces the copying between kernel memory and user space memory, minimizes the impact of other application packets, and improves the data distribution service application's packet receiving performance.

[0123] In some feasible embodiments, the socket channel includes a PF_PACKET socket channel or a PF_RING socket channel. A PF_PACKET socket is a mechanism in Linux systems used to directly send and receive data frames at the data link layer. PF_PACKET sockets allow users to directly manipulate network packets in user space without going through the kernel's network stack, making them very useful in network monitoring, testing, and development. In the embodiments of this application, using a PF_PACKET socket allows a data distribution service application located in user space to directly read data packets without going through the kernel's network stack during packet reception.

[0124] PF_RING sockets are used to capture data packets into a circular buffer, significantly improving the speed and efficiency of packet capture. PF_RING is a high-efficiency packet capture technology based on the Linux kernel. By providing a consistent Application Programming Interface (API), it enables packet processing applications to process large numbers of data packets at extremely high speeds. In this embodiment, the data distribution service application can quickly process large numbers of data packets through the API provided by the PF_RING socket.

[0125] Therefore, by using the PF_PACKET socket channel or the PF_RING socket channel to receive packets, the filtering process does not need to go through the protocol stack, saving the network protocol stack's packet processing time and avoiding competition with other application packets.

[0126] When a network interface card (NIC) receives data packets, it needs to utilize communication resources to do so. Different applications will use different communication resources to receive data packets.

[0127] In some feasible embodiments, receiving the data packet includes:

[0128] Data packets are received based on occupied communication resources, which are occupied through socket pairs.

[0129] The socket pairs include: socket pairs consisting of a PF_PACKET socket and a User Datagram Protocol (UDP) socket, a socket pair consisting of a PF_PACKET socket and a Transmission Control Protocol (TCP) socket, a socket pair consisting of a PF_RING socket and a UDP socket, or a socket pair consisting of a PF_RING socket and a TCP socket. Therefore, the communication resources occupied by these socket pairs are used to receive data packets, interfacing with the existing communication resource usage in the system that uses UDP or TCP sockets, thus achieving compatible use of communication resources and avoiding the reception of messages from other applications.

[0130] Example 3

[0131] Figure 7This diagram illustrates the architecture of a data distribution service network communication method according to one embodiment of this application. In this embodiment, the network interface card (NIC) used by the device does not support direct memory access, and the kernel memory is not shared memory. Under this architecture, the communication path of received data packets from the NIC to user space includes: NIC, Media Access Control (MAC), packet filter, socket channel, and user space memory. Data packets received by the NIC are stored in the NIC buffer and then copied to kernel memory. The MAC and packet filter can read and process data packets from kernel memory. The processed target data packet is copied from kernel memory to user space memory via the socket channel. The data distribution service application can read the target data packet from user space memory. This process does not require protocol stack processing, reducing processing steps and eliminating the need to share the protocol stack with data packets from other applications, thus improving data packet reception efficiency.

[0132] The data distribution service network communication method of this application is as follows: Figure 8 As shown, it includes the following steps:

[0133] S401: Receive data packets and store them in the network interface card (NIC) memory. In this embodiment, the NIC does not support direct memory access; therefore, neither the kernel space processing unit nor the user space data distribution service application can directly access the NIC's packet receiving queue. Data packets received by the NIC from the network are stored in the NIC's packet receiving queue.

[0134] S402: Filter the data packet to obtain the target data packet. After receiving the data packet, the network card stores the data packet in the network card memory, and then notifies the kernel that the data packet has been received. If the network card does not support direct memory access and the kernel is not configured with shared memory, the kernel will first copy the data packet from the network card memory to the kernel memory. Then, the media access control layer and BPF filter in the kernel space will read the data packet from the kernel memory for processing.

[0135] In some feasible embodiments, the data packets are filtered to obtain target data packets, specifically including:

[0136] The data packet is copied from the network card memory to the kernel memory.

[0137] The Media Access Control (Media Access Control) layer reads the data packets from the kernel memory and performs Layer 2 processing, deleting data packets from the kernel memory that the current device does not need to receive. Layer 2 processing includes Media Access Control address filtering and other procedures. It determines whether a data packet in the kernel memory is one that the current device needs to receive; if not, the corresponding data packet is deleted from the kernel memory.

[0138] Then, the BPF filter reads the remaining data packets from the kernel memory, performs rule-based filtering, deletes data packets in the kernel memory that do not conform to the rules, and obtains the target data packet. Rule-based filtering mainly relies on configuration rules to filter the remaining data packets in the kernel memory after Layer 2 processing, deleting data packets that do not conform to the filtering rules and retaining those that do.

[0139] In another feasible embodiment, the Media Access Control (MAC) layer can read data packets from kernel memory for Layer 2 processing. If it is determined that the data packet is not needed by the current device, the MAC layer deletes the corresponding data packet from kernel memory. If it is determined that the data packet is needed by the current device, the data packet is transmitted to the BPF filter. The BPF filter performs rule-based filtering on the received data packets. If the data packet does not conform to the filtering rules, the BPF filter deletes the corresponding data packet from kernel memory. Ultimately, only the data packets needed by the data distribution service application are retained in kernel memory. Thus, when the network card does not support direct memory access and kernel memory is not shared memory, data packets need to be copied from the network card memory to kernel memory, and then read from kernel memory for Layer 2 processing and rule-based filtering. Layer 2 processing filters out data packets that the current device does not need to receive, and rule-based filtering filters out data packets that do not conform to the receiving rules of the data distribution service application. The filtering process uses rule-based filtering, bypassing the processing of the network protocol stack, reducing processing steps, and eliminating the need to share the protocol stack with data packets from other applications, thereby improving data packet reception efficiency.

[0140] S403: Copy the target data packet from the kernel memory to the user space memory via the socket channel. The filtered data is copied to user space memory via the socket channel to reduce the impact of other application packets.

[0141] S404: The data distribution service application obtains the target data packet from the user space memory, reducing the uploading steps.

[0142] In some feasible embodiments, the socket channel includes a PF_PACKET socket channel or a PF_RING socket channel. A PF_PACKET socket is a mechanism in Linux systems used to directly send and receive data frames at the data link layer. PF_PACKET sockets allow users to directly manipulate network packets in user space without going through the kernel's network stack, making them very useful in network monitoring, testing, and development. In the embodiments of this application, using a PF_PACKET socket allows a data distribution service application located in user space to directly read data packets without going through the kernel's network stack during packet reception.

[0143] PF_RING sockets are used to capture data packets into a circular buffer, significantly improving the speed and efficiency of packet capture. PF_RING is a high-efficiency packet capture technology based on the Linux kernel. By providing a consistent Application Programming Interface (API), it enables packet processing applications to process large numbers of data packets at extremely high speeds. In this embodiment, the data distribution service application can quickly process large numbers of data packets through the API provided by the PF_RING socket.

[0144] Therefore, by using the PF_PACKET socket channel or the PF_RING socket channel to receive packets, the filtering process does not need to go through the protocol stack, saving the network protocol stack's packet processing time and avoiding competition with other application packets.

[0145] When a network interface card (NIC) receives data packets, it needs to utilize communication resources to do so. Different applications will use different communication resources to receive data packets.

[0146] In some feasible embodiments, receiving the data packet includes:

[0147] Data packets are received based on occupied communication resources, which are occupied through socket pairs.

[0148] The socket pairs include: socket pairs consisting of a PF_PACKET socket and a User Datagram Protocol (UDP) socket, a socket pair consisting of a PF_PACKET socket and a Transmission Control Protocol (TCP) socket, a socket pair consisting of a PF_RING socket and a UDP socket, or a socket pair consisting of a PF_RING socket and a TCP socket. Therefore, the communication resources occupied by these socket pairs are used to receive data packets, interfacing with the existing communication resource usage in the system that uses UDP or TCP sockets, thus achieving compatible use of communication resources and avoiding the reception of messages from other applications.

[0149] Example 4

[0150] based on Figure 3 In the architecture shown, when sending data packets, the data packets to be sent are stored in the shared memory of the network interface card (NIC) by the data distribution service application. The NIC directly reads the data packets to be sent from the shared memory and sends them out. Figure 9 As shown, the specific steps are as follows:

[0151] S501: The data distribution service application stores the data packets to be sent in the shared memory of the network interface card (NIC) through a socket channel. The data packets to be sent are encapsulated by the data distribution service application. When encapsulating the Media Access Control (MAC) address, the data distribution service application needs to obtain and store the IP-MAC mapping based on the Internet Protocol address (IP) and MAC address in the target data packet. Simultaneously, it obtains the local MAC address through the output control function ioctl, obtains the remote MAC address through the Address Resolution Protocol (ARP) cache, and encapsulates the data packets to be sent based on the obtained IP-MAC mapping, the local MAC address, and the remote MAC address. The specific encapsulation process is the same as existing data packet encapsulation methods and will not be described in this application.

[0152] S502: The data packet to be sent is sent from the shared memory of the network card via the network card. Therefore, when the network card supports direct memory access, it only needs to store the data packet to be sent in the shared memory of the network card, and the network card can obtain and send the data packet, reducing two copies, reducing system usage, improving system efficiency, and using a socket channel for data packet transmission without going through the complete network protocol stack, thus improving sending efficiency.

[0153] In some feasible embodiments, the socket channel includes a PF_PACKET socket channel or a PF_RING socket channel, avoiding competition with the transmission channels of other application messages.

[0154] In some feasible embodiments, the network card sends the data packet to be sent by occupying communication resources, and the communication resources are occupied by socket pairs;

[0155] The socket pairs include: socket pairs consisting of PF_PACKET sockets and User Datagram Protocol (UDP) sockets, socket pairs consisting of PF_PACKET sockets and Transmission Control Protocol (TCP) sockets, socket pairs consisting of PF_RING sockets and UDP sockets, or socket pairs consisting of PF_RING sockets and TCP sockets.

[0156] One type of socket pair that occupies communication resources is a general-purpose socket for other applications, namely a User Datagram Protocol (UDP) socket or a Transmission Control Protocol (TCP) socket. These general-purpose sockets are only used to occupy communication resources and do not perform packet sending or receiving. The other type of socket pair is the socket used by the data distribution service application to obtain target data packets, namely the PF_PACKET socket or the PF_RING socket.

[0157] like Figure 4As shown, for data distribution service applications using PF_PACKET sockets, communication resources can be occupied using either a PF_PACKET socket and a User Datagram Protocol (UDP) socket, or a PF_PACKET socket and a Transmission Control Protocol (TCP) socket. Similarly, communication resources can be occupied using either a PF_RING socket and a UDP socket, or a PF_RING socket and a TCP socket. Therefore, the communication resources occupied by these socket pairs are used to send data packets, interfacing with existing communication resource occupancy methods using UDP or TCP sockets in the system to achieve compatible communication resource usage.

[0158] Example 5

[0159] based on Figure 5 In the architecture shown, when sending data packets, the data packets to be sent are stored in the kernel's shared memory by the data distribution service application, and then copied to the network interface card (NIC) memory. The NIC then directly reads the data packets to be sent from its memory and sends them out. Figure 10 As shown, the specific steps are as follows:

[0160] S601: The data distribution service application stores the data packets to be sent in the kernel shared memory through a socket channel. The data packets to be sent are encapsulated by the data distribution service application. When encapsulating the media access control address, the data distribution service application needs to obtain and store the mapping between the IP address and the MAC address in the target data packet. At the same time, it obtains the local media access control address through the output control function ioctl, obtains the remote media access control address through the address resolution protocol ARP cache, and encapsulates the data packets to be sent according to the obtained IP-MAC mapping, the local media access control address, and the remote media access control address. The specific encapsulation process is the same as the existing data packet encapsulation process and will not be described in this application.

[0161] S602: Copy the data packet to be sent from the kernel shared memory to the network card memory.

[0162] S603: The data packet to be sent is sent from the network card's memory via the network card. Therefore, when the network card does not support direct memory access, but the kernel supports shared memory, it is only necessary to store the data packet to be sent in the kernel shared memory, and then copy it from the kernel shared memory to the network card's memory. The network card can then obtain and send the data packet, reducing one kernel copy, reducing system resource usage, and improving system efficiency. Using a socket channel for data packet transmission eliminates the need for the complete network protocol stack, further improving sending efficiency.

[0163] In some feasible embodiments, the socket channel includes a PF_PACKET socket channel or a PF_RING socket channel, avoiding competition with the transmission channels of other application messages.

[0164] In some feasible embodiments, the network card sends the data packet to be sent by occupying communication resources, and the communication resources are occupied by socket pairs;

[0165] The socket pairs include: socket pairs consisting of a PF_PACKET socket and a User Datagram Protocol (UDP) socket, a socket pair consisting of a PF_PACKET socket and a Transmission Control Protocol (TCP) socket, a socket pair consisting of a PF_RING socket and a UDP socket, or a socket pair consisting of a PF_RING socket and a TCP socket. Therefore, the communication resources occupied by these socket pairs are used to send data packets, interfacing with existing communication resource occupancy methods in the system that use UDP sockets or TCP sockets, thus achieving compatible use of communication resources.

[0166] Example 6

[0167] based on Figure 7 The architecture shown depicts a data packet being sent. The packet is stored in user-space memory by the data distribution service application, then copied to kernel memory, and finally to the network interface card (NIC) memory. The NIC then reads the packet directly from its memory and sends it out. For example... Figure 11 As shown, the specific steps are as follows:

[0168] S701: The data distribution service application stores the data packets to be sent in user space memory. The data packets to be sent are encapsulated by the data distribution service application. When encapsulating the media access control address, the data distribution service application needs to obtain and store the correspondence between the IP address and the MAC address in the target data packet. At the same time, it obtains the local media access control address through the output control function ioctl, obtains the remote media access control address through the address resolution protocol ARP cache, and encapsulates the data packets to be sent according to the obtained IP-MAC correspondence, the local media access control address, and the remote media access control address. The specific encapsulation process is the same as the existing data packet encapsulation process and will not be described in this application.

[0169] S702: Copy the data packet to be sent from the user space memory to the kernel memory via the socket channel.

[0170] S703: Copy the data packet to be sent from the kernel memory to the network card memory.

[0171] S704: The data packet to be sent is sent from the network card's memory via the network card. Therefore, when the network card does not support direct memory access and the kernel does not support shared memory, the data packet to be sent needs to be stored in user space memory, and then copied twice to the network card's memory. The network card can then obtain and send the data packet. Using a socket channel for data packet transmission eliminates the need for the complete network protocol stack, improving sending efficiency.

[0172] In some feasible embodiments, the socket channel includes a PF_PACKET socket channel or a PF_RING socket channel, avoiding competition with the transmission channels of other application messages.

[0173] In some feasible embodiments, the network card sends the data packet to be sent by occupying communication resources, and the communication resources are occupied by socket pairs;

[0174] The socket pairs include: socket pairs consisting of a PF_PACKET socket and a User Datagram Protocol (UDP) socket, a socket pair consisting of a PF_PACKET socket and a Transmission Control Protocol (TCP) socket, a socket pair consisting of a PF_RING socket and a UDP socket, or a socket pair consisting of a PF_RING socket and a TCP socket. Therefore, the communication resources occupied by these socket pairs are used to send data packets, interfacing with existing communication resource occupancy methods in the system that use UDP sockets or TCP sockets, thus achieving compatible use of communication resources.

[0175] A third aspect of this application provides a data distribution service network communication apparatus, such as... Figure 12 As shown, the device includes:

[0176] The network interface card 300 is used to receive data packets and store the received data packets in the network interface card memory; or to acquire and send data packets to be sent.

[0177] The processing unit 200 is used to filter the received data packets to obtain the target data packets;

[0178] Socket channel 100 is used to provide a channel for a data distribution service application to obtain the target data packet, or to provide a channel for a network interface card to obtain the data packet to be sent from a data distribution service application.

[0179] In one feasible embodiment, the network interface card (NIC) memory of the data distribution service network communication device supports direct memory access. During the process of receiving data packets, the NIC 300 receives data packets based on the occupied communication resources and stores the data packets in the NIC shared memory. The processing unit 200 directly reads the data packets from the NIC shared memory and performs Layer 2 processing and rule filtering, deleting data packets that fail Layer 2 processing or rule filtering in the NIC shared memory to obtain the target data packet. The data distribution service application directly obtains the target data packet from the NIC shared memory through the socket channel 100. During the process of sending data packets to be sent, the data distribution service application directly stores the data packets to be sent in the NIC shared memory through the socket channel 100. The NIC 300 obtains the data packets to be sent from the NIC shared memory and sends them.

[0180] In another feasible embodiment, the network interface card (NIC) memory of the data distribution service network communication device does not support direct memory access. Kernel shared memory is configured in the kernel space. During data packet reception, the NIC 300 receives data packets based on the occupied communication resources and stores the data packets in the NIC memory. The kernel copies the data packets from the NIC memory to the kernel shared memory. The processing unit 200 directly reads the data packets from the kernel shared memory and performs Layer 2 processing and rule filtering, deleting data packets from the kernel shared memory that fail Layer 2 processing or rule filtering to obtain the target data packet. The data distribution service application directly obtains the target data packet from the kernel shared memory through the socket channel 100. During data packet transmission, the data distribution service application directly stores the data packet to be transmitted in the kernel shared memory through the socket channel 100. Then, the kernel copies the data packet to be transmitted from the kernel shared memory to the NIC memory. The NIC 300 obtains the data packet to be transmitted from the NIC memory and sends it.

[0181] In another feasible embodiment, the network interface card (NIC) memory of the data distribution service network communication device does not support direct memory access. Only kernel memory for storing data is configured in the kernel space, and user space memory for storing data is configured in the user space. During data packet reception, the NIC 300 receives data packets based on the occupied communication resources and stores the data packets in the NIC memory. The kernel copies the data packets from the NIC memory to the kernel memory. The processing unit 200 directly reads the data packets from the kernel memory and performs Layer 2 processing and rule filtering, deleting data packets from the kernel memory that fail Layer 2 processing or rule filtering to obtain the target data packet. Then, the kernel copies the target data packet from the kernel memory to the user space memory through the socket channel 100. The data distribution service application retrieves the target data packet from the user space memory. During data packet transmission, the data distribution service application stores the data packet to be transmitted in the user space memory. The kernel copies the data packet to be transmitted from the user space memory to the kernel memory through the socket channel 100, and then copies the data packet to be transmitted from the kernel shared memory to the NIC memory. The NIC 300 retrieves the data packet to be transmitted from the NIC memory and transmits it.

[0182] The data packets received by the above device are filtered to obtain the target data packets. The data distribution service application obtains the target data packets through the socket channel. The received data packets are only filtered and do not need to go through the complete protocol stack processing to obtain the data packets that the data distribution service application needs to receive. There is no need to share the protocol stack with the data packets of other applications, avoiding competition with the messages of other applications, and the communication efficiency is higher.

[0183] A fourth aspect of this application provides an electronic device, comprising:

[0184] The memory is configured to store instructions; and

[0185] The processor is configured to retrieve the instructions from the memory and, when executing the instructions, to implement the data distribution service network communication method, or to implement the data distribution service network communication method.

[0186] The fifth aspect of this application provides a vehicle including a control system, wherein the control system applies the data distribution service network communication method described above, or applies the data distribution service network communication method described above.

[0187] A sixth aspect of this application provides a machine-readable storage medium storing instructions that cause a machine to perform the data distribution service network communication method, or to perform the data distribution service network communication method.

[0188] A seventh aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the data distribution service network communication method, or implements the data distribution service network communication method.

[0189] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0190] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0191] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0192] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0193] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0194] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

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

[0196] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0197] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A data distribution service network communication method, characterized in that, The data distribution service network communication method includes: Receive data packets and store them in the network card's memory; The data packets are filtered to obtain the target data packets; The data distribution service application obtains the target data packet through the socket channel.

2. The data distribution service network communication method according to claim 1, characterized in that, The network card memory is shared memory. The filtering of the data packets to obtain the target data packets includes: Read data packets from the network interface card's shared memory, perform Layer 2 processing, and delete data packets from the network interface card's shared memory that the current device does not need to receive. The remaining data packets are read from the shared memory of the network card, filtered according to rules, and data packets that do not conform to the rules in the shared memory of the network card are deleted to obtain the target data packet.

3. The data distribution service network communication method according to claim 1 or 2, characterized in that, The data distribution service application obtains the target data packet through a socket channel, including: The data distribution service application reads the target data packet from the network card's shared memory through the socket channel.

4. The data distribution service network communication method according to claim 1, characterized in that, The filtering of the data packets to obtain the target data packets includes: Copy the data packet from the network card memory to the kernel memory; Read the data packet from the kernel memory, perform Layer 2 processing, and delete data packets from the kernel memory that the current device does not need to receive; The remaining data packets are read from the kernel memory, filtered according to rules, and data packets that do not conform to the rules in the kernel memory are deleted to obtain the target data packet.

5. The data distribution service network communication method according to claim 4, characterized in that, The data distribution service application obtains the target data packet through a socket channel, including: The target data packet is copied from the kernel memory to the user space memory via a socket channel; The data distribution service application retrieves the target data packet from the user space memory.

6. The data distribution service network communication method according to claim 4, characterized in that, The kernel memory is kernel shared memory; The data distribution service application obtains the target data packet through a socket channel, including: The data distribution service application reads the target data packet from the kernel shared memory through a socket channel.

7. The data distribution service network communication method according to any one of claims 1-6, characterized in that, The socket channel includes either the PF_PACKET socket channel or the PF_RING socket channel.

8. The data distribution service network communication method according to any one of claims 1-6, characterized in that, The received data packet includes: Data packets are received based on occupied communication resources, which are occupied through socket pairs; The socket pairs include: socket pairs consisting of PF_PACKET sockets and User Datagram Protocol (UDP) sockets, socket pairs consisting of PF_PACKET sockets and Transmission Control Protocol (TCP) sockets, socket pairs consisting of PF_RING sockets and UDP sockets, or socket pairs consisting of PF_RING sockets and TCP sockets.

9. A data distribution service network communication method, characterized in that, The data distribution service network communication method includes: The data distribution service application stores the data packets to be sent in the shared memory of the network card through the socket channel, and sends the data packets to be sent in the shared memory of the network card through the network card; Alternatively, the data distribution service application stores the data packets to be sent in the kernel shared memory through the socket channel, copies the data packets to be sent from the kernel shared memory to the network card memory, and sends the data packets to be sent from the network card memory through the network card; Alternatively, the data distribution service application stores the data packets to be sent in user space memory, copies the data packets to be sent from the user space memory to kernel memory through a socket channel, copies the data packets to be sent from the kernel memory to the network card memory, and sends the data packets to be sent from the network card memory through the network card.

10. The data distribution service network communication method according to claim 9, characterized in that, The socket channel includes either the PF_PACKET socket channel or the PF_RING socket channel.

11. The data distribution service network communication method according to any one of claims 9-10, characterized in that, The network card sends the data packet to be sent by occupying the communication resources, and the communication resources are occupied by socket pairs; The socket pairs include: socket pairs consisting of PF_PACKET sockets and User Datagram Protocol (UDP) sockets, socket pairs consisting of PF_PACKET sockets and Transmission Control Protocol (TCP) sockets, socket pairs consisting of PF_RING sockets and UDP sockets, or socket pairs consisting of PF_RING sockets and TCP sockets.

12. A data distribution service network communication device, characterized in that, The device includes: A network interface card (NIC) is used to receive data packets and store the received data packets in its memory; or to acquire and send data packets to be sent. The processing unit is used to filter the received data packets to obtain the target data packets; A socket channel is used to provide a channel for a data distribution service application to obtain the target data packet, or to provide a channel for a network interface card to obtain the data packet to be sent from a data distribution service application.

13. An electronic device, characterized in that, include: The memory is configured to store instructions; as well as The processor is configured to retrieve the instructions from the memory and, when executing the instructions, to implement the data distribution service network communication method of any one of claims 1 to 8, or to implement the data distribution service network communication method of any one of claims 9 to 11.

14. A vehicle, comprising a control system, characterized in that, The control system uses the data distribution service network communication method as described in any one of claims 1 to 8, or the data distribution service network communication method as described in any one of claims 9 to 11.

15. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores instructions for causing the machine to perform the data distribution service network communication method of any one of claims 1 to 8, or the data distribution service network communication method of any one of claims 9 to 11.

16. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the data distribution service network communication method of any one of claims 1 to 8, or the data distribution service network communication method of any one of claims 9 to 11.