A data transmission method and system based on fast network protocol stack

By deploying a fast network protocol stack module in the base station, the problem of high CPU load is solved, efficient and fast data transmission is achieved, and the data processing capability and system performance of the base station are improved.

CN120075318BActive Publication Date: 2025-09-26GUANGDONG BROADRADIO COMM TECH
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing network processing solutions have high CPU load when processing large amounts of data, leading to system performance bottlenecks. Especially in scenarios such as base stations, they cannot meet the needs of efficient and stable data processing.

Method used

Deploy a fast network protocol stack module dedicated to sending and receiving designated ports, including the network card driver layer, UDP protocol stack and memory management module. Use memory sharing mechanism to achieve zero-copy data transmission, intercept data packets through the stubbing function and directly process the UDP packets of the designated port, bypassing the complex process of the standard protocol stack.

Benefits of technology

Significantly reduces CPU resource consumption, improves data transmission efficiency, enhances base station data processing capabilities, reduces latency and increases throughput, and reduces network load by 30%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075318B_ABST
    Figure CN120075318B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of communication technology, and 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 in a system specifically for sending and receiving UDP packets of a designated port; when sending data, checking the data target address and port information generated in a user state; if the target port belongs to the designated port range supported by the fast network protocol stack module, passing the data to the UDP protocol stack through a memory management module, encapsulating the data into an original UDP packet, and then directly passing it to a network card driver layer for sending; when receiving data, intercepting the data packet through a stub function pre-inserted in the network card driver layer and determining whether the target port belongs to the designated port range supported by the fast network protocol stack module; if so, directly sending the data packet to the UDP protocol stack for decapsulation processing, and directly passing it to the application layer through the memory management module. The present invention significantly reduces CPU resource consumption and achieves efficient and fast data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the booming communications industry, network data traffic is experiencing explosive growth, creating an increasingly urgent need for high-volume network data processing. While raw data transmission speeds are rapidly increasing, advances in microprocessor technology for low-power processing are slowing. During data transmission, network protocol processing overhead is increasing dramatically, accounting for an increasing proportion of packet transmission time.

[0003] Existing network processing solutions suffer from serious drawbacks when handling large amounts of data. The standard OSI network protocol stack has a complex processing flow and consumes significant CPU resources. This is particularly inefficient when processing UDP packets. This high CPU usage easily leads to system performance bottlenecks, significantly impacting the real-time performance of the entire system. Furthermore, dynamic memory allocation and frequent data copying (for example, between kernel and user modes) introduce additional latency. Existing processing solutions, especially in scenarios requiring large amounts of data, such as base stations, cannot meet the requirements for efficient and stable data processing. A new network processing solution is urgently needed that can both ensure the rapid transmission of large amounts of data and reduce the network's CPU load. 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, achieve efficient and fast data transmission under low CPU overhead, and improve the data processing capabilities of equipment such as base stations.

[0005] In order to achieve the purpose of the present invention, the following technical solutions are adopted:

[0006] A first aspect of the present invention provides a data transmission method based on a fast network protocol stack, comprising the following steps:

[0007] 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;

[0008] When sending data, the data destination address and port information generated in the user state are checked; 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 into a raw UDP message, and then directly passed to the network card driver layer for sending;

[0009] When receiving data, the data packet is intercepted by the stubbing function pre-inserted in the network card driver layer 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.

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

[0011] A further improvement is that the memory management module implements the memory sharing mechanism by:

[0012] 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 user state and kernel state need memory, available memory blocks are directly obtained from the memory pool.

[0013] A further improvement is that an asynchronous memory recycling mechanism is used when releasing memory. When memory is released in user mode or kernel mode, the memory block is placed in a recycling queue. The background maintenance thread regularly checks the recycling queue and puts the memory block back into the pre-allocated memory pool.

[0014] A further improvement is that the memory management module divides the shared memory into the following three partitions:

[0015] Shared partition: Only the memory management service of the memory management module is responsible for allocation and release. It is used to store the core data of the protocol stack, ensuring the security and efficiency of memory use.

[0016] Local partition: consists of multiple buffers of different sizes, independent of the kernel and user space, and managed uniformly by the memory management service of the memory management module. Each buffer contains one or more fixed-size memory blocks;

