Network data real-time transmission method, device, equipment and readable storage medium

By determining the type of network data and selected the appropriate transmission path, the problem of the system layer -free in real -time network schemes in the existing technology has been solved, and the real -time performance of the network is improved and the maintenance of Internet communication.

CN115914424BActive Publication Date: 2025-01-28SHENZHEN INOVANCE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211406284.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-10
Publication Date
2025-01-28
Estimated Expiration
2042-11-10

AI Technical Summary

Technical Problem

During the implementation of the existing real-time network solution, the system will have no network at the system level, affecting the normal Internet communication of the system.

Method used

By judging the network data type to be sent, if the preset real -time transmission type is made, the original kernel network protocol is sent to send it; if the preset non -real -time transmission type, the original kernel network protocol is sent. Specific steps include writing network data to direct storage areas or buffers, generating descriptors, and sending them to real -time or non -real -time receiving and receiving queues for network devices.

Benefits of technology

While improving the real -time performance of the network, retaining the ability of the kernel system layer and external Internet communication, and avoiding the problem of no network layer layer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115914424B_ABST
    Figure CN115914424B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and readable storage medium for real-time transmission of network data. That is, in the present application, when there is first network data to be sent, the type of the first network data will be determined. If it is a preset real-time transmission type, the original kernel network protocol will be skipped for transmission, thereby improving network performance (i.e., reducing the transmission steps of network data, thereby reducing the uncertainty in the transmission process and improving the real-time performance of its transmission). On the contrary, if it is a preset non-real-time transmission type, it will be sent based on the original kernel network protocol to maintain the ability of the kernel system layer to communicate with the external Internet. Therefore, the real-time transmission method of network data of the present application can improve the real-time performance of the network and maintain the ability to communicate with the external Internet.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of industrial network communications, and in particular to a method, device, equipment and readable storage medium for real-time transmission of network data. Background Art

[0002] A real-time operating system, or RTOS for short, is a system that must respond to events in the environment within a set deadline, otherwise serious consequences will occur. One of the most important characteristics that a hard real-time operating system should have is predictability, and its essence is determinism. The Ethernet technology in computer networks is applied to the field of industrial automation to form industrial control Ethernet, referred to as industrial Ethernet or Ethernet fieldbus. Usually, real-time industrial Ethernet is implemented based on a real-time operating system. The real-time operating system ensures the real-time response of events at the operating system scheduling level, but the output of the event response result depends on the real-time of the operating system Ethernet, which involves the specific implementation of the operating system Ethernet hardware driver, the operating system network protocol stack, etc. At present, the solutions that can improve the real-time performance of the network in the industry include: putting the real-time Ethernet application into kernel state execution, XDP (eXpress Data Path, fast data path) and DPDK technology (Intel Data Plane Development Kit, Intel Data Plane Development Tool Kit). However, although the above solutions may improve real-time performance to a certain extent, the implementation of the solutions will result in no network at the system layer, that is, the system layer or the kernel cannot perform normal Internet communication, affecting the use.

