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

By receiving and processing TCP image packets using an FPGA chip, and reordering them by updating the starting ISN number using a buffer, the problem of high CPU load is solved, and low-latency data transmission is achieved.

CN120186168BActive Publication Date: 2026-04-10YUSUR TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-18
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In high-speed network environments, the CPU needs to process a large number of out-of-order TCP network packets, resulting in high CPU utilization and an inability to meet the requirements for low-latency transmission.

Method used

The FPGA chip receives TCP image packets processed by the server, uses a preset buffer to count the write wait time, updates the starting ISN number and performs out-of-order reordering to reduce CPU load.

Benefits of technology

It reduces CPU utilization, improves out-of-order reordering efficiency, and meets the requirements for low-latency data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120186168B_ABST
    Figure CN120186168B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a TCP mirror data processing method, device, chip and medium, wherein the method comprises: counting the write waiting time length of the current starting ISN number waiting to write the TCP mirror packet in the preset buffer in the FPGA chip; determining whether the write waiting time length is greater than a preset time threshold; when greater than the preset time threshold, determining the minimum ISN number among all ISN numbers of the write target TCP mirror packet in the preset buffer; updating the current starting ISN number of the preset buffer to the minimum ISN number, and sending the target TCP mirror packet after the out-of-order rearrangement processing to the server. In this technical solution, the TCP mirror packet is processed based on a heterogeneous architecture, which reduces the occupancy rate of the central processor, improves the data processing efficiency of the TCP mirror packet, and timely discovers the timeout problem of the preset buffer, updates the current starting ISN number that is not received due to timeout, and ensures the stable operation of the out-of-order rearrangement function based on the heterogeneous structure.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of communication, and particularly relates to a TCP mirror data processing method and device, a chip and a medium. BACKGROUND

[0002] Transmission Control Protocol (TCP) network packets, when being transmitted, may exist different delays due to interference of transmission environment and the like, so that the TCP network packets received by a Central Processing Unit (CPU) are out of order, and therefore, it is a common communication scenario to reorder the TCP network packets and then send them to a backend.

[0003] In the related art, the received TCP network packets are reordered in the CPU of a server, however, in a high-speed network environment, the number of TCP network packets is large, and a corresponding buffer needs to be constructed in the CPU to store the TCP network packets and reorder the TCP network packets, thereby causing a high CPU occupancy rate, and when the CPU occupancy rate is high, the efficiency of the CPU in reordering may be low, and the low-latency sending requirement of the TCP network packets in the communication scenario cannot be met. SUMMARY

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a TCP mirror data processing method and device, a chip and a medium.

[0005] The present disclosure provides a TCP mirror data processing method, which is applied to an FPGA chip, the FPGA chip is connected with a server through a preset bus interface, and the FPGA chip is used to receive a target TCP mirror packet of a current TCP connection processed by the server, wherein a TCP five-tuple of the target TCP mirror packet is consistent with a reference TCP five-tuple of the current TCP connection, and the method comprises the following steps: counting a write waiting time length of a current start ISN number waiting to write a TCP mirror packet in a preset buffer in the FPGA chip; determining whether the write waiting time length is greater than a preset time threshold; when the write waiting time length is greater than the preset time threshold, determining a minimum ISN number in all ISN numbers of the target TCP mirror packet written in the preset buffer; updating the current start ISN number of the preset buffer to the minimum ISN number, and performing out-of-order reordering processing on the target TCP mirror packet according to the updated preset buffer, and sending the target TCP mirror packet after the out-of-order reordering processing to the server.

[0006] The embodiment of the present disclosure provides a kind of processing device of TCP mirror data, the device is applied to FPGA chip, the FPGA chip is connected with server by preset bus interface, the FPGA chip is used to receive the target TCP mirror package of current TCP connection handled by the server, wherein the TCP five-tuple of the target TCP mirror package is consistent with the reference TCP five-tuple of the current TCP connection, the device includes: statistics module, for the write waiting time length of current start ISN number waiting to write TCP mirror package in the preset buffer in the FPGA chip;First determination module, for determining whether the write waiting time length is greater than preset time threshold;Second determination module, for determining the minimum ISN number in all ISN numbers of the target TCP mirror package written in the preset buffer when greater than the preset time threshold;Processing module, for updating the current start ISN number of the preset buffer as the minimum ISN number, and according to the reordered processing of the target TCP mirror package of updated preset buffer, and the target TCP mirror package after reordered processing is sent to the server.

[0007] The embodiment of the present disclosure also provides an FPGA chip, which is connected with a server through a preset bus interface, and is used to receive a target TCP mirror package of a current TCP connection handled by the server, wherein a TCP five-tuple of the target TCP mirror package is consistent with a reference TCP five-tuple of the current TCP connection, and the FPGA chip is used to execute the processing method of the TCP mirror data.

[0008] The embodiment of the present disclosure also provides a computer-readable storage medium, which stores a computer program for executing the processing method of the TCP mirror data provided by the embodiment of the present disclosure.

[0009] Compared with the prior art, the technical scheme provided by the embodiment of the present disclosure has the following advantages:

[0010] The write waiting time length of the current start ISN number waiting to write TCP mirror package in the preset buffer in the FPGA chip is counted, it is determined whether the write waiting time length is greater than a preset time threshold, when greater than the preset time threshold, the minimum ISN number in all ISN numbers of the target TCP mirror package written in the preset buffer is determined, then the current start ISN number of the preset buffer is updated as the minimum ISN number, and the reordered processing of the target TCP mirror package is carried out according to the updated preset buffer, and the target TCP mirror package after reordered processing is sent to the server. In the technical scheme, the timeout problem of the preset buffer is found in time, the current start ISN number not received due to timeout is updated, and the stable operation of the reordered function based on the heterogeneous structure is ensured. 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 7 This 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 Another processing scenario of TCP mirror data provided by an embodiment of the present disclosure is shown in the figure;

[0025] Figure 14 A structure diagram of a processing device of TCP mirror data provided by an embodiment of the present disclosure is shown in the figure. DETAILED DESCRIPTION

[0026] Embodiments of the present disclosure will be described in more detail with reference to the drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms, and should not be interpreted as being limited to the embodiments set forth herein, but rather, these embodiments are provided so as to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only, and are not intended to limit the scope of protection of the present disclosure.

