User-mode stack architecture system supporting TSN protocol under Tianmai operating system and implementation method thereof

By designing a user-state protocol stack architecture in Tianmai operating system, the kernel protocol stack performance bottleneck and insufficient TSN service support are solved, and efficient data forwarding and low-latency TSN data stream processing are achieved.

CN118524157BActive Publication Date: 2025-02-07NANJING QUANXIN CABLE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410763528.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-14
Publication Date
2025-02-07
Estimated Expiration
2044-06-14

AI Technical Summary

Technical Problem

The kernel protocol stack of Tianmai multi-core partitioned operating system has differentiated requirements for performance bottlenecks, poor scalability, and does not support TSN services, resulting in unstable delay and jitter of TSN data on the software side.

Method used

Design a user-state protocol stack architecture system that supports TSN protocol under Tianmai operating system, and complete data flow shaping and shaping by reducing memory copy, expanding TSN service support, sharing ARP table entries and routing table entries resources, and using TSN scheduling module Priority is given to scheduling to reduce latency and jitter on the software side.

Benefits of technology

It significantly improves data throughput, improves TSN data forwarding performance, reduces jitter and time delay of TSN data streams on the software side, reduces the delay by more than 10%, and reduces the end-to-end jitter of 802.1BV data from 1us to below 0.1us.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118524157B_ABST
    Figure CN118524157B_ABST
Patent Text Reader

Abstract

The present invention provides a user-mode stack architecture system supporting TSN protocol under Tianmai operating system and its implementation method, the protocol stack system includes an API module, a management module for deployment management of the protocol stack, an FD module for socket management, a TSN scheduling module, a data cache module, a packet receiving and sending module, a table entry management module and an OPS interface module. The user-mode protocol stack architecture supporting TSN protocol under Tianmai operating system proposed by the present invention greatly improves data forwarding performance by reducing memory copying, and expands the support of TSN services to meet the differentiated QoS requirements of users, so as to better support the requirements of TSN services on the software system side; at the same time, in order to maximize the efficiency of resource utilization, the user-mode protocol stack and the kernel protocol stack share resources such as ARP table items and routing table items, and complete the shaping and sending and receiving of TSN key data streams on the software side through the TSN scheduling module, thereby reducing the delay and jitter on the software side.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, in particular to Ethernet network transmission technology, and specifically to a user-mode stack architecture system supporting TSN protocol under the Tianmai operating system and an implementation method thereof. Background Art

[0002] ACoreOS is a domestically produced airborne operating system developed by AVIC Computer. It has the characteristics of strong real-time, high security, high reliability, high certainty, scalability, and upgradeability. With the help of the matching integrated development environment AcoreIDE, users can quickly complete the development, debugging and deployment of embedded applications. ACoreOS has realized support for multiple architectures such as PowerPC, X86, ARM, MIPS, etc., and is widely used in the field of airborne embedded systems.

[0003] With the development of network technology, Tianmai multi-core partition operating system, as the main branch of Tianmai operating system, has been increasingly applied and developed. This system can be applied to airborne electronic equipment. It is an integrated modular avionics system (IMA) and an operating system that can simultaneously meet the "time" and "space" robust partition protection of the ARINC653 standard. In addition to being able to realize basic task scheduling, equipment management and other functions, Tianmai multi-core partition operating system can also realize time partition management, space partition management, health monitoring, inter-partition communication and other functions.

[0004] Under the Tianmai multi-core operating system, the partition is based on the standard socket interface of the Tianmai operating system, and completes the UDP / TCP layer encapsulation, IP layer encapsulation, data link layer encapsulation, etc. of the data through the Tianmai main partition kernel TCP / IP protocol stack. The driver module completes the data sending and receiving mechanism through the End layer access mechanism of the Tianmai kernel TCP / IP protocol stack.

[0005] However, in actual use, we found that the kernel protocol stack of Tianmai multi-core partitioned operating system has the following problems: 1) The performance bottleneck is large because it involves multiple data copies, and the actual measured performance is low. Under the same hardware conditions, the performance is far lower than the indicators under the Linux system; 2) The scalability needs to be improved. The kernel protocol stack resides in the kernel, with poor scalability, and it is impossible to customize the corresponding technology to improve throughput; 3) It does not support the differentiated needs of TSN services. TSN has put forward differentiated requirements for network transmission, requiring high-priority traffic to be sent and received first. The Tianmai kernel TCP / IP protocol stack adopts the fair scheduling principle, which is easy to cause instability in the delay jitter of TSN data on the software side; 4) TSN key protocols developed on the network card logic side, such as 802.1AV protocol, 802.1BV protocol, and 802.1AS protocol, reduce the delay and jitter of TSN data transmission, but because the data is processed differently by different CPUs and different operating systems, it will increase the delay and jitter of the data. Summary of the invention

[0006] In view of the defects and shortcomings of the prior art, the purpose of the present invention is to provide a user-mode protocol stack architecture system that supports the TSN protocol under the Tianmai operating system. The protocol stack greatly improves the data forwarding performance by reducing memory copies, and expands the support for TSN services to meet the differentiated QoS requirements of users, so as to better support the requirements of TSN services on the software system side; at the same time, in order to maximize the efficiency of resource utilization, the user-mode protocol stack and the kernel protocol stack share resources such as ARP table entries and routing table entries, and complete the shaping and reception of TSN key data streams on the software side through the TSN scheduling module, thereby reducing the delay and jitter on the software side.

