Method and apparatus for processing tcp mirror data, chip and medium

By constructing a buffer using an FPGA chip and utilizing a heterogeneous architecture to reorder TCP mirrored data, the problem of high CPU load was solved, and low-latency data transmission and stable out-of-order reordering were achieved.

CN120128594BActive Publication Date: 2026-01-13YUSUR TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510318185.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-18
Publication Date
2026-01-13
Estimated Expiration
2045-03-18

Smart Images

  • Figure CN120128594B_ABST
    Figure CN120128594B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a TCP mirror data processing method, device, chip and medium, wherein the method comprises: constructing a second buffer in the FPGA chip when it is determined according to a first current TCP mirror packet that a preset TCP reconnection condition is met; when the first buffer contains a target TCP mirror packet to be output, opening the read interface of the first buffer and the write interface of the second buffer, and closing the read interface of the second buffer and the write interface of the first buffer; when the first buffer does not contain a target TCP mirror packet to be output, closing the read interface of the first buffer and opening the read interface of the second buffer, and sending the corresponding TCP mirror packet to the server through the read interface of the second buffer. In this technical solution, the out-of-order rearrangement processing based on the heterogeneous structure is realized, and it is ensured that the normal out-of-order rearrangement operation is not affected during the reconnection, the smooth transition is realized, and the continuity and integrity of the out-of-order rearrangement processing are ensured, thereby improving the reliability and stability of the heterogeneous structure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of communication technology, and in particular to a method, apparatus, chip, and medium for processing TCP mirrored data. Background Technology

[0002] Transmission Control Protocol (TCP) network packets may experience varying delays during transmission due to interference from the transmission environment, resulting in out-of-order TCP network packets received by the Central Processing Unit (CPU). Therefore, reordering TCP network packets before sending them to the backend is a common communication scenario.

[0003] In related technologies, the received TCP network packets are reordered in the CPU of the server. However, in high-speed network environments, the number of TCP network packets is large. The CPU needs to build a corresponding buffer to store the TCP network packets and perform reordering on them, which leads to high CPU utilization. When the CPU utilization is high, the efficiency of reordering may be low, which cannot meet the low-latency transmission requirements of TCP network packets in communication scenarios. Summary of the Invention

[0004] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a method, apparatus, chip, and medium for processing TCP mirrored data.

[0005] This disclosure provides a method for processing TCP mirrored data. The method is applied to an FPGA chip, which is connected to a server via a preset bus interface. A first buffer is pre-built in the FPGA chip, whereby the first buffer stores the target TCP mirrored packet of the original TCP connection corresponding to the server. The FPGA chip obtains the corresponding TCP mirrored packet through a preset network interface and / or the bus interface. The method includes the following steps: in response to obtaining a first current TCP mirrored packet, determining whether a preset TCP reconnection condition is met based on the first current TCP mirrored packet; when the preset TCP reconnection condition is met, building a second buffer in the FPGA chip, and... The system identifies whether the first buffer contains the target TCP image packet to be output. If the first buffer contains the target TCP image packet to be output, the system opens the read interface of the first buffer and the write interface of the second buffer, and closes the read interface of the second buffer and the write interface of the first buffer. The corresponding TCP image packet is sent to the server through the read interface, and the corresponding TCP image packet is written to the corresponding buffer through the write interface. If the first buffer does not contain the target TCP image packet to be output, the system closes the read interface of the first buffer and opens the read interface of the second buffer to send the corresponding TCP image packet to the server through the read interface of the second buffer.

[0006] This disclosure provides a TCP mirroring data processing apparatus applied to an FPGA chip. The FPGA chip is connected to a server via a preset bus interface. A first buffer is pre-built in the FPGA chip, wherein the first buffer is used to store the target TCP mirroring packet of the original TCP connection corresponding to the server. The FPGA chip obtains the corresponding TCP mirroring packet through a preset network interface and / or the bus interface. The apparatus includes: a first determining module, used to determine whether a preset TCP reconnection condition is met based on the first current TCP mirroring packet in response to obtaining the first current TCP mirroring packet; a building module, used to build a second buffer in the FPGA chip when the preset TCP reconnection condition is met; and an identification module, used to identify... The interface processing module is configured to: 1) determine whether the first buffer contains the target TCP image packet to be output; 2) enable the read interface of the first buffer and the write interface of the second buffer, and disable the read interface of the second buffer and the write interface of the first buffer when the first buffer contains the target TCP image packet to be output, wherein the corresponding TCP image packet is sent to the server through the read interface, and the corresponding TCP image packet is written to the corresponding buffer through the write interface; 3) further configure the interface processing module to: 1) disable the read interface of the first buffer and enable the read interface of the second buffer when the first buffer does not contain the target TCP image packet to be output, so as to send the corresponding TCP image packet to the server through the read interface of the second buffer.

[0007] This disclosure also provides an FPGA chip, which is connected to a server via a preset bus interface. A first buffer is pre-built in the FPGA chip, wherein the first buffer is used to store the target TCP image packet of the original TCP connection corresponding to the server. The FPGA chip obtains the corresponding TCP image packet through a preset network interface and / or the bus interface. The FPGA chip is used to execute the above-mentioned TCP image data processing method.

[0008] This disclosure also provides a computer-readable storage medium storing a computer program for executing the TCP mirroring data processing method provided in this disclosure.

[0009] The technical solution provided in this disclosure has the following advantages compared with the prior art:

[0010] The TCP mirroring data processing method of this disclosure embodiment, in response to obtaining a first current TCP mirroring packet, determines whether a preset TCP reconnection condition is met based on the first current TCP mirroring packet. When the preset TCP reconnection condition is met, a second buffer is constructed in the FPGA chip, and it is identified whether the first buffer contains a target TCP mirroring packet to be output. When the first buffer contains a target TCP mirroring packet to be output, the read interface of the first buffer and the write interface of the second buffer are opened, and the read interface of the second buffer and the write interface of the first buffer are closed. The corresponding TCP mirroring packet is sent to the server through the read interface, and the corresponding TCP mirroring packet is written to the corresponding buffer through the write interface. Then, in response to the first buffer not containing a target TCP mirroring packet to be output, the read interface of the first buffer is closed, and the read interface of the second buffer is opened, so that the corresponding TCP mirroring packet is sent to the server through the read interface of the second buffer. This technical solution implements out-of-order reordering processing based on a heterogeneous structure, and ensures that normal out-of-order reordering operations are not affected during reconnection, achieving a smooth transition and ensuring the continuity and integrity of out-of-order reordering processing, thereby improving the reliability and stability of the heterogeneous structure. Attached Figure Description

[0011] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0012] Figure 1 This is a deployment architecture diagram of a TCP mirror data processing system provided in an embodiment of the present disclosure;

[0013] Figure 2 A flowchart illustrating a method for processing TCP mirrored data provided in an embodiment of this disclosure;

