Data forwarding proxy method, electronic device, storage medium and program product

By establishing a kernel buffer pool for each network card queue at the network card driver level, the application program can directly operate the kernel buffer pool space address, thus solving the problem of poor throughput performance in the seven-layer data forwarding agent, realizing a more efficient data forwarding agent, and improving network performance.

CN119766915BActive Publication Date: 2025-09-26BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411902221.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-09-26
Estimated Expiration
2044-12-23

AI Technical Summary

Technical Problem

In the existing seven-layer data forwarding proxy implementation, the network throughput performance is poor and the average response delay is long, mainly due to the copying of data between the fourth layer and the seventh layer.

Method used

By establishing a kernel buffer pool for each network card queue at the network card driver level and establishing a corresponding relationship between it and the CPU and application, the application directly operates the kernel buffer pool space address, avoiding data copying between user state and kernel state, and realizing direct processing and transmission of data packets.

Benefits of technology

The throughput performance of the seven-layer protocol stack agent has been improved, the average response delay has been shortened, and the data forwarding efficiency has been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119766915B_ABST
    Figure CN119766915B_ABST
Patent Text Reader

Abstract

The present application provides a data forwarding proxy method, comprising: a network card driver establishing a kernel buffer pool for each network card queue, and establishing a corresponding relationship between the kernel buffer pool, the CPU, and the application; upon receiving a data packet from the network, the network card driver stores the data packet in a designated kernel buffer pool space in the kernel buffer pool and reports it to the protocol stack; the protocol stack parses and processes the data packet in the order of the data link layer, the network layer, and the transport layer; the protocol stack transmits the designated kernel buffer pool space address to the application, allowing the application to operate on the data packet pointed to by the kernel buffer pool space address; the application performs at least one of adding, modifying, or deleting the data packet; the application writes the kernel buffer pool space address to the kernel and calls a protocol send function to send the data packet. The present application also provides an electronic device, a computer-readable storage medium, and a computer program product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a data forwarding proxy method, electronic equipment, computer-readable storage medium, and computer program product. Background Art

[0002] The existing seven-layer data forwarding proxy implementation, whether based on kernel-mode + user-mode implementation or pure user-mode implementation, requires a copy of the message when the seven-layer protocol stack transfers data from layer 4 to layer 7. After the user-mode process the data, the data is copied to the socket. This results in poor network throughput performance and long average response delay. Summary of the Invention

[0003] The purpose of the embodiments of the present application is to provide a data forwarding proxy method, an electronic device, a computer-readable storage medium, and a computer program product.

[0004] The first aspect of the present application provides a data forwarding proxy method, which includes: a network card driver establishes a kernel buffer pool for each network card queue, and establishes a corresponding relationship between the kernel buffer pool, the CPU, and the application; after the network card driver receives a data packet from the network, the data packet is stored in a designated kernel buffer pool space in the kernel buffer pool and reported to the protocol stack; the protocol stack parses and transmits the data packet in the order of the link layer, the network layer, and the transport layer; the protocol stack transmits the designated kernel buffer pool space address to the application, so that the application operates the data packet pointed to by the kernel buffer pool space address; the application performs at least one operation of adding, modifying or deleting the data packet; the application writes the address of the kernel buffer pool space to the kernel and calls the protocol sending function to send the data packet; wherein, the kernel buffer pool is used to allocate a number of kernel buffer pool structures to store data according to the actual length of the data packet, and the several kernel buffer pool structures can form a linked list structure, and the address of the kernel buffer pool space is represented by the address of the linked list structure. In some embodiments, after receiving a data packet from the network, the network card driver stores the data packet in a designated kernel buffer pool space in the kernel buffer pool, including: after receiving the data packet, the network card driver receives the data packet into the designated kernel buffer pool space in the kernel buffer pool via direct memory access or copying. In some embodiments, the protocol stack parses and processes the data packet in the order of the data link layer, network layer, and transport layer, including: after parsing the data packet in the order of the data link layer, network layer, and transport layer, for packets to be discarded, releasing the corresponding kernel buffer pool structure space to the corresponding kernel buffer pool, or placing data packets to be transmitted locally into the socket's receive queue. In some embodiments, the method further includes: disabling the kernel buffer pool merging and fragment reassembly functions of the protocol stack. In some embodiments, the method further includes: notifying the peer end via an ICMP message to send a non-fragmented data packet. In some embodiments, the application performs at least one of adding, modifying or deleting data packets, including: when the application performs an operation of adding data, allocating a new kernel buffer pool structure from the kernel buffer pool and adding it to the kernel buffer pool linked list; when the application performs an operation of deleting data, deleting the kernel buffer pool structure corresponding to the data; when the application performs an operation of modifying data, if the length of the modified data is greater than the maximum length of the TCP packet, allocating a new kernel buffer pool structure to store the data that exceeds the maximum length of the TCP packet.In some embodiments, when the application performs a data deletion operation, the kernel buffer pool structure corresponding to the data is deleted, including: deleting the kernel buffer pool structure corresponding to the data through a system call method, and releasing the kernel buffer pool structure corresponding to the data to the kernel buffer pool to which it belongs. The second aspect of the present application provides an electronic device, including: a processor and a memory, the memory storing executable instructions, when the executable instructions are executed by the processor, the electronic device executes any of the above methods. The third aspect of the present application provides a computer-readable storage medium, the computer-readable storage medium storing a computer program, when the computer program is executed by the processor, it implements any of the above data forwarding proxy methods. The fourth aspect of the present application provides a computer program product, the computer program product includes a computer program, when the computer program is run, the computer executes any of the above data forwarding proxy methods.

