Host network protocol stack soft unloading method and device based on intelligent network card

By replacing the host network protocol stack with the software driver and hardware channel of the smart network card, the flexibility and cost issues of the existing solution are solved, the entire network protocol stack is offloaded, and network transmission performance and iteration speed are improved.

CN121967555APending Publication Date: 2026-05-01YISIXIN TECH (HANGZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YISIXIN TECH (HANGZHOU) CO LTD
Filing Date
2024-10-29
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing host network protocol stack offloading solutions based on smart NICs are inflexible, time-consuming, costly, and cannot achieve offloading of the entire network protocol stack, especially UDP traffic.

Method used

A host network protocol stack soft offloading method based on smart network interface card (NIC) is adopted. User data is transmitted through hardware channels on the host side and smart NIC side via software driver. The native system kernel socket interface of the embedded processor on the smart NIC side is used to replace the host-side network protocol stack to realize data packet encapsulation and stripping processing.

Benefits of technology

It saves host CPU computing resources, reduces network processing pressure, improves network transmission performance, enhances flexibility and iteration speed, reduces costs, and enables the offloading of TCP and UDP traffic, achieving full network protocol stack offloading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121967555A_ABST
    Figure CN121967555A_ABST
Patent Text Reader

Abstract

The invention relates to a host network protocol stack soft unloading method and device based on an intelligent network card. The method comprises the following steps: a software driver transmits user data between a user mode application program at a host side and a native system kernel socket interface in an embedded processor at an intelligent network card side by utilizing a hardware channel at the intelligent network card side based on an inter-process communication mode; a native system kernel socket interface in the embedded processor on the intelligent network card side replaces a native system kernel network protocol stack on the host side based on the native system kernel network protocol stack on the intelligent network card side to achieve the function of the network protocol stack. According to the embodiment of the invention, the network protocol stack function of the host CPU is unloaded by using the hardware channel at the intelligent network card side through the software driver, so that the computing resources of the host CPU are saved, the network processing pressure of the host CPU is reduced, the network transmission performance is improved, and meanwhile, the flexibility of a host network protocol stack unloading scheme and the convenience of deployment and implementation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for soft offloading of host network protocol stack based on a smart network interface card. Background Technology

[0002] User applications running on a host computer need to communicate with the outside world through the host's complete network protocol stack, which consumes a significant amount of host CPU computing resources. Host network protocol stack offloading technology refers to transferring the host CPU's processing tasks for the network protocol stack to other devices, thereby freeing up CPU computing resources and improving network transmission performance. Network protocol stack offloading technology can solve the problems of traditional host network protocol stacks in terms of computing resource consumption and network transmission efficiency.

[0003] In the field of host network protocol stack offloading technology based on smart network interface cards (NICs), various manufacturers have developed different Transmission Control Protocol (TCP) offloading schemes, which can be basically divided into two types: TCP partial offloading and TCP full offloading. TCP partial offloading is provided by the manufacturer using a non-full-featured TCP Offload Engine (TOE) based on hardware logic, while TCP full offloading is provided by the manufacturer using a full-featured TCP protocol stack offloading engine based on hardware logic.

[0004] The aforementioned network protocol stack offloading schemes primarily rely on hardware to offload certain network data processing tasks, essentially using hardware accelerators to accelerate some protocols. While this offers excellent performance, it suffers from lengthy development times, long product iteration cycles, and high sunk costs. Furthermore, the low flexibility of the hardware logic means that the hardware chip cannot meet changing requirements. Additionally, in the hardware accelerator-based TCP protocol stack offloading scheme, the TCP offloading engine can only offload TCP traffic and cannot offload User Datagram Protocol (UDP) traffic, thus failing to achieve full network protocol stack offloading. Summary of the Invention

[0005] In view of this, this disclosure proposes a method and apparatus for soft offloading of host network protocol stack based on smart network interface card.

[0006] According to one aspect of this disclosure, a method for soft offloading of a host network protocol stack based on a smart network interface card is provided, comprising:

[0007] The software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card (NIC) side to transmit user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart NIC side. The software driver includes multiple modules located on the host side and the smart NIC side. The hardware channel includes the hardware channel front-end and hardware channel back-end of the network protocol stack offloading device on the smart NIC side.

[0008] The native system kernel socket interface in the embedded processor on the smart network card side, based on the native system kernel network protocol stack on the smart network card side, replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, encapsulates the user data to be sent, or strips the received network data to obtain the user data.

[0009] In one possible implementation, the software driver includes: a network protocol stack offload socket interface running on the host-side processor, a front-end driver, a back-end driver running on the smart network card-side embedded processor, and a back-end processing module;

[0010] The network protocol stack offloading device is registered to the host system kernel via a semi-virtualized interface by the front-end driver. The network protocol stack offloading device provides the same network protocol stack offloading socket interface as the host operating system's native system kernel socket interface.

[0011] The user-space application sends and receives user data based on the socket interface offloaded from the network protocol stack.

[0012] In one possible implementation, when a user-mode application calls the network protocol stack to offload the socket interface, the software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card side to remotely call the native system kernel socket interface in the embedded processor on the smart network interface card side, including:

[0013] The user-mode application calls the network protocol stack to unload the socket interface and saves the user data to be sent in the host memory.

[0014] The front-end driver delivers the user data to the back-end driver through the hardware channel;

[0015] The backend driver submits the user data to the backend processing module;

[0016] The native system kernel network protocol stack based on the smart network interface card (NIC) replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, including:

[0017] The backend processing module calls the native system kernel socket interface in the embedded processor on the smart network card side to pass user data into the native system kernel network protocol stack;

[0018] The native system kernel network protocol stack adds socket information to user data to encapsulate the user data, and sends the encapsulated data through the network card's transceiver port. The socket information is stored in the backend processing module when the data transmission channel is established.

[0019] In one possible implementation, the front-end driver delivers the user data to the back-end driver through the hardware channel, including:

[0020] The user-mode application fills the address on the host side used to store the user data into the first descriptor and puts the first descriptor into the front-end driver's send queue;

[0021] The front-end driver sends a notification to the hardware channel front-end of the network protocol stack offloading device on the smart network card side.

[0022] The hardware channel front end receives the notification and retrieves the first descriptor from the host-side sending queue;

[0023] The hardware channel front end retrieves the user data from the host memory according to the address pointed to by the first descriptor;

[0024] The hardware channel front end delivers the retrieved user data to the hardware channel back end of the network protocol stack offloading device on the smart network card side.

[0025] The hardware channel backend retrieves a second descriptor from the receiving queue on the smart network card side. The second descriptor describes the address of the free memory on the smart network card side.

[0026] The hardware channel backend stores the user data in the idle buffer on the smart network card side according to the address pointed to by the second descriptor, and interrupts the backend driver processing.

[0027] The backend driver retrieves the user data from the buffer pointed to by the second descriptor.

[0028] In one possible implementation, the native system kernel network protocol stack based on the smart network interface card (NIC) replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, including:

[0029] The native system kernel network protocol stack on the smart network card side strips the network data received by the network card's transceiver port to obtain user data and socket information, and sends the user data and socket information to the backend processing module through the native system kernel socket interface.

[0030] The method of transmitting user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart network card side using the hardware channel includes:

[0031] The backend processing module sends the received user data to the host-side user-mode application through the hardware channel based on the socket information.

[0032] In one possible implementation, the backend processing module sends the received user data to the host-side user-space application via the hardware channel based on the socket information, including:

[0033] The corresponding smart network card side's transmission queue is determined based on the received socket information, and the received user data is sent to the backend driver;

[0034] The backend driver fills the memory information of the user data stored on the network card side into the third descriptor, and puts the third descriptor into the transmission queue on the smart network card side;

[0035] The backend driver sends a notification to the hardware channel backend of the network protocol stack offloading device on the smart network card side.

[0036] The hardware channel backend receives the notification and retrieves the third descriptor from the smart network card's sending queue;

[0037] The hardware channel backend retrieves and saves user data from the host memory based on the address pointed to by the third descriptor.

[0038] The hardware channel front end retrieves a fourth descriptor from the host-side receive queue, the fourth descriptor containing an address pointing to free memory on the host side;

[0039] The hardware channel front end saves the user data to the free memory pointed to by the fourth descriptor according to the address pointed to by the fourth descriptor, and notifies the front end driver to process it.

[0040] The hardware channel front-end driver calls the network protocol stack unload socket interface and returns the call result to the user-mode application through the return value.

[0041] According to another aspect of this disclosure, a host network protocol stack software offloading device based on a smart network interface card is provided, comprising: a software driver and a hardware channel, wherein:

[0042] The software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card (NIC) side to transmit user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart NIC side. The software driver includes multiple modules located on the host side and the smart NIC side. The hardware channel includes the hardware channel front-end and hardware channel back-end of the network protocol stack offloading device on the smart NIC side.

[0043] The native system kernel socket interface in the embedded processor on the smart network card side, based on the native system kernel network protocol stack on the smart network card side, replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, encapsulates the user data to be sent, or strips the received network data to obtain the user data.

[0044] In one possible implementation, the software driver includes: a network protocol stack offload socket interface running on the host-side processor, a front-end driver, a back-end driver running on the smart network card-side embedded processor, and a back-end processing module;

[0045] The network protocol stack offloading device is registered to the host system kernel via a semi-virtualized interface by the front-end driver. The network protocol stack offloading device provides the same network protocol stack offloading socket interface as the host operating system's native system kernel socket interface.

[0046] The user-space application sends and receives user data based on the socket interface offloaded from the network protocol stack.

[0047] According to another aspect of this disclosure, an electronic device is proposed, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the above-described method when executing instructions stored in the memory.

[0048] In this embodiment, when a user-mode application calls the network protocol stack to offload the socket interface, the software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card (NIC) side to remotely call the native system kernel socket interface in the embedded processor on the NIC side. The native system kernel socket interface in the embedded processor on the NIC side calls the native system kernel network protocol stack on the NIC side, replacing the network protocol stack on the host side to implement the network protocol stack's functionality. The software driver resides within both the host and the smart NIC, and the hardware channel includes the front-end and back-end of the network protocol stack offloading device on the NIC side.

[0049] Based on this, this disclosure utilizes a software-driven hardware channel on the smart network interface card (NIC) side to offload the host CPU's network protocol stack, saving host CPU computing resources, reducing the network processing pressure on the host CPU, and improving network transmission performance. Furthermore, compared to traditional hardware-based solutions, this disclosure improves the flexibility and ease of deployment of the host network protocol stack offloading solution, increases version iteration speed, reduces costs, and can offload both TCP and UDP traffic, achieving full network protocol stack offloading.

[0050] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0051] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this disclosure together with the specification and serve to explain the principles of this disclosure.