[0014] Figure 3 This is a schematic diagram illustrating a TCP mirroring data processing scenario provided by an embodiment of the present disclosure;

[0015] Figure 4 This is a deployment architecture diagram of another TCP mirror data processing system provided in an embodiment of the present disclosure;

[0016] Figure 5 This is a schematic diagram illustrating another TCP mirror data processing scenario provided by an embodiment of this disclosure;

[0017] Figure 6 A flowchart illustrating another method for processing TCP mirrored data provided in this embodiment of the disclosure;

[0018] Figure 7This is a schematic diagram illustrating another TCP mirror data processing scenario provided by an embodiment of this disclosure;

[0019] Figure 8 A flowchart illustrating another method for processing TCP mirrored data provided in this embodiment of the disclosure;

[0020] Figure 9 This is a schematic diagram illustrating another TCP mirror data processing scenario provided by an embodiment of this disclosure;

[0021] Figure 10 This is a schematic diagram illustrating another TCP mirror data processing scenario provided by an embodiment of this disclosure;

[0022] Figure 11 A flowchart illustrating another method for processing TCP mirrored data provided in this embodiment of the disclosure;

[0023] Figure 12 This is a schematic diagram illustrating another TCP mirror data processing scenario provided by an embodiment of this disclosure;

[0024] Figure 13 This is a schematic diagram illustrating another TCP mirror data processing scenario provided by an embodiment of this disclosure;

[0025] Figure 14 This is a schematic diagram of a TCP mirror data processing device provided in an embodiment of the present disclosure. Detailed Implementation

[0026] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0027] It should be understood that the various steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect. The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the description below.

[0028] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules, or units, and are not used to limit the order of functions performed by these devices, modules, or units or their interdependencies. It should also be noted that the modifications of "a" and "a plurality of" mentioned in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0029] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0030] To address the aforementioned issues, this disclosure proposes a technical solution for processing TCP network packets using a heterogeneous architecture based on a Field Programmable Gate Array (FPGA) chip. In this solution, a TCP mirror packet of the TCP network packet is obtained, replacing the existing CPU-based out-of-order processing with a hardware-friendly out-of-order reordering method. The obtained packet is a TCP mirror packet of the TCP network packet, meaning that the corresponding TCP mirror packet is obtained by copying the TCP network packet. This allows for data reordering of the TCP mirror packet without being affected by the TCP transmission protocol, thus bypassing the CPU's out-of-order reordering task and bridging the relevant protocol stack.

[0031] Among them, reference Figure 1 The server includes a CPU and corresponding memory space. The TCP mirroring data processing method can be executed by an FPGA chip. The FPGA chip can be regarded as an acceleration card that reorders TCP network packets. Specifically, executable code for executing the TCP mirroring data processing method can be written in the FPGA chip. This executable code can exist as an acceleration core in the acceleration card. The FPGA chip is connected to the server through a bus interface, which can be a standard PCIe interface, etc. The PCIe interface is a type of PCI computer bus. It adopts the existing PCI programming concept and communication standard, but is based on a faster serial communication system. The FPGA chip may also include a network interface. The FPGA chip can obtain TCP mirror packets of relevant TCP network packets in the current network environment through the network interface or the bus interface with the server.

[0032] The method for processing TCP mirrored data according to embodiments of this disclosure will be described below with reference to specific examples. Figure 2This is a flowchart illustrating a method for processing TCP mirrored data according to an embodiment of the present disclosure. This method can be executed by a TCP mirrored data processing device, which can be implemented in software and / or hardware, and is generally integrated into an FPGA chip, such as... Figure 2 As shown, the method includes:

[0033] Step 201: Obtain the reference TCP 5-tuple for the current TCP connection from the server, and obtain candidate TCP image packets.

[0034] In one embodiment of this disclosure, the server can issue a reference TCP 5-tuple for the current TCP connection via a bus interface. In this embodiment, candidate TCP image packets for TCP connections in the network environment can be directly transmitted to the accelerator card via the bus interface or a network interface. That is, in some possible examples, candidate TCP image packets are obtained through a preset network interface; in this embodiment, the accelerator card directly reads the corresponding candidate TCP image packets in the network environment.

[0035] In some possible examples, mirrored packets in the CPU can be copied to obtain candidate TCP mirrored packets, which can then be retrieved via the bus interface.

[0036] Step 202: Filter candidate TCP image packets based on the reference TCP 5-tuple to obtain the target TCP image packet corresponding to the current TCP connection.

[0037] Since the obtained TCP mirror packets may originate from multiple TCP connections, in one embodiment of this disclosure, candidate TCP mirror packets are filtered based on a reference TCP 5-tuple to obtain the target TCP mirror packet corresponding to the current TCP connection. The current TCP connection can be understood as a TCP connection currently undergoing out-of-order reordering by the server. The TCP 5-tuple refers to the five parameters used to uniquely identify a TCP connection in TCP / IP network communication. These five parameters include the source IP address, source port, destination IP address, destination port, and transport layer protocol. The following is a detailed description of each parameter, where the data packets mentioned below can be the corresponding TCP mirror packets:

[0038] Source IP Address

[0039] The source IP address is the IP address of the host that sent the data packet. In network communication, it is used to identify the sender of the data packet. The source IP address is represented by a 32-bit unsigned integer (UINT32) and occupies 4 bytes in memory.

[0040] Source Port

[0041] The source port is used to identify the application or service sending the data packet. Under the same IP address, different applications use different port numbers to communicate. The source port is represented by a 16-bit unsigned integer (UINT16) and occupies 2 bytes in memory.

[0042] Destination IP Address

[0043] The destination IP address is the IP address of the host that receives the data packet. In network communication, it is used to identify the receiving end of the data packet. The destination IP address is represented using a 32-bit unsigned integer (UINT32) and occupies 4 bytes in memory.

[0044] Destination Port

[0045] The destination port is used to identify the application or service receiving the data packet. Different applications use different port numbers to communicate under the same IP address. The destination port is represented as a 16-bit unsigned integer (UINT16) and occupies 2 bytes in memory.

[0046] Transport Protocol

[0047] Transport layer protocols are used to identify the type of transport protocol used by data packets, such as TCP (protocol number 6) or UDP (protocol number 17). Different protocols handle data packets differently in network communication. A transport layer protocol is represented by an 8-bit unsigned integer (UINT8) and occupies 1 byte of memory.

[0048] As shown in Table 1 below, in some possible embodiments, the FPGA chip can be configured as an acceleration core to provide a corresponding reference TCP 5-tuple, where the 32-bit IP address is separated by 8 bits, and the value of the 5-tuple can be 0, indicating that the condition is ignored. The acceleration core will then filter target TCP image packets that match the configured reference TCP 5-tuple.