[0007] According to a first aspect of the present invention, a user-mode stack architecture system supporting TSN protocol under the Tianmai operating system is proposed, comprising:

[0008] API module, used to provide multiple API interfaces for multiple partitions of Tianmai operating system, and complete the creation of interface sockets based on different types of API interfaces;

[0009] Management module, used for deployment and management of the protocol stack;

[0010] The FD module is used to provide the management of the socket resource pool and the socket FD, including maintaining a global file descriptor for each socket and returning it to the user;

[0011] TSN scheduling module, used for scheduling TSN data streams. For data streams created by TSN sockets, the TSN scheduling module uses an independent data cache module to complete the priority scheduling of TSN data streams;

[0012] A data cache module, used for data cache, wherein the data cache module is configured to perform cache processing of queue data using socket FD as a keyword;

[0013] The packet receiving and sending module is used for encapsulation of data receiving and sending packets and internal jumps;

[0014] The entry management module is used to manage routing tables and ARP entries, which are dynamically learned by synchronizing the corresponding entries of the kernel protocol stack of the Tianmai operating system;

[0015] The OPS interface module is used to complete the adaptation management of packet sending and receiving with the underlying driver, where: in the packet sending direction, the driver module of the Tianmai operating system provides a locked packet sending function for simultaneous use by the user-mode protocol stack and the kernel protocol stack; in the packet receiving direction, different DMA receiving queues are used to identify whether the data is sent to the user-mode protocol stack or the kernel protocol stack, and different service table items are sent and sent on the network card, thereby identifying different DMA queues of the data on the logical side.

[0016] As an optional embodiment, the API module includes:

[0017] Configure the common socket API call interface and provide the interface functions of common socket creation, socket connection establishment, and socket sending and receiving; and

[0018] Configure the TSN-specific socket API call interface, and create a socket for TSN to send and receive packets based on the TSN-specific socket API call interface.

[0019] As an optional embodiment, the management module is configured to support the following protocol stack deployment modes:

[0020] The protocol stack follows a distributed deployment with multiple partitions running; and

[0021] Centralized deployment where the protocol stack is deployed separately in the OS partition.

[0022] As an optional embodiment, the OPS interface module includes a packet receiving interface, a packet sending interface and a network device interface adapted to the driver module;

[0023] After completing the adaptation with the driver module, the driver module is configured to send the data packets received from the network card to the packet sending and receiving module through the packet receiving interface, and the protocol stack sends the received data packets to the network card through the driver packet sending interface.

[0024] As an optional embodiment, the packet receiving and sending module includes UDP and TCP protocols of the transport layer, IP protocol of the network layer and ARP protocol of the data link layer.

[0025] As an optional embodiment, after the partition user calls the created socket, the data sent by the user based on the file descriptor corresponding to the socket is encapsulated by the packet transceiver module. The encapsulation when sending data includes:

[0026] First, the transport layer is encapsulated. This layer encapsulation depends on the FD module. Each partition user file descriptor is associated with the user source port, destination port, source IP, destination IP, and Option attributes. The packet receiving and sending module searches for the source port and destination port fields associated with the socket created by the user, and completes UDP or TCP encapsulation based on these fields.

[0027] Then the network layer encapsulation is performed, which is completed by the FD module and the routing table entry. The FD module provides the key source IP and destination IP fields of the network layer, and the routing table entry completes the judgment of whether the data is routeable. Only when the destination IP address / mask field exists in the routing table can the network be forwarded; the routing table entry subscribes to and shares the kernel's routing table;

[0028] Finally, the data link layer encapsulation is completed. This layer depends on the ARP table entries. The ARP table entries are obtained synchronously by the kernel's ARP protocol. If there is no ARP table entry, it is necessary to call the kernel interface to complete ARP learning and then encapsulate the ARP table entry.

[0029] As an optional embodiment, the TSN scheduling module includes a high-precision timer module, a basic module, a shaping module, and a bandwidth recording module, wherein:

[0030] The high-precision timer module is used to provide accurate system time;

[0031] The shaping module is used to complete the preemptive scheduling of data based on the high-precision timer and the scheduled transmission of data;

[0032] The basic scheduling module is used to complete the BE data transmission and reception;

[0033] The bandwidth recording module is used to receive and record the feedback DMA back pressure information when the driver DMA receives data overflow from the underlying hardware, and feed the bandwidth information back to the shaping scheduling module to complete data shaping, seize the bandwidth for forwarding non-TSN data streams, and ensure that TSN data streams are sent first.

[0034] According to the second aspect of the present invention, a method for implementing a user-mode stack architecture system supporting the TSN protocol under the Tianmai operating system is also proposed, including protocol stack deployment, user API management, network packet sending and receiving management, and TSN scheduling management, wherein:

[0035] (1) Protocol stack deployment

[0036] The management module completes the protocol stack deployment. The partition configuration of the Tianmai operating system is determined by the deployment file provided by the protocol stack management module to determine the deployment mode. The deployment modes include distributed deployment and centralized deployment. Distributed deployment refers to deploying the protocol stack in the partitioned module. At this time, the protocol stack and the partitioned application share CPU resources and adopt a mode of directly calling the protocol stack socket API; centralized deployment deploys the protocol stack independently in the operating system partition. At this time, the protocol stack and the partitioned application adopt a mode of shared memory communication or system call;