[0017] 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.

[0018] Further improvements include:

[0019] 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 will be processed through the standard protocol stack of the operating system;

[0020] 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 will be processed through the standard protocol stack of the operating system.

[0021] A further improvement is 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.

[0022] A second aspect of the present invention provides a data transmission system based on a fast network protocol stack, comprising:

[0023] A deployment component is used to deploy a fast network protocol stack module dedicated to sending and receiving 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;

[0024] The data transmission processing component is used to check the data destination address and port information generated by the user state when sending data. 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 into a raw UDP message, and then directly passed to the network card driver layer for sending.

[0025] The data receiving and processing component is used to intercept data packets 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.

[0026] The third aspect of the present invention proposes an electronic device, comprising 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 the first aspects.

[0027] The fourth aspect of the present invention proposes a computer-readable storage medium, which 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 the first aspects.

[0028] The beneficial effects of the present invention are:

[0029] This invention significantly reduces CPU resource consumption and enables efficient and rapid data transmission. Given the current high-volume data processing demands faced by base stations, this invention can significantly enhance their data processing capabilities, including increasing throughput and reducing latency. Actual testing has shown that, in a full-volume traffic processing scenario, the implementation of this invention's technical solution can reduce network load by 30%, significantly improving overall base station performance.

[0030] In high-traffic data processing scenarios such as base stations, the present invention can significantly improve the base station data processing capability, enhance the overall performance and real-time performance of the system, and has broad application prospects.

[0031] The present invention is applicable to base station systems, as well as base station plus repeater extended coverage systems, and is particularly applicable to distributed wireless systems, including optical fiber remote distributed systems, cable remote frequency shift repeater systems, frequency shift systems, sea area communications, low-altitude communications, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a diagram of a standard network protocol stack data flow in the prior art;

[0033] Figure 2 This is a flow chart of a data transmission method based on a fast network protocol stack according to the present invention;

[0034] Figure 3 is a schematic diagram of a memory management module (FMC) in this embodiment;

[0035] Figure 4 This is the ENS architecture diagram in this embodiment;

[0036] Figure 5 A schematic diagram of an electronic device. DETAILED DESCRIPTION

[0037] In order to enable those skilled in the art to better understand the solutions 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 part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0038] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0039] Figure 1The figure shows the data flow of a standard network protocol stack (TCP / IP protocol stack) in the prior art. Here, a network message from hardware to the application layer must go through four steps: network card driver, receive ring buffer management, protocol stack processing, and socket interaction. Meeting the needs of various network messages requires a large amount of CPU resources, resulting in excessive CPU resource consumption when processing large amounts of data. For current base stations, the processing of UDP messages is more important. UDP messages do not require the complex handshake and confirmation mechanisms of TCP, but the standard network protocol stack still performs these unnecessary operations. Therefore, the embodiments of the present invention improve upon the prior art, aiming to significantly reduce CPU load and improve data transmission efficiency by optimizing the network protocol stack design and memory management mechanism.

[0040] Please refer to the attached Figure 2 -Attached Figure 5 In a first aspect, an embodiment of the present invention proposes a data transmission method based on a fast network protocol stack, such as Figure 2 As shown, the following steps are included:

[0041] Step S1: Deploy a fast network protocol stack module (referred to as Efficient Network Stack (ENS) module in this embodiment) dedicated to sending and receiving UDP packets of a specified port in the system. The fast network protocol stack module is a streamlined network protocol stack module independent of the standard network protocol stack, wherein the fast network protocol stack module includes a network card driver layer, a UDP protocol stack, and a memory management module (referred to as FMC (fast memory communication) in this embodiment).

[0042] The ENS module is a lightweight protocol stack independent of the standard operating system network protocol stack. It focuses on processing UDP (User Datagram Protocol) packets within a specific port range, improving data transmission efficiency by streamlining protocol processing. The UDP protocol stack provides lightweight UDP protocol processing. It removes redundant functional modules (such as TCP connection management), significantly reducing the stack's complexity 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 send and receive data packets. The memory management module optimizes data transfer between user mode and kernel mode.