[0049] As shown in the example in Table 1, only candidate TCP mirror packets that meet the following conditions can pass the filtering: the source IP must be 172.24.16.35, the source PORT must be 19999, and the transport layer protocol must be TCP. Any destination IP and destination PORT that meet these conditions will also pass the filtering criteria.

[0050] Table 1

[0051]

[0052] Of course, in one embodiment of this disclosure, the obtained TCP image packets may come from TCP packets during handshakes or handshakes. Therefore, in order to further ensure that the source of the candidate TCP image packets corresponds to the corresponding TCP connection, in this embodiment, the header of the candidate TCP image packets can also be read, and the PSH value of the candidate TCP image packets can be determined based on the header. Only when the PSH value is 1 will the corresponding candidate TCP image packets be filtered, and candidate TCP image packets with a PSH value of 0 will be filtered directly.

[0053] It should be noted that, in the specific implementation process, different methods can be used to filter candidate TCP mirror packets based on the reference TCP 5-tuple, depending on the application scenario. An example is illustrated below:

[0054] In some possible examples, a reference TCP 5-tuple is configured in the FPGA chip, that is, the initialization configuration work is performed in the FPGA chip. The reference TCP 5-tuple includes the source IP address, source port, destination IP address, destination port, and transport layer protocol. Candidate TCP mirror packets are filtered based on the configured reference TCP 5-tuple to obtain the filtered target TCP mirror packets corresponding to the current TCP connection.

[0055] In some possible examples, filtering of candidate TCP image packets can be implemented using a state machine. In this example, a preset state machine is constructed, and in this embodiment, the relevant input data can be shifted and stored in a buffer variable of the preset state machine. This buffer variable is large enough to hold the 5-tuple portion of the TCP protocol.

[0056] In the initialization state, the acceleration core continuously matches the reference TCP 5-tuple based on the buffer variable; this is a sliding matching process. If a match is successful, the body length and header length of the target TCP image packet are recorded, and the time required to start outputting the body data of the target TCP image packet is calculated. Then, the core enters a locked and waiting state.

[0057] While waiting for the body data of the target TCP image packet based on the waiting time, the acceleration core will jump to the output state after the wait is completed. In the output state, the acceleration core will integrate and output the target TCP image packet according to the pre-recorded body length of the target TCP image packet.

[0058] That is, in this embodiment, such as Figure 3As shown, when the preset state machine corresponding to the reference TCP 5-tuple is in the open state (for example, taking the state bit as locked, when locked is 0, it is determined that the preset state machine is in the open state), a candidate TCP image packet is obtained. The TCP 5-tuple of the candidate TCP image packet is then subjected to sliding matching with the reference TCP 5-tuple. In response to a successful match, the state bit of the preset state machine is updated to the locked state (for example, taking the state bit as locked, when locked is 1, it is determined that the preset state machine is in the locked state). The candidate TCP image packet is then read from the end position of the sliding matching. For example, it can be based on the protocol header of the candidate TCP image packet. The process involves acquiring and recording the body length and header length of candidate TCP image packets, determining the remaining number of bytes to be read based on the end position of the sliding match, determining the remaining waiting time based on the number of bytes to be read, and continuing to read the headers of the remaining candidate TCP image packets within this waiting time. After the waiting period, the process reads the body data of the candidate TCP image packets, integrates the read body data, and sends the candidate TCP image packets to a preset buffer for out-of-order reordering. If the length of the read body data of a candidate TCP image packet matches the pre-recorded body length, the state bit of the preset state machine is updated to the enabled state bit.

[0059] Step 203: Reorder the target TCP image packet and send the reordered target TCP image packet to the server.

[0060] In one embodiment of this disclosure, the acquired target TCP image packets are reordered, and the reordered target TCP image packets are sent to the server. Since the reordering occurs within a heterogeneous FPGA chip, the task of reordering the CPU in the server is offloaded, significantly reducing CPU utilization and improving reordering efficiency.

[0061] In this embodiment, refer to Figure 4 The acceleration core in the FPGA chip can generate two functional modules based on pre-encoded values. One module is a 5-tuple filtering module, which filters the acquired candidate TCP image packets based on the input reference TCP 5-tuple. After filtering out the target TCP image packets that match the reference TCP 5-tuple, the packets proceed to the other module—the reordering module. This module reorders the acquired target TCP image packets and sends the reordered packets to the server. The reordering module provides a read interface, allowing the server to read the reordered target TCP image packets.

[0062] In one embodiment of this disclosure, to facilitate data rereading by the server, the target ISN number of the target TCP image packet can be determined, and the data length (payload length) of the data content of the target TCP image packet can be determined. A protocol header of the target TCP image packet is generated based on the target ISN number and the data length. The target TCP image packet is updated based on the protocol header and the data content (payload). Then, the updated target TCP image packet is sent to the server. The format of the updated target TCP image packet is: custom protocol header (ISN number + payload length) + payload content.

[0063] The server can quickly determine whether the target TCP image packet after FPGA reordering is accurate based on the custom protocol header of the updated target TCP image packet, and quickly locate the payload content based on the payload length, which improves the server's processing convenience, simplifies the CPU processing logic, and further reduces the CPU resource utilization.

[0064] In one embodiment of this disclosure, when the server determines that the ISN number is out of order based on the custom protocol header of the updated target TCP image packet, it can quickly issue an alarm to facilitate the rapid detection of out-of-order reordering issues and ensure the reliability and integrity of the sent target TCP image packet.

[0065] For example, in this embodiment, if the source IP is 172.24.16.35, the source PORT is 19999, and the transport layer protocol is TCP in the reference TCP 5-tuple of the current TCP connection during initialization, then the seven candidate TCP image packets obtained are shown in Table 2 below:

[0066] Table 2

[0067]

[0068] During the filtering process for the candidate TCP mirror packets, candidate TCP mirror packets with sequence numbers 1, 2, and 3 are filtered out based on the reference TCP 5-tuple and the PAH value. Candidate TCP mirror packet 1 is filtered because its protocol type does not match the reference TCP 5-tuple; candidate TCP mirror packet 2 is filtered because its PSH bit is not 1; and candidate TCP mirror packet 3 is filtered because its source IP does not match the reference TCP 5-tuple. The reordering results of the filtered candidate TCP mirror packets with sequence numbers 4, 7, 6, and 5 are shown in Table 3 below.

[0069] Table 3

[0070]

[0071] In this embodiment, the target TCP image packets in Table 3 can be sent to the server in the format of a custom protocol header (ISN number + payload length) + payload content. This preserves the necessary metadata in the target TCP image packets, ensuring that the reordered target TCP image packets can be accurately delivered to the backend system.