[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of the present application is to provide a method, device, equipment and readable storage medium for real-time transmission of network data, aiming to solve the technical problem that the current real-time network solution will cause no network at the system level during implementation.

[0005] To achieve the above object, the present application provides a method for real-time transmission of network data, the method comprising:

[0006] Determining the type of first network data to be sent;

[0007] If the type of the first network data is a preset real-time transmission type, skipping the original kernel network protocol to send the first network data;

[0008] If the type of the first network data is a preset non-real-time transmission type, the first network data is sent through the original kernel network protocol.

[0009] Further, the step of skipping the original kernel network protocol to send the first network data includes:

[0010] Writing the first network data into a preset first direct storage area;

[0011] Generate a first descriptor corresponding to the first network data based on the first address of the preset first direct storage area of ​​the first network data;

[0012] The first descriptor is sent to a preset real-time transceiver queue of a network device, so that the network device can send the first network data in real time based on the preset real-time transceiver queue, wherein an interrupt function of the preset real-time transceiver queue is disabled or not enabled.

[0013] Furthermore, the step of sending the first network data through the original kernel network protocol includes:

[0014] Writing the first network data into a preset buffer through the original kernel network protocol, and generating a second descriptor corresponding to the first network data based on a second address of the first network data in the preset buffer;

[0015] The second descriptor is sent to a driver of the network device, and the second descriptor is sent to a preset non-real-time transceiver queue of the network device through the driver, so that the network device can send the first network data based on the preset non-real-time transceiver queue.

[0016] Furthermore, the driver includes a memory mapping interface, and the memory mapping interface is used to map the preset first direct storage area to the user space to obtain a virtual memory space; the step of writing the first network data to the preset first direct storage area includes:

[0017] The first network data is sent to the virtual memory space, so that the first network data is written into the preset first direct storage area.

[0018] Furthermore, the driver program further includes a queue mapping interface, and the queue mapping interface is used to map the preset real-time transceiver queue to the user space to obtain a virtual queue space; the step of sending the first descriptor to the preset real-time transceiver queue of the network device includes:

[0019] The first descriptor is sent to the virtual queue space, so that the first descriptor is sent to the preset real-time transceiver queue.

[0020] Furthermore, before the step of determining the type of the first network data to be sent, the method further includes:

[0021] Based on a preset interaction interface, the register address of the network device, the memory mapping interface and the preset queue mapping interface are obtained from the driver of the network device, wherein the register corresponding to the register address is used to trigger the network device to send the first network data.

[0022] Furthermore, the network data real-time transmission method also includes:

[0023] In a preset second direct storage area storing second network data, query and detect whether new second network data is written;

[0024] If so, obtain the new second network data.

[0025] In addition, to achieve the above-mentioned purpose, the present application also provides a network data real-time transmission device, the network data real-time transmission device comprising:

[0026] A determination module, used for determining the type of the first network data to be sent;

[0027] A first sending module, configured to skip the original kernel network protocol to send the first network data if the type of the first network data is a preset real-time transmission type;

[0028] The second sending module is used to send the first network data through the original kernel network protocol if the type of the first network data is a preset non-real-time transmission type.

[0029] In addition, to achieve the above-mentioned purpose, the present application also provides a real-time transmission device for network data, which includes: a memory, a processor, and a real-time transmission program for network data stored in the memory and executable on the processor. When the real-time transmission program for network data is executed by the processor, the steps of the real-time transmission method for network data as described above are implemented.

[0030] In addition, to achieve the above-mentioned purpose, the present application also provides a readable storage medium, on which a network data real-time transmission program is stored. When the network data real-time transmission program is executed by a processor, the steps of the network data real-time transmission method as described above are implemented.

[0031] The embodiments of the present application propose a method, device, equipment and readable storage medium for real-time transmission of network data. The method for real-time transmission of network data includes: determining the type of first network data to be sent; if the type of the first network data is a preset real-time transmission type, skipping the original kernel network protocol to send the first network data; if the type of the first network data is a preset non-real-time transmission type, sending the first network data through the original kernel network protocol.

[0032] Compared with the existing real-time network solutions, the present application retains the ability of the kernel system layer to communicate with the external Internet by reusing the original kernel network protocol of the kernel layer. That is, when there is first network data to be sent, the type of the first network data will be judged. If it is a preset real-time transmission type, the original kernel network protocol will be skipped for transmission, thereby improving network performance (i.e., reducing the transmission steps of network data, thereby reducing the uncertainty in the transmission process and improving the real-time performance of its transmission). On the contrary, if it is a preset non-real-time transmission type, it will be sent based on the original kernel network protocol to maintain the ability of the kernel system layer to communicate with the external Internet. Therefore, the real-time transmission method of network data of the present application can improve the real-time performance of the network and maintain the ability to communicate with the external Internet. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application;

[0034] Figure 2 This is a flow chart of the first embodiment of the real-time network data transmission method of the present application;

[0035] Figure 3 This is a flow chart of the second embodiment of the real-time network data transmission method of the present application;

[0036] Figure 4 This is a schematic diagram of the principle of the real-time network data transmission method of this application;

[0037] Figure 5 This is a schematic diagram of the framework of the real-time network data transmission method of this application;

[0038] Figure 6 This is a schematic diagram of the network data sending effect of the network data real-time transmission method of the present application;

[0039] Figure 7 This is a schematic diagram of the network data receiving effect of the network data real-time transmission method of the present application.

[0040] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0041] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0042] like Figure 1 As shown, Figure 1 It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present application.

[0043] The terminal in the embodiment of the present application may be a PC, or may be an electronic terminal device with data processing function, such as a smart phone, a tablet computer, or a portable computer.

[0044] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0045] Optionally, the device may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the mobile terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal can also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.

[0046] Those skilled in the art will understand that Figure 1The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0047] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a network data real-time transmission program.

[0048] exist Figure 1 In the device shown, the network interface 1004 is mainly used to connect to the backend server and communicate data with the backend server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the network data real-time transmission program stored in the memory 1005 and perform the following operations:

[0049] Determining the type of first network data to be sent;

[0050] If the type of the first network data is a preset real-time transmission type, skipping the original kernel network protocol to send the first network data;

[0051] If the type of the first network data is a preset non-real-time transmission type, the first network data is sent through the original kernel network protocol.