[0005] The present application provides a data forwarding proxy method that can be used for the proxy of the seven-layer protocol stack. The application directly reads the data packets received by the protocol stack kernel buffer pool. After the application adds, deletes, and modifies the data packets, the data packets are sent to the protocol stack for forwarding, thereby avoiding memory copying, improving the throughput performance of the seven-layer protocol stack proxy, and shortening the average response delay. BRIEF DESCRIPTION OF THE DRAWINGS

[0006] Figure 1 This is a flow chart of the data forwarding proxy method according to an embodiment of the present application; Figure 2 This is a structural diagram of a data forwarding proxy device according to an embodiment of the present application;

[0007] Figure 3 This is a schematic diagram of the correspondence between the network card queue, CPU, and process in an embodiment of the present application;

[0008] Figure 4 Schematic diagram showing the mapping of application space to the kernel buffer pool.

[0009] Reference numerals:

[0010] 1000, data forwarding agent device; 1001, kernel buffer pool creation module; 1002, kernel buffer pool allocation module; 1003, data message parsing and transmission module; 1004, data message address transmission module; 1005, data message processing module; 1006, data message sending module; 1100, bus; 1200, processor; 1300, memory; 1400, other circuits. DETAILED DESCRIPTION

[0011] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0012] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but merely as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.

[0013] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0014] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.

[0015] It should also be understood that although the present application has been described with reference to certain specific examples, those skilled in the art will readily be able to implement many other equivalent forms of the present application.

[0016] Figure 1 A schematic diagram of a data forwarding proxy method flow diagram of an embodiment of the present application is shown as follows: Figure 1 As shown, the method includes: S101, the network card driver establishes a kernel buffer pool for each network card queue, and establishes a corresponding relationship between the kernel buffer pool, the CPU, and the application; S102, after the network card driver receives a data packet from the network, the data packet is stored in the specified kernel buffer pool space in the kernel buffer pool and reported to the protocol stack; S103, the protocol stack parses and transmits the data packet in the order of the link layer, the network layer, and the transport layer; S104, the protocol stack transmits the specified kernel buffer pool space address to the application, so that the application operates the data packet pointed to by the kernel buffer pool space address; S105, the application performs at least one operation of adding, modifying or deleting the data packet; S106, the application writes the address of the kernel buffer pool space to the kernel and calls the protocol sending function to send the data packet; wherein, the kernel buffer pool is used to allocate a number of kernel buffer pool structures to store data according to the actual length of the data packet, and the several kernel buffer pool structures can form a linked list structure, and the address of the kernel buffer pool space is represented by the address of the linked list structure.

[0017] For ease of understanding, each of the above steps is described separately.

[0018] In the above step S101, the kernel buffer pool (skb pool), CPU, and application establish a corresponding relationship, which can be combined with Figure 3 , Figure 3The figure shows a schematic diagram of the mapping between the kernel buffer pool, CPU, and application. Each queue in a multi-queue NIC RSS is bound to a separate CPU core, which is then bound to a separate process. Each process corresponds to an application. The figure only schematically illustrates the mapping between three NIC queues, three CPU cores, and three processes. It should be noted that the number of NIC queues, CPUs, and applications / processes is not limited to this and can be other values. This mapping between the kernel buffer pool, CPU, and application not only improves performance but also makes it easier for user-mode programs to map the kernel buffer pool.

[0019] Furthermore, the application program in the above step S101 is a user-mode program.

[0020] Since the kernel buffer pool has been created in step S101, the network card driver can receive data through the kernel buffer pool in step S102, thereby replacing the existing request from the slab memory.