[0027] It should be understood that each step described in the method embodiments of the present disclosure can be executed in different order, and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present disclosure is not limited in this respect.

[0028] The term "comprising" and variations thereof as used herein are open-ended, that is "including but not limited to". The term "based on" is "based, at least in part, 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". Related definitions will be given in the description below.

[0029] It should be noted that the concepts of "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0030] It should be noted that the modification of "one", "multiple" mentioned in the present disclosure is illustrative and not limiting, and those skilled in the art should understand that, unless otherwise explicitly indicated in the context, it should be understood as "one or more".

[0031] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.

[0032] To solve the above problems, the embodiment of the disclosure proposes a technical scheme of processing TCP network data packets based on a heterogeneous architecture of a Field Programmable Gate Array (FPGA) chip. In the scheme, a TCP mirror packet of a TCP network data packet is obtained, a hardware-friendly out-of-order rearrangement method is used to replace the existing CPU-based out-of-order processing, and the obtained TCP mirror packet of the TCP network data packet is a corresponding TCP mirror packet obtained by copying the TCP network data packet. The data rearrangement processing of the TCP mirror packet can be implemented without being affected by the TCP transmission protocol. Based on the out-of-order rearrangement task of the TCP mirror packet in the CPU offloading, the protocol stack is crossed.

[0033] In the embodiment of the disclosure, the TCP mirror data processing method is executed by the FPGA chip. Figure 1 The server includes a CPU and corresponding memory space, the TCP mirror data processing method can be executed by the FPGA chip, the FPGA chip can be regarded as an acceleration card for out-of-order rearrangement of TCP network data packets, and specific executable code for executing the TCP mirror data processing method can be written in the FPGA chip. The 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 or the like. The PCIe interface is a kind of PCI computer bus, which continues the existing PCI programming concept and communication standard, but is based on a faster serial communication system. The FPGA chip can also include a network interface, and the FPGA chip can obtain the TCP mirror packet of the related TCP network data packet in the current network environment through the network interface or the bus interface of the server.

[0034] The TCP mirror data processing method of the embodiment of the disclosure will be described below with reference to the embodiment. Figure 2 A flowchart of a TCP mirror data processing method provided by the embodiment of the disclosure is shown in the figure. The method can be executed by a TCP mirror data processing method device, which can be implemented by software and / or hardware and can be integrated in an FPGA chip. Figure 2 The method includes the following steps.

[0035] In step 201, the server obtains the reference TCP five-tuple of the current TCP connection and obtains the candidate TCP mirror packet.

[0036] In an embodiment of the disclosure, the server can send the reference TCP five-tuple of the current TCP connection through the bus interface.

[0037] In this embodiment, the candidate TCP mirror packet of the TCP data packet of the TCP connection in the network environment can be directly transmitted to the acceleration card through the bus interface or through the network interface.

[0038] That is, in some possible examples, the candidate TCP mirror packet is obtained through a preset network interface, and in the embodiment, the acceleration card directly reads the corresponding candidate TCP mirror packet in the network environment.

[0039] In some possible examples, the mirror data packet in the CPU can be copied to obtain the candidate TCP mirror packet, and then the copied candidate TCP mirror packet is obtained through the bus interface.

[0040] In step 202, the candidate TCP mirror packet is filtered according to the reference TCP five-tuple, so as to obtain the target TCP mirror packet corresponding to the current TCP connection.

[0041] Since the obtained TCP mirror packet can come from multiple TCP connections, in an embodiment of the present disclosure, the candidate TCP mirror packet is filtered according to the reference TCP five-tuple, so as to obtain the target TCP mirror packet corresponding to the current TCP connection, wherein the current TCP connection can be understood as a TCP connection currently subjected to the out-of-order rearrangement processing and the like.

[0042] The TCP five-tuple refers to five parameters used to uniquely identify a TCP connection in TCP / IP network communication. The five parameters include source IP address, source port, destination IP address, destination port and transport layer protocol. The following is a detailed introduction to each parameter, wherein the following packet can be the corresponding TCP mirror packet:

[0043] Source IP address (Source IP Address)

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

[0045] Source port (Source Port)

[0046] The source port is used to identify the application program or service sending the packet. Different application programs use different port numbers for communication under the same IP address. The source port is represented by a 16-bit unsigned integer (UINT16) and occupies 2 bytes in memory.

[0047] Destination IP address (Destination IP Address)

[0048] 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 by a 32-bit unsigned integer (UINT32) and occupies 4 bytes in memory.

[0049] Destination Port

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

[0051] Transport Protocol

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

[0053] That is, as shown in Table 1, in some possible embodiments, the FPGA chip can be configured as an acceleration core corresponding to the reference TCP five-tuple, wherein the 32-bit IP address is separated by 8 bits, and the value of the five-tuple can be 0, indicating that the condition is ignored. The acceleration core will filter the target TCP mirror packet that meets the configured reference TCP five-tuple.

[0054] As shown in Table 1, the source IP must be 172.24.16.35, the source PORT must be 19999, and the transport layer protocol must be TCP for the candidate TCP mirror packet to pass the filtering. Any destination IP and destination PORT that meet this condition are eligible for filtering:

[0055] Table 1

[0056]

[0057]

[0058] Of course, in one embodiment of the present disclosure, the obtained TCP mirror packet can come from handshake, handshake TCP packet, etc. Therefore, in order to further ensure the source of the candidate TCP mirror packet for the corresponding TCP connection, in this embodiment, the header of the candidate TCP mirror packet can be read, and the PSH value of the candidate TCP mirror packet can be determined according to the header. When the PSH value is 1, the corresponding candidate TCP mirror packet is filtered, and the candidate TCP mirror packet with PSH value of 0 is directly filtered.

[0059] It should be noted that in the specific implementation process, different ways can be adopted to perform the filtering processing of the candidate TCP mirror packets based on the reference TCP five-tuple according to different application scenarios, and examples are as follows:

[0060] In some possible examples, the reference TCP five-tuple is configured in the FPGA chip, that is, the initialization configuration is performed in the FPGA chip, the reference TCP five-tuple includes a source IP address, a source port, a destination IP address, a destination port, and a transport layer protocol, and the filtering processing of the candidate TCP mirror packets is performed according to the configured reference TCP five-tuple to obtain the filtered target TCP mirror packets corresponding to the current TCP connection.