[0052] Further, the processor 1001 may call the network data real-time transmission program stored in the memory 1005, and further perform the following operations:

[0053] The step of skipping the original kernel network protocol to send the first network data comprises:

[0054] Writing the first network data into a preset first direct storage area;

[0055] Generate a first descriptor corresponding to the first network data based on the first address of the preset first direct storage area of ​​the first network data;

[0056] The first descriptor is sent to a preset real-time transceiver queue of a network device, so that the network device can send the first network data in real time based on the preset real-time transceiver queue, wherein an interrupt function of the preset real-time transceiver queue is disabled or not enabled.

[0057] Further, the processor 1001 may call the network data real-time transmission program stored in the memory 1005, and further perform the following operations:

[0058] The step of sending the first network data through the original kernel network protocol comprises:

[0059] Writing the first network data into a preset buffer through the original kernel network protocol, and generating a second descriptor corresponding to the first network data based on a second address of the first network data in the preset buffer;

[0060] The second descriptor is sent to a driver of the network device, and the second descriptor is sent to a preset non-real-time transceiver queue of the network device through the driver, so that the network device can send the first network data based on the preset non-real-time transceiver queue.

[0061] Further, the processor 1001 may call the network data real-time transmission program stored in the memory 1005, and further perform the following operations:

[0062] The driver includes a memory mapping interface, and the memory mapping interface is used to map the preset first direct storage area to the user space to obtain a virtual memory space;

[0063] The step of writing the first network data into the preset first direct storage area comprises:

[0064] The first network data is sent to the virtual memory space, so that the first network data is written into the preset first direct storage area.

[0065] Further, the processor 1001 may call the network data real-time transmission program stored in the memory 1005, and further perform the following operations:

[0066] The driver further includes a queue mapping interface, and the queue mapping interface is used to map the preset real-time transceiver queue to the user space to obtain a virtual queue space;

[0067] The step of sending the first descriptor to a preset real-time transceiver queue of a network device comprises:

[0068] The first descriptor is sent to the virtual queue space, so that the first descriptor is sent to the preset real-time transceiver queue.

[0069] Further, the processor 1001 may call the network data real-time transmission program stored in the memory 1005, and further perform the following operations:

[0070] Before the step of determining the type of the first network data to be sent, the method further includes:

[0071] Based on a preset interactive interface, a register address, a memory mapping interface and a queue mapping interface of the network device are obtained from a driver of the network device, wherein the register corresponding to the register address is used to trigger the network device to send the first network data.

[0072] Further, the processor 1001 may call the network data real-time transmission program stored in the memory 1005, and further perform the following operations:

[0073] The network data real-time transmission method also includes:

[0074] In a preset second direct storage area storing second network data, query and detect whether new second network data is written;

[0075] If so, obtain the new second network data.

[0076] Reference Figure 2 , the first embodiment of the network data real-time transmission method of the present application, the network data real-time transmission method comprises:

[0077] Step S10, determining the type of the first network data to be sent;

[0078] In this embodiment, the application that generates the first network data to be sent can be divided into two types, one is a real-time Ethernet application, and the other is a common Ethernet application, wherein the first network data generated by the real-time Ethernet application can be an Ethernet frame with a high requirement for real-time performance, while the first network data generated by the common Ethernet application can be an Ethernet frame with a relatively low requirement for real-time performance but needs to be sent to the external Internet. It should be noted that although the current real-time network solution can improve the real-time performance of the network to a certain extent, such as the DPDK technology, it may be possible to improve the real-time performance of the network (the starting point of the solution is to improve the throughput, not to improve the real-time performance), but because the implementation process of the solution is completely implemented in the user state, that is, the network device (such as the network card) that completes the Ethernet frame transmission and reception is completely taken over by the real-time Ethernet application corresponding to the user state, which will cause the kernel layer to have no network. At the same time, the solution of putting the real-time Ethernet application into the kernel state for execution and reducing the data copy between the kernel state and the user state also has the same problem, and the real-time Ethernet application of the solution is executed in the kernel state on the one hand, and it is difficult to develop on the other hand, and it is also easy to produce BUG (defect) to cause the system to crash. Therefore, the current high-performance network solutions all have the problem of causing the kernel layer or system layer to have no network. To solve the above problem, in this embodiment, two Ethernet frame sending modes exist simultaneously to ensure that the ability of the kernel layer to communicate with the external network is retained while improving network performance.

