Data sending method and device and receiving method and device of TSN terminal
By establishing a DMA channel in the TSN terminal and utilizing the buffer address information and stream identification number of the data stream, the communication interruption problem between the Ethernet controller and the application is solved, and the real-time and deterministic performance of the TSN network is improved.
Patent Information
- Application Number
- CN202510785936.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-09-19
AI Technical Summary
In a TSN network, communication between Ethernet controller hardware and applications may be interrupted, affecting the real-time, deterministic, and congestion-free nature of the TSN network.
The application of the TSN terminal sends the buffer address information and stream identification number of the data stream to the network card, establishes a DMA channel, realizes real-time communication between the Ethernet controller hardware and the application, and uses the DMA channel to resolve the uncertainty of the Ethernet driver and network protocol stack of the real-time operating system.
It improves the real-time, deterministic and congestion-free performance of the TSN network, ensuring the time determinism and smoothness of data transmission.
Smart Images

Figure CN120675945A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communication technology, and in particular to a data sending method and device, and a data receiving method and device for a TSN terminal. Background Art
[0002] As we all know, TSN networks have the advantages of real-time, deterministic and congestion-free.
[0003] TSN network technology is well-defined and meets all of the aforementioned technical requirements. For real-time devices to connect to a TSN network, sending and receiving data must be fully deterministic across the entire real-time channel. This real-time channel begins with the application running on the device's real-time operating system (RTOS), extends down through the TSN protocol stack, and finally to the Ethernet device driver and Ethernet hardware.
[0004] However, communication interruptions between Ethernet controller hardware and applications can hinder the realization of TSN. Furthermore, the Ethernet drivers and network protocol stacks of most real-time operating systems are not deterministic, which undermines the expected real-time, deterministic, and congestion-free performance of TSN. Summary of the Invention
[0005] In view of this, the embodiments of the present application provide a data sending method and device, and a receiving method and device for a TSN terminal. The technical solution of the embodiments of the present application sends the address information and stream identification number of the buffer of the data stream to the network card through the application of the TSB terminal to establish a DMA channel for each transmitted data stream, and realizes the real-time communication between the Ethernet controller hardware and the application through the DMA channel, solves the uncertainty of the Ethernet driver and the network protocol stack of the real-time operating system itself, and improves the real-time, deterministic and congestion-free performance of the TSN network.
[0006] In the first aspect, an embodiment of the present application provides a data sending method for a TSN terminal, comprising: the application of the terminal sends the address information and flow identification number of the buffer of each sending data stream of the terminal to the connected network card; according to the address information of the buffer of the current sending data stream of the terminal, the content of the buffer is transferred to the network card connected to the terminal through a DMA controller; according to the flow identification number of the current sending data stream, the TSN flow feature information of the current sending data stream is matched from the flow feature matching table of the terminal; according to the flow feature information, the content is sent through the TSN network.
[0007] As described above, the application program at the TSB terminal sends the address information and stream identification number of the data stream buffer to the network card to establish a DMA channel for each data stream to be sent. The real-time communication between the Ethernet controller hardware and the application program is achieved through the DMA channel, which solves the uncertainty of the Ethernet driver program and the network protocol stack of the real-time operating system itself, and improves the real-time, deterministic and congestion-free performance of data sent by the TSN network.
[0008] In a possible implementation of the first aspect, it further includes: before the terminal sends data, configuring the flow feature matching table, each table entry in the flow feature matching table corresponds to a transmitted data flow, including TSN flow feature information of the data flow.
[0009] From the above, by statically configuring the flow feature matching table in advance, it is convenient to align the data flow with the receiver, so that the flow identification number of the sent data flow of the TSN terminal is the same as the flow identification number of the corresponding data flow in the data flow receiver.
[0010] In a possible implementation manner of the first aspect, the TSN flow characteristic information of each transmitted data flow includes a destination MAC address, a source MAC address, a TSN priority, and a VLAN ID.
[0011] From the above, the TSN data stream is sent through the MAC layer through the TSN flow feature information including the destination MAC address, source MAC address, TSN priority and VLAN ID.
[0012] In a possible implementation manner of the first aspect, the TSN flow characteristic information of each transmitted data flow further includes one of the following: a source IP address, a destination IP address, a source port number, and a destination port number.
[0013] From the above, the TSN stream feature information also includes one of the following: source IP address, destination IP address, source port number, destination port number, to increase the identity information of the sent data stream at the network layer and / or transport layer.
[0014] In a possible implementation of the first aspect, the network card is a PCIe device, and the application transmits the address information and stream identification number of the buffer of each data stream in each sending data stream to the network card through the PCIe interface through the write function to establish a DMA channel for each sending data stream.
[0015] From the above, the write function establishes a DMA channel from the application to the network card for each send data stream.
[0016] In a possible implementation of the first aspect, the write function is called once for each sent data stream, and the stream identification number of each sent data stream is mapped to the file descriptor of the called write function.
[0017] From the above, by mapping the stream identification number of each sending data stream with the file descriptor of the called write function, the DMA channel of each sending data stream is made to correspond to its stream identification number.
[0018] In a possible implementation of the first aspect, the TSN network transmits the content using an 802.1CB protocol.
[0019] As described above, the 802.1CB protocol transmits the sent data stream through the frame duplication and frame elimination methods, thereby improving the time certainty of the sent data stream.
[0020] In the second aspect, an embodiment of the present application provides a data receiving method for a TSN terminal, comprising: the application of the terminal sends the address information and flow identification number of the buffer of each received data stream of the terminal to the connected network card; the network card of the terminal receives a message from the TSN network, and obtains the received data stream corresponding to the message and the TSN flow feature information of the corresponding received data stream; according to the flow feature information, the flow identification number of the corresponding received data stream is obtained from the flow feature matching table of the terminal, and the address information of the buffer corresponding to the corresponding received data stream is obtained accordingly; according to the address information, the corresponding received data stream is transmitted to the buffer through the DMA controller to be received by the application of the terminal.
[0021] As described above, the application program at the TSB terminal sends the address information and stream identification number of the data stream buffer to the network card to establish a DMA channel for each received data stream. The real-time communication between the Ethernet controller hardware and the application program is achieved through the DMA channel, which solves the uncertainty of the Ethernet driver program and the network protocol stack of the real-time operating system itself, and improves the real-time, deterministic and congestion-free nature of data received by the TSN network.
[0022] In a possible implementation of the second aspect, the method further includes: configuring the flow feature matching table before the terminal receives the message from the TSN network.
[0023] From the above, by statically configuring the flow feature matching table in advance, it is convenient to align the data flow with the sender, so that the flow identification number of the received data flow of the TSN terminal is the same as the flow identification number of the corresponding data flow in the sender of the data flow.
[0024] In a possible implementation of the second aspect, the TSN flow characteristic information of each received data flow includes a destination MAC address, a source MAC address, a TSN priority, and a VLAN ID.
[0025] From the above, the TSN data stream is received through the MAC layer through the TSN flow feature information including the destination MAC address, source MAC address, TSN priority and VLAN ID.
[0026] In a possible implementation manner of the second aspect, the TSN flow characteristic information of each received data flow further includes one of the following: a source IP address, a destination IP address, a source port number, and a destination port number.
[0027] From the above, the TSN stream feature information also includes one of the following: source IP address, destination IP address, source port number, destination port number, to increase the identity information of the received data stream at the network layer and / or transport layer.
[0028] In a possible implementation of the second aspect, the network card is a PCIe device, and the application transmits the stream identification number and the address information of each received data stream to the network card through the PCIe interface through the read function to establish a DMA channel for each sent data stream.
[0029] From the above, a DMA channel is established from the application to the network card through the read function for each send data stream.
[0030] In a possible implementation of the second aspect, a read function is called once for each received data stream, and a stream identification number of each received data stream is mapped to a file descriptor of the called read function.
[0031] From the above, by mapping the stream identification number of each received data stream with the file descriptor of the called read function, the DMA channel of each received data stream is made to correspond to its stream identification number.
[0032] In a possible implementation of the second aspect, the TSN network uses the 802.1CB protocol to transmit the message.
[0033] As described above, the 802.1CB protocol receives data streams through frame replication and frame elimination methods, thereby improving the time certainty of receiving data streams.
[0034] In a third aspect, an embodiment of the present application provides a data sending device for a TSN terminal, comprising: an address sending module, for the application of the terminal to send the address information flow identification number of the buffer of each sending data stream of the terminal to the connected network card; a DAM sending module, for transmitting the content of the buffer to the network card through a DMA controller according to the address information of the buffer of the current sending data stream of the terminal; a sending matching module, for matching the TSN flow feature information of the current sending data stream from the flow feature matching table of the terminal according to the flow identification number of the current sending data stream, the TSN flow feature information including the target MAC address, source MAC address, TSN priority and VLAN ID; a network sending module, for transmitting the content through the TSN network according to the flow feature information.
[0035] As described above, the application program at the TSB terminal sends the address information and stream identification number of the data stream buffer to the network card to establish a DMA channel for each data stream to be sent. The real-time communication between the Ethernet controller hardware and the application program is achieved through the DMA channel, which solves the uncertainty of the Ethernet driver program and the network protocol stack of the real-time operating system itself, and improves the real-time, deterministic and congestion-free performance of data sent by the TSN network.
[0036] In a possible implementation of the third aspect, it further includes: a flow configuration module, which is used to configure the flow feature matching table before the terminal sends data, each table entry in the flow feature matching table corresponds to a sending data flow, including TSN flow feature information of the data flow.
[0037] From the above, by statically configuring the flow feature matching table in advance, it is convenient to align the data flow with the receiver, so that the flow identification number of the sent data flow of the TSN terminal is the same as the flow identification number of the corresponding data flow in the data flow receiver.
[0038] In a possible implementation manner of the third aspect, the TSN flow characteristic information of each transmitted data flow includes a destination MAC address, a source MAC address, a TSN priority, and a VLAN ID.
[0039] From the above, the TSN data stream is sent through the MAC layer through the TSN flow feature information including the destination MAC address, source MAC address, TSN priority and VLAN ID.
[0040] In a possible implementation manner of the third aspect, the TSN flow characteristic information of each transmitted data flow further includes one of the following: a source IP address, a destination IP address, a source port number, and a destination port number.
[0041] From the above, the TSN stream feature information also includes one of the following: source IP address, destination IP address, source port number, destination port number, to increase the identity information of the sent data stream at the network layer and / or transport layer.
[0042] In a possible implementation of the third aspect, the network card is a PCIe device, and the address sending module is specifically used by the application to transmit the address information and stream identification number of the buffer of each data stream in each sending data stream to the network card through the PCIe interface through a write function to establish a DMA channel for each sending data stream.
[0043] From the above, the write function establishes a DMA channel from the application to the network card for each send data stream.
[0044] In a possible implementation of the third aspect, the write function is called once for each sent data stream, and the stream identification number of each sent data stream is mapped to the file descriptor of the called write function.
[0045] From the above, by mapping the stream identification number of each sending data stream with the file descriptor of the called write function, the DMA channel of each sending data stream is made to correspond to its stream identification number.
[0046] In a possible implementation of the third aspect, the TSN network transmits the content using an 802.1CB protocol.
[0047] As described above, the 802.1CB protocol transmits the sent data stream through the frame duplication and frame elimination methods, thereby improving the time certainty of the sent data stream.
[0048] In a fourth aspect, an embodiment of the present application provides a data receiving device for a TSN terminal, comprising: an address sending module, for the application of the terminal to send the address information flow identification number of the buffer of each received data stream of the terminal to the connected network card; a network receiving module, for the network card to receive a message from the TSN network, and obtain the data stream corresponding to the message and the TSN flow feature information of the corresponding received data stream; a receiving matching module, for obtaining the flow identification number of the corresponding received data stream from the flow feature matching table of the terminal according to the flow feature information, and thereby obtaining the address information of the buffer corresponding to the corresponding received data stream; a DAM receiving module, for transmitting the corresponding received data stream to the buffer through the DMA controller according to the address information, so as to be received by the application of the terminal.
[0049] As described above, the application program at the TSB terminal sends the address information and stream identification number of the data stream buffer to the network card to establish a DMA channel for each received data stream. The real-time communication between the Ethernet controller hardware and the application program is achieved through the DMA channel, which solves the uncertainty of the Ethernet driver program and the network protocol stack of the real-time operating system itself, and improves the real-time, deterministic and congestion-free nature of data received by the TSN network.
[0050] In a possible implementation of the fourth aspect, the method further includes: a flow configuration module, configured to configure the flow feature matching table before the terminal receives a message from the TSN network.
[0051] From the above, by statically configuring the flow feature matching table in advance, it is convenient to align the data flow with the sender, so that the flow identification number of the received data flow of the TSN terminal is the same as the flow identification number of the corresponding data flow in the sender of the data flow.
[0052] In a possible implementation of the fourth aspect, the TSN flow characteristic information of each received data flow includes a destination MAC address, a source MAC address, a TSN priority, and a VLAN ID.
[0053] From the above, the TSN data stream is received through the MAC layer through the TSN flow feature information including the destination MAC address, source MAC address, TSN priority and VLAN ID.
[0054] In a possible implementation manner of the fourth aspect, the TSN flow characteristic information of each received data flow further includes one of the following: a source IP address, a destination IP address, a source port number, and a destination port number.
[0055] From the above, the TSN stream feature information also includes one of the following: source IP address, destination IP address, source port number, destination port number, to increase the identity information of the received data stream at the network layer and / or transport layer.
[0056] In a possible implementation of the fourth aspect, the network card is a PCIe device, and the address sending module is specifically used by the application to transmit the stream identification number and the address information of each received data stream to the network card through the PCIe interface through the read function to establish a DMA channel for each sent data stream.
[0057] From the above, a DMA channel is established from the application to the network card through the read function for each send data stream.
[0058] In a possible implementation of the fourth aspect, a read function is called once for each received data stream, and a stream identification number of each received data stream is mapped to a file descriptor of the called read function.
[0059] From the above, by mapping the stream identification number of each received data stream with the file descriptor of the called read function, the DMA channel of each received data stream is made to correspond to its stream identification number.
[0060] In a possible implementation of the fourth aspect, the TSN network uses the 802.1CB protocol to transmit the message.
[0061] As described above, the 802.1CB protocol receives data streams through frame replication and frame elimination methods, thereby improving the time certainty of receiving data streams.
[0062] In a fifth aspect, an embodiment of the present application provides a TSN terminal, comprising: the device described in the third aspect and the device described in the fourth aspect.
[0063] In a sixth aspect, an embodiment of the present application provides a TSN system, comprising: a TSN switch; and several TSN terminals, each TSN terminal comprising the apparatus described in the third aspect and the apparatus described in the fourth aspect, connected to a TSN switch.
[0064] The device described in the third aspect and the device described in the fourth aspect.
[0065] In the seventh aspect, an embodiment of the present application provides a computing device, comprising: a bus; a communication interface connected to the bus; at least one processor connected to the bus; and at least one memory connected to the bus and storing program instructions, wherein when the program instructions are executed by the at least one processor, the at least one processor executes the method described in any embodiment of the first or second aspect of the present application.
[0066] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a computer, causes the computer to execute the method described in any one of the embodiments of the first aspect or the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 This is a flow chart of an embodiment of a method for sending data to a TSN terminal of the present application;
[0068] Figure 2 This is a flow chart of an embodiment of a data receiving method for a TSN terminal of the present application;
[0069] Figure 3 This is a data schematic diagram of an embodiment of a data transmission method for a TSN terminal of the present application;
[0070] Figure 4 This is a flowchart of an embodiment of a data transmission method for a TSN terminal of the present application;
[0071] Figure 5 This is a structural diagram of an embodiment of a data sending device for a TSN terminal of the present application;
[0072] Figure 6 This is a structural diagram of an embodiment of a data receiving device for a TSN terminal of the present application;
[0073] Figure 7 This is a structural diagram of an embodiment of a data transmission device of a TSN terminal of the present application;
[0074] Figure 8 A schematic diagram of the structure of the computing device of this application. DETAILED DESCRIPTION
[0075] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0076] In the following description, the terms "first\second\third, etc." or module A, module B, module C, etc. are not only used to distinguish similar objects, or to distinguish different embodiments, but do not represent a specific ordering of the objects. It can be understood that the specific order or sequence can be interchanged where permitted so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0077] In the following description, the numbers representing the steps, such as S110, S120, etc., do not necessarily mean that the steps must be executed in this manner. If permitted, the order of the steps can be interchanged or they can be executed simultaneously.
[0078] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0079] The embodiments of the present application provide a data sending method and device, and a receiving method and device for a TSN terminal. The sending method includes: the application of the terminal sends the address information and stream identification number of the buffer of each sending data stream of the terminal to the connected network card; according to the address information of the buffer of the current sending data stream of the terminal, the content of the buffer is transmitted to the network card connected to the terminal through the DMA controller; according to the stream identification number of the current sending data stream, the TSN stream feature information of the current sending data stream is matched from the stream feature matching table of the terminal; according to the stream feature information, the content is sent through the TSN network. The embodiments of the present application also provide a data receiving method and device for a TSN terminal, which receives the data stream from the network card to the corresponding buffer through the DMA channel.
[0080] The technical solution of the embodiment of the present application sends the address information and stream identification number of the buffer of the data stream to the network card through the application of the TSB terminal to establish a DMA channel for each transmitted data stream, and realizes the real-time communication between the Ethernet controller hardware and the application through the DMA channel, thereby solving the uncertainty of the Ethernet driver and the network protocol stack of the real-time operating system itself, and improving the real-time, deterministic and congestion-free performance of the TSN network.
[0081] The following describes various embodiments of the present application in conjunction with the accompanying drawings. Figure 1 An embodiment of a data sending method for a TSN terminal of the present application is introduced.
[0082] Figure 1 The flowchart of an embodiment of a method for sending data of a TSN terminal is shown, including steps S110 to S140.
[0083] S110: The application of the TSN terminal sends the address information and stream identification number of the buffer of each transmitted data stream of the terminal to the connected network card.
[0084] The content of each transmit data stream's buffer is the data to be transmitted. The address information of each transmit data stream's buffer corresponds to the stream identification number of the data stream. The address information of each transmit data stream's buffer includes the starting address and data length of the buffer. The stream identification number is represented by streamID, for example, stream100.
[0085] Among them, the TSN terminal includes user state and kernel state. The application of the TSN terminal is in user state. The starting address of the buffer of each sending data stream is the physical address after the user state address is mapped. The network card driver of the TSN terminal is implemented in the kernel state. After the network card receives the address information and stream identification number of the buffer of each sending data stream, a DMA channel is established for each sending data stream through the kernel state. The DMA channel is a DMA logical channel.
[0086] In some embodiments, the TSN terminal network card is a PCIe device, and the application of the TSN terminal sends the address information of the buffer of each transmitted data stream and the stream identification number of the data stream to the network card of the TSN terminal through the write function, so as to establish a DMA channel from the application to the network card for each transmitted data stream through the write function.
[0087] In some embodiments, the write function is called once for each transmit data stream, and the stream identification number of each transmit data stream is mapped to the file descriptor of the called write function, so that the DMA channel of each transmit data stream corresponds to its stream identification number.
[0088] S120: According to the address information of the buffer of the current sending data stream of the TSN terminal, the content of the buffer is transmitted to the network card of the TSN terminal through the DMA controller.
[0089] When a TSN terminal application sends data, it sends it to a buffer for its data stream. The network card of the TSN terminal is a peripheral device, and the DMA channel between the peripheral device and the buffer for the TSN terminal application's send data stream is called an RDMA (Remote DMA) channel.
[0090] The DMA channel corresponding to the current sending data stream has been established in step S110, and the DMA controller directly transmits data through the DMA channel.
[0091] S130: According to the flow identification number of the data flow currently sent by the TSN terminal, TSN flow feature information of the data flow is matched from the flow feature matching table of the TSN terminal.
[0092] In some embodiments, the TSN flow signature information for each transmitted data stream includes the data stream's destination MAC address, source MAC address, TSN priority, and VLAN ID, for transmission of the data stream via the MAC layer. The TSN priority is the priority in the VLAN tag. Each entry in the flow signature matching table corresponds to a data stream, is indexed by the data stream's flow identification number, and includes the TSN flow signature information for that data stream.
[0093] In some embodiments, the TSN stream feature information of each transmitted data stream further includes one of the following: source IP address, destination IP address, source port number, destination port number, and additional network layer and / or transport layer information.
[0094] In some embodiments, the data stream sent by the TSN terminal can be a data stream of the link layer, application layer, transport layer or network layer. It is differentiated according to the needs of the application program of the TSN terminal. When the data stream sent is the application layer, the TSN stream feature information of each data stream sent also includes: source IP address, target IP address, source port number, target port number; when the data stream sent is the transport layer, the TSN stream feature information of each data stream sent also includes: source IP address, target IP address, source port number, target port number; when the data stream sent is the network layer, the TSN stream feature information of each data stream sent also includes: source IP address and target IP address.
[0095] In some embodiments, before a TSN terminal sends data, a flow feature matching table of the TSN terminal is configured to facilitate alignment of the data flow with the receiver. The flow identification number of the data flow sent by the TSN terminal is the same as the flow identification number of the corresponding data flow in the data flow receiver.
[0096] In some embodiments, the flow feature matching table of the TSN terminal is statically configured. In other embodiments, when the TSN adds a transmitted data stream, it adds an entry for the transmitted data stream to the flow feature matching table and notifies the receiver to add an entry for the received data stream corresponding to the transmitted data stream in its flow feature matching table.
[0097] S140: According to the flow characteristic information of the current data flow sent by the TSN terminal, the TSN terminal network card sends the buffer content obtained by using DMA through the TSN network.
[0098] The TSN terminal network card encodes the content based on the TSN protocol according to the stream feature information of the currently transmitted data stream and then sends it through the TSN network.
[0099] In some embodiments, a TSN network uses the 802.1CB protocol to transmit data, including: generating link layer header information and an 802.1CB protocol R-TAG tag based on the flow characteristics of the currently transmitted data flow, and generating a TSN message to be sent over the TSN network. The link layer header information includes a VLAN-TAG tag, which includes a VLAN ID and priority.
[0100] In some embodiments, when the TSN priority of the current sending data stream exceeds or is equal to the set value, this embodiment is used to send data; when the TSN priority of the current sending data stream is lower than the set value, the application of the TSN terminal sends data to the network card driver located in the kernel to avoid the low TSN priority sending data stream occupying the DMA channel and affecting the transmission of the high TSN priority sending data stream, especially when there is only one physical channel in the DMA, even if the DMA has multiple logical channels, data is transmitted through one physical channel.
[0101] In summary, an embodiment of a data sending method for a TSN terminal sends the address information and stream identification number of the buffer of the data stream to the network card through the application of the TSB terminal to establish a DMA channel for each data stream to be sent. The real-time communication between the application and the Ethernet controller hardware is achieved through the DMA channel, which solves the uncertainty of the Ethernet driver and the network protocol stack of the real-time operating system itself, and improves the real-time, deterministic and congestion-free performance of the TSN network when sending data.
[0102] The following combination Figure 2 An embodiment of a data receiving method for a TSN terminal of the present application is introduced.
[0103] A data receiving method embodiment of a TSN terminal receives a message sent by the sending method embodiment of a data sending method of a TSN terminal.
[0104] Figure 2 The flowchart of an embodiment of a method for receiving data of a TSN terminal is shown, including steps S210 to S240.
[0105] S210: The application of the TSN terminal sends the address information and stream identification number of the buffer of each received data stream of the terminal to the connected network card.
[0106] The content of each received data stream's buffer is the received data. The address information of each received data stream's buffer corresponds to the stream identification number of the data stream. The address information of each received data stream's buffer includes the starting address and data length of the buffer. The stream identification number is represented by streamID, for example, stream100.
[0107] Among them, the TSN terminal includes user state and kernel state. The application of the TSN terminal is in user state. The starting address of the buffer of each received data stream is the physical address mapped from the user state address. The network card driver of the TSN terminal is implemented in kernel state. After the network card receives the address information and stream identification number of the buffer of each received data stream, a DMA channel is established for each received data stream through the kernel state. The DMA channel is a DMA logical channel.
[0108] In some embodiments, the TSN terminal network card is a PCIe device, and the application of the TSN terminal sends the address information of the buffer of each received data stream and the stream identification number of the data stream to the network card of the TSN terminal through the read function, so as to establish a DMA channel from the application to the network card for each received data stream through the read function.
[0109] In some embodiments, the read function is called once for each received data stream, and the stream identification number of each received data stream is mapped to the file descriptor of the called read function, so that the DMA channel of each received data stream corresponds to its stream identification number.
[0110] S220: The network card of the TSN terminal receives a message from the TSN network, and obtains the corresponding received data stream and TSN flow feature information of the data stream.
[0111] Among them, the message received by the network card of the TSN terminal from the TSN network is a TSN message, which is a message of the TSN protocol at the link layer, including the header information of the link layer. After removing the header information of each TSN message, the corresponding received data stream is obtained.
[0112] The TSN message includes TSN stream feature information of the corresponding received data stream in the link layer header information, namely, the destination MAC address, source MAC address, TSN priority and VLAN ID. The TSN priority and VLAN ID are included in the VLAN-TAG tag.
[0113] In some embodiments, the TSN stream feature information of each received data stream is the same as the content of the data stream sent in the data sending method embodiment of the same TSN terminal, including the target MAC address, source MAC address, TSN priority and VLAN ID, and the TSN priority is the priority in the VLAN-TAG tag.
[0114] In some embodiments, the network card of the TSN terminal receives a message from the TSN network using the 802.1CB protocol, including:
[0115] The link layer header information and R-TAG label of the received message are obtained and removed to obtain the initial data stream; the TSN flow feature information of the received data stream is obtained based on the address information in the link layer header information and the TSN priority and VLAN ID in the VLAN-TAG label; the repeated data frames in the initial data stream are removed according to the R-TAG label to obtain the final received data stream.
[0116] S230: According to the flow feature information of the received data flow, the flow identification number of the data flow is obtained from the flow feature matching table of the TSN terminal, and the address information of the buffer corresponding to the data flow is obtained accordingly.
[0117] Among them, each table entry in the flow feature matching table corresponds to a received data flow, is indexed by the flow identification number of the data flow, and includes the TSN flow feature information of the data flow.
[0118] The address information of each buffer for receiving data streams corresponds to the stream identification number of the data stream one by one, and the address information of the buffer for each data stream includes the starting address and data length of the data stream in the buffer.
[0119] In some embodiments, before a TSN terminal receives a message from the TSN network, it configures its stream feature matching table to facilitate alignment of the data stream with the sender. The stream identification number of the received data stream at the TSN terminal is the same as the stream identification number of the corresponding data stream at the sender of the data stream, and the stream feature matching table of the TSN terminal is statically configured. In some embodiments, when the sender's sent data stream arrangement changes, the corresponding received data is also updated in the feature matching table by the receiver.
[0120] In some embodiments, the TSN stream feature information of each received data stream further includes one of the following: source IP address, destination IP address, source port number, and destination port number, adding network layer and / or transport layer information.
[0121] S240: According to the address information of the buffer of the current received data stream of the TSN terminal, the received data stream is transmitted to the buffer through the DMA controller.
[0122] The TSN terminal application obtains the received data from the buffer of the received data stream. The network card of the TSN terminal is a peripheral device, and the DMA channel between the peripheral device and the buffer of the TSN terminal application is called an RDMA (Remote DMA) channel.
[0123] In some embodiments, the received data stream can be a data stream at the link layer, application layer, transport layer, or network layer, depending on the application requirements of the TSN terminal. When the received data stream is at the application layer, the TSN stream feature information of each received data stream also includes: source IP address, destination IP address, source port number, and destination port number; when the received data stream is at the transport layer, the TSN stream feature information of each received data stream also includes: source IP address, destination IP address, source port number, and destination port number; when the received data stream is at the network layer, the TSN stream feature information of each received data stream also includes: source IP address and destination IP address.
[0124] In some embodiments, when the TSN priority of the currently received data stream exceeds or is equal to a set value, this embodiment is used to receive data; when the TSN priority of the currently sent data stream is lower than the set value, the application of the TSN terminal receives data from the network card driver located in the kernel, especially when there is only one physical channel in the DMA, even if the DMA has multiple logical channels, data is transmitted through one physical channel.
[0125] In summary, an embodiment of a data receiving method for a TSN terminal sends the address information and stream identification number of the buffer of the data stream to the network card through the application of the TSB terminal to establish a DMA channel for each received data stream, and realizes the real-time communication from the Ethernet controller hardware to the application through the DMA channel, solves the uncertainty of the Ethernet driver and the network protocol stack of the real-time operating system itself, and improves the real-time, deterministic and congestion-free performance of the TSN network when receiving data.
[0126] The following combination Figure 3 and Figure 4 An embodiment of a data transmission method for a TSN terminal of the present application is introduced.
[0127] An embodiment of a data transmission method for a TSN terminal combines the sending method described in an embodiment of a data sending method for a TSN terminal and the receiving method described in an embodiment of a data receiving method for a TSN terminal.
[0128] Figure 3 A data schematic diagram of an embodiment of a data transmission method for TSN terminals is shown. The diagram uses the example of an application program APP-1 in user state on TSN terminal-1 sending data to an application program APP-2 in user state on TSN terminal-2. Both the network card-1 of TSN terminal-1 and the network card-2 of TSN terminal-2 are PCIe devices, mounted in the kernel state of TSN terminal-1 and TSN terminal-2, respectively. In a TSN network, TSN packets are transmitted using at least the 802.1CB protocol via TSN network switches. For example, the diagram shows TSN switch 1 and TSN switch 2, transmitting 802.1CB protocol data frames over two paths.
[0129] Figure 4 The flowchart of an embodiment of a data transmission method for a TSN terminal is shown, including steps S310 to S365.
[0130] Among them, step S310 is executed after TSN terminal-1 and TSN terminal-2 are started, steps S320, S330, S340, S350 and S360 are executed sequentially when TSN terminal-1 sends data, steps S320 and S330 are executed in user mode, and S340, S350 and S360 are executed in kernel mode; steps S325, S335, S345, S355 and S365 are executed sequentially when TSN terminal-2 receives data, steps S325 and S365 are executed in user mode, and S335, S345 and S355 are executed in kernel mode.
[0131] S310: The TSN terminal configures its own flow feature matching table.
[0132] Among them, each TSN terminal (including TSN terminal-1 and TSN terminal-2) executes this step after startup. After the flow orchestration of the TSN network is completed, the TSN feature information of the user-state data flow (including the received data flow and the sent data flow) of each TSN terminal is configured in a flow feature matching table.
[0133] The TSN feature information for each data flow includes the destination MAC address, source MAC address, TSN priority, VLAN ID, source IP address, destination IP address, source port number, and destination port number. The data flow is the application layer data flow. The TSN priority of each data flow defines the determinism requirement for the data flow.
[0134] S320: APP-1 transmits the stream identification number and buffer address information of each sending data stream to the network card-1 of the TSN terminal through the PCIe interface through the write function to establish a DMA channel for sending data streams.
[0135] The fd (file descriptor) of the write function corresponds to the stream identification number of the data stream being sent, and includes the buffer address information of the data stream being sent. The buffer address information includes the starting address of the buffer and the data length, and the starting address is the physical space address.
[0136] S330: APP-1 writes the transmission data into the buffer corresponding to the current transmission data stream.
[0137] APP-1 writes and sends data to the corresponding buffer according to its own user-state address, and the user-state address is automatically mapped to a physical address.
[0138] S340: According to the address information of the buffer corresponding to the current sending data stream, the content of the buffer is transmitted to the network card-1 of the TSN terminal-1 through the DMA controller.
[0139] Among them, the DMA controller does not need to occupy CPU time, occupies a dedicated bus, has a fast transmission speed, and realizes the deterministic transmission of the data stream from the user-mode application to the network card-1 of the TSN terminal-1.
[0140] S350: According to the flow identification number of the currently transmitted data flow, the TSN flow feature information of the currently transmitted data flow is matched from the flow feature matching table of TSN terminal-1.
[0141] The stream identification number of the currently transmitted data stream can be obtained according to the current DMA channel, and the TSN stream feature information of the currently transmitted data stream can be obtained in real time from the stream feature matching table of TSN terminal-1 using the stream identification number as an index.
[0142] S360: According to the flow characteristic information of the currently transmitted data flow, the currently transmitted data is segmented and a corresponding packet header is added to form a TSN message, and the message is sent to the TSN network using the 802.1CB protocol.
[0143] The packet header includes the link layer's destination MAC address, source MAC address, VLAN TAG tag, and 802.1CB's R-TAG tag, as well as the source IP address and destination IP address, and transport layer information obtained based on the source port number and destination port number.
[0144] Among them, the 802.1CB protocol further improves the determinism of the TSN network.
[0145] S325: APP-2 transmits the stream identification number and buffer address information of each received data stream to the network card-2 of TSN terminal-2 through the PCIe interface through the read function, so as to establish a DMA channel for each received data stream.
[0146] The fd (file descriptor) of the read function corresponds to the stream identification number of the received data stream and includes the buffer address information of the received data stream. The buffer address information includes the starting address of the buffer and the data length. The starting address is the physical space address.
[0147] S335: The network card-2 of the TSN terminal-2 receives a message from the TSN network using the 802.1CB protocol, and obtains the corresponding received data stream and TSN flow feature information of the received data stream.
[0148] The received packet header includes the link layer's destination and source MAC addresses, VLAN tags, the network layer's source and destination IP addresses, and transport layer information. Based on this information in the packet header, the TSN flow characteristics of the received data stream are obtained. Furthermore, based on the 802.1CB R-TAG tag in the received packet header, duplicate packets are deleted and the packet header is removed to obtain the corresponding received data stream.
[0149] S345: According to the flow feature information of the current received data flow, the flow identification number of the current received data flow is obtained from the flow feature matching table of TSN terminal-2, and the address information of the buffer corresponding to the current received data flow is obtained accordingly.
[0150] Among them, a combined query is performed based on the flow feature information of the currently received data flow. For example, a TCAM hardware query method is used to obtain the flow identification number of the transmitted data flow in real time from the flow feature matching table of TSN terminal-2; and the buffer address information of the currently received data flow is obtained based on the flow identification number.
[0151] S355: According to the buffer address information of the current received data stream, the current received data stream is transferred to the corresponding buffer through the DMA controller.
[0152] Among them, the DMA controller does not need to occupy CPU time, occupies a dedicated bus, has a fast transmission speed, and realizes the deterministic transmission of the received data stream from the network card-2 of the TSN terminal-2 to the user-mode application.
[0153] S365: APP-2 receives data from the buffer corresponding to the current received data stream.
[0154] The following combination Figure 5 An embodiment of a data sending device of a TSN terminal of the present application is introduced.
[0155] An embodiment of a data sending device for a TSN terminal executes the sending method described in an embodiment of a data sending method for a TSN terminal, and has all the advantages thereof.
[0156] Figure 5 The structure of an embodiment of a data sending device of a TSN terminal is shown, including: an address sending module 510 , a DMA sending module 520 , a sending matching module 530 and a network sending module 540 .
[0157] The address sending module 510 is used by the application of the TSN terminal to send the address information and stream identification number of the buffer of each transmitted data stream of the terminal to the connected network card. Its working principle and advantages can be referred to step S110 of an embodiment of a data sending method of a TSN terminal.
[0158] The DMA sending module 520 is used to transmit the content of the buffer of the current data stream of the TSN terminal to the network card of the TSN terminal through the DMA controller according to the address information of the buffer of the current data stream of the TSN terminal. Its working principle and advantages can be referred to step S120 of the embodiment of the data sending method of a TSN terminal.
[0159] The transmission matching module 530 is used to match the TSN flow feature information of the data flow from the flow feature matching table of the TSN terminal according to the flow identification number of the current data flow transmitted by the TSN terminal. For its working principle and advantages, please refer to step S130 of the embodiment of the data transmission method of a TSN terminal.
[0160] The network sending module 540 sends the buffer content obtained by using the DMA channel through the TSN network according to the flow characteristic information of the current data flow sent by the TSN terminal. For its working principle and advantages, please refer to step S140 of an embodiment of a data sending method for a TSN terminal.
[0161] In some embodiments, the data sending device of the TSN terminal further includes: a flow configuration module, configured to configure a flow feature matching table of the TSN terminal before the TSN terminal receives a message from the TSN network.
[0162] The following combination Figure 6 An embodiment of a data receiving device for a TSN terminal of the present application is introduced.
[0163] An embodiment of a data transmitting and receiving device for a TSN terminal executes the sending method described in an embodiment of a data receiving method for a TSN terminal, and has all the advantages thereof.
[0164] Figure 6 The structure of an embodiment of a data receiving device of a TSN terminal is shown, which includes: an address sending module 610 , a network receiving module 620 , a receiving matching module 630 and a DMA receiving module 640 .
[0165] The address sending module 610 is used by the application of the TSN terminal to send the address information and stream identification number of the buffer of each received data stream of the terminal to the connected network card. Its working principle and advantages can be referred to step S210 of an embodiment of a data receiving method of a TSN terminal.
[0166] The network receiving module 620 is used by the network card of the TSN terminal to receive messages from the TSN network and obtain the corresponding received data stream and TSN flow feature information of the data stream. For its working principle and advantages, please refer to step S220 of an embodiment of a data receiving method for a TSN terminal.
[0167] The receiving matching module 630 is used to obtain the flow identification number of the data flow from the flow feature matching table of the TSN terminal based on the flow feature information of the currently received data flow, and accordingly obtain the address information of the buffer corresponding to the data flow. For the working principle and advantages of this module, please refer to step S230 of the embodiment of a data receiving method for a TSN terminal.
[0168] The DMA receiving module 640 is used to transfer the received data stream to the corresponding buffer through the DMA controller according to the address information of the buffer of the current received data stream of the TSN terminal. Its working principle and advantages can be referred to step S240 of an embodiment of a data receiving method of a TSN terminal.
[0169] In some embodiments, the data receiving device of the TSN terminal further includes: a flow configuration module, configured to configure a flow feature matching table of the TSN terminal before the TSN terminal receives a message from the TSN network.
[0170] The following combination Figure 7 An embodiment of a data transmission device for a TSN terminal of the present application is introduced.
[0171] An embodiment of a data transmitting and receiving device for a TSN terminal includes the device described in an embodiment of a data transmitting device for a TSN terminal and the device described in an embodiment of a data receiving device for a TSN terminal.
[0172] Figure 7 The structure of a TSN terminal embodiment is shown, including: a flow configuration module 710, a first address sending module 720, a data sending module 730, a DMA sending module 740, a sending matching module 750 and a network sending module 760, a second address sending module 725, a network receiving module 735, a receiving matching module 745, a DMA receiving module 755 and a data receiving module 765.
[0173] The flow configuration module 710 is used for the TSN terminal to configure its own flow feature matching table. For its working principle and advantages, please refer to step S310 of an embodiment of a data transmission method for a TSN terminal.
[0174] When the first address sending module 720 is used as a sender of the TSN terminal, its APP (application) transmits the stream identification number and buffer address information of each transmitted data stream to the network card of the TSN terminal through the PCIe interface through the write function. For its working principle and advantages, please refer to step S320 of an embodiment of a data transmission method for a TSN terminal.
[0175] When the data sending module 730 is used as a sender of a TSN terminal, its APP writes the sending data into the buffer corresponding to the current sending data stream. For its working principle and advantages, please refer to step S330 of an embodiment of a data transmission method of a TSN terminal.
[0176] When the DMA sending module 740 is used as a sender of the TSN terminal, it transmits the contents of the buffer corresponding to the current sending data stream to the network card of the TSN terminal through the DMA controller according to the address information of the buffer. For its working principle and advantages, please refer to step S340 of an embodiment of a data transmission method for a TSN terminal.
[0177] When the sending matching module 750 is used as a sender of the TSN terminal, the TSN flow feature information of the currently sent data flow is matched from the flow feature matching table of the TSN terminal according to the flow identification number of the currently sent data flow. For its working principle and advantages, please refer to step S350 of an embodiment of a data transmission method of a TSN terminal.
[0178] When the network sending module 760 is used as a sender of a TSN terminal, it segments the currently transmitted data and adds corresponding packet headers according to the flow characteristic information of the currently transmitted data stream to form a TSN message, and sends it to the TSN network using the 802.1CB protocol. For its working principle and advantages, please refer to step S360 of an embodiment of a data transmission method for a TSN terminal.
[0179] When the second address sending module 725 is used for the TSN terminal as the receiver, the APP of the TSN terminal transmits the stream identification number and buffer address information of each received data stream to the network card of the TSN terminal through the PCIe interface through the read function. Its working principle and advantages can be referred to step S325 of an embodiment of a data transmission method for a TSN terminal.
[0180] When the network receiving module 735 is used for the TSN terminal as the receiver, the TSN terminal network card uses the 802.1CB protocol to receive messages from the TSN network and obtain the current received data stream and the TSN flow feature information of the received data stream. For its working principle and advantages, please refer to step S335 of an embodiment of a data transmission method for a TSN terminal.
[0181] When the receiving matching module 745 is used as a TSN terminal as a receiver, it obtains the flow identification number of the current receiving data flow from the flow feature matching table of the TSN terminal according to the flow feature information of the current receiving data flow, and obtains the address information of the buffer corresponding to the current receiving data flow accordingly. For its working principle and advantages, please refer to step S345 of an embodiment of a data transmission method of a TSN terminal.
[0182] When the DMA receiving module 755 is used as a receiver for the TSN terminal, the DMA controller transmits the current received data stream to the corresponding buffer according to the buffer address information of the current received data stream. For its working principle and advantages, please refer to step S355 of an embodiment of a data transmission method for a TSN terminal.
[0183] When the data receiving module 765 is used as a TSN terminal as a receiver, its APP receives data from the buffer corresponding to the current received data stream. For its working principle and advantages, please refer to step S365 of an embodiment of a data transmission method for a TSN terminal.
[0184] An embodiment of the present application further provides a TSN system, comprising: a TSN switch and several TSN terminals; each TSN terminal is connected to a TSN switch, including a device described in an embodiment of a data sending device of a TSN terminal and a device described in an embodiment of a data receiving device of a TSN terminal, or a device described in an embodiment of a data transmission device of a TSN terminal.
[0185] An embodiment of the present application further provides a TSN terminal, comprising a device described in an embodiment of a data sending device of a TSN terminal and a device described in an embodiment of a data receiving device of a TSN terminal, or a device described in an embodiment of a data transmission device of a TSN terminal.
[0186] The present application embodiment also provides a computing device, Figure 8Detailed introduction.
[0187] The computing device 800 includes a processor 810 , a memory 820 , a communication interface 830 , and a bus 840 .
[0188] It should be understood that the communication interface 830 in the computing device 800 shown in this figure can be used to communicate with other devices.
[0189] The processor 810 may be connected to a memory 820. The memory 820 may be used to store the program code and data. Therefore, the memory 820 may be a storage unit within the processor 810, an external storage unit independent of the processor 810, or a component including both a storage unit within the processor 810 and an external storage unit independent of the processor 810.
[0190] Optionally, computing device 800 may further include a bus 840. Memory 820 and communication interface 830 may be connected to processor 810 via bus 840. Bus 840 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, for example. Bus 840 may be classified as an address bus, a data bus, a control bus, and the like. For ease of illustration, the figure uses only one line, but this does not imply that there is only one bus or only one type of bus.
[0191] It should be understood that in the embodiment of the present application, the processor 810 can adopt a central processing unit (CPU). The processor can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. Alternatively, the processor 810 adopts one or more integrated circuits to execute relevant programs to implement the technical solutions provided in the embodiment of the present application.
[0192] The memory 820 may include a read-only memory and a random access memory, and provides instructions and data to the processor 810. A portion of the processor 810 may also include a non-volatile random access memory. For example, the processor 810 may also store information about the device type.
[0193] When the computing device 800 is running, the processor 810 executes the computer-executable instructions in the memory 820 to perform the operating steps of each method embodiment.
[0194] It should be understood that the computing device 800 according to the embodiment of the present application can correspond to the corresponding subject in executing the method according to each embodiment of the present application, and the above-mentioned and other operations and / or functions of each module in the computing device 800 are respectively for implementing the corresponding processes of each method of the present embodiment. For the sake of brevity, they will not be repeated here.
[0195] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0196] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0197] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0198] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0199] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0200] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0201] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it is used to perform the operating steps of each method embodiment.
[0202] The computer storage medium of the embodiment of the present application can adopt any combination of one or more computer-readable media.Computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium.Computer-readable storage medium can be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof.More specific examples (non-exhaustive list) of computer-readable storage medium include, an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.
[0203] A computer-readable signal medium may include a data signal transmitted in baseband or as part of a carrier wave, which carries computer-readable program code. Such a transmitted data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, transfer, or convey a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0204] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0205] The computer program code for performing the operations of the present application can be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0206] Note that the above are only preferred embodiments of the present application and the technical principles employed. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of protection of the present application, all of which fall within the scope of protection of the present application.
Claims
1. A data transmission method for a TSN terminal, characterized in that: include: The application of the terminal sends the address information and stream identification number of the buffer of each sent data stream of the terminal to the connected network card; According to the address information of the buffer zone of the terminal currently sending the data stream, the content of the buffer zone is transmitted to the network card through the DMA controller; Matching TSN flow feature information of the currently transmitted data flow from a flow feature matching table of the terminal according to the flow identification number of the currently transmitted data flow; The content is sent through the TSN network according to the stream characteristic information.
2. The method according to claim 1, characterized in that Also includes: Before the terminal sends data, the flow feature matching table is configured, and each table entry in the flow feature matching table corresponds to a sending data flow, including TSN flow feature information of the data flow.
3. The method according to claim 1, characterized in that The TSN flow characteristic information of each transmitted data flow includes the destination MAC address, source MAC address, TSN priority and VLAN ID.
4. The method according to claim 3, characterized in that The TSN stream feature information of each transmitted data stream also includes one of the following: source IP address, destination IP address, source port number, and destination port number.
5. The method according to claim 1, characterized in that: The network card is a PCIe device, and the application of the terminal sends address information and a stream identification number of a buffer of each sent data stream of the terminal to the connected network card, including: The application transmits the address information and stream identification number of the buffer of each data stream in the sending data stream to the network card through the PCIe interface through the write function, so as to establish a DMA channel corresponding to each sending data stream.
6. The method according to claim 5, characterized in that The write function is called once for each send data stream, and the stream identification number of each send data stream is mapped to the file descriptor of the called write function.
7. A data receiving method for a TSN terminal, characterized in that: include: The application of the terminal sends the address information and stream identification number of the buffer of each received data stream of the terminal to the connected network card; The network card of the terminal receives a message from the TSN network, and obtains a received data stream corresponding to the message and TSN flow feature information of the corresponding received data stream; Obtaining, according to the flow feature information, a flow identification number of the corresponding received data flow from a flow feature matching table of the terminal, and obtaining address information of a buffer corresponding to the corresponding received data flow accordingly; According to the address information, the corresponding received data stream is transmitted to the buffer through a DMA controller so as to be received by an application of the terminal.
8. A data sending device for a TSN terminal, characterized in that: include: An address sending module, configured for the application of the terminal to send the address information flow identification number of the buffer zone of each sent data flow of the terminal to the connected network card; DA M sending module, used for transmitting the content of the buffer zone to the network card through the DMA controller according to the address information of the buffer zone of the current sending data stream of the terminal; A sending matching module, configured to match the TSN flow feature information of the currently sent data flow from the flow feature matching table of the terminal according to the flow identification number of the currently sent data flow; A network sending module is used to transmit the content through the TSN network according to the stream characteristic information.
9. A data receiving device for a TSN terminal, characterized in that: include: An address sending module, configured for the application of the terminal to send the address information flow identification number of the buffer of each received data flow of the terminal to the connected network card; A network receiving module, configured for the network card to receive a message from the TSN network and obtain TSN flow characteristic information of the data flow corresponding to the message and the corresponding received data flow; a receiving matching module, configured to obtain, from a flow feature matching table of the terminal according to the flow feature information, a flow identification number of the corresponding received data flow, and obtain address information of a buffer corresponding to the corresponding received data flow accordingly; The DMA receiving module transmits the corresponding received data stream to the buffer through the DMA controller according to the address information, so as to be received by the application of the terminal.
10. A TSN system, characterized in that: include: TSN switches; Several TSN terminals, each TSN terminal is connected to a TSN switch, including the device described in claim 8 and the device described in claim 9.