[0072] In summary, the TCP mirroring data processing method of this disclosure involves the FPGA chip obtaining a reference TCP 5-tuple for the current TCP connection from a server, acquiring candidate TCP mirroring packets, filtering the candidate TCP mirroring packets based on the reference TCP 5-tuple to obtain the target TCP mirroring packet corresponding to the current TCP connection, reordering the target TCP mirroring packet, and sending the reordered target TCP mirroring packet to the server. This technical solution, based on a heterogeneous architecture for TCP mirroring packet processing, reduces the CPU usage, improves the data processing efficiency of TCP mirroring packets, and meets the requirements for low-latency data transmission.

[0073] In actual execution, the out-of-order reordering module in the acceleration core handles the out-of-order problem of target TCP image packets. It receives out-of-order target TCP image packets and reorders them according to their sequence numbers (ISNs) to ensure that the output target TCP image packets are in order. A preset buffer for the current TCP connection is pre-built in the FPGA chip. The filtered target TCP image packets are stored in this preset buffer. The preset buffer's starting ISN is determined based on the target ISN of the first received target TCP image packet. Furthermore, the tail ISN is determined based on the storage space of the preset buffer set in the FPGA. The preset buffer is used to store TCP image packets within the corresponding ISN range.

[0074] For example, if the target ISN of the obtained TCP image packet is 500, and the preset buffer currently supports storing TCP image packets with ISNs ranging from 500 to 1500, then the target TCP image packet is written to the header of the preset buffer, and then the corresponding target TCP image packet is sent to the server. If the SEQ range corresponding to the TCP image packet is 500-600, then after sending the target TCP image packet, the preset buffer's currently supported ISN range is updated to 600-1600. That is, the preset buffer continuously updates the range of ISNs it can store until there is no more data written to the header buffer, at which point output stops.

[0075] Reference Figure 5If the ISN number corresponding to the current header buffer is 500, and the storage space of the preset buffer is 1001 bytes, then the buffer window size corresponding to the ISN number range is 500-1500. In this embodiment, when a target TCP image packet with ISN number 600 and length of 100 bytes is obtained, the target TCP image packet is written to the corresponding position in the buffer (the black dot in the figure represents the target TCP image packet written to the corresponding buffer). If a target TCP image packet with ISN number 900 and length of 100 bytes is obtained, the target TCP image packet is written to the corresponding position in the buffer. If a target TCP image packet with ISN number 500 and length of 100 bytes is further obtained, since the starting ISN number of the current header buffer is 500, target TCP image packets with ISN numbers from 500 to 700 are output, and the starting ISN number of the header buffer is updated to 700. At this time, the updated ISN number range is 700-1700.

[0076] The following describes a method for reordering TCP mirrored data according to specific embodiments of this disclosure. Figure 6 To provide another method for processing TCP mirrored data according to embodiments of this disclosure, a method for reordering TCP mirrored data is proposed, such as... Figure 6 As shown, the method includes:

[0077] Step 601: Identify the target ISN number of the target TCP image packet sent to the preset buffer, wherein the TCP 5-tuple of the target TCP image packet is consistent with the reference TCP 5-tuple of the current TCP connection.

[0078] It is understood that the target TCP image packet in this embodiment is filtered based on the filtering method described in the above embodiments. In this embodiment, the target ISN number of the target TCP image packet is extracted.

[0079] Step 602: Determine the starting ISN number corresponding to the preset buffer, and determine whether the target TCP image packet meets the preset sending conditions based on the starting ISN number and the target ISN number.

[0080] In this embodiment, the starting ISN number corresponding to the preset buffer is determined. As mentioned in the embodiments above, the starting ISN number is the ISN number corresponding to the next target TCP image packet to be sent. (Referring to...) Figure 5 The corresponding starting ISN number is 500, etc.

[0081] In this embodiment, it can be determined whether the starting ISN and the target ISN are consistent. If they are consistent, it is determined that the target TCP image packet meets the preset sending conditions, and thus, the target TCP image packet can be sent directly.

[0082] If the starting ISN and the target ISN are inconsistent, the target TCP image packet is written to the preset buffer based on the target ISN. That is, the starting position for writing is determined in the preset buffer based on the target ISN, and the corresponding target TCP image packet is written starting from that position. Continue to refer to... Figure 5 After obtaining the target TCP image packet with target ISN number 600 and length of 100 bytes, the target TCP image packet is written to the corresponding position of ISN number 600 in the buffer.

[0083] Step 603: When the preset sending conditions are met, send the corresponding target TCP image packet to the server.

[0084] In one embodiment of this disclosure, after a preset sending condition is met, a corresponding target TCP image packet is sent to the server. This target image packet is a reordered, forward-ordered target TCP image packet. In this embodiment, it is also determined whether the preset buffer contains other TCP image packets consecutively arranged with the target TCP image packet; for example, continuing to refer to… Figure 5 After obtaining the target TCP image packet with ISN number 500, since the corresponding target TCP image packet has also been written into the corresponding buffer for ISN numbers in the preset buffer range of 600-700, other TCP image packets, including the target TCP image packets with ISN numbers in the range of 600-700, are sent to the server. When other TCP image packets are present, the target TCP image packet and the other TCP image packets are sent to the server, ensuring sequential transmission. When no other TCP image packets are present (i.e., the corresponding TCP image packet is not written into the buffer for ISN numbers in the range of 600-700), the target TCP image packet is sent directly to the server.

[0085] After sending the target TCP image packet, the ISN number of the preset buffer also needs to be updated. In some possible embodiments, this preset buffer ISN update can be a complete update, determining the starting ISN number of the next target TCP image packet to be written to the preset buffer, updating the starting ISN number of the next target TCP image packet to be written to the starting ISN number of the preset buffer, that is, after updating the starting ISN number of the preset buffer, updating each other ISN number in turn, and continuing to refer to... Figure 5 After updating the starting ISN number of the preset buffer to 700, the subsequent ISN numbers are updated one by one, and the range of the updated ISN numbers is 700-1700.

[0086] In one embodiment of this disclosure, the preset buffer is a circular buffer. In the circular buffer, the pointer position of the preset pointer points to the corresponding starting ISN number, without needing to update subsequent ISN numbers one by one. In this embodiment, the pointer position of the preset pointer is read, and the starting ISN number corresponding to the preset buffer is determined according to the pointer position. When updating the preset buffer according to the updated starting ISN number and the tail ISN number, the pointer position of the preset pointer is directly updated to the buffer position corresponding to the updated starting ISN number, and the pointer position of the preset pointer is updated to the position of the starting ISN number of the next target TCP image packet to be written. The ISN number of the buffer corresponding to the sent target TCP image packet is updated with the next ISN number after the original tail ISN number of the preset buffer as the starting ISN number.

[0087] For example, refer to Figure 5 As shown, a preset pointer is set to identify the head of the preset buffer, starting from... Figure 5 After updating from ① to ②, the starting ISN number corresponding to the buffer header should change from 500 to 700. If the preset buffer is a circular buffer, the pointer is directly pointed to position 700 in ① as the header of the preset buffer. In this case, the ISN number corresponding to the end of the preset buffer's physical address remains the original 1500, while the ISN end of the preset buffer corresponding to the target TCP mirror packet sent before the pointer is 1700. In this way, the circular buffer can flexibly adjust its storage range, efficiently and effectively managing the reception and processing of out-of-order packets.