[0079] Specifically, for the first network data that needs to be sent out, its type will be determined before sending. Among them, the type of the first network data can include a preset real-time transmission type and a preset non-real-time transmission type. It should be noted that the specific type of the preset real-time transmission type can be set by the technician according to the actual situation. For example, common real-time industrial Ethernet (or real-time Ethernet application) includes PROFINET (automation bus standard), EtherCAT (Ether Control Automation Technology, Ethernet control automation technology), Ethernet PowerLink (high-speed industrial Ethernet), TSN (time scalar network, time scale network diagram), etc. Among them, when the first network data is generated by EtherCAT, the corresponding first network data type (or Ethernet frame type) is 0x88A4. Therefore, the Ethernet frame type 0x88A4 can be set in advance as the preset real-time transmission type. On the contrary, if the network data is not generated by the real-time Ethernet application, it is a preset non-real-time transmission type.

[0080] Step S20: if the type of the first network data is a preset real-time transmission type, skipping the original kernel network protocol to send the first network data;

[0081] Specifically, when the type of the first network data is a preset real-time transmission type, the original kernel network protocol is skipped to send the first network data, that is, the real-time Ethernet application in user mode will skip the kernel to directly access and operate the network card hardware to achieve the sending of the first network data.

[0082] Further, the step of skipping the original kernel network protocol to send the first network data includes:

[0083] Step S210, writing the first network data into a preset first direct storage area;

[0084] Furthermore, the driver includes a memory mapping interface, which is used to map the preset first direct storage area to the user space to obtain a virtual memory space; the step of writing the first network data to the preset first direct storage area includes: sending the first network data to the virtual memory space so that the first network data is written to the preset first direct storage area.

[0085] Specifically, the real-time Ethernet application in user mode writes the first network data into the virtual memory space corresponding to the preset first direct storage area. The first direct storage area may be an area pre-allocated in a DMA (Direct Memory Access) memory, and the virtual memory space is obtained by mapping the first direct storage area of ​​the kernel space to the user space through a preset memory mapping interface, such as by using the mmap method (a method for memory mapping files). It can be understood that the above process does not require the use of system calls to reduce the data processing process.

[0086] Step S220, generating a first descriptor corresponding to the first network data at a first address of the preset first direct storage area based on the first network data;

[0087] Specifically, after the real-time Ethernet application writes the first network data into the preset first direct storage area, the address of the first network data in the preset first direct storage area is written into the descriptor, thereby obtaining the first descriptor corresponding to the first network data. It should be noted that in this real-time example, the first network data needs to be sent through the network device, and the first descriptor corresponding to the first network data is the basis for the network device to send the first network data.

[0088] Step S230, sending the first descriptor to a preset real-time transceiver queue of a network device, so that the network device can send the first network data in real time based on the preset real-time transceiver queue, wherein the interrupt function of the preset real-time transceiver queue is disabled or the interrupt function is not enabled.

[0089] Furthermore, the driver also includes a queue mapping interface, which is used to map the preset real-time transceiver queue to the user space to obtain a virtual queue space; the step of sending the first descriptor to the preset real-time transceiver queue of the network device includes: sending the first descriptor to the virtual queue space so that the first descriptor is sent to the preset real-time transceiver queue.

[0090] Specifically, the above network device refers to a network card, and a network card usually includes multiple hardware transceiver queues. In this embodiment, at least one hardware transceiver queue is set as the above preset real-time transceiver queue for receiving the above first descriptor. Similarly, the real-time Ethernet application in the user state sends the first descriptor to the virtual queue space corresponding to the preset real-time transceiver queue, and the virtual queue space is obtained by mapping the preset real-time transceiver queue in the kernel space to the user space by the preset queue mapping interface, and is also implemented by the mmap method. It should be noted that the interrupt function corresponding to the hardware transceiver queue set as the preset real-time transceiver queue will be disabled or in an unenabled state to avoid the network card triggering an interrupt after receiving the network data, thereby causing a conflict with the network data processing process of the present application. After the first descriptor is sent to the preset real-time transceiver queue, the network device can complete the network data transmission in accordance with the order of each first descriptor in the preset real-time transceiver queue, and the first network data to be sent can be obtained according to the address in the first descriptor, and then the obtained first network data is sent out.

[0091] Step S30: If the type of the first network data is a preset non-real-time transmission type, the first network data is sent through the original kernel network protocol.

[0092] It is understandable that if the type of the first network data is not the preset real-time transmission type, the first network data is the preset non-real-time transmission type. The first network data of the preset non-real-time transmission type can be sent through the original kernel network protocol.

[0093] Furthermore, the first network data is written to a preset buffer through the original kernel network protocol, and a second descriptor corresponding to the first network data is generated based on a second address of the first network data in the preset buffer; the second descriptor is sent to a driver of the network device, and the second descriptor is sent to a preset non-real-time transceiver queue of the network device through the driver, so that the network device can send the first network data based on the preset non-real-time transceiver queue.

