A packet loss handling method, gateway, and device
By deploying gateways on the network path to detect packet loss and promptly retransmit packets, the problem of bandwidth waste caused by packet loss in network transmission is solved, achieving efficient packet loss handling, and is suitable for both wide area network (WAN) and local area network (LAN) environments.
Patent Information
- Application Number
- CN202411578306.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-11-06
AI Technical Summary
In network transmission, due to the inability to guarantee network quality, the time for the receiving end to reply with NAK after packet loss is relatively long, which means that the retransmitted packets from the sending end cannot be processed by the receiving end, wasting a lot of bandwidth, especially in the case of wide area network connection.
Deploy first and second gateways on the network path to detect packet loss by judging the packet sequence number (PSN) of the message. When packet loss is detected, send NAK directly to the sender to resend the message, thereby reducing the number of messages that are not processed by the receiver.
By detecting packet loss in advance and retransmitting messages in a timely manner, network bandwidth waste is reduced, network transmission efficiency is improved, low latency requirements are met, the processing is simplified, and it does not rely on TCP or other reliable transmission protocols.
Smart Images

Figure CN119363675B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network technology, and in particular to a packet loss handling method, gateway, and apparatus. Background Technology
[0002] When two hosts exchange messages on a network, the sender transmits messages to the receiver. Due to network quality issues, packet loss may occur. Upon detecting packet loss, the receiver needs to reply to the sender with a NAK (Non-Acknowledge) message, which includes the PSN (Package Sequence Number) of the lost packet. Upon receiving the NAK, the sender needs to retransmit the message starting from the lost packet corresponding to that PSN.
[0003] However, due to the unreliable network quality between the two hosts and the long round-trip time of packets, it takes a considerable amount of time for the NAK to be sent from the receiving end to the sending end. By the time the sending end receives the NAK from the receiving end, it has often already sent a large number of packets with a PSN greater than the packet loss rate. The receiving end will not receive or process these packets, and transmitting these unprocessed packets wastes a significant amount of bandwidth.
[0004] Especially when two hosts are connected via a wide area network, the network quality between the two hosts is even less guaranteed, the round-trip time of packets is longer, and the bandwidth waste is more serious. Summary of the Invention
[0005] The purpose of this application is to provide a packet loss handling method, gateway, and apparatus to reduce bandwidth wastage when handling packet loss. The specific technical solution is as follows:
[0006] In a first aspect, embodiments of this application provide a packet loss handling method applied to a first gateway, the first gateway being located on a transmission path between a first host and a second host, the method comprising:
[0007] Receive the first message sent by the first host;
[0008] Based on the packet sequence number (PSN) of the first message, determine whether packet loss has occurred;
[0009] If it is determined that no packet loss has occurred, the first receiving PSN is updated to the PSN of the first message, and the first message is forwarded to the second gateway, wherein the second gateway is located on the transmission path between the first gateway and the second host;
[0010] If packet loss is detected, a first negative acknowledgment (NAK) is sent to the first host. The first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host can resend a message with a PSN greater than or equal to the first PSN.
[0011] Secondly, embodiments of this application provide a packet loss handling method applied to a second gateway, the second gateway being located on the transmission path between a first host and a second host, the method comprising:
[0012] Receive and buffer messages sent by the first gateway, wherein the first gateway is located on the transmission path between the second gateway and the first host, and the message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message;
[0013] Based on the sequence number PSN of the seventh message to be sent and the current sending PSN, determine whether packet loss has occurred, wherein the sending PSN is the PSN of the most recent message sent to the second host;
[0014] If packet loss is detected, the seventh packet is discarded, and a fourth negative acknowledgment (NAK) is sent to the first gateway. If the first gateway determines that the seventh packet exists in the cached packets, it retransmits the seventh packet to the second gateway. If the first gateway determines that the seventh packet does not exist in the cached packets, it sends a fifth NAK to the first host. This causes the first host to retransmit a packet whose PSN is greater than or equal to the PSN carried by the fifth NAK. The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the transmitted PSN.
[0015] If it is determined that no packet loss has occurred, the seventh message is forwarded to the second host, and the sent PSN is updated to the PSN of the seventh message.
[0016] Thirdly, a gateway, wherein the gateway serves as a first gateway located on a transmission path between a first host and a second host, the gateway comprising:
[0017] processor;
[0018] transceiver;
[0019] A machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the machine-executable instructions cause the processor to perform the following steps:
[0020] Receive the first message sent by the first host;
[0021] Based on the packet sequence number (PSN) of the first message, determine whether packet loss has occurred;
[0022] If it is determined that no packet loss has occurred, the first receiving PSN is updated to the PSN of the first message, and the first message is forwarded to the second gateway, wherein the second gateway is located on the transmission path between the first gateway and the second host;
[0023] If packet loss is detected, a first negative acknowledgment (NAK) is sent to the first host. The first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host can resend a message with a PSN greater than or equal to the first PSN.
[0024] Fourthly, embodiments of this application provide a gateway, which serves as a second gateway and is located on the transmission path between a first host and a second host. The gateway includes:
[0025] processor;
[0026] transceiver;
[0027] A machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the machine-executable instructions cause the processor to perform the following steps:
[0028] Receive and buffer messages sent by the first gateway, wherein the first gateway is located on the transmission path between the second gateway and the first host, and the message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message;
[0029] Based on the sequence number PSN of the seventh message to be sent and the current sending PSN, determine whether packet loss has occurred, wherein the sending PSN is the PSN of the most recent message sent to the second host;
[0030] If packet loss is detected, the seventh packet is discarded, and a fourth negative acknowledgment (NAK) is sent to the first gateway. If the first gateway determines that the seventh packet exists in the cached packets, it retransmits the seventh packet to the second gateway. If the first gateway determines that the seventh packet does not exist in the cached packets, it sends a fifth NAK to the first host. This causes the first host to retransmit a packet whose PSN is greater than or equal to the PSN carried by the fifth NAK. The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the transmitted PSN.
[0031] If it is determined that no packet loss has occurred, the seventh message is forwarded to the second host, and the sent PSN is updated to the PSN of the seventh message.
[0032] Fifthly, embodiments of this application provide a packet loss processing device applied to a first gateway, the first gateway being located on a transmission path between a first host and a second host, the device comprising:
[0033] The first message receiving module is used to receive the first message sent by the first host;
[0034] The first packet loss judgment module is used to determine whether packet loss has occurred based on the packet sequence number (PSN) of the first message.
[0035] The first message forwarding module is used to update the first receiving PSN to the PSN of the first message and forward the first message to the second gateway if the first packet loss judgment module determines that no packet loss has occurred. The second gateway is located on the transmission path between the first gateway and the second host.
[0036] The first NAK sending module is configured to send a first negative acknowledgment (NAK) to the first host if the first packet loss judgment module determines that packet loss has occurred. The first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host retransmits a message with a PSN greater than or equal to the first PSN.
[0037] Sixthly, embodiments of this application provide a packet loss processing device applied to a second gateway, the second gateway being located on the transmission path between a first host and a second host, the device comprising:
[0038] The third message receiving module is used to receive and buffer messages sent by the first gateway, wherein the first gateway is located on the transmission path between the second gateway and the first host, and the message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message;
[0039] The second packet loss judgment module is used to determine whether packet loss has occurred based on the packet sequence number PSN of the seventh message to be sent and the current sending PSN, wherein the sending PSN is the PSN of the most recent message sent to the second host;
[0040] The third NAK sending module is configured to discard the seventh packet and send a fourth negative acknowledgment (NAK) to the first gateway if the second packet loss judgment module determines that packet loss has occurred. This allows the first gateway to resend the seventh packet to the second gateway if it determines that the seventh packet exists in the cached packets. If it determines that the seventh packet does not exist in the cached packets, the module sends a fifth NAK to the first host, causing the first host to resend a packet with a PSN greater than or equal to the PSN carried by the fifth NAK. The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the sent PSN.
[0041] The third message forwarding module is used to forward the seventh message to the second host and update the sent PSN to the PSN of the seventh message if the second packet loss judgment module determines that no packet loss has occurred.
[0042] In a seventh aspect, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the method described in either the first or second aspect.
[0043] Eighthly, embodiments of this application also provide a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps of the method described in either the first or second aspect.
[0044] Beneficial effects of the embodiments in this application:
[0045] This application provides a packet loss handling method applied to a first gateway between a first host and a second host. After receiving a first packet from the first host, the first gateway can determine whether packet loss has occurred based on the PSN of the first packet. If packet loss is determined, the first gateway directly sends a first NAK to the first host, causing the first host to retransmit the packet. That is, in this application embodiment, packet loss detection can be performed at the first gateway between the first and second hosts, earlier than the method in related technologies where packet loss detection is performed by the second host. Therefore, the first host can receive the first NAK earlier, thus promptly detecting packet loss and retransmitting the packet as quickly as possible. This reduces the number of packets sent by the first host after packet loss that will not be processed by the second host, reducing network bandwidth waste. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0047] Figure 1 A schematic diagram of a network structure provided in an embodiment of this application;
[0048] Figure 2 A flowchart illustrating the first packet loss handling method provided in this application embodiment;
[0049] Figure 3 A flowchart illustrating the second packet loss handling method provided in this application embodiment;
[0050] Figure 4 A flowchart illustrating the third packet loss handling method provided in this application embodiment;
[0051] Figure 5 A flowchart illustrating the fourth packet loss handling method provided in this application embodiment;
[0052] Figure 6 A schematic diagram of a processing flow for receiving messages from a first host, provided for an embodiment of this application;
[0053] Figure 7 A schematic diagram illustrating a process for a first gateway to send a message to a second gateway, provided as an embodiment of this application;
[0054] Figure 8 A flowchart illustrating the fifth packet loss handling method provided in this application embodiment;
[0055] Figure 9 A flowchart illustrating the sixth packet loss handling method provided in this application embodiment;
[0056] Figure 10 A schematic diagram of a processing flow for receiving messages from a first gateway, provided for an embodiment of this application;
[0057] Figure 11 A schematic diagram illustrating a process for a second gateway to send a message to a second host, provided as an embodiment of this application;
[0058] Figure 12 This is a schematic diagram of an ACK processing flow provided in an embodiment of this application;
[0059] Figure 13 A flowchart illustrating the seventh packet loss handling method provided in this application embodiment;
[0060] Figure 14 This is a schematic diagram of the structure of a first type of gateway provided in an embodiment of this application;
[0061] Figure 15 This is a schematic diagram of the structure of a second type of gateway provided in an embodiment of this application;
[0062] Figure 16 This is a schematic diagram of the structure of the first packet loss processing device provided in the embodiments of this application;
[0063] Figure 17 This is a schematic diagram of the structure of a second packet loss processing device provided in an embodiment of this application. Detailed Implementation
[0064] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0065] In related technologies, when packets are transmitted between two hosts, if packet loss occurs, the receiving end sends a NAK (Not Informed) message to the sending end to request retransmission. However, due to the unpredictable network quality between the two hosts and the long round-trip time of packets, the NAK transmission time is also long. A large number of packets have already been sent before the sending end receives the NAK, thus wasting significant network bandwidth.
[0066] To highlight the differences between the embodiments of this application and related technologies, the solutions of related technologies will be described first.
[0067] Related Technology 1: Employing ECN (Explicit Congestion Notification) or PFC (Priority Flow Control) to avoid packet loss. ECN is a mechanism used to alleviate network congestion. When the receiver detects network congestion, it notifies the sender to reduce the packet transmission rate, thereby reducing the packet loss rate. PFC can temporarily prevent the sender from sending packets after network congestion occurs, thereby reducing the packet loss rate.
[0068] Related Technology 2: Employing congestion management mechanisms to avoid packet loss. A common congestion management mechanism is DCQCN (Data Center Quantized Congestion Notification), which combines ECN and sender rate adjustment to address network congestion and packet loss issues.
[0069] In other words, related technologies 1 and 2 control the sending end to transmit packets after network congestion occurs, thereby reducing the packet loss rate. However, if packet loss actually occurs, the problems mentioned in the background technology above will still exist.
[0070] Related technology 3: Encapsulate the message in TCP (Transmission Control Protocol) or other reliable transport protocols, thereby utilizing the built-in packet loss handling mechanisms of TCP or other reliable transport protocols to handle the message loss problem. However, this method is relatively complex and will increase additional latency, which does not meet the requirement of low latency message transmission.
[0071] To address the aforementioned issues, embodiments of this application provide a packet loss handling method, gateway, and apparatus.
[0072] See Figure 1 This is a schematic diagram of a network structure provided in an embodiment of this application. The diagram includes a first host, a second host, a first gateway, and a second gateway. The diagram also includes a WAN (Wide Area Network), indicating that the first host and the second host are connected via a wide area network. It should be noted that... Figure 1 As one possible scenario, this application embodiment does not limit the connection between the first host and the second host to a wide area network. They can also be connected via a local area network.
[0073] It should be noted that the terms "first gateway" and "second gateway" are merely different names used to distinguish them; their functions are identical. When the first host sends a message to the second host, Figure 2 The subject of the embodiment is Figure 1 The first gateway is shown. When the second host sends a message to the first host, Figure 2 The execution subject of the embodiment is Figure 1 The second gateway shown.
[0074] See Figure 2 This is a flowchart illustrating the first packet loss handling method provided in the embodiments of this application, including the following steps S201-S204.
[0075] It should be noted that, in order to transmit messages, the first host and the second host will negotiate and establish a QP (Queue pair) connection in advance. Multiple QP connections can be established between the first host and the second host, and packet loss processing is performed for each QP connection using the scheme provided in the embodiments of this application.
[0076] In one embodiment of this application, the above message may be an RDMA (Remote Direct Memory Access) message.
[0077] S201: Receive the first message sent by the first host.
[0078] S202: Determine whether packet loss has occurred based on the PSN of the first message mentioned above.
[0079] Specifically, for each established QP connection, the PSN of the messages transmitted between the first host and the second host through that QP connection will increase by 1 step-by-step, starting from the first message, according to the sending order. For each QP connection, the first host and the second host will determine the start PSN (Start PSN) of that QP during the negotiation and establishment phase, which is the PSN of the first message.
[0080] In one embodiment of this application, it can be determined whether packet loss has occurred through the following steps A-C.
[0081] Step A: Determine whether the first message is the first message received by the first gateway from the first host.
[0082] Step B: If it is the first packet, then if the PSN of the first packet is not the starting PSN, packet loss is determined to have occurred.
[0083] The aforementioned starting PSN is: the PSN of the first message to be transmitted, which is negotiated between the first host and the second host through control messages.
[0084] Step C: If it is not the first message, determine whether packet loss has occurred based on the PSN of the first message and the current first received PSN.
[0085] If the first packet is not the first packet received by the first gateway from the first host, then the PSN of each packet sent by the first host will increment by 1. Therefore, if the PSN of the first packet is equal to the current first received PSN + 1, it means that no packet loss has occurred. If the PSN of the first packet is not equal to the current first received PSN + 1, it means that packet loss has occurred.
[0086] In another embodiment of this application, the first received PSN and the starting PSN sent by the first host can be recorded in a QP table. A tagQPListBody data structure can be defined in the QP table, wherein the first received PSN can be recorded in the uiRcvPSN1 field, and the starting PSN sent by the first host can be recorded in the uiRemoteStartPSN field.
[0087] Specifically, if the first gateway determines that a packet sent by the first host has been lost, it means that the packet loss occurred between the first host and the first gateway.
[0088] If no packet loss occurs, proceed to step S203; if packet loss occurs, proceed to step S204.
[0089] S203: Update the first received PSN to the PSN of the first message mentioned above, and forward the first message to the second gateway.
[0090] The second gateway is located on the transmission path between the first gateway and the second host.
[0091] In the absence of packet loss, the first gateway normally receives the first message sent by the first host, updates the first received PSN to the PSN of the most recently received first message, and according to the message sending order, the first received PSN should be updated to the original first received PSN + 1. Furthermore, in the absence of packet loss, it normally forwards the first message to the second gateway.
[0092] In one embodiment of this application, if the network bandwidth is large and the quality is good, theoretically, whenever the first gateway receives a first packet, it can directly forward the first packet to the second gateway after determining that no packet loss has occurred. If the network bandwidth is small and the quality is poor, the speed at which the first gateway forwards packets to the second gateway may be less than the speed at which it receives packets. In this case, the first gateway will cache some packets that have not yet been forwarded. The first gateway can then forward the packets in ascending order based on their PSNs (Personal Signal Numbers).
[0093] S204: Send a first NAK to the first host, wherein the first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host retransmits a message with a PSN greater than or equal to the first PSN.
[0094] Specifically, as shown in step S203 above, the first received PSN is updated when no packet loss occurs, meaning the first received PSN is equal to the PSN of the most recently received packet when no packet loss occurred. If packet loss occurs, it means that a packet with a PSN greater than the first received PSN has been lost, so the first PSN of the lost packet is the current first received PSN + 1.
[0095] The first host processes the first NAK in a manner similar to that of the second host in related technologies, by retransmitting a message whose PSN is greater than or equal to the first PSN.
[0096] In one embodiment of this application, the first gateway may further include a NAK sending identifier. The NAK sending identifier has two different values: a first value and a second value. The first value indicates that the first NAK has not yet been sent, and the second value indicates that the first NAK has been sent. For example, the first value is 0, and the second value is 1. This is merely an example; this application does not limit the specific values of the first and second values, as long as they are different. Therefore, the initial value of the NAK sending identifier can be the first value, and after sending the first NAK, the value of the NAK sending identifier can be adjusted to the second value.
[0097] The aforementioned NAK sending identifier can be recorded in the bNackHasSendFlag (NAK sent identifier) field of the tagQPListBody data structure.
[0098] In addition, since the first gateway detects packet loss, the first message received by the first gateway is an abnormally received message, so it can be discarded.
[0099] As can be seen from the above, the packet loss handling method provided in this application embodiment is applied to a first gateway between a first host and a second host. After receiving a first packet sent by the first host, the first gateway can determine whether packet loss has occurred based on the PSN of the first packet. If packet loss is determined to have occurred, the first gateway will directly send a first NAK to the first host, causing the first host to retransmit the packet. That is, in this application embodiment, packet loss detection can be performed at the first gateway between the first host and the second host, and the timing of packet loss detection is earlier than the method of packet loss detection performed by the second host in related technologies. Therefore, the first host can receive the first NAK in advance, thereby promptly detecting packet loss and retransmitting the packet as soon as possible. This reduces the number of packets sent by the first host after packet loss that will not be processed by the second host, reducing the waste of network bandwidth.
[0100] This application embodiment adds a first gateway to the network for packet loss handling. Compared with related technologies 1 and 2, the solution provided by this application embodiment can actually handle packet loss after it occurs, rather than just reducing the possibility of packet loss. Compared with related technology 3, this application embodiment does not rely on TCP or other reliable transmission protocols, the processing method is simpler, and it meets the requirement of low latency in message transmission.
[0101] See Figure 3 This is a flowchart illustrating the second packet loss handling method provided in this application embodiment, which is consistent with the aforementioned... Figure 2 Compared to the embodiment shown, the first gateway caches the packets received from the first host if it determines that no packet loss has occurred.
[0102] In one embodiment of this application, packets received by the first gateway from the first host can be sequentially mounted in a preset linked list according to the PSN in ascending order. The starting address of the preset linked list can be recorded in the stPacketListHead (packet header) field of the tagQPListBody data structure.
[0103] The above method also includes the following steps S301-S304.
[0104] S301: Receive the second NAK sent by the second gateway.
[0105] The second NAK mentioned above carries the second PSN of the second message that was lost.
[0106] S302: Determine whether a second message exists in the cached messages.
[0107] In one embodiment of this application, the first gateway may record the PSN carried in the NAK received from the second gateway. The PSN carried in the NAK may be recorded in the uiNakRcvPsn (NAK received PSN) field of the tagQPListBody data structure.
[0108] Specifically, the second NAK might be sent by the second gateway to the first gateway after detecting packet loss. In this case, the packet loss occurs between the first and second gateways. Alternatively, the second host might send a NAK to the second gateway after detecting packet loss. Upon receiving the NAK, the second gateway can then send a second NAK to the first gateway. In this case, the packet loss occurs between the second gateway and the second host. The specific method by which the second gateway sends the second NAK can be found below. Figure 8 The only difference between steps S801-S803 shown is the method of sending the fourth NAK. Figure 8 In the illustrated embodiment, the fourth NAK is sent; in this embodiment, the second gateway sends the second NAK. The second NAK and the fourth NAK are only distinguished by their names; they are actually the same, and will not be described in detail here.
[0109] If a second message exists, proceed to step S303; otherwise, proceed to step S304.
[0110] S303: Send the second message to the second gateway.
[0111] Since the second message exists in the first gateway, after the second gateway sends the second NAK to the first gateway, the first gateway can directly resend the second message to the second gateway.
[0112] In one embodiment of this application, a retransmission count flag can be configured for each packet cached in the first gateway, indicating the number of times the packet has been retransmitted. The retransmission count flag can be called uiRetryCount. Before sending a second packet to the second gateway, the retransmission count flag can be set to 0, and the forwarding thread of the first gateway will prioritize forwarding packets with a retransmission count flag of 0. After retransmitting the second packet, the retransmission count flag corresponding to the second packet is incremented by 1, thereby counting the number of retransmissions of the second packet.
[0113] S304: Send a third NAK to the first host, wherein the PSN carried by the third NAK is the second PSN, so that the first host resends a third message with a PSN greater than or equal to the second PSN.
[0114] Since the second message is not present in the first gateway, it cannot directly retransmit it to the second gateway. To resolve the packet loss issue, it needs to request the second message from the first host. Therefore, the first gateway sends a third NAK to the first host, causing the first host to retransmit a third message with a PSN greater than or equal to the second PSN. This third message contains the second message with a PSN equal to the second PSN, as well as other messages with a PSN greater than the second message's PSN. After receiving the retransmitted third message from the first host, the first gateway can perform the aforementioned... Figure 2 In the embodiment shown, packet loss detection is performed on the third message to resend a third message containing the second message to the second gateway, thereby completing the packet loss processing of the second message.
[0115] As can be seen from the above, in this embodiment, the first gateway stores messages. When the first gateway receives the second NAK, it indicates that packet loss occurred during transmission of the message sent from the first gateway to the second gateway. In this case, if the first gateway stores the second message indicated by the second NAK, it can directly send the stored second message back to the second gateway without requesting the first host to retransmit the second message. The first host does not perform any additional processing during this process, so this process is imperceptible to the first host and does not affect its message transmission, nor does it consume bandwidth used by the first host to send messages to the first gateway. Furthermore, compared to retransmitting messages through the first host, the first gateway can quickly retransmit the second message to the second gateway after receiving the second NAK via a shorter transmission path, achieving rapid packet loss processing and reducing bandwidth waste. Moreover, if the first gateway does not store the second message, it can send a third NAK to the first host, allowing the first host to continue retransmitting messages normally without affecting the normal packet loss processing flow. Furthermore, the second NAK in this embodiment may be generated after the second gateway detects packet loss. In this case, even if the first host retransmits the message, compared with the related technology where the second host sends a NAK to the first host after detecting packet loss, the data transmission path between the second gateway and the first host in this application is still shorter, and the time required for NAK transmission is shorter. Therefore, even if the first gateway does not cache the second message, the solution provided in this embodiment can still improve the speed of packet loss processing and reduce bandwidth waste.
[0116] See Figure 4 This is a flowchart illustrating the third packet loss handling method provided in this application embodiment. After step S304, the method further includes steps S305-S309.
[0117] S305: Receive third message.
[0118] S306: Determine whether the third PSN of the third message is less than or equal to the current first received PSN.
[0119] Since the first host sends messages in ascending order of PSN, as mentioned earlier, the first received PSN is only updated if no packet loss occurs. Therefore, theoretically, when no packet loss occurs, all messages with PSNs less than or equal to the first received PSN should be normally received by the first gateway, and the first gateway should not receive messages with PSNs less than or equal to the first received PSN again. The reason a third message with a PSN less than or equal to the current first received PSN might be that the first gateway normally received the third message with a PSN less than or equal to the first received PSN, but the third message was lost after being sent by the first gateway, and the first host retransmitted the third message. Alternatively, the first host might retransmit the third message for other reasons.
[0120] Based on this, if it is determined that the third PSN is less than or equal to the current first received PSN, then step S307 is executed; if it is determined that the third PSN is greater than the current first received PSN, then the aforementioned steps are adopted. Figure 2 The subsequent processing of the illustrated embodiments will not be described in detail here.
[0121] S307: Determine whether the above third message has been cached.
[0122] If the third message has already been cached in the first gateway, there is no need to cache it again, and step S308 is executed. If it is determined that the third message has not been cached, step S309 is executed.
[0123] S308: Discard the received third message and send the cached third message to the second gateway.
[0124] Specifically, the retransmission count of the cached third message can be updated to 0 to instruct the forwarding thread to prioritize forwarding the third message.
[0125] S309: Buffer and send the received third message to the second gateway mentioned above.
[0126] After receiving a third message whose third PSN is less than or equal to the current first received PSN, the first received PSN will not be updated.
[0127] As can be seen from the above, in this embodiment of the application, after receiving a third message whose third PSN is less than or equal to the current first receiving PSN, different processing can be performed depending on whether the third message is stored in the first gateway.
[0128] In another embodiment of this application, as described above Figure 3 Based on the illustrated embodiment, the following steps D-E are also included.
[0129] Step D: Receive the first ACK (Acknowledge) sent by the second gateway mentioned above.
[0130] The first ACK mentioned above is sent by the second gateway after it has determined that the fourth message has not been lost, and carries the fourth PSN of the fourth message.
[0131] Step E: Delete the cached fourth message.
[0132] The fact that the first gateway receives the first ACK indicates that the second gateway has determined that the fourth packet was not lost. In this case, the first gateway is unlikely to need to resend the fourth packet to the second gateway, so it can stop storing the fourth packet and save storage space for the first gateway.
[0133] The specific method by which the second gateway sends an ACK to the first gateway can be found in step I below. The only difference is that in this embodiment, the second gateway sends the first ACK, while in step I, the second gateway sends the sixth ACK. The only difference between the two is in their names, which will not be described in detail here.
[0134] In another embodiment of this application, the above method further includes the following steps F1-F5.
[0135] Step F1: Send the fifth message to the second gateway mentioned above.
[0136] Step F2: Determine whether a second ACK is received from the second gateway within the first preset time period.
[0137] The second ACK mentioned above is sent by the second gateway after it has determined that the fifth message has not been lost, and it carries the PSN of the fifth message.
[0138] Specifically, after sending the fifth message to the second gateway, the first gateway records the message's sending time. If no second ACK is received from the second gateway within a first preset time interval between the current time and the sending time, it is determined that no second ACK has been received from the second gateway within the first preset time interval. Step F3 is then executed; otherwise, steps D-E as described above can be followed.
[0139] Step F3: If it is determined that the second ACK has not been received, then determine whether the number of times the fifth message has been retransmitted has reached the first preset number;
[0140] In one embodiment of this application, if the retransmission count flag corresponding to the fifth message reaches a first preset number, it is determined that the number of times the fifth message has been retransmitted has reached the first preset number.
[0141] If the number of times the fifth message is retransmitted reaches the first preset number, it means that the fifth message has still not been successfully transmitted despite multiple retransmissions. In this case, the network quality may be too poor, or the fifth message itself may contain errors. Continuing to retransmit the fifth message in this situation will have a low probability of success. Therefore, the first gateway can abandon the retransmission of the fifth message and proceed to step F5 to avoid further waste of the first gateway's message processing resources and to save the first gateway's storage resources. Conversely, if the number of times the fifth message is retransmitted does not reach the first preset number, it can continue to attempt to retransmit the fifth message and proceed to step F4.
[0142] Step F4: Resend the cached fifth message to the second gateway mentioned above.
[0143] Since the second gateway will send a second ACK to the first gateway if it confirms that it has successfully received the fifth message, if the first gateway does not receive the second ACK after the first preset time period, it indicates that the second gateway may have failed to receive the fifth message for an extended period, potentially resulting in packet loss. In this case, the first gateway can proactively retransmit the fifth message to the second gateway to address the possible packet loss issue.
[0144] In one embodiment of this application, the fifth message is retransmitted to the second gateway, and the retransmission count corresponding to the fifth message is incremented by 1. The process then returns to step F2.
[0145] Step F5: If the first preset number of times is reached, delete the cached fifth message.
[0146] In another embodiment of this application, the above method further includes the steps G1-G3.
[0147] Step G1: Receive the first ACK sent by the second gateway mentioned above.
[0148] Step G2: Determine whether there exists a sixth message whose PSN is less than the fourth PSN mentioned above, and which has not received an ACK for the PSN carrying the message.
[0149] Since the first gateway should theoretically send packets to the second gateway in ascending order of PSN, if no packet loss occurs, the second gateway will receive the packets in ascending order of PSN and send ACKs to the first gateway in the same order. The first gateway should also receive the ACKs sent by the second gateway in ascending order of PSN.
[0150] Therefore, if the first gateway receives the first ACK, it indicates that the second gateway has determined that the fourth packet with the PSN as the fourth PSN has not been lost. In the absence of packet loss, the first gateway will receive ACKs in ascending order of the PSNs it carries. Therefore, upon receiving the first ACK, the ACKs corresponding to packets with PSNs less than the fourth PSN should have already been received by the first gateway. Conversely, if there is a sixth packet with a PSN less than the fourth PSN, and no ACK for that packet's PSN has been received, it indicates that the sixth packet may have been lost. In this case, step G3 can be executed to retransmit the sixth packet. If the sixth packet does not exist, no further processing is performed.
[0151] Step G3: Resend the sixth message mentioned above.
[0152] After retransmitting the sixth message, the time of retransmission can be recorded, and the retransmission count corresponding to the sixth message can be incremented by 1.
[0153] As can be seen from the above, in this embodiment of the application, after receiving the first ACK, the first gateway can determine whether there is a sixth message that has not yet received its corresponding ACK. If there is, it means that the sixth message may have been lost. In this application, the first gateway can actively retransmit the sixth message to deal with the packet loss problem in a timely manner.
[0154] See Figure 5 This is a flowchart illustrating the fourth packet loss handling method provided in this application embodiment, which is consistent with the aforementioned... Figure 2 Compared to the illustrated embodiment, if packet loss is determined to have occurred, the following step S205 is added after step S204.
[0155] S205: Before receiving a message whose PSN is the first PSN mentioned above, discard the received message whose PSN is greater than the first PSN mentioned above.
[0156] After packet loss occurs, the first gateway sends a first NAK (Network Address Translation) carrying the first PSN (Personal Data Type) to the first host. The first host then retransmits a packet with a PSN greater than or equal to the first PSN back to the first gateway. However, since it takes time for the first NAK to travel from the first gateway to the first host, the first gateway continues to send packets in ascending order of PSN. Therefore, the first gateway may receive other packets with PSNs greater than the first PSN that the first host continued to send after the packet loss. Because these packets are received after the packet loss, the first gateway does not process them but discards them.
[0157] In addition, as mentioned above, the first gateway can maintain a NAK sending flag. After the first gateway sends the first NAK, the value of the NAK sending flag is adjusted to the second value.
[0158] When the NAK sending identifier takes the second value, packets with a PSN greater than the first PSN will be discarded before a packet with a PSN equal to the first PSN is received.
[0159] As can be seen from the above, in this embodiment of the application, the first gateway will discard the packets received during the packet loss processing, thereby avoiding out-of-order faults in the packet transmission process.
[0160] In another embodiment of this application, if it is determined that no packet loss has occurred, the above method further includes the following step H.
[0161] Step H: If all messages belonging to the same message are received normally, then send a third ACK to the first host mentioned above.
[0162] The PSN carried in the third ACK is the PSN of the last segment of the message.
[0163] Specifically, messages are composed of one message. Some message types consist of a single message, while others consist of multiple messages. When the message sent by the first host is an RDMA message, there are approximately thirty different types of RDMA messages sent by the first host, and one or more RDMA messages can form a single message.
[0164] Multiple messages belonging to the same message can carry a first identifier. Different values of the first identifier indicate whether the message is the first message in the message, the last message in the message, or any other message besides the first and last messages. For example, a first identifier value of 0 indicates that the message is the first message, a first identifier value of 1 indicates that the message is the last message, and a first identifier value of 2 indicates that the message is any other message besides the first and last messages. The first gateway can determine whether a message is the last message based on the value of the first identifier. Since the first host sends messages sequentially according to their order in the message, if the first gateway successfully receives the last message, theoretically all messages in the message should have been received normally. Therefore, after receiving the last message, the gateway can send a third ACK to the first host to notify the first host that all messages in the message have been received normally and no packet loss has occurred.
[0165] Furthermore, in this case, if the first gateway maintains a NAK sending identifier, and the current value of the NAK sending identifier is the second value, then after the first gateway sends the third ACK, the value of the NAK sending identifier will be adjusted to the first value.
[0166] As can be seen from the above, in this embodiment of the application, after the first gateway normally receives all the packets in the same message, it will send a third ACK to the first host so that the first host can determine that all the packets in the message have been normally received and there is no need to resend the packets in the message.
[0167] The following is through Figure 6 The illustrated embodiment provides a unified description of the processing flow after the first gateway receives a message sent by the first host.
[0168] See Figure 6 This is a schematic diagram illustrating a process for receiving messages from a first host, provided in an embodiment of this application. In this embodiment, the first value of the bNackHasSendFlag field is false, and the second value is true.
[0169] The specific process is as follows: receive messages from the first host.
[0170] Check if the bNackHasSendFlag field is true.
[0171] If the bNackHasSendFlag field is true, then check if the PSN of the packet is uiRcvPSN1+1.
[0172] If the value is uiRcvPSN1+1, then the bNackHasSendFlag field will be set to false, the packet will be cached, and execution will continue. Figure 6 The following steps are shown below.
[0173] If it is not uiRcvPSN1+1, the message is discarded and the process ends.
[0174] If the bNackHasSendFlag field is not true, check the PSN and uiRcvPSN1 of the packet to determine if the packet was lost.
[0175] If a packet is lost, discard the packet, set the bNackHasSendFlag field to true, and send a NAK with PSN uiRcvPSN1+1 to the first host.
[0176] If no packet is lost, update uiRcvPSN1 and cache the packet. Determine if the packet is the last packet in the message; if not, end the process. If it is, send an ACK with the PSN of the packet to the first host.
[0177] pass Figure 7 The illustrated embodiment provides a unified description of the processing flow for the first gateway to send messages to the second gateway.
[0178] See Figure 7 This is a schematic diagram of a processing flow for a first gateway to send a message to a second gateway, provided in an embodiment of this application. The processing flow is specifically executed by the forwarding thread in the first gateway.
[0179] If the linked list of cached messages is not empty, poll and check all cached messages.
[0180] Check if the uiRetryCount corresponding to the message is 0.
[0181] If the value is 0, then send the message, record the time of packet transmission, and increment uiRetryCount by 1.
[0182] If it is not 0, then determine whether the uiRetryCount of the message has reached the first preset number of times.
[0183] If the first preset number of attempts is reached, the message will be deleted.
[0184] If the first preset number of attempts is not reached, then it is determined whether the second ACK from the second gateway has not been received within the first preset time period.
[0185] If the second ACK is not received, send the message, record the time of packet transmission, and increment uiRetryCount by 1.
[0186] If a second ACK is received, then all cached packets are checked in a round-robin fashion, provided the cached packet list is not empty.
[0187] The above process describes the packet loss handling process of the first gateway during the process of the first host sending a message to the second host. The following describes the packet loss handling process of the second gateway during the process of the first host sending a message to the second host.
[0188] See Figure 8 This is a flowchart illustrating the fifth packet loss handling method provided in this application embodiment, including the following steps S801-S804.
[0189] S801: Receives and buffers messages sent by the first gateway.
[0190] The first gateway is located on the transmission path between the second gateway and the first host. The message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message.
[0191] S802: Determine whether packet loss has occurred based on the PSN of the seventh message to be sent and the current sending PSN.
[0192] The PSN mentioned above refers to the PSN of the most recent message sent to the second host.
[0193] In one embodiment of this application, when the second gateway processes the seventh message sent by the first gateway, packet loss detection is performed before forwarding the seventh message to the second host.
[0194] In theory, the first host will send packets sequentially in ascending order of PSN, and the absolute value of the difference between the PSNs of adjacent packets should be 1. Therefore, if no packet loss occurs, and the packets are forwarded from the first host to the second gateway via the first gateway, the absolute value of the difference between the PSNs of adjacent packets sent by the first gateway to the second gateway should also be 1. Thus, when the second gateway sends packets to the second host sequentially according to the order in which they are received, the absolute value of the difference between the PSNs of adjacent packets should also be 1.
[0195] Therefore, if the PSN of the seventh message to be sent is equal to the current sending PSN + 1, it indicates that no packet loss has occurred. Otherwise, it indicates that packet loss has occurred. The above packet loss occurred between the second gateway and the first gateway.
[0196] In one embodiment of this application, the aforementioned PSN can be recorded in the uiSendPSN field of the tagQPListBody data structure.
[0197] If packet loss is determined to have occurred, proceed to step S803; if no packet loss is determined to have occurred, proceed to step S804.
[0198] S803: Discard the aforementioned seventh message and send a fourth NAK to the aforementioned first gateway, so that if the aforementioned first gateway determines that the seventh message exists in the cached messages, it retransmits the aforementioned seventh message to the aforementioned second gateway. If it determines that the seventh message does not exist in the cached messages, it sends a fifth NAK to the aforementioned first host, so that the aforementioned first host retransmits a message whose PSN is greater than or equal to the PSN carried by the aforementioned fifth NAK.
[0199] The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the transmitted PSN.
[0200] Specifically, the PSN sent above is the PSN of the most recent message sent to the second host. The PSN of the next message to be sent to the second host should be the current PSN+1. The PSN of the currently lost message is the current PSN+1. Therefore, this message is lost and needs to be retransmitted. Thus, the PSN carried by the fourth NAK is the current PSN+1, instructing the first gateway to retransmit the message. The method by which the first gateway retransmits messages can be found above. Figure 3 The embodiments shown will not be described in detail here.
[0201] S804: Forward the aforementioned seventh message to the aforementioned second host, and update the sent PSN to the PSN of the aforementioned seventh message.
[0202] After the seventh message is forwarded to the second host normally, the most recently forwarded message is the seventh message. Therefore, the sending PSN needs to be updated to the PSN of the seventh message. In fact, according to the message sending order, the sending PSN is updated to the original sending PSN+1.
[0203] As can be seen from the above, in the solution provided by this application embodiment, during the process of the first host sending a message to the second host, the second gateway performs packet loss detection after receiving the message sent by the first gateway and before sending the seventh message to the second host. If packet loss occurs, the second gateway will send a fourth NAK to the first gateway to handle the packet loss. That is, in this application embodiment, the second gateway can perform packet loss handling on the message sent by the first host in advance before the message is sent to the second host. Because the timing of packet loss handling is advanced, the second gateway can respond in advance after packet loss occurs, reducing the waste of network bandwidth.
[0204] In another embodiment of this application, the second gateway performs the following step I after performing step S801.
[0205] Step I: Send the sixth ACK to the first gateway mentioned above.
[0206] The PSN carried in the sixth ACK is the PSN of the received message.
[0207] In other words, whenever the second gateway receives a message from the first gateway, it sends a sixth ACK corresponding to that message back to the first gateway to notify it that it has successfully received the message.
[0208] See Figure 9 This is a flowchart illustrating the sixth packet loss handling method provided in this application embodiment, including the following steps S901-S904.
[0209] S901: Receive the sixth NAK sent by the second host after determining that packet loss has occurred.
[0210] Among them, the fifth PSN carried by the sixth NAK is the PSN of the eighth packet with the smallest PSN among the packets that were lost.
[0211] For example, if the second host receives a message with PSN 1 and then receives a message with PSN 4, it can be determined that messages with PSN 2 and 3 have been lost. In this case, the eighth message is the message with the smallest PSN among the lost messages, that is, the message with PSN 2.
[0212] S902: Determine if the eighth message exists in the cached messages.
[0213] If the second gateway determines that the eighth packet exists, then proceed to step S903; if it determines that the eighth packet does not exist, then proceed to step S904.
[0214] S903: Send a message to the second host that has a cached PSN greater than or equal to the fifth PSN.
[0215] If the second gateway stores the eighth message, it simulates the processing method in related technologies where the first host receives the NAK sent by the second host and sends a message to the second host with a cached PSN greater than or equal to the fifth PSN. For the second host, the retransmitted message received is the same as in related technologies, and this process is imperceptible to the second host.
[0216] In one embodiment of this application, the second gateway can set the retransmission count flag corresponding to the stored PSN greater than or equal to the fifth PSN to 0, so that the forwarding thread in the second gateway will prioritize forwarding the above packets.
[0217] During the retransmission process, the second gateway sends packets with cached PSNs greater than or equal to the fifth PSN in ascending order of PSN size.
[0218] In one possible scenario, the fifth PSN is 2, and the second gateway stores packets with PSNs 2-5 respectively. In this case, the second gateway sends packets with PSNs 2, 3, 4, and 5 to the second host in sequence.
[0219] In another possible scenario, the fifth PSN is 2. The second gateway stores packets with PSNs of 2, 4, and 5 respectively. In this case, the second gateway sends packets with PSNs of 2, 4, and 5 to the second host sequentially. The second host first receives the packet with PSN=2, confirms that the lost packet has been retransmitted, and then receives the packet with PSN=4, confirming that the packet with PSN=3 has been lost. It then sends a NAK (Network Address Translation) with PSN=3 to the second gateway. The second gateway will then execute... Figure 9 The illustrated embodiment performs packet loss processing.
[0220] S904: Send a NAK carrying the fifth PSN to the first gateway mentioned above.
[0221] If the second gateway does not store the eighth message, it cannot execute step S903 to directly retransmit the message to the second host. Instead, it sends a NAK carrying the fifth PSN to the first gateway, so that the first gateway adopts the same method as described above. Figure 3 The illustrated embodiment retransmits messages in a similar manner.
[0222] Additionally, while the second gateway may not store the eighth packet, it may store other packets with a PSN greater than or equal to the fifth PSN. In this case, the second gateway can send these other packets with stored PSNs greater than or equal to the fifth PSN to the second host. Specifically, the retransmission count flag for these other packets with stored PSNs greater than or equal to the fifth PSN can be set to 0, causing the forwarding thread in the second gateway to prioritize forwarding these packets.
[0223] As can be seen from the above, in the solution provided by this application embodiment, the second gateway can retransmit the message to the second host after the second host detects packet loss, thereby completing the packet loss processing process. Compared with the solution in related technologies where the first host retransmits the message to the second host, the transmission link length between the second gateway and the second host in this application embodiment is significantly shorter. Therefore, the packet loss processing process can be completed quickly between the second gateway and the second host, thereby reducing the waste of network bandwidth. Even if the second gateway does not store the eighth message, the second gateway can still send a NAK to the first gateway, allowing the first gateway to continue the packet loss processing process.
[0224] In another embodiment of this application, after step S901, the second gateway further performs the following step J.
[0225] Step J: Discard any subsequent received packets whose PSN is less than the fifth PSN mentioned above.
[0226] In one embodiment of this application, after receiving the sixth NAK, the second gateway may also record the fifth PSN in the sixth NAK. The fifth PSN may be recorded in the uiNakRcvPsn field described above.
[0227] After receiving a subsequent message, the second gateway can compare the message's PSN with the recorded fifth PSN. If the PSN is less than the fifth PSN, the message is discarded.
[0228] Under normal circumstances, the second host receives packets in ascending order of PSN (Personal Signal Number), incrementing by 1. If out-of-order PSNs are detected, packet loss is confirmed, and only then will the second host send the fifth NAK (Network Address Translation) to the second gateway. The second host will stop receiving packets until the retransmitted eighth packet is received. Therefore, the second host does not send the fifth NAK when receiving packets in normal order; it only sends it after detecting packet loss of the eighth packet. Thus, upon receiving the fifth NAK, the second gateway can determine that the second host successfully received other packets whose PSN is less than the fifth PSN and were sent before the eighth packet, and therefore did not send a NAK for these packets. Consequently, upon receiving the fifth NAK, the second gateway can discard subsequently received packets with PSNs less than the fifth PSN and will not cache them.
[0229] In addition, the second gateway can also delete cached packets with a PSN smaller than the fifth PSN mentioned above to save storage space.
[0230] In another embodiment of this application, step S801 described above can be implemented by the following steps K1-K4.
[0231] Step K1: Receive the message sent by the first gateway.
[0232] Step K2: Determine whether the PSN of the message is less than or equal to the current second receiving PSN.
[0233] Wherein, the second received PSN is the PSN of the message with the largest PSN received from the first gateway before the message was received.
[0234] If the PSN of the message is determined to be less than or equal to the current second receiving PSN, then proceed to step K3; otherwise, proceed to step K4.
[0235] Step K3: Determine whether the message has been cached. If it has been cached, discard the received message. If it has not been cached, cache the message.
[0236] Under normal circumstances, messages are sent in ascending order of PSN. Therefore, the PSN of a message received by the second gateway from the first gateway should be greater than the PSN of the message with the largest PSN received from the first gateway before receiving this message; that is, the second received PSN. If the PSN of a message received from the first gateway is less than or equal to the second received PSN, it indicates that the order in which the second gateway receives messages may be out of order, and the second gateway may have previously received and cached this message from the first gateway.
[0237] Therefore, if the second gateway has already cached the message, there is no need to cache it again, and the received message can be discarded. Otherwise, the message should be cached.
[0238] Regardless of whether the message has been cached, the second gateway performs the aforementioned actions upon receiving the message. Figure 8 The illustrated embodiment performs packet loss processing. If the packet has been cached, the cached packet can be used to replace the received packet for packet loss processing; if the packet has not been cached, the received packet is directly processed for packet loss.
[0239] In addition, if the PSN of the message is less than or equal to the current second received PSN, the recorded second received PSN will not be updated after the message is received.
[0240] In another embodiment of this application, the second received PSN can be recorded in the uiRcvPSN2 (received PSN2) field of the tagQPListBody data structure.
[0241] Step K4: Cache the message and update the second received PSN to the PSN of the message.
[0242] If the PSN of the message is greater than the current second received PSN, it means that the PSN of the message is greater than the PSN of the message with the largest PSN received from the first gateway before the message was received. That is, the second gateway has not received the message before, so the message is directly cached and the second received PSN is updated.
[0243] In another embodiment of this application, the above method further includes the steps L1-L2.
[0244] Step L1: Receive the fourth ACK sent by the second host.
[0245] The fourth ACK is sent by the second host after it has normally received all the messages included in the first message, and the PSN carried by the fourth ACK is the PSN of the last message in the first message.
[0246] Step L2: Delete the messages included in the first cached message.
[0247] Each time the second host receives a complete message, it sends an ACK to the second gateway. The second gateway receives a fourth ACK, indicating that the second host has successfully received all packets in the first message. The PSN of the last packet in the first message is the PSN carried in the fourth ACK. Theoretically, the second gateway does not need to retransmit all packets in the first message that it has already successfully received to the second host, and therefore can delete them from the cached message list.
[0248] As described above, PSNs of messages belonging to the same message are consecutive, and the first identifier value of the last message in a message is different from the first identifier values of other messages in the same message. Therefore, the second gateway can start from the message corresponding to the PSN carried by the cached fourth ACK, and delete messages with adjacent PSNs in descending order of PSN, until the first identifier value of the deleted message indicates that the message is the first message in the message.
[0249] Alternatively, starting from the PSN-corresponding message carried by the fourth cached ACK, determine the adjacent messages in descending order of PSN, until the value of the first identifier of the determined message indicates that the message is the first message in the message, and finally delete all determined messages.
[0250] Furthermore, when caching packets, the second gateway can store packets belonging to the same message together, and can delete them together directly when deleting them.
[0251] In addition, the aforementioned second gateway can record the PSN carried in the fourth ACK after receiving it. Specifically, it can be recorded in the uiAckRcvPsn (acknowledgment PSN) field of the tagQPListBody data structure.
[0252] As can be seen from the above, in the solution provided by the embodiments of this application, when the second gateway receives the fourth ACK for the first message, it can delete the messages included in the cached first message, thereby saving the storage space of the second gateway.
[0253] In another embodiment of this application, the above method further includes the steps M1-M5.
[0254] Step M1: Send the ninth message to the second host mentioned above.
[0255] Specifically, the second gateway records the time of message transmission after sending the ninth message to the second host.
[0256] Step M2: Determine whether the fifth ACK from the second host has been received within the second preset time period.
[0257] The fifth ACK mentioned above is sent by the second host after it has normally received all the messages in the message containing the ninth message.
[0258] If it is determined that the fifth ACK has not been received, then proceed to step M3.
[0259] If the fifth ACK from the second host is not received after a second preset time period from the time the ninth message was sent, the ninth message is resent to the second host, and the retransmission count corresponding to the ninth message is incremented by 1.
[0260] Since the second host will send a fifth ACK to the second gateway if it confirms that it has successfully received all packets in the message containing the ninth packet, if it does not receive the fifth ACK from the second host within the second preset time period, the second host may not have received the ninth packet normally for a considerable period of time, which may indicate packet loss. In this case, the second gateway can proactively retransmit the ninth packet to the second host to handle the potential packet loss problem.
[0261] Step M3: Determine whether the number of times the above ninth message has been resent has reached the second preset number.
[0262] If the number of times the ninth message is retransmitted reaches the second preset number, it means that the ninth message has still not been successfully transmitted despite multiple retransmissions. In this case, the network quality may be too poor, or the ninth message itself may contain errors. If the ninth message is retransmitted again, the probability of successful retransmission is low. Therefore, the second gateway can abandon the retransmission of the ninth message and proceed to step M5. If the number of times the ninth message is retransmitted does not reach the second preset number, proceed to step M4.
[0263] Specifically, if the retransmission count flag corresponding to the ninth message does not reach the second preset number, then it is determined that the number of times the ninth message has been retransmitted has not reached the second preset number. If the retransmission count flag corresponding to the ninth message reaches the second preset number, then it is determined that the number of times the ninth message has been retransmitted has reached the second preset number.
[0264] If the second preset number of attempts has not been reached, proceed to step M4. If the second preset number of attempts has been reached, proceed to step M5.
[0265] Step M4: Resend the cached ninth message to the second host mentioned above.
[0266] Return to and execute step M2 above.
[0267] Step M5: Delete the cached ninth message.
[0268] Deleting the cached ninth message can avoid the additional waste of the second gateway's message processing resources caused by continuing to retransmit the ninth message, and save the second gateway's storage resources.
[0269] It should be noted that when a message includes multiple messages, steps M1-M5 are executed separately for each message in the same message, and the above processing is performed separately.
[0270] In addition, in conjunction with the above embodiments, the tagQPListBody data structure in this application is defined as follows: depending on the needs of different embodiments, the actual tagQPListBody data structure may include at least one of the defined fields:
[0271] typedef struct tagQpListBody{
[0272] uint32_t uiRemoteStartPsn;
[0273] uint32_t uiRcvPSN1;
[0274] uint32_t uiRcvPSN2;
[0275] uint32_t uiSendPSN;
[0276] uint32_t uiAckRcvPsn;
[0277] uint32_t uiNakRcvPsn;
[0278] bool bNackHasSendFlag;
[0279] PACKET_LIST_Head_S stPacketListHead;
[0280] };
[0281] The following is through Figure 10 The illustrated embodiment provides a unified description of the processing flow after the second gateway receives a message sent by the first gateway.
[0282] See Figure 10 This is a schematic diagram of a process for receiving messages from a first gateway, provided in an embodiment of this application.
[0283] The specific process is as follows: receive messages from the first gateway.
[0284] Check if the PSN of the message is less than uiNakRcvPsn.
[0285] If the value is less than the specified value, the message is discarded and the process ends.
[0286] If the value is not less than the specified value, the message is cached, and uiRcvPSN2 is updated. An ACK carrying the PSN of the message is sent back to the first gateway.
[0287] pass Figure 11 The illustrated embodiment provides a unified description of the processing flow for the second gateway to send messages to the second host.
[0288] See Figure 11 This is a schematic diagram of a processing flow for a second gateway to send a message to a second host, provided in an embodiment of this application. The processing flow is specifically executed by the forwarding thread in the second gateway.
[0289] If the linked list of cached messages is not empty, poll and check all cached messages.
[0290] Check the PSN and uiSendPSN of the message to be sent to determine if there is packet loss.
[0291] If a packet is lost, a NAK is sent to the first gateway.
[0292] If no packets are lost, check if the uiRetryCount corresponding to the message to be sent is 0.
[0293] If the value is 0, update uiSendPSN, send the packet, record the packet sending time, and increment uiRetryCount corresponding to the packet by 1.
[0294] If it is not 0, then determine whether the uiRetryCount corresponding to the message has reached the second preset number of times.
[0295] If the second preset number of times is reached, the cached message will be deleted.
[0296] If the second preset number of attempts is not reached, then it is determined whether the fifth ACK from the second host has not been received within the second preset time period.
[0297] If the fifth ACK is not received, send the message, record the time of packet transmission, and increment the uiRetryCount corresponding to the message by 1.
[0298] If the fifth ACK is received, and the linked list of cached packets is not empty, all cached packets are checked in a round-robin fashion.
[0299] The following describes the processing flow when the second gateway receives an ACK.
[0300] See Figure 12 This is a schematic diagram of an ACK processing flow provided in an embodiment of this application.
[0301] The left side of the dashed line in the diagram shows the processing flow when the first gateway receives an ACK sent by the second gateway.
[0302] The specific process is as follows: Receive the ACK. Search the cache for packets whose PSN is less than or equal to the PSN carried in the ACK. If the PSN of a cached packet is equal to the PSN in the ACK, delete the cached packet. If the PSN of a cached packet is less than the PSN in the ACK, set the uiRetryCount corresponding to the packet to 0 and retransmit the packet.
[0303] The right side of the dashed line in the diagram shows the processing flow when the second gateway receives an ACK sent by the second host.
[0304] The specific process is as follows: Receive the ACK, look up the ACK-indicating message in the cache, update uiAckRcvPsn to the PSN carried by the ACK, and delete the message from the cache.
[0305] The following is a detailed description of the processing flow of the second gateway, the first gateway, and the first host after the second gateway receives the NAK sent by the second host.
[0306] See Figure 13 This is a flowchart illustrating the seventh packet loss handling method provided in the embodiments of this application.
[0307] The dotted line in the diagram will... Figure 13 It is divided into three areas, and the processing flow of the second gateway, the first gateway, and the first host are recorded in the three areas respectively.
[0308] The specific processing flow of the second gateway is as follows: It receives the NAK. It checks if a packet corresponding to the PSN in the NAK exists in the cache. If so, it sets the uiRetryCount of packets with PSNs greater than or equal to the PSN in the NAK to 0 and retransmits these packets. If not, it sends the NAK to the first gateway. The PSN in the sent NAK is the same as the PSN in the received NAK.
[0309] The specific processing flow of the first gateway is as follows: It checks if a packet corresponding to the PSN in the NAK exists in the cache. If so, it sets the uiRetryCount of the packet whose PSN equals the PSN in the NAK to 0 and retransmits the packet. If not, it sends the NAK to the first host. The PSN in the sent NAK is the same as the PSN in the received NAK.
[0310] The specific processing flow of the first host is as follows: starting from the message corresponding to the PSN in NAK, retransmit the message whose PSN is greater than or equal to the PSN in NAK.
[0311] Corresponding to the aforementioned packet loss handling method applied to the first gateway, this application embodiment also provides a gateway.
[0312] See Figure 14This is a schematic diagram of the structure of a first type of gateway provided in an embodiment of this application. The gateway, as the first gateway, is located on the transmission path between the first host and the second host. The gateway includes:
[0313] Processor 1401;
[0314] Transceiver 1404;
[0315] A machine-readable storage medium 1402 stores machine-executable instructions that can be executed by the processor 1401; the machine-executable instructions cause the processor 1401 to perform the following steps:
[0316] Receive the first message sent by the first host;
[0317] Based on the packet sequence number (PSN) of the first message, determine whether packet loss has occurred;
[0318] If it is determined that no packet loss has occurred, the first receiving PSN is updated to the PSN of the first message, and the first message is forwarded to the second gateway, wherein the second gateway is located on the transmission path between the first gateway and the second host;
[0319] If packet loss is detected, a first negative acknowledgment (NAK) is sent to the first host. The first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host retransmits a message with a PSN greater than or equal to the first PSN.
[0320] like Figure 14 As shown, the network device may also include a communication bus 1403. The processor 1401, machine-readable storage medium 1402, and transceiver 1404 communicate with each other via the communication bus 1403. The communication bus 1403 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 1403 can be divided into an address bus, a data bus, a control bus, etc.
[0321] The transceiver 1404 can be a wireless communication module, which interacts with other devices under the control of the processor 1401.
[0322] The machine-readable storage medium 1402 may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Alternatively, the machine-readable storage medium 1402 may also be at least one storage device located remotely from the aforementioned processor.
[0323] Processor 1401 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0324] As can be seen from the above, the packet loss handling method provided in this application embodiment is applied to a first gateway between a first host and a second host. After receiving a first packet sent by the first host, the first gateway can determine whether packet loss has occurred based on the PSN of the first packet. If packet loss is determined to have occurred, the first gateway will directly send a first NAK to the first host, causing the first host to retransmit the packet. That is, in this application embodiment, packet loss detection can be performed at the first gateway between the first host and the second host, and the timing of packet loss detection is earlier than the method of packet loss detection performed by the second host in related technologies. Therefore, the first host can receive the first NAK in advance, thereby promptly detecting packet loss and retransmitting the packet as soon as possible. This reduces the number of packets sent by the first host after packet loss that will not be processed by the second host, reducing the waste of network bandwidth.
[0325] In one embodiment of this application, if it is determined that no packet loss has occurred, the packets received from the first host are buffered, and the machine-executable instructions further cause the processor to perform the following steps:
[0326] Receive the second NAK sent by the second gateway, the second NAK carrying the second PSN of the second packet that was lost;
[0327] Determine if a second message exists in the cached messages;
[0328] If the existence of the second message is determined, the second message is sent to the second gateway;
[0329] If it is determined that the second message does not exist, a third NAK is sent to the first host, the third NAK carrying the second PSN, so that the first host resends a third message with a PSN greater than or equal to the second PSN.
[0330] As can be seen from the above, in this embodiment, the first gateway stores messages. When the first gateway receives the second NAK, it indicates that packet loss occurred during transmission of the message sent from the first gateway to the second gateway. In this case, if the first gateway stores the second message indicated by the second NAK, it can directly send the stored second message back to the second gateway without requesting the first host to retransmit the second message. The first host does not perform any additional processing during this process, so this process is imperceptible to the first host and does not affect its message transmission, nor does it consume bandwidth used by the first host to send messages to the first gateway. Furthermore, compared to retransmitting messages through the first host, the first gateway can quickly retransmit the second message to the second gateway after receiving the second NAK via a shorter transmission path, achieving rapid packet loss processing and reducing bandwidth waste. Moreover, if the first gateway does not store the second message, it can send a third NAK to the first host, allowing the first host to continue retransmitting messages normally without affecting the normal packet loss processing flow. Furthermore, the second NAK in this embodiment may be generated after the second gateway detects packet loss. In this case, even if the first host retransmits the message, compared with the related technology where the second host sends a NAK to the first host after detecting packet loss, the data transmission path between the second gateway and the first host in this application is still shorter, and the time required for NAK transmission is shorter. Therefore, even if the first gateway does not cache the second message, the solution provided in this embodiment can still improve the speed of packet loss processing and reduce bandwidth waste.
[0331] In one embodiment of this application, after sending the third NAK to the first host, the machine-executable instructions further cause the processor to perform the following steps:
[0332] Receive third message;
[0333] Determine whether the third PSN of the third message is less than or equal to the current first received PSN;
[0334] If it is determined that the third PSN is less than or equal to the current first received PSN, then it is determined whether the third message has been cached.
[0335] If it is determined that the third message has been cached, the received third message is discarded and the cached third message is sent to the second gateway.
[0336] If it is determined that the third message has not been cached, then the received third message is cached and sent to the second gateway.
[0337] As can be seen from the above, in this embodiment of the application, after receiving a third message whose third PSN is less than or equal to the current first receiving PSN, different processing can be performed depending on whether the third message is stored in the first gateway.
[0338] In one embodiment of this application, the machine-executable instructions further cause the processor to perform the following steps:
[0339] Receive a first confirmation ACK sent by the second gateway, wherein the first ACK is sent by the second gateway after determining that the fourth packet has not been lost, and carries the fourth PSN of the fourth packet;
[0340] Delete the cached fourth message.
[0341] In one embodiment of this application, the machine-executable instructions further cause the processor to perform the following steps:
[0342] Send the fifth message to the second gateway;
[0343] Determine whether a second ACK is received from the second gateway within a first preset time period, wherein the second ACK is sent by the second gateway after determining that the fifth message has not been lost, and carries the PSN of the fifth message;
[0344] If it is determined that the second ACK has not been received, then it is determined whether the number of times the fifth message has been retransmitted has reached the first preset number;
[0345] If it is determined that the first preset number of times has not been reached, the cached fifth message is resent to the second gateway, and the process returns to the step of determining whether the second ACK has been received from the second gateway within the first preset time period;
[0346] If the first preset number of times is reached, the cached fifth message is deleted.
[0347] In one embodiment of this application, the machine-executable instructions further cause the processor to perform the following steps:
[0348] Receive the first ACK sent by the second gateway;
[0349] Determine whether there exists a sixth message whose PSN is less than the fourth PSN and which has not received an ACK for the PSN carrying the message;
[0350] If the existence of the sixth message is determined, the sixth message is retransmitted.
[0351] As can be seen from the above, in this embodiment of the application, after receiving the first ACK, the first gateway can determine whether there is a sixth message that has not yet received its corresponding ACK. If there is, it means that the sixth message may have been lost. In this application, the first gateway can actively retransmit the sixth message to deal with the packet loss problem in a timely manner.
[0352] In one embodiment of this application, if packet loss is determined to have occurred, the machine-executable instructions further cause the processor to perform the following steps:
[0353] Before receiving a message whose PSN is the first PSN, discard any received message whose PSN is greater than the first PSN.
[0354] As can be seen from the above, in this embodiment of the application, the first gateway will discard the packets received during the packet loss processing, thereby avoiding out-of-order faults in the packet transmission process.
[0355] In one embodiment of this application, if it is determined that no packet loss has occurred, the machine-executable instructions further cause the processor to perform the following steps:
[0356] If all messages belonging to the same message are received normally, a third ACK is sent to the first host, wherein the PSN carried in the third ACK is the PSN of the last message in the message.
[0357] As can be seen from the above, in this embodiment of the application, after the first gateway normally receives all the packets in the same message, it will send a third ACK to the first host so that the first host can determine that all the packets in the message have been normally received and there is no need to resend the packets in the message.
[0358] In one embodiment of this application, determining whether packet loss has occurred based on the PSN of the first message specifically includes:
[0359] Determine whether the first message is the first message received by the first gateway from the first host;
[0360] If it is the first message, then if the PSN of the first message is not the starting PSN, it is determined that packet loss has occurred. The starting PSN is the PSN of the first message to be transmitted, which is negotiated between the first host and the second host through control messages.
[0361] If it is not the first message, then based on the PSN of the first message and the current first received PSN, it is determined whether packet loss has occurred.
[0362] Corresponding to the aforementioned packet loss handling method applied to the second gateway, this application embodiment also provides a gateway.
[0363] See Figure 15 This is a schematic diagram of the structure of a second type of gateway provided in an embodiment of this application. The gateway, as a second gateway, is located on the transmission path between the first host and the second host. The gateway includes:
[0364] Processor 1501;
[0365] Transceiver 1504;
[0366] A machine-readable storage medium 1502 stores machine-executable instructions that can be executed by the processor 1501; the machine-executable instructions cause the processor 1501 to perform the following steps:
[0367] Receive and buffer messages sent by the first gateway, wherein the first gateway is located on the transmission path between the second gateway and the first host, and the message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message;
[0368] Based on the sequence number PSN of the seventh message to be sent and the current sending PSN, determine whether packet loss has occurred, wherein the sending PSN is the PSN of the most recent message sent to the second host;
[0369] If packet loss is detected, the seventh packet is discarded, and a fourth negative acknowledgment (NAK) is sent to the first gateway. If the first gateway determines that the seventh packet exists in the cached packets, it retransmits the seventh packet to the second gateway. If the first gateway determines that the seventh packet does not exist in the cached packets, it sends a fifth NAK to the first host. This causes the first host to retransmit a packet whose PSN is greater than or equal to the PSN carried by the fifth NAK. The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the transmitted PSN.
[0370] If it is determined that no packet loss has occurred, the seventh message is forwarded to the second host, and the sent PSN is updated to the PSN of the seventh message.
[0371] like Figure 15As shown, the network device may also include a communication bus 1503. The processor 1501, machine-readable storage medium 1502, and transceiver 1504 communicate with each other via the communication bus 1503. The communication bus 1503 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 1503 can be divided into an address bus, a data bus, a control bus, etc.
[0372] Transceiver 1504 can be a wireless communication module. Under the control of processor 1501, transceiver 1504 interacts with other devices for data exchange.
[0373] Machine-readable storage medium 1502 may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Alternatively, machine-readable storage medium 1502 may also be at least one storage device located remotely from the aforementioned processor.
[0374] Processor 1501 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0375] As can be seen from the above, in the solution provided by this application embodiment, during the process of the first host sending a message to the second host, the second gateway performs packet loss detection after receiving the message sent by the first gateway and before sending the seventh message to the second host. If packet loss occurs, the second gateway will send a fourth NAK to the first gateway to handle the packet loss. That is, in this application embodiment, the second gateway can perform packet loss handling on the message sent by the first host in advance before the message is sent to the second host. Because the timing of packet loss handling is advanced, the second gateway can respond in advance after packet loss occurs, reducing the waste of network bandwidth.
[0376] In one embodiment of this application, the machine-executable instructions further cause the processor to perform the following steps:
[0377] The system receives a sixth NAK sent by the second host after determining that packet loss has occurred, wherein the fifth PSN carried by the sixth NAK is the PSN of the eighth packet with the smallest PSN among the packets that have been lost.
[0378] Determine if the eighth message exists among the cached messages;
[0379] If the existence of the eighth message is determined, a message with a cached PSN greater than or equal to the fifth PSN is sent to the second host;
[0380] If it is determined that the eighth message does not exist, then a NAK carrying the fifth PSN is sent to the first gateway.
[0381] As can be seen from the above, in the solution provided by this application embodiment, the second gateway can retransmit the message to the second host after the second host detects packet loss, thereby completing the packet loss processing process. Compared with the solution in related technologies where the first host retransmits the message to the second host, the transmission link length between the second gateway and the second host in this application embodiment is significantly shorter. Therefore, the packet loss processing process can be completed quickly between the second gateway and the second host, thereby reducing the waste of network bandwidth. Even if the second gateway does not store the eighth message, the second gateway can still send a NAK to the first gateway, allowing the first gateway to continue the packet loss processing process.
[0382] In one embodiment of this application, after receiving the sixth NAK sent by the second host after determining that packet loss has occurred, the machine-executable instructions further cause the processor to perform the following steps:
[0383] Discard any subsequently received packets whose PSN is less than the fifth PSN.
[0384] In one embodiment of this application, receiving and buffering the message sent by the first gateway specifically includes:
[0385] Receive messages sent by the first gateway;
[0386] Determine whether the PSN of the message is less than or equal to the current second received PSN; wherein, the second received PSN is the PSN of the message with the largest PSN received from the first gateway before the message was received;
[0387] If the PSN of the message is determined to be less than or equal to the current second received PSN, then it is determined whether the message has been cached. If it has been cached, the received message is discarded; if it has not been cached, the message is cached.
[0388] If it is determined that the PSN of the message is greater than the current second receive PSN, then the message is cached and the second receive PSN is updated to the PSN of the message.
[0389] In one embodiment of this application, the machine-executable instructions further cause the processor to perform the following steps:
[0390] Receive a fourth acknowledgment ACK sent by the second host, wherein the fourth ACK is sent by the second host after it has normally received all the messages included in the first message, and the PSN carried by the fourth ACK is the PSN of the last message in the first message;
[0391] Delete the first message included in the cache.
[0392] As can be seen from the above, in the solution provided by the embodiments of this application, when the second gateway receives the fourth ACK for the first message, it can delete the messages included in the cached first message, thereby saving the storage space of the second gateway.
[0393] In one embodiment of this application, the machine-executable instructions further cause the processor to perform the following steps:
[0394] Send the ninth message to the second host;
[0395] Determine whether the fifth ACK is received from the second host within a second preset time period, wherein the fifth ACK is sent by the second host after it has normally received all the messages in the message containing the ninth message;
[0396] If it is determined that the fifth ACK has not been received, then it is determined whether the number of times the ninth message has been retransmitted has reached the second preset number;
[0397] If it is determined that the second preset number of times has not been reached, the cached ninth message is resent to the second host, and the process returns to the step of determining whether the fifth ACK is received from the second host within the second preset time period;
[0398] If the second preset number of times is reached, the cached ninth message is deleted.
[0399] In one embodiment of this application, after receiving and buffering the message sent by the first gateway, the machine-executable instructions further cause the processor to perform the following steps:
[0400] A sixth ACK is sent to the first gateway, and the PSN carried in the sixth ACK is the PSN of the received message.
[0401] Corresponding to the aforementioned packet loss processing method applied to the first gateway, this application embodiment also provides a packet loss processing device applied to the first gateway.
[0402] See Figure 16 This is a schematic diagram of the structure of a first packet loss processing device provided in an embodiment of this application. The device is applied to a first gateway, which is located on the transmission path between a first host and a second host. The device includes:
[0403] The first message receiving module 1601 is used to receive the first message sent by the first host;
[0404] The first packet loss judgment module 1602 is used to determine whether packet loss has occurred based on the packet sequence number (PSN) of the first message.
[0405] If the first packet loss judgment module 1602 determines that no packet loss has occurred, the first message forwarding module 1603 updates the first receiving PSN to the PSN of the first message and forwards the first message to the second gateway, wherein the second gateway is located on the transmission path between the first gateway and the second host.
[0406] The first NAK sending module 1604 is used to send a first negative acknowledgment (NAK) to the first host if the first packet loss judgment module 1602 determines that packet loss has occurred. The first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host retransmits a message with a PSN greater than or equal to the first PSN.
[0407] As can be seen from the above, the packet loss handling method provided in this application embodiment is applied to a first gateway between a first host and a second host. After receiving a first packet sent by the first host, the first gateway can determine whether packet loss has occurred based on the PSN of the first packet. If packet loss is determined to have occurred, the first gateway will directly send a first NAK to the first host, causing the first host to retransmit the packet. That is, in this application embodiment, packet loss detection can be performed at the first gateway between the first host and the second host, and the timing of packet loss detection is earlier than the method of packet loss detection performed by the second host in related technologies. Therefore, the first host can receive the first NAK in advance, thereby promptly detecting packet loss and retransmitting the packet as soon as possible. This reduces the number of packets sent by the first host after packet loss that will not be processed by the second host, reducing the waste of network bandwidth.
[0408] In one embodiment of this application, if it is determined that no packet loss has occurred, the message received from the first host is buffered, and the device further includes:
[0409] The first NAK receiving module is used to receive the second NAK sent by the second gateway;
[0410] The first message determination module is used to determine whether there is a second message in the cached messages, wherein the PSN of the second message is the second PSN carried by the second NAK, and the second PSN is: the PSN of the message that was lost;
[0411] The second message forwarding module is used to send the second message to the second gateway if the first message determination module determines that the second message exists;
[0412] The second NAK sending module is configured to send a third NAK to the first host if the first message determination module determines that the second message does not exist. The third NAK carries the second PSN, so that the first host resends a third message with a PSN greater than or equal to the second PSN.
[0413] As can be seen from the above, in this embodiment, the first gateway stores messages. When the first gateway receives the second NAK, it indicates that packet loss occurred during transmission of the message sent from the first gateway to the second gateway. In this case, if the first gateway stores the second message indicated by the second NAK, it can directly send the stored second message back to the second gateway without requesting the first host to retransmit the second message. The first host does not perform any additional processing during this process, so this process is imperceptible to the first host and does not affect its message transmission, nor does it consume bandwidth used by the first host to send messages to the first gateway. Furthermore, compared to retransmitting messages through the first host, the first gateway can quickly retransmit the second message to the second gateway after receiving the second NAK via a shorter transmission path, achieving rapid packet loss processing and reducing bandwidth waste. Moreover, if the first gateway does not store the second message, it can send a third NAK to the first host, allowing the first host to continue retransmitting messages normally without affecting the normal packet loss processing flow. Furthermore, the second NAK in this embodiment may be generated after the second gateway detects packet loss. In this case, even if the first host retransmits the message, compared with the related technology where the second host sends a NAK to the first host after detecting packet loss, the data transmission path between the second gateway and the first host in this application is still shorter, and the time required for NAK transmission is shorter. Therefore, even if the first gateway does not cache the second message, the solution provided in this embodiment can still improve the speed of packet loss processing and reduce bandwidth waste.
[0414] In one embodiment of this application, the apparatus further includes:
[0415] The second message receiving module is used to receive the third message;
[0416] The first PSN determination module is used to determine whether the third PSN of the third message is less than or equal to the current first received PSN;
[0417] The second message determination module is used to determine whether the third message has been cached if the first PSN determination module determines that the third PSN is less than or equal to the current first received PSN.
[0418] The first message sending module is configured to discard the received third message and send the cached third message to the second gateway if the second message determining module determines that the third message has been cached.
[0419] The second message sending module is configured to cache and send the received third message to the second gateway if the second message determining module determines that the third message has not been cached.
[0420] As can be seen from the above, in this embodiment of the application, after receiving a third message whose third PSN is less than or equal to the current first receiving PSN, different processing can be performed depending on whether the third message is stored in the first gateway.
[0421] In one embodiment of this application, the apparatus further includes:
[0422] The first ACK receiving module is used to receive the first confirmation ACK sent by the second gateway, wherein the first ACK is sent by the second gateway after determining that the fourth message has not been lost, and carries the fourth PSN of the fourth message;
[0423] The first message deletion module is used to delete the cached fourth message.
[0424] In one embodiment of this application, the apparatus further includes:
[0425] The third message sending module is used to send the fifth message to the second gateway;
[0426] The first ACK determination module is used to determine whether a second ACK is received from the second gateway within a first preset time period. The second ACK is sent by the second gateway after determining that the fifth packet has not been lost, and carries the PSN of the fifth packet.
[0427] The first count judgment module is used to determine whether the number of times the fifth message has been retransmitted has reached a first preset number if the first ACK judgment module determines that the second ACK has not been received.
[0428] The fourth message sending module is used to resend the cached fifth message to the second gateway and return to trigger the execution of the first ACK judgment module;
[0429] The second message deletion module is used to delete the cached fifth message if the first count determination module determines that the first preset count has been reached.
[0430] In one embodiment of this application, the apparatus further includes:
[0431] The second ACK receiving module is used to receive the first ACK sent by the second gateway;
[0432] The second PSN determination module is used to determine whether there is a sixth message whose PSN is less than the fourth PSN and which has not received an ACK for the PSN carrying the message.
[0433] The fifth message sending module is used to retransmit the sixth message if the second PSN determination module determines that the sixth message exists.
[0434] As can be seen from the above, in this embodiment of the application, after receiving the first ACK, the first gateway can determine whether there is a sixth message that has not yet received its corresponding ACK. If there is, it means that the sixth message may have been lost. In this application, the first gateway can actively retransmit the sixth message to deal with the packet loss problem in a timely manner.
[0435] In one embodiment of this application, if packet loss is determined to have occurred, the device further includes:
[0436] The first message discarding module is used to discard received messages whose PSN is greater than the first PSN before receiving a message whose PSN is the first PSN.
[0437] As can be seen from the above, in this embodiment of the application, the first gateway will discard the packets received during the packet loss processing, thereby avoiding out-of-order faults in the packet transmission process.
[0438] In one embodiment of this application, if it is determined that no packet loss has occurred, the device further includes:
[0439] The first ACK sending module is used to send a third ACK to the first host if all messages belonging to the same message are received normally. The PSN carried in the third ACK is the PSN of the last message in the message.
[0440] As can be seen from the above, in this embodiment of the application, after the first gateway normally receives all the packets in the same message, it will send a third ACK to the first host so that the first host can determine that all the packets in the message have been normally received and there is no need to resend the packets in the message.
[0441] In one embodiment of this application, the first packet loss judgment module 1602 is specifically used for:
[0442] Determine whether the first message is the first message received by the first gateway from the first host;
[0443] If it is the first message, then if the PSN of the first message is not the starting PSN, it is determined that packet loss has occurred. The starting PSN is the PSN of the first message to be transmitted, which is negotiated between the first host and the second host through control messages.
[0444] If it is not the first message, then based on the PSN of the first message and the current first received PSN, it is determined whether packet loss has occurred.
[0445] See Figure 17 This is a schematic diagram of the structure of a second packet loss processing device provided in an embodiment of this application. The device includes:
[0446] The third message receiving module 1701 is used to receive and buffer messages sent by the first gateway, wherein the first gateway is located on the transmission path between the second gateway and the first host, and the message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message;
[0447] The second packet loss judgment module 1702 is used to determine whether packet loss has occurred based on the packet sequence number PSN of the seventh message to be sent and the current sending PSN, wherein the sending PSN is the PSN of the most recent message sent to the second host;
[0448] The third NAK sending module 1703 is configured to discard the seventh packet and send a fourth negative acknowledgment (NAK) to the first gateway if the second packet loss judgment module 1702 determines that packet loss has occurred. This allows the first gateway to resend the seventh packet to the second gateway if it determines that the seventh packet exists in the cached packets. If it determines that the seventh packet does not exist in the cached packets, it sends a fifth NAK to the first host, causing the first host to resend a packet with a PSN greater than or equal to the PSN carried by the fifth NAK. The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the sent PSN.
[0449] The third message forwarding module 1704 is used to forward the seventh message to the second host and update the sent PSN to the PSN of the seventh message if the second packet loss judgment module 1702 determines that no packet loss has occurred.
[0450] As can be seen from the above, in the solution provided by this application embodiment, during the process of the first host sending a message to the second host, the second gateway performs packet loss detection after receiving the message sent by the first gateway and before sending the seventh message to the second host. If packet loss occurs, the second gateway will send a fourth NAK to the first gateway to handle the packet loss. That is, in this application embodiment, the second gateway can perform packet loss handling on the message sent by the first host in advance before the message is sent to the second host. Because the timing of packet loss handling is advanced, the second gateway can respond in advance after packet loss occurs, reducing the waste of network bandwidth.
[0451] In one embodiment of this application, the apparatus further includes:
[0452] The second NAK receiving module is used to receive the sixth NAK sent by the second host after determining that packet loss has occurred, wherein the fifth PSN carried by the sixth NAK is the PSN of the eighth packet with the smallest PSN among the packets that have been lost;
[0453] The third message determination module is used to determine whether the eighth message exists in the cached messages;
[0454] The sixth message sending module is used to send a message to the second host if the third message determining module determines that the eighth message exists, and the cached PSN is greater than or equal to the fifth PSN.
[0455] The fourth NAK sending module is used to send an NAK carrying the fifth PSN to the first gateway if the third message determining module determines that the eighth message does not exist.
[0456] As can be seen from the above, in the solution provided by this application embodiment, the second gateway can retransmit the message to the second host after the second host detects packet loss, thereby completing the packet loss processing process. Compared with the solution in related technologies where the first host retransmits the message to the second host, the transmission link length between the second gateway and the second host in this application embodiment is significantly shorter. Therefore, the packet loss processing process can be completed quickly between the second gateway and the second host, thereby reducing the waste of network bandwidth. Even if the second gateway does not store the eighth message, the second gateway can still send a NAK to the first gateway, allowing the first gateway to continue the packet loss processing process.
[0457] In one embodiment of this application, the apparatus further includes:
[0458] The second message discarding module is used to discard subsequently received messages whose PSN is less than the fifth PSN.
[0459] In one embodiment of this application, the third message receiving module 1701 is specifically used for:
[0460] Receive messages sent by the first gateway;
[0461] The third PSN determination module is used to determine whether the PSN of the packet is less than or equal to the current second received PSN; wherein, the second received PSN is the PSN of the packet with the largest PSN received from the first gateway before the packet was received;
[0462] The message processing module is used to determine whether the message has been cached if the third PSN determination module determines that the second received PSN is less than or equal to the current PSN. If the message has been cached, the received message is discarded; if the message has not been cached, the message is cached.
[0463] The message caching module is used to cache the message and update the second received PSN to the PSN of the message if the third PSN determination module determines that the PSN is greater than the current second received PSN.
[0464] In one embodiment of this application, the apparatus further includes:
[0465] The third ACK receiving module is used to receive the fourth acknowledgment ACK sent by the second host, wherein the fourth ACK is sent by the second host after it has normally received all the messages included in the first message, and the PSN carried by the fourth ACK is the PSN of the last message in the first message;
[0466] The third message deletion module is used to delete messages included in the cached first message.
[0467] As can be seen from the above, in the solution provided by the embodiments of this application, when the second gateway receives the fourth ACK for the first message, it can delete the messages included in the cached first message, thereby saving the storage space of the second gateway.
[0468] In one embodiment of this application, the apparatus further includes:
[0469] The seventh message sending module is used to send the ninth message to the second host;
[0470] The second ACK determination module is used to determine whether the fifth ACK fed back by the second host is received within the second preset time period, wherein the fifth ACK is sent by the second host after it has normally received all the messages in the message containing the ninth message;
[0471] The seventh message sending module is used to resend the cached ninth message to the second host if the second ACK judgment module determines that the fifth ACK has not been received, and return to trigger the execution of the second ACK judgment module;
[0472] The second count determination module is used to determine whether the number of times the ninth message has been retransmitted has reached the second preset count.
[0473] The fourth message deletion module is used to delete the cached ninth message if the second count determination module determines that the second preset count has been reached.
[0474] In one embodiment of this application, the apparatus further includes:
[0475] The second ACK sending module is used to send a sixth ACK to the first gateway, wherein the PSN carried by the sixth ACK is the PSN of the received message.
[0476] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps described above for any packet loss handling method applied to the first gateway or the second gateway.
[0477] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any packet loss handling method applied to the first gateway or the second gateway in the above embodiments.
[0478] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0479] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0480] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for gateways, devices, computer-readable storage media, and computer program products are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0481] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A packet loss handling method, characterized in that, Applied to a first gateway, located on a transmission path between a first host and a second host, where the first host and the second host are the two ends transmitting packets, the method includes: Receive the first message sent by the first host; Based on the packet sequence number (PSN) of the first message, determine whether packet loss has occurred; If it is determined that no packet loss has occurred, the first receiving PSN is updated to the PSN of the first message, and the first message is forwarded to the second gateway, wherein the second gateway is located on the transmission path between the first gateway and the second host; If packet loss is detected, a first negative acknowledgment (NAK) is sent to the first host. The first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host retransmits a message with a PSN greater than or equal to the first PSN.
2. The method according to claim 1, characterized in that, If it is determined that no packet loss has occurred, the method further includes caching the packets received from the first host. Receive the second NAK sent by the second gateway, the second NAK carrying the second PSN of the second packet that was lost; Determine if a second message exists in the cached messages; If the existence of the second message is determined, the second message is sent to the second gateway; If it is determined that the second message does not exist, a third NAK is sent to the first host, the third NAK carrying the second PSN, so that the first host resends a third message with a PSN greater than or equal to the second PSN.
3. The method according to claim 2, characterized in that, After sending the third NAK to the first host, the method further includes: Receive third message; Determine whether the third PSN of the third message is less than or equal to the current first received PSN; If it is determined that the third PSN is less than or equal to the current first received PSN, then it is determined whether the third message has been cached. If it is determined that the third message has been cached, the received third message is discarded and the cached third message is sent to the second gateway. If it is determined that the third message has not been cached, then the received third message is cached and sent to the second gateway.
4. The method according to claim 2, characterized in that, The method further includes: Receive a first confirmation ACK sent by the second gateway, wherein the first ACK is sent by the second gateway after determining that the fourth packet has not been lost, and carries the fourth PSN of the fourth packet; Delete the cached fourth message.
5. The method according to claim 4, characterized in that, The method further includes: Send the fifth message to the second gateway; Determine whether a second ACK is received from the second gateway within a first preset time period, wherein the second ACK is sent by the second gateway after determining that the fifth message has not been lost, and carries the PSN of the fifth message; If it is determined that the second ACK has not been received, then it is determined whether the number of times the fifth message has been retransmitted has reached the first preset number; If it is determined that the first preset number of times has not been reached, the cached fifth message is resent to the second gateway, and the process returns to the step of determining whether the second ACK has been received from the second gateway within the first preset time period; If the first preset number of times is reached, the cached fifth message is deleted.
6. The method according to claim 4, characterized in that, The method further includes: Receive the first ACK sent by the second gateway; Determine whether there exists a sixth message whose PSN is less than the fourth PSN and which has not received an ACK for the PSN carrying the message; If the existence of the sixth message is determined, the sixth message is retransmitted.
7. The method according to claim 1, characterized in that, If packet loss is determined to have occurred, the method further includes: Before receiving a message whose PSN is the first PSN, discard any received message whose PSN is greater than the first PSN.
8. The method according to claim 1, characterized in that, If it is determined that no packet loss has occurred, the method further includes: If all messages belonging to the same message are received normally, a third ACK is sent to the first host, wherein the PSN carried in the third ACK is the PSN of the last message in the message.
9. The method according to claim 1, characterized in that, The step of determining whether packet loss has occurred based on the packet sequence number (PSN) of the first message includes: Determine whether the first message is the first message received by the first gateway from the first host; If it is the first message, then if the PSN of the first message is not the starting PSN, it is determined that packet loss has occurred. The starting PSN is the PSN of the first message to be transmitted, which is negotiated between the first host and the second host through control messages. If it is not the first message, then based on the PSN of the first message and the current first received PSN, it is determined whether packet loss has occurred.
10. A packet loss handling method, characterized in that, Applied to a second gateway located on the transmission path between a first host and a second host, where the first host and the second host are the two ends of the transmitted message, the method includes: Receive and buffer messages sent by the first gateway, wherein the first gateway is located on the transmission path between the second gateway and the first host, and the message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message; Based on the sequence number PSN of the seventh message to be sent and the current sending PSN, determine whether packet loss has occurred, wherein the sending PSN is the PSN of the most recent message sent to the second host; If packet loss is detected, the seventh packet is discarded, and a fourth negative acknowledgment (NAK) is sent to the first gateway. If the first gateway determines that the seventh packet exists in the cached packets, it retransmits the seventh packet to the second gateway. If the first gateway determines that the seventh packet does not exist in the cached packets, it sends a fifth NAK to the first host. This causes the first host to retransmit a packet whose PSN is greater than or equal to the PSN carried by the fifth NAK. The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the transmitted PSN. If it is determined that no packet loss has occurred, the seventh message is forwarded to the second host, and the sent PSN is updated to the PSN of the seventh message.
11. The method according to claim 10, characterized in that, The method further includes: The system receives a sixth NAK sent by the second host after determining that packet loss has occurred, wherein the fifth PSN carried by the sixth NAK is the PSN of the eighth packet with the smallest PSN among the packets that have been lost. Determine if the eighth message exists among the cached messages; If the existence of the eighth message is determined, a message with a cached PSN greater than or equal to the fifth PSN is sent to the second host; If it is determined that the eighth message does not exist, then a NAK carrying the fifth PSN is sent to the first gateway.
12. The method according to claim 11, characterized in that, After receiving the sixth NAK sent by the second host after determining that packet loss has occurred, the method further includes: Discard any subsequently received packets whose PSN is less than the fifth PSN.
13. The method according to claim 10, characterized in that, The process of receiving and buffering messages sent by the first gateway includes: Receive messages sent by the first gateway; Determine whether the PSN of the message is less than or equal to the current second received PSN; wherein, the second received PSN is the PSN of the message with the largest PSN received from the first gateway before the message was received; If the PSN of the message is determined to be less than or equal to the current second received PSN, then it is determined whether the message has been cached. If it has been cached, the received message is discarded; if it has not been cached, the message is cached. If it is determined that the PSN of the message is greater than the current second receive PSN, then the message is cached and the second receive PSN is updated to the PSN of the message.
14. The method according to claim 10, characterized in that, The method further includes: Receive the fourth acknowledgment ACK sent by the second host, wherein the fourth ACK is sent by the second host after it has normally received all the messages included in the first message, and the PSN carried by the fourth ACK is the PSN of the last message in the first message; Delete the first message included in the cache.
15. The method according to claim 14, characterized in that, The method further includes: Send the ninth message to the second host; Determine whether the fifth ACK is received from the second host within a second preset time period, wherein the fifth ACK is sent by the second host after it has normally received all the messages in the message containing the ninth message; If it is determined that the fifth ACK has not been received, then it is determined whether the number of times the ninth message has been retransmitted has reached the second preset number; If it is determined that the second preset number of times has not been reached, the cached ninth message is resent to the second host, and the process returns to the step of determining whether the fifth ACK is received from the second host within the second preset time period; If the second preset number of times is reached, the cached ninth message is deleted.
16. The method according to claim 10, characterized in that, After receiving and buffering the message sent by the first gateway, the method further includes: A sixth ACK is sent to the first gateway, and the PSN carried in the sixth ACK is the PSN of the received message.
17. A gateway, characterized in that, The gateway, serving as a first gateway, is located on the transmission path between the first host and the second host, where the first host and the second host are the two ends transmitting the message. The gateway includes: processor; transceiver; A machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the machine-executable instructions cause the processor to perform the following steps: Receive the first message sent by the first host; Based on the packet sequence number (PSN) of the first message, determine whether packet loss has occurred; If it is determined that no packet loss has occurred, the first receiving PSN is updated to the PSN of the first message, and the first message is forwarded to the second gateway, wherein the second gateway is located on the transmission path between the first gateway and the second host; If packet loss is detected, a first negative acknowledgment (NAK) is sent to the first host. The first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host retransmits a message with a PSN greater than or equal to the first PSN.
18. A gateway, characterized in that, The gateway, serving as a second gateway, is located on the transmission path between the first host and the second host, where the first host and the second host are the two ends transmitting the message. The gateway includes: processor; transceiver; A machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the machine-executable instructions cause the processor to perform the following steps: Receive and buffer messages sent by the first gateway, wherein the first gateway is located on the transmission path between the second gateway and the first host, and the message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message; Based on the sequence number PSN of the seventh message to be sent and the current sending PSN, determine whether packet loss has occurred, wherein the sending PSN is the PSN of the most recent message sent to the second host; If packet loss is detected, the seventh packet is discarded, and a fourth negative acknowledgment (NAK) is sent to the first gateway. If the first gateway determines that the seventh packet exists in the cached packets, it retransmits the seventh packet to the second gateway. If the first gateway determines that the seventh packet does not exist in the cached packets, it sends a fifth NAK to the first host. This causes the first host to retransmit a packet whose PSN is greater than or equal to the PSN carried by the fifth NAK. The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the transmitted PSN. If it is determined that no packet loss has occurred, the seventh message is forwarded to the second host, and the sent PSN is updated to the PSN of the seventh message.
19. A packet loss processing device, characterized in that, Applied to a first gateway, the first gateway being located on a transmission path between a first host and a second host, the first host and the second host being the two ends of the transmission message, the device includes: The first message receiving module is used to receive the first message sent by the first host; The first packet loss judgment module is used to determine whether packet loss has occurred based on the packet sequence number (PSN) of the first message. The first message forwarding module is used to update the first receiving PSN to the PSN of the first message and forward the first message to the second gateway if the first packet loss judgment module determines that no packet loss has occurred. The second gateway is located on the transmission path between the first gateway and the second host. The first NAK sending module is configured to send a first negative acknowledgment (NAK) to the first host if the first packet loss judgment module determines that packet loss has occurred. The first PSN carried in the first NAK is calculated based on the current first received PSN, so that the first host retransmits a message with a PSN greater than or equal to the first PSN.
20. A packet loss processing device, characterized in that, An apparatus applied to a second gateway, located on the transmission path between a first host and a second host, where the first and second hosts are the two ends transmitting messages, comprising: The third message receiving module is used to receive and buffer messages sent by the first gateway, wherein the first gateway is located on the transmission path between the second gateway and the first host, and the message is sent by the first gateway after receiving it from the first host and determining that no packet loss has occurred based on the PSN of the message; The second packet loss judgment module is used to determine whether packet loss has occurred based on the packet sequence number PSN of the seventh message to be sent and the current sending PSN, wherein the sending PSN is the PSN of the most recent message sent to the second host; The third NAK sending module is configured to discard the seventh packet and send a fourth negative acknowledgment (NAK) to the first gateway if the second packet loss judgment module determines that packet loss has occurred. This allows the first gateway to resend the seventh packet to the second gateway if it determines that the seventh packet exists in the cached packets. If it determines that the seventh packet does not exist in the cached packets, the module sends a fifth NAK to the first host, causing the first host to resend a packet with a PSN greater than or equal to the PSN carried by the fifth NAK. The fifth NAK carries the same PSN as the fourth NAK, and the PSN carried by the fourth NAK is calculated based on the sent PSN. The third message forwarding module is used to forward the seventh message to the second host and update the sent PSN to the PSN of the seventh message if the second packet loss judgment module determines that no packet loss has occurred.
21. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-9 or 10-16.
Citation Information
Patent Citations
Congestion control method and device
CN117061438A
Network message forwarding method and device, switch and storage medium
CN118487721A