Data transmission method and system based on fast network protocol stack

By deploying the fast network protocol stack module in the base station, the problems of high CPU load and low data transmission efficiency in the existing technology are solved, efficient and fast data transmission under low load is achieved, and the data processing capability of the base station is significantly improved.

CN120075318AActive Publication Date: 2025-05-30GUANGDONG BROADRADIO COMM TECH

Patent Information

Application Number
CN202510245998.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-04
Publication Date
2025-05-30
Estimated Expiration
2045-03-04

AI Technical Summary

Technical Problem

When the existing network processing solution processes large-stream data, the CPU load is high and the data transmission efficiency is low, which cannot meet the efficient and stable data processing needs of base stations and other equipment.

Method used

Using a data transmission method based on the fast network protocol stack, a fast network protocol stack module dedicated to sending and receiving UDP packets at a specified port is deployed, including a network card driver layer, a UDP protocol stack and a memory management module to realize zero-copy data transmission.

Benefits of technology

It significantly reduces CPU resource consumption, improves data transmission efficiency, and improves the data processing capabilities of the base station, including improving throughput and reducing latency, and reduces network load by 30%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075318A_ABST
    Figure CN120075318A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of communication, in particular to a data transmission method and system based on a fast network protocol stack. The method comprises the following steps: deploying a fast network protocol stack module specially used for receiving and transmitting udp messages of a specified port in a system; when the data is sent, checking a data target address and port information generated in a user mode; if the target port belongs to a specified port range supported by the fast network protocol stack module, transmitting the data to a UDP protocol stack through the memory management module, packaging the data into an original UDP message, and directly transmitting the original UDP message to a network card driving layer to be sent out; when data are received, intercepting a data packet through a piling function inserted in a network card driving layer in advance and judging whether a target port belongs to a specified port range supported by a fast network protocol stack module, if so, directly sending the data packet into a UDP protocol stack for de-encapsulation processing, and directly transmitting the data packet to an application layer through a memory management module; according to the invention, the CPU resource consumption is obviously reduced, and efficient and rapid data transmission is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technologies, and particularly to a data transmission method and system based on a fast network protocol stack. Background Art

[0002] With the booming development of the communication industry, network data traffic has increased explosively, and the demand for processing large-volume network data has become increasingly urgent. Currently, the transmission speed of raw data in the network has increased rapidly, but the progress speed of microprocessor technology in low-power consumption processing scenarios has gradually slowed down. During data transmission, the network protocol processing overhead has increased sharply, and its proportion has become larger and larger compared with the packet transmission time.

[0003] Existing network processing solutions have serious defects when dealing with large-volume data. The processing flow of the standard OSI network protocol stack is complex and consumes a large amount of CPU resources. Especially when processing UDP packets, the efficiency is low, and its CPU occupancy rate is too high, resulting in the system performance being easily bottlenecked, greatly affecting the real-time performance of the overall system. In addition, dynamic memory allocation and frequent data copying (such as between the kernel state and the user state) cause additional delays. Especially in scenarios such as base stations that need to process a large amount of data, the existing processing solutions cannot meet the requirements of efficient and stable data processing. There is an urgent need for a new network processing solution that can not only ensure the fast transmission of large-volume data but also reduce the network load on the CPU. Summary of the Invention

[0004] The present invention aims to provide a data transmission method based on a fast network protocol stack to solve the problems of high CPU load and low data transmission efficiency in existing network processing solutions, realize efficient and fast data transmission with low CPU overhead, and improve the data processing capabilities of devices such as base stations.

[0005] To achieve the objectives of the present invention, the following technical solutions are adopted: In a first aspect of the present invention, a data transmission method based on a fast network protocol stack is proposed, including the following steps: Deploy a fast network protocol stack module dedicated to receiving and sending UDP packets of a specified port in the system, where the fast network protocol stack module includes a network card driver layer, a UDP protocol stack, and a memory management module; When data is sent, check the data target address and port information generated in the user state; if the target port belongs to the specified port range supported by the fast network protocol stack module, then pass the data to the UDP protocol stack through the memory management module to be encapsulated as a raw UDP packet and directly pass it to the network card driver layer for sending; When receiving data, the patching function pre-inserted in the network card driver layer intercepts the data packet and determines whether the destination port of the data packet belongs to the specified port range supported by the fast network protocol stack module. If so, the data packet is directly sent to the UDP protocol stack for decapsulation processing, and then directly passed to the application layer through the memory management module.