[0094] It should be noted that, in the hardware transceiver queue of the network device of this embodiment, except for the preset real-time transceiver queue, the remaining hardware transceiver queues are all non-real-time transceiver queues. Correspondingly, when the first network data is a non-real-time transmission type, a system call is initiated to switch the system CPU (Central Processing Unit) context from user mode to kernel mode, copy the first network data from user space to kernel space, and then send the first network data to a preset buffer (skb, Struct sk_buffer, a buffer area for transceiver packets) through the original kernel network protocol. It can be understood that the above-mentioned second descriptor will also contain the address of the first network data in the buffer, which will not be repeated here. The second descriptor will be sent to the driver corresponding to the network device, and the second descriptor will be sent to the preset non-real-time transceiver queue of the network device through the driver, so that the network device can send the first network data based on the preset non-real-time transceiver queue. It can be understood that the network device in this embodiment has a real-time transceiver queue and a non-real-time transceiver queue, and receives descriptors with different real-time requirements respectively to complete the transmission of network data. Thus, the real-time requirements for network data transmission are met, and the communication with the external Internet at the system level or kernel level is maintained. In addition, the priority of the real-time transceiver queue during transmission can be set to a high priority, so that the corresponding network data in the real-time transceiver queue is sent first before the non-real-time transceiver queue, thereby ensuring the real-time transmission of the first network data.

