Data transmission method and device, equipment and medium
By detecting and storing time-sensitive data to shared storage space, the delay and jitter problems caused by on-board Ethernet are solved, and faster and more stable data transmission is achieved, ensuring the security and timeliness of real-time data.
Patent Information
- Application Number
- CN202310519509.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-09
- Publication Date
- 2024-11-12
AI Technical Summary
Vehicle Ethernet causes long delays and unstable during data transmission, affecting the timeliness of real-time data and may cause safety accidents.
By detecting the data type of the target data, if it is time-sensitive data, it is stored in the shared storage space and sending access notifications to the target program, allowing it to quickly access the storage space shared by the application layer and the kernel layer, reducing processing flow and time consuming.
It shortens the delay of data from receiving to the target program, reduces the delay jitter, improves the efficiency and stability of data transmission, and ensures the timeliness of real-time data.
Smart Images

Figure CN118939440A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of vehicle technology, and in particular to a data transmission method, device, equipment and medium. Background Art
[0002] With the development of vehicle intelligence, the demand for data transmission in vehicles is also increasing. For example, image sensors and lidar sensors used in the process of autonomous driving will generate a large amount of real-time data, and the applications in the vehicle terminal system also need to rely on these real-time data to make decisions. At present, the data transmission capacity of the CAN bus on the vehicle can no longer meet the current data transmission needs, so the automotive Ethernet came into being. Due to the high bandwidth and transmission rate of the automotive Ethernet, more and more vehicles are beginning to use the automotive Ethernet. However, due to the reasons of the automotive Ethernet itself, when the vehicle terminal system receives the data transmitted through the automotive Ethernet, it must perform a series of processing such as flow control, security processing, adaptation of the transmission protocol, interface call, etc. before the data can reach the corresponding application and complete the corresponding data processing. This will inevitably affect the data transmission efficiency in the system. If the real-time data has a high timeliness requirement, it is likely to cause the real-time data to fail, causing safety accidents and other problems.
[0003] As in the prior art, the vehicle terminal system usually transmits data based on the vehicle Ethernet. For the receiving end of the vehicle terminal system, after receiving the data packet, the data packet will first be sent to the network card driver (for example, Figure 1 The NIC Driver in the NIC Driver uses an interrupt plus polling mechanism to send the packets in the queue to the network protocol stack (for example Figure 1 Netfilter and TCP / IP in it), and finally the application layer calls the socket API interface to receive the data packet to the application layer for processing. From receiving the data packet to transmitting the data packet to the application layer of the on-board receiving end, it is necessary to go through multiple processing flows such as queue queuing, flow control, network protocol stack, and interface calling. The queue queuing, network protocol stack processing of data packets, and two memory copies involved in these multiple processing flows will cause the data packet to be transmitted to the application layer to take a long time, which in turn causes the application layer of the on-board terminal system to receive the data packet to have a long delay. And because the time consumption of each processing flow is not fixed but fluctuates, the more processing flows there are, the greater the delay jitter of the application layer receiving the data packet, and the on-board Ethernet has more processing flows, so the delay of the application layer receiving the data packet is unstable. Continue to see Figure 1 ,Since data packets need to go through NIC queue ,flow control, network protocol stack, interface call and other processing processes, the delay of receiving data packets at the ,application layer is long and unstable, e.g. Figure 2As shown, the average delay is about 100us (Note: the delay may be different in different environments and on-board receivers with different performance, but the jitter phenomenon is similar), and the maximum allowable delay may exceed 1500us with large jitter.
[0004] Therefore, how to speed up the transmission of data within the system and ensure the timeliness of real-time data when using in-vehicle Ethernet has become an urgent problem to be solved. Summary of the invention
[0005] In order to solve the above technical problems, the present disclosure provides a data transmission method, device, equipment and medium.
[0006] In a first aspect, the present disclosure provides a data transmission method, comprising:
[0007] When receiving the target data, detecting the data type of the target data;
[0008] If the data type of the target data is time-sensitive data, the target data is stored in a shared storage space, wherein the shared storage space is a storage space shared by the application layer and the kernel layer;
[0009] An access notification is sent to a target program corresponding to the target data, wherein the access notification is used to enable the target program to access the shared storage space to read the target data.
[0010] In a second aspect, the present disclosure provides a data transmission device, including:
[0011] A detection module, used for detecting the data type of the target data when receiving the target data;
[0012] A storage module, used for storing the target data in a shared storage space if the data type of the target data is time-sensitive data, wherein the shared storage space is a storage space shared by the application layer and the kernel layer;
[0013] The sending module is used to send an access notification to a target program corresponding to the target data, wherein the access notification is used to enable the target program to access the shared storage space to read the target data.
[0014] In a third aspect, the present disclosure provides an electronic device, including:
[0015] processor;
[0016] A memory for storing executable instructions;
[0017] The processor is used to read executable instructions from the memory and execute the executable instructions to implement the data transmission method described in the first aspect.
[0018] In a fourth aspect, the present disclosure provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the data transmission method described in the first aspect.
[0019] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0020] The data transmission method, device, equipment and medium of the embodiment of the present disclosure can detect the data type of the target data when receiving the target data; if the data type of the target data is time-sensitive data, the target data is stored in a shared storage space, wherein the shared storage space is a storage space shared by the application layer and the kernel layer; an access notification is sent to the target program corresponding to the target data, wherein the access notification is used to enable the target program to access the shared storage space to read the target data. According to the embodiment of the present disclosure, for the target data whose data type is time-sensitive data, from receiving the target data to transmitting the target data to the target program, only three processing flows are required, namely, detecting the data type of the target data, memory copying (i.e., copying the target data to the shared storage space), and sending the access notification to the target program. Since there are fewer processing flows and each processing flow takes less time, it takes less time and more stable time from receiving the target data to transmitting the target data to the target program, that is, the target program has a shorter delay and less jitter when receiving the target data. Therefore, compared with data transmission based on the vehicle Ethernet process, according to the embodiment of the present disclosure, the delay and jitter can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0022] Figure 1 It is a logical schematic diagram of a data transmission process based on vehicle Ethernet provided by the relevant technology;
[0023] Figure 2 is based on Figure 1 Schematic diagram of the delay test results of data transmission using the data transmission method shown;
[0024] Figure 3 is a flowchart of a data transmission method provided by an embodiment of the present disclosure;
[0025] Figure 4 is a logical schematic diagram of a data transmission process provided by an embodiment of the present disclosure;
[0026] Figure 5 is based on Figure 4Schematic diagram of the delay test results of data transmission using the data transmission method shown;
[0027] Figure 6 is based on Figure 1 and Figure 4 A comparison chart of the delay test results of data transmission using the data transmission method shown;
[0028] Figure 7 A schematic diagram of the structure of a data transmission device provided in an embodiment of the present disclosure;
[0029] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0031] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0032] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0033] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0034] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0035] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0036] In order to solve the problems in the prior art, the embodiments of the present disclosure provide a data transmission method, apparatus, device and medium. The data transmission method provided by the embodiments of the present disclosure is first described below.
[0037] Figure 3 It is a flowchart of a data transmission method provided by an embodiment of the present disclosure.
[0038] In some embodiments of the present disclosure, Figure 3 The data transmission method shown can be applied to a data transmission module, and the data transmission module can be integrated in an electronic device, which can be understood as a vehicle-mounted terminal, etc., without specific limitation.
[0039] like Figure 3 As shown, the data transmission method may include the following steps.
[0040] S310: When receiving target data, detect the data type of the target data.
[0041] Specifically, data types may include time-sensitive data and ordinary data. Time-sensitive data refers to data that may become meaningless or generate abnormal data if the delay is too large during the transmission of data from the transmitter to the application at the receiver. For example, time-sensitive data may include vehicle control data and / or data distribution service (DDS) data, etc., but is not limited to this. Ordinary data refers to data that is not sensitive to delay. In other words, when data is transmitted from the transmitter to the application at the receiver, if the delay is too large, the data will not become meaningless or generate abnormal data, such as data generated by logs, etc., but is not limited to this.
[0042] In some embodiments, the electronic device may be a receiving end, and the data transmission module in the receiving end may detect the data type of the target data when receiving the target data sent by other electronic devices.
[0043] Specifically, the target data may be any data packet generated by other electronic devices.
[0044] In other embodiments, the electronic device may be a transmitting end, and the data transmission module in the transmitting end may detect the data type of the target data when receiving the target data generated by the application.
[0045] Specifically, the target data may be any data generated by any application in the application layer and to be sent to other electronic devices.
[0046] Specifically, there are many specific implementation methods of "data type of detection target data", and typical examples are described below, but they do not constitute a limitation on the present application.
[0047] In some embodiments, detecting the data type of the target data includes:
[0048] S3111. Obtain feature tuples of target data.
[0049] Specifically, the feature tuple may include at least one of a source address, a destination address, a source port, a destination port, a transmission protocol, and the like.
[0050] In one example, the electronic device is a receiving end, and the target data is a data packet. S311 may include: acquiring a feature tuple of the target data by parsing the data packet.
[0051] In another example, the electronic device is the sending end, and the target data is unencapsulated data. S311 may include: determining at least one of the address of the electronic device that generates the target data, the address of the electronic device that receives the target data, the port that sends the target data, the port that receives the target data, the protocol used to transmit the target data, etc., so as to determine the characteristic tuple of the target data.
[0052] S3112. Match the characteristic tuple of the target data with the whitelist, wherein the whitelist includes the characteristic tuple of data whose data type is time-sensitive data.
[0053] Specifically, a whitelist can be prepared in advance, and the characteristic tuple of data whose data type is time-sensitive data can be placed in the whitelist. It should be noted that which data in the data generated by the electronic device as a transmitter is time-sensitive data, and which data in the data received by the electronic device as a receiver is time-sensitive data, can be set by those skilled in the art according to actual conditions, and are not limited here.
[0054] In one example, the vehicle control data and the data distribution service data are time-sensitive data, and accordingly, the whitelist includes feature tuples of the vehicle control data and / or feature tuples of the data distribution service data.
[0055] It is understandable that in order to improve the safety of vehicle driving, it is necessary to ensure the real-time communication of vehicle control data (for example, brake control data, steering control data, vehicle control data for autonomous driving, etc.). In the related art, 802.1Qbv or 802.1Qav based on TSN is usually used to shorten the delay and improve the delay jitter problem by planning the gate time or bandwidth reservation. However, for the receiving end, due to the uncertainty of the processing delay of the OS protocol stack, the end-to-end delay may eventually be uncertain. However, in this application, by adding the feature tuple of the vehicle control data to the whitelist, the vehicle control data can be sent to the application layer application as quickly as possible for processing, so as to achieve reliable communication.
[0056] It can also be understood that DDS is a new generation of distributed real-time communication middleware protocol, which brings many conveniences to vehicle communication. While achieving software and hardware decoupling, facilitating vehicle model iteration and flexible communication, it also brings some problems. For example, by setting LIFESPAN QoS, DDS can make each data written by DataWriter have an associated "expiration time". After this time, the data will no longer be transmitted to any application, and the data will be cleared from the DataReader cache. However, the receiving end may discard some DDS data due to protocol stack delay, which may cause safety accidents. For example, DDS data used for vehicle control (such as DDS data for steering control) will cause safety accidents if the receiving end discards data due to protocol stack delay. In this application, by treating DDS data as time-sensitive data, DDS data can be sent to the application in the application layer for processing as quickly as possible, so as to achieve reliable communication and thus improve the vehicle safety factor.
[0057] S3113: If the feature tuple of the target data is matched in the whitelist, determine that the data type of the target data is time-sensitive data.
[0058] S3114: If the feature tuple of the target data is not matched in the whitelist, determine that the data type of the target data is common data.
[0059] In some other embodiments, detecting the data type of the target data includes:
[0060] S3121. Get the flag bit of the target data.
[0061] Specifically, the flag bit is used to identify the data type of the target data.
[0062] In an example, the electronic device is a receiving end, and the target data is a data packet. S311 may include: obtaining a flag bit of the target data by parsing the data packet.
[0063] In another example, the electronic device is a transmitting end, and the target data is unencapsulated data, and S311 may include: determining the flag bit of the target data according to the maximum allowable delay corresponding to the target data, specifically, if the maximum allowable delay corresponding to the target data is less than the first threshold, determining the value of the flag bit of the target data to be the first value, and if the maximum allowable delay corresponding to the target data is greater than or equal to the first threshold, determining the value of the flag bit of the target data to be the second value. The "maximum allowable delay" mentioned here refers to the maximum time allowed for the application program at the receiving end to receive the data from the transmitting end. Of course, after determining the flag bit of the target data, the target data and the flag bit can also be encapsulated together so that they can be subsequently encapsulated in the same data packet.
[0064] S3122: If the value of the flag bit is the first value, determine that the data type of the target data is time-sensitive data.
[0065] S3123. If the value of the flag bit is the second value, determine that the data type of the target data is normal data.
[0066] For example, if the value of the flag bit is 1, the data type of the target data is determined to be time-sensitive data, and if the value of the flag bit is 0, the data type of the target data is determined to be ordinary data. However, the present invention is not limited thereto.
[0067] In some further embodiments, detecting the data type of the target data includes:
[0068] S3131. Obtain the maximum allowable delay corresponding to the target data.
[0069] In an example, the electronic device is a receiving end, and the target data is a data packet, then S311 may include: acquiring a maximum allowable delay corresponding to the target data by parsing the data packet.
[0070] In another example, the electronic device is a transmitting end, and the target data is unencapsulated data. S311 may include: obtaining the maximum allowable delay corresponding to the target data by querying a preset maximum allowable delay table, wherein the maximum allowable delay table records maximum allowable delays corresponding to multiple data, but is not limited thereto. Of course, after determining the maximum allowable delay of the target data, the target data and the maximum allowable delay may also be encapsulated together so as to be subsequently encapsulated in the same data packet.
[0071] S3132: If the maximum allowed delay is less than the first threshold, determine that the data type of the target data is time-sensitive data.
[0072] S3133: If the maximum allowed delay is greater than or equal to the first threshold, determine that the data type of the target data is ordinary data.
[0073] It can be understood that the data type of the target data is detected by whitelist matching, obtaining flag bits, and obtaining the maximum allowed delay. The detection method is simple, easy to implement, and less time-consuming, which is conducive to shortening the time taken by the electronic device from receiving the target data to transmitting the target data to the target program.
[0074] S320: If the data type of the target data is time-sensitive data, store the target data in a shared storage space, wherein the shared storage space is a storage space shared by the application layer and the kernel layer.
[0075] Specifically, the shared storage space is a virtual continuous memory area pre-established between the application layer and the kernel layer. A shared storage space is associated with a network device, and the application can implement the system call by configuring the block size, header space, start address and size. The shared storage space may include, for example, cloud memory storage (UCloudMemory Storage, UMEM), or other storage spaces that can be shared by the kernel layer and the application layer known to those skilled in the art, which are not limited here.
[0076] Optionally, the method may further include: if the data type of the target data is ordinary data, determining to transfer the target data to the target program based on the in-vehicle Ethernet process, wherein the in-vehicle Ethernet process includes queue queuing, flow control, network protocol stack, and interface calling.
[0077] Specifically, if the electronic device is the receiving end, transmitting the target data to the target program based on the in-vehicle Ethernet process includes: putting the target data into the queue of the network card, and the network card driver uses an interrupt and / or polling mechanism to send the target data in the queue to the network protocol stack; if the data is local, it is processed by TCP / IP and placed in the data buffer, and the application program (i.e., the target program) calls the socket API interface to read the target data to the application layer.
[0078] Specifically, if the electronic device is the sending end, transmitting the target data to the target program based on the in-vehicle Ethernet process includes: the application calls the system socket API to send the data from the application layer to the network protocol stack, and after processing such as flow control, the network card driver (ie, the target program) sends the target data from the local.
[0079] It can be understood that by setting up the transmission of ordinary data in electronic devices based on the on-board Ethernet process, the diversion transmission of ordinary data and time-sensitive data can be achieved, avoiding ordinary data occupying the fast transmission channel of time-sensitive data.
[0080] S330. Send an access notification to a target program corresponding to the target data, wherein the access notification is used to enable the target program to access the shared storage space to read the target data.
[0081] Specifically, the access notification includes the storage address of the target data in the shared storage space.
[0082] In some embodiments, the electronic device may be a receiving end, and the target program may be an application program in an application layer that is to receive target data.
[0083] In other embodiments, the electronic device may be a sending end, and the target program may be a network card driver in the electronic device.
[0084] Specifically, there are many specific implementation methods of "sending an access notification to a target program corresponding to target data", which are described below with reference to typical examples, but are not limited thereto.
[0085] In some embodiments, S330 may include: if multiple target data are received within a preset time period, sending access notifications to the corresponding target programs in sequence according to the acquisition times of the multiple target data.
[0086] Specifically, if the electronic device is a receiving end, the acquisition time is the time when the data transmission module in the electronic device receives the target data sent by other electronic devices. If the electronic device is a sending end, the acquisition time is the time when the data transmission module in the electronic device receives the target data generated by the application.
[0087] In other embodiments, S330 may include: if the number of multiple target data received at the same time is greater than a second threshold, sorting the priorities of the multiple target data from large to small; and sending access notifications to the corresponding target programs in turn according to the priority sorting of the target data.
[0088] Specifically, the priority is used to characterize the sensitivity of data to delay. The higher the priority, the more sensitive the data is to delay.
[0089] It can be understood that by sending access notifications to the corresponding target programs in sequence according to the priority of the target data, more time-sensitive data can be transmitted to its corresponding target program first, further reducing the delay corresponding to the more time-sensitive data.
[0090] It can be understood that in order to reduce the difficulty of implementing the data transmission method provided by the embodiment of the present disclosure, the data transmission method provided by the embodiment of the present disclosure can be implemented based on the fast network path (eXpress Data Path, XDP). Then, when the target data is received, the network hook of XDP can be triggered to call the corresponding BPF program, and the BPF program is run to implement the following steps: detect the data type of the target data; if the data type of the target data is time-sensitive data, store the target data in the shared storage space, and send an access notification to the target program corresponding to the target data, so that the target program accesses the shared storage space to read the target data. If the data type of the target data is ordinary data, determine to transfer the target data to the target program based on the vehicle Ethernet process.
[0091] In some embodiments, the electronic device is a receiving end. When receiving the target data (i.e., data packet), the target data can be unpacked, and the data type of the target data can be detected and the target program corresponding to the target data can be determined (for example, the target program can be determined based on the target address and / or target port, etc.); if the data type of the target data is time-sensitive data, the target data is stored in a shared storage space, and an access notification is sent to the target program corresponding to the target data, so that the target program can access the shared storage space to read the target data. If the data type of the target data is ordinary data, it is determined to transfer the target data to the target program based on the vehicle Ethernet process.
[0092] In other embodiments, the electronic device is a transmitter, and when receiving the target data (unencapsulated data), the data type of the target data can be detected, and the network card driver used to send the target data to other electronic devices can be determined as the target program; if the data type of the target data is time-sensitive data, the target data is stored in a shared storage space, and an access notification is sent to the target program corresponding to the target data, so that the target program accesses the shared storage space to read the target data. If the data type of the target data is ordinary data, it is determined to transmit the target data to the target program based on the in-vehicle Ethernet process.
[0093] The disclosed embodiment can detect the data type of the target data when the target data is received; if the data type of the target data is time-sensitive data, the target data is stored in a shared storage space, wherein the shared storage space is a storage space shared by the application layer and the kernel layer; and an access notification is sent to the target program corresponding to the target data, wherein the access notification is used to enable the target program to access the shared storage space to read the target data. According to the disclosed embodiment, for the target data whose data type is time-sensitive data, from receiving the target data to transmitting the target data to the target program, only three processing flows are required, namely, detecting the data type of the target data, memory copying (i.e., copying the target data to the shared storage space), and sending the access notification to the target program. Since there are fewer processing flows and each processing flow takes less time, it takes less time from receiving the target data to transmitting the target data to the target program and the time consumption is more stable, that is, the delay of the target program receiving the target data is shorter and more stable. Therefore, compared with data transmission based on the vehicle Ethernet process, according to the disclosed embodiment, the delay can be shortened and the delay jitter can be reduced.
[0094] To explain in detail the data transmission method provided by the embodiment of the present disclosure, the data transmission method provided by the embodiment of the present disclosure is illustrated in detail below by taking an electronic device as a receiving end.
[0095] Figure 4 FIG. 1 is a logical diagram of a data transmission process provided by an embodiment of the present disclosure. Figure 4 As shown, when the network card driver (i.e., NIC Driver) receives a data packet, it can trigger the XDP network hook to call the corresponding BPF program, and run the BPF program to implement the following steps: detect the data type of the data packet; if the data type of the data packet is time-sensitive data, store the data packet in the shared storage space, and send an access notification to the target application corresponding to the data packet, so that the target application can access the shared storage space to read the data packet. If the data type of the data packet is ordinary data, the target data is put into the queue of the network card, and the network card driver uses the interrupt and / or polling mechanism to send the target data in the queue to the network protocol stack. If it is local data, it is processed by TCP / IP and placed in the data buffer, and the application (i.e., the target program) calls the socket API interface to read the target data to the application layer.
[0096] like Figure 4As shown in the figure, the data transmission is an XDP-based data transmission method, and the implementation principle of the XDP-based data transmission method is as follows: 1) Inject a BDP bytecode program into the network card driver process (for example, it can be written in C language, etc.), and use a compiler (such as LLVM) to compile the BDP bytecode program into BPF instructions. 2) Through XDP, let ordinary data go through the in-vehicle Ethernet process (each network card driver has a mounting point for the XDP program, and whenever a network card receives a data packet, the XDP program will be executed. The XDP program can parse, filter, encapsulate or decapsulate the data packet, modify fields of the data packet, and forward it, etc.). 3) Through XDP, send time-sensitive data to the UMEM shared by the application program and memory, and the application program directly reads the UMEM through the AF_XDP socket, reducing the processing process of the network protocol stack, thereby reducing latency and jitter.
[0097] For example, the XDP-based data transmission method can be implemented with reference to the following steps.
[0098] 1) Statistically analyze time-sensitive data according to service requirements, and create a whitelist based on the characteristic tuple <dip (destination address), dport (destination port), protocol (transmission protocol)> of the time-sensitive data.
[0099] Whitelist Example 1:
[0100] <192.168.1.1, 6666, UDP>, <192.168.1.1, 7777, UDP>, …
[0101] The above flow characteristics are time-sensitive data flows, and other flows are ordinary data flows.
[0102] Whitelist Example 2:
[0103] <192.168.1.1, 7400, UDP>, <192.168.1.1, 7410, UDP>, <192.168.1.1, 7401, UDP>, <192.168.1.1, 7411, UDP>, …
[0104] The above flow characteristics are time-sensitive data flows with a DDS domain ID of 0.
[0105] 2) Write a kernel XDP program
[0106] Obtain the characteristic tuple tuple <sip (source address), dip (source port), sport (destination address), dport (destination port), protocol (transmission protocol)> of the data packet
[0107] If the tuple is matched in the pre-set whitelist, the data packet is written into UMEM;
[0108] Use the whitelist as the key to call the bpf_redirect_map interface to directly direct it to the application layer;
[0109] Otherwise, follow the in-vehicle Ethernet process.
[0110] 3) Compile the kernel XDP program into the bytecode file xx_kernel.o
[0111] 4) Write the application layer XDP socket program
[0112] Load the kernel bytecode program xx_kernel.o;
[0113] Create an AF_XDP socket and associate the socket with UMEM. The specific implementation logic is as follows: If an access notification is received, receive the data packet sent by the NIC Driver in UMEM.
[0114] It should be noted that the specific steps for the sending end to implement the XDP-based data transmission method are similar to the specific steps for the receiving end to implement the XDP-based data transmission method, and will not be repeated here.
[0115] To prove Figure 4 The data transmission method shown can shorten the delay and improve the delay stability. A delay test was performed. The data stream was timestamped at the entrance of the XDP data stream of the NIC Driver, and the XDP socket of the time-sensitive application and the socket reception of the ordinary data stream were timestamped respectively, and the difference was calculated. Figure 5 is based on Figure 4 Schematic diagram of the delay test results of data transmission using the data transmission method shown. Figure 6 is based on Figure 1 and Figure 4 The data transmission method shown in the figure shows the delay test results of data transmission. Figure 1 The data transmission method shown in the figure is used to perform the data transmission delay test results. Line 2 is based on Figure 4 The data transmission method shown in the figure shows the delay test results of data transmission. Figure 5 and Figure 6 As shown, the processing delay of time-sensitive data streams at the receiving end is significantly reduced, which can meet the communication requirements of real-time data streams, and the processing delay of time-sensitive data streams is smoother and has smaller jitter.
[0116] It is understandable that in the related art, 802.1Qbv or 802.1Qav based on the TSN protocol is usually used to improve the delay and delay uncertainty. However, 802.1Qbv or 802.1Qav is used to implement traffic transmission and stream bandwidth reservation and shaping transmission according to the gate control list time slot, respectively, to solve the processing of different priority streams at the sending end. When the stream reaches the receiving end, some uncertain jitters will be generated due to the processing of the application receiving stream by the processor scheduling and the network protocol stack, thereby affecting the processing of the key stream. The communication based on AF_XDP socket proposed in the embodiment of the present disclosure can solve the problem of uncertainty in the delay of the last hop receiving end, accelerate the processing of time-sensitive data streams, keep the original processing method unchanged for ordinary data streams, and improve the problem of long delay and unstable delay of the receiving end itself in end-to-end communication. Of course, based on similar inventive concepts, the problem of long delay and unstable delay of the sending end itself in end-to-end communication can also be improved, thereby reducing the need for the sending end to purchase the TSN protocol stack. In this way, it can serve as a supplement to the TSN protocol and can be combined with TSN technology to achieve full-link reliable communication between the receiving and sending ends, meeting the communication requirements of smart cars for low-latency real-time communication.
[0117] It should be noted that the inventive concept of the disclosed embodiment can also be extended to other technical fields. For example, it can be extended to the field of numerical control technology, especially to the field of real-time Ethernet fieldbus, to realize network data packet processing based on AF_XDP real-time Ethernet fieldbus. For another example, it can also be extended to the field of diverting traffic from the intranet to the honeypot, and the traffic that meets the honeypot diversion conditions is obtained according to the network quintuple and the traffic processing strategy; the filtered traffic is diverted to the intranet honeypot to add the trapping configuration and send the configured traffic to the intranet server; the received traffic is screened and modified on the intranet server, and the modified traffic is sent to the attacker. For another example, it can also be extended to the field of small stream retransmission, and the small stream retransmission data is used as time-sensitive data, so that the small stream retransmission data packet is sent to the fast transmission channel to solve the technical problem of poor timeliness of retransmitting small stream data packets.
[0118] Figure 7 is a schematic diagram of the structure of a data transmission device provided by an embodiment of the present disclosure, and the data transmission device can be understood as the above-mentioned electronic device or a part of the functional modules in the above-mentioned electronic device. Figure 8 As shown, the data transmission device 700 includes:
[0119] The detection module 710 is used to detect the data type of the target data when receiving the target data;
[0120] The storage module 720 is used to store the target data in a shared storage space if the data type of the target data is time-sensitive data, wherein the shared storage space is a storage space shared by the application layer and the kernel layer;
[0121] The sending module 730 is used to send an access notification to a target program corresponding to the target data, wherein the access notification is used to enable the target program to access the shared storage space to read the target data.
[0122] In another embodiment of the present disclosure, the detection module 710 may include:
[0123] A first acquisition submodule is used to acquire a feature tuple of target data;
[0124] A matching submodule, used for matching the characteristic tuple of the target data with the whitelist, wherein the whitelist includes the characteristic tuple of the data whose data type is time-sensitive data;
[0125] A first determination submodule is used to determine that the data type of the target data is time-sensitive data if a feature tuple of the target data is matched in the whitelist;
[0126] The second determination submodule is used to determine that the data type of the target data is common data if the feature tuple of the target data is not matched in the whitelist.
[0127] In yet another embodiment of the present disclosure, the whitelist includes: a feature tuple of vehicle control data and / or a feature tuple of data distribution service data.
[0128] In another embodiment of the present disclosure, the detection module 710 may include:
[0129] The second acquisition submodule is used to obtain the flag bit of the target data;
[0130] A third determination submodule, configured to determine that the data type of the target data is time-sensitive data if the value of the flag bit is the first value;
[0131] The fourth determination submodule is used to determine that the data type of the target data is common data if the value of the flag bit is the second value.
[0132] In another embodiment of the present disclosure, the detection module 710 may include:
[0133] The third acquisition submodule is used to obtain the maximum allowable delay corresponding to the target data;
[0134] a fifth determination submodule, configured to determine that the data type of the target data is time-sensitive data if the maximum allowable delay is less than a first threshold;
[0135] The sixth determination submodule is used to determine that the data type of the target data is ordinary data if the maximum allowable delay is greater than or equal to the first threshold.
[0136] In another embodiment of the present disclosure, the sending module 730 may include:
[0137] A sorting submodule, used for sorting the priorities of the multiple target data from large to small if the number of the multiple target data received at the same time is greater than a second threshold;
[0138] The sending submodule is used to send access notifications to the corresponding target programs in sequence according to the priority of the target data.
[0139] In another embodiment of the present disclosure, the device further comprises:
[0140] A determination module is used to determine whether to transmit the target data to a target program based on an in-vehicle Ethernet process if the data type of the target data is ordinary data, wherein the in-vehicle Ethernet process includes queue queuing, flow control, network protocol stack, and interface calling.
[0141] The device provided in this embodiment can execute the method of any of the above embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.
[0142] Figure 8 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown.
[0143] like Figure 8 As shown, the electronic device may include a controller 801 and a memory 802 storing computer program instructions.
[0144] Specifically, the controller 801 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0145] The memory 802 may include a large capacity memory for information or instructions. By way of example and not limitation, the memory 802 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 802 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 802 may be inside or outside the integrated gateway device. In a particular embodiment, the memory 802 is a non-volatile solid-state memory. In a particular embodiment, the memory 802 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (Electrically Erasable Programmable ROM, EEPROM), an electrically rewritable ROM (EAROM) or a flash memory, or a combination of two or more of these.
[0146] The controller 801 reads and executes the computer program instructions stored in the memory 802 to perform the steps of the data transmission method provided in the embodiment of the present disclosure.
[0147] In one example, the electronic device may further include a transceiver 803 and a bus 804. Figure 8 As shown, the controller 801, the memory 802 and the transceiver 803 are connected via a bus 804 and communicate with each other.
[0148] The bus 804 includes hardware, software, or both. For example, but not limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a Memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, the bus 804 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0149] The embodiments of the present disclosure further provide a computer-readable storage medium, which may store a computer program. When the computer program is executed by a processor, the processor implements the data transmission method provided by the embodiments of the present disclosure.
[0150] The above-mentioned storage medium may, for example, include a memory 802 of computer program instructions, and the above-mentioned instructions may be executed by the controller 801 of the electronic device to complete the data transmission method provided in the embodiment of the present disclosure. Optionally, the storage medium may be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium may be a ROM, a random access memory (Random Access Memory, RAM), a compact disc read-only memory (Compact Disc ROM, CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0151] The present disclosure also provides a vehicle, including at least one of the following:
[0152] The data transmission device provided by the embodiment of the present disclosure;
[0153] The electronic device provided by the embodiment of the present disclosure;
[0154] The storage medium provided by the embodiments of the present disclosure;
[0155] The computer-readable storage medium provided by the embodiments of the present disclosure.
[0156] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising" is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0157] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data transmission method, It is characterized in that include: Upon receiving the target data, detecting the data type of the target data; If the data type of the target data is time-sensitive data, storing the target data in a shared storage space, wherein the shared storage space is a storage space shared by the application layer and the kernel layer; An access notification is sent to a target program corresponding to the target data, wherein the access notification is used to enable the target program to access the shared storage space to read the target data.
2. The method according to claim 1, It is characterized in that The detecting the data type of the target data includes: Acquire a feature tuple of the target data; Matching the characteristic tuple of the target data with a whitelist, wherein the whitelist includes characteristic tuples of data whose data type is time-sensitive data; If the feature tuple of the target data is matched in the whitelist, determining that the data type of the target data is time-sensitive data; If the feature tuple of the target data is not matched in the whitelist, it is determined that the data type of the target data is common data.
3. The method according to claim 2, It is characterized in that The whitelist includes: a feature tuple of vehicle control data and / or a feature tuple of data distribution service data.
4. The method according to claim 1, It is characterized in that The detecting the data type of the target data includes: Obtaining a flag bit of the target data; If the value of the flag bit is the first value, determining that the data type of the target data is time-sensitive data; If the value of the flag bit is the second value, it is determined that the data type of the target data is common data.
5. The method according to claim 1, It is characterized in that The detecting the data type of the target data includes: Obtaining a maximum allowable delay corresponding to the target data; If the maximum allowed delay is less than a first threshold, determining that the data type of the target data is time-sensitive data; If the maximum allowed delay is greater than or equal to a first threshold, it is determined that the data type of the target data is common data.
6. The method according to claim 1, It is characterized in that The sending an access notification to the target program corresponding to the target data includes: If the number of the multiple target data received at the same time is greater than the second threshold, sorting the priorities of the multiple target data from large to small; Access notifications are sent to the corresponding target programs in sequence according to the priority ranking of the target data.
7. The method according to claim 1, It is characterized in that Also includes: If the data type of the target data is ordinary data, determine to transfer the target data to the target program based on an in-vehicle Ethernet process, wherein the in-vehicle Ethernet process includes queue queuing, flow control, a network protocol stack, and an interface call.
8. A data transmission device, It is characterized in that include: A detection module, used for detecting the data type of the target data when receiving the target data; A storage module, used for storing the target data in a shared storage space if the data type of the target data is time-sensitive data, wherein the shared storage space is a storage space shared by the application layer and the kernel layer; The sending module is used to send an access notification to a target program corresponding to the target data, wherein the access notification is used to enable the target program to access the shared storage space to read the target data.
9. An electronic device, It is characterized in that include: processor; A memory for storing executable instructions; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the data transmission method described in any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the data transmission method described in any one of claims 1 to 7.
11. A vehicle, It is characterized in that Include at least one of the following: The data transmission device according to claim 8; The electronic device according to claim 9; The computer readable storage medium of claim 10.
Citation Information
Cited By
Safety vehicle-mounted communication method based on DDS
CN121078081A
A dds-based secure vehicle-mounted communication method
CN121078081B