[0088] In some possible implementations, due to the limited size of the preset buffer, window overflow may occur. Window overflow refers to out-of-order TCP packets whose ISN exceeds the buffer's range. Window overflow is determined based on the ISN of the arriving related TCP mirror packet and the current buffer window range. That is, refer to... Figure 7 Assuming the current starting ISN is 500 and the ISN range is 500 to 1500, if the target ISN of the obtained target TCP image packet + data_len (i.e., the byte length of the obtained target TCP image packet) > 1500 (after windowing) or ISN < 500 (before windowing), it is determined to be windowing. In this embodiment, the target TCP image packet with windowing can be directly output. However, since the preset buffer may send out target TCP image packets after out-of-order rearrangement at this time.

[0089] To distinguish between windowed target TCP image packets and out-of-order reordered target TCP image packets, arbitration processing is required before the target TCP image packets are sent to the central processing unit. This involves determining whether the target TCP image packet to be sent is a windowed target TCP image packet. If it is, the windowed target TCP image packet is input to a preset arbitration module in the FPGA chip. The arbitration module then outputs the windowed target TCP image packet and the out-of-order reordered target TCP image packet sequentially to their respective output channels. In some possible examples, a first preset priority for the windowed target TCP image packet and a second preset priority for the out-of-order reordered target TCP image packet can be determined. The arbitration module then outputs the corresponding windowed target TCP image packet and out-of-order reordered target TCP image packet in descending order of priority.

[0090] In summary, the TCP mirroring data processing method of this disclosure identifies the target ISN number of the target TCP mirroring packet sent to a preset buffer, wherein the TCP 5-tuple of the target TCP mirroring packet is consistent with the reference TCP 5-tuple of the current TCP connection. It determines the starting ISN number corresponding to the preset buffer, and determines whether the target TCP mirroring packet meets preset sending conditions based on the starting ISN number and the target ISN number. If the preset sending conditions are met, the corresponding target TCP mirroring packet is sent to the server. In this technical solution, the out-of-order reordering of TCP mirroring packets is performed based on a heterogeneous architecture, reducing the CPU usage and improving the efficiency of out-of-order reordering of TCP mirroring packets, thus meeting the requirements for low-latency data transmission.

[0091] When reordering target TCP mirror packets, timeout issues may occur. For example, in the case of the aforementioned post-windowing scenario, the target TCP mirror packet from the post-windowing will be directly output. As the reordering progresses, the ISN number in the preset buffer is continuously updated until an exception occurs when the post-windowing target TCP mirror packet is needed as a normal-order target TCP mirror packet. At this point, because the target TCP mirror packet has already been directly output, the normal-order target TCP mirror packet will be lost, and the preset buffer will permanently cache other target TCP mirror packets, causing the reordering module to malfunction.

[0092] For example, if the incoming target TCP image packet arrives with a significant delay, other target TCP image packets already written to the pre-defined buffer will remain unread for an extended period, causing data backlog. Unprocessed target TCP image packets accumulate latency, impacting overall system performance and the real-time nature of data transmission.

[0093] To address the aforementioned timeout issue, this disclosure also proposes a method for processing TCP mirrored data to resolve the timeout problem. This method is also applied to an FPGA chip, which connects to a server via a pre-defined bus interface. The FPGA chip receives the target TCP mirrored packet of the current TCP connection processed by the server, wherein the TCP 5-tuple of the target TCP mirrored packet is identical to the reference TCP 5-tuple of the current TCP connection.

[0094] like Figure 8 As shown, the method includes: step 801, counting the write wait time of the current starting ISN number waiting to be written into the TCP image packet in the preset buffer of the FPGA chip.

[0095] In one embodiment of this disclosure, a preset timer can be pre-set, starting from 0 each time the starting ISN number in the preset buffer is updated. In this embodiment, the write wait time for the current starting ISN number to be written to the TCP image packet in the preset buffer of the FPGA chip is counted according to the preset timer.

[0096] Step 802: Determine whether the write wait time is greater than the preset time threshold.

[0097] The preset duration threshold can be set according to the size of the preset buffer space, etc. The larger the preset buffer space, the longer the corresponding preset duration threshold can be.

[0098] Step 803: When the duration exceeds the preset time threshold, determine the smallest ISN number among all ISN numbers to be written to the target TCP image packet in the preset buffer.

[0099] In this embodiment, when the write wait time exceeds a preset time threshold, it indicates that the aforementioned timeout has occurred. Therefore, to ensure the order of out-of-order reordering, the smallest ISN number among all ISN numbers written to the target TCP image packet is determined in a preset buffer. In some possible embodiments, the first ISN number of all target TCP image packets written to the preset buffer can be identified, and the smallest ISN number is determined from the first ISN number. This smallest ISN number corresponds to the most recent buffer position for writing the target TCP image packet.

[0100] In this embodiment, refer to Figure 9 A preset timer counter can be maintained in the FPGA chip. The counter continuously counts before the arrival of the target TCP image packet corresponding to the starting ISN number. When the counter count exceeds the preset duration threshold, the minimum value among all the first ISN numbers written to the target TCP image packet is determined to be 600.

[0101] In some possible embodiments, the second ISN number following the current starting ISN number in the preset buffer and written to the target TCP image packet is identified, and this second ISN number is determined to be the minimum ISN number. For example, referring to the above... Figure 9 After determining that the ISN number is 500, the second ISN number written to the next target TCP image packet is 600.

[0102] Step 804: Update the current starting ISN number of the preset buffer to the minimum ISN number, perform out-of-order reordering of the target TCP image packet according to the updated preset buffer, and send the out-of-order reordered target TCP image packet to the server.

[0103] In the embodiments of this disclosure, after determining the minimum ISN number, the current starting ISN number in the preset buffer is updated to the minimum ISN number, that is, the ISN numbers that have not been received for a long time are skipped. In this embodiment, the minimum ISN number can be used as the starting ISN number to update all ISN numbers in the preset buffer. Then, the target TCP image packets are reordered according to the updated preset buffer, and the reordered target TCP image packets are sent to the server. In this embodiment, if the pointer position of the preset pointer is used to point to the current starting ISN number, the pointer position of the preset pointer can be controlled to be located at the corresponding position of the current starting ISN number in the preset buffer. After updating the current starting ISN number in the preset buffer to the minimum ISN number, the pointer position of the preset pointer is updated to the corresponding position of the minimum ISN number in the preset buffer.