[0052] Figure 1 A flowchart is shown for a host network protocol stack soft offloading method based on a smart network interface card according to an embodiment of the present disclosure.

[0053] Figure 2 A flowchart illustrating the invocation of the socket interface of the native system on the smart network card side according to an embodiment of the present disclosure is shown.

[0054] Figure 3 This diagram illustrates a flowchart of a front-end driver submitting user data to a back-end driver via a hardware channel according to an embodiment of the present disclosure.

[0055] Figure 4 A flowchart illustrating the reception of a data packet according to an embodiment of the present disclosure is shown.

[0056] Figure 5 A schematic diagram of a transmit / receive queue according to an embodiment of the present disclosure is shown.

[0057] Figure 6 This diagram illustrates the host-side and smart NIC-side structure of an exemplary application scenario according to an embodiment of the present disclosure.

[0058] Figure 7 A flowchart illustrating a host network protocol stack soft offloading based on a smart network interface card (NIC) in an exemplary application scenario according to an embodiment of this disclosure is shown.

[0059] Figure 8 A block diagram of a host network protocol stack soft offloading device based on a smart network interface card according to an embodiment of the present disclosure is shown.

[0060] Figure 9 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation

[0061] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.

[0062] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0063] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.

[0064] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0065] CPU: Central Processing Unit, referred to as processor in this embodiment, is the core of computer system for operation and control, and is the final execution unit for information processing and program execution.

[0066] Socket: A socket is a programming interface used for network communication, which helps to implement data transmission between different hosts. The socket interface is provided by the operating system kernel and resides in the operating system's network protocol stack.

[0067] Paravirtualization: Paravirtualization is a type of virtualization technology that improves virtualization performance and efficiency by modifying the interaction between virtualization software and the virtual machine operating system. Compared to full virtualization, paravirtualization requires certain modifications to the virtual machine operating system.

[0068] Virtio: A paravirtualization technology used for communication and protocol conversion between virtual machines and the host machine. In traditional virtual machine scenarios, the devices associated with the virtual machine are simulated by the host machine's hypervisor. With the rise of smart network interface cards (NICs), some smart NICs directly provide hardware-based virtio devices. The virtio device used in the exemplary application scenario of Embodiment 1 of this disclosure can be a hardware virtio device.