[0006] A further improvement is that the memory management module adopts a memory sharing mechanism to achieve zero-copy data transmission between the kernel mode and the user mode.

[0007] A further improvement is that the method for the memory management module to implement the memory sharing mechanism is as follows: The memory blocks are stored in a pre-allocated memory pool. The pre-allocated memory pool pre-allocates a certain number of fixed-size memory blocks during the system initialization phase and stores them in a dedicated queue. When the user mode and the kernel mode need memory, they directly obtain available memory blocks from the memory pool.

[0008] A further improvement is that an asynchronous memory recycling mechanism is adopted when releasing memory. When the user mode or the kernel mode releases memory, the memory block is put into the recycling queue, and the background maintenance thread periodically checks the recycling queue and puts the memory block back into the pre-allocated memory pool.

[0009] A further improvement is that the memory management module divides the shared memory into the following three partitions: Shared partition: Only the memory management service of the memory management module is responsible for allocation and release, and is used to store the core data of the protocol stack to ensure the security and efficiency of memory use; Local partition: Consists of multiple buffers of different sizes, independent of the kernel and user spaces, and is uniformly managed by the memory management service of the memory management module. Each buffer contains one or more fixed-size memory blocks; Remote partition: Can be accessed by all programs and is used for communication between programs, but cannot be used for memory allocation by the memory management module itself.

[0010] A further improvement is that it also includes: When sending data, if the destination port does not belong to the specified port range supported by the fast network protocol stack module, the data is processed through the standard protocol stack of the operating system; When receiving data, if the destination port of the data packet does not belong to the specified port range supported by the fast network protocol stack module, the data packet is processed through the standard protocol stack of the operating system.

[0011] A further improvement is that the fast network protocol stack module simulates the Socket interface of the operating system and provides a usage mode compatible with the standard Socket interface.

[0012] The second aspect of the present invention provides a data transmission system based on a fast network protocol stack, including: A deployment component, configured to deploy a fast network protocol stack module dedicated to receiving and sending UDP packets on a specified port in the system. The fast network protocol stack module includes a network card driver layer, a UDP protocol stack, and a memory management module; A data sending processing component, configured to, when sending data, check the data target address and port information generated in the user state; if the target port belongs to the specified port range supported by the fast network protocol stack module, pass the data to the UDP protocol stack through the memory management module to be encapsulated as a raw UDP packet and then directly pass it to the network card driver layer for sending; A data receiving processing component, configured to, when receiving data, intercept the data packet through a stubs function inserted in the network card driver layer in advance and determine whether the target port of the data packet belongs to the specified port range supported by the fast network protocol stack module. If so, directly send the data packet to the UDP protocol stack for decapsulation processing, and then directly pass it to the application layer through the memory management module.

[0013] The third aspect of the present invention provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a data transmission method based on a fast network protocol stack as described in any one of the first aspects.

[0014] The fourth aspect of the present invention provides a computer-readable storage medium, which includes a stored computer program. When the computer program runs, it controls the device where the computer-readable storage medium is located to execute a data transmission method based on a fast network protocol stack as described in any one of the first aspects.

[0015] The beneficial effects of the present invention are as follows: The present invention significantly reduces the CPU resource consumption, realizes efficient and fast data transmission. In the case where the current base station faces the demand for large-flow data processing, the present invention can significantly improve the data processing ability of the base station, including increasing the throughput and reducing the latency. Through actual tests, it is found that in the full-flow service processing scenario, the technical solution of the present invention can reduce the network load by 30%, thus significantly improving the overall performance of the base station.

[0016] In large-flow data processing scenarios such as base stations, the present invention can significantly improve the data processing ability of the base station, enhance the overall performance and real-time performance of the system, and has a wide range of application prospects.