[0037] (2) User API management

[0038] The API module of the protocol stack provides an interface for partition calling, and after the partition calling, the sending and receiving of network data begins; the interface includes: a common socket API calling interface, and provides interface functions for common socket creation, socket connection establishment, and socket sending and receiving; a TSN-specific socket API calling interface, and creates a socket for TSN packet sending and receiving based on the TSN-specific socket API calling interface;

[0039] For each socket, the FD module maintains a global file descriptor and returns the file descriptor to the user. For connections created by ordinary sockets, the protocol stack provides socket cache forwarding capabilities. For connections created by TSN sockets, the protocol stack provides a TSN scheduling module, which ensures the priority of data flows based on TSN socket connections and gives priority scheduling.

[0040] (3) Network packet management

[0041] After the partition user calls the created socket, the data sent by the user based on the file descriptor corresponding to the socket is encapsulated by the packet receiving and sending module; and the data packet is decapsulated after it is received;

[0042] (4) TSN scheduling management

[0043] TSN scheduling management includes priority scheduling of TSN data streams and scheduling adjustments based on DMA back pressure, including:

[0044] For the data stream created by the TSN socket, the TSN scheduling module uses an independent data cache module to complete the priority scheduling of the TSN data stream through a high-precision timer, preempting the bandwidth forwarded by non-TSN data streams in the scheduling process to ensure the timeliness of TSN data stream transmission; and

[0045] After the driver DMA receives data overflow from the underlying hardware, it performs data scheduling adjustments and shapes the data according to the received DMA back pressure information and bandwidth information.

[0046] As an optional embodiment, the processing of the network packet sending and receiving management, the data stream encapsulation when sending data includes:

[0047] First, the transport layer is encapsulated. This layer encapsulation depends on the FD module. Each partition user file descriptor is associated with the user source port, destination port, source IP, destination IP, and Option attributes. The packet receiving and sending module searches for the source port and destination port fields associated with the socket created by the user, and completes UDP or TCP encapsulation based on these fields.

[0048] Then the network layer encapsulation is performed, which is completed by the FD module and the routing table entry. The FD module provides the key source IP and destination IP fields of the network layer, and the routing table entry completes the judgment of whether the data is routeable. Only when the destination IP address / mask field exists in the routing table can the network be forwarded; the routing table entry subscribes to the routing table of the shared kernel;

[0049] Finally, the data link layer encapsulation is completed. This layer depends on the ARP table entries. The ARP table entries are obtained synchronously by the kernel's ARP protocol. If there is no ARP table entry, it is necessary to call the kernel interface to complete ARP learning and then encapsulate the ARP table entry.

[0050] As an optional embodiment, the processing of the network packet sending and receiving management, the decapsulation process after receiving the data stream includes:

[0051] For received messages, the file descriptor to which the message belongs is first searched. Once the descriptor is found, it is sent to the packet receiving cache of the corresponding partition. The specific file descriptor is found by parsing the message quintuple keyword and part of the Option field, thereby completing the data receiving process.

[0052] Based on the technical solution of the present invention, based on the officially released Tianmai 3 operating system, a user-mode stack architecture supporting the TSN protocol under the Tianmai operating system and its implementation method are proposed to address the performance issues found in the process of developing TSN network interface cards. Based on this solution, the following significant beneficial effects can be achieved:

[0053] (1) It greatly improves the data throughput of the Tianmai 3 operating system. Through system calls or shared memory solutions, it reduces data memory copies. At the same time, it improves the performance of the network interface card through user-mode scheduling and sending. Currently, based on the actual test results of this system solution, the TSN data forwarding performance has been improved by 2 times;

[0054] (2) When BE and TSN streams are mixed, the priority of TSN data can be guaranteed on the network interface card forwarding side, but the congestion of BE data on the software side will greatly affect the delay and jitter of TSN data. Through the delay and jitter test before and after use, it is found that the system solution proposed by the present invention reduces the jitter and delay of TSN data flow on the software side, and the delay is reduced by more than 10%. For 802.1BV data, the end-to-end jitter can be reduced from about 1us to less than 0.1us;

[0055] (3) The customized interface expands user-friendliness. The distinction between TSN sockets and ordinary sockets allows partition users to effectively distinguish different data streams in programming. At the same time, good scalability can be combined with user SLA to expand the corresponding Option socket interface, allowing the scheduling module to implement refined flow scheduling and further reduce software-side jitter and latency.

[0056] It should be understood that all combinations of the aforementioned concepts and the additional concepts described in more detail below can be considered as part of the inventive subject matter of the present disclosure as long as such concepts are not mutually inconsistent. In addition, all combinations of the claimed subject matter are considered as part of the inventive subject matter of the present disclosure.

[0057] The foregoing and other aspects, embodiments and features of the present invention can be more fully understood from the following description in conjunction with the accompanying drawings. Other additional aspects of the present invention, such as the features and / or beneficial effects of the exemplary embodiments, will be apparent from the following description or learned from the practice of the specific embodiments according to the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] The accompanying drawings are not intended to be drawn to scale. In the accompanying drawings, each identical or nearly identical component shown in each figure may be represented by the same reference numeral. For clarity, not every component is labeled in each figure. Embodiments of various aspects of the present invention will now be described by way of example and with reference to the accompanying drawings.