[0069] Ioctl (input / output control): ioctl is a system call used to pass control commands between user space and kernel space. In operating systems, accessing hardware devices from user space typically requires system calls. ioctl can also be used for inter-process communication. In Linux, ioctl can be used with pipes, sockets, and other communication methods to pass control information between processes.

[0070] Doorbell: A doorbell is a mechanism used to notify hardware devices that there are new commands or data to process. It is typically used by software drivers or operating systems for communication and synchronization with hardware devices. In communication between hardware and software, the doorbell is usually a special type of register.

[0071] User applications running on a host computer need to communicate with the outside world through the host's complete network protocol stack. However, sending and receiving data packets via this stack consumes significant amounts of host CPU resources. Conserving host CPU resources requires host network protocol stack offloading technology. Existing host protocol offloading solutions based on smart network interface cards (NICs) accelerate only some protocols using hardware accelerators. These solutions suffer from low flexibility, long development times, long product iteration cycles, high sunk costs, and cannot achieve complete offloading of the network protocol stack.

[0072] Based on this, this disclosure provides a method for soft unloading of the host network protocol stack based on a smart network interface card (NIC). This disclosure utilizes software drivers in the host and the smart NIC to unload the host processor's network protocol stack-related tasks via a hardware channel, saving the host processor's computing resources, reducing the network processing load on the host processor, and improving network transmission performance. Furthermore, compared to traditional hardware-based solutions, this disclosure improves the flexibility of the host network protocol stack unloading scheme, increases version iteration speed and deployment convenience, reduces costs, and can unload both TCP and UDP traffic, achieving full network protocol stack unloading.

[0073] The methods and apparatus provided in this disclosure are based on smart network interface cards (NICs). The smart NIC may be equipped with an embedded processor running an operating system. This disclosure does not limit the specific types of processors and operating systems on the host computer or embedded processors and operating systems on the smart NIC.

[0074] Figure 1 A flowchart illustrating a host network protocol stack soft offloading method based on a smart network interface card (NIC) according to an embodiment of this disclosure is shown. Figure 1 As shown, the method may include:

[0075] Step S10, software-driven, based on inter-process communication, utilizes the hardware channel on the smart NIC side to transmit user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart NIC side. The software driver includes multiple modules located on the host side and the smart NIC side. The hardware channel includes the hardware channel front-end and hardware channel back-end of the network protocol stack offloading device on the smart NIC side.

[0076] Step S20: The native system kernel socket interface in the embedded processor on the smart network card side, based on the native system kernel network protocol stack on the smart network card side, replaces the native system kernel network protocol stack on the host side to implement the function of the network protocol stack, encapsulates the user data to be sent, or strips the received network data to obtain the user data.

[0077] In this embodiment, the network protocol stack of the host CPU can be offloaded via inter-process communication. According to the method provided in this embodiment, a user-mode application on the host can indirectly interact remotely with the embedded processor of the smart network interface card (NIC) via inter-process communication. Specifically, when the user-mode application calls to offload the socket interface from the network protocol stack, the software driver calls the native system kernel socket interface of the embedded CPU operating system of the smart NIC through a hardware channel. Furthermore, the native system kernel socket interface in the embedded processor on the smart NIC side, based on the native system kernel network protocol stack on the smart NIC side, replaces the native system kernel network protocol stack on the host side to implement the network protocol stack function. In this way, this embodiment releases the computing resources of the host CPU, improves network transmission performance, and by using software to call the native system kernel socket interface (socket interface) of the embedded CPU through the hardware channel on the smart NIC side, it improves the flexibility of the host network protocol stack offload scheme, increases iteration speed, reduces costs, and achieves full network protocol stack offload.

[0078] In one possible implementation, the software driver includes: a network protocol stack offload socket interface running on the host-side processor, a front-end driver, a back-end driver running on the smart network card-side embedded processor, and a back-end processing module;

[0079] The network protocol stack offloading device is registered to the host system kernel via a semi-virtualized interface by the front-end driver. The network protocol stack offloading device provides the same network protocol stack offloading socket interface as the host operating system's native system kernel socket interface. The user-mode application sends and receives user data based on the network protocol stack offloading socket interface.

[0080] This disclosure provides a software driver package for network protocol stack offloading, including: a front-end driver running on a host-side processor, which can be used to register the network protocol stack offloading device in the host system kernel and can also be used to interact with the front-end of the smart network interface card (NIC) hardware channel; a network protocol offloading socket interface running on the host, provided by the network protocol stack offloading device; a back-end driver running on the smart NIC, which can be used to operate the back-end of the smart NIC hardware channel; and a back-end processing module running on the smart NIC, which can be used to call the socket interface of the native system of the embedded processor of the smart NIC.

[0081] Furthermore, embodiments of this disclosure may provide a hardware channel for network protocol stack offloading, including: a hardware channel front-end and a hardware channel back-end of a network protocol stack offloading device on the smart network interface card side.

[0082] To free up host CPU computing resources and improve network transmission performance, this embodiment of the disclosure can register the hardware channel front-end of the smart network interface card (NIC) side with the host native system kernel using semi-virtualization technology, registering it as the network protocol stack offloading device. In some specific embodiments, the front-end driver of this embodiment can register the hardware channel front-end of the smart NIC side network protocol stack offloading device with the host native system kernel using semi-virtualization technology. The semi-virtualization technology can involve Virtio, Xen, VMware Paravirtualization, etc. This embodiment of the disclosure does not limit the specific implementation method of registering the device with the host native system kernel using virtualization technology. In one specific embodiment, the front-end driver of this embodiment can register the hardware channel front-end of the smart NIC side network protocol stack offloading device with the host system kernel through a semi-virtualization interface. In this way, the host kernel registers the hardware channel as a virtualized device, which, compared to traditional hardware solutions, improves the flexibility of the host network protocol stack offloading solution, increases iteration speed, and reduces costs.

[0083] In this embodiment, the network protocol stack offloading device registered to the host system kernel can provide a network protocol stack offloading socket interface that is identical to the host native system socket interface. For example, the host native system socket interface may include: socket(), bind(), connect(), send(), recv(), setsockopt(), etc. This embodiment does not limit the specific types of socket interfaces involved or the specific functions of the network protocol stack to be implemented. The network protocol stack offloading socket interface described in this embodiment can provide an interface with the same functions as the aforementioned host native system socket. Furthermore, user-space applications can initiate various requests through the network protocol stack offloading socket interface with the same functions as the host native system socket. In this way, user-space applications are unaware of the subsequent software driver invocation process. Furthermore, the socket interface of the smart NIC-side native system can call the smart NIC-side native system kernel network protocol stack to replace the host-side native system kernel network protocol stack in implementing the network protocol stack functions.