[0061] In some possible examples, the filtering processing of the candidate TCP mirror packets can be implemented by using a state machine, in this example, a preset state machine is constructed, and in this embodiment, the related input data is shifted and stored in a buffer variable of the preset state machine. This buffer variable is sufficient to accommodate the five-tuple part in the TCP protocol.

[0062] In the initialization state, the acceleration core will constantly match the reference TCP five-tuple based on the buffer variable, which is a sliding matching process. If the matching is successful, the length of the body and the length of the protocol header of the target TCP mirror packet are recorded, and the time required to wait for starting to output the body data of the target TCP mirror packet is calculated, and the state is entered into the locked and waiting state.

[0063] When waiting for the body data of the target TCP mirror packet based on the waiting time, after the waiting is completed, the acceleration core will jump to the output state. In the output state, the acceleration core will integrate and output the target TCP mirror packet according to the length of the body of the target TCP mirror packet recorded in advance.

[0064] That is, in this embodiment, as Figure 3As shown, when the preset state machine corresponding to the reference TCP five tuple is in the open state (for example, when the state bit is locked, and the locked is 0, it is determined that the preset state machine is in the open state), the candidate TCP mirror packet is obtained, the TCP five tuple of the candidate TCP mirror packet is matched with the reference TCP five tuple, and the state bit of the preset state machine is updated to the locked state (for example, when the state bit is locked, and the locked is 1, it is determined that the preset state machine is in the locked state) in response to the matching result of the sliding matching being a matching success. From the sliding matching end position, the candidate TCP mirror packet is read, for example, the text length and the protocol header length of the candidate TCP mirror packet can be obtained and recorded based on the protocol header of the candidate TCP mirror packet, the remaining to-be-read byte number is determined based on the sliding matching end position, the remaining waiting time is determined based on the to-be-read byte number, the protocol header of the remaining candidate TCP mirror packet is read within the waiting time, and the text data of the candidate TCP mirror packet is read after the waiting is completed. Thus, the read text data of the candidate TCP mirror packet is integrated, and the candidate TCP mirror packet is sent to the preset buffer for out-of-order rearrangement processing. If the length of the read text data of the candidate TCP mirror packet is consistent with the pre-recorded text length of the candidate TCP mirror packet, the state bit of the preset state machine is updated to the open state.

[0065] In step 203, the target TCP mirror packet is subjected to out-of-order rearrangement processing, and the target TCP mirror packet subjected to the out-of-order rearrangement processing is sent to the server.

[0066] In an embodiment of the present disclosure, the target TCP mirror packet obtained is subjected to out-of-order rearrangement processing, and the target TCP mirror packet subjected to the out-of-order rearrangement processing is sent to the server. Since the out-of-order rearrangement occurs in the heterogeneous structure FPGA chip, the task of out-of-order rearrangement of the CPU in the server is offloaded, the CPU occupancy rate is greatly reduced, and the out-of-order rearrangement efficiency is improved.

[0067] In the present embodiment, referring to Figure 4 , the acceleration core in the FPGA chip can obtain two functional modules according to the pre-encoding, one of which is a five tuple filtering module for filtering the candidate TCP mirror packet obtained according to the input reference TCP five tuple, and the other is an out-of-order rearrangement module. The target TCP mirror packet obtained is subjected to out-of-order rearrangement based on the out-of-order rearrangement module, and the target TCP mirror packet subjected to the out-of-order rearrangement is sent to the server. The out-of-order rearrangement module can provide a read interface, and the server reads the target TCP mirror packet subjected to the out-of-order rearrangement based on the read interface.

[0068] In one embodiment of the present disclosure, in order to facilitate the data readback of the server, the target ISN number of the target TCP mirror packet can also be determined, and the data length (payload length) of the data content of the target TCP mirror packet is determined, the protocol header of the target TCP mirror packet is generated according to the target ISN number and the data length, the target TCP mirror packet is updated according to the protocol header and the data content (payload), and then the updated target TCP mirror packet is sent to the server, wherein the format of the updated target TCP mirror packet is: custom protocol header (ISN number + payload length) + payload content.

[0069] The server can quickly determine whether the target TCP mirror packet reordered by the FPGA is accurate based on the custom protocol header of the updated target TCP mirror packet, and quickly locate the payload content based on the payload length, thereby improving the processing convenience of the server, simplifying the processing logic of the CPU, and further reducing the resource occupation rate of the CPU.

[0070] In one embodiment of the present disclosure, when the server determines that the ISN number appears in the wrong order based on the custom protocol header of the updated target TCP mirror packet, an alarm can be quickly given to quickly find the problem of reordering, and to ensure the reliability and integrity of the target TCP mirror packet sent.

[0071] For example, in the present 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 five-tuple of the current TCP connection initialized and set, the seven candidate TCP mirror packets obtained are referred to in Table 2 below:

[0072] Table 2

[0073]

[0074]

[0075] When filtering the candidate TCP mirror packets, the candidate TCP mirror packets with sending sequence numbers 1, 2, and 3 are filtered according to the reference TCP five-tuple and the PAH value. The candidate TCP mirror packet 1 is filtered because it does not match the protocol type of the reference TCP five-tuple, the candidate TCP mirror packet 2 is filtered because the PSH bit is not 1, and the candidate TCP mirror packet 3 is filtered because it does not match the source IP of the reference TCP five-tuple. The reordering results of the candidate TCP mirror packets with sequence numbers 4, 7, 6, and 5 after filtering are referred to in Table 3 below:

[0076] Table 3

[0077]

[0078] In the embodiment, the target TCP mirror packet in Table 3 can be sent to the server in the format of a custom protocol header (ISN number + payload length) + payload content. That is, the necessary metadata in the target TCP mirror packet is preserved, and the target TCP mirror packet after reordering can be accurately and correctly delivered to the backend system.

[0079] To sum up, the processing method of the TCP mirror data in the embodiment of the disclosure, the FPGA chip obtains a reference TCP five-tuple of a current TCP connection through a server, and obtains a candidate TCP mirror packet. The candidate TCP mirror packet is filtered and processed according to the reference TCP five-tuple, so as to obtain a target TCP mirror packet corresponding to the current TCP connection. Then, the target TCP mirror packet is reordered and processed, and the target TCP mirror packet after the reordering and processing is sent to the server. In the technical solution, the TCP mirror packet is processed based on a heterogeneous architecture, which reduces the occupancy rate of the central processing unit, improves the data processing efficiency of the TCP mirror packet, and meets the low-latency data transmission requirement.