[0059] Figure 1 1 is an architecture diagram of a user-mode protocol stack system based on the TSN protocol according to an embodiment of the present invention.

[0060] Figure 2 It is a schematic diagram of a distributed deployment mode of a protocol stack according to an embodiment of the present invention.

[0061] Figure 3 It is a schematic diagram of a centralized deployment mode of a protocol stack according to an embodiment of the present invention.

[0062] Figure 4 is a schematic diagram of a FC module according to an embodiment of the present invention.

[0063] Figure 5 is a schematic diagram of a TSN scheduling module according to an embodiment of the present invention. DETAILED DESCRIPTION

[0064] In order to better understand the technical content of the present invention, specific embodiments are given and described as follows in conjunction with the accompanying drawings.

[0065] Various aspects of the present invention are described in this disclosure with reference to the accompanying drawings, in which many illustrative embodiments are shown. The embodiments of the present disclosure are not necessarily intended to include all aspects of the present invention. It should be understood that the various concepts and embodiments introduced above, as well as those described in more detail below, can be implemented in any of many ways, because the concepts and embodiments disclosed by the present invention are not limited to any implementation. In addition, some aspects disclosed by the present invention can be used alone or in any appropriate combination with other aspects disclosed by the present invention.

[0066] User stack architecture system supporting TSN protocol under Tianmai operating system

[0067] Combination Figure 1 as well as Figures 2 to 5 As shown, the user-mode stack architecture supporting the TSN protocol under the Tianmai operating system according to an embodiment of the present invention includes:

[0068] API module, used to provide multiple API interfaces for multiple partitions of Tianmai operating system, and complete the creation of interface sockets based on different types of API interfaces;

[0069] Management module, used for deployment and management of the protocol stack;

[0070] The FD module is used to provide the management of the socket resource pool and the socket FD, including maintaining a global file descriptor for each socket and returning it to the user;

[0071] TSN scheduling module, used for scheduling TSN data streams. For data streams created by TSN sockets, the TSN scheduling module uses an independent data cache module to complete the priority scheduling of TSN data streams;

[0072] A data cache module, used for data cache, wherein the data cache module is configured to perform cache processing of queue data using socket FD as a keyword;

[0073] The packet receiving and sending module is used for encapsulation of data receiving and sending packets and internal jumps;

[0074] The entry management module is used to manage routing tables and ARP entries, which are dynamically learned by synchronizing the corresponding entries of the kernel protocol stack of the Tianmai operating system;

[0075] The OPS interface module is used to complete the adaptation management of packet sending and receiving with the underlying driver, where: in the packet sending direction, the driver module of the Tianmai operating system provides a locked packet sending function for simultaneous use by the user-mode protocol stack and the kernel protocol stack; in the packet receiving direction, different DMA receiving queues are used to identify whether the data is sent to the user-mode protocol stack or the kernel protocol stack, and different service table items are sent and sent on the network card, thereby identifying different DMA queues of the data on the logical side.

[0076] As an optional embodiment, the API module provides customized and differentiated API interfaces for multiple partitions of the Tianmai system. As an example, the interface types configured include:

[0077] Configure the common socket API call interface and provide the interface functions of common socket creation, socket connection establishment, and socket sending and receiving; and

[0078] Configure the TSN-specific socket API call interface, and create a socket for TSN to send and receive packets based on the TSN-specific socket API call interface.

[0079] As an optional embodiment, the management module provides protocol stack deployment management and is configured to support the following protocol stack deployment modes:

[0080] The protocol stack follows a distributed deployment with multiple partitions running; and

[0081] Centralized deployment where the protocol stack is deployed separately in the OS partition.

[0082] As an optional embodiment, the OPS interface module includes a packet receiving interface, a packet sending interface and a network device interface adapted to the driver module;

[0083] After completing the adaptation with the driver module, the driver module is configured to send the data packets received from the network card to the packet sending and receiving module through the packet receiving interface, and the protocol stack sends the received data packets to the network card through the driver packet sending interface.

[0084] As an optional embodiment, the packet receiving and sending module includes UDP and TCP protocols of the transport layer, IP protocol of the network layer and ARP protocol of the data link layer.

[0085] Combination Figure 1 As shown, the table management includes the management of routing table and ARP table. The routing table and ARP table synchronize the corresponding table module of the Tianmai operating system kernel. Among them, there are many sources of routing, which may be dynamic routing learning, configuration routing, interface routing, etc. The ARP table is dynamically learned according to the ARP protocol of the kernel protocol stack.

[0086] As an optional embodiment, after the partition user calls the created socket, the data sent by the user based on the file descriptor corresponding to the socket is encapsulated by the packet transceiver module. The encapsulation when sending data includes:

[0087] First, the transport layer is encapsulated. This layer encapsulation depends on the FD module. Each partition user file descriptor is associated with the user source port, destination port, source IP, destination IP, and Option attributes. The packet receiving and sending module searches for the source port and destination port fields associated with the socket created by the user, and completes UDP or TCP encapsulation based on these fields.