[0084] For example, in this embodiment of the disclosure, the user-space application can call the host's native system kernel socket interface to send packets through the host network protocol stack. It should be noted that the host network protocol stack sends not only packets but also other information. The interfaces called by the host network protocol stack may include:

[0085] 1. `socket()`: Creates a new socket. 2. `bind()`: Binds a socket to an address (IP address and port number). 3. `listen()`: Sets a socket to listen, waiting for client connection requests. 4. `accept()`: Accepts a client's connection request and creates a new socket for communication with that client. 5. `connect()`: Establishes a connection with another socket. 6. `send()`: Sends data to a connected socket. 7. `recv()`: Receives data from a connected socket. 8. `close()`: Closes a socket. 9. `select()`: Used for multiplexing, allowing monitoring of multiple sockets to determine which sockets have data available for reading or writing. 10. `setsockopt()`: Sets socket options, such as timeout and buffer size. 11. `getsockopt()`: Retrieves the values ​​of socket options. 12. `shutdown()`: Closes one or two communication paths of a connected socket.

[0086] Some of the interfaces mentioned above include messages, while others do not. This application does not impose any restrictions on this.

[0087] In specific embodiments of this disclosure, when a user-space application needs to send a message, it can call the network protocol stack offload socket interface. The data to be sent does not need to be processed by the host network protocol stack; instead, it can be directly passed to the network protocol stack offload driver. The driver then sends the data to the embedded CPU on the smart network card via a hardware channel, where the embedded CPU calls its native system kernel network protocol stack for processing. In this way, embodiments of this disclosure free up the host CPU's computing resources, improve network transmission performance, increase the flexibility of the host network protocol stack offload scheme, accelerate iteration, reduce costs, and achieve full network protocol stack offload.

[0088] In this embodiment, the network protocol stack offloading method can be based on network programming using sockets. For user-space applications, the solution in this embodiment is more layer-wise in the network protocol stack, where the underlying network traffic can be either TCP or UDP. Therefore, this embodiment can offload both TCP and UDP traffic, achieving full network protocol stack offloading.

[0089] Figure 2 A flowchart illustrating the invocation of the socket interface of the native system on the smart network card side according to an embodiment of the present disclosure is shown.

[0090] like Figure 2 As shown, the process of calling the socket interface of the native system on the smart network card side may include:

[0091] In step S11, the user-mode application calls the network protocol stack to unload the socket interface and saves the user data to be sent in memory.

[0092] In this embodiment of the disclosure, the network protocol offload socket interface can be functionally and behaviorally identical to the socket interface provided by the host's native system. The user data may include data packets. In the application scenario of sending data packets according to this embodiment of the disclosure, the user-mode application can initiate a request to the network protocol stack offload device through the network protocol offload socket interface, and enter kernel mode through a system call via the network protocol offload socket interface, storing the user data to be sent in memory.

[0093] In step S12, the front-end driver delivers the user data to the back-end driver through the hardware channel.

[0094] In this embodiment of the disclosure, the front-end driver located on the host side can deliver socket call information and user data to the back-end driver located on the smart network interface card side through the hardware channel.

[0095] Step S13: The backend driver submits the user data to the backend processing module.

[0096] Step S21: The backend processing module calls the native system kernel socket interface in the embedded processor on the smart network card side to pass the user data into the native system kernel network protocol stack.

[0097] Step S22: The native system kernel network protocol stack adds socket information to the user data to encapsulate the user data, and sends the encapsulated data through the network card transceiver port. The socket information is stored in the backend processing module when the data transmission channel is established.

[0098] Figure 3 This diagram illustrates a flowchart of a front-end driver submitting user data to a back-end driver via a hardware channel according to an embodiment of the present disclosure. Figure 3 As shown, the process by which the front-end driver submits the user data to the back-end driver through the hardware channel may include:

[0099] In step S1201, the user-mode application fills the address on the host side used to store the user data into the first descriptor and puts the first descriptor into the send queue of the front-end driver.

[0100] Figure 5 A schematic diagram of a transmit / receive queue according to an embodiment of the present disclosure is shown.

[0101] like Figure 5 As shown in the embodiments of this disclosure, in the transmit queue, the pointer contained in the first descriptor can point to the data that the driver wants to send, such as user data. In the receive queue, the pointer contained in the second descriptor can point to a free buffer. In a specific embodiment, the descriptors pointing to the free buffer can be organized by the front-end or back-end driver. When there is data to be received on the hardware channel, the hardware can fill the data into the free buffer and then notify the driver to process it via an interrupt. The embodiments of this disclosure do not limit the specific way in which the driver organizes the descriptors.

[0102] In this embodiment, the front-end driver adds the first descriptor to the host-side transmission queue when data needs to be sent, and the smart network interface card (NIC) adds the second descriptor to the smart NIC-side reception queue when receiving data. The transmission and reception queues can queue and schedule network data packets to avoid congestion during transmission and achieve optimal performance. In this way, this embodiment reduces the CPU load, frees up the host CPU's computing resources, and improves network transmission performance.

[0103] In step S1202, the front-end driver sends a notification to the hardware channel front-end of the network protocol stack offloading device on the smart network card side.

[0104] In one specific embodiment of this disclosure, the front-end driver knocks a doorbell and sends a notification to the hardware channel front-end of the network protocol stack offloading device on the smart network card side.

[0105] In step S1203, the hardware channel front end receives the notification and retrieves the first descriptor from the host-side sending queue.

[0106] The aforementioned Direct Memory Access Mapping (DMAmapping) enables the hardware front-end of the network protocol stack offloading device on the smart network interface card (NIC) side to directly access main memory without interfering with the CPU, and without further CPU intervention. In this way, the embodiments of this disclosure reduce the CPU load, free up the host CPU's computing resources, and improve network transmission performance.

[0107] In step S1204, the hardware channel front end retrieves the user data from the host memory according to the address pointed to by the first descriptor.

[0108] In step S1205, the hardware channel front end delivers the retrieved user data to the hardware channel back end of the network protocol stack offloading device on the smart network card side.

[0109] In step S1206, the hardware channel backend retrieves a second descriptor from the receiving queue on the smart network card side. The second descriptor describes the address of the free memory on the smart network card side.

[0110] In step S1207, the hardware channel backend stores the user data in the idle buffer on the smart network card side according to the address pointed to by the second descriptor, and interrupts the backend driver processing.