[0080] In the actual execution process, the out-of-order reordering module in the acceleration core is used to process the out-of-order problem of the target TCP mirror packet. It receives the out-of-order target TCP mirror packet and reorders it according to the sequence number ISN to ensure that the output target TCP mirror packet is arranged in order.

[0081] A preset buffer of the current TCP connection is constructed in the FPGA chip, and the filtered target TCP mirror packet is stored in the preset buffer. The preset buffer is marked with a starting ISN number corresponding to a starting pointer of the preset buffer according to a target ISN number of the target TCP mirror packet received for the first time. Then, a tail ISN number is determined according to a storage space of the preset buffer set in the FPGA, and the preset buffer is used to store the TCP mirror packet within the corresponding ISN number range.

[0082] For example, if the target ISN number of the target TCP mirror packet is 500, and the preset buffer currently supports storing the TCP mirror packet with the ISN number range of 500-1500, the target TCP mirror packet is written to the head of the preset buffer, and then the corresponding target TCP mirror packet is sent to the server. If the SEQ range of the TCP mirror packet is 500-600, after the target TCP mirror packet is sent, the ISN number range supported by the preset buffer for storage is updated to 600-1600. That is, the ISN number range supported by the preset buffer for storage is constantly updated until there is no data written in the head buffer, and the output is stopped.

[0083] Reference Figure 5, if the ISN number corresponding to the head buffer of the current buffer is 500, and the storage space of the preset buffer is 1001 bytes, then the corresponding buffer window size in the preset buffer is the ISN number range: 500-1500 corresponding window, in this embodiment, if the target TCP mirror packet with ISN number 600 and length 100 bytes is obtained, then the target TCP mirror packet is written in the corresponding position of the buffer (the black dot in the figure represents the target TCP mirror packet written in the corresponding buffer), if the target TCP mirror packet with ISN number 900 and length 100 bytes is obtained, then the target TCP mirror packet is written in the corresponding position of the buffer, if the target TCP mirror packet with ISN number 500 and length 100 bytes is further obtained, then the target TCP mirror packet with ISN number 500 to 700 is outputted, the starting ISN number of the head buffer is updated to 700, at this time, the updated ISN number range is 700-1700.

[0084] The method for processing TCP mirror data according to the embodiment of the present disclosure will be described below with reference to specific embodiments.

[0085] Figure 6 Another method for processing TCP mirror data according to the embodiment of the present disclosure is provided, in which a method for rearranging the out-of-order TCP mirror data is proposed, as shown in Figure 6 , the method comprises:

[0086] In step 601, the target ISN number of the target TCP mirror packet sent to the preset buffer is identified, wherein the TCP five-tuple of the target TCP mirror packet is consistent with the reference TCP five-tuple of the current TCP connection.

[0087] It can be understood that the target TCP mirror packet in the embodiment is filtered based on the filtering method in the above embodiment. In this embodiment, the target ISN number of the target TCP mirror packet is extracted.

[0088] In step 602, the starting ISN number corresponding to the preset buffer is determined, and it is determined whether the target TCP mirror packet meets the preset sending condition according to the starting ISN number and the target ISN number.

[0089] In this embodiment, the starting ISN number corresponding to the preset buffer is determined. As mentioned in the above embodiment, the starting ISN number is the ISN number corresponding to the next target TCP mirror packet to be sent, wherein the corresponding starting ISN number is 500, etc. Figure 5

[0090] ​In the embodiment, it can be determined whether the start ISN number and the target ISN number are consistent, and when the target ISN number is consistent, it is determined that the target TCP mirror packet meets the preset sending condition, so that the target TCP mirror packet can be directly sent.

[0091] If the start ISN number and the target ISN number are inconsistent, the target TCP mirror packet is written in the preset buffer according to the target ISN number, that is, the start writing position is determined in the preset buffer according to the target ISN number, and the corresponding target TCP mirror packet is written from the start writing position. Continue to refer to Figure 5 After obtaining the target TCP mirror packet with the target ISN number of 600 and the length of 100 bytes, the target TCP mirror packet is written in the corresponding position of the buffer with the ISN number of 600.

[0092] In step 603, when the preset sending condition is met, the corresponding target TCP mirror packet is sent to the server.

[0093] In one embodiment of the disclosure, after the preset sending condition is met, the corresponding target TCP mirror packet is sent to the server. The target mirror packet is the in-sequence target TCP mirror packet after reordering. In the embodiment, it is also determined whether the preset buffer contains other TCP mirror packets arranged continuously with the target TCP mirror packet, for example, continue to refer to Figure 5 After obtaining the target TCP mirror packet with the target ISN number of 500, since the corresponding target TCP mirror packet is also written in the corresponding buffer with the ISN number range of 600-700 in the preset buffer, the other TCP mirror packets include the target TCP mirror packets with the ISN number range of 600-700. When the other TCP mirror packets are included, the target TCP mirror packet and the other TCP mirror packets are sent to the server, that is, the continuous TCP mirror packets are sent, so that the in-sequence sending is ensured. When the other TCP mirror packets are not included, that is, the corresponding TCP mirror packet is not written in the corresponding buffer with the ISN number range of 600-700, the target TCP mirror packet is directly sent to the server.

[0094] In some possible embodiments, the preset buffer updates the ISN number, which can be the whole update, determines the start ISN number of the next target TCP mirror packet to be written in the preset buffer, updates the start ISN number of the next target TCP mirror packet to be written to the start ISN number of the preset buffer, that is, after updating the start ISN number of the preset buffer, each ISN number is sequentially updated, and continue to refer to Figure 5 After updating the start ISN number of the preset buffer to 700, the subsequent ISN numbers are sequentially updated, and the updated ISN number range is 700-1700.