[0088] Then the network layer encapsulation is performed, which is completed by the FD module and the routing table entry. The FD module provides the key source IP and destination IP fields of the network layer, and the routing table entry completes the judgment of whether the data is routeable. Only when the destination IP address / mask field exists in the routing table can the network be forwarded; the routing table entry subscribes to and shares the kernel's routing table;

[0089] Finally, the data link layer encapsulation is completed. This layer depends on the ARP table entries. The ARP table entries are obtained synchronously by the kernel's ARP protocol. If there is no ARP table entry, it is necessary to call the kernel interface to complete ARP learning and then encapsulate the ARP table entry.

[0090] As an optional embodiment, the TSN scheduling module includes a high-precision timer module, a basic module, a shaping module, and a bandwidth recording module, wherein:

[0091] The high-precision timer module is used to provide accurate system time;

[0092] The shaping module is used to complete the preemptive scheduling of data based on the high-precision timer and the scheduled transmission of data;

[0093] The basic scheduling module is used to complete the BE data transmission and reception;

[0094] The bandwidth recording module is used to receive and record the feedback DMA back pressure information when the driver DMA receives data overflow from the underlying hardware, and feed the bandwidth information back to the shaping scheduling module to complete data shaping, seize the bandwidth for forwarding non-TSN data streams, and ensure that TSN data streams are sent first.

[0095] According to an embodiment of the present invention, a method for implementing a user-mode stack architecture system supporting the TSN protocol under the Tianmai operating system is also proposed, including protocol stack deployment, user API management, network packet sending and receiving management, and TSN scheduling management.

[0096] (1) Protocol stack deployment

[0097] The protocol stack deployment is completed by the management module. The partition configuration of the Tianmai operating system is determined by the deployment file provided by the protocol stack management module. The deployment modes include distributed deployment and centralized deployment. Distributed deployment means deploying the protocol stack in the partitioned module. At this time, the protocol stack and the partitioned application share CPU resources and adopt a mode of directly calling the protocol stack socket API; centralized deployment deploys the protocol stack independently in the operating system partition. At this time, the protocol stack and the partitioned application adopt a shared memory communication or system call mode.

[0098] (2) User API management

[0099] The API module of the protocol stack provides an interface for partition calling, and after the partition calling, the sending and receiving of network data begins; the interface includes: a common socket API calling interface, and provides interface functions for common socket creation, socket connection establishment, and socket sending and receiving; a TSN-specific socket API calling interface, and creates a socket for TSN packet sending and receiving based on the TSN-specific socket API calling interface.

[0100] For each socket, the FD module maintains a global file descriptor and returns the file descriptor to the user. For connections created by ordinary sockets, the protocol stack provides socket cache forwarding capabilities. For connections created by TSN sockets, the protocol stack provides a TSN scheduling module. The TSN scheduling module ensures the priority of data flows based on TSN socket connections and priority scheduling.

[0101] (3) Network packet management

[0102] After the partition user calls the created socket, the data sent by the user based on the file descriptor corresponding to the socket is encapsulated by the packet receiving and sending module; and the data packet is decapsulated after it is received.

[0103] (4) TSN scheduling management

[0104] TSN scheduling management includes priority scheduling of TSN data streams and scheduling adjustments based on DMA back pressure, including:

[0105] For the data stream created by the TSN socket, the TSN scheduling module uses an independent data cache module to complete the priority scheduling of the TSN data stream through a high-precision timer, preempting the bandwidth forwarded by non-TSN data streams in the scheduling process to ensure the timeliness of TSN data stream transmission; and

[0106] After the driver DMA receives data overflow from the underlying hardware, it performs data scheduling adjustments and shapes the data according to the received DMA back pressure information and bandwidth information.

[0107] As an optional embodiment, the processing of the network packet sending and receiving management, the data stream encapsulation when sending data includes:

[0108] First, the transport layer is encapsulated. This layer encapsulation depends on the FD module. Each partition user file descriptor is associated with the user source port, destination port, source IP, destination IP, and Option attributes. The packet receiving and sending module searches for the source port and destination port fields associated with the socket created by the user, and completes UDP or TCP encapsulation based on these fields.

[0109] Then the network layer encapsulation is performed, which is completed by the FD module and the routing table entry. The FD module provides the key source IP and destination IP fields of the network layer, and the routing table entry completes the judgment of whether the data is routeable. Only when the destination IP address / mask field exists in the routing table can the network be forwarded; the routing table entry subscribes to the routing table of the shared kernel;

[0110] Finally, the data link layer encapsulation is completed. This layer depends on the ARP table entries. The ARP table entries are obtained synchronously by the kernel's ARP protocol. If there is no ARP table entry, it is necessary to call the kernel interface to complete ARP learning and then encapsulate the ARP table entry.

[0111] As an optional embodiment, the processing of the network packet sending and receiving management, the decapsulation process after receiving the data stream includes:

[0112] For received messages, the file descriptor to which the message belongs is first searched. Once the descriptor is found, it is sent to the packet receiving cache of the corresponding partition. The specific file descriptor is found by parsing the message quintuple keyword and part of the Option field, thereby completing the data receiving process. Example

[0113] The user-mode protocol stack architecture system based on the above embodiments is deployed and explained using the Tianmai 3 operating system as an example.