[0017] The present invention is applicable to base station systems, and also applicable to base station plus repeater extended coverage systems, and particularly applicable to distributed wireless systems, including fiber optic remote distributed systems, cable remote frequency shift repeater systems, frequency shift systems, marine communications, low-altitude communications, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a schematic diagram of the data flow of a standard network protocol stack in the prior art; Figure 2 It is a flowchart of a data transmission method based on a fast network protocol stack according to the present invention; Figure 3 It is a schematic diagram of the memory management module (FMC) in this embodiment; Figure 4 It is the ENS architecture diagram in this embodiment; Figure 5 It is a schematic diagram of an electronic device. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0019] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0021] Figure 1The figure shows the data flow of a standard network protocol stack (TCP / IP protocol stack) in the prior art. Among them, for a network packet to be received from the hardware layer to the application layer, it needs to go through four steps: network card driver, receive ring buffer management, protocol stack processing, and socket interaction. To meet the requirements of various network packets, a large amount of CPU resources are consumed, resulting in excessive CPU resource consumption when processing large traffic data. For current base stations, in fact, they more need to meet the processing of UDP packets. UDP packets do not require the complex handshake and acknowledgment mechanisms like TCP, but the standard network protocol stack still performs these unnecessary operations. Therefore, the embodiments of the present invention improve the prior art, aiming to significantly reduce the CPU load and improve the data transmission efficiency by optimizing the network protocol stack design and memory management mechanism.

[0022] Please refer to the attached Figure 2 - attached Figure 5 , the first aspect of the embodiments of the present invention proposes a data transmission method based on a fast network protocol stack. As Figure 2 shown, it includes the following steps: Step S1: Deploy a fast network protocol stack module (abbreviated as ENS (Efficient Network Stack) module in this embodiment) dedicated to receiving and sending UDP packets on a specified port in the system. This fast network protocol stack module is a lightweight network protocol stack module independent of the standard network protocol stack. Among them, the fast network protocol stack module includes a network card driver layer, a UDP protocol stack, and a memory management module (abbreviated as FMC (fast memory communication) in this embodiment).

[0023] It can be understood that the ENS module is a lightweight protocol stack independent of the operating system's standard network protocol stack, focusing on processing UDP (User Datagram Protocol) packets within a specific port range, and improving the data transmission efficiency by simplifying the protocol processing flow. The UDP protocol stack provides lightweight UDP protocol processing functions. The UDP protocol stack removes redundant functional modules (such as TCP connection management), significantly reducing the complexity of the protocol stack and focusing on encapsulating and decapsulating UDP packets within a specified port range. The network card driver layer is responsible for interacting with physical network devices to complete the sending and receiving of data packets. The memory management module is used to optimize the data transfer process between the user mode and the kernel mode.

[0024] The present invention deploys a fast network protocol stack module dedicated to processing UDP packets within a specified port range. This fast network protocol stack module bypasses the complex processing logic of the standard network protocol stack and avoids redundant processing. This operation significantly reduces the intermediate links in packet processing and reduces the CPU load in network processing.

[0025] Step S2: When data is sent, check the destination address and port information of the data generated in the user state; if the destination port belongs to the specified port range supported by the fast network protocol stack module, the data is passed to the UDP protocol stack through the memory management module, encapsulated as a raw UDP packet, and then directly passed to the network card driver layer for sending, bypassing the standard network protocol stack.

[0026] Step S3: When data is received, intercept the data packet through a stub function inserted in the network card driver layer in advance and determine whether the destination port of the data packet belongs to the specified port range supported by the fast network protocol stack module. If so, the data packet is directly sent to the UDP protocol stack for decapsulation processing, and then directly passed to the application layer through the memory management module, avoiding the data copy from the system kernel state to the user state and accelerating the transmission rate.

[0027] It can be understood that stubbing is a technique of inserting interception points (Hooks) in the code to capture or modify the behavior of specific events. Through the stubbing technique, the UDP protocol stack can directly process UDP data of the specified port, bypassing the complex process of the standard network protocol stack.

[0028] In this embodiment, the memory management module adopts a memory sharing mechanism to achieve zero-copy data transmission between the kernel state and the user state.

[0029] It can be understood that shared memory is a technique that allows multiple processes or threads to access the same memory area, used to achieve efficient data sharing and communication.