[0095] In one embodiment of the present disclosure, the preset buffer is a ring buffer, in which the corresponding start ISN number is pointed to by the pointer position of the preset pointer, and the subsequent ISN numbers do not need to be updated one by one. In this embodiment, the pointer position of the preset pointer is read, the start ISN number corresponding to the preset buffer is determined according to the pointer position, when the start ISN number and the tail ISN number are updated, the pointer position of the preset pointer is directly updated to the buffer position corresponding to the updated start ISN number, the pointer position of the preset pointer is updated to the position of the start ISN number of the next target TCP mirror packet to be written, and the ISN number of the buffer corresponding to the sent target TCP mirror packet is updated with the next ISN number of the original tail ISN number of the preset buffer as the start ISN number.

[0096] For example, referring to FIG. 2, Figure 5 , a preset pointer pointer is set to identify the head of the preset buffer. After the update from ① to ② in FIG. 2, Figure 5 , the start ISN number corresponding to the head of the buffer should be changed from 500 to 700. If the preset buffer is a ring buffer, the pointer is directly pointed to the position of 700 in ① as the head of the preset buffer. At this time, the ISN number corresponding to the end of the physical address of the preset buffer is still the original 1500, and the ISN end of the preset buffer corresponding to the target TCP mirror packet sent before the pointer is 1700. In this way, the ring buffer can flexibly adjust the storage range and efficiently and effectively manage the reception and processing of out-of-order packets.

[0097] In some possible embodiments, since the cache space size of the preset buffer is limited, the super window condition may occur. The super window refers to the out-of-order TCP packet with an ISN exceeding the buffer range, which is judged based on the ISN number of the incoming related TCP mirror packet and the current buffer window range. That is, referring to FIG. 3, Figure 7 , assuming that the current start ISN number is 500 and the ISN number range is 500-1500, if the target ISN number of the obtained target TCP mirror packet + data_len (i.e., the byte length of the obtained target TCP mirror packet) > 1500 (post-window) or ISN < 500 (pre-window), it is determined that the super window condition occurs. In this embodiment, the target TCP mirror packet of the super window condition can be directly output, but since the preset buffer may have the target TCP mirror packet after the reordering at this time.

[0098] In order to distinguish the target TCP mirror packet of the super window and the target TCP mirror packet after the reordering and rearrangement, arbitration processing needs to be performed on the target TCP mirror packet before the target TCP mirror packet is sent to the central processor, that is, it is judged whether the target TCP mirror packet to be sent is a target TCP mirror packet of a super window, if it is a target TCP mirror packet of a super window, the target TCP mirror packet of the super window is input into a preset arbitration module in the FPGA chip, and the target TCP mirror packet of the super window and the target TCP mirror packet after the reordering and rearrangement are output to the corresponding output channels in sequence through the arbitration module. In some possible examples, a first preset priority of the target TCP mirror packet of the super window can be determined, a second preset priority of the target TCP mirror packet after the reordering and rearrangement is determined, and the corresponding target TCP mirror packet of the super window and the target TCP mirror packet after the reordering and rearrangement are output in sequence according to the order from high to low of the priorities through the arbitration module.

[0099] In summary, the processing method of the TCP mirror data in the embodiment of the present disclosure identifies the target ISN number of the target TCP mirror packet sent to the preset buffer, wherein the TCP five-tuple of the target TCP mirror packet is consistent with the reference TCP five-tuple of the current TCP connection, determines the starting ISN number corresponding to the preset buffer, determines whether the target TCP mirror packet meets the preset sending condition according to the starting ISN number and the target ISN number, and sends the corresponding target TCP mirror packet to the server when the preset sending condition is met. In this technical solution, the reordering and rearrangement processing of the TCP mirror packet is performed based on the heterogeneous architecture, which reduces the occupancy rate of the central processor, improves the reordering and rearrangement efficiency of the TCP mirror packet, and meets the low-latency data transmission requirement.

[0100] When the target TCP mirror packet is reordered and rearranged, there may be a timeout sending problem. For example, when the above-mentioned post-window situation occurs, the target TCP mirror packet of the post-window will be directly output. With the reordering and rearrangement, the ISN number of the preset buffer is constantly updated, and when the target TCP mirror packet of the post-window is needed as an in-order target TCP mirror packet, an exception will occur. At this time, since the target TCP mirror packet has been directly output, the in-order target TCP mirror packet will be lost, the preset buffer will always cache other target TCP mirror packets, and the reordering and rearrangement module will be paralyzed.

[0101] For example, the in-order target TCP mirror packet arrives after a long delay, and other target TCP mirror packets already written in the preset buffer will be read out for a long time, causing data accumulation. The target TCP mirror packets that have not been processed for a long time will accumulate delay, affecting the overall performance of the system and the real-time performance of data transmission.

[0102] To solve the above timeout problem, the disclosure also proposes a processing method of TCP mirror data for solving the timeout problem. The method is also applied to the FPGA chip, and the FPGA chip is connected with the server through a preset bus interface. The FPGA chip is used for receiving a target TCP mirror packet of a current TCP connection processed by the server, wherein the TCP five-tuple of the target TCP mirror packet is consistent with a reference TCP five-tuple of the current TCP connection.

[0103] As shown in Figure 8 , the method comprises:

[0104] Step 801, the write waiting time length of the current start ISN number waiting to write the TCP mirror packet in the preset buffer in the FPGA chip is counted.

[0105] In an embodiment of the disclosure, a preset timer can be set in advance, and the timer starts from 0 every time the start ISN number of the preset buffer is updated. In this embodiment, the write waiting time length of the current start ISN number waiting to write the TCP mirror packet in the preset buffer in the FPGA chip is counted according to the preset timer.

[0106] Step 802, it is determined whether the write waiting time length is greater than a preset time threshold.

[0107] The preset time threshold can be set according to the size of the buffer space of the preset buffer, and the larger the preset buffer space is, the longer the corresponding preset time threshold can be set, and the like.

[0108] Step 803, when the write waiting time length is greater than the preset time threshold, the minimum ISN number of all ISN numbers of the target TCP mirror packet written in the preset buffer is determined.

[0109] In this embodiment, when the write waiting time length is greater than the preset time threshold, it indicates that the above timeout phenomenon occurs. Therefore, in order to ensure the order of the out-of-order rearrangement, the minimum ISN number of all ISN numbers of the target TCP mirror packet written in the preset buffer is determined.