[0114] Each partition under the Tianmai 3 operating system runs on an independent CPU core. These partitions can choose different deployment modes based on resource differences when using the protocol stack. During deployment and use, the interface between the Tianmai operating system and the protocol stack is involved. For the eight modules included in the protocol stack, the driver module, partition module, and kernel protocol stack module (such as Figure 1 As shown in the figure, they are connected with the eight modules in the protocol stack of the foregoing embodiment of the present invention to complete the construction of the entire system.

[0115] As an example, the deployment process of the user-mode TSN protocol stack that supports multiple partitions under the Tianmai operating system is as follows:

[0116] (1) First, complete the adaptation of the Tianmai operating system driver module and the TSN protocol stack. The protocol stack develops a packet receiving interface, a packet sending interface, and a network device interface through the OPS interface to complete the adaptation with the driver module. After the driver module is adapted, the data packets received from the network card are sent to the packet receiving and sending module of the protocol stack. The protocol stack sends the received data packets to the network card through the driver packet sending interface;

[0117] (2) Complete the adaptation of the protocol stack to the Tianmai 3 kernel protocol stack, including subscribing to routing table entries and ARP table entries. The subscription process protocol stack is supported in the module in the source code and does not require the participation of other modules;

[0118] (3) The management module completes the deployment and use of the protocol stack through the API interface (deployment file). As an example, the protocol stack supports two deployment modes for the Tianmai 3 multi-partition system: distributed deployment and centralized deployment;

[0119] (4) Multi-partition users call the API header file released by the protocol stack, and create sockets and send and receive messages based on the API socket interface included in the API header file.

[0120] It should be understood that the API header file is provided by the protocol stack and is adapted and used by users of multiple partitions.

[0121] As an example, the interface includes two types of interfaces: ordinary socket API calls and TSN-specific socket API calls. The TSN-specific socket provides SLA injection parameters, partition parameters, bandwidth parameters, time urgency and other parameters to facilitate the completion of data-refined differentiated scheduling in the scheduling module.

[0122] The TSN protocol stack can be built through the above four steps.

[0123] Combination Figure 1 , Figure 4 , 5 The working process of the protocol stack mainly includes four processes: protocol stack deployment management, user API management, network packet sending and receiving, and TSN scheduling.

[0124] The protocol stack deployment for partitions is completed by the protocol stack management module.

[0125] The deployment mode is determined by the deployment file provided by the partition configuration protocol stack management module.

[0126] The deployment modes are divided into distributed deployment and centralized deployment. The distributed deployment mode requires the protocol stack to be deployed in the module in the partition. At this time, the protocol stack and the partitioned application share CPU resources and adopt the mode of directly calling the protocol stack socket API; the centralized deployment mode requires the protocol stack to be deployed in the operating system partition. At this time, the protocol stack and the partitioned application adopt the mode of shared memory communication or system call.

[0127] Combination Figure 2 , 3 The deployments shown are examples of distributed deployment mode and centralized deployment mode.

[0128] In the distributed deployment mode, the protocol stack is deployed in each partition. The partition and the protocol stack are on the same CPU core. The partition uses the protocol stack function by directly calling the API interface of the protocol stack. At this time, the partition needs to be mapped through different DMA queues in the network card logic layer and the driver to complete the data transmission and reception between the driver and the TSN protocol stack.

[0129] In the centralized deployment mode, the partition completes the function of calling the API interface of the protocol stack through the customized API system call (or customized shared memory call) provided by the TSN protocol stack. At this time, the protocol stack and the driver are on the same CPU core, and the driver completes the data transmission and reception through the DMA queue.

[0130] The protocol stack API module provides an interface for partition calling, and after the partition is called, the sending and receiving of network data begins.

[0131] The interface provided by the API module is a customized interface. On the one hand, it provides interface functions such as socket creation, socket connection establishment, and socket sending and receiving similar to the operating system. On the other hand, it provides a TSN-specific socket API interface based on the socket interface, and creates a socket for TSN sending and receiving packets based on the TSN interface.

[0132] For each socket, the FD module maintains a global file descriptor and returns the file descriptor to the user. For connections created by ordinary sockets, the protocol stack provides socket cache forwarding capabilities. For connections created by TSN sockets, the protocol stack provides a TSN scheduling module to ensure the data flow priority based on the TSN socket connection. At the same time, the TSN scheduling module receives the DMA back pressure of the underlying OPS module to perform data scheduling adjustments and other tasks.

[0133] After the user calls to create the socket, the data sent by the user based on the file descriptor is encapsulated by the packet transceiver module.

[0134] The encapsulation process when sending is as follows:

[0135] First, the transport layer is encapsulated. This layer encapsulation depends on the FD module. The storage relationship of this module is as follows Figure 4 As shown, each partition user file descriptor is associated with the user source port, destination port, source IP, destination IP, and Option attributes;

[0136] The packet receiving and sending module looks up the source port and destination port fields associated with the socket created by the user, and completes UDP or TCP encapsulation based on the fields;

[0137] Then the network layer encapsulation is performed, which is completed by the FD module and the routing table entry. The FD module provides the key source IP and destination IP fields of the network layer. The routing table entry completes the judgment of whether the data is reachable by route. Only when the destination IP address / mask field exists in the routing table can the network be forwarded; the routing table entry subscribes to and shares the kernel's routing table;

[0138] Finally, the data link layer encapsulation is completed. This layer depends on the ARP table entries, and the ARP table entries also depend on the kernel's ARP protocol. For those without ARP table entries, the kernel interface needs to be called to complete ARP learning and then encapsulate the ARP table entries.

[0139] In the embodiment of the present invention, the fragmentation of the message is completed by the bottom network card, such as the UFO function, the TSO function, etc. The protocol stack proposed in the present invention is not responsible for the specific work of message fragmentation.

[0140] The decapsulation process when receiving a data stream is as follows:

[0141] For received messages, the main task is to find the file descriptor to which the message belongs. After finding the descriptor, it can be sent to the packet receiving cache of the corresponding partition. It mainly parses the message quintuple keyword and some Option fields to find the determined file descriptor, thereby completing the data receiving process.

[0142] Scheduling management refers to the completion of the scheduling of TSN data streams. For the data streams created by the TSN sockets, the scheduling module uses an independent data cache module and completes the TSN data priority scheduling through a high-precision timer. In the scheduling process, it can seize the bandwidth for forwarding non-TSN data streams to ensure the timeliness of TSN data stream transmission.

[0143] This scheduling module can effectively reduce the delay of TSN data stream on the software side, reduce the jitter of TSN data stream on the software side, and ensure the high efficiency of software and hardware data interaction.

[0144] Combination Figure 5As shown in the figure, the scheduling module architecture is divided into four modules, namely, high-precision timer module, basic module, shaping module, and bandwidth recording module; the high-precision timer module provides accurate system time, the shaping module can complete preemptive scheduling of data based on high-precision timer, scheduled data transmission and other functions, the basic scheduling module completes BE data reception and transmission, and the bandwidth recording module drives DMA to receive the data overflow of the underlying hardware and feeds back the back pressure information to the bandwidth recording module of TSN scheduling, and then feeds back the bandwidth information to the shaping scheduling module, completing the effective shaping of the data, reducing and suppressing the DMS data overflow.

[0145] Although the present invention has been disclosed as above with preferred embodiments, it is not intended to limit the present invention. A person with ordinary knowledge in the technical field to which the present invention belongs may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be determined by the definition of the claims.

Claims

1. A user-mode stack architecture system supporting TSN protocol under Tianmai operating system, characterized in that: include: API module, used to provide multiple API interfaces for multiple partitions of Tianmai operating system, and complete the creation of interface sockets based on different types of API interfaces; Management module, used for deployment and management of the protocol stack; The FD module is used to provide the management of the socket resource pool and the socket FD, including maintaining a global file descriptor for each socket and returning it to the user; TSN scheduling module, used for scheduling TSN data streams. For data streams created by TSN sockets, the TSN scheduling module uses an independent data cache module to complete the priority scheduling of TSN data streams; A data cache module, used for data cache, wherein the data cache module is configured to perform cache processing of queue data using socket FD as a keyword; The packet receiving and sending module is used for encapsulation of data receiving and sending packets and internal jumps; The entry management module is used to manage routing tables and ARP entries, which are dynamically learned by synchronizing the corresponding entries of the kernel protocol stack of the Tianmai operating system; The OPS interface module is used to complete the adaptation management of the underlying driver receiving and sending packets, where: in the packet sending direction, the driver module of the Tianmai operating system provides a locked packet sending function for simultaneous use by the user-mode protocol stack and the kernel protocol stack; in the packet receiving direction, different DMA receiving queues are used to identify whether the data is sent to the user-mode protocol stack or the kernel protocol stack, and different service table items are sent and sent on the network card, thereby identifying different DMA queues of the data on the logical side; The TSN scheduling module is used to implement priority scheduling of TSN data streams and scheduling adjustment based on DMA back pressure, including: For the data stream created by the TSN socket, the TSN scheduling module uses an independent data cache module to complete the priority scheduling of the TSN data stream through a high-precision timer, preempting the bandwidth forwarded by non-TSN data streams in the scheduling process to ensure the timeliness of TSN data stream transmission; and After the driver DMA receives data overflow from the underlying hardware, it performs data scheduling adjustments and shapes the data according to the received DMA back pressure information and bandwidth information.

2. The user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 1, characterized in that: The API module includes: Configure the common socket API call interface and provide the interface functions of common socket creation, socket connection establishment, and socket sending and receiving; and Configure the TSN-specific socket API call interface, and create a socket for TSN to send and receive packets based on the TSN-specific socket API call interface.

3. The user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 1, characterized in that: The management module is configured to support the following protocol stack deployment modes: The protocol stack follows a distributed deployment with multiple partitions running; and Centralized deployment where the protocol stack is deployed separately in the OS partition.

4. The user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 1, characterized in that: The OPS interface module includes a packet receiving interface, a packet sending interface and a network device interface adapted to the driver module; After completing the adaptation with the driver module, the driver module is configured to send the data packets received from the network card to the packet sending and receiving module through the packet receiving interface, and the protocol stack sends the received data packets to the network card through the driver packet sending interface.

5. The user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 1, characterized in that: The packet receiving and sending module includes UDP and TCP protocols at the transport layer, IP protocol at the network layer and ARP protocol at the data link layer.

6. The user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 1, characterized in that: After the partition user calls the created socket, the data sent by the user based on the file descriptor corresponding to the socket is encapsulated by the packet sending and receiving module. The encapsulation when sending data includes: First, the transport layer is encapsulated. This layer encapsulation depends on the FD module. Each partition user file descriptor is associated with the user source port, destination port, source IP, destination IP, and Option attributes. The packet receiving and sending module searches for the source port and destination port fields associated with the socket created by the user, and completes UDP or TCP encapsulation based on these fields. Then the network layer encapsulation is performed, which is completed by the FD module and the routing table entry. The FD module provides the key source IP and destination IP fields of the network layer, and the routing table entry completes the judgment of whether the data is routeable. Only when the destination IP address / mask field exists in the routing table can the network be forwarded; the routing table entry subscribes to and shares the kernel's routing table; Finally, the data link layer encapsulation is completed. This layer depends on the ARP table entries. The ARP table entries are obtained synchronously by the kernel's ARP protocol. If there is no ARP table entry, it is necessary to call the kernel interface to complete ARP learning and then encapsulate the ARP table entry.

7. The user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 1, characterized in that: The TSN scheduling module includes a high-precision timer module, a basic scheduling module, a shaping scheduling module and a bandwidth recording module, wherein: High-precision timer module, used to provide accurate system time; Basic scheduling module, used to complete BE data transmission and reception; The shaping scheduling module is used to complete TSN data priority scheduling based on high-precision timers and scheduling adjustment based on DMA back pressure, seize the bandwidth of non-TSN data stream forwarding, and ensure that TSN data streams are sent first; The bandwidth recording module is used to receive and record the feedback DMA back pressure information when the driver DMA receives data overflow from the underlying hardware, and feed the bandwidth information back to the shaping scheduling module.

8. The method for implementing a user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 1, characterized in that: It includes protocol stack deployment, user API management, network packet sending and receiving management, and TSN scheduling management, including: (1) Protocol stack deployment The management module completes the protocol stack deployment. The partition configuration of the Tianmai operating system is determined by the deployment file provided by the protocol stack management module to determine the deployment mode. The deployment modes include distributed deployment and centralized deployment. Distributed deployment refers to deploying the protocol stack in the partitioned module. At this time, the protocol stack and the partitioned application share CPU resources and adopt a mode of directly calling the protocol stack socket API; centralized deployment deploys the protocol stack independently in the operating system partition. At this time, the protocol stack and the partitioned application adopt a mode of shared memory communication or system call; (2) User API management The API module of the protocol stack provides an interface for partition calling, and after the partition calling, the sending and receiving of network data begins; the interface includes: a common socket API calling interface, and provides interface functions for common socket creation, socket connection establishment, and socket sending and receiving; a TSN-specific socket API calling interface, and creates a socket for TSN packet sending and receiving based on the TSN-specific socket API calling interface; For each socket, the FD module maintains a global file descriptor and returns the file descriptor to the user. For connections created by ordinary sockets, the protocol stack provides socket cache forwarding capabilities. For connections created by TSN sockets, the protocol stack provides a TSN scheduling module, which ensures the priority of data flows based on TSN socket connections and gives priority scheduling. (3) Network packet management After the partition user calls the created socket, the data sent by the user based on the file descriptor corresponding to the socket is encapsulated by the packet receiving and sending module; and the data packet is decapsulated after it is received; (4) TSN scheduling management TSN scheduling management includes priority scheduling of TSN data streams and scheduling adjustments based on DMA back pressure, including: For the data stream created by the TSN socket, the TSN scheduling module uses an independent data cache module to complete the priority scheduling of the TSN data stream through a high-precision timer, preempting the bandwidth forwarded by non-TSN data streams in the scheduling process to ensure the timeliness of TSN data stream transmission; and After the driver DMA receives data overflow from the underlying hardware, it performs data scheduling adjustments and shapes the data according to the received DMA back pressure information and bandwidth information.

9. The method for implementing a user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 8, characterized in that: The processing of the network packet sending and receiving management, the data flow encapsulation when sending data includes: First, the transport layer is encapsulated. This layer encapsulation depends on the FD module. Each partition user file descriptor is associated with the user source port, destination port, source IP, destination IP, and Option attributes. The packet receiving and sending module searches for the source port and destination port fields associated with the socket created by the user, and completes UDP or TCP encapsulation based on these fields. Then the network layer encapsulation is performed, which is completed by the FD module and the routing table entry. The FD module provides the key source IP and destination IP fields of the network layer, and the routing table entry completes the judgment of whether the data is routeable. Only when the destination IP address / mask field exists in the routing table can the network be forwarded; the routing table entry subscribes to the routing table of the shared kernel; Finally, the data link layer encapsulation is completed. This layer depends on the ARP table entries. The ARP table entries are obtained synchronously by the kernel's ARP protocol. If there is no ARP table entry, it is necessary to call the kernel interface to complete ARP learning and then encapsulate the ARP table entry.

10. The method for implementing a user-mode stack architecture system supporting TSN protocol under the Tianmai operating system according to claim 8, characterized in that: The processing of the network packet sending and receiving management, the decapsulation process after receiving the data stream includes: For received messages, the file descriptor to which the message belongs is first searched. Once the descriptor is found, it is sent to the packet receiving cache of the corresponding partition. The specific file descriptor is found by parsing the message quintuple keyword and part of the Option field, thereby completing the data receiving process.

Citation Information

Patent Citations

  • User mode network protocol stack system and method for processing message

    CN101867558A

  • Method for processing socket, method and apparatus for transmitting packet data

    US20140112278A1