[0021] Furthermore, in step S102 , the kernel buffer pool structure puts the kernel buffer pool structure (sk_buf structure) and the fixed-length data together.

[0022] In the above step S103, the protocol stack needs to parse the data message in the order of the data link layer, the network layer, and the transport layer, and transmit the data message upward layer by layer according to the data link layer, the network layer, and the transport layer.

[0023] In the above step S104, the protocol stack transmits the specified kernel buffer pool space address to the application program, so that the application program can operate the data message pointed to by the kernel buffer pool space address. Figure 4 A schematic diagram showing the mapping of application space to the kernel buffer pool is provided for explanation. Figure 4 In the process, each process corresponds to its own network card queue, each network card queue corresponds to its own kernel buffer pool, and the application (i.e. Figure 4 A portion of the space (for each process shown in the figure) is mapped to the kernel's kernel buffer pool, which the application then uses to read directly from the kernel buffer pool. Processes are bound to CPUs and network card queues one by one to avoid multi-core contention for the kernel buffer pool.

[0024] In the above step S104, the application program may operate the actual data pointed to by the kernel buffer through a function.

[0025] In the above step S105, the application performs at least one operation of adding, modifying or deleting the data message through the kernel buffer.

[0026] In step S106, to ensure consistent message size during transmission, the MSS (maximum length of data packets allowed by the TCP protocol) on both the sending and receiving sides of the data packet can be adjusted to accommodate common HTTP proxy modifications. For example, inserting the X-Forwarded-For request header eliminates the need to modify the skb. Note that after the user-mode program sends the skb, it cannot manipulate it. For incomplete skb transmissions, the application must wait for a write event before resending, just like a normal write. For completed skb transmissions, the application performs a delink operation to avoid duplicate transmissions.

[0027] This application modifies the network card driver layer to create a kernel buffer pool for each network card receive and send queue to allow application mapping. This application provides a data forwarding proxy method suitable for a seven-layer protocol stack proxy. By directly reading the data message received by the protocol stack in the user-mode program, the user-mode program adds, deletes, and modifies the data message, and then sends the data message to the protocol stack for forwarding, thereby avoiding memory copying, improving the throughput performance of the seven-layer protocol stack proxy, and shortening the average response delay. In some embodiments, after the network card driver receives the data message from the network, it stores the data message in a designated kernel buffer pool space in the kernel buffer pool, including: after the network card driver receives the data message, it receives the data message to the kernel buffer pool space designated by the kernel buffer pool through direct memory access or copying. In some embodiments, the protocol stack parses and transmits data packets in the order of the data link layer, the network layer, and the transport layer, including: after parsing the data packets in the order of the data link layer, the network layer, and the transport layer, for packets that need to be discarded, the corresponding kernel buffer pool structure space is released to the kernel buffer pool to which it belongs, or for data packets that need to be transmitted locally, it is placed on the socket's receive queue. In some embodiments, the method also includes: the kernel buffer pool merging and fragment reassembly functions of the protocol stack are both disabled. In some embodiments, the method also includes: the protocol stack notifies the other end to send non-fragmented data packets through an ICMP message. Since the protocol stack prohibits the fragment reassembly function, if it is necessary to notify the other end to send the data packet in the form of a non-fragmented data packet, the other end can be notified through an ICMP message, so that the other end sends the data packet in the form of a non-fragmented data packet. In some embodiments, an application performs at least one of adding, modifying, or deleting data packets, including: when the application adds data, allocating a new kernel buffer pool structure from the kernel buffer pool and adding it to the kernel buffer pool linked list; when the application deletes data, deleting the kernel buffer pool structure corresponding to the data; and when the application modifies data, if the length of the modified data exceeds the maximum length of the TCP packet, allocating a new kernel buffer pool structure to store the portion of data that exceeds the maximum length of the TCP packet. In some embodiments, when the application deletes data, deleting the kernel buffer pool structure corresponding to the data includes: deleting the kernel buffer pool structure corresponding to the data through a system call method and releasing the kernel buffer pool structure corresponding to the data to the kernel buffer pool to which it belongs. According to one embodiment of the present application, the present application also provides an electronic device, comprising: a processor and a memory, the memory storing executable instructions, which, when executed by the processor, causes the electronic device to perform any of the above methods.

[0028] In some embodiments, the memory may be a FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories.

[0029] In some embodiments, executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0030] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0031] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.

[0032] In some embodiments, the electronic device can be any electronic device deployed on a network, such as a terminal device or server. Terminal devices may include mobile phones, tablets, laptops, desktop computers, various wearable devices, smart TVs, in-vehicle devices, or other electronic devices capable of performing the aforementioned functions. The server can be a cloud server, an independent physical server, a server cluster composed of multiple physical servers, or a distributed system. The server can also be a node server on a blockchain network.