[0110] In some possible embodiments, the first ISN number of all target TCP mirror packets written in the preset buffer can be identified, and the minimum ISN number is determined in the first ISN number. The minimum ISN number corresponds to the most recent buffer position of the written target TCP mirror packet.

[0111] In this embodiment, reference is made to Figure 9A pre-designed timer counter can be maintained in the FPGA chip. The counter continues to count before the target TCP mirror packet corresponding to the starting ISN number arrives. When the counter value exceeds the preset time threshold, the minimum value of the first ISN number of all target TCP mirror packets written is determined as 600.

[0112] In some possible embodiments, the second ISN number of the next target TCP mirror packet written after the current starting ISN number in the preset buffer is identified, and the second ISN number is determined as the minimum ISN number. For example, referring to the above embodiment, when the ISN number is determined as 500, the second ISN number of the next target TCP mirror packet written is 600. Figure 9

[0113] In step 804, the current starting ISN number of the preset buffer is updated to the minimum ISN number, the out-of-order rearrangement processing of the target TCP mirror packet is performed according to the updated preset buffer, and the target TCP mirror packet after the out-of-order rearrangement processing is sent to the server.

[0114] In an embodiment of the present disclosure, after the minimum ISN number is determined, the current starting ISN number of the preset buffer is updated to the minimum ISN number, that is, the ISN number of the target TCP mirror packet waiting for a long time is skipped. In this embodiment, the ISN number of the preset buffer can be updated to the starting ISN number, and then the out-of-order rearrangement processing of the target TCP mirror packet is performed according to the updated preset buffer, and the target TCP mirror packet after the out-of-order rearrangement processing is sent to the server.

[0115] In this embodiment, if the current starting ISN number is pointed by the pointer position of the preset pointer, 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 the current starting ISN number of the preset buffer is updated 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.

[0116] In actual execution process, in order to ensure that the current starting ISN number is updated only in the case of timeout, in an embodiment of the present disclosure, before the current starting ISN number of the preset buffer is updated to the minimum ISN number, it can be further determined whether the number of data packets of the target TCP mirror packet written in the preset buffer is greater than a preset data packet number threshold. The preset data packet number threshold can be calibrated according to the scene. When the number of data packets is greater than the preset data packet number threshold, the current starting ISN number of the preset buffer is further updated to the minimum ISN number.

[0117] ​In one embodiment of the present disclosure, the number of bytes written in the preset buffer can also be determined, and it is determined that the number of bytes is greater than a preset byte number threshold. When the number of bytes is greater than the preset byte number threshold, the current start ISN number of the preset buffer is further updated to the minimum ISN number. The preset byte number threshold can be set according to the scene. For example, the preset byte number can be 200 or the like.

[0118] That is, in the present embodiment, the current start ISN number of the preset buffer is updated to the minimum ISN number when the write waiting time is greater than the preset time threshold, and the number of bytes written in the preset buffer is greater than the preset byte number threshold. Figure 10 In the present embodiment, whether the corresponding TCP mirror packet has been written in the corresponding address in the preset buffer is marked in the bitmap in advance. At this time, the target TCP mirror packet stored in the buffer is searched through the bitmap, and the pointer position of the preset pointer is updated to this position. The target TCP mirror packet stored in the buffer is output, so as to maintain the stable operation of the preset buffer.

[0119] In some possible embodiments, when the write waiting time is greater than the preset time threshold, the current start ISN number of the preset buffer is updated to the minimum ISN number only when the number of data packets of the target TCP mirror packet written is greater than a preset data packet number threshold, and / or the number of bytes written is greater than a preset byte number threshold. That is, a plurality of judgment conditions are combined to jointly process the normal operation of the buffer.

[0120] In some possible embodiments, even if the write waiting time is not greater than the preset time threshold, the current start ISN number of the preset buffer can also be updated to the minimum ISN number when 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. Thus, even in some scenes where the preset time threshold is set relatively large, the memory overflow problem of the preset buffer can be found in time, the problem of long-time no output of the target TCP mirror packet in the preset buffer is avoided, and the output delay of the target TCP mirror packet is reduced.

[0121] In some possible embodiments, even if the number of bytes written is not greater than the preset byte number threshold, and / or the number of data packets of the target TCP mirror packet written is not greater than the preset data packet number threshold, the current start ISN number of the preset buffer can also be updated to the minimum ISN number when the write waiting time is greater than the preset time threshold. Thus, the timeout problem is solved in advance, and the problem of long-time no data output is avoided.

[0122] Therefore, in the technical solution, the timeout and the memory overflow protection mechanism are combined, various abnormal scenarios of the preset buffer can be flexibly coped with, and stable and efficient operation of the preset buffer is ensured. The protection mechanism can effectively manage the preset buffer, ensure stable operation of the out-of-order rearrangement function, and prevent the out-of-order rearrangement function from being disturbed by abnormal scenarios with a small probability, thereby optimizing the TCP out-of-order processing function under a heterogeneous architecture.

[0123] In summary, the method for processing TCP mirror data according to the embodiment of the disclosure, the write waiting duration of the current start ISN number waiting to be written into the TCP mirror packet in the preset buffer in the FPGA chip is counted, it is determined whether the write waiting duration is greater than the preset duration threshold, when the write waiting duration is greater than the preset duration threshold, the minimum ISN number in all ISN numbers of the write target TCP mirror packet in the preset buffer is determined, then the current start ISN number of the preset buffer is updated to the minimum ISN number, and the out-of-order rearrangement processing of the target TCP mirror packet is performed according to the updated preset buffer, and the target TCP mirror packet after the out-of-order rearrangement processing is sent to the server. In the technical solution, the timeout problem of the preset buffer is found in time, the current start ISN number that is not received due to the timeout is updated, and stable operation of the out-of-order rearrangement function based on the heterogeneous structure is ensured.

[0124] Based on the above embodiment, the TCP processed by the server can change, therefore, the reference TCP five-tuple constructed according to the original TCP connection cannot be used to continue receiving the TCP mirror packet of the new TCP connection, in this case, TCP reconnection processing needs to be performed.

[0125] The method for processing TCP mirror data for performing TCP reconnection processing according to the embodiment of the disclosure is described below with reference to the embodiment. In the method, for the convenience of description, the current TCP connection is represented as the original TCP connection, and the preset buffer of the original TCP connection is represented as the first buffer.