[0043] The present invention deploys a fast network protocol stack module that specifically processes UDP packets within a specified port range. The 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 data packet processing and reduces the CPU load in network processing.

[0044] Step S2: 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, the data is passed to the UDP protocol stack through the memory management module, encapsulated as the original UDP message, and then directly passed to the network card driver layer for sending out, bypassing the standard network protocol stack.

[0045] Step S3: When receiving data, the data packet is intercepted by the piling function pre-inserted in the network card driver layer 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, avoiding data copying from the system kernel state to the user state and speeding up the transmission rate.

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

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

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

[0049] In a preferred solution of this embodiment, the method for the memory management module to implement the memory sharing mechanism is:

[0050] 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 user state and kernel state need memory, available memory blocks are directly obtained from the memory pool, avoiding the overhead of dynamic memory allocation.

[0051] It is understandable that in traditional memory allocation methods, each memory request requires the operating system to perform complex allocation operations, which consumes a lot of time. However, after the present invention uses a pre-allocated memory queue, the memory is already prepared in the queue and can be used directly without waiting for the allocation process.

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

[0053] It is understandable that if each memory release requires immediate execution, it may lead to frequent lock contention and context switching, affecting performance. However, the present invention uses an asynchronous memory recovery mechanism to defer these operations to a background thread, thereby reducing the burden on the main thread. Specifically, when memory needs to be released, rather than performing a complex release operation immediately, the memory to be released is placed in a pending release queue, which is then processed by a dedicated maintenance thread. This not only improves memory management efficiency but also avoids interference with data transmission during memory release, saving data copy time from the kernel to the application layer and between threads. Data transmission efficiency is improved through a memory sharing mechanism.

[0054] like Figure 3 Shown is a schematic diagram of the Memory Management Module (FMC).

[0055] In this embodiment, the memory management module divides the shared memory into the following three partitions:

[0056] Shared partition: Only the memory management service of the memory management module is responsible for allocation and release. It is used to store the core data of the protocol stack. Any attempt by external programs or user processes to allocate or release shared partitions will be rejected by the system, ensuring the security and efficiency of memory use.

[0057] Local partitions: These are composed of multiple buffers of varying sizes, independent of the kernel and user space. They are managed uniformly by the memory management service of the memory management module. Each buffer contains one or more fixed-size memory blocks and is primarily used for memory allocation for specific tasks. When a program needs to use memory resources from a local partition, it sends a request to the memory management service. The memory management service then searches for an appropriate memory block in the local partition's buffers based on the requested memory size and type.

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

[0059] Specifically, when data is sent, if the destination port does not belong to the specified port range supported by the fast network protocol stack module, the data will be processed through the standard protocol stack of the operating system; when data is received, 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 will be processed through the standard protocol stack of the operating system.

[0060] In this embodiment, the fast network protocol stack module (ENS) is a UDP message transceiver library based on FMC. It can be understood that ENS is a streamlined protocol stack module independent of the operating system socket. The fast network protocol stack module simulates the operating system's socket interface and provides a usage method compatible with the standard socket interface.

[0061] like Figure 4 The following diagram shows the ENS architecture. After loading ENS, the system creates a set of ENs socket interfaces, which mostly correspond to system socket interfaces. ENs sockets can be created using methods similar to system socket interfaces. They are then processed directly by the ENs UDP stack and passed directly to the driver layer, without passing through the system's TCP / IP stack.

[0062] ENS provides two UDP message sending interfaces: ens_sendmsg() and ens_sendto(), and the receiving interface is ens_recvfrom(), which is similar to the use of system sockets.

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

[0064] ens_sendmsg() decides to take different branches based on the interface parameters. If it is an IPv6 message, the path taken is the same as sendto(). If it is IPv4, it is determined whether IPSec is supported. If it does not support IPSec, the packet is directly passed to the driver layer for sending. If it supports IPSec, since the packet is more complex, xfrm needs to be called, so it is passed to the ens thread for processing, and then the ens udp stack packet is performed before being passed to the driver.

[0065] ens_recvfrom: Data is received by stubbing in the network card driver layer. When a packet comes from the network, it will be passed to the receiving function to stubbing to determine whether it is UDP data and the designated port data bound to ens. If so, it will be directly intercepted and unpacked, and then passed to the upper thread through the FMC_Put() function. If not, the receiving function will exit and continue the normal unpacking process of the system.