[0030] In a preferred solution of this embodiment, the method for the memory management module to implement the memory sharing mechanism is as follows: Adopt the method of pre-allocating a memory pool to store memory blocks. The pre-allocated memory pool pre-allocates a certain number of fixed-size memory blocks during the system initialization phase and stores them in a dedicated queue. When the user state and the kernel state need memory, they directly obtain available memory blocks from the memory pool, avoiding the overhead during dynamic memory allocation.

[0031] It can be understood that in the traditional memory allocation method, each time memory is applied for, the operating system needs to perform complex allocation operations, which will consume a lot of time. After using the pre-allocated memory queue in the present invention, the memory is already prepared in the queue and can be directly used without waiting for the allocation process.

[0032] Specifically, in this embodiment, an asynchronous memory recycling mechanism is adopted when releasing memory. When the user state or the kernel state releases memory, the memory block is put into the recycling queue, and the background maintenance thread regularly checks the recycling queue and puts the memory block back into the pre-allocated memory pool.

[0033] It can be understood that if the memory release needs to be executed immediately every time, it may lead to frequent lock contention and context switching, affecting performance. The asynchronous memory recycling mechanism adopted by the present invention can postpone these operations to the background thread, thus reducing the burden on the main thread. That is, when there is memory to be released, instead of immediately performing complex release operations, the memory to be released is put into the queue to be released, and a dedicated maintenance thread is used to process it. This not only improves the efficiency of memory management but also avoids interference with data transmission during memory release, saves the data copy time for communication from the kernel to the application layer and between threads, and improves the data transmission efficiency through the memory sharing mechanism.

[0034] As Figure 3 shown in the schematic diagram of the memory management module (FMC).

[0035] In this embodiment, the memory management module divides the shared memory into the following three partitions: Shared partition: Only the memory management service of the memory management module is responsible for allocation and release, which is used to store the core data of the protocol stack. Any attempt by external programs or user processes to allocate or release the shared partition will be rejected by the system, ensuring the security and efficiency of memory usage.

[0036] Local partition: It consists of multiple buffers of different sizes, independent of the kernel and user space, and is uniformly managed by the memory management service of the memory management module. Each buffer contains one or more memory blocks of a fixed size; it is mainly used for memory allocation for specific tasks. When the program needs to use the memory resources of the local partition, it needs to send a request to the memory management service. The memory management service searches for a suitable memory block in the buffers of the local partition for allocation according to the requested memory size and type.

[0037] Remote partition: The composition of the remote partition is similar to that of the local partition, but it can be accessed by all programs and is used for communication between programs, but cannot be used for memory allocation by the memory management module itself. Application scenarios include: (1) When another memory management module passes a message to the current application program; (2) For application program 1 and application program 2 on the same memory management module, application program 1 can pass the memory address it uses to application program 2.

[0038] Specifically, when sending data, if the destination port does not belong to the specified port range supported by the fast network protocol stack module, the data is processed through the standard protocol stack of the operating system; when receiving data, if the destination port of the data packet does not belong to the specified port range supported by the fast network protocol stack module, the data packet is processed through the standard protocol stack of the operating system.

[0039] In this embodiment, the Fast Network Protocol Stack Module (ENS) is a UDP message sending and receiving library based on FMC. It can be understood that ENS is a lightweight protocol stack module independent of the operating system socket. The Fast Network Protocol Stack Module emulates the Socket interface of the operating system and provides a usage mode compatible with the standard Socket interface.

[0040] As Figure 4 shown in the ENS architecture diagram. After loading ENS, a set of ens socket interfaces are built in the system. Most of these interfaces correspond to the system socket interfaces. An ens socket can be created using a method similar to that of the system socket interface, and then directly processed by the ens udp stack and given to the driver layer without going through the system's tcp / ip stack.

[0041] ENS provides two UDP message sending interfaces: ens_sendmsg() and ens_sendto(). The receiving interface is ens_recvfrom(), which is similar to the usage of the system socket.

[0042] The principle of ens_sendto() is to directly pass the data to the ENS thread for processing through the FMC_Put interface without occupying the time of the current thread. The biggest advantage of this interface is its fast execution efficiency and short thread occupation time.