[0126] Figure 11 The flowchart of the method for processing TCP mirror data according to another embodiment of the disclosure is shown in FIG. 11, the method includes: Figure 11

[0127] In step 1110, it is determined whether the preset TCP reconnection condition is met according to the first current TCP mirror packet.

[0128] In the technical solution of the disclosure, the first current TCP mirror packet is obtained, the first current TCP mirror packet can be a current TCP mirror packet obtained through a network interface or a bus interface, and it is determined whether the preset TCP reconnection condition is met according to the first current TCP mirror packet. ​

[0129] It should be noted that in different application scenarios, the manner of determining whether the preset TCP reconnection condition is met according to the first current TCP mirror packet is different, for example as follows:

[0130] In an embodiment of the present disclosure, the first TCP five-tuple corresponding to the original TCP connection is determined, the second TCP five-tuple of the first current TCP mirror packet is extracted, and it is determined whether the first TCP five-tuple and the second TCP five-tuple are consistent. If they are not consistent, it is determined that the preset TCP reconnection condition is met.

[0131] In the present embodiment, in order to improve the comparison efficiency, any one five-tuple parameter of the first TCP five-tuple and the second TCP five-tuple can be directly compared, for example, only whether the destination port in the first TCP five-tuple and the second TCP five-tuple is consistent can be identified, and if not, it is directly determined that the first TCP five-tuple and the second TCP five-tuple are not consistent.

[0132] That is, in the present embodiment, with reference to Figure 12 In the five-tuple filtering module of the FPGA chip, it is directly determined whether the destination port in the second TCP five-tuple changes relative to the first TCP five-tuple.

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

[0134] That is, in the present embodiment, with reference to Figure 12 In the out-of-order rearrangement module, it is determined whether the current ISN number of the first current TCP mirror packet changes significantly.

[0135] In the present embodiment, the minimum ISN number difference between the current ISN number and all the ISN numbers can also be calculated, and it is determined whether the minimum ISN number difference is greater than a preset ISN number difference threshold. That is, when the current ISN number changes significantly, and the small ISN number difference is greater than the preset ISN number difference threshold, it is determined that the current ISN number changes significantly, and thus it is determined that the preset TCP reconnection condition is met.

[0136] Of course, in an embodiment of the present disclosure, in order to improve the sensitivity of reconnection identification, when the current ISN number does not belong to all the ISN numbers in the first buffer, the maximum ISN number difference between the current ISN number and all the ISN numbers can also be calculated, and it is 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 is determined that the preset TCP reconnection condition is met.

[0137] The above manner of determining whether the preset reconnection condition is met based on the quintuple and the ISN number can be executed singly, that is, any one of the above conditions is met and the preset reconnection condition is considered to be met, or can be executed jointly, that is, the preset reconnection condition is considered to be met only when the above two conditions are met.

[0138] In step 1120, 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 mirror packet to be output.

[0139] In one embodiment of the present disclosure, 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 mirror packet to be output. The second buffer can be a RAM area in the FPGA.

[0140] In step 1130, when the first buffer contains the 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 into the corresponding buffer through the write interface.

[0141] In step 1140, in response to the first buffer not containing the 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, so that the corresponding TCP mirror packet is sent to the server through the read interface of the second buffer.

[0142] In this embodiment, when the first buffer contains the 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 into the corresponding buffer through the write interface. In response to the first buffer not containing the 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, so that the corresponding TCP mirror packet is sent to the server through the read interface of the second buffer.

[0143] That is, in this embodiment, in response to obtaining the second current TCP mirror packet, the third TCP quintuple of the second current TCP mirror packet is identified, it is determined whether the third TCP quintuple is consistent with the second TCP quintuple, and when the third TCP quintuple is consistent with the second TCP quintuple, the second TCP quintuple is written into the second buffer through the write interface of the second buffer. In addition, the first TCP quintuple is updated after reconnection, that is, the original TCP connection corresponding to the first TCP quintuple pre-configured in the FPGA chip is deleted, and the second TCP quintuple is configured in the FPGA chip.

[0144] That is, in this embodiment, referring to Figure 13 If 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.

[0145] 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.

[0146] 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.

[0147] In summary, the method for processing TCP mirror data in the embodiment of the present disclosure, in response to obtaining the first current TCP mirror packet, determines whether the preset TCP reconnection condition is met according to the first current TCP mirror packet, constructs a second buffer in the FPGA chip when the preset TCP reconnection condition is met, and identifies whether the first buffer contains the target TCP mirror packet to be output. When the first buffer contains the 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 in the corresponding buffer through the write interface. In response to the first buffer not containing the 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, so that the corresponding TCP mirror packet is sent to the server through the read interface of the second buffer. In the technical solution, the out-of-order rearrangement processing based on the heterogeneous structure is realized, and the normal out-of-order rearrangement operation is ensured during the reconnection, the smooth transition is realized, the continuity and integrity of the out-of-order rearrangement processing are ensured, and the reliability and stability of the heterogeneous structure are improved.

[0148] In order to realize the above-mentioned embodiment, the present disclosure further provides a device for processing TCP mirror data.

[0149] Figure 14 A structural schematic diagram of a device for processing TCP mirror data provided by the embodiment of the present disclosure is provided. The device can be realized by software and / or hardware, and can be generally integrated in an FPGA chip. The FPGA chip is connected with a server through a preset bus interface. As shown in the figure, the device comprises an identification module 1410, a determination module 1420 and a processing module 1430. Figure 14

[0150] The identification module 1410 is configured to identify the target ISN number of the target TCP mirror packet sent to the preset buffer, wherein the TCP five-tuple of the target TCP mirror packet is consistent with the reference TCP five-tuple of the current TCP connection.

[0151] The determination module 1420 is configured to determine the starting ISN number corresponding to the preset buffer, and determine whether the target TCP mirror packet meets the preset sending condition according to the starting ISN number and the target ISN number.

[0152] The processing module 1430 is configured to send the corresponding target TCP mirror packet to the server when the preset sending condition is met.

[0153] The device for processing TCP mirror data provided by the embodiment of the present disclosure can execute the method for processing TCP mirror data provided by any embodiment of the present disclosure, and has the corresponding function modules and beneficial effects of the execution method.​