[0104] In actual execution, to ensure that the current starting ISN is only updated when a timeout occurs, in one embodiment of this disclosure, before updating the current starting ISN in the preset buffer to the minimum ISN, the number of target TCP image packets already written in the preset buffer can be further determined, and it can be determined whether the number of packets is greater than a preset packet number threshold. The preset packet number threshold can be calibrated according to the scenario. If the number of packets is greater than the preset packet number threshold, the current starting ISN in the preset buffer is further updated to the minimum ISN.

[0105] In one embodiment of this disclosure, the number of bytes already written in the preset buffer can be determined. If the number of bytes is greater than a preset byte count threshold, and if it is greater than the preset byte count threshold, the current starting ISN number of the preset buffer is further updated to the minimum ISN number. The preset byte count threshold can be set according to the needs of the scenario. For example, the preset byte count can be 200.

[0106] That is, in this embodiment, referring to Figure 10The FPGA chip internally maintains a preset counter sum_byte to record the number of bytes written to the preset buffer. The preset byte count threshold is MAX_BYTE. When sum_byte > MAX_BYTE, the current starting ISN of the preset buffer is further updated to the minimum ISN. In this embodiment, the corresponding address in the preset buffer is marked in advance in the bitmap to indicate whether the corresponding TCP image packet has been written. At this time, the nearest target TCP image packet that has been stored in the buffer is searched through the bitmap, and the pointer position of the preset pointer is updated to this position. The nearest target TCP image packet that has been stored in the buffer is then output, thereby maintaining the stable operation of the preset buffer.

[0107] In some possible embodiments, when the write wait time exceeds a preset time threshold, if it is determined that the number of data packets of the target TCP image packet that has been written is greater than a preset data packet number threshold, and / or the number of bytes that have been written is greater than a preset byte number threshold, then the current starting ISN number of the preset buffer is updated to the minimum ISN number; that is, multiple judgment conditions are combined to jointly process and maintain the normal operation of the buffer.

[0108] In some possible embodiments, even if the write wait time is not greater than the preset duration threshold, but the number of bytes written is greater than the preset byte number threshold, and / or the number of data packets of the target TCP mirror packet written is greater than the preset data packet number threshold, the current starting ISN of the preset buffer can be updated to the minimum ISN. Thus, even if the preset duration threshold is set relatively large in some scenarios, the memory overflow problem of the preset buffer will be detected in time, avoiding the problem of no output of the target TCP mirror packet in the preset buffer for a long time, and reducing the output latency of the target TCP mirror packet.

[0109] In some possible embodiments, even if the number of bytes written is not greater than a preset byte number threshold, and / or the number of data packets of the target TCP image packet written is not greater than a preset data packet number threshold, but the write wait time is greater than a preset time threshold, the current starting ISN number of the preset buffer can be updated to the minimum ISN number. In this way, the timeout problem is resolved in advance, avoiding the problem of no data output for a long time.

[0110] Therefore, this technical solution combines timeout and memory overflow protection mechanisms to flexibly handle various abnormal scenarios of the preset buffer, ensuring its stable and efficient operation. The proposed protection mechanism effectively manages the preset buffer, ensuring the stable operation of the out-of-order reordering function and preventing it from being interfered with by low-probability abnormal scenarios, thereby optimizing the TCP out-of-order processing function under heterogeneous architectures.

[0111] In summary, the TCP mirroring data processing method of this embodiment involves statistically analyzing the write wait time for the current starting ISN number to be written into the TCP mirroring packet in a preset buffer of the FPGA chip. It determines whether the write wait time exceeds a preset time threshold. If it does, it identifies the smallest ISN number among all ISN numbers to be written into the target TCP mirroring packet in the preset buffer. Then, it updates the current starting ISN number in the preset buffer to the smallest ISN number, performs out-of-order reordering of the target TCP mirroring packet based on the updated preset buffer, and sends the out-of-order reordered target TCP mirroring packet to the server. This technical solution promptly detects timeout issues in the preset buffer and updates the current starting ISN numbers that are not received within the timeout period, ensuring the stable operation of the out-of-order reordering function based on heterogeneous structures.

[0112] Based on the above embodiments, the TCP processed by the server may change. Therefore, the reference TCP 5-tuple constructed based on the original TCP connection can no longer be used to receive TCP mirror packets for new TCP connections. In this case, TCP reconnection processing is required.

[0113] The following describes a method for processing TCP mirrored data for TCP reconnection processing according to an embodiment of the present disclosure. In this method, for ease of explanation, the current TCP connection is referred to as the original TCP connection, and the preset buffer of the original TCP connection is referred to as the first buffer.

[0114] Figure 11 This is a flowchart of a method for processing TCP mirrored data according to another embodiment of the present disclosure, as follows: Figure 11 As shown, the method includes:

[0115] Step 1110: In response to obtaining the first current TCP image packet, determine whether the preset TCP reconnection conditions are met based on the first current TCP image packet.

[0116] In the technical solution disclosed herein, a first current TCP image packet is obtained. This first current TCP image packet can be obtained through a network interface or a bus interface. Based on the first current TCP image packet, it is determined whether the preset TCP reconnection conditions are met.

[0117] It should be noted that the methods for determining whether the preset TCP reconnection conditions are met based on the first current TCP image packet vary in different application scenarios, as shown in the following example:

[0118] In one embodiment of this disclosure, a first TCP 5-tuple corresponding to the original TCP connection is determined, a second TCP 5-tuple of the first current TCP mirror packet is extracted, and it is determined whether the first TCP 5-tuple and the second TCP 5-tuple are consistent. If they are inconsistent, a preset TCP reconnection condition is determined to be met. In this embodiment, to improve comparison efficiency, any one of the 5-tuple parameters of the first TCP 5-tuple and the second TCP 5-tuple can be directly compared. For example, it can be determined whether the destination port in the first TCP 5-tuple and the second TCP 5-tuple is consistent. If they are inconsistent, it is directly determined that the first TCP 5-tuple and the second TCP 5-tuple are inconsistent.

[0119] That is, in this embodiment, referring to Figure 12 The FPGA chip's quintuple filtering module directly determines whether the destination port in the second TCP quintuple has changed relative to the first TCP quintuple.

[0120] In one embodiment of this disclosure, the current ISN number of the first current TCP image packet is obtained, and it is determined whether the current ISN number belongs to all the corresponding ISN numbers in the first buffer. If it does not belong to all the corresponding ISN numbers in the first buffer, it is determined that the preset TCP reconnection condition is met.

[0121] In this embodiment, we continue to refer to... Figure 12 In the out-of-order reordering module, it is determined whether the current ISN number of the first current TCP image packet has changed significantly.

[0122] In this embodiment, the minimum ISN difference between the current ISN and all ISNs can also be calculated to determine whether the minimum ISN difference is greater than a preset ISN difference threshold. That is, when the current ISN changes significantly, if the minimum ISN difference is greater than the preset ISN difference threshold, then the current ISN is determined to have changed significantly, thereby determining that the preset TCP reconnection condition is met.