[0033] The terminal device or server can be directly or indirectly connected to other devices via wired or wireless communication, which is not limited in this application. Optionally, the above-mentioned communication method uses standard communication technology and / or protocols. The Internet is usually the Internet, but it can also be any network, including but not limited to any combination of local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless network, private network or virtual private network. In some embodiments, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged through the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.

[0034] Figure 2 A schematic diagram of the structure of a data forwarding agent device according to an embodiment of the present application is shown in FIG. Figure 2As shown, the device includes: a kernel buffer pool creation module 1001, which is used to enable the network card driver to establish a kernel buffer pool for each network card queue, and to establish a corresponding relationship between the kernel buffer pool, the CPU, and the application; a kernel buffer pool allocation module 1002, which, when the network card driver receives a data packet from the network, stores the data packet in the designated kernel buffer pool space in the kernel buffer pool and reports it to the protocol stack; a data packet parsing and transmission module 1003, which is used to parse and transmit the data packet in the order of the link layer, the network layer, and the transport layer through the protocol stack; a data packet address transmission module 1004, which is used to transmit the data packet through the protocol stack The specified kernel buffer pool space address is transmitted to the application so that the data message pointed to by the kernel buffer pool space address can be operated in the application; the data message processing module 1005 is used to perform at least one of adding, modifying or deleting the data message through the application; the data message sending module 1006 is used to allow the application to write the kernel buffer pool space address to the kernel and call the protocol sending function to send the data message; wherein, the kernel buffer pool is used to allocate a number of kernel buffer pool structures to store data according to the actual length of the data message, and the several kernel buffer pool structures can form a linked list structure, and the address of the kernel buffer pool space is represented by the address of the linked list structure.

[0035] It should be noted that the data forwarding proxy device provided by the present application, and the implementation details of its various modules correspond to the data forwarding proxy method provided by the present application, and will not be repeated here one by one. According to the computer-readable storage medium of at least one embodiment of the present application, the computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, it implements any of the above-mentioned data forwarding proxy methods. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the functions can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.

[0036] In one possible implementation, a computer-readable storage medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium designed to carry or store the desired program code in the form of instructions or data structures and accessible by a computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technology (such as infrared, radio and microwave) is used to transmit software from a website, server or other remote source, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and optical disk as used herein include optical disk, laser disk, optical disk, digital versatile disk (DVD), floppy disk and Blu-ray disk, where disks generally reproduce data magnetically, while optical disks reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media. According to a computer program product of at least one embodiment of the present application, the computer program product includes a computer program, and when the computer program is executed, the computer is caused to execute any of the above-mentioned data forwarding proxy methods.

[0037] Figure 2 An example diagram of a data forwarding proxy device using a hardware implementation of a processing system is shown. The device may include corresponding modules for executing each or several steps in the above flowchart. Therefore, each step or several steps in the above flowchart can be executed by a corresponding module, and the device may include one or more of these modules. The module may be one or more hardware modules specifically configured to execute the corresponding steps, or implemented by a processor configured to execute the corresponding steps, or stored in a computer-readable medium for execution by the processor, or implemented by some combination.

[0038] The hardware structure can be implemented using a bus architecture. The bus architecture can include any number of interconnecting buses and bridges, depending on the specific application and overall design constraints of the hardware. Bus 1100 connects various circuits including one or more processors 1200, memory 1300, and / or hardware modules. Bus 1100 can also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc.

[0039] Bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component Architecture (EISA) bus. Buses can be classified as address buses, data buses, control buses, and the like. For ease of illustration, this figure shows only one connecting line, but this does not imply that there is only one bus or only one type of bus.

[0040] The processor 1200 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or any combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0041] Any process or method description in the flowchart or otherwise described herein can be understood to represent a module, fragment or portion of code including one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which the functions may be performed in a substantially simultaneous manner or in a reverse order according to the functions involved, as will be understood by those skilled in the art to which the embodiments of the present application pertain. The processor performs the various methods and processes described above. For example, the method embodiments in the present application can be implemented as a software program that is tangibly contained in a machine-readable medium, such as a memory. In some embodiments, part or all of the software program can be loaded and / or installed via a memory and / or a communication interface. When the software program is loaded into the memory and executed by the processor, one or more steps in the method described above can be performed. Alternatively, in other embodiments, the processor can be configured to perform one of the above methods in any other appropriate manner (e.g., by means of firmware).

[0042] The logic and / or steps represented in the flowchart or otherwise described herein may be embodied in any readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device).