[0154] To achieve the above-mentioned embodiments, the present disclosure further proposes a computer program product comprising computer programs / instructions which, when executed by a processor, implement the TCP mirror data processing method in the above-mentioned embodiments.

[0155] To achieve the above-mentioned embodiments, the present disclosure further proposes an FPGA chip, which is connected with a server through a pre-set bus interface, and is used to execute any of the TCP mirror data processing methods.

[0156] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present 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 executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through a communication device, or installed from a memory, or installed from a ROM. When the computer program is executed by a processor, the above-mentioned functions defined in the TCP mirror data processing method of the embodiments of the present disclosure are executed.

[0157] It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present disclosure, the computer readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium other than the computer readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained in the computer readable medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, a RF (radio frequency) or the like, or any suitable combination of the above.

[0158] The computer readable medium described above can be contained in the FPGA chip described above, or can exist separately and not be assembled into the electronic device.

[0159] The computer readable medium described above carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the processing method for concentrating TCP mirror data.

[0160] FPGA chips can be programmed in one or more programming languages or combinations thereof, including but not limited to Verilog, VHDL, and the like, to execute computer program code for performing the operations of the present disclosure. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0161] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functionalities, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams or block diagrams can represent a module, a procedure, or a part of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in some cases, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flow diagrams, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0162] The units described in the embodiments of the present disclosure can be implemented by means of software, or by means of hardware. In some cases, the names of the units do not constitute a limitation on the units themselves. The functions described above can be performed at least in part by one or more hardware logic components. For example, non-limiting examples of exemplary types of hardware logic components that can be used include field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0163] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include a lined- up electrical connection, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0164] The above description is only the preferred embodiment of the present disclosure and the explanation of the principles of the applied technology. It should be understood by those skilled in the art that the disclosure range involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the technical features described above, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the technical solutions formed by replacing the above features with the technical features disclosed in the present disclosure (but not limited to) having similar functions.

[0165] In addition, although each operation is described in a particular order, this should not be understood as requiring the operations to be performed in the specific order shown or in a sequential order. In certain circumstances, multitasking and parallel processing can be advantageous. Similarly, although several implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments can also be combined in a single embodiment. Conversely, various features described in the context of a single embodiment can also be separated and implemented in multiple embodiments.

[0166] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. A method for processing TCP mirrored data, the method comprising: The method is applied to an FPGA chip, the FPGA chip is connected with a server through a preset bus interface, and the FPGA chip is used for receiving a target TCP mirror packet of a current TCP connection processed by the server, wherein a TCP five-tuple of the target TCP mirror packet is consistent with a reference TCP five-tuple of the current TCP connection, and the method comprises the following steps: statistically determining a write waiting time length of a current starting ISN number in a preset buffer of the FPGA chip waiting for writing a target TCP mirror packet; determining whether the write waiting time length is greater than a preset time threshold; when the write waiting time length is greater than the preset time threshold, determining a minimum ISN number among all ISN numbers of the target TCP mirror packet written in the preset buffer; updating the current starting ISN number of the preset buffer to the minimum ISN number, and performing out-of-order rearrangement processing on the target TCP mirror packet according to the updated preset buffer, and sending the target TCP mirror packet after the out-of-order rearrangement processing to the server.

2. The method of claim 1, wherein, The method comprises the following steps: statistically determining a write waiting time length of a current starting ISN number in a preset buffer of the FPGA chip waiting for writing a target TCP mirror packet.

3. The method of claim 1, wherein, Before the current starting ISN number of the preset buffer is updated to the minimum ISN number, the method further comprises the following steps: determining a data packet quantity of the target TCP mirror packet written in the preset buffer, and determining that the data packet quantity is greater than a preset data packet quantity threshold.

4. The method of claim 1 or 3, wherein, Before the current starting ISN number of the preset buffer is updated to the minimum ISN number, the method further comprises the following steps: determining a byte quantity written in the preset buffer, and determining that the byte quantity is greater than a preset byte quantity threshold.

5. The method of any one of claims 1-3, wherein, The method comprises the following steps: identifying a first ISN number of all the target TCP mirror packets written in the preset buffer; determining the minimum ISN number in the first ISN number.

6. The method of any one of claims 1-3, wherein, The method comprises the following steps: identifying a second ISN number of the target TCP mirror packet written after the current starting ISN number in the preset buffer; determining that the second ISN number is the minimum ISN number.

7. The method of claim 1, wherein, The method further comprises the following steps: controlling a pointer position of a preset pointer to be located at a corresponding position of the current starting ISN number in the preset buffer; After the current starting ISN number of the preset buffer is updated to the minimum ISN number, the method further comprises the following steps: updating the pointer position of the preset pointer to a corresponding position of the minimum ISN number in the preset buffer.

8. A TCP mirror data processing apparatus, characterized by, The device is applied to an FPGA chip, the FPGA chip is connected with a server through a preset bus interface, the FPGA chip is used for receiving a target TCP mirror packet of a current TCP connection processed by the server, wherein a TCP five-tuple of the target TCP mirror packet is consistent with a reference TCP five-tuple of the current TCP connection, and the device comprises: a statistical module, which is used for counting a write waiting time length of a current starting ISN number waiting for writing in the target TCP mirror packet in a preset buffer in the FPGA chip; a first determination module, which is used for determining whether the write waiting time length is greater than a preset time threshold; a second determination module, which is used for determining a minimum ISN number among all ISN numbers of the target TCP mirror packet written in the preset buffer when the write waiting time length is greater than the preset time threshold; a processing module, which is used for updating the current starting ISN number of the preset buffer to the minimum ISN number, performing out-of-order rearrangement processing of the target TCP mirror packet according to the updated preset buffer, and sending the target TCP mirror packet after the out-of-order rearrangement processing to the server.

9. An FPGA chip, characterized by The FPGA chip is connected with a server through a preset bus interface, the FPGA chip is used for receiving a target TCP mirror packet of a current TCP connection processed by the server, wherein a TCP five-tuple of the target TCP mirror packet is consistent with a reference TCP five-tuple of the current TCP connection, and the FPGA chip is used for executing the processing method of the TCP mirror data in any one of claims 1-7.

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

Citation Information

Patent Citations

  • Method and device for processing TCP (Transmission Control Protocol) data

    CN114726920A

  • Data storage method and device based on out-of-order rearrangement and medium

    CN117424866A