[0123] Of course, in one embodiment of this disclosure, in order to improve the sensitivity of reconnection identification, when the current ISN number does not belong to all the corresponding ISN numbers in the first buffer, the maximum ISN number difference between the current ISN number and all ISN numbers can be calculated, and it can be determined whether the maximum ISN number difference is greater than a preset ISN number difference threshold. If it is greater than the preset ISN number difference threshold, it can be determined that the preset TCP reconnection condition is met.

[0124] The above method of determining whether the preset reconnection conditions are met based on the quintuple and ISN can be executed individually, that is, if any one of the above conditions is met, the preset reconnection conditions are considered to be met. Alternatively, it can be executed together, that is, if both of the above conditions are met, the preset reconnection conditions are considered to be met.

[0125] Step 1120: When the preset TCP reconnection conditions are met, a second buffer is constructed in the FPGA chip, and it is identified whether the first buffer contains the target TCP image packet to be output.

[0126] In one embodiment of this disclosure, when a preset TCP reconnection condition is met, a second buffer is constructed in the FPGA chip, and it is identified whether the first buffer contains the target TCP image packet to be output. The second buffer can be a RAM area within the FPGA.

[0127] Step 1130: When the first buffer contains the target TCP image packet to be output, open the read interface of the first buffer and the write interface of the second buffer, and close the read interface of the second buffer and the write interface of the first buffer. The corresponding TCP image packet is sent to the server through the read interface, and the corresponding TCP image packet is written to the corresponding buffer through the write interface.

[0128] Step 1140: In response to the fact that the first buffer does not contain the target TCP image packet to be output, the read interface of the first buffer is closed and the read interface of the second buffer is opened so as to send the corresponding TCP image packet to the server through the read interface of the second buffer.

[0129] In this embodiment, when the first buffer contains the target TCP image packet to be output, the read interface of the first buffer and the write interface of the second buffer are opened, and the read interface of the second buffer and the write interface of the first buffer are closed. The corresponding TCP image packet is sent to the server through the read interface, and the corresponding TCP image packet is written to the corresponding buffer through the write interface. In response to the first buffer not containing the target TCP image packet to be output, the read interface of the first buffer is closed, and the read interface of the second buffer is opened, so that the corresponding TCP image packet is sent to the server through the read interface of the second buffer.

[0130] In this embodiment, in response to obtaining the second current TCP image packet, the third TCP 5-tuple of the second current TCP image packet is identified, and it is determined whether the third TCP 5-tuple is consistent with the second TCP 5-tuple. If they are consistent, the second TCP 5-tuple is written to the second buffer through the write interface of the second buffer. Furthermore, after reconnection, the first TCP 5-tuple is also updated; that is, the first TCP 5-tuple corresponding to the original TCP connection pre-configured in the FPGA chip is deleted, and the second TCP 5-tuple is configured in the FPGA chip.

[0131] That is, in this embodiment, referring to Figure 13If the first buffer is RAM1 and the second buffer is RAM2, then when the preset TCP reconnection conditions are met, the relevant reconnection control module will establish a new reconnection buffer RAM2 and store the TCP image packets (including the first current TCP image packet) obtained after reconnection into RAM2. Through the read / write interface, only write operations are performed, and no read operations are performed. Simultaneously, through the read / write interface, RAM1 is controlled to stop write operations and only perform read operations to quickly read all target TCP image packets from the first buffer. Once the target TCP image packets in RAM1 are cleared, the read interface of RAM2 is opened, and the central processing unit obtains the corresponding target TCP image packets from the read interface. The entire process is managed based on a ping-pong control channel. After reconnection, RAM2 will serve as the new preset buffer.

[0132] In one embodiment of this disclosure, if a reconnection occurs again, RAM1 is used again as the preset buffer, and the above reconnection processing logic is repeated. That is, in this embodiment, after the read interface of the second buffer is opened, in response to obtaining the third current TCP image packet, it is determined whether the preset TCP reconnection condition is met based on the third current TCP image packet. When the preset TCP reconnection condition is met, if the second buffer contains the TCP image packet to be output, the read interface of the second buffer and the write interface of the first buffer are opened, and the read interface of the first buffer and the write interface of the second buffer are closed. In response to the second buffer not containing the TCP image packet to be output, the read interface of the second buffer is closed, and the read interface of the first buffer is opened, so as to send the corresponding TCP image packet to the server through the read interface of the first buffer.

[0133] In this technical solution, the out-of-order processing under the heterogeneous architecture targets mirrored data and does not go through the protocol stack. Therefore, when TCP reconnection occurs, it is necessary to be able to identify the reconnection and track the out-of-order reordering to ensure that the new connection after TCP reconnection can perform out-of-order processing normally. Thus, in this embodiment, the normal out-of-order reordering operation is not affected during the reconnection process (whether before or after reconnection), ensuring a smooth transition during reconnection and avoiding packet loss and missing packets, thereby greatly improving the reliability and stability of the heterogeneous structure.

[0134] In summary, the TCP mirroring data processing method of this disclosure, in response to obtaining a first current TCP mirror packet, determines whether a preset TCP reconnection condition is met based on the first current TCP mirror packet. When the preset TCP reconnection condition is met, a second buffer is constructed in the FPGA chip, and it is identified whether the first buffer contains a target TCP mirror packet to be output. When the first buffer contains a target TCP mirror packet to be output, the read interface of the first buffer and the write interface of the second buffer are opened, and the read interface of the second buffer and the write interface of the first buffer are closed. The corresponding TCP mirror packet is sent to the server through the read interface, and the corresponding TCP mirror packet is written to the corresponding buffer through the write interface. Then, in response to the first buffer not containing a target TCP mirror packet to be output, the read interface of the first buffer is closed, and the read interface of the second buffer is opened to send the corresponding TCP mirror packet to the server through the read interface of the second buffer. This technical solution implements out-of-order reordering processing based on a heterogeneous structure, ensuring that normal out-of-order reordering operations are not affected during reconnection, achieving a smooth transition, ensuring the continuity and integrity of out-of-order reordering processing, thereby improving the reliability and stability of the heterogeneous structure.

[0135] To implement the above embodiments, this disclosure also proposes a TCP mirror data processing apparatus.

[0136] Figure 14 This is a schematic diagram of a TCP mirroring data processing device provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and is generally integrated into an FPGA chip. The FPGA chip is connected to a server through a preset bus interface. For example... Figure 14 As shown, the device includes: an identification module 1410, a determination module 1420, and a processing module 1430, wherein,

[0137] The identification module 1410 is used to identify the target ISN number of the target TCP image packet sent to the preset buffer, wherein the TCP 5-tuple of the target TCP image packet is consistent with the reference TCP 5-tuple of the current TCP connection;