[0111] In step S1208, the backend driver retrieves the user data from the buffer pointed to by the second descriptor.

[0112] In one possible implementation, the native system kernel network protocol stack on the smart NIC side replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack. This includes: the native system kernel network protocol stack on the smart NIC side stripping the network data received by the NIC's transceiver port to obtain user data and socket information, and sending the user data and socket information to the backend processing module through the native system kernel socket interface; the step of using the hardware channel on the smart NIC side to transmit user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart NIC side includes: the backend processing module sending the received user data to the user-mode application on the host side through the hardware channel according to the socket information.

[0113] Figure 4 A flowchart illustrating the reception of a data packet according to an embodiment of the present disclosure is shown. Figure 4 As shown, the backend processing module sends the received user data to the host-side user-space application through the hardware channel based on the socket information, including:

[0114] In step S301, the backend processing module determines the corresponding smart network card side's transmission queue based on the received socket information and sends the received user data to the backend driver.

[0115] In step S302, the backend driver fills the memory information of the user data stored on the network card side into the third descriptor, and puts the third descriptor into the transmission queue on the smart network card side.

[0116] The third descriptor contains a pointer to the address of the user data stored on the network card side.

[0117] In step S303, the backend driver adds the third descriptor to the smart network card side transmit queue and adds the fourth descriptor to the host side receive queue.

[0118] Step S304: The backend driver sends a notification to the hardware channel backend of the network protocol stack offloading device on the smart network card side.

[0119] In step S305, the hardware channel backend receives the notification and retrieves the third descriptor from the sending queue on the smart network card side.

[0120] In step S306, the hardware channel backend retrieves and saves user data from the host memory based on the address pointed to by the third descriptor.

[0121] Step S307: The hardware channel front end retrieves the fourth descriptor from the host-side receive queue.

[0122] The fourth descriptor contains an address pointing to free memory on the host side.

[0123] In step S308, the hardware channel front end saves the user data to the free memory pointed to by the fourth descriptor according to the address pointed to by the fourth descriptor, and notifies the front end driver to process it.

[0124] In step S309, the hardware channel front-end driver calls the network protocol stack unload socket interface and returns the call result to the user-mode application through the return value.

[0125] In this way, the network protocol stack of the embedded CPU of the smart network card can replace the host-side native system kernel network protocol stack to complete the task of receiving data packets, thereby freeing up the computing resources of the host CPU, improving network transmission performance, increasing the flexibility of the host network protocol stack offloading scheme, improving iteration speed, reducing costs, and realizing the offloading of the entire network protocol stack.

[0126] The following example illustrates an exemplary application scenario of this disclosure, using the scenario of host protocol stack offloading based on Virtio derivative devices as an example.

[0127] Figure 6 This diagram illustrates the host-side and smart network interface card (NIC) side architectures of an exemplary application scenario according to embodiments of this disclosure. Figure 6 As shown, the smart network interface card (NIC) side of the exemplary application scenario may include:

[0128] The smart NIC side presents a PCIe Virtio hardware channel, including a Virtio network protocol stack offloading front-end device and a Virtio network protocol stack offloading back-end device, corresponding to the hardware channel front-end and back-end of the network protocol stack offloading on the smart NIC side described in this specification. The PCIe Virtio hardware channel of the network protocol stack offloading device on the smart NIC side is a Virtio variant device, and its data interaction design follows the Split Queue in the Virtio standard protocol. Because this device type does not belong to any device specified in the Virtio protocol, when the device driver registers with the kernel, its interfaces are all custom interfaces. However, the interfaces for queue interaction or data interaction between this device and other devices can conform to the Virtio standard protocol.

[0129] like Figure 6 As shown, the host side of the exemplary application scenario may include:

[0130] The network protocol stack offloading device front-end driver can register the hardware channel front-end device of the Virtio network protocol stack offloading device located on the smart network interface card as a network protocol stack offloading device in the kernel. This network protocol stack offloading device provides a network protocol stack offloading socket interface that is functionally and behaviorally identical to the host's native Linux system kernel socket. Furthermore, user-space applications can invoke the network protocol stack offloading socket interface to initiate various requests to the network protocol stack offloading device front-end driver.

[0131] In an exemplary application scenario of this disclosure, the software driver package for network protocol stack offloading may include: a network protocol stack offloading device front-end driver running on the host, which can be used to register the network protocol stack offloading device in the host system kernel and can also be used to interact with the hardware channel front-end of the smart network card; a network protocol offloading socket running on the host, provided by the network protocol stack offloading device; a network protocol stack offloading device back-end driver running on the smart network card, which can be used to operate the hardware channel back-end of the smart network card; and a network protocol stack offloading back-end processing module running on the smart network card, which can be used to call the socket interface of the native system kernel of the embedded processor of the smart network card.

[0132] For example, user-space applications can call socket interface functions of the host's native Linux system kernel, such as socket(), bind(), connect(), send(), and receive(), to send packets through the host network protocol stack. When a user-space application wants to send data, it sends the data to the host network protocol stack through functions such as send(). The data then undergoes multiple layers of protocol processing to form the corresponding packet header, and finally the driver sends the packet to the hardware.

[0133] In an exemplary application scenario of this disclosure, when a user-space application needs to send a message, it can call the network protocol stack offload socket interface. In this case, the data to be sent does not need to be processed by the host Linux system network protocol stack; instead, it can be directly passed to the network protocol stack offload device front-end driver. The network protocol stack offload device front-end driver then sends the data to the network protocol stack offload device back-end driver on the smart network interface card (NIC) via a hardware channel. The network protocol stack offload back-end processing module then calls its native system kernel network protocol stack socket for processing. Furthermore, the native system kernel socket interface on the smart NIC side can call the native system kernel network protocol stack on the smart NIC side, replacing the host-side native system kernel network protocol stack to implement the functions of the network protocol stack.

[0134] In an exemplary application scenario of this disclosure, the operation of the kernel-mode network protocol stack unloading device front-end driver by the user-mode application through the network protocol stack unloading socket interface is implemented as an ioctl. That is, when a user-mode application calls the network protocol stack unloading socket interface, the network protocol stack unloading socket interface can encapsulate the function name, function parameters, data buffer, and other related information called by the user-mode application in a data structure, and pass it to the kernel network protocol stack unloading device front-end driver through the ioctl system call. Subsequently, the kernel driver passes the call information of the user-mode application to the network protocol stack unloading device back-end driver of the smart network card.

