An intelligent network card and method for implementing TCP protocol proxy offloading
Patent Information
- Application Number
- CN202611078021.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]传统技术中,在经典网络模型中,每个通过系统的数据包都需要CPU的全程参与,包括从用户空间缓冲区拷贝到内核空间、经过TCP/IP协议栈的层层处理、加上各种头部信息、计算校验和等,然而传统技术中随着网络速度的提升,数据包处理能力无法与网络速度进行匹配,导致整体网络处理效能低下,存在不足之处
1.通过获取智能网卡中预设的后端服务器池列表,基于负载均衡策略在后端服务器池列表中选取目标后端服务器,基于智能网卡构建并发送后端SYN请求信息至目标后端服务器,基于TCP协议建立智能网卡与目标后端服务器的连接,创建双向会话映射表项并进行维护,其中,本申请实施例中的负载均衡策略、TCP协议握手以及双向会话映射表项的维护均是在智能网卡的可编程硬件加速器中完成的,耗时在微秒级甚至纳秒级,速度极快,提高了整体网络处理效能;
Smart Images

Figure CN122994237A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of digital information transmission technology, and in particular to a smart network interface card and method for implementing TCP protocol proxy offloading. Background Technology
[0002] Currently, TCP (Transmission Control Protocol) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol widely used in the Internet. It establishes a connection through a three-way handshake and terminates it through a four-way handshake, providing a reliable data transmission mechanism including sequence numbers, acknowledgments, retransmission control, flow control, and congestion control. A network interface card (NIC) is a key hardware device for data transmission between a computer and a network; its core function is to convert the computer's internal digital signals into signals that can be transmitted over the network, enabling data transmission and reception.
[0003] In traditional technologies, in the classic network model, every data packet passing through the system requires the full participation of the CPU, including copying from the user space buffer to the kernel space, processing through layers of the TCP / IP protocol stack, adding various header information, calculating checksums, etc. However, as network speeds increase, traditional technologies cannot match the data packet processing capabilities, resulting in low overall network processing efficiency and shortcomings. Summary of the Invention
[0004] To address the aforementioned issues, this application provides a smart network interface card and method for implementing TCP protocol proxy offloading.
[0005] Firstly, this application provides a method for implementing TCP protocol proxy offloading, which adopts the following technical solution: A method for implementing TCP protocol proxy offloading includes the following steps: Step S1: Based on the built-in programmable hardware accelerator of the smart network card, listen and identify whether the client initiates a connection request. If a request is initiated, intercept it based on the smart network card and reply with a connection establishment confirmation. If the client sends an ACK confirmation message, the connection is successfully established. Synchronously record the connection status information and create a TCP connection status table for display. Step S2: Obtain the list of preset backend server pools in the smart network card, and select the target backend server from the list of backend server pools based on the load balancing strategy. Step S3: Based on the smart network card, construct and send backend SYN request information to the target backend server, establish a connection between the smart network card and the target backend server based on the TCP protocol, create bidirectional session mapping table entries and maintain them; Step S4: The programmable hardware accelerator based on the smart network card performs real-time identification, message rewriting, and sending operations on the data transmitted between the client and the target backend server. Step S5: Synchronize the state of the client and the target backend server based on the bidirectional session mapping table entries, detect whether the client or the target backend server has issued a request to close the connection, and if so, close the connection and output a connection termination signal.
[0006] Preferably, the smart network card has a built-in programmable hardware accelerator, which performs real-time monitoring on a predetermined virtual IP and port to obtain inbound packet information. Parallel synchronous deep parsing is performed on the inbound message information to obtain the listening parsing result. Based on the listening parsing result, it is determined whether the client initiates a connection. If the listening parsing result shows that the client sends a front-end SYN request, it is determined that the client initiates a connection and the first handshake response signal is output. Upon receiving the first handshake response signal, when the front-end SYN request information arrives at the smart network card, the front-end SYN request information is intercepted and cached based on the data packet processing engine pre-set within the smart network card.
[0007] Preferably, the connection establishment confirmation is sent back to the client based on the TCP protocol stack pre-configured in the smart network card, that is, the front-end direct handshake response information is sent back; After receiving the direct handshake response information from the front end, if the client agrees to establish a connection, it sends a front end ACK confirmation message to the smart network card. When the smart network card receives the front end ACK confirmation message, it indicates that the smart network card and the client have successfully established a connection and outputs a front end handshake completion signal. The connection status record information is obtained by recording the status information of the TCP connection between the smart network card and the client; A TCP connection state table is created at the smart network interface card level, and the connection state record information is displayed and marked in real time on the TCP connection state table and cached.
[0008] Preferably, the backend server pool list pre-set in the smart network card is obtained, the backend server pool list includes multiple server IPs and ports, and also includes server health status information; The smart network card filters and selects each backend server in the backend server pool list based on the server health status information to obtain the health status filtering results. Perform consistent hashing operation on connection state record information based on consistent hashing algorithm; The backend servers in the health status screening results are cyclically allocated based on a polling mechanism. The number of active connections for each backend server is obtained by counting the active connections of each backend server in the health status screening results based on the smart network card. Select the minimum number of active connections among all backend servers and mark that backend server as the target backend server.
[0009] Preferably, the source IP address is the physical IP address of the smart network card itself, and a temporary source port is obtained by dynamically allocating a port from a local port pool of the smart network card. Based on the TCP protocol, the smart network card creates a connection establishment request and receives SYN request information from the backend; Mark the target backend server's service port as the target service port; The backend SYN request information is sent from the source temporary port to the target service port. After receiving the backend SYN request information from the target service port, the target backend server sends a backend direct handshake response information to the smart network card. After receiving the backend direct handshake response information, the smart network card replies with backend ACK confirmation information to the target backend server. When the target backend server receives the backend ACK confirmation information, it indicates that the target backend server and the smart network card have successfully established a connection, and outputs a backend handshake completion signal.
[0010] Preferably, a bidirectional session mapping entry is created, which includes front-end connection identification information, back-end connection identification information, and a mapping pointer; When there is data conversion between the client and the target backend server, data maintenance operations are performed based on the bidirectional session mapping table entries.
[0011] Preferably, the application data sent by the client to the smart network card is marked as downstream traffic information; The smart network interface card (NIC) finds the target backend server corresponding to the client based on the bidirectional session mapping table entry, performs packet rewriting operation on the downstream traffic information based on the programmable hardware accelerator in the smart NIC to obtain downstream packet rewriting information, and calculates the checksum of the downstream packet rewriting information to obtain downstream checksum data information. The downstream packet rewriting information is sent to the target backend server based on the physical port of the smart network card; Mark the response data of the target backend server as upstream traffic information; The upstream traffic information is rewritten by performing reverse packet rewriting operation based on the programmable hardware accelerator in the smart network card to obtain the upstream packet rewriting information. The checksum of the upstream packet rewriting information is calculated to obtain the upstream checksum data information. The smart network interface card (NIC) uses its physical port to send upstream packet rewriting information to the client.
[0012] Preferably, the data transmission status between the client and the target backend server is synchronized in real time based on the mapping pointer between the client and the target backend server in the bidirectional session mapping table. Upon receiving a shutdown request from the client or the target backend server, coordinate the shutdown process for the connection between the client and the smart NIC, as well as the connection between the smart NIC and the target backend server. The connection termination signal is output when both the connection between the client and the smart network card, and the connection between the smart network card and the target backend server, are closed.
[0013] Secondly, this application provides a smart network interface card that implements TCP protocol proxy offloading, using the following technical solution: A smart network interface card (NIC) that implements TCP protocol proxy offloading includes: The front-end connection establishment module is configured to listen based on the programmable hardware accelerator built into the smart network card, identify whether the client initiates a connection request, and if a request is initiated, it will intercept the request based on the smart network card and reply with a connection establishment confirmation. If the front-end ACK confirmation information sent by the client is received, the connection is successfully established. The connection status record information is recorded synchronously and a TCP connection status table is created for display. The backend server selection module is configured to obtain a list of preset backend server pools in the smart network interface card and select a target backend server from the list of backend server pools based on a load balancing strategy. The backend connection establishment module is configured to build and send backend SYN request information to the target backend server based on the smart network card, establish a connection between the smart network card and the target backend server based on the TCP protocol, and create and maintain bidirectional session mapping table entries. The data plane traffic forwarding module is configured to perform real-time identification, packet rewriting, and sending operations on the data transmitted between the client and the target backend server in a programmable hardware accelerator based on a smart network card. The state synchronization termination module is configured to synchronize the state of the client and the target backend server based on bidirectional session mapping entries. It detects whether the client or the target backend server sends a request to close the connection. If a request to close the connection is sent, the connection is closed and a connection termination signal is output.
[0014] In summary, this application includes at least one of the following beneficial technical effects: 1. By obtaining the pre-set list of backend server pools in the smart network interface card (NIC), a target backend server is selected from the list based on a load balancing strategy. A backend SYN request is constructed and sent to the target backend server based on the smart NIC. A connection between the smart NIC and the target backend server is established based on the TCP protocol. A bidirectional session mapping table entry is created and maintained. In this embodiment, the load balancing strategy, TCP handshake, and maintenance of the bidirectional session mapping table entry are all completed in the programmable hardware accelerator of the smart NIC, with a time consumption of microseconds or even nanoseconds, which is extremely fast and improves the overall network processing efficiency. 2. By rewriting application data sent from the client to the smart network interface card (NIC) to obtain downstream message rewriting information and calculate checksums, and by rewriting response data from the target backend server to obtain upstream message rewriting information and calculate checksums, near-zero copy traffic forwarding is achieved. In this application, the smart NIC strictly maintains the state of the front-end TCP connection and the back-end TCP connection, ensuring that flow control, out-of-order reordering, and retransmission mechanisms can work independently and correctly at both ends of the smart NIC. At the hardware level of the smart NIC, the rewriting and targeted delivery of transmitted data are completed, constructing a direct data channel that bypasses the host kernel, achieving ultra-low latency, high throughput, and zero CPU usage, further improving the overall network processing efficiency. Attached Figure Description
[0015] Figure 1 This embodiment is a flowchart illustrating the method for implementing TCP protocol proxy offloading. Figure 2 This embodiment mainly illustrates the module diagram of the smart network interface card that implements TCP protocol proxy offloading.
[0016] Attached reference numerals: 1. Front-end connection establishment module; 2. Back-end server selection module; 3. Back-end connection establishment module; 4. Data plane traffic forwarding module; 5. State synchronization termination module. Detailed Implementation
[0017] The present application will be further described in detail below with reference to the accompanying drawings.
[0018] This application discloses a method for implementing TCP protocol proxy offloading.
[0019] A method for implementing TCP protocol proxy offloading includes the following steps: Reference Figure 1Step S1 involves listening for client requests using the built-in programmable hardware accelerator of the smart network interface card (NIC). If a request is initiated, the NIC intercepts the request and sends a connection confirmation. If an ACK confirmation message from the client is received, the connection is successfully established. The connection status information is then recorded synchronously, and a TCP connection status table is created for display. Step S1 specifically includes the following sub-steps: Step A1: The smart network card has a built-in programmable hardware accelerator. The programmable hardware accelerator listens in real time on the predetermined virtual IP and port to obtain inbound packet information.
[0020] Step A2: Perform parallel synchronous deep parsing on the inbound message information to obtain the listening parsing result. Based on the listening parsing result, determine whether the client initiates a connection. If the listening parsing result shows that the client has sent a front-end SYN request, then determine that the client has initiated a connection and output the first handshake response signal.
[0021] Step A3: After receiving the first handshake response signal, when the front-end SYN request information arrives at the smart network card, the data packet processing engine pre-configured in the smart network card intercepts and caches the front-end SYN request information without reporting it to the host operating system, thus improving network processing efficiency.
[0022] Step S1 further includes the following sub-steps: Step B1: Based on the pre-configured TCP protocol stack within the smart network card, a connection establishment confirmation is sent back to the client, i.e., a direct handshake response is sent back to the client.
[0023] In step B2, after receiving the direct handshake response from the front end, if the client agrees to establish a connection, it sends a front end ACK confirmation message to the smart network card. When the smart network card receives the front end ACK confirmation message, it indicates that the smart network card and the client have successfully established a connection, and outputs a front end handshake completion signal.
[0024] Step B3 involves recording the state information of the TCP connection between the smart network interface card (NIC) and the client to obtain connection state record information. This connection state record information includes the five-tuple (source / destination IP, port), sequence number, window size, and other state information of the TCP connection between the smart NIC and the client.
[0025] Step B4: Create a TCP connection state table at the smart network interface card level, and display and cache the connection state record information in the TCP connection state table in real time.
[0026] Reference Figure 1Step S2 involves obtaining the preset list of backend server pools in the smart network interface card (NIC) and selecting the target backend server from the list based on a load balancing strategy. Step S2 specifically includes the following sub-steps: Step S21: Obtain the list of backend server pools pre-configured in the smart network card. The list of backend server pools includes multiple server IPs and ports, as well as server health status information (such as: available, unavailable, weight value).
[0027] Step S22: The smart network card filters and selects each backend server in the backend server pool list based on the server health status information to obtain the health status filtering results.
[0028] Step S23: Perform a consistent hashing operation on the five-tuple (source / destination IP, port) in the connection state record information based on the consistent hashing algorithm. This ensures that requests from the same client are consistently sent to the same backend server, which is suitable for scenarios requiring session consistency.
[0029] Step S24: Based on the polling mechanism, perform cyclic allocation processing on each backend server in the health status screening results.
[0030] Step S25: Count the active connections of each backend server in the health status screening results based on the smart network card to obtain the number of active connections of each backend server.
[0031] Step S26: Select the minimum number of active connections among all backend servers and mark that backend server as the target backend server. In this embodiment, a load balancing strategy is used to select the target backend server from the backend server pool list. It should be noted that the load balancing strategy in this embodiment is implemented in the programmable hardware accelerator of the smart network interface card, taking only microseconds or even nanoseconds, resulting in extremely high speed and improved overall network processing performance.
[0032] In practical applications, by obtaining the list of backend server pools preset in the smart network card, the target backend server is selected from the list of backend server pools based on the load balancing strategy. In this embodiment, the load balancing strategy is executed in the programmable hardware accelerator of the smart network card, without having to be uploaded to the host operating system, which greatly reduces the CPU interrupt load and takes only microseconds or even nanoseconds, making it extremely fast and improving the overall network processing efficiency.
[0033] Reference Figure 1 Step S3 involves constructing and sending backend SYN request information to the target backend server based on the smart network interface card (NIC), establishing a connection between the smart NIC and the target backend server based on the TCP protocol, creating and maintaining a bidirectional session mapping table. Step S3 specifically includes the following sub-steps: Step C1: Select the physical IP address of the smart network card itself as the source IP address, and dynamically allocate a port from a local port pool of the smart network card to obtain the source temporary port.
[0034] Step C2: Based on the TCP protocol, the smart network card creates a connection establishment request and obtains the backend SYN request information.
[0035] Step C3: Mark the service port of the target backend server as the target service port.
[0036] Step C4: The backend SYN request information is sent from the source temporary port to the target service port. After receiving the backend SYN request information based on the target service port, the target backend server sends the backend direct handshake response information to the smart network card.
[0037] In step C5, after receiving the backend direct handshake response information, the smart network interface card (NIC) replies with an ACK confirmation message to the target backend server. When the target backend server receives the ACK confirmation message, it indicates that the connection between the target backend server and the smart NIC has been successfully established, and it outputs a backend handshake completion signal. It should be noted that in this embodiment, the connection establishment process between the target backend server and the smart NIC is completely independent of the host operating system, does not consume host CPU resources, and does not go through the host protocol stack. It is extremely time-efficient and fast, improving overall network processing performance.
[0038] Step S3 further includes the following sub-steps: Step D1: Create a bidirectional session mapping table entry. This entry includes frontend connection identifier information, backend connection identifier information, and a mapping pointer. The frontend connection identifier information includes the client IP address, client serial number, and client status information. The backend connection identifier information includes the smart network interface card (NIC) IP address, target backend server IP address, target backend server serial number, and target backend server status information. The mapping pointer refers to the mapping connection relationship between the client and the server.
[0039] Step D2: When data conversion occurs between the client and the target backend server, data maintenance operations are performed based on the bidirectional session mapping table entries. Specifically, when data conversion occurs between the client and the target backend server, the data maintenance operations include the smart network interface card (NIC) determining the data transmission direction based on the bidirectional session mapping table entries, i.e., determining whether the data originates from the client or the target backend server. The data maintenance operations also include precisely modifying the IP and TCP header fields (such as address, port, sequence number / acknowledgment number offset) during the rewrite operation. Furthermore, the data maintenance operations include sending the rewritten data packets out from the correct port.
[0040] In practical applications, this application constructs and sends backend SYN request information to the target backend server based on a smart network interface card (NIC), establishes a connection between the smart NIC and the target backend server based on the TCP protocol, and creates and maintains a bidirectional session mapping table. In this embodiment, the TCP handshake and the maintenance of the bidirectional session mapping table are both completed in the programmable hardware accelerator of the smart NIC, taking only microseconds or even nanoseconds, resulting in extremely high speed and improved overall network processing efficiency.
[0041] Reference Figure 1 Step S4 involves real-time identification, packet rewriting, and transmission of data transmitted between the client and the target backend server within the programmable hardware accelerator based on the smart network interface card. Step S4 specifically includes the following sub-steps: Step S41: Mark the application data sent by the client to the smart network card as downstream traffic information.
[0042] In step S42, the smart NIC finds the target backend server corresponding to the client based on the bidirectional session mapping table entry, performs packet rewriting on the downstream traffic information using the programmable hardware accelerator in the smart NIC to obtain downstream packet rewriting information, and calculates the checksum of the downstream packet rewriting information to obtain downstream checksum data information. Specifically, performing packet rewriting on the downstream traffic information means changing the source address to the smart NIC address and the destination address to the target backend server address.
[0043] Step S43: Send downstream packet rewriting information to the target backend server based on the physical port of the smart network card.
[0044] Step S44: Mark the response data of the target backend server as upstream traffic information.
[0045] Step S45: Based on the programmable hardware accelerator in the smart network interface card (NIC), perform a reverse packet rewriting operation on the upstream traffic information to obtain upstream packet rewriting information, and calculate the checksum of the upstream packet rewriting information to obtain upstream checksum data information. Specifically, performing packet rewriting on the upstream traffic information means changing the source address back to the original VIP and the destination address back to the original client address.
[0046] Step S46: Based on the physical port of the smart network card, the upstream packet rewriting information is sent to the client.
[0047] In practical applications, this application achieves near-zero-copy traffic forwarding by rewriting application data sent from the client to the smart network interface card (NIC) to obtain downstream message rewriting information and calculating checksums, and by rewriting response data from the target backend server to obtain upstream message rewriting information and calculating checksums. The smart NIC in this application strictly maintains the state of the front-end and back-end TCP connections, ensuring that flow control, out-of-order reordering, and retransmission mechanisms can operate independently and correctly at both ends of the smart NIC. By completing the rewriting and targeted delivery of transmitted data at the hardware level of the smart NIC, a direct data channel bypassing the host kernel is constructed, achieving ultra-low latency, high throughput, and zero CPU usage, further improving overall network processing efficiency.
[0048] Reference Figure 1 Step S5 involves synchronizing the client's and target backend server's states based on the bidirectional session mapping table entries, detecting whether the client or target backend server has issued a connection close request, and if so, closing the connection and outputting a connection termination signal. Step S5 specifically includes the following sub-steps: Step S51: Based on the mapping pointer between the client and the target backend server in the bidirectional session mapping table, the data transmission status between the client and the target backend server is synchronized in real time.
[0049] Step S52: Upon receiving a shutdown request from the client or the target backend server, coordinate the shutdown process for the connection between the client and the smart network card, as well as the connection between the smart network card and the target backend server.
[0050] Step S53: Until the connection between the client and the smart network card, and the connection between the smart network card and the target backend server are both closed, output a connection termination signal to end the communication between the client and the target backend server.
[0051] This application also discloses a smart network interface card that implements TCP protocol proxy offloading.
[0052] Reference Figure 2 A smart network interface card (NIC) that implements TCP protocol proxy offloading, comprising a NIC communication system, including: The front-end connection establishment module is configured to listen for connections based on the programmable hardware accelerator built into the smart network card, identify whether the client initiates a connection request, intercept the request based on the smart network card and reply with a connection establishment confirmation, and if the front-end ACK confirmation information sent by the client is received, the connection is successfully established, the connection status record information is recorded synchronously and a TCP connection status table is created for display.
[0053] The backend server selection module is configured to obtain a list of pre-set backend server pools from the smart network interface card (NIC) and select a target backend server from the list of backend server pools based on a load balancing strategy.
[0054] The backend connection establishment module is configured to build and send backend SYN request information to the target backend server based on the smart network card, establish a connection between the smart network card and the target backend server based on the TCP protocol, and create and maintain bidirectional session mapping table entries.
[0055] The data plane traffic forwarding module is configured to perform real-time identification, packet rewriting, and transmission operations on the data transmitted between the client and the target backend server in a programmable hardware accelerator based on a smart network interface card.
[0056] The state synchronization termination module is configured to synchronize the state of the client and the target backend server based on bidirectional session mapping entries. It detects whether the client or the target backend server sends a request to close the connection. If a request to close the connection is sent, the connection is closed and a connection termination signal is output.
[0057] Those skilled in the art will understand that embodiments of the present invention can be provided as methods or systems. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0058] This invention is described with reference to flowchart illustrations and structural diagrams of methods and systems according to embodiments of the invention. It should be understood that the combination of each process and module in the flowchart and structural diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, generate instructions for implementing the process. Figure 1 One or more processes and structures Figure 1 A device for a function specified in one or more modules.
[0059] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and structures Figure 1 The function specified in one or more modules.
[0060] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and structures Figure 1 The steps of a specified function in one or more modules.
[0061] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0062] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for implementing TCP protocol proxy offloading, characterized in that, Includes the following steps: Step S1: Based on the built-in programmable hardware accelerator of the smart network card, listen and identify whether the client initiates a connection request. If a request is initiated, intercept it based on the smart network card and reply with a connection establishment confirmation. If the client sends an ACK confirmation message, the connection is successfully established. Synchronously record the connection status information and create a TCP connection status table for display. Step S2: Obtain the list of preset backend server pools in the smart network card, and select the target backend server from the list of backend server pools based on the load balancing strategy. Step S3: Based on the smart network card, construct and send backend SYN request information to the target backend server, establish a connection between the smart network card and the target backend server based on the TCP protocol, create bidirectional session mapping table entries and maintain them; Step S4: The programmable hardware accelerator based on the smart network card performs real-time identification, message rewriting, and sending operations on the data transmitted between the client and the target backend server. Step S5: Synchronize the state of the client and the target backend server based on the bidirectional session mapping table entries, detect whether the client or the target backend server has issued a request to close the connection, and if so, close the connection and output a connection termination signal.
2. The method for implementing TCP protocol proxy offloading according to claim 1, characterized in that, Step S1 specifically includes the following sub-steps: The smart network card has a built-in programmable hardware accelerator, which listens in real time on a predetermined virtual IP and port to obtain inbound packet information. Parallel synchronous deep parsing is performed on the inbound message information to obtain the listening parsing result. Based on the listening parsing result, it is determined whether the client initiates a connection. If the listening parsing result shows that the client sends a front-end SYN request, it is determined that the client initiates a connection and the first handshake response signal is output. Upon receiving the first handshake response signal, when the front-end SYN request information arrives at the smart network card, the front-end SYN request information is intercepted and cached based on the data packet processing engine pre-set within the smart network card.
3. The method for implementing TCP protocol proxy offloading according to claim 2, characterized in that, Step S1 further includes the following sub-steps: Based on the pre-configured TCP protocol stack within the smart network card, a connection establishment confirmation is sent back to the client, i.e., a direct handshake response is sent to the front end. After receiving the direct handshake response information from the front end, if the client agrees to establish a connection, it sends a front end ACK confirmation message to the smart network card. When the smart network card receives the front end ACK confirmation message, it indicates that the smart network card and the client have successfully established a connection and outputs a front end handshake completion signal. The connection status record information is obtained by recording the status information of the TCP connection between the smart network card and the client; A TCP connection state table is created at the smart network interface card level, and the connection state record information is displayed and marked in real time on the TCP connection state table and cached.
4. The method for implementing TCP protocol proxy offloading according to claim 3, characterized in that, Step S2 specifically includes the following sub-steps: Obtain the list of backend server pools pre-configured in the smart network interface card. The list of backend server pools includes multiple server IPs and ports, as well as server health status information. The smart network card filters and selects each backend server in the backend server pool list based on the server health status information to obtain the health status filtering results. Perform consistent hashing operation on connection state record information based on consistent hashing algorithm; The backend servers in the health status screening results are cyclically allocated based on a polling mechanism. The number of active connections for each backend server is obtained by counting the active connections of each backend server in the health status screening results based on the smart network card. Select the minimum number of active connections among all backend servers and mark that backend server as the target backend server.
5. The method for implementing TCP protocol proxy offloading according to claim 4, characterized in that, Step S3 specifically includes the following sub-steps: Select the physical IP address of the smart network card itself as the source IP address, and dynamically allocate a port from a local port pool of the smart network card to obtain the source temporary port; Based on the TCP protocol, the smart network card creates a connection establishment request and receives SYN request information from the backend; Mark the target backend server's service port as the target service port; The backend SYN request information is sent from the source temporary port to the target service port. After receiving the backend SYN request information based on the target service port, the target backend server sends a backend direct handshake response information to the smart network card. After receiving the backend direct handshake response information, the smart network card replies with backend ACK confirmation information to the target backend server. When the target backend server receives the backend ACK confirmation information, it indicates that the target backend server and the smart network card have successfully established a connection, and outputs a backend handshake completion signal.
6. The method for implementing TCP protocol proxy offloading according to claim 5, characterized in that, Step S3 further includes the following sub-steps: Create a bidirectional session mapping table entry, which includes front-end connection identification information, back-end connection identification information, and a mapping pointer; When there is data conversion between the client and the target backend server, data maintenance operations are performed based on the bidirectional session mapping table entries.
7. The method for implementing TCP protocol proxy offloading according to claim 6, characterized in that, Step S4 specifically includes the following sub-steps: The application data sent by the client to the smart network card is marked as downstream traffic information; The smart network interface card (NIC) finds the target backend server corresponding to the client based on the bidirectional session mapping table entry, performs packet rewriting operation on the downstream traffic information based on the programmable hardware accelerator in the smart NIC to obtain downstream packet rewriting information, and calculates the checksum of the downstream packet rewriting information to obtain downstream checksum data information. The downstream packet rewriting information is sent to the target backend server based on the physical port of the smart network card; Mark the response data of the target backend server as upstream traffic information; The upstream traffic information is rewritten by performing reverse packet rewriting operation based on the programmable hardware accelerator in the smart network card to obtain the upstream packet rewriting information. The checksum of the upstream packet rewriting information is calculated to obtain the upstream checksum data information. The smart network interface card (NIC) uses its physical port to send upstream packet rewriting information to the client.
8. The method for implementing TCP protocol proxy offloading according to claim 7, characterized in that, Step S5 specifically includes the following sub-steps: Based on the mapping pointers between the client and the target backend server in the bidirectional session mapping table, the data transmission status between the client and the target backend server is synchronized in real time. Upon receiving a shutdown request from the client or the target backend server, coordinate the shutdown process for the connection between the client and the smart NIC, as well as the connection between the smart NIC and the target backend server. The connection termination signal is output when both the connection between the client and the smart network card, and the connection between the smart network card and the target backend server, are closed.
9. A smart network interface card (NIC) for implementing TCP protocol proxy offloading, characterized in that, The smart network interface card that implements TCP protocol proxy offloading is used to implement the method for implementing TCP protocol proxy offloading as described in any one of claims 1-8, including: The front-end connection establishment module is configured to listen based on the programmable hardware accelerator built into the smart network card, identify whether the client initiates a connection request, and if a request is initiated, it will intercept the request based on the smart network card and reply with a connection establishment confirmation. If the front-end ACK confirmation information sent by the client is received, the connection is successfully established. The connection status record information is recorded synchronously and a TCP connection status table is created for display. The backend server selection module is configured to obtain a list of preset backend server pools in the smart network interface card and select a target backend server from the list of backend server pools based on a load balancing strategy. The backend connection establishment module is configured to build and send backend SYN request information to the target backend server based on the smart network card, establish a connection between the smart network card and the target backend server based on the TCP protocol, and create and maintain bidirectional session mapping table entries. The data plane traffic forwarding module is configured to perform real-time identification, packet rewriting, and sending operations on the data transmitted between the client and the target backend server in a programmable hardware accelerator based on a smart network card. The state synchronization termination module is configured to synchronize the state of the client and the target backend server based on bidirectional session mapping entries. It detects whether the client or the target backend server sends a request to close the connection. If a request to close the connection is sent, the connection is closed and a connection termination signal is output.