[0138] The determination module 1420 is used to determine the starting ISN number corresponding to the preset buffer, and to determine whether the target TCP image packet meets the preset sending conditions based on the starting ISN number and the target ISN number.

[0139] The processing module 1430 is used to send the corresponding target TCP image packet to the server when the preset sending conditions are met.

[0140] The TCP mirror data processing apparatus provided in this disclosure can execute the TCP mirror data processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.

[0141] To implement the above embodiments, this disclosure also proposes a computer program product, including a computer program / instruction, which, when executed by a processor, implements the TCP mirroring data processing method in the above embodiments.

[0142] To implement the above embodiments, this disclosure also proposes an FPGA chip, which is connected to a server through a preset bus interface and is used to execute any of the above TCP image data processing methods.

[0143] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from memory, or installed from ROM. When the computer program is executed by a processor, it performs the functions defined in the TCP mirroring data processing method of embodiments of this disclosure.

[0144] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0145] The aforementioned computer-readable medium may be included in the aforementioned FPGA chip; or it may exist independently and not assembled into the electronic device.

[0146] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the aforementioned method for processing centralized TCP mirrored data.

[0147] FPGA chips can be programmed with computer program code in one or more programming languages ​​or combinations thereof to perform the operations of this disclosure. These programming languages ​​include, but are not limited to, Verilog, VHDL, etc. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0148] 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 this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated 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, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0149] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not necessarily limiting in certain circumstances. The functions described above can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), etc.

[0150] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0151] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0152] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0153] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for processing TCP mirrored data, characterized in that, The method is applied to an FPGA chip, which is connected to a server via a preset bus interface. A first buffer is pre-built in the FPGA chip, which stores the target TCP image packet of the original TCP connection corresponding to the server. The FPGA chip obtains the corresponding TCP image packet through a preset network interface and / or the bus interface. The method includes the following steps: In response to obtaining the first current TCP image packet, determine whether the preset TCP reconnection conditions are met based on the first current TCP image packet; When the preset TCP reconnection condition is met, a second buffer is constructed in the FPGA chip, and it is identified whether the first buffer contains the target TCP image packet to be output; When the first buffer contains the target TCP image packet to be output, the read interface of the first buffer and the write interface of the second buffer are opened, and the read interface of the second buffer and the write interface of the first buffer are closed. The corresponding TCP image packet is sent to the server through the read interface of the first buffer, and the corresponding TCP image packet is written to the corresponding buffer through the write interface of the second buffer. In response to the first buffer not containing the target TCP image packet to be output, the read interface of the first buffer is closed and the read interface of the second buffer is opened to send the corresponding TCP image packet to the server through the read interface of the second buffer.

2. The method as described in claim 1, characterized in that, The step of determining whether the preset TCP reconnection conditions are met based on the first current TCP image packet includes: Determine the first TCP 5-tuple corresponding to the original TCP connection; Extract the second TCP 5-tuple from the first current TCP image packet; Determine whether the first TCP 5-tuple is consistent with the second TCP 5-tuple, wherein if they are inconsistent, it is determined that the preset TCP reconnection condition is met.

3. The method as described in claim 1 or 2, characterized in that, The step of determining whether the preset TCP reconnection conditions are met based on the first current TCP image packet includes: Obtain the current ISN number of the first current TCP image packet; Determine whether the current ISN number belongs to all the corresponding ISN numbers in the first buffer; If the ISN does not belong to any of the corresponding ISN numbers in the first buffer, it is determined that the preset TCP reconnection condition is met.

4. The method as described in claim 3, characterized in that, Before determining that the preset TCP reconnection conditions are met, the process also includes: Calculate the minimum ISN difference between the current ISN and all ISNs; The minimum ISN difference is determined to be greater than a preset ISN difference threshold.

5. The method as described in claim 2, characterized in that, After enabling the write interface of the second buffer, the following is also included: In response to obtaining the second current TCP image packet, identify the third TCP 5-tuple of the second current TCP image packet; Determine whether the third TCP 5-tuple is consistent with the second TCP 5-tuple; When the second TCP 5-tuple matches, the second TCP 5-tuple is written to the second buffer through the write interface of the second buffer.

6. The method as described in claim 5, characterized in that, Before determining whether the third TCP 5-tuple matches the second TCP 5-tuple, the method further includes: Delete the first TCP 5-tuple corresponding to the original TCP connection pre-configured in the FPGA chip; Configure the second TCP quintuple in the FPGA chip.

7. The method as described in claim 1, characterized in that, After opening the read interface of the second buffer, the following is also included: In response to obtaining a third current TCP image packet, determine whether the preset TCP reconnection condition is met based on the third current TCP image packet; When the preset TCP reconnection conditions are met, and the second buffer contains the TCP image packet to be output, the read interface of the second buffer and the write interface of the first buffer are opened, and the read interface of the first buffer and the write interface of the second buffer are closed. In response to the second buffer not containing a TCP image packet to be output, the read interface of the second buffer is closed and the read interface of the first buffer is opened to send the corresponding TCP image packet to the server through the read interface of the first buffer.

8. A TCP mirrored data processing apparatus, characterized in that, The device is applied to an FPGA chip, which is connected to a server via a preset bus interface. A first buffer is pre-built in the FPGA chip, wherein the first buffer is used to store the target TCP image packet of the original TCP connection corresponding to the server. The FPGA chip obtains the corresponding TCP image packet through a preset network interface and / or the bus interface. The device includes: The determination module is used to determine, in response to obtaining the first current TCP image packet, whether the preset TCP reconnection conditions are met based on the first current TCP image packet; A construction module is used to construct a second buffer in the FPGA chip when the preset TCP reconnection conditions are met; The identification module is used to identify whether the first buffer contains the target TCP image packet to be output; The interface processing module is configured to, when the first buffer contains the target TCP image packet to be output, open the read interface of the first buffer and the write interface of the second buffer, and close the read interface of the second buffer and the write interface of the first buffer, wherein... The corresponding TCP image packet is sent to the server through the read interface of the first buffer, and the corresponding TCP image packet is written to the corresponding buffer through the write interface of the second buffer. The interface processing module is further configured to, in response to the first buffer not containing the target TCP image packet to be output, close the read interface of the first buffer and open the read interface of the second buffer, so as to send the corresponding TCP image packet to the server through the read interface of the second buffer.

9. An FPGA chip, characterized in that, The FPGA chip is connected to the server through a preset bus interface. A first buffer is pre-built in the FPGA chip, wherein the first buffer is used to store the target TCP image packet of the original TCP connection corresponding to the server. The FPGA chip obtains the corresponding TCP image packet through a preset network interface and / or the bus interface. The FPGA chip is used to execute the TCP image data processing method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program for executing the TCP mirroring data processing method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Method for reordering TCP (transmission control protocol) connections

    CN102104596A

  • Dynamic Offline End-to-End Packet Processing based on Traffic Class

    US20200412655A1