[0043] ens_sendmsg() decides to take different branches according to the interface parameters. If it is an IPv6 message, the path is the same as that of sendto(). If it is an IPv4 message, it depends on whether IPSec is supported. If IPSec is not supported, the packet is directly encapsulated and passed to the driver layer for packet sending. If IPSec is supported, since the packet encapsulation is more complex and xfrm needs to be called, it is passed to the ens thread for processing, then encapsulated by the ens udp stack, and then passed to the driver.

[0044] ens_recvfrom: Data reception is performed by hooking the network card driver layer. When a packet arrives on the network, it will first be passed to the receiving function hook to determine whether it is UDP data and data of the specified port bound to ENS. If so, it is directly intercepted and unpacked, and then passed to the upper-layer thread through the FMC_Put() function. If not, the reception exits and the normal unpacking process of the system continues.

[0045] The present invention significantly reduces the CPU resource consumption, realizes efficient and fast data transmission. In the case that the current base station faces the demand for large - volume data processing, the present invention can significantly improve the data - processing ability of the base station, including increasing the throughput and reducing the latency. Through actual tests, it is found that in the full - traffic service - processing scenario, adopting the technical solution of the present invention can reduce the network load by 30%, thus significantly improving the overall performance of the base station.

[0046] In the second aspect of the embodiments of the present invention, a data - transmission system based on a fast network protocol stack is proposed, corresponding to the data - transmission method based on a fast network protocol stack provided in the above - mentioned embodiments of the present invention. Since the data - transmission system based on a fast network protocol stack provided in the embodiments of the present invention corresponds to the data - transmission method based on a fast network protocol stack provided in the above - mentioned embodiments of the present invention, the implementation manners of the foregoing data - transmission method based on a fast network protocol stack are also applicable to the data - transmission system based on a fast network protocol stack provided in this embodiment.

[0047] Specifically, the system includes the following modules: A deployment component, configured to deploy a fast network protocol - stack module dedicated to receiving and sending UDP packets of a specified port in the system. Wherein, the fast network protocol - stack module includes a network - card driver layer, a UDP protocol stack, and a memory - management module.

[0048] A data - sending processing component, configured to check the data target address and port information generated in the user state when sending data; if the target port belongs to the specified port range supported by the fast network protocol - stack module, the data is passed to the UDP protocol stack through the memory - management module to be encapsulated as a raw UDP packet and then directly passed to the network - card driver layer for sending.

[0049] A data - receiving processing component, configured to intercept a data packet through a piling function pre - inserted in the network - card driver layer and determine whether the target port of the data packet belongs to the specified port range supported by the fast network protocol - stack module when receiving data. If so, the data packet is directly sent to the UDP protocol stack for decapsulation processing, and then directly passed to the application layer through the memory - management module.

[0050] See Figure 5 , the embodiments of the present invention also correspondingly provide an electronic device and a computer - readable storage medium.

[0051] As Figure 5The figure shows a schematic diagram of an electronic device provided by an embodiment of the present invention. The electronic device of this embodiment includes: a processor 11, a memory 12, and a computer program stored in the memory and executable on the processor 11. When the processor 11 executes the computer program, it implements the steps in the above-described embodiment of the data transmission method based on the fast network protocol stack. Alternatively, when the processor 11 executes the computer program, it implements the functions of each module / unit in the above-described device embodiments.

[0052] Exemplarily, the computer program may be divided into one or more modules / units, and the one or more modules / units are stored in the memory and executed by the processor 11 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program in the electronic device.

[0053] The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the schematic diagram is only an example of the electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, the electronic device may further include input / output devices, network access devices, a bus, etc.

[0054] The so-called processor 11 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor is the control center of the electronic device and connects various parts of the entire electronic device using various interfaces and lines.

[0055] The memory 12 can be used to store the computer programs and / or modules. By running or executing the computer programs and / or modules stored in the memory, and invoking the data stored in the memory, the processor realizes various functions of the electronic device. The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system 121, application programs 122 required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0056] Among them, if the modules / units integrated in the electronic device are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above method embodiments of the present invention, it can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above method embodiments can be realized. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0057] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the attached drawings of the device embodiments provided by the present invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement without creative efforts.

[0058] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of this application.

Claims