[0066] This invention significantly reduces CPU resource consumption and enables efficient and rapid data transmission. Given the current high-volume data processing demands faced by base stations, this invention can significantly enhance their data processing capabilities, including increasing throughput and reducing latency. Actual testing has shown that, in a full-volume traffic processing scenario, the implementation of this invention's technical solution can reduce network load by 30%, significantly improving overall base station performance.

[0067] The second aspect of an embodiment of the present invention proposes a data transmission system based on a fast network protocol stack, which corresponds to a data transmission method based on a fast network protocol stack provided in the above-mentioned embodiment of the present invention. Since the data transmission system based on a fast network protocol stack provided in the embodiment of the present invention corresponds to a data transmission method based on a fast network protocol stack provided in the above-mentioned embodiment of the present invention, the implementation method of the aforementioned data transmission method based on a fast network protocol stack is also applicable to a data transmission system based on a fast network protocol stack provided in this embodiment.

[0068] Specifically, the system includes the following modules:

[0069] The 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.

[0070] The data sending processing component is used 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, encapsulated into the original UDP message, and then directly passed to the network card driver layer for sending.

[0071] The data receiving and processing component is used to intercept data packets 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.

[0072] See also Figure 5 , an embodiment of the present invention also provides an electronic device and a computer-readable storage medium.

[0073] like Figure 5FIG2 is a schematic diagram of an electronic device provided in accordance with an embodiment of the present invention. The electronic device in accordance with this embodiment includes a processor 11, a memory 12, and a computer program stored in the memory and executable by the processor 11. When the processor 11 executes the computer program, the steps of the aforementioned embodiment of the data transmission method based on the fast network protocol stack are implemented. Alternatively, when the processor 11 executes the computer program, the functions of the modules / units in the aforementioned device embodiments are implemented.

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

[0075] The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the schematic diagram is merely an example of an electronic device and does not limit the electronic device. The electronic device may include more or fewer components than shown, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.

[0076] The processor 11 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or 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.

[0077] The memory 12 can be used to store the computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system 121, an application 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 based on the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0078] Wherein, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0079] It should be noted that 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 across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art can understand and implement the present invention without inventive effort.

[0080] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

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; The memory management module adopts a memory sharing mechanism to achieve zero-copy data transmission between kernel state and user state; The memory management module implements a memory sharing mechanism by: using a pre-allocated 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 user state and kernel state need memory, available memory blocks are directly obtained from the memory pool. When releasing memory, an asynchronous memory recycling mechanism is used. When user state or kernel state releases memory, the memory block is placed in a recycling queue. A background maintenance thread periodically checks the recycling queue and puts the memory block back into the pre-allocated memory pool. The memory management module divides the shared memory into the following three partitions: a shared partition, which is allocated and released only by the memory management service of the memory management module and is used to store the core data of the protocol stack to ensure the security and efficiency of memory use; a local partition, which consists of multiple buffers of different sizes, is 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 fixed size; a remote partition, which can be accessed by all programs and is used for communication between programs, but cannot be used for memory allocation of the memory management module itself; When sending data, the data destination address and port information generated in the user state are checked; 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 into a raw UDP message, and then directly passed to the network card driver layer for sending; When receiving data, the data packet is intercepted by the stubbing function pre-inserted in the network card driver layer 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. 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 will be 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 will be processed through the standard protocol stack of the operating system.

3. 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.

4. A data transmission system based on a fast network protocol stack, configured to execute a data transmission method based on a fast network protocol stack as claimed in any one of claims 1 to 3, characterized in that: include: A deployment component is used to deploy a fast network protocol stack module dedicated to sending and receiving 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; The data transmission processing component is used to check the data destination address and port information generated by the user state when sending data. 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 into 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 data packets 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.

5. An electronic device, characterized in that: The invention 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, a data transmission method based on a fast network protocol stack as described in any one of claims 1 to 3 is implemented.

6. 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 the data transmission method based on the fast network protocol stack according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Message distribution method, network equipment and storage medium

    CN119211145A