Method, device and equipment for synchronizing software and hardware of TCP session sequence number in DPU and medium
By synchronizing TCP session sequence numbers in the DPU network forwarding engine, the failure of session tracking function checks caused by the inconsistency of sequence numbers between software and hardware modules was resolved, thereby improving network performance and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YUSUR TECH CO LTD
- Filing Date
- 2023-12-14
- Publication Date
- 2026-07-21
AI Technical Summary
In the DPU network forwarding engine, the session tracing function fails to check because the TCP session sequence numbers in the software module and the hardware module are out of sync.
Synchronization of TCP session sequence numbers is achieved between the software module and the hardware module. Specifically, the software module receives the sequence number value of the most recent TCP session returned by the hardware module and determines the sequence number value of the current TCP session based on this, ensuring sequence number synchronization during subsequent data packet processing.
The issue of session tracking failure due to sequence number asynchrony was resolved, and key information synchronization between software and hardware modules was achieved, improving network performance and security.
Smart Images

Figure CN117714516B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a software and hardware synchronization method, apparatus, device, and medium for TCP session sequence numbers in the DPU network forwarding engine. Background Technology
[0002] With the rapid development of cloud network technology, the Data Processing Unit (DPU), as a new type of network interface card (NIC), improves overall system performance while reducing data processing latency. DPUs are gradually becoming network devices integrated on hosts in cloud computing environments. Figure 1 This is a host architecture diagram of a DPU (Data Processing Unit). The host machine hosts virtual machines, and the network traffic of the virtual machines enters the DPU through ports, and then enters the external network. The DPU has a network forwarding engine, which forwards the network traffic entering the DPU.
[0003] Furthermore, such as Figure 2A The network forwarding engine in the DPU is implemented jointly by software and hardware modules. The forwarding engine processes network traffic in a pipelined manner. The software module is a pipeline implemented according to specifications such as OpenFlow, while the hardware module is a pipeline composed of multiple hash tables. Initially, the software module contains all session rules, while the hardware module contains no rules. Upon arrival of network traffic, the software and hardware work together to process the traffic using a UPCALL mechanism.
[0004] like Figure 2B The UPCALL mechanism process is as follows: 1) After the DPU starts, the rules in its hardware forwarding path are empty, and the rules in its software forwarding path are issued by the network controller; 2) Network traffic first reaches the hardware forwarding path. Whether the traffic comes from the external network or is sent by the virtual machine, it is considered as newly created traffic; 3) At this time, the forwarding table of the hardware forwarding path does not have forwarding rules for the session to which the newly created traffic belongs (for example, a TCP session refers to the session connection established between two nodes in communication based on the TCP / IP protocol. A TCP session is usually represented by a 5-tuple, which includes the source IP address, destination IP address, source port number, destination port number, and TCP protocol identifier). This data packet is called the first packet of this session and is sent to the virtual switch in the DPU; 4) The software forwarding path in the virtual switch is responsible for forwarding this data packet and issuing the rules to the offloading path, and then to the hardware forwarding path; 5) Subsequent data packets of this session are forwarded by the hardware forwarding path.
[0005] like Figure 2CWhen the network controller modifies the TCP session rules, the network forwarding engine uses the FLOWMODIFY mechanism to handle this situation. Specifically, the software module receives the action update of the old TCP session rules from the network controller, obtains the new TCP session rules, and sends a deletion command to the hardware module to delete the old TCP session rules.
[0006] Further reference Figure 2C When subsequent packets of a TCP session arrive at the hardware, the UPCALL mechanism will be retried.
[0007] Furthermore, for TCP sessions, the software module's CT session inspection module has an order number checking mechanism, while the hardware module lacks this mechanism. The CT session inspection mechanism tracks the state of TCP sessions and maintains information such as source IP address, destination IP address, source port, and destination port. By combining session state with the device's session rules, the CT session inspection mechanism can reliably filter and forward TCP sessions, improving network performance and security. Specifically, as... Figure 2D As shown, during the TCP session check (CT) of data packets, for the transmitted file "123", the initial sequence number is seq = 1. With win = 1, if the current data packet's sequence number is seq = 2, since 2 = initial sequence number + win, the CT session check passes. However, assuming the current data packet's sequence number is seq = 3, then 3 > initial sequence number + win, and the CT session check fails. After updating seq = 2, if the current data packet's sequence number is seq = 3, since 3 = updated sequence number + win, the CT session check passes.
[0008] The above analysis shows that when a FLOW MODIFY occurs, the TCP session sequence number check by the CT session check module in the software module fails due to the asynchrony between the software and hardware. Specifically, as the UPCALL process describes, the software module is responsible for processing the first data packet of the TCP session and generating rules that are offloaded to the hardware. The hardware module processes subsequent data packets of the TCP session. When subsequent packets of the TCP session are processed in the hardware module, key session information such as the TCP session sequence number exists only in the hardware module. When a FLOW MODIFY occurs, an error will occur when the CT module in the software module performs a sequence number check again.
[0009] Therefore, it is necessary to synchronize key information such as TCP session sequence numbers between software and hardware modules. Summary of the Invention
[0010] In view of this, embodiments of the present invention provide a method, apparatus, electronic device, and storage medium for synchronizing TCP session sequence numbers in a DPU network forwarding engine, which solves the problem that session tracking function fails to check when TCP sessions are forwarded in the DPU network forwarding engine due to the inconsistency of sequence numbers in the software and hardware.
[0011] According to a first aspect of the present invention, a method for software and hardware synchronization of TCP session sequence numbers in a network forwarding engine of a DPU is provided, applied to a DPU network forwarding engine, the network forwarding engine including a software module and a hardware module, wherein data packets are forwarded in a pipeline manner in the DPU network forwarding engine, the method comprising: the software module receiving TCP session rules from a network controller; the hardware module obtaining the TCP session rules from the software module through a UPCALL mechanism and forwarding data packets, wherein the sequence number values of the TCP sessions in the software module and the hardware module are both the sequence number values carried by the first TCP data packet; when the network controller modifies the action of the TCP session rules in the software module, the software module receiving new TCP session rules from the network controller, the new TCP session rules indicating that the action of the TCP session rules has been updated; the software module sending a deletion instruction to the hardware module to delete the TCP session rules, and receiving the sequence number value carried by the data packet of the most recent TCP session returned by the hardware module, so that the software module determines a new sequence number value for the current TCP session based on the return value; when subsequent data packets of the TCP session will re-trigger the UPCALL mechanism, the hardware module obtaining the new TCP session rules and their corresponding sequence number values.
[0012] In another implementation of the present invention, receiving the sequence number value carried by the data packet of the most recent TCP session returned by the hardware module includes: the software module receiving the synchronization instruction returned by the hardware module and extracting the sequence number value carried by the data packet of the most recent TCP session.
[0013] In another implementation of the present invention, the method further includes: the software module configuring the synchronization instruction in the TCP session rule; and the software module sending the TCP session rule to the hardware module.
[0014] In another implementation of the present invention, the method further includes: the hardware module receiving the TCP session rule and storing the synchronization instructions in the TCP session rule.
[0015] In another implementation of the present invention, the method further includes: the hardware module processes subsequent network traffic of the TCP session based on the new TCP session rules, records the sequence number of the most recently forwarded TCP session, and updates the sequence number value in the locally stored TCP session rules.
[0016] In another implementation of the present invention, the hardware module receives a new TCP session rule issued by the software module and records the sequence number value in the TCP session rule of the hardware module as the value in the synchronization instruction.
[0017] In another implementation of the present invention, before the network controller modifies the actions of the TCP session rules in the software module, the method further includes: the hardware module processes subsequent network traffic of the TCP session based on the TCP session rules, records the sequence number of the most recently forwarded TCP session, and updates the sequence number value in the locally stored TCP session rules.
[0018] According to a second aspect of the present invention, an apparatus for executing a TCP session sequence number software-hardware synchronization method is provided, applied to a DPU network forwarding engine. The network forwarding engine includes a software module and a hardware module, and data packets are forwarded in a pipelined manner in the network forwarding engine. The software module receives TCP session rules from a network controller. The hardware module obtains the TCP session rules from the software module through a UPCALL mechanism and forwards data packets, wherein the sequence number value of the TCP session in both the software module and the hardware module is the sequence number value carried by the first TCP data packet. When the network controller modifies the action of the TCP session rule in the software module, the software module receives a new TCP session rule from the network controller, the new TCP session rule indicating that the action of the TCP session rule has been updated. The software module sends a deletion command to the hardware module to delete the TCP session rule, and receives the sequence number value carried by the data packet of the most recent TCP session returned by the hardware module, enabling the software module to determine a new sequence number value for the current TCP session based on the return value. When subsequent data packets of the TCP session re-trigger the UPCALL mechanism, the hardware module obtains the new TCP session rule and its corresponding sequence number value.
[0019] According to a third aspect of the present invention, an electronic device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, wherein the executable instruction causes the processor to perform an operation corresponding to the method described in the first aspect.
[0020] According to a fourth aspect of the present invention, a computer storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0021] In an embodiment of the present invention, when the software module sends a deletion instruction to the hardware module, it can receive the sequence number of the previous TCP session sequence returned by the hardware module. Then, it can determine the sequence number of the current TCP session sequence based on the sequence number of the previous TCP session sequence, and perform CT session checking based on the sequence number of the current TCP session sequence. This achieves synchronization of key information such as the TCP session sequence number between the software module and the hardware module, thereby solving the problem of session tracking function failure caused by the asynchronous sequence numbers in the software and hardware when the TCP session is forwarded in the DPU network forwarding engine. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0023] Figure 1 This is a schematic block diagram of a network forwarding engine in a DPU according to some embodiments of the present invention.
[0024] Figure 2A This is a schematic block diagram illustrating the distribution of session rules in some embodiments of the present invention.
[0025] Figure 2B This is a schematic block diagram illustrating the upcall mechanism in the session rule issuance process of some embodiments of the present invention.
[0026] Figure 2C This is a schematic block diagram of the UPCALL and FLOW MODIFY processes in some embodiments of the present invention.
[0027] Figure 2D This is a schematic diagram of the TCP session sequence number checking mechanism in some embodiments of the present invention.
[0028] Figure 3 This is a flowchart illustrating the steps of a method for soft and hard synchronization of TCP session sequence numbers in a DPU according to some embodiments of the present invention.
[0029] Figure 4A for Figure 3 A flowchart illustrating the steps of a specific example of the TCP session sequence number hardware and software synchronization method in this embodiment.
[0030] Figure 4B for Figure 4A A diagram illustrating the changes in session rules during various forwarding stages in the TCP session sequence number soft and hard synchronization method.
[0031] Figure 5 According to other embodiments of the present invention Figure 3 A structural block diagram of the apparatus for implementing the method.
[0032] Figure 6 This is a schematic diagram of the structure of an electronic device according to other embodiments of the present invention. Detailed Implementation
[0033] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art should fall within the protection scope of the present invention.
[0034] Figure 3 This is a flowchart illustrating the steps of a method for soft and hard synchronization of TCP session sequence numbers in a DPU according to some embodiments of the present invention. Figure 3 The TCP session sequence number software and hardware synchronization method is applied to the DPU network forwarding engine. The DPU network forwarding engine includes software and hardware modules. Data packets are forwarded in a pipeline manner in the DPU network forwarding engine. The software and hardware synchronization methods include:
[0035] S310: The software module receives TCP session rules from the network controller.
[0036] S320: The hardware module obtains the TCP session rules from the software module through the UPCALL mechanism and forwards the data packets. The sequence number value of the TCP session in both the software module and the hardware module is the sequence number value carried in the first TCP data packet.
[0037] S330: When the network controller modifies the actions of the TCP session rules in the software module, the software module receives the new TCP session rules from the network controller. The new TCP session rules indicate the update of the actions of the TCP session rules.
[0038] S340: The software module sends a deletion command to the hardware module to delete the TCP session rule, and receives the sequence number value carried by the data packet of the most recent TCP session returned by the hardware module, so that the software module can determine the new sequence number value of the current TCP session based on the return value.
[0039] S350: When subsequent packets in a TCP session trigger the UPCALL mechanism again, the hardware module obtains the new TCP session rules and their corresponding sequence number values.
[0040] In this embodiment of the invention, when the software module sends a deletion command to the hardware module, it can receive the sequence number of the previous TCP session sequence returned by the hardware module. Then, it can determine the sequence number of the current TCP session sequence based on the sequence number of the previous TCP session sequence, and perform CT session check based on the sequence number of the current TCP session sequence. This realizes the synchronization of key information such as the TCP session sequence number between the software module and the hardware module, thereby solving the problem of session tracking function check failure caused by the asynchronous sequence numbers in the software and hardware when the TCP session is forwarded in the DPU network forwarding engine.
[0041] The following will combine Figure 4A and Figure 4B A method for soft and hard synchronization of TCP session sequence numbers according to some embodiments of the present invention is described in further detail. This includes:
[0042] S410: During the initialization phase, the software module obtains the TCP session rules from the network controller.
[0043] S420: When the first packet of a TCP session arrives at the DPU network forwarding engine, according to the UPCALL mechanism, the packet is processed by the software module, which then distributes the TCP session rules to the hardware. During the software module's processing, the packet undergoes a TCP session sequence number check by the CT module, at which point it passes. The specific process for distributing the rules to the hardware is as follows: the software issues an instruction like `match = xxx, action(xxx)`; `action(xxx)` includes a `sync` instruction. For example, the `sync` instruction for the TCP session rules is: `(type = sync, value = seq)`, where `seq` is the TCP sequence number carried by the first packet, typically 0.
[0044] S430: The hardware module receives TCP session rules and stores the synchronization instructions within those rules. For example... Figure 4B During the initialization phase shown, the hardware module receives the initial session rule (i.e., the old session rule): match = xxx, action(xxx, sync). Since no TCP session sequence is forwarded, the recorded TCP sequence number is the initial value issued by the software, such as 0.
[0045] S440: Subsequent network traffic for a TCP session is handled by hardware. The hardware module records the sequence number of the most recently forwarded TCP session and updates the sequence number value in the locally stored TCP session rule. For example... Figure 4BAs shown, after forwarding 100 TCP session sequences, the sequence number of the most recent TCP session sequence recorded is: seq=100.
[0046] S450: When the network controller modifies the TCP session rules in the software module, the software module, according to the FLOWMODIFY mechanism, replaces the previous TCP session rules with the modified ones and sends a deletion command to the hardware module. For example, a modified session rule could be: match = xxx, action(xxx, yyy, sync).
[0047] S460: The hardware module responds to the delete command issued by the software module, deletes the TCP session rule in the hardware module, and sends the most recent TCP session sequence number back to the software module via the sync command. For example... Figure 4B In the flow_mod phase, the initial session rule is deleted: match = xxx, action(xxx, sync), and the sequence number of the most recent TCP session is returned via the sync instruction, i.e., the sync instruction is (type = sync, value = 100).
[0048] S470: The software module receives the sync command returned by the hardware module and extracts its value as the sequence number value in the TCP session rules of the software module. For example... Figure 4B In the flow_mod phase shown, the sequence number of the TCP session is updated: seq = 100.
[0049] S480: As subsequent packets of this TCP session continue to arrive at the DPU network forwarding engine, they will continue to be processed according to the UPCALL mechanism. For example... Figure 4B In the flow_mod phase shown, the software module continues to process incoming data packets and sends a TCP session rule `match = xxx, action(xxx, yyy, sync)` to the hardware module. During the software module's continued processing of data packets for this TCP session, the CT session check module obviously checks the packet and updates it to the most recent TCP session sequence number, for example, `seq = 101` in the diagram. The `sync` instruction in the TCP session rule sent by the software module to the hardware module is specifically `(type = sync, value = 101)`.
[0050] S490: The hardware module receives new TCP session rules from the software module and records the sequence number value in the hardware TCP session rule as the value in the sync instruction. For example, the hardware module uses the following session rule for forwarding: match = xxx, action(xxx, yyy, sync), where the sequence number value is 101.
[0051] S495: Subsequent packets in this TCP session continue to be forwarded by the hardware, and the seq value continues to be updated. The subsequent steps are the same as above.
[0052] Figure 5 This is an apparatus for performing a TCP session sequence number soft and hard synchronization method according to other embodiments of the present invention. Figure 5 The network forwarding engine includes software module 510 and hardware module 520. Data packets are forwarded in a pipeline manner by the network forwarding engine.
[0053] Software module 510 receives TCP session rules from the network controller.
[0054] Hardware module 520 obtains TCP session rules from software module 510 through the UPCALL mechanism and forwards data packets. The sequence number values of the TCP sessions in both software module 510 and hardware module 520 are the sequence number values carried in the first TCP data packet.
[0055] When the network controller modifies the actions of the TCP session rules in software module 510, software module 510 receives the new TCP session rules from the network controller. The new TCP session rules indicate that the actions of the TCP session rules should be updated.
[0056] The software module 510 sends a deletion command to the hardware module 520 to delete the TCP session rule, and receives the sequence number value carried by the data packet of the most recent TCP session returned by the hardware module 520, so that the software module 510 can determine the new sequence number value of the current TCP session based on the return value.
[0057] When subsequent packets in a TCP session trigger the UPCALL mechanism again, the hardware module 520 obtains the new TCP session rules and their corresponding sequence number values.
[0058] In the solution of this embodiment of the invention, when the software module sends a deletion command to the hardware module, it can receive the sequence number of the previous TCP session sequence returned by the hardware module. Then, it can determine the sequence number of the current TCP session sequence based on the sequence number of the previous TCP session sequence, and perform CT session check based on the sequence number of the current TCP session sequence. The synchronization of key information such as the TCP session sequence number is realized between the software module and the hardware module, thereby solving the problem of session tracking function check failure caused by the asynchronous sequence numbers in the software and hardware when the TCP session is forwarded in the DPU network forwarding engine.
[0059] In other examples, receiving the sequence number value carried by the data packet of the most recent TCP session returned by the hardware module includes: the software module receiving the synchronization instruction returned by the hardware module and extracting the sequence number value carried by the data packet of the most recent TCP session.
[0060] In other examples, the software module configures the synchronization instruction in the TCP session rules; the software module issues the TCP session rules to the hardware module.
[0061] In other examples, the hardware module receives the TCP session rules and stores the synchronization instructions in the TCP session rules.
[0062] In other examples, the hardware module processes subsequent network traffic of a TCP session based on new TCP session rules, records the sequence number of the most recently forwarded TCP session, and updates the sequence number value in the locally stored TCP session rule.
[0063] In other examples, the hardware module receives new TCP session rules issued by the software module and records the sequence number value in the hardware module's TCP session rules as the value in the synchronization instruction.
[0064] In other examples, before the network controller modifies the TCP session rules in the software module, the hardware module processes subsequent network traffic of the TCP session based on the TCP session rules, records the sequence number of the most recently forwarded TCP session, and updates the sequence number value in the locally stored TCP session rules.
[0065] The specific implementations of the software and hardware modules in the device can be found in the descriptions of the corresponding steps in the above method embodiments, which also have corresponding beneficial effects, and will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the device and modules described above can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be repeated here.
[0066] Reference Figure 6 The diagram shows a structural schematic of an electronic device according to another embodiment of the present invention. The specific embodiments of the present invention do not limit the specific implementation of the electronic device.
[0067] like Figure 6 As shown, the electronic device may include: a processor 602 for executing program 610, a communications interface 604, a memory 606, and a communications bus 608.
[0068] The processor, communication interface, and memory communicate with each other via a communication bus.
[0069] A communication interface is used to communicate with other electronic devices or servers.
[0070] The processor is used to execute programs, specifically the relevant steps in the above method embodiments.
[0071] Specifically, the program may include program code, which includes computer operation instructions.
[0072] The processor may be a CPU, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The one or more processors included in a smart device may be of the same type, such as one or more CPUs; or they may be of different types, such as one or more CPUs and one or more ASICs.
[0073] Memory is used to store programs. Memory may include high-speed RAM, and may also include non-volatile memory, such as at least one disk drive.
[0074] The program may include multiple computer instructions, and specifically, the program may use multiple computer instructions to cause the processor to execute the operation corresponding to the TCP session sequence number soft and hard synchronization method in the DPU network forwarding engine described in any of the aforementioned method embodiments.
[0075] The specific implementation of each step in the program can be found in the corresponding descriptions of the steps and units in the above method embodiments, which have corresponding beneficial effects, and will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the devices and modules described above can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be repeated here.
[0076] This invention also provides a computer storage medium storing a computer program thereon, which, when executed by a processor, implements the method described in any of the foregoing method embodiments. The computer storage medium includes, but is not limited to, compact disc read-only memory (CD-ROM), random access memory (RAM), floppy disk, hard disk, or magneto-optical disk.
[0077] This invention also provides a computer program product, including computer instructions that instruct a computing device to perform the operation corresponding to the soft and hard synchronization of TCP session sequence numbers in the DPU network forwarding engine of the above-described multiple method embodiments.
[0078] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of the present invention can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present invention.
[0079] The methods described above according to embodiments of the present invention can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium and subsequently stored in a local recording medium, downloaded via a network. Thus, the methods described herein can be stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an Application Specific Integrated Circuit (ASIC) or a Field Programmable Gate Array (FPGA)). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., random access memory (RAM), read-only memory (ROM), flash memory, etc.) capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods described herein. Furthermore, when a general-purpose computer accesses code used to implement the methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the methods shown herein.
[0080] Those skilled in the art will recognize that the units and method steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the embodiments of the present invention.
[0081] The above embodiments are only used to illustrate the embodiments of the present invention, and are not intended to limit the embodiments of the present invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of the present invention, and the patent protection scope of the embodiments of the present invention should be defined by the claims.
Claims
1. A method for soft and hard synchronization of TCP session sequence numbers in a DPU, characterized in that, Applied to a DPU network forwarding engine, the DPU network forwarding engine includes software and hardware modules, and data packets are forwarded in a pipeline manner within the DPU network forwarding engine. The method includes: The software module receives TCP session rules from the network controller; The hardware module obtains TCP session rules from the software module and forwards data packets through the UPCALL mechanism. The sequence number value of the TCP session in both the software module and the hardware module is the sequence number value carried by the first TCP data packet. When the network controller modifies the action of the TCP session rule in the software module, the software module receives the new TCP session rule from the network controller, and the new TCP session rule indicates that the action of the TCP session rule is updated. The software module sends a deletion command to the hardware module to delete the TCP session rule, and receives the sequence number value carried by the data packet of the most recent TCP session returned by the hardware module, so that the software module can determine the new sequence number value of the current TCP session based on the return value. When subsequent packets in the TCP session re-trigger the UPCALL mechanism, the hardware module obtains the new TCP session rules and their corresponding sequence number values.
2. The method according to claim 1, characterized in that, The sequence number value carried in the data packet of the most recent TCP session returned by the hardware module includes: The software module receives the synchronization command returned by the hardware module and extracts the sequence number value carried in the data packet of the most recent TCP session.
3. The method according to claim 2, characterized in that, The method further includes: The software module configures the synchronization command in the TCP session rules; The software module sends the TCP session rules to the hardware module.
4. The method according to claim 3, characterized in that, The method further includes: The hardware module receives the TCP session rules and stores the synchronization instructions in the TCP session rules.
5. The method according to claim 4, characterized in that, The method further includes: The hardware module processes subsequent network traffic of a TCP session based on the new TCP session rules, records the sequence number of the most recently forwarded TCP session, and updates the sequence number value in the locally stored TCP session rules.
6. The method according to claim 4, characterized in that, The method further includes: The hardware module receives the new TCP session rule issued by the software module and records the sequence number value in the TCP session rule of the hardware module as the value in the synchronization instruction.
7. The method according to claim 1, characterized in that, Before the network controller modifies the actions of the TCP session rules in the software module, the method further includes: The hardware module processes subsequent network traffic of the TCP session based on the TCP session rules, records the sequence number of the most recently forwarded TCP session, and updates the sequence number value in the locally stored TCP session rules.
8. An apparatus for executing a method for soft and hard synchronization of TCP session sequence numbers in a DPU, characterized in that, Applied to the DPU network forwarding engine, the network forwarding engine includes software modules and hardware modules, and data packets are forwarded in a pipeline manner in the network forwarding engine; The software module receives TCP session rules from the network controller; The hardware module obtains TCP session rules from the software module and forwards data packets through the UPCALL mechanism. The sequence number value of the TCP session in both the software module and the hardware module is the sequence number value carried by the first TCP data packet. When the network controller modifies the action of the TCP session rule in the software module, the software module receives the new TCP session rule from the network controller, and the new TCP session rule indicates that the action of the TCP session rule is updated. The software module sends a deletion command to the hardware module to delete the TCP session rule, and receives the sequence number value carried by the data packet of the most recent TCP session returned by the hardware module, so that the software module can determine the new sequence number value of the current TCP session based on the return value. When subsequent packets in the TCP session re-trigger the UPCALL mechanism, the hardware module obtains the new TCP session rules and their corresponding sequence number values.
9. An electronic device, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform an operation corresponding to the method according to any one of claims 1-7.
10. A computer storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1-7.