[0135] Figure 7 A flowchart illustrating a host network protocol stack soft offloading based on a smart network interface card (NIC) in an exemplary application scenario according to an embodiment of this disclosure is shown.

[0136] like Figure 7 As shown, the process of soft offloading the host network protocol stack based on the smart network card in the exemplary application scenario may include:

[0137] Step 1: The user-space application calls the network protocol stack to unload the socket interface, saves the user data to be sent in the host memory, and then fills in the descriptor (first descriptor) containing information such as the data memory address.

[0138] The network protocol offloaded socket interface is functionally and behaviorally identical to the socket interface provided by the host's native Linux system. User-space applications can use the network protocol offloaded socket interface to make system calls to enter kernel mode and store the user data to be sent in memory.

[0139] Step 2: The user-space program populates the descriptor and puts it into the send queue.

[0140] Step 3: The user-space program notifies the network card hardware.

[0141] User-space programs notify the network interface card (NIC) hardware via a "doorbell" mechanism, indicating that data needs to be sent. This "doorbell" is a signal or interrupt used to wake up the NIC hardware and start it working.

[0142] Step 4: The network card-side hardware channel front end retrieves the descriptor from the transmit queue.

[0143] The network card hardware responds to the doorbell signal by retrieving a first descriptor from the host's transmit queue.

[0144] Step 5: The network card side hardware channel front end acquires user data.

[0145] The network card-side hardware channel front end retrieves data from the memory area of ​​the user-mode program based on the information in the first descriptor.

[0146] Step 6: Obtain an idle descriptor from the hardware channel backend on the network card side.

[0147] The network interface card (NIC) hardware channel backend retrieves a second descriptor from the NIC's receive queue. The second descriptor describes the available free memory space on the NIC side.

[0148] Step 7: The network card-side hardware channel backend writes user data into the embedded system memory.

[0149] The network card hardware writes the acquired user data into the embedded system memory space described by the third descriptor.

[0150] Step 8: The network card-side hardware channel backend notifies the embedded system.

[0151] The smart network card hardware notifies the embedded Linux system via an interrupt that user data is ready for further processing.

[0152] Step 9: The embedded system retrieves the data.

[0153] In an embedded system, the network protocol stack unloads the backend driver and retrieves the prepared user data.

[0154] Step 10: The backend driver sends the data to the network protocol stack to unload the backend processing module.

[0155] The network protocol stack unloaded backend driver sends data to the network protocol stack unloaded backend processing module, which is responsible for further processing the data.

[0156] Step 11: Add socket information to the backend processing module.

[0157] The backend processing module adds socket information to the data; this information was already stored in the backend processing module when the channel was established.

[0158] Step 12: The backend processing module passes the data to the native system kernel network protocol stack.

[0159] Data with added socket information is passed to the native system kernel socket interface and then enters the native system kernel network protocol stack for standard packet processing.

[0160] Step 13: The native system kernel network protocol stack sends the packetized data to the network card's transceiver port.

[0161] The data, after being processed by the kernel protocol stack, is sent to the transmit / receive port on the network card side, ready for transmission.

[0162] Step 14: The network card's sending port sends data to the network.

[0163] The network card's transmit port sends data from the transmit / receive port to the network, completing the entire transmission process.

[0164] Steps 15-26 describe the process of receiving data packets, which specifically includes:

[0165] Step 15: The network card's transceiver port receives network data.

[0166] When data is sent to this device from an external network, it is first received by the transceiver port of the smart network interface card (NIC). As a network interface device, the NIC's transceiver port is responsible for listening to and capturing data packets on the network. Once a data packet is received, the NIC performs preliminary processing, such as verifying the integrity and correctness of the data packet, and then prepares to pass this data to the upper-layer protocol stack for processing.

[0167] Step 16: The network card's transceiver port sends data to the kernel protocol stack.

[0168] After receiving data, the network interface card (NIC) transmit / receive ports will pass the data to the native system kernel network protocol stack on the smart NIC side. The kernel protocol stack will further process the data, such as parsing the header information of the data packets and performing appropriate processing according to the protocol type (such as TCP / IP).

[0169] Step 17: Strip the network header from the native system kernel network protocol stack to obtain the data and socket information.

[0170] During the kernel protocol stack's processing of data packets, it first strips the network header information (such as the IP header and TCP header) to obtain the actual transmitted data and the socket information associated with that data. Socket information is a crucial component of network communication; it contains information such as the addresses and port numbers of both communicating parties and forms the basis for establishing and maintaining network communication connections.

[0171] Step 18: The native system kernel network protocol stack sends data and socket information to the native system kernel socket interface.

[0172] After stripping the network header information, the kernel protocol stack will pass the obtained data and socket information to the native system kernel socket interface.

[0173] Step 19: The native system kernel socket interface determines the sending queue on the smart network card side based on the obtained socket information and the pre-stored socket information, and sends the data to the backend driver.

[0174] After receiving data and socket information, the native system kernel socket interface determines the target location to which the data should be sent. This target location is the send queue on the smart network interface card side. Therefore, the native system kernel socket interface queries the pre-stored socket information (this information was stored when the data transmission channel was established), finds the send queue that matches the received socket information, and sends the data to the backend driver.

[0175] Step 20: The backend driver fills the memory information of the received data into the third descriptor.

[0176] After receiving data, the backend driver fills the third descriptor with the memory information of this data (such as the starting address and length of the data). The third descriptor is a data structure used to describe the storage location of the data after the glass socket information in the memory on the network card side.

[0177] Step 21: The backend driver puts the filled third descriptor into the send queue on the smart network card side.

[0178] After the third descriptor is filled, the backend driver places it into the transmit queue on the smart network interface card (NIC) side. The transmit queue is a queue used to store data to be transmitted, and it schedules and transmits data according to the first-in, first-out (FIFO) principle.

[0179] Step 22: The backend driver notifies the network card side hardware channel backend to retrieve the descriptor.

[0180] To notify the network interface card (NIC) hardware backend that there is data to process, the backend driver sends a "doorbell" signal to the NIC. The doorbell signal is a special mechanism used for communication and synchronization between hardware and software. By sending the doorbell signal, the backend driver ensures that the NIC hardware backend can promptly receive and process new data.

[0181] Step 23: Remove the third descriptor from the back end of the hardware channel on the network card side.

[0182] Upon receiving the doorbell signal, the smart network interface card (NIC) hardware begins processing the data in the transmission queue. The NIC-side hardware channel backend retrieves the third descriptor from the queue.

[0183] Step 24: The network card-side hardware channel backend retrieves user data based on the third descriptor.