1. A data transmission method based on a fast network protocol stack, characterized in that: The following steps are involved: Deploy a fast network protocol stack module dedicated to sending and receiving UDP messages of a specified port in the system, wherein the fast network protocol stack module includes a network card driver layer, a UDP protocol stack, and a memory management module; When sending data, check the data target address and port information generated in the user state; if the target port belongs to the specified port range supported by the fast network protocol stack module, pass the data to the UDP protocol stack through the memory management module, encapsulate it into a raw UDP message, and then directly pass it to the network card driver layer for sending; When receiving data, the data packet is intercepted by the stubbing function inserted in the network card driver layer in advance and it is determined whether the target port of the data packet belongs to the specified port range supported by the fast network protocol stack module. If so, the data packet is directly sent to the UDP protocol stack for decapsulation processing, and then directly passed to the application layer through the memory management module.

2. A data transmission method based on a fast network protocol stack according to claim 1, characterized in that: The memory management module adopts a memory sharing mechanism to realize zero-copy data transmission between kernel state and user state.

3. A data transmission method based on a fast network protocol stack according to claim 2, characterized in that: The method for the memory management module to implement the memory sharing mechanism is: The memory blocks are stored in a pre-allocated memory pool. The pre-allocated memory pool pre-allocates a certain number of fixed-size memory blocks during the system initialization phase and stores them in a dedicated queue. When the user state and the kernel state need memory, the available memory blocks are directly obtained from the memory pool.

4. The data transmission method based on a fast network protocol stack according to claim 3, characterized in that: An asynchronous memory recycling mechanism is used when releasing memory. When the user state or kernel state releases the memory, the memory block is placed in the recycling queue. The background maintenance thread periodically checks the recycling queue and puts the memory block back into the pre-allocated memory pool.

5. The data transmission method based on a fast network protocol stack according to claim 2, characterized in that: The memory management module divides the shared memory into the following three partitions: Shared partition: Only the memory management service of the memory management module is responsible for allocation and release, which is used to store the core data of the protocol stack to ensure the security and efficiency of memory use; Local partition: It consists of multiple buffers of different sizes, which are independent of the kernel and user space and are managed uniformly by the memory management service of the memory management module. Each buffer contains one or more memory blocks of fixed size. Remote partition: can be accessed by all programs and used for communication between programs, but cannot be used for memory allocation of the memory management module itself.

6. The data transmission method based on a fast network protocol stack according to claim 1, characterized in that: Also includes: When sending data, if the destination port does not belong to the specified port range supported by the fast network protocol stack module, the data is processed through the standard protocol stack of the operating system; When receiving data, if the destination port of the data packet does not belong to the specified port range supported by the fast network protocol stack module, the data packet is processed through the standard protocol stack of the operating system.

7. The data transmission method based on a fast network protocol stack according to claim 1, characterized in that: The fast network protocol stack module simulates the Socket interface of the operating system and provides a usage method compatible with the standard Socket interface.

8. A data transmission system based on a fast network protocol stack, characterized in that: include: A deployment component is used to deploy a fast network protocol stack module dedicated to sending and receiving UDP messages of a specified port in the system, wherein the fast network protocol stack module includes a network card driver layer, a UDP protocol stack, and a memory management module; The data sending processing component is used to check the data target address and port information generated by the user state when sending data; if the target port belongs to the specified port range supported by the fast network protocol stack module, the data is passed to the UDP protocol stack through the memory management module, encapsulated as a raw UDP message, and then directly passed to the network card driver layer for sending; The data receiving and processing component is used to intercept the data packet through the stubbing function pre-inserted in the network card driver layer when receiving data and determine whether the target port of the data packet belongs to the specified port range supported by the fast network protocol stack module. If so, the data packet is directly sent to the UDP protocol stack for decapsulation processing, and then directly passed to the application layer through the memory management module.

9. An electronic device, characterized in that: It comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements a data transmission method based on a fast network protocol stack as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a data transmission method based on a fast network protocol stack as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • UDP data package transmission method

    CN101217464A

  • Method and device for network device data forwarding

    CN104283923A

  • Message forwarding method, terminal and computer readable storage medium

    CN114006859A

  • Space management method and device, operating system, equipment and storage medium

    CN116610594A

  • Message distribution method, network equipment and storage medium

    CN119211145A

Cited By

  • Data transmission method and device

    CN120658813A