[0095] To explain the above steps clearly, refer to Figure 4 , is a schematic diagram of the principle of the real-time transmission method of network data in the present application, the real-time Ethernet application and the ordinary Ethernet application are both in the user state, the network device driver module and the network device are both in the kernel state, wherein the network device driver module includes a ring buffer 1, a ring buffer 2 and a preconfigured physical memory allocated from the physical memory, and the network device (network card) includes a device register space, a hardware transceiver queue 1 and a hardware transceiver queue 2. There is a corresponding relationship between the hardware transceiver queue 1 and the ring buffer 1, and there is a corresponding relationship between the hardware transceiver queue 2 and the ring buffer 2. And the above-mentioned preconfigured physical memory, device register space and ring buffer 1 will be mapped to the real-time Ethernet application in the user state respectively by mmap. Ring buffer 1 is set to a preset real-time transceiver queue, and ring buffer 2 is set to a preset non-real-time transceiver queue. When the real-time Ethernet application generates the first network data to be sent, the first network data is written into the virtual memory space (i.e. Figure 4 The first descriptor containing the first network data storage address is sent to the virtual queue space (i.e. Figure 4It can be understood that at this time, the first network data has been written to the corresponding physical memory configured in the kernel state, and the first descriptor corresponding to the first network data has also been sent to the ring buffer 1. It should be noted that there is a corresponding relationship between the ring buffer 1 and the hardware transceiver queue 1, and the first descriptor is equivalent to being sent to the hardware transceiver queue 1. In addition, the real-time Ethernet application is mapped in the device register space (i.e. Figure 4 The device register space in the dashed box in the figure) reads and writes the sending command, thereby triggering the network device to execute the sending step, and the network device can send the first network data according to the first descriptor in the hardware transceiver queue 1. As for the first network data generated by ordinary Ethernet applications, it can be sent based on the kernel network protocol stack (that is, the original kernel network protocol) and the network device driver (that is, the existing Ethernet frame sending path is reused, and the second descriptor corresponding to the first network data will be sent to the ring buffer 2, and sent by triggering an interrupt).

[0096] In addition, the network data real-time transmission method also includes:

[0097] Step S01, querying and detecting whether new second network data is written into a preset second direct storage area storing second network data;

[0098] Step S02: If yes, obtain the new second network data.

[0099] In this embodiment, the above-mentioned preset second direct storage area can be pre-allocated. And the second network data received by the network device from the outside will be stored in the second direct storage area. The same preset second direct storage area will also be mapped to the user space by mmap, and the relevant Ethernet application in the user state will query and detect whether there is new second network data written in the mapped preset second direct storage area (wherein, the query interval can be set by the technician). When the query finds that there is new second network data, the new second network data is obtained to complete the data reception.

[0100] Reference Figure 6 , is a schematic diagram of the network data sending effect of the network data real-time transmission method of the present application, Figure 6 , the horizontal axis is the number of samples, the vertical axis is the time required for network packet transmission, the sampling point of the control scheme (the existing link layer Ethernet frame transmission process through the raw socket interface provided by the operating system) is represented by the origin, and the sampling point of the present application scheme is represented by a cross. Figure 6 From the distribution of the two sampling points, the time taken to send the network packet in this application is more stable, so the solution of this application has stronger real-time performance. Figure 7, which is a schematic diagram of the network data receiving effect of the network data real-time transmission method of the present application. The horizontal axis is the sampling number, and the vertical axis is the time required for the network packet to be sent. The sampling points of the control scheme (the existing link layer Ethernet frame sending process through the original socket interface provided by the operating system) are represented by the origin, and the sampling points of the present application scheme are represented by a cross. Similarly, according to each sampling point, the present application scheme has a stronger real-time performance.

[0101] In this embodiment, the type of the first network data to be sent is determined; if the type of the first network data is a preset real-time transmission type, the original kernel network protocol is skipped to send the first network data; if the type of the first network data is a preset non-real-time transmission type, the first network data is sent through the original kernel network protocol. Compared with the existing real-time network scheme, the present application reuses the original kernel network protocol of the kernel layer, thereby retaining the ability of the kernel system layer to communicate with the external Internet. That is, in the present application, when there is a first network data to be sent, the type of the first network data will be determined. If it is a preset real-time transmission type, the original kernel network protocol is skipped to send it, thereby improving the network performance (i.e., reducing the transmission steps of the network data, thereby reducing the uncertainty in the transmission process and improving the real-time performance of its transmission). On the contrary, if it is a preset non-real-time transmission type, it is sent based on the original kernel network protocol to maintain the ability of the kernel system layer to communicate with the external Internet. Therefore, the real-time transmission method of network data of the present application can achieve the improvement of the real-time performance of the network and maintain the ability to communicate with the external Internet.

[0102] Further, referring to 3, a second embodiment of the method for real-time transmission of network data of the present application is proposed based on the first embodiment of the method for real-time transmission of network data of the present application.

[0103] Before the step of determining the type of the first network data to be sent, the method for real-time transmission of network data includes:

[0104] Step S001, based on a preset interaction interface, obtain the register address of the network device, the preset memory mapping interface and the preset queue mapping interface from the driver of the network device, wherein the register corresponding to the register address is used to trigger the network device to send the first network data.

[0105] In this embodiment, the real-time Ethernet application will skip the original kernel network protocol and directly operate the network device, thereby reducing the steps in the first network data transmission process, which can reduce the transmission delay on the one hand and improve the real-time performance of data transmission on the other hand. Before the process of realizing the real-time transmission of network data, the real-time Ethernet application needs to be initialized to obtain the relevant information for realizing the real-time transmission of network data. The above-mentioned preset interactive interface will be used for the interaction between the real-time Ethernet application and the driver of the network device. Among them, there are multiple implementation methods of the preset interactive interface, such as by setting character devices, block devices, mixed devices and sockets. Taking character devices as an example, character devices can be registered in the driver, wherein when the driver interacts with the real-time Ethernet application, the character device can provide the user-state real-time Ethernet application with the physical starting address and length information (i.e., the register address) of the register space of the network device, provide the user-state real-time Ethernet application with a DMA attribute memory allocation interface (for allocating the above-mentioned preset first direct storage area), provide a mapping interface for mapping a specified DMA memory block (preset first direct storage area) to the user state, and provide a mapping interface for mapping a specified transceiver queue to a preset queue mapping interface in the user state (the transceiver queue or the descriptor of the corresponding circular buffer of the transceiver queue can be created by the real-time Ethernet application, or the address, length, and size of the descriptor can be obtained through the preset interaction interface to directly obtain the descriptor). At the same time, a mapping interface for mapping the device register space to the user state is also provided, so that the user-state real-time Ethernet application can write a send instruction in the mapped device register space to trigger the network device to send the first network data. Reference Figure 5 , a schematic diagram of the framework of the real-time transmission method of network data in the present application. The real-time Ethernet application in the user state includes real-time Ethernet frame sending and real-time Ethernet initialization, wherein the real-time Ethernet frame sending and receiving refers to the real-time Ethernet frame, which is directly operated on the network device through kernel bypass (i.e. skipping the original kernel network protocol) to complete the sending and receiving. Real-time Ethernet initialization means that in the initial stage of the application of the above method, the real-time Ethernet application can interact with the driver of the network device through a preset interactive interface to obtain relevant information about the network device, and the relevant information includes: the register address of the network device, the memory mapping interface, and the queue mapping interface, etc. In addition, the real-time Ethernet application can also include: link (connection) status detection, which is used for the network connection status of the network device. Similarly, for ordinary Ethernet applications, the kernel network protocol stack and the network device driver can be used to operate the network device to complete the sending.

[0106] It should be noted that the above process can be implemented by incremental development of existing network device drivers, such as adding relevant character devices to the network device. Similarly, for network devices with multiple transceiver queues, the designated transceiver queue is occupied by the real-time Ethernet application as a real-time transceiver queue, and the remaining transceiver queues are used by ordinary Ethernet applications. At the same time, in order to ensure the correspondence between the real-time Ethernet application, the network device driver and the network device, the identifier of the designated network device is added to the network device driver. The identifier can be the PCI (Peripheral Component Interconnect, local bus standard) address of the network device, or the attribute identifier of the corresponding node of the network device in the device tree. The identifier of the network device can determine whether the actually connected or matching network device is the designated network device when the network device is initialized. If it is, the physical starting address and length (i.e., register address) of the register space of the network device are saved, which can be provided to the real-time Ethernet application in the user state.

[0107] It is understandable that during the initialization process, the real-time Ethernet application will map the first direct storage area of ​​the kernel state, the preset real-time transceiver queue and the device register space to the user state based on the mapping interface obtained above, so that the real-time Ethernet application directly operates the network device in the user state to send the first network data, without the need to resort to the original kernel network protocol stack, reducing the first network data sending step, and enhancing the real-time performance of the overall network. It should be noted that the entire software framework when the DPDK solution is implemented is huge, and it is difficult to separate the user state driver layer for reuse by the real-time industrial network protocol stack. The present application implements the above process by only incremental development of the existing standard network device driver. The user state only needs to operate the key hardware of the network device, and it is not necessary to implement the complete drive of the network device in the user state, so that the user state can directly operate the network device for data transmission and reception. The implementation process is cleaner and simpler.

[0108] In addition, the embodiment of the present application also provides a network data real-time transmission device, the network data real-time transmission device comprising:

[0109] A determination module, used for determining the type of the first network data to be sent;

[0110] A first sending module, configured to skip the original kernel network protocol to send the first network data if the type of the first network data is a preset real-time transmission type;

[0111] The second sending module is used to send the first network data through the original kernel network protocol if the type of the first network data is a preset non-real-time transmission type.

[0112] Determining the type of first network data to be sent;

[0113] If the type of the first network data is a preset real-time transmission type, skipping the original kernel network protocol to send the first network data;

[0114] If the type of the first network data is a preset non-real-time transmission type, the first network data is sent through the original kernel network protocol.

[0115] Optionally, the first sending module is further used for:

[0116] Writing the first network data into a preset first direct storage area;

[0117] Generate a first descriptor corresponding to the first network data based on the first address of the preset first direct storage area of ​​the first network data;

[0118] The first descriptor is sent to a preset real-time transceiver queue of a network device, so that the network device can send the first network data in real time based on the preset real-time transceiver queue, wherein an interrupt function of the preset real-time transceiver queue is disabled or not enabled.

[0119] Optionally, the second sending module is further used for:

[0120] The step of sending the first network data through the original kernel network protocol comprises:

[0121] Writing the first network data into a preset buffer through the original kernel network protocol, and generating a second descriptor corresponding to the first network data based on a second address of the first network data in the preset buffer;

[0122] The second descriptor is sent to a driver of the network device, and the second descriptor is sent to a preset non-real-time transceiver queue of the network device through the driver, so that the network device can send the first network data based on the preset non-real-time transceiver queue.

[0123] Optionally, the first sending module is further used for:

[0124] The driver includes a memory mapping interface, and the memory mapping interface is used to map the preset first direct storage area to the user space to obtain a virtual memory space;

[0125] The step of writing the first network data into the preset first direct storage area comprises:

[0126] The first network data is sent to the virtual memory space, so that the first network data is written into the preset first direct storage area.

[0127] Optionally, the first sending module is further used for:

[0128] The driver further includes a queue mapping interface, and the queue mapping interface is used to map the preset real-time transceiver queue to the user space to obtain a virtual queue space;

[0129] The step of sending the first descriptor to a preset real-time transceiver queue of a network device comprises:

[0130] The first descriptor is sent to the virtual queue space, so that the first descriptor is sent to the preset real-time transceiver queue.

[0131] Optionally, the first sending module is further used for:

[0132] Based on a preset interactive interface, a register address, a memory mapping interface and a queue mapping interface of the network device are obtained from a driver of the network device, wherein the register corresponding to the register address is used to trigger the network device to send the first network data.

[0133] Optionally, the network data real-time transmission device further includes a receiving module, and the receiving module is used to:

[0134] In a preset second direct storage area storing second network data, query and detect whether new second network data is written;

[0135] If so, obtain the new second network data.

[0136] The network data real-time transmission device provided by the present application adopts the network data real-time transmission method in the above embodiment to solve the technical problem that the current real-time network solution will cause the system layer to have no network during implementation. Compared with the prior art, the beneficial effects of the network data real-time transmission device provided by the embodiment of the present application are the same as the beneficial effects of the network data real-time transmission method provided by the above embodiment, and other technical features in the network data real-time transmission device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0137] In addition, an embodiment of the present application also proposes a real-time transmission device for network data, which includes: a memory, a processor, and a real-time transmission program for network data stored on the memory and executable on the processor, and when the real-time transmission program for network data is executed by the processor, the steps of the real-time transmission method for network data as described above are implemented.

[0138] The specific implementation of the network data real-time transmission device of the present application is basically the same as the various embodiments of the above-mentioned new method for real-time transmission of network data, and will not be repeated here.

[0139] In addition, an embodiment of the present application further proposes a readable storage medium, on which a network data real-time transmission program is stored. When the network data real-time transmission program is executed by a processor, the steps of the network data real-time transmission method as described above are implemented.

[0140] The specific implementation of the readable storage medium of the present application is basically the same as the various embodiments of the above-mentioned new method for real-time transmission of network data, and will not be repeated here.

[0141] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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 system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0142] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0143] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0144] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for real-time transmission of industrial network data, characterized in that: The industrial network data real-time transmission method comprises: Determining the type of the first industrial network data to be sent; If the type of the first industrial network data is a preset real-time transmission type, skipping the original kernel network protocol to send the first industrial network data; If the type of the first industrial network data is a preset non-real-time transmission type, the first industrial network data is sent through the original kernel network protocol.