[0184] After retrieving the third descriptor, the smart network interface card (NIC) hardware retrieves the corresponding user data based on the memory information in the descriptor. This data is the raw data received from the network, processed by the kernel protocol stack to obtain the actual data.

[0185] Step 25: The network card hardware channel front end retrieves the fourth descriptor from the host-side receive queue.

[0186] After acquiring the data, the smart network interface card (NIC) needs to send the data back to the user-space application on the host side. At this time, the NIC hardware channel front-end retrieves a data structure called the fourth descriptor from the host-side receive queue. The fourth descriptor describes information such as the location and size of free memory on the host side. By retrieving the fourth descriptor, the smart NIC can ensure that the data is transmitted to the correct location on the host side.

[0187] Step 26: The hardware channel front end saves the user data to the free memory pointed to by the fourth descriptor according to the address pointed to by the fourth descriptor, and notifies the front end driver to process it.

[0188] After the data is saved to the memory area pointed to by the fourth descriptor, the hardware channel front end will notify the front end driver through some mechanism (such as interrupt, signal, etc.) that the data is ready and can be further processed by the front end driver or passed to the user-mode application.

[0189] After receiving a notification from the hardware channel frontend, the frontend driver will execute the corresponding processing logic. For example, it can retrieve data from the buffer pointed to by the fourth descriptor and then pass the data to the network protocol stack to unload the socket interface or return it directly to the user-space application.

[0190] User-space applications can receive this data by calling the corresponding functions or methods provided by the socket interface offloading from the network protocol stack.

[0191] Figure 8 A block diagram of a host network protocol stack soft unloading device based on a smart network interface card (NIC) according to an embodiment of the present disclosure is shown. As shown, the host network protocol stack soft unloading device 40 based on a smart NIC may include:

[0192] Software driver 41 and hardware channel 42, wherein:

[0193] The software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card (NIC) side to transmit user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart NIC side. The software driver includes multiple modules located on the host side and the smart NIC side. The hardware channel includes the hardware channel front-end and hardware channel back-end of the network protocol stack offloading device on the smart NIC side.

[0194] The native system kernel socket interface in the embedded processor on the smart network card side, based on the native system kernel network protocol stack on the smart network card side, replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, encapsulates the user data to be sent, or strips the received network data to obtain the user data.

[0195] The software driver includes: a network protocol stack offload socket interface running on the host-side processor, a front-end driver, a back-end driver running on the embedded processor on the smart network card side, and a back-end processing module;

[0196] The network protocol stack offloading device is registered to the host system kernel via a semi-virtualized interface by the front-end driver. The network protocol stack offloading device provides the same network protocol stack offloading socket interface as the host operating system's native system kernel socket interface.

[0197] The user-space application sends and receives user data based on the socket interface offloaded from the network protocol stack.

[0198] In one possible implementation, when a user-mode application calls the network protocol stack to offload the socket interface, the software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card side to remotely call the native system kernel socket interface in the embedded processor on the smart network interface card side, including:

[0199] The user-mode application calls the network protocol stack to unload the socket interface and saves the user data to be sent in the host memory.

[0200] The front-end driver delivers the user data to the back-end driver through the hardware channel;

[0201] The backend driver submits the user data to the backend processing module;

[0202] The native system kernel network protocol stack based on the smart network interface card (NIC) replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, including:

[0203] The backend processing module calls the native system kernel socket interface in the embedded processor on the smart network card side to pass user data into the native system kernel network protocol stack;

[0204] The native system kernel network protocol stack adds socket information to user data to encapsulate the user data, and sends the encapsulated data through the network card's transceiver port. The socket information is stored in the backend processing module when the data transmission channel is established.

[0205] In one possible implementation, the front-end driver delivers the user data to the back-end driver through the hardware channel, including:

[0206] The user-mode application fills the address on the host side used to store the user data into the first descriptor and puts the first descriptor into the front-end driver's send queue;

[0207] The front-end driver sends a notification to the hardware channel front-end of the network protocol stack offloading device on the smart network card side.

[0208] The hardware channel front end receives the notification and retrieves the first descriptor from the host-side sending queue;

[0209] The hardware channel front end retrieves the user data from the host memory according to the address pointed to by the first descriptor;

[0210] The hardware channel front end delivers the retrieved user data to the hardware channel back end of the network protocol stack offloading device on the smart network card side.

[0211] The hardware channel backend retrieves a second descriptor from the receiving queue on the smart network card side. The second descriptor describes the address of the free memory on the smart network card side.

[0212] The hardware channel backend stores the user data in the idle buffer on the smart network card side according to the address pointed to by the second descriptor, and interrupts the backend driver processing.

[0213] The backend driver retrieves the user data from the buffer pointed to by the second descriptor.

[0214] In one possible implementation, the native system kernel network protocol stack on the smart network card side strips the network data received by the network card's transceiver port to obtain user data and socket information, and sends the user data and socket information to the backend processing module through the native system kernel socket interface.

[0215] The method of transmitting user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart network card side using the hardware channel includes:

[0216] The backend processing module sends the received user data to the host-side user-mode application through the hardware channel based on the socket information.

[0217] In one possible implementation, the backend processing module determines the corresponding smart network card side's transmission queue based on the received socket information and sends the received user data to the backend driver.

[0218] The backend driver fills the memory information of the user data stored on the network card side into the third descriptor, and puts the third descriptor into the transmission queue on the smart network card side;

[0219] The backend driver sends a notification to the hardware channel backend of the network protocol stack offloading device on the smart network card side.

[0220] The hardware channel backend receives the notification and retrieves the third descriptor from the smart network card's sending queue;

[0221] The hardware channel backend retrieves and saves user data from the host memory based on the address pointed to by the third descriptor.

[0222] The hardware channel front end retrieves a fourth descriptor from the host-side receive queue, the fourth descriptor containing an address pointing to free memory on the host side;

[0223] The hardware channel front end saves the user data to the free memory pointed to by the fourth descriptor according to the address pointed to by the fourth descriptor, and notifies the front end driver to process it.

[0224] The hardware channel front-end driver calls the network protocol stack unload socket interface and returns the call result to the user-mode application through the return value.

[0225] An electronic device is provided according to an embodiment of the present disclosure, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0226] For specific embodiments of the above-mentioned devices and electronic equipment, please refer to the Methods section.

[0227] For example, electronic devices can also be user equipment (UE), mobile devices, user terminals, terminals, handheld devices, computing devices, or in-vehicle devices, etc. Examples of terminals include: displays, smartphones or portable devices, mobile phones, tablets, laptops, PDAs, mobile internet devices (MID), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, wireless terminals in vehicle-to-everything (V2X) networks, etc.

