Data transmission method, system and device of hybrid network protocol stack and storage medium
Through the data transmission method of the hybrid network protocol stack, using the offload model and multiple process modes, combined with soft and hard queues and shared memory management, the interface design problem between the user-mode IO and the kernel-mode protocol stack is solved, achieving high performance and Compatible network data transmission is suitable for mixed traffic in various scenarios.
Patent Information
- Application Number
- CN202311746961.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-18
- Publication Date
- 2024-10-18
AI Technical Summary
Existing technologies have problems such as scenario limitations, low performance, and poor stability in communication connections. Especially in the interface design between user-mode IO and Linux kernel protocol stack, they cannot effectively achieve high performance and compatibility.
Using the data transmission method of the hybrid network protocol stack, the data to be transmitted is allocated to the appropriate RX/TX process mode through the offload model, including pure user mode, process mode from user mode to kernel mode and pure kernel mode, using software and hardware queues It performs data shunting with software and hardware shunts, and realizes efficient data transmission between user mode and kernel mode through ring queues and shared memory management mechanisms.
It realizes the functional interoperability of user-mode IO and kernel-mode protocol stacks, improves the performance and compatibility of network equipment, solves the compatibility issues of high-performance throughput and traditional protocol applications, and is suitable for mixed traffic in various scenarios.
Smart Images

