Network card link layer TCP retransmission offloading method and system
By monitoring the sending and receiving process of the TCP link on the network card, detecting ACK message anomalies and initiating timeout retransmission, the performance loss problem caused by the retransmission mechanism in TCP transmission is solved, and the link layer TCP retransmission mechanism is offloaded and Improvement of system protocol stack performance.
Patent Information
- Application Number
- CN202311400771.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-26
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2043-10-26
AI Technical Summary
In the existing technology, the performance loss of the system protocol stack due to the retransmission mechanism during the TCP transmission process is large, and the implementation complexity of the system protocol stack is increased.
Monitor the message sending process through the TCP link between the sender and the receiver through the network card, back up the message when detecting an abnormality in the ACK message, initiate TCP timeout retransmission of the network card, and resume the normal sending process after the retransmission is completed, reducing the burden on the system protocol stack.
It realizes the offloading of the TCP retransmission mechanism at the network card link layer, reduces the performance loss of the system protocol stack caused by the retransmission mechanism during TCP transmission, simplifies the functions of the network transport layer, and ensures the reliability and performance of data transmission.
Smart Images

Figure CN117459608B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of network communication, and in particular relates to a network card link layer TCP retransmission unloading method and system. Background Art
[0002] The Ethernet adapter is an Ethernet network interface card that complies with the PCI Express protocol standard and usually supports Microsoft Windows, Linux, Unix and other operating systems. The current operating system puts the TCP checksum function of the protocol stack into the network adapter to reduce the CPU load, but the system protocol stack still needs to perform retransmission timeout processing or congestion control, resulting in serious performance loss. In addition, because the network transport layer is not only responsible for data transmission, the implementation complexity of the system protocol stack is increased. Summary of the invention
[0003] In order to solve at least one technical problem proposed by the present invention, a first aspect of the present invention provides a link layer TCP retransmission offloading method of a network card, wherein:
[0004] The network card monitors the message sending process and the ACK message waiting process of each TCP link initiated by the protocol stack of the sending end to the protocol stack of the receiving end;
[0005] When it is monitored that the ACK message is received abnormally, backing up the message sent by the protocol stack of the sending end to the protocol stack of the receiving end;
[0006] When the ACK message is not received within the specified time, the network card TCP timeout retransmission process is initiated, and the network card TCP timeout retransmission process includes retransmitting the backup message;
[0007] At the same time, the protocol stack of the sending end continues to wait for receiving an ACK message from the protocol stack of the receiving end;
[0008] After the network card TCP timeout retransmission process is completed, the protocol stack of the sending end receives the correct ACK message and then enters the next message sending process.
[0009] The second aspect of the present invention provides a network card link layer TCP retransmission offload system, the network card includes at least one processor; and a memory storing instructions, which, when executed by at least one processor, implements the steps of the aforementioned method.
[0010] A third aspect of the present invention provides a computer-readable storage medium having computer instructions stored thereon, which implement the steps of the aforementioned method when executed by a processor.
[0011] The beneficial effect of the present invention is that the unloading of the link layer TCP retransmission mechanism of the network card is realized, and the system protocol stack performance loss caused by the retransmission mechanism during the TCP transmission process is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 . Network card working principle diagram;
[0013] Figure 2 . Flowchart of the network card link layer TCP retransmission offloading method of some embodiments;
[0014] Figure 3 .Schematic diagram of network card TCP timeout retransmission implementation in some embodiments;
[0015] Figure 4 . Schematic diagram of the abnormal handling of repeated reception of network card ACK messages in some embodiments;
[0016] Figure 5 .Schematic diagram of the network card link layer TCP retransmission offload system in some embodiments. DETAILED DESCRIPTION
[0017] Various aspects of the present disclosure will now be explained with reference to the accompanying drawings. As long as the shapes, relative positions and other aspects of the components described in these aspects are not clearly defined, the scope of the present disclosure is not limited to the components shown, which are only used for illustrative purposes. In addition, although many details are set forth, it should be understood that some aspects of the present disclosure can be implemented without these details. In other cases, well-known communication protocols, circuits and technologies are not shown in detail to avoid obscuring the understanding of the description.
[0018] Terminology explanation:
[0019] The link layer is the second layer of the OSI model, namely the data link layer.
[0020] A network card is a network adapter and is a data link layer device.
[0021] TCP (Transmission Control Protocol) transmission control protocol.
[0022] Retransmission mechanism TCP will retransmit lost data, including timeout retransmission, fast retransmission, SACK method, and Duplicate SACK.
[0023] ACK (Acknowledge character) is a confirmation character, indicating that the received characters are error-free. In the TCP / IP protocol, if the receiver successfully receives the data, it will reply with an ACK data.
[0024] A protocol stack, also known as a protocol stack, is a specific software implementation of a computer network protocol suite.
[0025] SACK (selective Acknowledge) stands for selective confirmation, which notifies the receiver that the message has been received.
[0026] LOF, the full name of Local Outlier Factor, is a very classic density-based anomaly detection algorithm (Breuning et. al. 2000). The expression formula of the LOF algorithm is as follows: LOF(x) = (sum(Neighbors(x)) / k) / sum(reachability_distance(Neighbors(x), x)), where LOF(x) represents the outlier factor of data point x, and Neighbors(x) represents the outlier factor when x is X n When the current X n ACK message and X n-1 The density of ACK messages between points p and q is represented by reachability_distance(p, q). LOF(x) calculates the connectivity between x's neighbor points and x, and the connectivity between neighbor points and their neighbor points, thus comprehensively considering the relative connectivity of data points to calculate their outlier scores.
[0027] The basic principle of a known network card (network adapter) is as follows Figure 1 As shown, the computer device can be connected to the network card through the PCI Express interface, the computer device is configured with an operating system and a network application, and the network card is configured with a network card driver. The operating system includes a protocol stack responsible for network communication, and the protocol stack includes a TCP module that needs to be connected, a UDP module that does not need to be connected, and an IP module for transmitting network packets and determining routes. The network application includes a browser, a mail client, a Web server or a mail server, etc., which can be used as a sending end or a receiving end according to the needs of actual business. In addition, network cards of other principles are also within the scope of the present invention, that is, the present invention does not specifically limit the network card technology other than the following embodiments of the present invention.
[0028] The current operating system puts the TCP checksum offload function of the protocol stack into the network adapter to reduce the CPU load, but the system protocol stack still needs to perform retransmission timeout processing or congestion control, which results in serious performance loss. In addition, because the network transport layer is not only responsible for data transmission, the implementation complexity of the system protocol stack is increased.
[0029] The following embodiments can solve various technical problems including the above technical problems, and thus have various technical effects.
[0030] like Figure 2 As shown, some embodiments of the present invention provide a link layer TCP retransmission offloading method for a network card, wherein
[0031] S1: The network card monitors the process of sending messages and waiting for receiving ACK messages for each TCP link initiated by the protocol stack of the sending end to the protocol stack of the receiving end;
[0032] S2: when it is monitored that the ACK message is received abnormally, back up the message sent by the protocol stack of the sending end to the protocol stack of the receiving end;
[0033] S3: When the ACK message is not received within the specified time, the network card TCP timeout retransmission process is initiated, and the network card TCP timeout retransmission process includes retransmitting the backup message; at the same time, the protocol stack of the sending end continues to wait for receiving the ACK message of the protocol stack of the receiving end;
[0034] S4: After the network card TCP timeout retransmission process is completed, the protocol stack of the sending end receives the correct ACK message and then enters the next message sending process.
[0035] In these embodiments, the TCP retransmission mechanism of the network card link layer is unloaded, and the performance loss of the system protocol stack caused by the retransmission mechanism during TCP transmission is reduced. It is ensured that the network transport layer is only responsible for data transmission, and the implementation complexity of the system protocol stack is reduced. Specifically, the network transport layer provides logical communication between application processes horizontally to achieve end-to-end reliable or unreliable transmission. Vertically, the upper layer data is segmented and passed to the network layer below it to achieve functions such as timeout retransmission congestion control.
[0036] In a specific embodiment, Figure 3 As shown, the sending end includes a protocol stack (system protocol stack) and a network card, and the receiving end includes a protocol stack.
[0037] The network card monitors the sending operation process of each TCP link initiated by the protocol stack of the sending end to the protocol stack of the receiving end (for example, sending "messages 1000-1499") and the process of waiting to receive ACK messages;
[0038] When it is monitored that the ACK message reception is abnormal (for example, "ACK1500 message" is lost, "ACK 2000 message" is lost), the sending message sent by the protocol stack of the sending end to the protocol stack of the receiving end is backed up (backed up "messages 1500-1999", backed up "messages 1000-1499");
[0039] When it is monitored that the ACK message is still not received within the specified time RTO (Retransmission Timeout) (that is, the RTO timeout is detected), the network card TCP timeout retransmission process is initiated, and the network card TCP timeout retransmission process includes retransmitting the backup sent message (for example, starting from the first unanswered message group 1000-1499, retransmitting "messages 1000-1499" and "messages 1500-1999"); at the same time, the protocol stack of the sending end continues to wait for receiving the ACK message of the protocol stack of the receiving end.
[0040] After the TCP timeout retransmission process of the network card ends, the protocol stack of the sending end receives the correct ACK message (receives "message ACK 2000"), notifies the receiving party that I have received the message (SACK 1000~1499), and then enters the next sending operation process (sending "messages 2000~2499").
[0041] The link layer TCP retransmission offloading method of the network adapter based on any of the above embodiments,
[0042] The network card also monitors the real-time ACK message response time of each TCP link initiated by the protocol stack of the sending end to the protocol stack of the receiving end;
[0043] When it is detected that the ACK message is received abnormally, backing up the sending message sent by the protocol stack of the sending end to the protocol stack of the receiving end;
[0044] When monitoring detects that three identical ACK messages are received consecutively, the network card congestion control process is initiated.
[0045] In these embodiments, when the sender of the traditional protocol stack receives three identical ACKs in succession, it indicates that the network is congested, and then a congestion control operation is taken. The network card of these embodiments of the present invention monitors the real-time ACK message response time for each TCP connection. When the response interval of consecutive ACK messages is abnormal, it is considered that the network condition corresponding to the current link is poor, and synchronous backup message sending begins. When the network card monitors that a TCP link receives three identical ACK messages in succession, it enters the congestion control process. After the network card congestion control ends, the correct ACK message is uploaded to the system protocol stack, and the previous sending process continues.
[0046] In a specific embodiment, Figure 4 As shown, the sending end includes a protocol stack and a network card, and the receiving end includes a protocol stack.
[0047] The network card also monitors the sending operation process of each TCP link initiated by the protocol stack of the sending end to the protocol stack of the receiving end (for example, sending "messages 500-999", "messages 1000-1499", "messages 1500-1999", "messages 2000-2499", "messages 2500-999") and the process of waiting for receiving ACK messages (for example, "message SACK 2000", "message SACK 2500", "message SACK 3000"), and the real-time ACK message response time;
[0048] When it is detected that the interval between consecutive ACK message responses is abnormal (one of the situations where the ACK message reception is abnormal), backing up the sending message sent by the protocol stack of the sending end to the protocol stack of the receiving end;
[0049] When the monitoring detects that three identical ACK messages ("ACK 1000" messages) are received in succession, the network card congestion control process is initiated (retransmitting "messages 1000 to 1499"). After that, the protocol stack continues to send operations ("messages 3000 to 3499").
[0050] In the link layer TCP retransmission offloading method of the network adapter based on any of the above embodiments, the method for monitoring the abnormal reception of the ACK message is:
[0051] Obtain a current ACK message and several adjacent ACK messages before the current ACK message;
[0052] The outlier factor of the current ACK message is calculated according to the LOF algorithm, and the LOF algorithm is shown in Formula 1:
[0053] LOF(x)=(sum(Neighbors(x)) / k) / sum(reachability_distance(Neighbors(x),x))(1)
[0054] Where LOF(x) represents the outlier factor of the current ACK message x, Neighbors(x) represents the k most recent ACK messages before the current ACK message x; reachability_distance(p, q) represents the reachable distance from the current ACK message to the most recent ACK message;
[0055] If the outlier factor of the current ACK message is greater than the threshold, it is determined that the ACK message is received abnormally.
[0056] In these embodiments, the original protocol stack has no monitoring and prediction mechanism for network timeout retransmission and congestion. Once it occurs, it is too late. The LOF(x) algorithm not only fills the gap that the protocol stack does not implement, but also is implemented in the network card to predict network congestion in advance. The algorithm accurately captures the changing trend of the risk factor of impending network congestion by analyzing the density of ACK message arrival time.
[0057] In the link layer TCP retransmission offloading method of the network adapter based on any of the above embodiments, if the outlier factor of the current ACK message is less than or equal to the threshold, the current ACK message no longer participates in the LOF algorithm calculation of the subsequent ACK message.
[0058] In these embodiments, when the outlier value LOF(x) (outlier factor) is relatively small, the data point x corresponding to the outlier value LOF(x) at this time does not participate in the subsequent LOF algorithm for density calculation.
[0059] In the link layer TCP retransmission offloading method for a network adapter based on any of the above embodiments, in the LOF algorithm, the periodic RTT of each reception of the ACK message participates in the density calculation.
[0060] In these embodiments, the periodic RTT (Round Trip Time, i.e., the round trip time of a connection, i.e., the difference between the time when data is sent and the time when confirmation is received) of each received ACK message is used as a density calculation unit, and the algorithm is optimized through the condition of density analysis of the arrival time of the ACK message.
[0061] In the link layer TCP retransmission offloading method for a network adapter based on any one of the above embodiments, the threshold is 20%; and the plurality of adjacent ACK messages are 10 adjacent ACK messages.
[0062] In these embodiments, when the outlier value LOF(x) (outlier factor) is less than or equal to 20%, the network connection is very smooth. At this time, the data point x corresponding to the outlier value LOF(x) does not participate in the subsequent LOF algorithm for density calculation. Considering the network card LOF(x n ) The performance loss of the calculation is, in a specific embodiment, 10 (k value) adjacent ACK messages, which are applied in some scenarios considering the impact on network card transmission.
[0063] From the above multiple embodiments, it can be seen that the present invention makes the following adjustments to the LOF algorithm:
[0064] (1) When the outlier LOF(x) (outlier factor) is small (<20%), it can be understood that the network connection is very smooth. At this time, the data point x corresponding to the outlier LOF(x) is no longer involved in the density calculation.
[0065] (2) Taking into account the premise of not reducing the transmission performance of the network card, the value of k is limited to 10, and the neighbors of point x are the previous k nodes that sent messages.
[0066] (3) When LOF(x) is too large, the data point x at this time is the data point that needs attention and causes network timeout retransmission or congestion retransmission.
[0067] In the link layer TCP retransmission offloading method of the network adapter based on any of the above embodiments, the LOF algorithm is as shown in Formula 2-4:
[0068] Fn(X n )=Sum(Neighbors(X n )) / 10= [RTT(X n )-RTT(X n-10 )+RTT(X n )-RTT(X n-9 )+……+RTT(X n )-RTT(X n-1 )] / 10 (2)
[0069] Fn 10 =Sum(reachability_distance(Neighbors(X n ),X))=[Fn( Xn-10 )+Fn(X n-9 )+……+Fn(X n-1 )] / 10 (3)
[0070] LOF(X n ) = Fn(X n ) / Fn 10 (4)
[0071] Among them, F n (X n ) represents the density value corresponding to the ACK message Xn;
[0072] Xn indicates the nth time the sender receives the ack message (indicating an action);
[0073] Sum() represents the summation formula;
[0074] Neighbors(X n ) indicates X n With X n-1 The density between
[0075] RTT(X n ) indicates sending message X nThe RTT calculated at
[0076] RTT(X n-10 ) indicates sending message X n-10 The RTT calculated at
[0077] RTT(X n-9 ) indicates sending message X n-9 The RTT calculated at
[0078] RTT(X n-1 ) indicates sending message X n-1 The RTT calculated at
[0079] Fn 10 Indicates ACK message X n Average density of the previous 10 ACK messages;
[0080] reachability_distance(Neighbors(X n ),X) represents the use of formula F n (X n ) = Sum(Neighbors(X n )) / 10 respectively calculate Fn(X n-10 ),Fn(X n-9 ),…Fn(X n-1 ) 10 F n A collection of values;
[0081] Fn(X n-10 ) indicates ACK message X n-10 The corresponding density value;
[0082] Fn(X n-9 ) indicates ACK message X n-9 The corresponding density value;
[0083] Fn(X n-1 ) indicates ACK message X n-1 The corresponding density value;
[0084] LOF(X n ) indicates ACK message X n The corresponding anomaly coefficient (outlier factor) is a relative value, relative to the density values of the 10 ACKs before it.
[0085] In these embodiments, it is assumed that the periodic RTT (Round Trip Time of a connection, i.e., the difference between the time when data is sent and the time when confirmation is received) of each received ACK message is a density calculation unit. n) and then take 10 more points, a total of 11 points to participate in X n Point density calculation sum(Neighbors(X n )) / 10 Calculation. X n The previous 10 points participate in the calculation of the density of neighboring points of point Xn sum(reachability_distance(Neighbors(X n ), X n ), and finally get point X n The outlier factor LOF(X n ). When LOF(x) > 80%, it is considered that the ACK message reception is abnormal, and the message sending synchronization backup mechanism is immediately started.
[0086] Some other embodiments of the present invention provide a link layer TCP retransmission offload system 1, which includes at least one processor 2; a memory 3, a network interface 4, and a system interface 5. The memory 3 stores instructions, and when the instructions are executed by at least one processor 2, the steps of the aforementioned method are implemented.
[0087] The embodiments and functional operations of the subject matter described in this specification may be implemented in: digital electronic circuitry, tangibly implemented computer software or firmware, computer hardware, including the structures disclosed in this specification and their structural equivalents, or a combination of more than one of the above. The embodiments of the subject matter described in this specification may be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on one or more tangible non-transitory program carriers, for execution by a data processing device or to control the operation of a data processing device.
[0088] Although this specification contains many specific implementation details, these should not be interpreted as limitations on the scope of any invention or the scope of what can be claimed, but rather as an illustration of features that can concretize a particular embodiment of a particular invention. The specific features described in this specification in the context of independent embodiments can also be implemented in combination with a single embodiment. Conversely, the various features described in the context of a single embodiment can also be implemented independently in multiple embodiments, or in any suitable sub-combination. In addition, although the features can be described above as a combination effect and even initially required, one or more features from the required combination can be removed from the combination in some cases, and the required combination can be turned to a sub-combination or a variation of the sub-combination.
Claims
1. A method for implementing TCP retransmission offloading at a network card link layer, characterized in that: The network card monitors the message sending process and the ACK message waiting process of each TCP link initiated by the protocol stack of the sending end to the protocol stack of the receiving end; When it is monitored that the ACK message is received abnormally, backing up the message sent by the protocol stack of the sending end to the protocol stack of the receiving end; When the ACK message is not received within the specified time, the network card TCP timeout retransmission process is initiated, and the network card TCP timeout retransmission process includes retransmitting the backup message; at the same time, the protocol stack of the sending end continues to wait for receiving the ACK message of the protocol stack of the receiving end; After the TCP timeout retransmission process of the network card ends, the protocol stack of the sending end receives the correct ACK message and then enters the next message sending process; The method for monitoring the abnormal reception of the ACK message is: Obtain a current ACK message and several adjacent ACK messages before the current ACK message; The outlier factor of the current ACK message is calculated according to the LOF algorithm, and the LOF algorithm is shown in formula (1): LOF(x)=(sum(Neighbors(x)) / k) / sum(reachability_distance(Neighbors(x),x))(1) Among them, LOF(x) represents the outlier factor of the current ACK message x, and Neighbors(x) represents the outlier factor when x is X n When the current X n ACK message and X n-1 The density between ACK messages; reachability_distance() represents the reachable distance from the current ACK message to the nearest ACK message; sum() represents the summation function; If the outlier factor of the current ACK message is greater than the threshold, it is determined that the ACK message is received abnormally.
2. A method for implementing TCP retransmission offloading at a network card link layer as claimed in claim 1, characterized in that: The network card also monitors the real-time ACK message response time of each TCP link initiated by the protocol stack of the sending end to the protocol stack of the receiving end; When it is monitored that the ACK message is received abnormally, backing up the message sent by the protocol stack of the sending end to the protocol stack of the receiving end; When monitoring detects that three identical ACK messages are received consecutively, the network card congestion control process is initiated.
3. A method for implementing TCP retransmission offloading at a network card link layer as claimed in claim 1, characterized in that: If the outlier factor of the current ACK message x is less than or equal to the threshold, the current ACK message x no longer participates in the LOF algorithm calculation of subsequent ACK messages.
4. A method for implementing TCP retransmission offloading at a network card link layer as claimed in claim 3, characterized in that: In the LOF algorithm, the periodic RTT of each reception of the ACK message participates in the density calculation.
5. A method for implementing TCP retransmission offloading at a network card link layer as claimed in claim 4, characterized in that: The threshold is 20%.
6. A method for implementing TCP retransmission offloading at a network card link layer as claimed in claim 5, characterized in that: The plurality of adjacent ACK messages are 10 adjacent ACK messages.
7. A method for implementing TCP retransmission offloading at a network card link layer as claimed in claim 6, characterized in that: The LOF algorithm is shown in equations (2), (3) and (4): Fn(X n )=Sum(Neighbors(X n )) / 10=[RTT(X n )-RTT(X n-10 )+RTT(X n )-RTT(X n-9 )+……+RTT(X n )-RTT(X n-1 )] / 10 (2) Fn 10 =Sum(reachability_distance(Neighbors(X n ),X))=[Fn( Xn-10 )+Fn(X n-9 )+……+Fn(X n-1 )] / 10 (3) LOF(X n ) = Fn(X n ) / Fn 10 (4) Among them, F n (X n ) represents the density value corresponding to the ACK message Xn; Xn indicates the nth time the sender receives the ack message; Sum() represents the summation formula; Neighbors(X n ) indicates X n With X n-1 The density between RTT(X n ) indicates sending message X n The RTT calculated at RTT(X n-10 ) indicates sending message X n-10 The RTT calculated at RTT(X n-9 ) indicates sending message X n-9 The RTT calculated at RTT(X n-1 ) indicates sending message X n-1 The RTT calculated at Fn 10 Indicates ACK message X n Average density of the previous 10 ACK messages; reachability_distance(Neighbors(X n ),X) represents the use of formula F n (X n )=Sum(Neighbors(X n )) / 10 respectively calculate Fn(X n-10 ),Fn(X n-9 ),…Fn(X n-1 )10 F n A collection of values; Fn(X n-10 ) indicates ACK message X n-10 The corresponding density value; Fn(X n-9 ) indicates ACK message X n-9 The corresponding density value; Fn(X n-1 ) indicates ACK message X n-1 The corresponding density value; LOF(X n ) indicates ACK message X n The corresponding anomaly coefficient.
8. A network card link layer implements TCP retransmission offloading system, characterized in that: The network card comprises at least one processor; and a memory storing instructions, which, when executed by the at least one processor, implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Message transmission method and user equipment
CN106656431A
Forward retransmission method applicable to network coding transmission control protocol
CN107592185A
Network adapter with TCP windowing support
US6788704B1