2. The method for real-time transmission of industrial network data according to claim 1, characterized in that: The step of skipping the original kernel network protocol to send the first industrial network data includes: Writing the first industrial network data into a preset first direct storage area; Generate a first descriptor corresponding to the first industrial network data based on the first industrial network data at a first address of the preset first direct storage area; The first descriptor is sent to a preset real-time transceiver queue of a network device, so that the network device can send the first industrial network data in real time based on the preset real-time transceiver queue, wherein the interrupt function of the preset real-time transceiver queue is disabled or the interrupt function is not enabled.

3. The method for real-time transmission of industrial network data according to claim 2, characterized in that: The step of sending the first industrial network data through the original kernel network protocol includes: Writing the first industrial network data into a preset buffer through the original kernel network protocol, and generating a second descriptor corresponding to the first industrial network data based on a second address of the first industrial network data in the preset buffer; The second descriptor is sent to a driver of the network device, and the second descriptor is sent to a preset non-real-time transceiver queue of the network device through the driver, so that the network device can send the first industrial network data based on the preset non-real-time transceiver queue.

4. The method for real-time transmission of industrial network data according to claim 3, characterized in that: The driver includes a memory mapping interface, and the memory mapping interface is used to map the preset first direct storage area to the user space to obtain a virtual memory space; The step of writing the first industrial network data into the preset first direct storage area comprises: The first industrial network data is sent to the virtual memory space, so that the first industrial network data is written into the preset first direct storage area.