Figure CN118802776A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a data transmission method, system, device and storage medium of a hybrid network protocol stack. Background Art
[0002] In the era of Network Functions Virtualization (NFV), more and more traditional communication technology (CT) services need to be deployed on general-purpose computing platforms (general-purpose CPUs) to achieve the ultimate integration of computing and networking through software and hardware decoupling, that is, the integration of communication technology and Internet technology.
[0003] In computing and network integration products, the network relies heavily on the most basic packet processing capabilities of general computing platforms, including the core components such as the sending and receiving of network packets. This demand has given rise to high-performance network solutions based on general servers, including high-performance user-mode IO packet sending and receiving framework components, layer 2 and layer 3 network packet forwarding kits based on user-mode packet sending and receiving, and TCP / UDP protocol stacks that support layer 4 networks. These solutions are based on user-mode IO packet sending and receiving, and have rebuilt a new network protocol stack to replace the traditional kernel-based (net module / socket) protocol stack. This is a new user-mode high-performance technology interface stack, but this will cause a large number of traditional network applications, such as the standard BSD Socket, which has a 40-year history of development, to fail to run, which brings new compatibility issues.
[0004] The large number of network applications accumulated after 40 years of network development fully reflects the complexity and diversity of network protocols. The wide variety of network protocols themselves and the superposition of various compatibilities over the years have made various network applications bloated and huge. The user-mode high-performance IO component under the general server framework has broken through the traditional forwarding performance limitations based on the Linux kernel, achieving at least ten times the performance improvement and bringing new options for the breakthrough of high-performance forwarding solutions. After the performance problem is solved, the completeness and compatibility of functions become the next key point that needs to be broken through, otherwise the large number of applications accumulated over 40 years of development must be torn down and rebuilt.
[0005] There are existing projects, such as VPP and F-Stack, which are based on the use of user-mode IO packet processing on general-purpose CPUs to support the development of high-performance general-purpose server scenarios. A brand-new user-mode protocol stack has been redeveloped with a lot of manpower. However, these projects can only solve some scenario requirements at present. The root cause of irreplaceability is that it is impossible to overthrow and reconstruct all the applications accumulated over nearly 40 years of development and migrate from the kernel protocol stack to the user-mode protocol stack of the above projects. The design principles and interfaces of the user-mode protocol stacks independently developed by each company are different, and there is no broad standard uniformity, and there is no ability to overturn the de facto standard of BSD socket.
[0006] At present, the commonly used solutions for connecting user-mode IO and Linux kernel protocol stack interfaces are KNI and Tun / Tap. However, KNI and Tun / Tap have their own defects: KNI only provides an IO channel from user mode to kernel to implement data packet re-injection into kernel space, and it does not have network attributes and business attributes, and has scenario restrictions; Tun / Tap has user-mode and kernel-mode data channels with reverse synchronization functions, but because it needs to be deployed in a sandbox to achieve spatial isolation, it has very low performance and very poor stability. Summary of the invention
[0007] The embodiments of the present application provide a data transmission method, system, device and storage medium of a hybrid network protocol stack to solve technical problems such as scenario limitations, low performance, and poor stability in communication connections in the prior art.
[0008] In the first aspect, an embodiment of the present application provides a data transmission method for a hybrid network protocol stack, including: inputting the data to be transmitted into a diversion model to obtain a matching rule output by the diversion model; allocating the data to be transmitted to the RX / TX process mode corresponding to the matching rule; and transmitting the data to be transmitted based on the RX / TX process mode; wherein the RX / TX process mode includes a first form process mode, a second form process mode and a third form process mode; the first form process mode is a pure user-mode RX / TX process; the second form process mode is an RX / TX process from user mode to kernel mode; and the third form process mode is an RX / TX process of a pure kernel-mode process.
[0009] In one embodiment, the diversion model performs data diversion based on soft and hard queues and soft and hard diverters; the data to be transmitted is allocated to the RX / TX process mode corresponding to the matching rules, including: if the data to be transmitted is a network data packet with obvious characteristics, a first form process mode of a pure user state RX / TX process is adopted; if the data to be transmitted includes control packets mixed in the network data packet, a second form process mode of an RX / TX process from user state to kernel state is adopted; if the data packet to be transmitted is a specific control packet with obvious characteristics and clear protocols, a third form process mode of an RX / TX process of a pure kernel state process is adopted.
[0010] In one embodiment, the physical address of the same association is mapped to non-overlapping user state address space and kernel state address space to implement data transmission between the user state and the kernel state without copying the address content to each other.
[0011] In one embodiment, data to be transmitted is transmitted based on the RX / TX process mode, including: designing multiple circular queues; based on the multiple circular queues, user-mode writing and kernel-mode reading are implemented in one ring, and user-mode reading and kernel-mode writing are ensured to be in one ring.
[0012] In one embodiment, data to be transmitted is transmitted based on the RX / TX process mode, including: in the second form process mode, the data to be transmitted has been balanced after user-state soft screening; and the data to be transmitted is distributed to the corresponding CPU after CPU number equalization processing.
[0013] In one embodiment, data to be transmitted is transmitted based on the RX / TX process mode, including: in the third form process mode, the data to be transmitted is balanced, wherein the balanced processing includes satisfying a preset ratio between the NIC and the CPU; and the data to be transmitted after the balanced processing is distributed to the corresponding CPU.
[0014] In one embodiment, a network card device based on the ISO model has dual capabilities of layer 2 and layer 3; data to be transmitted is transmitted based on the RX / TX process mode, including: when it is necessary to process related data packets through the third form process mode, follow the standard kernel protocol stack processing process; when the virtual network card device needs to respond to the kernel device, the corresponding attributes of the first form process mode and the attributes of the second form process mode are synchronized to the kernel device.
[0015] In the second aspect, an embodiment of the present application provides a data transmission system of a hybrid network protocol stack, including: a diversion model module, used to input the data to be transmitted into the diversion model to obtain the matching rules output by the diversion model; a matching rule module, used to allocate the data to be transmitted to the RX / TX process mode corresponding to the matching rule; a data transmission module, used to transmit the data to be transmitted based on the RX / TX process mode; wherein the RX / TX process mode includes a first form process mode, a second form process mode and a third form process mode; the first form process mode is a pure user-mode RX / TX process; the second form process mode is an RX / TX process from user mode to kernel mode; the third form process mode is an RX / TX process of a pure kernel-mode process.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory storing a computer program, and when the processor executes the program, the data transmission method of the hybrid network protocol stack of the first aspect is implemented.
[0017] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data transmission method of the hybrid network protocol stack of the first aspect.
[0018] The data transmission method, system, device and storage medium of the hybrid network protocol stack provided in the embodiment of the present application include: inputting the data to be transmitted into the diversion model to obtain the matching rules output by the diversion model; allocating the data to be transmitted to the RX / TX process mode corresponding to the matching rules; transmitting the data to be transmitted based on the RX / TX process mode; wherein the RX / TX process mode includes a first form process mode, a second form process mode and a third form process mode; the first form process mode is a pure user state RX / TX process; the second form process mode is an RX / TX process from user state to kernel state; the third form process mode is an RX / TX process of a pure kernel state process. The present application can realize the intercommunication of the user state IO transceiver packet and the kernel state protocol stack function to realize the replacement of network equipment, fundamentally solving the scenario of high-performance throughput and compatibility with traditional protocol applications, and conforming to the actual application of various hybrid traffic in various scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1It is a flowchart of a data transmission method of a hybrid network protocol stack provided in an embodiment of the present application;
[0021] Figure 2 It is a schematic diagram of the overall design basis of the high-performance hybrid network protocol stack IO layer framework provided in an embodiment of the present application;
[0022] Figure 3 It is a schematic diagram of three forms of processes of the high-performance hybrid network protocol stack IO layer framework provided in an embodiment of the present application;
[0023] Figure 4 It is a schematic diagram of a simple model of hybrid protocol stack docking under three form processes provided in an embodiment of the present application;
[0024] Figure 5 It is a distribution diagram of soft and hard queues and soft and hard splitter rules provided in the embodiment of the present application;
[0025] Figure 6 This is a schematic diagram of a network packet processing flow of mapping a virtual network device to a kernel provided in an embodiment of the present application;
[0026] Figure 7 It is a schematic diagram of a shared memory management mechanism in user mode and kernel mode provided in an embodiment of the present application;
[0027] Figure 8 It is a CPU system design diagram based on a typical non-consistent memory provided in an embodiment of the present application;
[0028] Fig. 9 It is a schematic diagram of an IRQ redirection mechanism based on equalization provided in an embodiment of the present application;
[0029] Fig.10 It is a structural diagram of a data transmission system of a hybrid network protocol stack provided in an embodiment of the present application;
[0030] Fig.11 It is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0032] At present, the design principles and interfaces of the user-mode protocol stacks independently developed by various companies are different, and there is no widespread standard uniformity. From the perspective of compatibility, it is necessary to reconstruct new applications for each independent application, and the workload is much larger than the previous reconstruction estimate. From the performance perspective, it can be found that a large number of applications are slow protocols, that is, a large number of applications do not require an IO exchange capacity of more than 10Gbps or 40Gbps (limited to the IO space exchange rate on this CPU). The forwarding content of the user-mode high-performance IO component is divided into two categories. The first category is high-speed data transmission, and the second category is slow application control. This is similar to the usual definition of call control (signaling plane, control plane) and service bearing (user plane, media plane, forwarding plane). The second category can achieve high-speed forwarding through ACL+routing+NAT based on user-mode standards, and the vectorized CPU instructions (such as sse, neon and other instructions) and multi-core expansion on general servers can greatly improve the forwarding performance. The first category again borrows the kernel protocol stack to implement function control because it is a slow protocol. Based on the background of modern general-purpose CPU multi-core technology, a general-purpose server can have at least 32 cores (more and more 64-core, 96-core, and 128-core CPUs are also increasing), which can be handled based on the reasonable allocation of resources and CPU resource ratio. For example, 20 cores are configured to handle high-speed data transmission, and 8 cores are configured to handle low-speed applications passing through the kernel. After the CPU resources are fully satisfied, the user-mode high-performance IO framework and the traditional kernel protocol stack ecosystem can be integrated through a more flexible framework to solve the smooth replacement needs of products. Based on the above overall idea, how to be compatible with the Linux kernel-based protocol stack and the socket API-based application requires an overall solution from the IO layer to the Linux kernel and then to the user-mode application. At present, the common DPDK-based KNI, Tun / Tap and other solutions are used to connect the user-mode IO and Linux kernel protocol stack interfaces, and provide a virtual Ethernet network card device mapped to the Linux kernel through the virtualized device, so that the kernel protocol stack can complete the reception of network data packets based on this virtual network port and send them to the kernel protocol stack for processing.
[0033] However, the existing general computing platform (based on general CPU) high-performance network device interface solutions have the following defects: 1. They all have a single goal, only adding a user state and kernel state channel in specific scenarios; 2. They have scenario limitations, and in actual use, the corresponding strategy needs to be selected according to the business characteristics. Among them, the technical paths of KNI / TUN / TAP are quite different and cannot be complementary and reused; 3. The current technical solutions only solve the problem from various demand levels, and there are performance bottlenecks. In particular, the two interfaces of tun and tap will become the lowest performance shortcoming of the system and do not support multi-core expansion, which seriously restricts the multi-core reuse scenario of general-purpose CPUs. However, multi-core reuse is the most basic requirement of general-purpose CPUs.
[0034] Based on this, the present application proposes a high-performance hybrid network protocol stack IO layer framework model, which uses a general-purpose CPU as the hardware platform of the network device and implements the hybrid reuse of user-mode and kernel-mode protocol stacks through the IO layer framework. The model of this embodiment can connect the high-performance IO and traditional kernel protocol stacks on general-purpose servers, and achieve high throughput and high-performance rich network protocol compatibility based on technologies such as diversion strategies and interrupt migration, and fully integrate the high-speed data throughput processing of the user mode with the slow applications.
[0035] First, a brief description of the nouns used in this application is given:
[0036] Network Function Virtualization: A concept of network architecture that uses virtualization technology to divide the functions of the network node level into several functional blocks, which are implemented in software instead of hardware architecture. The core of network function virtualization is virtual network function. It provides network functions that can only be found in hardware, including many applications such as routing, CPE, mobile core, IMS, CDN, accessories, security, policy, etc. However, virtualized network functions need to combine applications, business processes and infrastructure software that can be integrated and adjusted. The goal of network function virtualization technology is to provide network functions on standard servers instead of customized equipment. In order to achieve NFV deployment in the short term, vendors need to make four key decisions: deploy a cloud hosting model, choose a network-optimized platform, build services and resources based on TM Forum principles to promote operational integration, and deploy a flexible and loosely coupled data / process architecture.
[0037] VPP: full name Vector Packet Processing, runs in user space, supports multiple packet receiving methods, the most commonly used is DPDK. VPP has two main functions: framework scalability and mature switching / routing functions.
[0038] F-Stack: F-Stack is a network development framework that combines high performance, ease of use, and versatility. It is implemented in pure C and acts as glue to bond DPDK, FreeBSD user-mode protocol stack, and Posix API.
[0039] Data Processing Unit (DPU): Mainly used in large-scale computing scenarios in data centers, serving cloud computing, its role is to improve the efficiency of computing infrastructure such as data centers, reduce energy waste, and thus reduce costs. Virtualization, networking, storage, and security are very important tasks in data centers, and they also consume a lot of computing resources.
[0040] Direct Memory Access (DMA): Allows hardware devices of different speeds to communicate without relying on a large interrupt load on the CPU.
[0041] Lockless queue: Lockless FIFO, abbreviated as LFIFO.
[0042] Virtual address space: Virtual address zone, abbreviated as VA.
[0043] Physical Layer: Physical Layer, abbreviated as PL.
[0044] Link Layer: Link Layer, abbreviated as LL.
[0045] Network Functions Virtualization: Network Functions Virtualization, abbreviated as NFV.
[0046] Data Processing: Data Processing, English abbreviation Unit DPU.
[0047] Network interface controller: Network interface controller, abbreviated as NIC.
[0048] Direct Memory Access: Direct Memory Access, abbreviated as DMA.
[0049] See also Figure 1 , Figure 1 1 is a flow chart of a data transmission method of a hybrid network protocol stack provided in an embodiment of the present application. In this embodiment, the data transmission method of the hybrid network protocol stack includes steps S110 to S130, and each step is specifically as follows:
[0050] S110: Input the data to be transmitted into the diversion model to obtain the matching rules output by the diversion model.
[0051] S120: Allocate the data to be transmitted to the RX / TX process mode corresponding to the matching rule.
[0052] S130: Transmitting the data to be transmitted based on the RX / TX process mode.
[0053] Among them, the RX / TX process mode includes the first form process mode, the second form process mode and the third form process mode; the first form process mode is a pure user-mode RX / TX process; the second form process mode is an RX / TX process from user mode to kernel mode; the third form process mode is a pure kernel-mode RX / TX process.
[0054] Optionally, the traffic diversion model performs data diversion based on soft and hard queues and soft and hard diverters. The soft and hard queues and soft and hard diverters are used to match the agreed rules, and different data flows after matching the rules are sent to different RX / TX processes for processing.
[0055] Optionally, the step of allocating the data to be transmitted to the RX / TX process mode corresponding to the matching rule specifically includes:
[0056] If the data to be transmitted is a network data packet with obvious characteristics, the first form of the pure user state RX / TX process mode is adopted. In the first form of the process mode, the entire data exchange is completed in the user state, and there will be no cross-CPU authority switching, and no interrupt trap will be triggered.
[0057] If the data to be transmitted includes control packets mixed in the network data packets, the second form flow mode of the RX / TX process from user state to kernel state is adopted. In the second form flow mode, the relevant data is sent to the user state for preprocessing, and then part of the traffic needs to be sent to the kernel protocol stack for processing.
[0058] If the data packet to be transmitted is a specific control packet with obvious characteristics and clear protocol, the third form process mode of the RX / TX process of the pure kernel state process is adopted. In the third form process mode, entering the kernel protocol stack requires the application corresponding to the kernel protocol stack function to be reused.
[0059] It should be noted that this embodiment develops the most basic IO framework and protocol stack solution based on a general-purpose CPU platform, which can transition traditional hardware network elements to a general-purpose CPU framework, realize network virtualization, and achieve true computing-network integration.
[0060] In summary, this embodiment provides a data transmission method for a hybrid network protocol stack, including: inputting the data to be transmitted into the diversion model to obtain the matching rules output by the diversion model; allocating the data to be transmitted to the RX / TX process mode corresponding to the matching rule; transmitting the data to be transmitted based on the RX / TX process mode; wherein the RX / TX process mode includes a first form process mode, a second form process mode and a third form process mode; the first form process mode is a pure user state RX / TX process; the second form process mode is an RX / TX process from user state to kernel state; the third form process mode is an RX / TX process of a pure kernel state process. The present application can realize the intercommunication of user state IO transceiver packets and kernel state protocol stack functions to realize network equipment replacement, fundamentally solving the scenario of high-performance throughput and compatibility with traditional protocol applications, and conforming to the actual application of various hybrid traffic in various scenarios.
[0061] In the related technologies, network virtualization products based on general-purpose CPUs are based on a high-performance IO framework in user mode to complete the sending, receiving and processing of data packets, which is quite different from the traditional kernel protocol stack. This new processing method has brought about a significant improvement in performance. Several key technologies adopted can avoid the performance bottleneck of traditional kernels, such as bypass kernel, large pages, user-mode driver framework, etc.
[0062] Since this technology fundamentally bypasses the kernel and directly exchanges the network card's data packets to the user state, and the network driver and kernel protocol stack in the traditional kernel mode are built in the kernel state and kernel space, this will result in the data packets in the user space being unable to complete the interface exchange with the kernel space protocol stack, and thus the kernel's protocol stack functions cannot be reused.
[0063] Due to the development and evolution of the kernel protocol stack over the past few decades, a large number of network elements, cloud hosts, and other scenarios have deployed hosts based on the Linux operating system (such as the mainstream Ubuntu / CentOS system). At the same time, applications based on the kernel socket interface are extremely extensive. The entire kernel-based hardware and software application is a very large and stable application ecosystem. Although the framework based on user-mode high-performance IO has been developed for more than 10 years, a large number of related kernel socket applications have not been synchronized by developers to the new high-performance user-mode IO framework. In the face of the fact that user-mode IO has high network throughput capabilities and related applications are lacking, corresponding solutions are inevitably needed to bridge the gap between user-mode IO and mature and stable protocol stacks / applications.
[0064] Although the CPU now supports processing with different permissions and different spaces in terms of instructions and address space, the essence is still software behavior, so the entire hardware foundation does not distinguish between the two different forms of software in user mode and kernel mode. The stability and consistency of the hardware foundation provides the most basic operating environment for connecting IO user mode and protocol stack kernel mode.
[0065] At present, Ethernet frames are the most basic transmission format of network data packets at the network level, so this embodiment considers the most widely used network packet specification of Ethernet ETH, a link physical layer structure. The overall solution of this embodiment can be designed based on the following system model:
[0066] See also Figure 2 , Figure 2 It is a schematic diagram of the overall design basis of the high-performance hybrid network protocol stack IO layer framework provided in the embodiment of the present application.
[0067] Figure 2 A path diagram of the entire life cycle of the processing flow of CPU and OA behavior, external network card behavior, and Ethernet transmission behavior is described.
[0068] From the system level, the software behavior on the entire CPU can be summarized as processing on the CPU. For the CPU or operating system, whether it is user mode or kernel mode, it is a software behavior and is under the control of the CPU. From the perspective of discrete mathematics or signal digitization, for a single Ethernet frame on the network, no matter which behavior state it is in, it is a relatively independent data unit. It appears as a single data frame during transmission, as a single non-associated descriptor during network card processing, and as a memory segment during CPU processing.
[0069] Based on the above basic situation, the software processing process on the CPU only needs to focus on the processing of a single memory segment or a single descriptor, and the memory segments or descriptors of related types or associations can be summarized into a collection. Based on this logic, this embodiment designs the following user mode and kernel mode hybrid high-performance prototype.
[0070] See also Figure 3 , Figure 3 It is a schematic diagram of three forms of processes of the high-performance hybrid network protocol stack IO layer framework provided in an embodiment of the present application.
[0071] Traditional kernels use interrupts and polling to increase system network throughput. This is because early CPUs were not powerful enough and had low network throughput. For low-performance CPUs, they only need to respond to interrupts to process network data. Modern CPUs have greatly increased processing frequency and the number of cores, and network traffic has increased a hundred times compared to the past. In this context, isolating certain CPU cores (physical cores) to facilitate dedicated processing of high-throughput and low-latency network data packets can better match the actual situation of current hardware and network traffic.
[0072] Based on common business scenarios, it can be summarized as follows: Figure 3 The three forms of RX / TX processes shown in the figure can cover almost all scenarios of the current mixed combination of user mode and kernel mode. Currently, all network transmission scenarios basically include two behaviors:
[0073] The first behavior is exchange, that is, transportation from space A to space B, and the form of space is manifested as ports and network connections.
[0074] The second behavior is processing, which requires initiating a request (start) or responding to a request (end) to create or terminate the data packet on the local machine.
[0075] These behaviors converge into the following three combinations:
[0076] The first type is the exchanged network data packets with most obvious characteristics. This type of data packet has the largest traffic and is the most important network behavior, and needs to meet the requirements of low latency and high throughput.
[0077] The second type is control packets mixed in with a large amount of exchanged data. The most typical one is the TCP three-way handshake control packet. It is bound to be mixed in with a large number of data packets that transmit the actual content of the user, and needs to meet the characteristics of low traffic and high timely processing.
[0078] The third type is user-class control data, including OAM control signaling, DHCP address allocation, PPPOE dial-up, IPV6 routing announcements and other low-speed network data. This type of control packet does not require real-time performance and has low traffic, but its protocol content is very cumbersome in compatibility due to historical baggage and is highly dependent on the strong compatibility of the previous application software.
[0079] Based on the derivation of actual network conditions, Figure 3The path diagram of most data on the basic model is line 1, which is the first form of the process mode using a pure user-mode RX / TX process; the path diagram of the control packet mixed in the network data packet is line 2, which is the second form of the process mode using the RX / TX process from user mode to kernel mode. The path diagram of the control packet with obvious characteristics and clear protocols is line 3, which is the third form of the process mode using the RX / TX process of a pure kernel-mode process.
[0080] Both high-performance user-mode and traditional kernel-mode protocol stacks can achieve IO connectivity in these three RX / TX processes. Figure 3 As shown in the figure, when the network data packet passes through the network card queue to the memory, the corresponding memory and network descriptor are in one-to-one correspondence. Since it is a discrete network descriptor, targeted policies can be implemented on it. Assume that the descriptor that conforms to policy A is sent to the user state through the process of line 1, the descriptor that conforms to policy B is sent to the kernel state through the process of line 2 through the user state, and the descriptor that conforms to policy C is sent to the kernel state through the process of line 3. Figure 3 On this basis, the corresponding protocol stack process is added to build the following complete process processing of network data packets.
[0081] See also Figure 4 , Figure 4 It is a schematic diagram of a simple model of hybrid protocol stack docking under three form processes provided in an embodiment of the present application.
[0082] like Figure 4 As shown in the figure, by supplementing the user-mode and kernel-mode protocol stacks based on the ISO standard model, we can get a complete process from network transmission to network card to high-performance IO layer network and then to hybrid protocol stacks in various forms.
[0083] This embodiment includes three forms of RX / TX flow modes. Since the protocol stack complies with the design principle of layered stack, each layer independently processes the protocol layer specified by the ISO model, for example, TCP and UDP are in their four-layer templates, and IP is in its three-layer template.
[0084] Based on the design of ISO standard model, the upper layer solves the functional and compatibility problems at all levels. The performance of the entire protocol stack depends on the high-performance framework driven by user-mode IO. The protocol stack itself focuses on the completeness and compatibility of the protocol. The protocol stack itself does not have high-performance characteristics because of the low-coupling layered design. In this embodiment, the high-performance hybrid network protocol stack IO layer framework can explain its design advantages in terms of high performance and compatibility.
[0085] Compare the three forms of high-performance RX / TX process modes, and explain the design principles of the three modes respectively:
[0086] The first form of process mode: is the most basic pure user-mode RX / TX process, corresponding to line 1.
[0087] The entire data exchange is completed in user mode, without switching across CPU permissions and without triggering interrupt traps. Data is directly transferred from the network card to the user mode through DMA, and then the user mode protocol stack or application processes data based on the user mode address space. When applied to RX / TX processes in multiple mixed forms, this process needs to be improved. Because when there are three forms of RX / TX models at the same time, it is necessary to consider different flows entering different RX / TX process modes, so a diversion model needs to be built at different levels.
[0088] The second form of process mode: It is an RX / TX process with a relatively large span, inheriting the background of the first form of process mode above. The relevant data has been sent to the user state, and then part of the traffic needs to be sent to the kernel protocol stack for processing after pre-processing in the user state, corresponding to line 2.
[0089] Since the kernel only handles the distribution of related protocols, socket-based applications need to return to user mode through the kernel protocol stack. In terms of address space, the memory data of the network card needs to cross the domain twice, from user mode to kernel mode and then back to user mode. Because this process needs to send the descriptor and data packet to user mode first, and then send it to kernel mode based on a certain strategy. Therefore, a software filter needs to be built into the user mode to synchronize the descriptor after matching the rule to the kernel. And based on performance considerations, the addresses of user mode and kernel mode can be mapped to avoid memory copying between user mode and kernel mode.
[0090] The third form of process mode: It is a RX / TX process different from the traditional kernel network packet receiving and sending. The traditional kernel protocol stack relies on the network packet receiving and sending driver to take over all network devices and send all network descriptors to the kernel space, corresponding to line 3.
[0091] In this solution, most network data is processed in the user space, so only specific network data needs to enter the kernel protocol stack. The original intention of entering the kernel protocol stack is to reuse the application corresponding to the kernel protocol stack function, that is, the control data packet needs to be sent to the kernel protocol stack. In fact, most of the transmission data can be directly forwarded through the user state. For such a scenario, only the data in certain specific queues needs to be sent to the kernel protocol stack. Therefore, the kernel RX / TX process in the third form process mode directly corresponds to the designated queue of the network card, that is, only data that meets certain unified characteristics and is in the same network queue needs to be processed under the third form process mode. This process is essentially different from the standard Linux NAPI.
[0092] After describing three different forms of RX / TX processes as above, we continue to describe the splitter design. This embodiment requires different types of splitters to match the agreed rules, and then the data streams after different matching rules are sent to different RX / TX processes for processing. Figure 5 To describe the different positions of different shunts in the system data flow.
[0093] See also Figure 5 , Figure 5 This is a distribution diagram of soft and hard queues and soft and hard splitter rules provided in an embodiment of the present application.
[0094] Based on the above design, corresponding to Figure 5 It can be assumed that three CPU cores (in some embodiments, more CPUs can be expanded to match the traffic) are used to process the three corresponding RX / TX processes. The following describes how the network data flow enters the different RX / TX processes:
[0095] Line 1 corresponds to most of the scenarios. Most of the traffic is sent directly to the user-mode pthread 0 for processing through the user-mode RX / TX process. The packets that need to enter the kernel for processing are mixed in these traffic flows. Figure 5 After the soft splitter rule marked on the left is matched, it enters the soft queue marked by line 3, and then pthread1 in the kernel state processes the soft queue, thereby completing the sorting process of sending the packets that need additional kernel processing from the mixed data in the hardware gateway queue to the kernel for processing with the help of the cooperation between the soft splitter and the soft queue; Figure 5 The RX / TX process of line 3 in the lower right corner corresponds to pthread 2 in the kernel. This thread is dedicated to processing a single hardware network card queue that requires special processing, that is, all data in this network card queue must enter the kernel for processing. This relies on the processing of the hardware splitter rules to send data packets that meet a single feature to this specific hardware network card queue. This mode is more direct and has higher performance than the software separation rule + soft queue method. However, this mode is subject to the limitations of hardware rules. When the hardware rules exceed the limit or cannot be processed, the rules of the soft splitter can be used to achieve rule matching. Generally, soft matching rules are more flexible. By combining the above hardware and software methods, all scenarios that need to enter the kernel protocol stack under different rules can be covered.
[0096] Network card devices based on the ISO model need to have dual capabilities of layer 2 and layer 3. When relevant data packets need to be processed through the kernel protocol stack, according to the standard kernel protocol stack processing flow, the virtual network card device that responds to the kernel component can synchronize the corresponding layer 2 and layer 3 attributes to the kernel device. Figure 6The deployment of the corresponding virtual devices in kernel mode and the intercommunication process with the kernel protocol at layer 2 and layer 3 are marked.
[0097] See also Figure 6 , Figure 6 It is a schematic diagram of the network packet processing flow of mapping a virtual network device to a kernel provided in an embodiment of the present application.
[0098] Figure 6 This article describes how to re-import data packets in a high-performance IO framework into the kernel protocol stack through a virtual network device. The Linux kernel design is a system software belonging to the operating system level, which has standard definitions and specifications for the network. If you need to reuse the entire kernel protocol stack and the entire BSD socket application based on the kernel protocol stack, you must switch the data through the virtual network device mode according to the standardized definition of the Linux net module. Let's go back to the previous ISO model. Since the ISO model only defines the functions of network layering, the actual performance depends on the IO framework to handle it. This provides a very good operating idea for performance and function compatibility with the kernel.
[0099] like Figure 6 As shown in the figure, assuming that the physical NIC1 and physical NIC2 in the lower left corner are managed by the high-performance IO framework, the entire physical network card will be removed from the Linux kernel space. Figure 6 Of the four physical NICs shown, only the physical NIC3 and physical NIC4 on the right can be controlled by the Linux kernel. This is very consistent with most application scenarios. Assuming a host system, the management channels are connected to its operating system based on physical NIC3 and physical NIC4, and other high-traffic services go through physical NIC1 and physical NIC2. Then even if the traffic of high-traffic services goes through physical NIC1 and physical NIC2, it can still return to the Linux kernel again through the VirtualNetDevice involved in this embodiment, because the Linux kernel is essentially a software system. As long as the data can be injected from the VirtualNetDevice of line 1 to the Linux kernel protocol stack from the data level, the Linux kernel protocol stack does not care whether it comes from the real physical NIC3 and physical NIC4 or the VirtualNetDevice of line 1.
[0100] As Figure 6 As shown in the figure, two VirtualNetDevice are used to distinguish and mark how the Layer 2 bridge scenario and the Layer 3 routing scenario are connected to their network protocol stack and upper-layer applications through topology in kernel state. Figure 6 Line 1 and Line 2 correspond to the data flow of Layer 3 and Layer 2 respectively. Figure 6The route marked by line 3 is the standard kernel layer 2 data flow. It can be compared that the routes of line 3 and line 2 are exactly the same after entering the kernel protocol stack, and are completely unaffected at the functional level.
[0101] Based on any of the above embodiments, the network card device based on the ISO model has dual capabilities of layer 2 and layer 3; the data to be transmitted is transmitted based on the RX / TX process mode, including: when it is necessary to process the relevant data packets through the third form process mode, follow the standard kernel protocol stack processing process; when the virtual network card device needs to respond to the kernel device, the corresponding attributes of the first form process mode and the attributes of the second form process mode are synchronized to the kernel device.
[0102] After solving the hybrid model of user-mode and kernel protocol stack under the user-mode IO framework and realizing the functional connection between user-mode IO and kernel protocol stack, the next step is to describe how to achieve a performance improvement technology of more than 10 times compared with kernel NAPI in performance design.
[0103] See also Figure 7 , Figure 7 It is a schematic diagram of the shared memory management mechanism in user mode and kernel mode provided in an embodiment of the present application.
[0104] Now the CPU and operating system are decentralized, the core code is in kernel mode and the corresponding address space is also protected by permissions. Traditionally, user-mode data needs to be processed by the kernel, such as using the CPU's trap instruction to allow the software to enter kernel mode, and the kernel program copies the data to the kernel space for processing. This security layer design does ensure the stability of the system core.
[0105] When a large amount of data is frequently exchanged between user mode and kernel mode, this frequent two-way trap and data copying will have a serious impact on performance. The design of this kernel itself is not problematic and follows the principles of operating system design. After comparing the design principles of Windows and Linux, it is found that the Linux kernel is more macroscopic, and the Windows NT kernel is more micro-kernel-oriented. Based on these limitations, combined with Figure 7 Describe the design rationale.
[0106] (1) Figure 7 The physical address space in the figure is all the physical addresses of the machine. The padding part is intercepted and becomes the physical address manageable by the OS on the left, that is, part of the memory is hidden so that the operating system cannot see it. If the intercepted address is known, it can be mapped to the virtual space on the right.
[0107] Since the address spaces of user state and kernel state are different, the same physical address is mapped to non-overlapping user state and kernel state spaces. Then, independent program segments in user state and kernel state read and write different address spaces respectively, but actually access the same physical address.
[0108] Since the same physical address is accessed, data exchange between user mode and kernel mode is realized without copying the address content to each other.
[0109] (2) Figure 7 The circular queue on the left can limit its use to ensure that there is no conflict between user state and kernel state. Specifically, multiple circular queues are designed to ensure that the writing of user state and the reading of kernel state are in one ring, and the reading of user state and the writing of kernel state are in one ring. Through different rings, the concurrent conflict problem of exchanging data between user state and kernel state is solved.
[0110] Through the above two points (1) and (2), high concurrency and completely lockless and zero copy are fully realized at the memory and synchronization level, and the corresponding performance can be greatly improved by 10 to 20 times. The address hiding and double-layer address mapping involved are the key designs of this embodiment.
[0111] Based on any of the above embodiments, the physical address of the same connection is mapped to non-overlapping user state address space and kernel state address space to achieve data transmission between user state and kernel state without copying address content to each other.
[0112] Based on any one of the above embodiments, data to be transmitted is transmitted based on the RX / TX process mode, including: designing multiple ring queues; based on the multiple ring queues, user-mode writing and kernel-mode reading are implemented in one ring, and user-mode reading and kernel-mode writing are ensured to be in one ring.
[0113] As described above, this embodiment not only completes the hybrid model of user state and kernel protocol stack under the user state IO framework to realize the functional docking of user state IO and kernel protocol stack, but also adopts shared memory management and circular queue mechanism of user state and kernel state for data processing to improve performance. Specifically, part of the physical address is intercepted from the physical address of the machine and mapped to the virtual address space, which is equivalent to cleverly hiding part of the memory so that it is invisible to the operating system. Since the virtual address spaces of user state and kernel state are different, the same connected physical address is mapped to non-overlapping user state and kernel state spaces. Independent program segments in user state and kernel state read and write different address spaces respectively, and actually access the same physical address to realize data exchange between user state and kernel state without copying address content to each other. At the same time, the circular queue is used to ensure that the writing of user state and the reading of kernel state are in the same ring, and high concurrency and completely lock-free and zero-copy are fully realized at the memory and synchronization levels through different rings, which can greatly improve performance.
[0114] See also Figure 8 , Figure 8 This is a CPU system design diagram based on typical non-consistent memory provided in an embodiment of the present application.
[0115] In order to solve the SMP memory consistency problem due to the expansion of multi-core CPUs, the coupling relationship between memory and CPU has been redesigned. By dividing the memory into non-consistent partitions based on the proximity to the CPU, multiple CPU cores in the partition can maintain consistency directly, and data consistency does not need to be maintained across partitions. This more practical memory design greatly improves the efficiency of local cache.
[0116] like Figure 8 As shown, the six CPUs in the dotted boxes are used to process network data packets in pure user mode (no need to cross to kernel space), and the remaining two CPUs in the non-dotted boxes are used to process data packets that need to be processed in kernel space.
[0117] To improve performance, the NIC network card, memory, CPU, and cache are all determined at the physical hardware level. Therefore, when processing the data packets required for NIC0 and NIC1, only cpu6 and cpu7 can be selected in the kernel space, and when processing the kernel data of NIC2 and NIC3, only cpu8 and cpu9 can be selected.
[0118] from Figure 8 The two arrows show this clear selectivity requirement. In fact, this conventional redirection strategy limits the software and constrains the software's choice of CPU, but it is indeed a fundamental system to improve system performance.
[0119] See also Fig. 9 , Fig. 9It is a schematic diagram of an IRQ redirection mechanism based on balance provided in an embodiment of the present application.
[0120] Currently, the kernel uses the standard NAPI mechanism, which solves the problems of multi-core and cross-memory consistency through per-core local data and local interrupts. Fig. 9 This paper describes how to smoothly transition between two data scenarios through an IRQ redirection mechanism based on data balancing.
[0121] In this embodiment, there are two types of data that need to be reloaded into the kernel space. The data on the left is after soft filtering in user mode. Since the equalizer is pre-placed when it is sent to CPU0~CPU5 on the NIC, the data is already balanced when it is reloaded into the kernel space and then runs to CPU6 and CPU7. It is only necessary to ensure that the number of CPUs is equal. That is, the solid arrows and the dotted arrows divide the data equally, and then push it to the corresponding CPU6 and CPU7 through the softIRQ method. Since CPU0~CPU7 share the cache, there is no data inconsistency problem.
[0122] Arrows 1 and 2 on the right mark pure kernel-mode data exchange scenarios, which do not involve cross-CPU data exchange. It only requires ensuring a certain ratio between the NIC and the CPU to ensure that the data is evenly distributed to the corresponding CPU.
[0123] Optionally, whether it is multiple queues or a single queue, it is sufficient to meet the n:1 ratio.
[0124] Based on any one of the above embodiments, data to be transmitted is transmitted based on the RX / TX process mode, including: in the second form process mode, the data to be transmitted has been balanced after user-state soft filtering; the data to be transmitted is processed equally by the number of CPUs and then allocated to the corresponding CPU.
[0125] Based on any one of the above embodiments, data to be transmitted is transmitted based on the RX / TX process mode, including: in the third form process mode, the data to be transmitted is balanced, wherein the balanced processing includes satisfying a preset ratio between the NIC and the CPU; and the data to be transmitted after the balanced processing is distributed to the corresponding CPU.
[0126] This embodiment smoothly transitions the following two data scenarios through an IRQ redirection mechanism based on data balancing. On the one hand, for data that needs to be processed by kernel state after being filtered by user state, since a balancer is pre-placed when it is sent to multiple CPUs on the NIC, the data is already balanced when it is reloaded into the kernel space and then run on other CPUs, and it is sufficient to ensure that the number of CPUs is equal; on the other hand, for kernel state data that only needs to be processed by the kernel protocol stack, since it does not involve cross-CPU data exchange, it is only necessary to ensure that a certain ratio is met between the NIC and the CPU to ensure that the data is evenly distributed to the corresponding CPU.
[0127] Since the standard Linux kernel uses the NAPI framework to process the entire kernel protocol stack, through the above improvements to the most basic IO layer close to the memory and CPU level, this embodiment implements a set of basic frameworks to meet the basic packet transmission and reception framework and network device virtualization layer with high performance and high compatibility. Based on this framework, network functions can be smoothly transitioned from traditional hardware ASIC routers / switches and other devices to software-based products based on general-purpose CPUs. Under the condition of ensuring that performance is not affected, software-based products can be easily upgraded to ensure that functions are solved at the software level and are no longer subject to hardware limitations and hardware upgrades.
[0128] This embodiment fundamentally solves the scenario of high-performance throughput and compatibility with traditional protocol applications, and implements a system to solve high-forwarding and high-compatibility applications. If you need to bypass this patent, you can only use the traditional Tun / Tap technology, which has very low performance and greatly reduces the capacity index of the overall device. Under the same specifications, more network element devices need to be deployed to achieve the same function.
[0129] This embodiment can be used as a high-performance basic network data IO underlying framework for a high-performance forwarding platform of a general-purpose CPU. All virtualized products such as vBRAS, MEC, vOLT, UPF, SD-WAN, etc. can use this embodiment to implement function development and product release on a general-purpose CPU. Compared with the prior art, the technical advantages of this embodiment include:
[0130] (1) It provides a framework-level design. The original technology is just a virtualized device.
[0131] (2) It fully complies with various mixed traffic conditions in various scenarios and is a practical design and strategy.
[0132] (3) Compared with the original technology exchange performance, the performance is nearly 10 times better.
[0133] (4) The protocol stack and application are completely transparent, and the original technology needs to be sandboxed to ensure security.
[0134] The data transmission system of the hybrid network protocol stack provided in an embodiment of the present application is described below. The data transmission system of the hybrid network protocol stack described below and the data transmission method of the hybrid network protocol stack described above can be referred to each other.
[0135] See also Fig.10 , Fig.10 : is a structural diagram of a data transmission system of a hybrid network protocol stack provided in an embodiment of the present application. In this embodiment, the data transmission system of the hybrid network protocol stack includes:
[0136] The traffic diversion model module 101 is used to input the data to be transmitted into the traffic diversion model to obtain the matching rules output by the traffic diversion model.
[0137] The matching rule module 102 is used to allocate the data to be transmitted to the RX / TX process mode corresponding to the matching rule.
[0138] The data transmission module 103 is used to transmit the data to be transmitted based on the RX / TX process mode.
[0139] Among them, the RX / TX process mode includes the first form process mode, the second form process mode and the third form process mode; the first form process mode is a pure user-mode RX / TX process; the second form process mode is an RX / TX process from user mode to kernel mode; the third form process mode is a pure kernel-mode RX / TX process.
[0140] Based on any of the above embodiments, the traffic diversion model performs data diversion based on soft and hard queues and soft and hard diverters; the data transmission module 103 is specifically used for:
[0141] If the data to be transmitted is a network data packet with obvious characteristics, the first form process mode of a pure user-state RX / TX process is adopted; if the data to be transmitted includes control packets mixed in the network data packet, the second form process mode of the RX / TX process from user state to kernel state is adopted; if the data packet to be transmitted is a specific control packet with obvious characteristics and clear protocol, the third form process mode of the RX / TX process of a pure kernel-state process is adopted.
[0142] Based on any of the above embodiments, the physical address of the same connection is mapped to non-overlapping user state address space and kernel state address space to achieve data transmission between user state and kernel state without copying address content to each other.
[0143] Based on any of the above embodiments, the data transmission module 103 is specifically used for:
[0144] Design multiple circular queues; based on multiple circular queues, implement user-mode writing and kernel-mode reading in one ring, and ensure that user-mode reading and kernel-mode writing are in one ring.
[0145] Based on any of the above embodiments, the data transmission module 103 is specifically used for:
[0146] In the second form process mode, the data to be transmitted has been balanced after soft screening in the user state; the data to be transmitted is processed with equal CPU numbers and then allocated to the corresponding CPUs.
[0147] Based on any of the above embodiments, the data transmission module 103 is specifically used for:
[0148] In the third form process mode, the data to be transmitted is balanced, wherein the balanced processing includes satisfying a preset ratio between the NIC and the CPU; and allocating the balanced data to be transmitted to the corresponding CPU.
[0149] Based on any of the above embodiments, the network card device based on the ISO model has dual capabilities of layer 2 and layer 3; the data transmission module 103 is specifically used for:
[0150] When it is necessary to process relevant data packets through the third form process mode, the standard kernel protocol stack processing process is followed; when the virtual network card device needs to respond to the kernel device, the corresponding attributes of the first form process mode and the second form process mode are synchronized to the kernel device.
[0151] On the other hand, an embodiment of the present application further provides an electronic device, Fig.11 is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application, such as Fig.11 As shown, the electronic device may include: the electronic device may include a memory 1120, a processor 1110, and a computer program stored in the memory 1120 and executable on the processor 1110. When the processor 1110 executes the program, the data transmission method of the hybrid network protocol stack provided by the above methods is implemented.
[0152] Optionally, the electronic device may further include a communication bus 1130 and a communication interface (CommunicationsInterface) 1140, wherein the processor 1110, the communication interface 1140, and the memory 1120 communicate with each other through the communication bus 1130. The processor 1110 may call a computer program in the memory 1120 to execute a data transmission method of a hybrid network protocol stack, the method comprising:
[0153] Input the data to be transmitted into the diversion model to obtain the matching rules output by the diversion model; assign the data to be transmitted to the RX / TX process mode corresponding to the matching rule; transmit the data to be transmitted based on the RX / TX process mode; wherein the RX / TX process mode includes a first form process mode, a second form process mode and a third form process mode; the first form process mode is a pure user-mode RX / TX process; the second form process mode is an RX / TX process from user mode to kernel mode; the third form process mode is an RX / TX process of a pure kernel-mode process.
[0154] In addition, the logic instructions in the above-mentioned memory 1120 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform 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 disk or an optical disk.
[0155] On the other hand, the present application also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it is implemented to execute the data transmission method of the hybrid network protocol stack provided by the above-mentioned methods. Its steps and principles have been introduced in detail in the above-mentioned methods and will not be repeated here.
[0156] Non-transitory computer-readable storage media can be any available media or data storage devices that can be accessed by a processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drives (SSDs)), etc.
[0157] As described above, the embodiments of the present application provide a data transmission method, system, device, and storage medium of a hybrid network protocol stack, which can solve the following problems:
[0158] 1. From the most basic level of the user-mode IO framework to the overall solution of the kernel protocol stack, it is necessary to fundamentally solve the compatibility problem of the hybrid protocol stack from the IO layer.
[0159] 2. It is a universal solution that is not restricted by technologies such as sandboxes, and can solve the problem that various modes of previous solutions are not supported and are incompatible.
[0160] 3. Balance performance and functionality, meeting Layer 2 and Layer 3 functions while having high-speed IO capabilities.
[0161] 4. Support the combination of software and hardware to meet the general strategy of various network card forms such as ordinary network cards, smart network cards, DPUs, etc., and design from the solution level to be compatible with the development of the latest new technologies such as DPUs and smart network cards.
[0162] This application implements a basic framework to meet the high-performance and high-compatibility basic packet receiving and sending framework and network device virtualization layer through the improvement of the basic IO layer close to the memory and CPU level. Based on this framework, the network functions can be smoothly transitioned from traditional hardware ASIC routers / switches and other devices to software-based products based on general-purpose CPUs. Under the condition of ensuring that performance is not affected, software-based products can be upgraded very conveniently, ensuring that the functions are solved at the software level and are no longer subject to hardware limitations and hardware upgrades.
[0163] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0164] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data transmission method of a hybrid network protocol stack, characterized in that: include: Inputting the data to be transmitted into the diversion model to obtain the matching rules output by the diversion model; Allocating the data to be transmitted to the RX / TX process mode corresponding to the matching rule; Transmitting the data to be transmitted based on the RX / TX process mode; Among them, the RX / TX process mode includes a first form process mode, a second form process mode and a third form process mode; the first form process mode is a pure user-mode RX / TX process; the second form process mode is an RX / TX process from user mode to kernel mode; the third form process mode is an RX / TX process of a pure kernel-mode process.
2. The data transmission method of the hybrid network protocol stack according to claim 1, characterized in that: The diversion model performs data diversion based on soft and hard queues and soft and hard diverters; the allocation of the data to be transmitted to the RX / TX process mode corresponding to the matching rule includes: If the data to be transmitted is a network data packet with obvious characteristics, the first form process mode of the pure user mode RX / TX process is adopted; If the data to be transmitted includes control packets mixed in network data packets, the second form flow mode of the RX / TX flow from user state to kernel state is adopted; If the data packet to be transmitted is a specific control packet with obvious characteristics and clear protocol, the third form process mode of the RX / TX process of the pure kernel state process is adopted.
3. The data transmission method of the hybrid network protocol stack according to claim 1, characterized in that: The physical address of the same connection is mapped to non-overlapping user state address space and kernel state address space to achieve data transmission between user state and kernel state without copying the address content to each other.
4. The data transmission method of the hybrid network protocol stack according to claim 1, characterized in that: The data transmission of the data to be transmitted based on the RX / TX process mode includes: Design multiple ring queues; Based on the multiple ring queues, the writing of the user state and the reading of the kernel state are implemented in one ring, and it is ensured that the reading of the user state and the writing of the kernel state are in one ring.
5. The data transmission method of the hybrid network protocol stack according to claim 1, characterized in that: The data transmission of the data to be transmitted based on the RX / TX process mode includes: In the second form flow mode, the data to be transmitted after soft filtering in the user state has been balanced; The data to be transmitted is processed according to the number of CPUs and then distributed to the corresponding CPUs.
6. The data transmission method of the hybrid network protocol stack according to claim 1, characterized in that: The data transmission of the data to be transmitted based on the RX / TX process mode includes: In the third form process mode, the data to be transmitted is balanced, wherein the balanced processing includes satisfying a preset ratio between the NIC and the CPU; Allocate the balanced data to be transmitted to the corresponding CPU.
7. The data transmission method of the hybrid network protocol stack according to claim 1, characterized in that: The network card device based on the ISO model has dual capabilities of layer 2 and layer 3; the data to be transmitted is transmitted based on the RX / TX process mode, including: When it is necessary to process the relevant data packets through the third form process mode, the standard kernel protocol stack processing process is followed; When a virtual network card device needs to respond to the kernel device, the corresponding attributes of the first form process mode and the attributes of the second form process mode are synchronized to the kernel device.
8. A data transmission system of a hybrid network protocol stack, characterized in that: include: A traffic diversion model module, used to input the data to be transmitted into the traffic diversion model to obtain the matching rules output by the traffic diversion model; A matching rule module, used for allocating the data to be transmitted to the RX / TX process mode corresponding to the matching rule; A data transmission module, used for transmitting the data to be transmitted based on the RX / TX process mode; Among them, the RX / TX process mode includes a first form process mode, a second form process mode and a third form process mode; the first form process mode is a pure user-mode RX / TX process; the second form process mode is an RX / TX process from user mode to kernel mode; the third form process mode is an RX / TX process of a pure kernel-mode process.
9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the data transmission method of the hybrid network protocol stack according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data transmission method of the hybrid network protocol stack according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Network data packet processing method and device, electronic equipment and storage medium
CN115714679A
Data packet processing method and device and storage medium
CN116743663A
Acceleration framework and acceleration method for database network load performance, and device
WO2023046141A1