[0228] Figure 9 This is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, device 1900 may be provided as a server or terminal device. See also... Figure 9 The apparatus 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.

[0229] Device 1900 may also include a power supply component 1926 configured to perform power management of device 1900, a wired or wireless network interface 1950 configured to connect device 1900 to a network, and an input / output interface 1958 (I / O interface). Device 1900 can operate on an operating system, such as Windows Server, stored in memory 1932. TM macOS X TM Unix TM Linux TM FreeBSD TM Or similar.

[0230] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by a processing component 1922 of the device 1900 to perform the above-described method.

[0231] The above description is merely an exemplary embodiment of the present invention and is not intended to limit the scope of protection of the present invention, which is determined by the appended claims.

[0232] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0233] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0234] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0235] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for soft offloading of host network protocol stack based on smart network interface card, characterized in that, include: The software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card (NIC) side to transmit user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart NIC side. The software driver includes multiple modules located on the host side and the smart NIC side. The hardware channel includes the hardware channel front-end and hardware channel back-end of the network protocol stack offloading device on the smart NIC side. The native system kernel socket interface in the embedded processor on the smart network card side, based on the native system kernel network protocol stack on the smart network card side, replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, encapsulates the user data to be sent, or strips the received network data to obtain the user data.

2. The method according to claim 1, characterized in that, The software driver includes: a network protocol stack offload socket interface running on the host-side processor, a front-end driver, a back-end driver running on the embedded processor on the smart network card side, and a back-end processing module; The network protocol stack offloading device is registered to the host system kernel via a semi-virtualized interface by the front-end driver. The network protocol stack offloading device provides the same network protocol stack offloading socket interface as the host operating system's native system kernel socket interface. The user-space application sends and receives user data based on the socket interface offloaded from the network protocol stack.

3. The method according to claim 2, characterized in that, When a user-mode application calls the network protocol stack to offload the socket interface, the software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card side to remotely call the native system kernel socket interface in the embedded processor on the smart network interface card side, including: The user-mode application calls the network protocol stack to unload the socket interface and saves the user data to be sent in the host memory. The front-end driver delivers the user data to the back-end driver through the hardware channel; The backend driver submits the user data to the backend processing module; The native system kernel network protocol stack based on the smart network interface card (NIC) replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, including: The backend processing module calls the native system kernel socket interface in the embedded processor on the smart network card side to pass user data into the native system kernel network protocol stack; The native system kernel network protocol stack adds socket information to user data to encapsulate the user data, and sends the encapsulated data through the network card's transceiver port. The socket information is stored in the backend processing module when the data transmission channel is established.

4. The method according to claim 3, characterized in that, The front-end driver delivers the user data to the back-end driver through the hardware channel, including: The user-mode application fills the address on the host side used to store the user data into the first descriptor and puts the first descriptor into the front-end driver's send queue; The front-end driver sends a notification to the hardware channel front-end of the network protocol stack offloading device on the smart network card side. The hardware channel front end receives the notification and retrieves the first descriptor from the host-side sending queue; The hardware channel front end retrieves the user data from the host memory according to the address pointed to by the first descriptor; The hardware channel front end delivers the retrieved user data to the hardware channel back end of the network protocol stack offloading device on the smart network card side. The hardware channel backend retrieves a second descriptor from the receiving queue on the smart network card side. The second descriptor describes the address of the free memory on the smart network card side. The hardware channel backend stores the user data in the idle buffer on the smart network card side according to the address pointed to by the second descriptor, and interrupts the backend driver processing. The backend driver retrieves the user data from the buffer pointed to by the second descriptor.

5. The method according to claim 2, characterized in that, The native system kernel network protocol stack based on the smart network interface card (NIC) replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, including: The native system kernel network protocol stack on the smart network card side strips the network data received by the network card's transceiver port to obtain user data and socket information, and sends the user data and socket information to the backend processing module through the native system kernel socket interface. The method of transmitting user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart network card side using the hardware channel includes: The backend processing module sends the received user data to the host-side user-mode application through the hardware channel based on the socket information.

6. The method according to claim 5, characterized in that, The backend processing module, based on the socket information, sends the received user data to the host-side user-mode application via the hardware channel, including: The backend processing module determines the corresponding smart network card side's transmission queue based on the received socket information and sends the received user data to the backend driver. The backend driver fills the memory information of the user data stored on the network card side into the third descriptor, and puts the third descriptor into the transmission queue on the smart network card side; The backend driver sends a notification to the hardware channel backend of the network protocol stack offloading device on the smart network card side. The hardware channel backend receives the notification and retrieves the third descriptor from the smart network card's sending queue; The hardware channel backend retrieves and saves user data from the host memory based on the address pointed to by the third descriptor. The hardware channel front end retrieves a fourth descriptor from the host-side receive queue, the fourth descriptor containing an address pointing to free memory on the host side; The hardware channel front end saves the user data to the free memory pointed to by the fourth descriptor according to the address pointed to by the fourth descriptor, and notifies the front end driver to process it. The hardware channel front-end driver calls the network protocol stack unload socket interface and returns the call result to the user-mode application through the return value.

7. A host network protocol stack soft offloading device based on a smart network interface card, characterized in that, include: The software driver, based on inter-process communication, utilizes the hardware channel on the smart network interface card (NIC) side to transmit user data between the user-mode application on the host side and the native system kernel socket interface in the embedded processor on the smart NIC side. The software driver includes multiple modules located on the host side and the smart NIC side. The hardware channel includes the hardware channel front-end and hardware channel back-end of the network protocol stack offloading device on the smart NIC side. The native system kernel socket interface in the embedded processor on the smart network card side, based on the native system kernel network protocol stack on the smart network card side, replaces the native system kernel network protocol stack on the host side to implement the functions of the network protocol stack, encapsulates the user data to be sent, or strips the received network data to obtain the user data.

8. The apparatus according to claim 7, characterized in that, The software driver includes: a network protocol stack offload socket interface running on the host-side processor, a front-end driver, a back-end driver running on the embedded processor on the smart network card side, and a back-end processing module; The network protocol stack offloading device is registered to the host system kernel via a semi-virtualized interface by the front-end driver. The network protocol stack offloading device provides the same network protocol stack offloading socket interface as the host operating system's native system kernel socket interface. The user-space application sends and receives user data based on the socket interface offloaded from the network protocol stack.

9. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to implement the method of any one of claims 1 to 6 when executing instructions stored in the memory.

10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 6.