5. The method for real-time transmission of industrial network data according to claim 4, characterized in that: The driver further includes a queue mapping interface, and the queue mapping interface is used to map the preset real-time transceiver queue to the user space to obtain a virtual queue space; The step of sending the first descriptor to a preset real-time transceiver queue of a network device comprises: The first descriptor is sent to the virtual queue space, so that the first descriptor is sent to the preset real-time transceiver queue.

6. The method for real-time transmission of industrial network data according to claim 5, characterized in that: Before the step of determining the type of the first industrial network data to be sent, the method further includes: Based on a preset interactive interface, a register address, a memory mapping interface, and a queue mapping interface of the network device are obtained from a driver of the network device, wherein the register corresponding to the register address is used to trigger the network device to send the first industrial network data.

7. The method for real-time transmission of industrial network data according to claim 1, characterized in that: The industrial network data real-time transmission method also includes: In a preset second direct storage area storing the second industrial network data, query and detect whether new second industrial network data is written; If yes, obtain the new second industrial network data.

8. A real-time transmission device for industrial network data, characterized in that: The industrial network data real-time transmission device comprises: A determination module, used for determining the type of the first industrial network data to be sent; A first sending module, configured to skip the original kernel network protocol to send the first industrial network data if the type of the first industrial network data is a preset real-time transmission type; The second sending module is used to send the first industrial network data through the original kernel network protocol if the type of the first industrial network data is a preset non-real-time transmission type.

9. An industrial network data real-time transmission device, characterized in that: The industrial network data real-time transmission device includes: a memory, a processor, and an industrial network data real-time transmission program stored in the memory and executable on the processor. When the industrial network data real-time transmission program is executed by the processor, the steps of the industrial network data real-time transmission method as described in any one of claims 1 to 7 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores an industrial network data real-time transmission program, and when the industrial network data real-time transmission program is executed by a processor, the steps of the industrial network data real-time transmission method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • System and method for timely and uniform distribution for real-time packet transmission

    US20180295052A1