[0043] For the purposes of this specification, a "readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples (a non-exhaustive list) of readable storage media include the following: an electrical connection having one or more wires (electronic device), a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), a fiber optic device, and a portable read-only memory (CDROM). In addition, the readable storage medium can even be paper or other suitable medium on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in other suitable ways as necessary, and then storing it in a memory.

[0044] It should be understood that various parts of the present application can be implemented using hardware, software, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement the hardware: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0045] Those skilled in the art will understand that all or part of the steps of the above-mentioned implementation method can be accomplished by instructing related hardware through a program, and the program can be stored in a readable storage medium. When the program is executed, it includes one or a combination of the steps of the method implementation method.

[0046] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing module, each unit may exist physically separately, or two or more units may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may also be stored in a readable storage medium. The storage medium may be a read-only memory, a magnetic disk, or an optical disk, etc.

[0047] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present application. In this specification, the schematic representations of the above terms are not necessarily the same embodiment / method or example. Moreover, the specific features, structures, materials or characteristics described may be combined in a suitable manner in any one or more embodiments / methods or examples. In addition, those skilled in the art may combine and combine the different embodiments / methods or examples described in this specification and the features of the different embodiments / methods or examples, unless they are mutually inconsistent.

[0048] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. Throughout the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.

[0049] Those skilled in the art will appreciate that the above embodiments are merely intended to clearly illustrate the present application and are not intended to limit the scope of the present application. Other changes or modifications may be made based on the above disclosure, and such changes or modifications are still within the scope of the present application.

Claims

1. A data forwarding proxy method, characterized in that: The method includes: the network card driver establishes a kernel buffer pool for each network card queue respectively, and establishes a corresponding relationship between the kernel buffer pool, the CPU, and the application; after the network card driver receives a data packet from the network, the data packet is stored in the designated kernel buffer pool space in the kernel buffer pool and reported to the protocol stack; the protocol stack parses and transmits the data packet in the order of the link layer, the network layer, and the transport layer; the protocol stack transmits the designated kernel buffer pool space address to the application so that the application operates the data packet pointed to by the kernel buffer pool space address; the application performs at least one operation of adding, modifying or deleting the data packet; the application writes the address of the kernel buffer pool space to the kernel and calls the protocol sending function to send the data packet; wherein, the kernel buffer pool is used to allocate a number of kernel buffer pool structures to store data according to the actual length of the data packet, and the several kernel buffer pool structures can form a linked list structure, and the address of the kernel buffer pool space is represented by the address of the linked list structure.

2. The proxy method according to claim 1, wherein after receiving the data packet from the network, the network card driver stores the data packet into a designated kernel buffer pool space in the kernel buffer pool, comprising: After receiving the data packet, the network card driver receives the data packet into the kernel buffer pool space specified by the kernel buffer pool through direct memory access or copying.

3. The proxy method according to claim 1, wherein the protocol stack parses and transmits the data message in the order of the link layer, the network layer, and the transport layer, including: After parsing the data message in accordance with the data link layer, network layer, and transport layer in turn, for the message that needs to be discarded, its corresponding kernel buffer pool structure space is released to the kernel buffer pool to which it belongs, or for the data message that needs to be transmitted locally, it is placed on the socket's receive queue.

4. The agent method according to claim 3, further comprising: The kernel buffer pool merging and fragment reassembly functions of the protocol stack are both disabled.

5. The agent method according to claim 4, further comprising: The protocol stack notifies the opposite end to send a non-fragmented data message through an ICMP message.

6. The proxy method according to claim 1, wherein the application performs at least one of adding, modifying, or deleting the data message, comprising: When the application performs an operation of adding data, a new kernel buffer pool structure is allocated from the kernel buffer pool and added to the kernel buffer pool linked list; When the application deletes data, the kernel buffer pool structure corresponding to the data is deleted; when the application modifies data, if the length of the modified data is greater than the maximum length of the TCP message, a new kernel buffer pool structure is allocated to store the data that exceeds the maximum length of the TCP message.

7. The proxy method according to claim 6, wherein when the application performs a data deletion operation, deleting the kernel buffer pool structure corresponding to the data comprises: The kernel buffer pool structure corresponding to the data is deleted through a system call method, and the kernel buffer pool structure corresponding to the data is released to the kernel buffer pool to which it belongs.

8. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores executable instructions, and when the executable instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data forwarding agent method according to any one of claims 1 to 7 is implemented.

10. A computer program product, characterized in that The computer program product includes a computer program, and when the computer program is executed, the computer is caused to execute the data forwarding agent method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data communication method and system

    CN110391999A

  • Data transmission method and device, equipment and storage medium

    CN117215978A