WO2013152586A1 - Data packet retransmission method, data packet receiving method and device - Google Patents

Data packet retransmission method, data packet receiving method and device Download PDF

Info

Publication number
WO2013152586A1
WO2013152586A1 PCT/CN2012/083544 CN2012083544W WO2013152586A1 WO 2013152586 A1 WO2013152586 A1 WO 2013152586A1 CN 2012083544 W CN2012083544 W CN 2012083544W WO 2013152586 A1 WO2013152586 A1 WO 2013152586A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
packet
retransmission
message type
sequence number
Prior art date
Application number
PCT/CN2012/083544
Other languages
French (fr)
Chinese (zh)
Inventor
杨荣玉
王海彬
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2013152586A1 publication Critical patent/WO2013152586A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1867Arrangements specially adapted for the transmitter end
    • H04L1/1887Scheduling and prioritising arrangements

Definitions

  • the present invention relates to a link retransmission technique, and in particular, to a data packet retransmission method, a data packet reception method, and an apparatus. Background technique
  • Quick Path Interconnect is the central processing unit (Central)
  • CPU Processing Unit
  • CPU CPU
  • input and output hub input and output hub
  • QPI has two packet paths, one for the data transmission path and one for the data reception path.
  • the local protocol layer sends the data packet to the link layer; the link layer sends these packets to the physical layer and also stores it in the retransmission buffer; the local physical layer sends these packets to the remote end.
  • Physical layer For the receiving path: The local physical layer receives the data packets sent by the remote physical layer, and the local physical layer sends the packets to the link layer, and the link layer decodes the data packets and determines whether there is any error, and the data is correct.
  • the packet is sent to the protocol layer, and the decoding information is sent to the retransmission control module and the system control module respectively.
  • the local link layer will generate an acknowledgment (ack) after receiving a number of fixed number of error-free packets and inform the other party (ie, the remote end), and the other party clears the data pointed by the tail pointer (tail) in the retransmission buffer. . If there is an error, the local link layer will encapsulate the serial number of the error packet (pkt_num) in the retry request (retry_request) and send it to the other party. At the same time, the local will discard the subsequently received packet until it receives Resend the response (retry_response).
  • the invention provides a data packet retransmission method, a data packet receiving method and a device, which are used for reducing Waste of resources caused by data retransmission.
  • An aspect of the present invention provides a data packet retransmission method, including:
  • the message type and the sequence number of the packet to be retransmitted in the message type to which the request belongs, and the total sequence number of the packet to be sent is a sequence number obtained by counting the data packets of all message types sent;
  • An aspect of the present invention provides a data packet sending apparatus, including:
  • a first receiving module configured to receive a retransmission request, where the retransmission request is sent by a sending end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission;
  • a first processing module configured to acquire the request according to a mapping relationship between a total sequence number of the packet corresponding to the retransmitted data packet and a total sequence number of the locally stored packet and a packet sequence number of each message type.
  • the message type to which the retransmitted data packet belongs and the sequence number of the packet to be retransmitted in the message type to which the request is retransmitted, and the total sequence number of the sent packet is obtained by counting the data packets of all the message types sent. serial number;
  • a first sending module configured to send the request to the receiving end according to a message type to which the data packet retransmitted according to the request belongs and a sending sequence number of the data packet requested to be retransmitted in a message type to which the request belongs.
  • Another aspect of the present invention provides a data packet receiving method, including:
  • the total sequence number of the receiving packet is a data packet of all message types received Counting the obtained serial number;
  • the first data packet includes a message type to which the first data packet belongs and a delivery sequence number of the first data packet in a message type to which the first data packet belongs;
  • the last received sequence number of the message type is the packet sequence number of the last received message packet of the same message type as the first packet in the message type to which the first packet belongs.
  • the first data packet belongs to The last received sequence number of the message type is updated to the delivery sequence number of the first data packet in the message type to which the first data packet belongs.
  • Another aspect of the present invention provides a data packet receiving apparatus, including:
  • a second receiving module configured to receive a first data packet sent by the sending end, where the first data packet includes a message type to which the first data packet belongs and an outgoing packet of the first data packet in a message type to which the first data packet belongs serial number;
  • a second processing module configured to: after the second receiving module receives the first data packet, modify a total sequence number of the received packet to obtain a total sequence number of the packet corresponding to the first data packet, where When the error occurs in the first data packet, the last received packet sequence number of the message type to which the first data packet belongs is obtained according to the message type to which the first data packet belongs, and the message to which the first data packet belongs is determined.
  • the last packet of the message type to which the first data packet belongs is The serial number is updated to the sequence number of the packet in which the first data packet belongs in the message type to which the first data packet belongs; the total sequence number of the received packet is a sequence number obtained by counting the data packets of all received message types; The last received sequence number of the message type to which the data packet belongs is the last received data packet belonging to the same message type as the first data packet before the first data packet.
  • SEQ ID NO contract itself belongs message types.
  • a data packet retransmission method and a data packet transmitting apparatus provided by an aspect of the present invention, after receiving a retransmission request sent by a receiving end, according to a packet retransmission request packet corresponding to a packet sequence number and a locally stored total packet transmission sequence
  • the mapping relationship between the number and the packet sequence number of each message type obtain the message type to which the data packet requesting retransmission belongs, and the data packet requesting retransmission belongs to The sequence number of the packet sent in the message type, and then the data packet requesting retransmission and the data packet sent after the data packet requested to be retransmitted belong to the same message type as the data packet retransmitted by the request, and the obtained request is heavy.
  • the transmitted data packet and the subsequent data packet belonging to the same message type as the data packet requesting retransmission are resent to the receiving end, so that only the same type of data packet is retransmitted, and other types of data packets do not need to be retransmitted.
  • the amount of data retransmitted is reduced compared with the prior art scheme in which the data packet requested to be retransmitted and all the data packets sent after the data packet requested to be retransmitted are resent to the receiving end. Reduce the waste of resources caused by the retransmission mechanism.
  • a data packet receiving method and apparatus provided by another aspect of the present invention parses a data packet after receiving a data packet, and if the data packet can be successfully solved, according to the message type of the data packet in the data packet and the data packet to which the data packet belongs
  • the sequence number of the outgoing packet in the message type determines whether to discard the data packet, and if the data packet is not discarded, the last received sequence number of the message type to which the data packet belongs is updated, so as to continue to receive subsequent data packets, and implement the data packet. Reception.
  • the data packet receiving method and device provided by the present invention cooperate with the data packet retransmission method and device provided by the present invention, and the transmitting end performs data packet retransmission according to the message type, reduces the amount of retransmitted data, and reduces resources caused by retransmission. Consumption provides conditions.
  • FIG. 1 is a flowchart of a method for retransmitting a data packet according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a data packet retransmission method according to another embodiment of the present invention
  • FIG. 3 is a flowchart of a data packet receiving method according to an embodiment of the present invention
  • FIG. 4 is a schematic diagram of a data packet retransmission process according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a data packet sending apparatus according to an embodiment of the present invention
  • FIG. 6B is a schematic structural diagram of a data packet sending apparatus according to another embodiment of the present invention
  • FIG. 6B is a QPI according to another embodiment of the present invention
  • FIG. 7 is a schematic structural diagram of a data packet receiving apparatus according to an embodiment of the present invention
  • FIG. 8 is a schematic structural diagram of a data packet receiving apparatus according to another embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for retransmitting a data packet according to an embodiment of the present invention. As shown in FIG. 1, the data packet retransmission method in this embodiment includes:
  • Step 101 Receive a retransmission request, where the retransmission request is sent by a sending end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission.
  • the execution body of this embodiment is a transmitting end.
  • the sender may be any device in the device or device with a retransmission mechanism.
  • the sender may be a server, a routing device, or the like, or may be a QPI in a Central Processing Unit (CPU) or a QPI in the interconnect chip.
  • the receiving end may also be any device in the device or device with a retransmission mechanism, for example, the receiving end may also be a server, a routing device, etc., or may be a QPI in the CPU or a QPI in the interconnect chip.
  • the total sequence number of the received packet is a sequence number obtained by the receiving end to count the data packets of all received message types.
  • the total sequence number of the packet corresponding to the data packet requesting retransmission is the total sequence number of the packet received by the receiving end after receiving the data packet retransmitted by the receiving end. For example, suppose the receiving end receives the total sequence number of the packet before receiving the retransmitted data packet, and after receiving the data packet that is retransmitted, the total sequence number of the received packet will increase by 1 to 11, and the request is heavy.
  • the total sequence number of the received packet corresponding to the transmitted data packet is 11.
  • the sender sends a packet to the receiver, and counts the packets of all message types sent, so that a total sequence number of the packet is obtained.
  • the total sequence number of the packet sent corresponding to each data packet records the transmission sequence number of each transmitted data packet.
  • the total sequence number of the first packet sent by the first transmitted data packet is 1, and the total sequence number of the second packet sent packet is 2, and the packet sent by the Nth transmitted packet corresponds to
  • the total serial number is N and the like.
  • the data packet to be transmitted refers to the data packet transmitted for the first time does not include the retransmitted data packet, and the total sequence number of the packet corresponding to the retransmitted data packet is the first time of the data packet.
  • the receiving end it will receive the data packet sent by the sender, and will parse the received data packet according to the protocol. If the data packet can be successfully parsed, the packet is considered to have no error. If the data packet is not successfully parsed. , then the packet is considered to be in error. If the packet is in error, the receiver sends a retransmission request to the sender. For the receiving end, the packets of all received message types are also counted, so that a total number of received packets is obtained. The total sequence number of the received packet corresponding to each data packet records the receiving sequence number of each received data packet.
  • the total received sequence number corresponding to the first received data packet is 1, and the total received serial number corresponding to the second received data packet is 2, and the received packet corresponding to the Nth received data packet is received.
  • the total serial number is N and the like.
  • the received data packet mentioned here means that the data packet received for the first time does not include the retransmitted data packet, and the total sequence number of the received packet corresponding to the retransmitted data packet is that the data packet is first.
  • the total sequence number of the packet corresponding to the data packet counted by the sender is the same as the total sequence number of the packet corresponding to the data packet counted by the receiver. Based on this, when the receiving end sends a retransmission request to the transmitting end, the receiving end may add the total receiving sequence number corresponding to the data packet requesting retransmission to the retransmission request, and based on the sending end, it may be known which data is requested to be retransmitted. package.
  • Step 102 Acquire, according to a mapping relationship between a total sequence number of the packet corresponding to the retransmitted data packet and a total sequence number of the locally stored packet and a total sequence number of the packet sent by each message type, obtain a data packet to which the request retransmission belongs.
  • the total packet sequence number is a sequence number obtained by the sender to count the data packets of all message types sent.
  • the total sequence number of the outgoing packet corresponding to each data packet is the total sequence number of the outgoing packet counted after the data packet is sent.
  • IP/IP Internet Protocol
  • IPv4 Internet Protocol version 4
  • IPv6 Internet Protocol version 6
  • the type of the IPv4 data packet belongs to the IPv4 type
  • the type of the IPv6 data packet belongs to the IPv6 type.
  • the QPI protocol mainly includes six types of message types: a listening message (SNOOP, SNP), a source message (HOME, HOM), a request and response message, and a data response message (Data Response, DRS). , Non Data Response (NDR), Non-Coherence Bypass (NCB), and Non-Coherence Standard (NCS).
  • the sender in addition to counting the data packets of all message types to obtain the total sequence number of the packet, the sender also separately counts the data packets of different message types to obtain the packet sequence number of each message type. Moreover, the sender also maps the total packet sequence number and the packet sequence number of each message type, and stores the mapping relationship between them locally.
  • the mapping relationship between the total sequence number of the sent packet and the sequence number of the packet sent by each message type mainly includes: a total sequence number of the packet to be sent corresponding to each transmitted data packet, a message type to which each transmitted data packet belongs, and each The correspondence between the transmitted packet and the sequence number of the packet in the associated message type.
  • the transmitting end parses the retransmission request, and obtains the total sequence number of the packet corresponding to the data packet requesting retransmission from the retransmission request.
  • the sender receives the total sequence number of the packet corresponding to the data packet requesting retransmission from the retransmission request sent by the receiving end
  • the total sequence number of the packet corresponding to the data packet retransmitted according to the request and the total number of locally stored packets may be The mapping relationship between the sequence number and the packet sequence number of each message type obtains the message type to which the data packet requesting retransmission belongs and the packet sequence number in the message type to which the retransmission data packet belongs.
  • the sending end may store the mapping relationship between the total packet sequence number and the packet sequence number of each message type in a mapping relationship table, but is not limited thereto.
  • Table 1 gives a mapping table showing the three message types as an example.
  • the sending end when the sending end obtains the total number of the received packet corresponding to the data packet requesting retransmission from the retransmission request sent by the receiving end, the data packet corresponding to the retransmission request may be received.
  • the total sequence number of the packet matches the total sequence number of the packet in the mapping relationship table, and the total sequence number of the packet with the same total sequence number of the packet corresponding to the packet to be retransmitted is referred to as the total number of the packet in the matching, and will be matched.
  • the message type corresponding to the total sequence number of the outgoing packet and the sequence number of the packet in the message type respectively serve as the message type to which the data packet requesting retransmission belongs and the packet sequence number in the message type to which the data packet requested to be retransmitted belongs.
  • Table 1 is taken as an example for description.
  • the total sequence number of the packet corresponding to the data packet requesting retransmission is 2, and the total sequence number of the packet in the matching in Table 1 is 2, and the message type corresponding to the total sequence number 2 of the packet is 2
  • the corresponding packet type of the message type is 1, and the message type of the data packet requesting retransmission belongs to pktO, and the sequence number of the packet requesting retransmission in the message type pktO is 1, that is, requesting retransmission
  • the packet is the first packet sent in the message type pktO.
  • Step 103 Send a data packet requesting retransmission and a data requesting retransmission to the receiving end according to the message type to which the data packet requested to be retransmitted belongs and the data packet sequence number of the data packet requested to be retransmitted in the message type to which the request belongs. Packets sent after the packet that are requested to be retransmitted belong to the same message type.
  • the request may be obtained from the retransmission buffer according to the information.
  • the retransmitted data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type as the data packet retransmitted by the request, and then the retransmitted data packet of the obtained request and the data requested in the retransmission A packet that is sent after the packet and belongs to the same message type as the packet requesting retransmission is resent to the receiving end.
  • the sending end of the embodiment may be configured to cache data packets of different message types by setting multiple retransmission buffers. And, the sender will record each retransmission buffer and message. The correspondence between types. Based on this, after obtaining the message type to which the data packet requesting retransmission belongs, the transmitting end may determine, according to the message type to which the data packet requested to be retransmitted, the retransmission buffer corresponding to the data packet requesting retransmission, that is, determining The retransmission buffer in which the packet for which the request is retransmitted is cached.
  • the sending end obtains the data packet requesting retransmission from the retransmission buffer corresponding to the data packet that is requested to be retransmitted according to the packet sequence number in the message type to which the transmitting packet is retransmitted according to the obtained request, and
  • the data packet sent after the data packet requested to be retransmitted belongs to the same message type as the data packet requesting retransmission, that is, the data packet sequence requesting the retransmission in the message type to which the request belongs is the starting position, in the request
  • the retransmission buffer in which the retransmitted data packet is located acquires the data packet requesting retransmission and the data packet stored later.
  • Such a message type corresponds to a retransmission buffer, and the correspondence relationship is simple, which is convenient for the sender to manage, and the data packet is highly efficient from the retransmission buffer.
  • the transmitting end of the embodiment may further use a retransmission buffer, and separately manage storage locations of data packets of different message types in the retransmission buffer through different linked lists.
  • the sender may first determine the linked list corresponding to the data packet requesting retransmission; and then send the packet sequence according to the message type to which the request is retransmitted according to the message type to which the request belongs. The number is searched in the determined linked list, and the data packet requesting retransmission and the data packet sent after requesting the retransmitted data packet belonging to the same message type as the data packet requesting retransmission are respectively in the retransmission buffer.
  • a storage location and then respectively obtaining a data packet requesting retransmission according to the obtained storage location into the retransmission buffer and a data packet corresponding to the data packet requested to be retransmitted and sent after the data packet requested to be retransmitted belongs to the same message type .
  • the transmitting end when the transmitting end retransmits the data packet that has been sent before resending (that is, retransmitting the data packet), the total number of the retransmitted data packet is stopped using the total sequence number of the outgoing packet, that is, the total sequence number of the sent packet does not follow the data packet. The retransmission is incremented.
  • the transmitting end sends a retransmission response to the receiving end to notify the receiving end of the data packet sent later.
  • a packet for retransmission For the receiving end, after receiving the retransmission response sent by the sending end, it receives the retransmitted data packet sent by the sending end.
  • the sender The retransmission response is sent to the receiving end first, and then the data packet requesting retransmission is sent to the receiving end and the data packet sent after the data packet requesting retransmission belongs to the same message type as the data packet requesting retransmission.
  • the sending end sends a retransmission response to the receiving end, and after receiving the retransmission request, sending the data packet requesting retransmission to the receiving end and the data sent after requesting the retransmitted data packet and requesting retransmission.
  • a packet can be used before it belongs to the same message type.
  • the sending end may obtain the message type to which the data packet requesting retransmission belongs and the data packet requesting retransmission before sending the sequence number of the packet in the message type to which it belongs, and send the packet to the receiving end. Retransmit the response.
  • the sender may obtain the message type to which the data packet to which the request is retransmitted belongs and the type of the message to which the retransmitted data packet belongs in the message type to which the request belongs, according to the message type to which the retransmitted data packet belongs.
  • the retransmission response is sent to the receiving end.
  • the sender may obtain the data packet requesting retransmission from the retransmission buffer corresponding to the data packet requested to be retransmitted, and the data packet sent after requesting the retransmitted data packet is the same as the data packet requesting retransmission.
  • the retransmission response is sent to the receiving end. .
  • the sending end after receiving the retransmission request sent by the receiving end, receives the total sequence number of the packet corresponding to the data packet retransmitted by the receiving end, and the total sequence number of the locally stored packet and the type of each message type. Corresponding relationship between the sequence numbers of the packets, finding the message type to which the data packet requesting retransmission belongs and the packet sequence number in the message type to which the data packet requesting retransmission belongs, and then obtaining the request weight from the retransmission buffer according to the information The transmitted data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type, and then the obtained data packets are resent to the receiving end.
  • FIG. 2 is a flowchart of a method for retransmitting a data packet according to another embodiment of the present invention. This embodiment is implemented based on the embodiment shown in FIG. 1. As shown in FIG. 2, the method of this embodiment includes before step 103:
  • Step 103a Determine whether the message type to which the data packet requesting retransmission belongs is the same as the message type to which the data packet requested by the previous retransmission request is retransmitted; if the result of the determination is no, that is, the step is not the same, step 103 is performed; Go to step 104.
  • Step 104 Discard the retransmission request.
  • a special case is considered mainly, that is, the case where the receiving end continuously receives two or more packets having errors belonging to the same message type.
  • the receiving end if the packet has an error, the packet type to which the packet belongs cannot be known from the packet, and it is impossible to distinguish whether the packet belongs to the same message type as other packets. Since it is impossible to distinguish which message type the packet in which the error belongs, the receiving end sends a retransmission request to the transmitting end as long as it receives the packet in which the error occurred.
  • the sender continuously receives two retransmission requests, and the data packet retransmitted by the sender to the receiver according to the latter retransmission request is retransmitted to the receiver according to the previous retransmission request.
  • a subset of the data packet that is, some data packets are repeatedly sent; and for the receiving end, if the data packet is received after receiving the data packet, the data packet is discarded, which shows that A special situation can also result in wasted resources.
  • the transmitting end of the embodiment receives the retransmission request and according to the total sequence number of the packet corresponding to the data packet in which the retransmission is requested, and the total sequence number of the packet stored locally and the packet sequence number of each message type.
  • the mapping type of the data packet to which the request is retransmitted may be compared with the message type to which the data packet retransmitted by the previous retransmission request request belongs, and two Are they the same?
  • step 103 may be performed, that is, the message type to which the data packet retransmitted according to the request belongs and the data packet requested to be retransmitted are in the message type to which the message belongs. Sending a sequence number, resending the data packet requesting retransmission to the receiving end and the data packet sent after the data packet requesting retransmission belongs to the same message type as the data packet requesting retransmission.
  • the judgment result is the same, it indicates that the retransmission request belongs to the same message type as the data packet retransmitted by the previous retransmission request, and belongs to the special case mentioned above, because the sender has already described the message according to the previous retransmission request.
  • the transmitting end may discard the retransmission request without performing retransmission processing.
  • the sender compares the message type to which the data packet retransmitted by the current request belongs with the message type to which the data packet retransmitted by the previous retransmission request request belongs, and determines whether the two previous retransmission requests are heavy. A packet with the same error of the same message type can be discarded. If the result of the determination is yes, the current retransmission request can be discarded without retransmission processing, which is beneficial to reduce resource waste caused by data retransmission.
  • the transmitting end sends the first data packet to the receiving end before receiving the retransmission request sent by the receiving end.
  • the first data packet is a data packet sent by the sending end to the receiving end for the first time.
  • the purpose of using the first data packet here is to distinguish it from the retransmitted data packet or the data packet requesting retransmission.
  • the sending, by the sending end, the first data packet to the receiving end may be: the sending end sends the first data packet to the receiving end, buffers the first data packet, and according to the message that the first data packet belongs to.
  • the type updates the mapping relationship between the total sequence number of the outgoing packet and the outgoing sequence number of each message type.
  • the first data packet sent by the sending end includes the message type to which the data packet belongs and the sending sequence number of the first data packet in the message type to which the first data packet belongs.
  • the message type to which the first data packet belongs may be implemented by an identifier or a flag bit in the first data packet.
  • the mapping relationship between the total number of the updated packet and the sequence number of the packet of each message type is mainly added to the total number of the packet to be sent in the mapping relationship, and the sequence number of the packet in the message type to which the first packet belongs. And a correspondence between the message types to which the first data packet belongs.
  • Table 1 On the basis of Table 1, after a new packet with the message type pktO is sent, the new mapping table will be as shown in Table 2.
  • the process of buffering the first data packet may be: according to the first data packet
  • the message type caches the first data packet into a retransmission buffer corresponding to the first data packet.
  • the sender uses a retransmission buffer to simultaneously buffer data packets of all message types and manage the storage locations of data packets of different message types through different linked lists, after the sender sends the first data packet, the first data packet is sent.
  • the process of performing caching may be: buffering the first data packet into the retransmission buffer, and recording the storage location of the first data packet in the retransmission buffer to the message according to the message type to which the first data packet belongs. The type corresponds to the linked list.
  • the sender can use a counter to count the packet sequence number and the total packet sequence number of each message type. When the counter has reached the maximum value, it can be re-counted from 0, that is, it can be cycled.
  • the transmitting end distinguishes the data packet according to the type of the message when the data packet is sent, and records the mapping relationship between the total sequence number of the sent packet and the packet sequence number of each message type, so as to receive the heavy
  • the data packet requesting retransmission and the data packet sent after the requesting retransmission of the data packet requesting retransmission belong to the same message type are not retransmitted to the data packet of other message types.
  • the foundation is beneficial to reduce the amount of data retransmitted, reduce the waste of resources caused by the retransmission mechanism, and improve the bandwidth utilization of the system.
  • FIG. 3 is a flowchart of a data packet receiving method according to an embodiment of the present invention. As shown in FIG. 3, the data packet receiving method in this embodiment includes:
  • Step 301 Receive a first data packet sent by the sending end, and modify a total sequence number of the received packet to obtain a total sequence number of the received packet corresponding to the first data packet.
  • the first data packet is also a data packet that is sent by the sending end for the first time, and is used to distinguish the data packet requesting retransmission or the data packet to be retransmitted, and is not limited to a specific data packet. and also That is to say, the first data packet here is not necessarily the same data packet as the first data packet in the previous embodiment.
  • the execution body of this embodiment is a receiving end.
  • the receiving end can be any device with a retransmission mechanism or a module in the device.
  • the receiving end can be a server, a routing device, etc., and can also be a QPI in the CPU or a QPI in the interconnect chip.
  • the sending end may also be any device in the device or device with a retransmission mechanism, for example, the sending end may be a server, a routing device, etc., or may be a QPI in the CPU or a QPI in the interconnect chip.
  • the total sequence number of the received packet is a sequence number obtained by counting the data packets of all received message types; the total sequence number of the received packet corresponding to the first data packet is the total sequence of the received packets after receiving the first data packet. number. For example, if the total sequence number of the received packet is 5 before the first data packet is received, the total sequence number of the received packet becomes 6 after receiving the first data packet, and the total sequence number of the received packet corresponding to the first data packet is 6. The total sequence number of the received packet changes with the receipt of the data packet, and the total sequence number of the received packet corresponding to a certain data packet is fixed.
  • the received first data packet includes a message type to which the data packet belongs and a transmission sequence number of the first data packet in a message type to which the first data packet belongs.
  • the transmitting end in addition to counting the data packets of all message types, the transmitting end also counts the data packets of each message type according to the message type to which the data packet belongs.
  • the message sequence number of the message type is the sequence number obtained by the sender to count the packets belonging to the message type.
  • the packet sequence number in the message type to which the packet belongs is the packet sequence number of the message type to which the packet belongs after the packet is sent.
  • the packet sequence number of the message type to which the data packet belongs is 2, and after the data packet is sent, the packet sequence number of the message type to which the data packet belongs is 3, and the data packet belongs to itself.
  • the delivery sequence number in the message type is 3. That is, the packet sequence number of the first packet in the message type to which it belongs is the packet sequence number of the message type to which the first packet counted after the first packet is transmitted.
  • the receiving end receives the first data packet sent by the sending end, and uses the total receiving sequence number to count the received first data packet. That is, each time a first data packet is received, the receiving end modifies the total sequence number of the received packet, and more specifically increases the total sequence number of the received packet by one. In this embodiment, the receiving end may acquire the total number of the received packet corresponding to the received first data packet while modifying the total sequence number of the received packet.
  • the data packet that the receiving end uses to count the total sequence number of the received packet refers to the first received data packet and does not include the retransmitted data packet, and the total sequence number of the received packet corresponding to the retransmitted data packet is The total sequence number of the corresponding packet received when the packet is received for the first time.
  • Step 302 When it is determined that the received first data packet does not have an error, obtain a last received sequence number of the message type to which the first data packet belongs according to the message type to which the first data packet belongs.
  • the receiving end parses the first data packet. If the first packet can be successfully parsed, the first packet has no error; if the first packet cannot be successfully parsed, the first packet has an error.
  • the receiving end may obtain, from the first data packet, the message type to which the first data packet belongs and the delivery sequence number of the first data packet in the message type to which the first data packet belongs. Then, the receiving end obtains the last receiving sequence number of the message type to which the first data packet belongs according to the last received packet sequence number of each message type recorded locally according to the message type to which the first data packet belongs. The last received sequence number of the message type to which the data packet belongs is the packet sequence number of the last received message packet of the same message type as the first data packet in the message type to which the first data packet belongs.
  • the receiving end may separately buffer the received data packets according to the message type, or may uniformly cache the data packets of all message types. However, in this embodiment, for each message type, the receiving end records the sequence number of the last received data packet in the message type to which it belongs, so as to determine whether the data packet of each message type is pressed. Order reception.
  • Step 303 Determine whether the last received sequence number of the message type to which the first data packet belongs and the delivery sequence number of the first data packet in the message type to which the first data packet belongs are consecutive; when the determination result is yes, that is, continuous, step 304 is performed. When the judgment result is no, that is, discontinuous, step 305 is performed.
  • the receiving end compares the received first data packet with the last received packet sequence number of the message type to which the first data packet belongs, and can determine whether the two are consecutive.
  • Step 304 Update the last received sequence number of the message type to which the first data packet belongs to the delivery sequence number of the first data packet in the message type to which the first data packet belongs.
  • the first data packet is described. If there is no error in the packet of the message type of the genus, the first packet will be the last received packet, so the receiving end updates the last packet sequence number of the message type to which the first packet belongs to the first packet. The sequence number of the packet in the message type to which it belongs, in order to continue to receive packets of the same message type.
  • Step 305 Record the sequence number of the first packet in the message type to which the packet belongs, as the retransmission sequence number threshold, and discard the first packet.
  • the transmitting end retransmits the first data packet, so the receiving end discards the first data packet after determining the discontinuous result.
  • the receiving end records the sequence number of the first packet in the message type to which it belongs, as the retransmission sequence number threshold.
  • the retransmission sequence number threshold is used for distinguishing, among the data packets sent by the receiving end, which packets are retransmitted.
  • the receiving end parses the data packet after receiving the data packet, and if the data packet can be successfully solved, according to the message type of the data packet in the data packet and the packet sending sequence in the message type to which the data packet belongs.
  • the number is determined whether to discard the data packet, and if the data packet is not discarded, the last received sequence number of the message type to which the data packet belongs is updated, so as to continue to receive subsequent data packets, and if the data packet is discarded, the corresponding data packet is recorded.
  • the packet sequence number of the packet in the associated message type so as to distinguish the retransmitted data packet from the data packet sent by the sender, and realize the reception of the data packet.
  • the data packet receiving method provided in this embodiment is matched with the method for sending a data packet by the sending end provided by the foregoing embodiment, and the transmitting end performs data packet retransmission according to the message type, reduces the amount of retransmitted data, and reduces resources caused by retransmission. Consumption provides conditions.
  • the same message type before the first data packet is indicated.
  • the data packet has an error, so before the receiving end receives the first data packet, the receiving end sends a retransmission request to the transmitting end by receiving the data packet in which the error occurred, and the retransmission request includes the data requesting retransmission.
  • the total serial number of the packet corresponding to the packet is referred to as a first retransmission request.
  • the first retransmission request The data packet requested for retransmission is a data packet received before the first data packet that belongs to the same message type as the first data packet and an error occurs.
  • the receiving end receives the first retransmission response sent by the sending end after receiving the first data packet, and sends the first sending end according to the retransmission sequence number threshold recorded before the first retransmission request is sent. Retransmit the packet sent after the response is retransmitted. For retransmitted data packets, the receiving end does not count the total number of received packets, that is, when the retransmitted data packet is received, the receiving end does not update the total receiving sequence number.
  • the first retransmission response is a retransmission response corresponding to the first retransmission request.
  • the retransmission data packet described herein includes a data packet for which the first retransmission request is requested to be retransmitted, and the first data packet and the first data packet transmitted between the data packet requesting retransmission and the first data packet are the same message. Type of packet.
  • the receiving end receives, according to the retransmission sequence number threshold before sending the first retransmission request, the retransmission data packet sent by the transmitting end after sending the first retransmission response, where the receiving end receives the transmitting end and sends the first retransmission.
  • the data packet sent after the response; the data packet sent by the sender after sending the first retransmission response will also include the message type to which it belongs and the packet sequence number in the message type to which it belongs.
  • the receiving end compares the sending sequence number of the data packet sent by the transmitting end after sending the first retransmission response in the message type to which the transmitting end belongs, and the retransmission sequence number threshold before sending the first retransmission request.
  • the data packet is retransmitted.
  • the data packet so the receiving end uses the data packet as a retransmission data packet. At this time, the receiving end does not update the total receiving sequence number after receiving the retransmission packet.
  • the receiving end when the receiving end receives the data packet sent by the transmitting end after transmitting the first retransmission response, it first parses the received data packet, and distinguishes whether the data packet has an error according to the analysis result. Subsequent operations are performed when the result of the judgment is that no error has occurred in the packet.
  • the sending sequence of the data packet sent by the sending end after sending the first retransmission response is greater than the retransmission sequence number threshold before the first retransmission request is sent, the data packet is not retransmitted.
  • the data packet, but the newly transmitted data packet needs to update the total sequence number of the received packet after receiving the data packet, and more specifically, the total sequence number of the received packet is increased by one.
  • the receiving end acquires the number sent by the receiving sender after sending the first retransmission response. According to the total number of the package corresponding to the package. That is, the receiving end can start receiving the data packet according to the process of step 301 to step 304.
  • the above process describes the processing procedure when the receiving end receives the data packet of the message type before receiving the retransmission response after the packet of the certain message type is in error, by discarding and recording the data packet received after the packet is received.
  • the sequence number of the packet to be sent in the message type and further distinguish which packets are retransmitted from the data packet sent by the sender after sending the retransmission response, ensuring that the total sequence number of the packet can be correctly counted and sent.
  • the total sequence number of the outgoing packet is consistent, which lays the foundation for the retransmission of the data packet.
  • the receiving end sends a second retransmission request to the transmitting end, where the second retransmission request includes a total received sequence number corresponding to the first data packet. Based on this, the receiving end receives the second retransmission response sent by the transmitting end, and receives the first data packet retransmitted by the transmitting end, and does not update the total sequence number of the receiving packet, that is, the total sequence number of the receiving packet is not added. 1. In this process, it is assumed that the receiving end does not receive a packet of the same message type as the packet in which the error occurred before receiving the second retransmission response. If the receiving end receives a packet of the same message type as the packet in which the error occurred before receiving the second retransmission response, the situation will be the same as the above procedure.
  • the receiving terminal may record the total receiving sequence number corresponding to the first data packet that is requested to be retransmitted.
  • the first data packet retransmitted by the transmitting end received by the receiving end may also generate an error.
  • the receiving end needs to resend the second retransmission request to the transmitting end, but in the process, along with the data of other message types.
  • the total sequence number of the received packet may change, so the total sequence number of the first packet corresponding to the first data packet cannot be obtained according to the current total sequence number of the received packet, so the packet corresponding to the first data packet recorded before is received.
  • the total sequence number can regenerate the second retransmission request and send it to the sender. If the first data packet retransmitted by the sender received by the receiving end does not have an error, the total sequence number of the received packet corresponding to the first data packet may be discarded.
  • the receiving end when receiving the retransmission request, the receiving end records the total sequence number of the packet corresponding to the data packet requested to be retransmitted, so as to continue to send the retransmission request to the transmitting end when the retransmitted data packet is still in error. It is beneficial to improve the success rate of receiving data packets.
  • the sender is Link-A and the receiver is Link-B.
  • the message type is 3, which are pktO, pktl, and pkt2.
  • the data packet is represented by pak, and the number following the pak identifies the total sequence number of the packet or the total sequence number of the packet corresponding to the packet.
  • Link-A When Link-A sends a packet of a certain message type to Link-B, it records the sequence number of the packet of the message type, which is recorded as each_pkt_num, and also sends the total sequence number, which is recorded as total_pkt-num, and A mapping relationship table is created, and the mapping relationship table is stored
  • Link-A sends a packet of a certain message type to Link-B, it inserts each_pkt_num corresponding to the packet of this message type into the packet. Therefore, for a packet of the same message type, its corresponding eack_pkt_num is continuously accumulated by one. As shown in Figure 4, at the beginning, Link_A sends data packets pak0, pakl, pak2, pak3, etc. to Link-B.
  • Link-B When Link-B receives the data packet, it counts the number of all received data packets, that is, the total sequence number of the received packet, which is recorded as pkt_num, and extracts each_pkt_num contained in each data packet. When the data packet is correct, the extracted each_pkt_num and the last received sequence number of the message type are recorded as last_each_pkt_num (that is, each of the last received packet of the message type) Pkt — num ) Compare to determine if the packet of the message type is contiguous. If it is not continuous, it indicates that there is an error in the previous packet, then the packet is not received, but pkt_num continues to accumulate at this time.
  • Link-B When there is an error in the currently received data packet, because Link-B cannot know the message type to which the data packet belongs, it will directly send a retry_request to Link_A and the total sequence number of the packet corresponding to the error packet (ie The value of pkt_num after receiving the packet) informs Link_A.
  • Link-A can find the message type to which the error packet belongs and the corresponding each_pkt_num according to the total sequence number of the received packet corresponding to the error packet, and then start retransmission.
  • Link-B detects pakl (shown by dotted line in Figure 4). After an error occurs, a retransmission request is generated, which is retry-req (which contains the pkt-num corresponding to akl) to Link-A. Tells Link—A that there is a packet error and needs to be resent.
  • Link-B will continue to receive packets sent by Link-A, such as pak2, pak3, etc., and will continue to count pkt_num. At this point, after determining that the received data packet is correct, Link_B will also match each_pkt_num in the data packet with the same message type.
  • Last_each_pkt_num compares to determine whether the packet of the message type is continuous: if it is continuous, it indicates that the packet of this message type has not been missed and continues to receive; if it is not continuous, If the packet of the message type is wrong before, the received packet is discarded, and each_pkt_num in the discarded packet is assigned to the retransmission sequence number threshold, which is recorded as
  • Max—each_pkt— num As shown in Figure 4, pak3 and pakl have the same message type, so the pak3 received after the akl error needs to be discarded, and each_pkt_num in pak3 is assigned to max_each_pkt_num. Since ak2 and akl belong to different message types, and there is no error with the previous packet of ak2 belonging to the same message type, pak2 receives normally without discarding.
  • Link-B when Link-B successfully receives the data packet sent by LinK-A, it will send ack to Link-A.
  • Link-A When Link-A sends pakN, it receives retry_req, stops the normal packet transmission, and sends a retry res to Link-B.
  • Link-A searches in the mapping table according to pkt_num in retry req, and obtains the retry buffer corresponding to the pktl message and the retransmission buffer corresponding to the starting position of pktl that needs to be retransmitted. Pakl. Then, all the packets that need to be retransmitted are read out from the retransmission buffer and sent to Link-B. As shown in Figure 4, assume that all packets that need to be retransmitted include pakl, pak3 - pakM (shown in phantom in Figure 4).
  • Link-A After Link-A sends pakM, it continues to send normal data packets, such as pak(N+l). After Link-B detects retry_res, it stops counting pkt_num for pktl type packets, that is, it does not increment pkt_num after receiving the packet of message type pktl.
  • Link-B receives the link_A retransmitted message type pktl packet, extracts each_pkt_num, and compares the extracted each_pkt_num with max_each_pkt_num, when each_ When pkt_num is greater than max_each_pkt_num, the pkt_num is restarted for the packet of the message type pktl, that is, each_pkt_num is greater than max in the packet detecting the message type pktl. For each_pkt_num, you need to force kt num 1 and then need to add 1 to pkt_num when receiving a new packet with message type pktl.
  • Link-B normally receives subsequent data packets and sends ack to Link-A when it successfully receives subsequent data packets.
  • Link-B when Link-B detects a packet error, it also saves pkt_num at this time, that is, pkt_num corresponding to the error packet.
  • pkt_num After receiving the retry_res, if the first received packet has no error, the saved pkt_num is discarded; if the first received packet after retry-res has an error, it needs to be redirected to the Link- A sends retry_req, at which point pkt_num in retry req is the previously saved pkt_num, not the current pkt_num. In this way, after Link-A receives retry req, it can find the correct retransmission packet type and the starting position of the retransmission packet in the mapping table according to pkt_num in retry req.
  • the data packet retransmission method and the data packet receiving method provided by the embodiment of the present invention cooperate with each other, and in a scenario requiring retransmission, only a certain type of data packet can be retransmitted without After that, all other types of data packets are retransmitted, which reduces the amount of data retransmitted, saves resource waste caused by the retransmission mechanism, and improves the bandwidth utilization of the system.
  • FIG. 5 is a schematic structural diagram of a data packet sending apparatus according to an embodiment of the present invention.
  • the data packet transmitting apparatus 5 of this embodiment includes: a first receiving module 51, a first processing module 52, and a first transmitting module 53.
  • the first receiving module 51 is configured to receive a retransmission request, where the retransmission request is sent by the receiving end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission.
  • the total sequence number of the received packet is a sequence number obtained by the receiving end to count the data packets of all received message types.
  • the total sequence number of the packet corresponding to the data packet requesting retransmission is the total sequence number of the packet received after the receiving end receives the data packet requesting retransmission.
  • the first processing module 52 is connected to the first receiving module 51, and is configured to receive a total sequence number of the packet corresponding to the data packet retransmitted according to the request in the retransmission request received by the first receiving module 51, and a total sequence of the locally stored packet.
  • the mapping relationship between the number and the packet sequence number of each message type obtains the message type to which the data packet requesting retransmission belongs and the packet sequence number of the data packet requesting retransmission in the message type to which it belongs.
  • the total sequence number of the packet is a sequence number obtained by counting packets of all message types sent.
  • the first sending module 53 is connected to the first processing module 52, and the message type to which the data packet retransmitted according to the request acquired by the first processing module 52 belongs and the data packet requested to be retransmitted are themselves The packet sequence number in the associated message type, the data packet requesting retransmission is sent to the receiving end, and the data packet sent after the requesting retransmitted data packet belongs to the same message type as the data packet requesting retransmission.
  • the function modules of the data packet transmitting apparatus in this embodiment can be used to perform the process of the data packet retransmission method shown in FIG. 1.
  • the specific working principle is not described here. For details, refer to the description of the method embodiment.
  • the packet sending device of this embodiment may be any device or device in the device having a retransmission mechanism.
  • the sender may be a server, a routing device, or the like, or may be a QPI in the CPU or a QPI in the interconnect chip.
  • the data packet transmitting apparatus of the embodiment After receiving the retransmission request sent by the receiving end, the data packet transmitting apparatus of the embodiment receives the total sequence number of the packet corresponding to the data packet retransmitted by the receiving end, and the total sequence number of the packet and the message type of each of the locally stored packets. Correspondence between the serial numbers of the outgoing packets, find the message type to which the data packet requesting retransmission belongs, and the sequence number of the outgoing packet in the message type to which the data packet requesting retransmission belongs, and then obtain the request from the retransmission buffer according to the information. The retransmitted data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type, and then the obtained data packets are resent to the receiving end.
  • the data packet transmitting apparatus of this embodiment realizes that only the same type of data packet is retransmitted in the process of data packet retransmission, and other types of data packets sent after requesting the retransmitted data packet are not used when retransmission is not required.
  • Retransmission which reduces the amount of data retransmitted, and reduces the amount of data that is retransmitted compared with the solution in the prior art that retransmits the data packet that is requested to be retransmitted and all data packets that are sent after the data packet is retransmitted to the receiving end. Waste of resources caused by the transmission mechanism.
  • FIG. 6 is a schematic structural diagram of a data packet sending apparatus according to an embodiment of the present invention. This embodiment is implemented based on the embodiment shown in FIG. As shown in FIG. 6A, the data packet transmitting apparatus 6 of this embodiment also includes a first receiving module 51, a first processing module 52, and a first transmitting module 53, and each module also has the functions described in the embodiment shown in FIG. .
  • the first processing module 52 is further configured to send, at the first sending module 53, the data packet requesting retransmission to the receiving end, and the data packet sent after requesting the retransmitted data packet to be requested to be retransmitted.
  • the first sending module is triggered.
  • the first processing module 52 of the embodiment is further configured to discard the retransmission request received by the first receiving module 51 when the determination result is the same.
  • the first sending module 53 of this embodiment is further configured to send the first data packet to the receiving end.
  • the first data packet is a data packet sent to the receiving end for the first time, and the first data packet includes a message type to which the first data packet belongs and a delivery sequence number of the first data packet in the message type to which the first data packet belongs.
  • the first processing module 52 is further configured to buffer the first data packet, and update a mapping relationship between the total packet sequence number and the packet sequence number of each message type according to the message type to which the first data packet belongs.
  • the packet transmitting apparatus of this embodiment includes a plurality of retransmission buffers 54. Different retransmission buffers 54 are used to buffer packets of different message types.
  • the first processing module 52 is specifically configured to buffer the first data packet into the retransmission buffer 54 corresponding to the first data packet according to the message type to which the first data packet belongs.
  • the first transmitting module 53 of this embodiment includes: a retransmission control unit 531, a transmission control unit 532, and a transmitting unit 533.
  • the retransmission control unit 531 is connected to the first processing module 52, and is configured to determine, according to the message type to which the data packet retransmitted by the first processing module 52 belongs, a retransmission buffer corresponding to the data packet requesting retransmission. 54.
  • the sending control unit 532 is connected to the first processing module 52 and the retransmission buffer 54 for requesting the retransmission of the data packet according to the request acquired by the first processing module 52 in the message type of the message type to which the first processing module 52 belongs.
  • the retransmission buffer 54 corresponding to the retransmitted data packet acquires the data packet requesting retransmission and the data packet transmitted after the data packet requested to be retransmitted belongs to the same message type as the data packet requested to be retransmitted.
  • the sending unit 533 is connected to the sending control unit 532, and configured to send a retransmission response to the receiving end, and then send the data packet requested by the sending control unit 532 and retransmitted to the receiving end, and send the data packet after requesting the retransmitted data packet.
  • the sending unit 533 is specifically configured to acquire, at the first processing module 52, the request for retransmission.
  • the message type to which the data packet belongs and the data packet requesting retransmission send a retransmission response to the receiving end before the packet sequence number in the message type to which it belongs.
  • the sending unit 533 is specifically configured to send a retransmission response to the receiving end before the retransmission control unit 531 determines the retransmission buffer corresponding to the data packet requesting retransmission according to the message type of the data packet requested to be retransmitted.
  • the sending unit 533 is specifically configured to: in the retransmission buffer corresponding to the data packet requesting retransmission, the sending control unit 532 acquires the data packet requesting retransmission and the data sent after requesting the retransmitted data packet and requesting retransmission After the packet belongs to the same message type packet, the retransmission response is sent to the receiving end.
  • the first sending module 53 of this embodiment further includes: a special packet generating unit 534.
  • the special packet generation unit 534 is configured to generate a retransmission response.
  • the special packet generating unit 534 is connected to the first processing module 52 and the sending unit 533 for generating a retransmission response under the control of the first processing module 52, and providing the retransmission response to the sending unit 533.
  • the special packet generating unit 534 is further configured to generate a retransmission request.
  • the special packet generating unit 534 of this embodiment is also used to generate an ack message or the like.
  • the first processing module 52 of this embodiment may include: a receiving decoding unit 521 and a system control unit 522.
  • the receiving and decoding unit 521 is connected to the first receiving module 51, and configured to parse the retransmission request received by the first receiving module 51, and obtain the total sequence number of the packet corresponding to the data packet requesting retransmission.
  • the system control unit 522 is connected to the receiving and decoding unit 521, and is configured to match the total sequence number of the packet corresponding to the data packet requesting retransmission with the total sequence number of the packet in the locally stored mapping relationship table, and send the matching packet in the matching.
  • the message type corresponding to the total sequence number and the packet sequence number of the message type respectively serve as the message type to which the data packet requesting retransmission belongs and the packet sequence number in the message type to which the data packet requested to be retransmitted belongs.
  • the mapping relationship table stores a mapping relationship between the total sequence number of the packet and the packet sequence number of each message type.
  • system control unit 522 is also connected to the retransmission control unit 531, the transmission control unit 532, and the special packet generation unit 534.
  • the first sending module Specifically, the sending unit 533 can send the first data packet to the receiving end.
  • the first processing module 52 may specifically cache the first data packet by its system control unit 522, and update between the total packet sequence number and the packet sequence number of each message type according to the message type to which the first data packet belongs. Mapping relations. More specifically, the first processing module 52 may specifically cache the first data packet by the system control unit 522 according to the message type to which the first data packet belongs to the retransmission buffer 54 corresponding to the first data packet.
  • the first processing module 52 may specifically determine, by its system control unit 522, the message type to which the data packet requesting retransmission belongs and the message to which the data packet to which the previous retransmission request requests retransmission belongs.
  • the receiving end sends the data packet requesting retransmission and the data packet sent after the data packet requesting retransmission belongs to the same message type as the data packet requesting retransmission; when the judgment result is the same, the first receiving module 51 is used. The received retransmission request is discarded.
  • the data packet transmitting apparatus of the embodiment After receiving the retransmission request sent by the receiving end, the data packet transmitting apparatus of the embodiment receives the total sequence number of the packet corresponding to the data packet retransmitted by the receiving end, and the total sequence number of the packet and the message type of each of the locally stored packets. Correspondence between the serial numbers of the outgoing packets, find the message type to which the data packet requesting retransmission belongs, and the sequence number of the outgoing packet in the message type to which the data packet requesting retransmission belongs, and then obtain the request from the retransmission buffer according to the information. The retransmitted data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type, and then the obtained data packets are resent to the receiving end.
  • the data packet transmitting apparatus of this embodiment realizes that only the same type of data packet is retransmitted in the process of data packet retransmission, and other types of data packets sent after requesting the retransmitted data packet are not used when retransmission is not required.
  • Retransmission which reduces the amount of data retransmitted, and reduces the amount of data that is retransmitted compared with the solution in the prior art that retransmits the data packet that is requested to be retransmitted and all data packets that are sent after the data packet is retransmitted to the receiving end. Waste of resources caused by the transmission mechanism.
  • FIG. 6B is a schematic structural diagram of a link layer of a QPI protocol according to an embodiment of the present invention.
  • the QPI protocol in this embodiment includes: a protocol layer of QPI, a link layer of QPI, and The physical layer of QPI.
  • the link layer of QPI is responsible for receiving and retransmitting data packets.
  • the link layer of QPI mainly includes: receiving module rx, receiving decoding module rx_decode, system control module sys-Ctrl, multiple retransmission control modules retry- ctrl, sending control module tx- Ctrl, special packet generating module gen sp , multiple retransmission buffers retry_buf and sending module tx.
  • the receiving module rx of this embodiment is equivalent to the first receiving module 51 in the embodiment shown in FIG. 6A; the receiving decoding module rx_decode of this embodiment is equivalent to FIG. 6A.
  • the receiving and decoding unit 521 in the illustrated embodiment; the system control module sys_Ctrl of the embodiment is equivalent to the system control unit 522 in the embodiment shown in FIG. 6A; the retransmission control module retry_Ctrl of the embodiment is equivalent to The retransmission control unit 531 in the embodiment shown in FIG. 6A; the transmission control module tx_Ctrl of the embodiment is equivalent to the transmission control unit 532 in the embodiment shown in FIG.
  • the special packet generation module gen-sp of this embodiment Corresponding to the special packet generating unit 534 in the embodiment shown in FIG. 6A; the retransmission buffer retry_buf of this embodiment is equivalent to the retransmission buffer 54 in the embodiment shown in FIG. 6A; the sending of this embodiment
  • the module tx corresponds to the transmitting unit 533 in the embodiment shown in Fig. 6A.
  • the receiving module rx is an interface between the link layer and the physical layer, and is configured to receive data packets from the physical layer.
  • the receiving decoding module rx_decode is used for decoding the data packet received by the receiving module rx, extracting the link layer contained in the data packet and sending the information to the system control module sys_Ctrl, and receiving Whether the packet is incorrect and which packet error is sent to the retransmission control module retry_ctrl.
  • the system control module sys-Ctrl is mainly used to send control information to the retransmission control module retry- ctrl, the send control module tx-Ctrl, and the special packet generation module gen-sp.
  • the retransmission control module retry-Ctrl is used to control the read/write pointer of the retry buffer retry_buf.
  • the send control module tx_Ctrl is used to select the data to be sent from the retransmission buffer retry_buf, the protocol layer, and the special packet generation module gen-sp.
  • the special packet generation module gen-sp is used to generate special packets used by the link layer, such as acknowledgment (ack), retry-request, retry-response, and so on.
  • Retransmission buffer retry_buf used to receive the sequence number of the error packet in the retry_requset when retransmission is required
  • the sending module tx is used to send data packets.
  • the link layer of the QPI protocol of the embodiment has the function of transmitting and receiving data packets at the same time.
  • the functions of the modules in the link layer of the QPI protocol of the present embodiment are described above as a whole. According to the packet retransmission, the functions of each module in the link layer when the data packet is retransmitted are described in detail.
  • the receiving module rx receives the retransmission request from the physical layer.
  • the receiving decoding module rx_decode is used to decode the retransmission request received by the receiving module rx, extract the total sequence number of the packet corresponding to the data packet requesting retransmission, and provide it to the system control module sys- Ctrl.
  • the system control module sys_Ctrl matches the total sequence number of the packet corresponding to the retransmitted data packet with the total sequence number of the packet in the locally stored mapping relationship table, and matches the message type corresponding to the total sequence number of the received packet in the match.
  • the message sequence number of the message type is used as the message type to which the data packet requesting retransmission belongs and the packet sequence number of the data packet requesting retransmission in the message type to which the request is retransmitted, and the message type to which the retransmitted data packet belongs is controlled.
  • the information is provided to the corresponding retransmission control module retry_Ctrl, and the packet sequence number of the data packet requesting retransmission in the message type to which it belongs is provided as control information to the transmission control module tx_ctrl.
  • the retransmission control module retry-Ctrl selects the corresponding retransmission buffer retry_buf according to the message type to which the retransmitted packet belongs.
  • the sending control module tx_Ctrl obtains the data packet requesting retransmission from the retransmission buffer retry_buf selected by the retry control module retry_Ctrl according to the packet sequence number in the message type to which the request is retransmitted. A packet sent after a packet that is requested to be retransmitted.
  • the sending module tx sends the data packet obtained by the sending control module tx_Ctrl to the receiving end.
  • the special packet generation module gen-sp generates a retransmission response before the sending module tx sends the data packet acquired by the control module tx_Ctrl to the receiving end; the sending module tx sends the retransmission response to the receiving end, and then receives the retransmission response.
  • the data packet sent by the control module tx_Ctrl is sent.
  • the link layer of the QPI protocol sets a plurality of retransmission buffers, so that each retransmission buffer corresponds to one message type, and stores the total sequence number of the packet and the packet sequence number of each message type. Correspondence between the two types, so that after receiving the retransmission request from the receiving end, only the same type of data packet can be retransmitted, and other types of data packets sent after requesting the retransmitted data packet do not need to be retransmitted.
  • FIG. 7 is a schematic structural diagram of a data packet receiving apparatus according to an embodiment of the present invention.
  • the data packet receiving apparatus 7 of this embodiment includes: a second receiving module 71 and a second processing module 72.
  • the second receiving module 71 is configured to receive the first data packet sent by the sending end.
  • the first data packet includes a message type to which the first data packet belongs and a delivery sequence number of the first data packet in a message type to which the first data packet belongs.
  • the second processing module 72 is connected to the second receiving module 71, and configured to: after receiving the first data packet, the second receiving module 71, modify the total sequence number of the received packet to obtain the total number of the received packet corresponding to the first data packet, And determining that the first packet received by the second receiving module 71 does not generate an error, acquiring the last packet sequence number of the message type to which the first data packet belongs according to the message type to which the first data packet belongs, and determining the first Whether the last received sequence number of the message type to which the data packet belongs and whether the first data packet is consecutive in the message type of the message type to which it belongs, and when the judgment result is continuous, the last message type to which the first data packet belongs is received.
  • the packet sequence number is updated to the packet sequence number of the first packet in the message type to which it belongs.
  • the total sequence number of the received packet is a sequence number obtained by counting the data packets of all received message types; the last received sequence number of the message type to which the first data packet belongs is the last received before the first data packet.
  • the first packet belongs to the packet sequence number of the packet of the same message type in the message type to which it belongs.
  • the function modules of the data packet receiving apparatus of this embodiment can be used to execute the flowchart of the data packet receiving method shown in FIG. 3.
  • the specific working principle is not described here. For details, refer to the description of the method embodiment.
  • the data packet receiving apparatus in this embodiment may be any device in the device or device having a retransmission mechanism, for example, the receiving end may also be a server, a routing device, or the like, or may be a QPI in the CPU or a QPI in the interconnect chip.
  • the data packet receiving apparatus of the embodiment cooperates with the data packet sending apparatus provided by the embodiment of the present invention, and parses the data packet after receiving the data packet. If the data packet can be successfully solved, according to the data packet, the data packet belongs to The message type and the packet sequence number in the message type to which the packet belongs determine whether to discard the packet, and if the packet is not discarded, update the last packet sequence number of the message type to which the packet belongs, so as to continue Receiving a subsequent data packet, if the data packet is discarded, the packet sequence number of the data packet in the associated message type is recorded correspondingly, so as to distinguish the retransmitted data packet from the data packet sent by the sender, and implement the data packet.
  • the receiving for the data packet transmitting device, retransmits the data packet according to the message type, reduces the amount of retransmitted data, and reduces the resource consumption caused by the retransmission.
  • FIG. 8 is a schematic structural diagram of a data packet receiving apparatus according to another embodiment of the present invention. This embodiment is implemented based on the embodiment shown in FIG. As shown in FIG. 8, the data packet receiving apparatus of this embodiment 8 also includes: a second receiving module 71 and a second processing module 72, and each module also has the functions described in the embodiment shown in FIG.
  • the second processing module 72 of the embodiment is further configured to: when the result of the determination is that the last received sequence number of the message type to which the first data packet belongs and the initial sequence number of the first data packet in the message type to which the first data packet belongs are discontinuous When the first data packet is recorded as the retransmission sequence number threshold in the message sequence number of the message type to which the first data packet belongs, the first data packet is discarded.
  • the apparatus of this embodiment further includes: a second sending module 73.
  • the second sending module 73 is configured to send a first retransmission request to the sending end before the second receiving module 71 receives the first data packet.
  • the first retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission; the data packet requested to be retransmitted is the same message type received before the first data packet and the error occurs. data pack.
  • the second receiving module 71 is further configured to receive the first retransmission response sent by the sending end.
  • the second processing module 72 is further configured to receive, according to the retransmission sequence number threshold before sending the first retransmission request, the retransmission data packet sent by the transmitting end after sending the first retransmission response.
  • the retransmitted data packet includes a data packet requesting retransmission, a first data packet, and a data packet that is sent between the data packet requesting retransmission and the first data packet and belongs to the same message type as the data packet.
  • the second processing module 72 is specifically configured to: send, by the sending end, the data packet sent by the sending end after sending the first retransmission response, the sequence number of the sending packet in the message type to which the transmitting end belongs, and the retransmission sequence number threshold before sending the first retransmission request.
  • the transmitting end Comparing, when the sending packet sent by the transmitting end after transmitting the first retransmission response has a packet sequence number in the message type to which it belongs is less than or equal to the retransmission sequence number threshold before the first retransmission request is sent, the transmitting end is The data packet sent after the first retransmission response is sent as a retransmission data packet.
  • the second processing module 72 is further configured to: after the sending of the first retransmission response, the data packet sent by the transmitting end in the message type to which the first packet is sent is greater than the retransmission sequence number of the packet before the first retransmission request is sent.
  • the time limit is updated, and the total sequence number of the received packet is obtained, and the total sequence number of the packet corresponding to the data packet sent by the sender after sending the first retransmission response is obtained.
  • the second sending module 73 is further configured to send a second retransmission request to the sending end when it is determined that the first data packet received by the second receiving module 71 is incorrect.
  • the second retransmission request includes a total sequence number of the packet corresponding to the first data packet.
  • the second receiving module 71 is further configured to: after receiving the second retransmission response sent by the sending end, receive the first data packet retransmitted by the sending end.
  • the second processing module 72 is further configured to record a total sequence number of the packet corresponding to the first data packet.
  • the second sending module 73 is further configured to: when determining that the re-received first data packet has an error, regenerate according to the total received sequence number corresponding to the first data packet recorded by the second processing module 72, and send the second to the sending end. Retransmit the request.
  • the second processing module 72 and the second sending module 73 are connected.
  • Each of the foregoing functional modules can be used to perform the process of the data packet receiving method provided in the foregoing embodiment, and the specific working principle is not described herein.
  • the link layer of the QPI protocol shown in FIG. 6B receives a data packet as a receiving end, it can be used as the data packet receiving apparatus of this embodiment.
  • the functions of the respective modules shown in Fig. 6B and the packet receiving apparatus of this embodiment will be described below.
  • the receiving module rx in the embodiment shown in FIG. 6B is equivalent to the second receiving module 71 in the embodiment; the receiving decoding module rx_decode and the system control module sys-Ctrl in the embodiment shown in FIG. 6B can be As the second processing module 72 in this embodiment, the transmission control module tx- ctrl, the special packet generation module gen-sp, and the transmission module tx in the embodiment shown in FIG.
  • the link layer of the QPI protocol shown in FIG. 6B can be referred to the embodiment shown in FIG. 3 or the description of the embodiment, and details are not described herein again.
  • the data packet receiving apparatus of the embodiment cooperates with the data packet sending apparatus provided by the embodiment of the present invention, and parses the data packet after receiving the data packet. If the data packet can be successfully solved, the data packet is determined according to the data packet.
  • the message type of the message type and the packet sequence number in the message type to which the data packet belongs determine whether to discard the data packet, and if the data packet is not discarded, update the last packet sequence number of the message type to which the data packet belongs, so as to facilitate Continue to receive subsequent data packets. If the data packet is discarded, the packet sequence number of the data packet in the associated message type is recorded correspondingly, so as to distinguish the retransmitted data packet from the data packet sent by the sender, and implement the data packet.
  • the data packet transmitting apparatus receives, and when an error occurs in the data packet, by transmitting a retransmission request to the data packet transmitting apparatus as the transmitting end, the data packet transmitting apparatus performs retransmission of the data packet according to the message type, thereby reducing the amount of retransmitted data and reducing retransmission.
  • the resource consumption provides conditions.
  • the steps of implementing the above method embodiments may be performed by hardware related to the program instructions.
  • the aforementioned program can be stored in a calculation
  • the machine can be read from the storage medium.
  • the steps including the foregoing method embodiments are performed; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)
  • Detection And Prevention Of Errors In Transmission (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present invention provides a data packet retransmission method, a data packet receiving method, and a data packet receiving device. The retransmission method comprises: receiving a retransmission request comprising a packet reception total sequence number corresponding to a data packet of which retransmission is requested; according to mapping between the packet reception total sequence number corresponding to the data packet of which retransmission is requested and a packet transmission sequence number of each message type and mapping between a locally stored packet transmission total sequence number and a packet transmission sequence number of each message type, acquiring a message type of the data packet of which retransmission is requested and a packet transmission sequence number in the message type; and according to the acquired message type of the data packet of which retransmission is requested and the packet transmission sequence number in the message type, retransmitting to a receiving end the data packet of which retransmission is requested and subsequently sent data packets that have the same message type as the data packet of which retransmission is requested. The technical solution of the present invention can retransmit data packets of the same type only, thereby reducing the data traffic for retransmission and lowering resource waste caused by a retransmission mechanism.

Description

数据包重传方法、 数据包接收方法及装置 技术领域 本发明涉及链路重传技术, 尤其涉及一种数据包重传方法、 数据包接 收方法及装置。 背景技术  TECHNICAL FIELD The present invention relates to a link retransmission technique, and in particular, to a data packet retransmission method, a data packet reception method, and an apparatus. Background technique
快速互联通道 ( Quick Path Interconnect, QPI )是中央处理单元( Central Quick Path Interconnect (QPI) is the central processing unit (Central)
Processing Unit, CPU )与 CPU之间, CPU与输入输出集线器( Input Output Hub,Processing Unit, CPU) and CPU, CPU and input and output hub (Input Output Hub,
IOH )之间乃至 CPU与远端内存之间数据交换的重要高速通道。 An important high-speed channel for data exchange between the IOH and even the CPU and remote memory.
现有 QPI的实现方案包括 QPI的协议层 ( Upper Layer ) 、 链路层 ( Link Layer )和物理层 (Physical Layer)。 QPI有两条数据包通路, 一条是数据发送 通路, 一条是数据接收通路。 对于发送通路: 本地的协议层将数据包发给链 路层; 链路层将这些包发送给物理层的同时也存入重传緩冲器中; 本地物理 层将这些包发给远端的物理层。 对于接收通路: 本地物理层接收远端物理层 发来的数据包, 本地物理层将这些包发给链路层, 链路层对这些数据包进行 译码并判断是否有误, 将无误的数据包发给协议层, 并将译码信息分别发送 给重传控制模块和系统控制模块。 本地链路层会在接收到若干个固定个数的 无误包后产生确认(ack )并告知对方(即远端) , 对方将重传緩冲器中的尾 指针(tail )指向的数据清掉。 如果有误, 本地的链路层会将计数的错误包的 序号 (pkt— num )封装在重传请求 ( retry— request ) 中发送给对方; 同时本地 会丟弃后续接收到的包, 直到收到重传响应 ( retry— response ) 。  Existing QPI implementations include QPI's Upper Layer, Link Layer, and Physical Layer. QPI has two packet paths, one for the data transmission path and one for the data reception path. For the transmission path: the local protocol layer sends the data packet to the link layer; the link layer sends these packets to the physical layer and also stores it in the retransmission buffer; the local physical layer sends these packets to the remote end. Physical layer. For the receiving path: The local physical layer receives the data packets sent by the remote physical layer, and the local physical layer sends the packets to the link layer, and the link layer decodes the data packets and determines whether there is any error, and the data is correct. The packet is sent to the protocol layer, and the decoding information is sent to the retransmission control module and the system control module respectively. The local link layer will generate an acknowledgment (ack) after receiving a number of fixed number of error-free packets and inform the other party (ie, the remote end), and the other party clears the data pointed by the tail pointer (tail) in the retransmission buffer. . If there is an error, the local link layer will encapsulate the serial number of the error packet (pkt_num) in the retry request (retry_request) and send it to the other party. At the same time, the local will discard the subsequently received packet until it receives Resend the response (retry_response).
在上述重传过程中, 发送端会将第一个错误包以及在第一个错误包之后 已经发送的其他包都重传,但实际上有些包是不需要重传的, 因此,现有 QPI 的重传机制会造成资源浪费。 发明内容  During the above retransmission process, the sender will retransmit the first error packet and other packets that have been sent after the first error packet, but in fact some packets do not need to be retransmitted. Therefore, the existing QPI The retransmission mechanism will result in waste of resources. Summary of the invention
本发明提供一种数据包重传方法、 数据包接收方法及装置, 用以降低 数据重传造成的资源浪费。 The invention provides a data packet retransmission method, a data packet receiving method and a device, which are used for reducing Waste of resources caused by data retransmission.
本发明一方面提供一种数据包重传方法, 包括:  An aspect of the present invention provides a data packet retransmission method, including:
接收重传请求, 所述重传请求由发送端发送, 所述重传请求包括请求 重传的数据包对应的收包总序列号;  Receiving a retransmission request, where the retransmission request is sent by the sending end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission;
根据所述请求重传的数据包对应的收包总序列号和本地存储的发包 总序列号与每个消息类型的发包序列号之间的映射关系, 获取所述请求重 传的数据包所属的消息类型和所述请求重传的数据包在自身所属的消息 类型中的发包序列号, 所述发包总序列号为对发送的所有消息类型的数据 包进行计数得到的序列号;  Obtaining, according to a mapping relationship between a total number of received packets corresponding to the data packet retransmitted by the request and a total sequence number of the locally stored packet and a packet sequence number of each message type, acquiring the data packet to which the request retransmission belongs The message type and the sequence number of the packet to be retransmitted in the message type to which the request belongs, and the total sequence number of the packet to be sent is a sequence number obtained by counting the data packets of all message types sent;
根据所述请求重传的数据包所属的消息类型和所述请求重传的数据 包在自身所属的消息类型中的发包序列号, 向所述接收端发送所述请求重 传的数据包以及在所述请求重传的数据包之后发送的与所述请求重传的 数据包属于同一消息类型的数据包。  And sending, according to the message type to which the data packet retransmitted by the request belongs, and the packet sequence number of the data packet requested by the retransmission in the message type to which the request belongs, to the receiving end, the data packet requesting retransmission and The data packet sent after the data packet requested to be retransmitted and the request retransmitted belongs to a data packet of the same message type.
本发明一方面提供一种数据包发送装置, 包括:  An aspect of the present invention provides a data packet sending apparatus, including:
第一接收模块, 用于接收重传请求, 所述重传请求由发送端发送, 所 述重传请求包括请求重传的数据包对应的收包总序列号;  a first receiving module, configured to receive a retransmission request, where the retransmission request is sent by a sending end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission;
第一处理模块, 用于根据所述请求重传的数据包对应的收包总序列号 和本地存储的发包总序列号与每个消息类型的发包序列号之间的映射关 系, 获取所述请求重传的数据包所属的消息类型和所述请求重传的数据包 在自身所属的消息类型中的发包序列号, 所述发包总序列号为对发送的所 有消息类型的数据包进行计数得到的序列号;  a first processing module, configured to acquire the request according to a mapping relationship between a total sequence number of the packet corresponding to the retransmitted data packet and a total sequence number of the locally stored packet and a packet sequence number of each message type. The message type to which the retransmitted data packet belongs and the sequence number of the packet to be retransmitted in the message type to which the request is retransmitted, and the total sequence number of the sent packet is obtained by counting the data packets of all the message types sent. serial number;
第一发送模块, 用于根据所述请求重传的数据包所属的消息类型和所 述请求重传的数据包在自身所属的消息类型中的发包序列号, 向所述接收 端发送所述请求重传的数据包以及在所述请求重传的数据包之后发送的 与所述请求重传的数据包属于同一消息类型的数据包。  a first sending module, configured to send the request to the receiving end according to a message type to which the data packet retransmitted according to the request belongs and a sending sequence number of the data packet requested to be retransmitted in a message type to which the request belongs The retransmitted data packet and the data packet transmitted after the requesting retransmitted data packet and the data packet retransmitted by the request belong to the same message type.
本发明另一方面提供一种数据包接收方法, 包括:  Another aspect of the present invention provides a data packet receiving method, including:
接收发送端发送的第一数据包, 修改收包总序列号以获取所述第一数 据包对应的收包总序列号; 所述收包总序列号为对接收的所有消息类型的 数据包进行计数得到的序列号; 所述第一数据包包括所述第一数据包所属 的消息类型和所述第一数据包在自身所属的消息类型中的发包序列号; 当确定出所述第一数据包未发生错误时, 根据所述第一数据包所属的 消息类型获取所述第一数据包所属的消息类型的最后收包序列号, 所述第 一数据包所属的消息类型的最后收包序列号为在所述第一数据包之前最 后接收到的与所述第一数据包属于同一消息类型的数据包在自身所属的 消息类型中的发包序列号; Receiving a first data packet sent by the sending end, and modifying a total sequence number of the received packet to obtain a total sequence number of the received packet corresponding to the first data packet; the total sequence number of the receiving packet is a data packet of all message types received Counting the obtained serial number; the first data packet includes a message type to which the first data packet belongs and a delivery sequence number of the first data packet in a message type to which the first data packet belongs; Obtaining, according to the message type to which the first data packet belongs, a last received sequence number of the message type to which the first data packet belongs, where the first data packet belongs to The last received sequence number of the message type is the packet sequence number of the last received message packet of the same message type as the first packet in the message type to which the first packet belongs.
判断所述第一数据包所属的消息类型的最后收包序列号和所述第一 数据包在自身所属的消息类型中的发包序列号是否连续;  Determining whether a last received sequence number of the message type to which the first data packet belongs and a delivery sequence number in the message type to which the first data packet belongs are consecutive;
当判断结果为所述第一数据包所属的消息类型的最后收包序列号和 所述第一数据包在自身所属的消息类型中的发包序列号连续时, 将所述第 一数据包所属的消息类型的最后收包序列号更新为所述第一数据包在自 身所属的消息类型中的发包序列号。  When the result of the judgment is that the last received sequence number of the message type to which the first data packet belongs and the delivery sequence number of the first data packet in the message type to which the first data packet belongs are consecutive, the first data packet belongs to The last received sequence number of the message type is updated to the delivery sequence number of the first data packet in the message type to which the first data packet belongs.
本发明另一方面提供一种数据包接收装置, 包括:  Another aspect of the present invention provides a data packet receiving apparatus, including:
第二接收模块, 用于接收发送端发送的第一数据包, 所述第一数据包 包括所述第一数据包所属的消息类型和所述第一数据包在自身所属的消 息类型中的发包序列号;  a second receiving module, configured to receive a first data packet sent by the sending end, where the first data packet includes a message type to which the first data packet belongs and an outgoing packet of the first data packet in a message type to which the first data packet belongs serial number;
第二处理模块, 用于在所述第二接收模块接收到所述第一数据包后, 修改收包总序列号以获取所述第一数据包对应的收包总序列号, 在确定出 所述第一数据包未发生错误时, 根据所述第一数据包所属的消息类型获取 所述第一数据包所属的消息类型的最后收包序列号, 并判断所述第一数据 包所属的消息类型的最后收包序列号和所述第一数据包在自身所属的消 息类型中的发包序列号是否连续, 当判断结果为连续时, 将所述第一数据 包所属的消息类型的最后收包序列号更新为所述第一数据包在自身所属 的消息类型中的发包序列号; 所述收包总序列号为对接收的所有消息类型 的数据包进行计数得到的序列号; 所述第一数据包所属的消息类型的最后 收包序列号为在所述第一数据包之前最后接收到的与所述第一数据包属 于同一消息类型的数据包在自身所属的消息类型中的发包序列号。  a second processing module, configured to: after the second receiving module receives the first data packet, modify a total sequence number of the received packet to obtain a total sequence number of the packet corresponding to the first data packet, where When the error occurs in the first data packet, the last received packet sequence number of the message type to which the first data packet belongs is obtained according to the message type to which the first data packet belongs, and the message to which the first data packet belongs is determined. Whether the last received sequence number of the type and the initial sequence number of the first data packet in the message type to which the first data packet belongs are consecutive, and when the judgment result is continuous, the last packet of the message type to which the first data packet belongs is The serial number is updated to the sequence number of the packet in which the first data packet belongs in the message type to which the first data packet belongs; the total sequence number of the received packet is a sequence number obtained by counting the data packets of all received message types; The last received sequence number of the message type to which the data packet belongs is the last received data packet belonging to the same message type as the first data packet before the first data packet. SEQ ID NO contract itself belongs message types.
本发明一方面提供的数据包重传方法及数据包发送装置, 在接收到接 收端发送的重传请求后, 根据请求重传的数据包对应的收包从序列号以及 本地存储的发包总序列号与每个消息类型的发包序列号之间的映射关系, 获取请求重传的数据包所属的消息类型以及请求重传的数据包在所属的 消息类型中的发包序列号, 进而获取请求重传的数据包和在请求重传的数 据包之后发送的与所述请求重传的数据包属于同一消息类型的数据包, 将 获取到的请求重传的数据包以及之后发送的与请求重传的数据包属于同 一消息类型的数据包重新发送给接收端, 实现了只重传同一类型的数据 包, 而其他类型的数据包在不需要重传的时候不用重传, 与现有技术中要 将请求重传的数据包和请求重传的数据包之后发送的所有数据包都重新 发送给接收端的方案相比, 减少了重传的数据量, 降低了重传机制造成的 资源浪费。 A data packet retransmission method and a data packet transmitting apparatus provided by an aspect of the present invention, after receiving a retransmission request sent by a receiving end, according to a packet retransmission request packet corresponding to a packet sequence number and a locally stored total packet transmission sequence The mapping relationship between the number and the packet sequence number of each message type, obtain the message type to which the data packet requesting retransmission belongs, and the data packet requesting retransmission belongs to The sequence number of the packet sent in the message type, and then the data packet requesting retransmission and the data packet sent after the data packet requested to be retransmitted belong to the same message type as the data packet retransmitted by the request, and the obtained request is heavy. The transmitted data packet and the subsequent data packet belonging to the same message type as the data packet requesting retransmission are resent to the receiving end, so that only the same type of data packet is retransmitted, and other types of data packets do not need to be retransmitted. When there is no retransmission, the amount of data retransmitted is reduced compared with the prior art scheme in which the data packet requested to be retransmitted and all the data packets sent after the data packet requested to be retransmitted are resent to the receiving end. Reduce the waste of resources caused by the retransmission mechanism.
本发明另一方面提供的数据包接收方法及装置, 在接收到数据包后对 数据包进行解析, 如果能够成功解数据包, 会根据数据包中该数据包所属 的消息类型和该数据包所属的消息类型中的发包序列号确定是否丟弃该 数据包, 如果不丟弃该数据包就更新该数据包所属的消息类型的最后收包 序列号, 以便于继续接收后续数据包, 实现数据包的接收。 本发明提供的 数据包接收方法及装置与本发明提供的数据包重传方法及装置相配合, 为 发送端根据消息类型进行数据包的重传, 减少重传数据量, 降低重传造成 的资源消耗提供了条件。 附图说明  A data packet receiving method and apparatus provided by another aspect of the present invention parses a data packet after receiving a data packet, and if the data packet can be successfully solved, according to the message type of the data packet in the data packet and the data packet to which the data packet belongs The sequence number of the outgoing packet in the message type determines whether to discard the data packet, and if the data packet is not discarded, the last received sequence number of the message type to which the data packet belongs is updated, so as to continue to receive subsequent data packets, and implement the data packet. Reception. The data packet receiving method and device provided by the present invention cooperate with the data packet retransmission method and device provided by the present invention, and the transmitting end performs data packet retransmission according to the message type, reduces the amount of retransmitted data, and reduces resources caused by retransmission. Consumption provides conditions. DRAWINGS
实施例或现有技术描述中所需要使用的附图作一简单地介绍, 显而易见 地, 下面描述中的附图是本发明的一些实施例, 对于本领域普通技术人员 来讲, 在不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的 附图。 The drawings used in the embodiments or the description of the prior art are briefly described. It is obvious that the drawings in the following description are some embodiments of the present invention, and are not creative to those skilled in the art. Other drawings can also be obtained from these drawings on the premise of labor.
图 1为本发明一实施例提供的数据包重传方法的流程图;  FIG. 1 is a flowchart of a method for retransmitting a data packet according to an embodiment of the present invention;
图 2为本发明另一实施例提供的数据包重传方法的流程图; 图 3为本发明一实施例提供的数据包接收方法的流程图;  2 is a flowchart of a data packet retransmission method according to another embodiment of the present invention; FIG. 3 is a flowchart of a data packet receiving method according to an embodiment of the present invention;
图 4为本发明一实施例提供的数据包重传过程示意图;  4 is a schematic diagram of a data packet retransmission process according to an embodiment of the present invention;
图 5为本发明一实施例提供的数据包发送装置的结构示意图; 图 6 A为本发明另一实施例提供的数据包发送装置的结构示意图; 图 6B为本发明另一实施例提供的 QPI协议的链路层的结构示意图; 图 7为本发明一实施例提供的数据包接收装置的结构示意图; 图 8为本发明另一实施例提供的数据包接收装置的结构示意图。 具体实施方式 为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本 发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描 述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提 下所获得的所有其他实施例, 都属于本发明保护的范围。 FIG. 5 is a schematic structural diagram of a data packet sending apparatus according to an embodiment of the present invention; FIG. 6B is a schematic structural diagram of a data packet sending apparatus according to another embodiment of the present invention; FIG. 6B is a QPI according to another embodiment of the present invention; Schematic diagram of the link layer of the protocol; FIG. 7 is a schematic structural diagram of a data packet receiving apparatus according to an embodiment of the present invention; FIG. 8 is a schematic structural diagram of a data packet receiving apparatus according to another embodiment of the present invention. The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. The embodiments are a part of the embodiments of the invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
图 1为本发明一实施例提供的数据包重传方法的流程图。如图 1所示, 本实施例的数据包重传方法包括:  FIG. 1 is a flowchart of a method for retransmitting a data packet according to an embodiment of the present invention. As shown in FIG. 1, the data packet retransmission method in this embodiment includes:
步骤 101、 接收重传请求, 所述重传请求由发送端发送, 所述重传请 求包括请求重传的数据包对应的收包总序列号。  Step 101: Receive a retransmission request, where the retransmission request is sent by a sending end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission.
本实施例的执行主体为发送端。 发送端可以是任何具有重传机制的设 备或设备中的模块, 例如发送端可以是服务器、 路由设备等, 也可以是中 央处理单元( Central Processing Unit, CPU )中的 QPI或互联芯片中的 QPI 等。 同理, 接收端也可以是任何具有重传机制的设备或设备中的模块, 例 如接收端也可以是服务器、 路由设备等, 也可以是 CPU中的 QPI或互联 芯片中的 QPI等。  The execution body of this embodiment is a transmitting end. The sender may be any device in the device or device with a retransmission mechanism. For example, the sender may be a server, a routing device, or the like, or may be a QPI in a Central Processing Unit (CPU) or a QPI in the interconnect chip. Wait. Similarly, the receiving end may also be any device in the device or device with a retransmission mechanism, for example, the receiving end may also be a server, a routing device, etc., or may be a QPI in the CPU or a QPI in the interconnect chip.
其中, 收包总序列号是接收端对接收的所有消息类型的数据包进行计 数得到的序列号。 而请求重传的数据包对应的收包总序列号为接收端在接 收到该请求重传的数据包后计数到的收包总序列号。 举例说明, 假设接收 端在接收到请求重传的数据包之前收包总序列号为 10 ,接收到该请求重传 的数据包后收包总序列号会加 1变为 11 ,则该请求重传的数据包对应的收 包总序列号为 11。  The total sequence number of the received packet is a sequence number obtained by the receiving end to count the data packets of all received message types. The total sequence number of the packet corresponding to the data packet requesting retransmission is the total sequence number of the packet received by the receiving end after receiving the data packet retransmitted by the receiving end. For example, suppose the receiving end receives the total sequence number of the packet before receiving the retransmitted data packet, and after receiving the data packet that is retransmitted, the total sequence number of the received packet will increase by 1 to 11, and the request is heavy. The total sequence number of the received packet corresponding to the transmitted data packet is 11.
在数据传输过程中, 发送端会向接收端发送数据包, 并会对发送的所 有消息类型的数据包进行计数, 这样就会得到一个发包总序列号。 其中, 每个数据包对应的发包总序列号记录了每个被发送的数据包的发送序号。 例如, 第一个被发送的数据包对应的发包总序列号为 1 , 第二个被发送的 数据包对应的发包总序列号为 2 , 第 N个被发送的数据包对应的发包 总序列号为 N等。 在此说明, 这里所说的被发送的数据包是指第一次发送 的数据包不包括重传的数据包, 重传的数据包对应的发包总序列号也就是 该数据包在第一次发送时对应的收包总序列号。 During the data transmission process, the sender sends a packet to the receiver, and counts the packets of all message types sent, so that a total sequence number of the packet is obtained. The total sequence number of the packet sent corresponding to each data packet records the transmission sequence number of each transmitted data packet. For example, the total sequence number of the first packet sent by the first transmitted data packet is 1, and the total sequence number of the second packet sent packet is 2, and the packet sent by the Nth transmitted packet corresponds to The total serial number is N and the like. Here, the data packet to be transmitted refers to the data packet transmitted for the first time does not include the retransmitted data packet, and the total sequence number of the packet corresponding to the retransmitted data packet is the first time of the data packet. The total serial number of the corresponding receipt when sending.
对接收端来说, 会接收发送端发送的数据包, 并且会按照协议规定解 析接收到的数据包, 如果能够成功解析数据包, 则认为该数据包未发生错 误, 如果未能成功解析数据包, 则认为该数据包发生错误。 如果数据包发 生错误, 接收端就会向发送端发送重传请求。 对接收端来说, 也会对接收 到的所有消息类型的数据包进行计数, 这样就会得到一个收包总序列号。 其中, 每个数据包对应的收包总序列号记录了每个被接收的数据包的接收 序号。 例如, 第一个被接收的数据包对应的收包总序列号为 1 , 第二个被 接收的数据包对应的收包总序列号为 2 , 第 N个被接收的数据包对应 的收包总序列号为 N等。 在此说明, 这里所说的被接收的数据包是指第一 次接收的数据包不包括重传的数据包, 重传的数据包对应的收包总序列号 也就是该数据包在第一次被接收到时对应的收包总序列号。  For the receiving end, it will receive the data packet sent by the sender, and will parse the received data packet according to the protocol. If the data packet can be successfully parsed, the packet is considered to have no error. If the data packet is not successfully parsed. , then the packet is considered to be in error. If the packet is in error, the receiver sends a retransmission request to the sender. For the receiving end, the packets of all received message types are also counted, so that a total number of received packets is obtained. The total sequence number of the received packet corresponding to each data packet records the receiving sequence number of each received data packet. For example, the total received sequence number corresponding to the first received data packet is 1, and the total received serial number corresponding to the second received data packet is 2, and the received packet corresponding to the Nth received data packet is received. The total serial number is N and the like. Herein, the received data packet mentioned here means that the data packet received for the first time does not include the retransmitted data packet, and the total sequence number of the received packet corresponding to the retransmitted data packet is that the data packet is first. The total received serial number of the corresponding receipt when it is received.
对于同一数据包来说, 发送端计数的该数据包对应的发包总序列号与 接收端计数的该数据包对应的收包总序列号是相同的。 基于此, 接收端在 向发送端发送重传请求时, 可以将请求重传的数据包对应的收包总序列号 添加在重传请求中, 基于此发送端可以获知请求重传的是哪个数据包。  For the same data packet, the total sequence number of the packet corresponding to the data packet counted by the sender is the same as the total sequence number of the packet corresponding to the data packet counted by the receiver. Based on this, when the receiving end sends a retransmission request to the transmitting end, the receiving end may add the total receiving sequence number corresponding to the data packet requesting retransmission to the retransmission request, and based on the sending end, it may be known which data is requested to be retransmitted. package.
步骤 102、 根据请求重传的数据包对应的收包总序列号和本地存储的 发包总序列号与每个消息类型的发包总序列号之间的映射关系, 获取请求 重传的数据包所属的消息类型和请求重传的数据包在自身所属的消息类 型中的发包序列号。  Step 102: Acquire, according to a mapping relationship between a total sequence number of the packet corresponding to the retransmitted data packet and a total sequence number of the locally stored packet and a total sequence number of the packet sent by each message type, obtain a data packet to which the request retransmission belongs. The message type and the sequence number of the packet that is requested to be retransmitted in the message type to which it belongs.
其中, 发包总序列号是由发送端对发送的所有消息类型的数据包进行 计数得到的序列号。 每个数据包对应的发包总序列号是发送该数据包后计 数到的发包总序列号。  The total packet sequence number is a sequence number obtained by the sender to count the data packets of all message types sent. The total sequence number of the outgoing packet corresponding to each data packet is the total sequence number of the outgoing packet counted after the data packet is sent.
其中, 对每个数据包来说都有其所属的消息类型。 对于不同的协议来 说,会有不同的消息类型,且消息类型允许根据实际应用进行修改和定义。 例如, 对于传输控制协议 /因特网互联协议 ( Transmission Control  Among them, for each packet, there is a message type to which it belongs. For different protocols, there are different message types, and the message type allows modification and definition based on the actual application. For example, for Transmission Control Protocol / Internet Connection Protocol (Transmission Control)
Protocol/Internet Protocol, TCP/IP ) 协议来说, 可以根据^艮文的类型定义 两种消息类型,分别为互联网协议版本 4 ( Internet Protocol version 4 , IPv4 ) 类型和互联网协议版本 6 ( Internet Protocol version 6 , IPv6 )类型。 其中, IPv4数据包的类型属于 IPv4类型, IPv6数据包的类型属于 IPv6类型。 又 例如,对于 QPI协议主要包括六类消息类型,分别为: 监听报文(SNOOP, SNP ) , 源报文(HOME, HOM )、 请求及响应报文, 数据响应报文(Data Response, DRS ) , 非数据响应报文 ( Non Data Response, NDR ) , 非一 致性旁路报文(Non Coherence Bypass , NCB )和非一致性标准报文(Non Coherence Standard , NCS ) 。 According to the Protocol/Internet Protocol (TCP/IP) protocol, two types of messages can be defined according to the type of the protocol, which is Internet Protocol version 4 (IPv4). Type and Internet Protocol version 6 (IPv6) type. The type of the IPv4 data packet belongs to the IPv4 type, and the type of the IPv6 data packet belongs to the IPv6 type. For example, the QPI protocol mainly includes six types of message types: a listening message (SNOOP, SNP), a source message (HOME, HOM), a request and response message, and a data response message (Data Response, DRS). , Non Data Response (NDR), Non-Coherence Bypass (NCB), and Non-Coherence Standard (NCS).
在本实施例中, 发送端除了会对所有消息类型的数据包进行计数得到 发包总序列号之外, 还会对不同消息类型的数据包单独进行计数, 得到每 个消息类型的发包序列号。 而且, 发送端还会将发包总序列号和每个消息 类型的发包序列号进行映射, 将他们之间的映射关系存储在本地。 其中, 发包总序列号与每个消息类型的发包序列号之间的映射关系主要包括: 每 个被发送的数据包对应的发包总序列号、 每个被发送的数据包所属的消息 类型以及每个被发送的数据包在所属的消息类型中的发包序列号之间的 对应关系。  In this embodiment, in addition to counting the data packets of all message types to obtain the total sequence number of the packet, the sender also separately counts the data packets of different message types to obtain the packet sequence number of each message type. Moreover, the sender also maps the total packet sequence number and the packet sequence number of each message type, and stores the mapping relationship between them locally. The mapping relationship between the total sequence number of the sent packet and the sequence number of the packet sent by each message type mainly includes: a total sequence number of the packet to be sent corresponding to each transmitted data packet, a message type to which each transmitted data packet belongs, and each The correspondence between the transmitted packet and the sequence number of the packet in the associated message type.
基于此, 当发送端接收到接收端发送的重传请求后, 对重传请求进行 解析, 从重传请求中获取请求重传的数据包对应的收包总序列号。 当发送 端从接收端发送的重传请求中获取到请求重传的数据包对应的收包总序 列号后, 可以根据请求重传的数据包对应的收包总序列号和本地存储的发 包总序列号与每个消息类型的发包序列号之间的映射关系, 获取请求重传 的数据包所属的消息类型和请求重传的数据包在自身所属的消息类型中 的发包序列号。  Based on this, after receiving the retransmission request sent by the receiving end, the transmitting end parses the retransmission request, and obtains the total sequence number of the packet corresponding to the data packet requesting retransmission from the retransmission request. After the sender receives the total sequence number of the packet corresponding to the data packet requesting retransmission from the retransmission request sent by the receiving end, the total sequence number of the packet corresponding to the data packet retransmitted according to the request and the total number of locally stored packets may be The mapping relationship between the sequence number and the packet sequence number of each message type obtains the message type to which the data packet requesting retransmission belongs and the packet sequence number in the message type to which the retransmission data packet belongs.
可选的, 发送端可以以映射关系表的方式存储发包总序列号和每个消 息类型的发包序列号之间的映射关系, 但不限于此。 为便于理解, 表 1给 出一种以 3个消息类型为例显示的映射关系表。  Optionally, the sending end may store the mapping relationship between the total packet sequence number and the packet sequence number of each message type in a mapping relationship table, but is not limited thereto. For ease of understanding, Table 1 gives a mapping table showing the three message types as an example.
表 1  Table 1
Figure imgf000009_0001
num ) num ) num )
Figure imgf000009_0001
Num ) num ) num )
1 0 1 0 pktl 1 0 1 0 pktl
2 1 1 0 pktO2 1 1 0 pktO
3 1 2 0 pktl3 1 2 0 pktl
4 1 3 0 pktl4 1 3 0 pktl
5 1 3 1 pkt2 基于映射关系表, 当发送端从接收端发送的重传请求中获取到请求重 传的数据包对应的收包总序列号后, 可以将请求重传的数据包对应的收包 总序列号与映射关系表中的发包总序列号进行匹配, 将与请求重传的数据 包对应的收包总序列号相同的发包总序列号称为匹配中的发包总序列号, 并将匹配中的发包总序列号对应的消息类型以及消息类型中的发包序列 号分别作为请求重传的数据包所属的消息类型和请求重传的数据包在自 身所属的消息类型中的发包序列号。 5 1 3 1 pkt2 Based on the mapping relationship table, when the sending end obtains the total number of the received packet corresponding to the data packet requesting retransmission from the retransmission request sent by the receiving end, the data packet corresponding to the retransmission request may be received. The total sequence number of the packet matches the total sequence number of the packet in the mapping relationship table, and the total sequence number of the packet with the same total sequence number of the packet corresponding to the packet to be retransmitted is referred to as the total number of the packet in the matching, and will be matched. The message type corresponding to the total sequence number of the outgoing packet and the sequence number of the packet in the message type respectively serve as the message type to which the data packet requesting retransmission belongs and the packet sequence number in the message type to which the data packet requested to be retransmitted belongs.
以表 1为例进行说明, 假设请求重传的数据包对应的收包总序列号为 2 , 则在表 1中匹配中的发包总序列号为 2 , 该发包总序列号 2对应的消息 类型为 pktO , 对应的消息类型的发包序列号为 1 , 则请求重传的数据包所 属的消息类型为 pktO ,请求重传的数据包在消息类型 pktO中的发包序列号 为 1 , 即请求重传的数据包是消息类型 pktO中第一个被发送的数据包。  Table 1 is taken as an example for description. Suppose the total sequence number of the packet corresponding to the data packet requesting retransmission is 2, and the total sequence number of the packet in the matching in Table 1 is 2, and the message type corresponding to the total sequence number 2 of the packet is 2 For pktO, the corresponding packet type of the message type is 1, and the message type of the data packet requesting retransmission belongs to pktO, and the sequence number of the packet requesting retransmission in the message type pktO is 1, that is, requesting retransmission The packet is the first packet sent in the message type pktO.
步骤 103、 根据请求重传的数据包所属的消息类型和请求重传的数据 包在自身所属的消息类型中的发包序列号, 向接收端发送请求重传的数据 包以及在请求重传的数据包之后发送的与请求重传的数据包属于同一消 息类型的数据包。  Step 103: Send a data packet requesting retransmission and a data requesting retransmission to the receiving end according to the message type to which the data packet requested to be retransmitted belongs and the data packet sequence number of the data packet requested to be retransmitted in the message type to which the request belongs. Packets sent after the packet that are requested to be retransmitted belong to the same message type.
具体的, 当发送端获取到请求重传的数据包所属的消息类型以及请求 重传的数据包在自身所属的消息类型中的发包序列号后, 根据这些信息可 以从重传緩冲器中获取请求重传的数据包以及在请求重传的数据包之后 发送的与该请求重传的数据包属于同一消息类型的数据包, 然后将获取到 的请求重传的数据包以及在请求重传的数据包之后发送的与请求重传的 数据包属于同一消息类型的数据包重新发送给接收端。  Specifically, when the sender acquires the message type to which the data packet requesting retransmission belongs and the packet sequence number of the data packet requesting retransmission in the message type to which the request belongs, the request may be obtained from the retransmission buffer according to the information. The retransmitted data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type as the data packet retransmitted by the request, and then the retransmitted data packet of the obtained request and the data requested in the retransmission A packet that is sent after the packet and belongs to the same message type as the packet requesting retransmission is resent to the receiving end.
可选的, 本实施例的发送端可以通过设置多个重传緩冲器, 分别用来 緩存不同消息类型的数据包。 并且, 发送端会记录每个重传緩冲器与消息 类型之间的对应关系。 基于此, 发送端在获取到请求重传的数据包所属的 消息类型后, 可以根据请求重传的数据包所属的消息类型确定出请求重传 的数据包对应的重传緩冲器, 即确定出该请求重传的数据包緩存在哪个重 传緩冲器中。 然后, 发送端根据获取到的请求重传的数据包在自身所属的 消息类型中的发包序列号, 从请求重传的数据包对应的重传緩冲器中获取 请求重传的数据包以及在请求重传的数据包之后发送的与请求重传的数 据包属于同一消息类型的数据包, 即以请求重传的数据包在自身所属的消 息类型中的发包序列号为起始位置, 在请求重传的数据包所在的重传緩冲 器中获取请求重传的数据包和后面存储的数据包。 这种每个消息类型对应 一个重传緩冲器的方式, 对应关系简单, 便于发送端进行管理, 从重传緩 冲器中获取数据包的效率较高。 Optionally, the sending end of the embodiment may be configured to cache data packets of different message types by setting multiple retransmission buffers. And, the sender will record each retransmission buffer and message. The correspondence between types. Based on this, after obtaining the message type to which the data packet requesting retransmission belongs, the transmitting end may determine, according to the message type to which the data packet requested to be retransmitted, the retransmission buffer corresponding to the data packet requesting retransmission, that is, determining The retransmission buffer in which the packet for which the request is retransmitted is cached. Then, the sending end obtains the data packet requesting retransmission from the retransmission buffer corresponding to the data packet that is requested to be retransmitted according to the packet sequence number in the message type to which the transmitting packet is retransmitted according to the obtained request, and The data packet sent after the data packet requested to be retransmitted belongs to the same message type as the data packet requesting retransmission, that is, the data packet sequence requesting the retransmission in the message type to which the request belongs is the starting position, in the request The retransmission buffer in which the retransmitted data packet is located acquires the data packet requesting retransmission and the data packet stored later. Such a message type corresponds to a retransmission buffer, and the correspondence relationship is simple, which is convenient for the sender to manage, and the data packet is highly efficient from the retransmission buffer.
可选的, 本实施例的发送端还可以使用一个重传緩冲器, 并通过不同 链表分别管理不同消息类型的数据包在该重传緩冲器中的存储位置。 基于 此, 发送端在获取到请求重传的数据包所属的消息类型后可以先确定请求 重传的数据包对应的链表; 然后根据请求重传的数据包在自身所属的消息 类型中的发包序列号在确定出的链表中进行查找, 获取请求重传的数据包 以及在请求重传的数据包之后发送的与请求重传的数据包属于同一消息 类型的数据包分别在重传緩冲器中的存储位置, 然后根据获取的存储位置 到重传緩冲器中分别获取请求重传的数据包和在请求重传的数据包之后 发送的与请求重传的数据包属于同一消息类型的数据包。 这种所有消息类 型对应同一重传緩冲器而通过不同链表对不同消息类型的数据包在重传 緩冲器中的存储位置进行管理的方式, 需要的重传緩冲器的个数较少, 有 利于节约发送端的资源。  Optionally, the transmitting end of the embodiment may further use a retransmission buffer, and separately manage storage locations of data packets of different message types in the retransmission buffer through different linked lists. Based on this, after obtaining the message type to which the data packet requesting retransmission belongs, the sender may first determine the linked list corresponding to the data packet requesting retransmission; and then send the packet sequence according to the message type to which the request is retransmitted according to the message type to which the request belongs. The number is searched in the determined linked list, and the data packet requesting retransmission and the data packet sent after requesting the retransmitted data packet belonging to the same message type as the data packet requesting retransmission are respectively in the retransmission buffer. a storage location, and then respectively obtaining a data packet requesting retransmission according to the obtained storage location into the retransmission buffer and a data packet corresponding to the data packet requested to be retransmitted and sent after the data packet requested to be retransmitted belongs to the same message type . The manner in which all message types correspond to the same retransmission buffer and the storage locations of data packets of different message types in the retransmission buffer are managed by different linked lists, the number of retransmission buffers required is small. , help to save resources on the sender.
其中, 发送端在重新发送之前已经发送过的数据包 (即重传数据包) 时, 将停止使用发包总序列号对重传的数据包进行计数, 即发包总序列号 不会随着数据包的重传而递增。  Wherein, when the transmitting end retransmits the data packet that has been sent before resending (that is, retransmitting the data packet), the total number of the retransmitted data packet is stopped using the total sequence number of the outgoing packet, that is, the total sequence number of the sent packet does not follow the data packet. The retransmission is incremented.
在此说明, 为了标识后续发送的数据包为重传的数据包, 发送端在向 接收端发送重传的数据包之前, 会向接收端发送重传响应, 以告知接收端 后面发送的数据包为重传的数据包。 对于接收端来说, 在接收到发送端发 送的重传响应后, 会接收发送端发送的重传的数据包。 具体来说, 发送端 会先向接收端发送重传响应, 然后向接收端发送请求重传的数据包和在请 求重传的数据包之后发送的与请求重传的数据包属于同一消息类型的数 据包。 Herein, in order to identify that the subsequently transmitted data packet is a retransmitted data packet, before sending the retransmitted data packet to the receiving end, the transmitting end sends a retransmission response to the receiving end to notify the receiving end of the data packet sent later. A packet for retransmission. For the receiving end, after receiving the retransmission response sent by the sending end, it receives the retransmitted data packet sent by the sending end. Specifically, the sender The retransmission response is sent to the receiving end first, and then the data packet requesting retransmission is sent to the receiving end and the data packet sent after the data packet requesting retransmission belongs to the same message type as the data packet requesting retransmission.
其中, 发送端向接收端发送重传响应的时机只要是在接收到重传请求 之后, 向接收端发送请求重传的数据包和在请求重传的数据包之后发送的 与请求重传的数据包属于同一消息类型的数据包之前均可以。  The sending end sends a retransmission response to the receiving end, and after receiving the retransmission request, sending the data packet requesting retransmission to the receiving end and the data sent after requesting the retransmitted data packet and requesting retransmission. A packet can be used before it belongs to the same message type.
可选的, 发送端可以在接收到重传请求之后, 获取请求重传的数据包 所属的消息类型和请求重传的数据包在自身所属的消息类型中的发包序 列号之前, 向接收端发送重传响应。  Optionally, after receiving the retransmission request, the sending end may obtain the message type to which the data packet requesting retransmission belongs and the data packet requesting retransmission before sending the sequence number of the packet in the message type to which it belongs, and send the packet to the receiving end. Retransmit the response.
可选的, 发送端可以在获取请求重传的数据包所属的消息类型和请求 重传的数据包在自身所属的消息类型中的发包序列号之后, 根据请求重传 的数据包所属的消息类型确定请求重传的数据包对应的重传緩冲器之前, 向接收端发送重传响应。  Optionally, the sender may obtain the message type to which the data packet to which the request is retransmitted belongs and the type of the message to which the retransmitted data packet belongs in the message type to which the request belongs, according to the message type to which the retransmitted data packet belongs. Before determining the retransmission buffer corresponding to the data packet requesting retransmission, the retransmission response is sent to the receiving end.
可选的, 发送端可以在从请求重传的数据包对应的重传緩冲器中获取 请求重传的数据包和在请求重传的数据包之后发送的与请求重传的数据 包属于同一消息类型的数据包之后, 并在发送请求重传的数据包和在请求 重传的数据包之后发送的与请求重传的数据包属于同一消息类型的数据 包之前, 向接收端发送重传响应。  Optionally, the sender may obtain the data packet requesting retransmission from the retransmission buffer corresponding to the data packet requested to be retransmitted, and the data packet sent after requesting the retransmitted data packet is the same as the data packet requesting retransmission. After the data packet of the message type, and after transmitting the data packet requesting retransmission and the data packet sent after the data packet requesting retransmission belongs to the same message type, the retransmission response is sent to the receiving end. .
在本实施例中, 发送端在接收到接收端发送的重传请求之后, 根据接 收端请求重传的数据包对应的收包总序列号和本地存储的发包总序列号 和每个消息类型的发包序列号之间的对应关系, 找到请求重传的数据包所 属的消息类型和请求重传的数据包所属的消息类型中的发包序列号, 进而 根据这些信息从重传緩冲器中获取请求重传的数据包和在请求重传的数 据包之后发送的与请求重传的数据包属于同一消息类型的数据包, 然后将 获取的这些数据包重新发送给接收端。 本实施例的数据包重传方法在数据 包重传过程中实现了只重传同一类型的数据包, 而在请求重传的数据包之 后发送的其他类型的数据包在不需要重传的时候不用重传, 与现有技术中 要将请求重传的数据包和请求重传的数据包之后发送的所有数据包都重 新发送给接收端的方案相比, 减少了重传的数据量, 降低了重传机制造成 的资源浪费。 图 2为本发明另一实施例提供的数据包重传方法的流程图。 本实施例 基于图 1所示实施例实现。 如图 2所示, 本实施例的方法在步骤 103之前 包括: In this embodiment, after receiving the retransmission request sent by the receiving end, the sending end receives the total sequence number of the packet corresponding to the data packet retransmitted by the receiving end, and the total sequence number of the locally stored packet and the type of each message type. Corresponding relationship between the sequence numbers of the packets, finding the message type to which the data packet requesting retransmission belongs and the packet sequence number in the message type to which the data packet requesting retransmission belongs, and then obtaining the request weight from the retransmission buffer according to the information The transmitted data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type, and then the obtained data packets are resent to the receiving end. The data packet retransmission method of this embodiment implements only retransmission of the same type of data packet in the process of data packet retransmission, and other types of data packets sent after requesting the retransmitted data packet do not need to be retransmitted. Without retransmission, the amount of retransmitted data is reduced, and the amount of data retransmitted is reduced compared with the solution in the prior art that the data packet requested to be retransmitted and all data packets sent after the data packet requested to be retransmitted are resent to the receiving end. Waste of resources caused by the retransmission mechanism. FIG. 2 is a flowchart of a method for retransmitting a data packet according to another embodiment of the present invention. This embodiment is implemented based on the embodiment shown in FIG. 1. As shown in FIG. 2, the method of this embodiment includes before step 103:
步骤 103a、判断请求重传的数据包所属的消息类型和前一个重传请求 请求重传的数据包所属的消息类型是否相同; 如果判断结果为否, 即不相 同, 则执行步骤 103 ; 反之, 执行步骤 104。  Step 103a: Determine whether the message type to which the data packet requesting retransmission belongs is the same as the message type to which the data packet requested by the previous retransmission request is retransmitted; if the result of the determination is no, that is, the step is not the same, step 103 is performed; Go to step 104.
步骤 104、 将重传请求丟弃。  Step 104: Discard the retransmission request.
在本实施例中, 主要考虑一种特殊情况, 即接收端连续接收到属于同 一消息类型的两个或以上发生错误的数据包的情况。 对于接收端来说, 如 果数据包发生错误, 就无法从数据包中获知该数据包所属的消息类型, 也 就无法区分该数据包与其他数据包是否属于同一消息类型。 由于无法区分 发生错误的数据包属于哪个消息类型, 所以对接收端来说只要接收到发生 错误的数据包就向发送端发送重传请求。 这样对于上述特殊情况, 发送端 会连续接收到两个重传请求, 而发送端根据后一个重传请求向接收端重传 的数据包就会是根据前一个重传请求向接收端重传的数据包的子集, 即有 部分数据包会被重复发送; 而对于接收端来说, 在接收到数据包后如果又 接收到该数据包, 就会将该数据包丟弃, 由此可见这种特殊情况也会造成 浪费资源。  In the present embodiment, a special case is considered mainly, that is, the case where the receiving end continuously receives two or more packets having errors belonging to the same message type. For the receiving end, if the packet has an error, the packet type to which the packet belongs cannot be known from the packet, and it is impossible to distinguish whether the packet belongs to the same message type as other packets. Since it is impossible to distinguish which message type the packet in which the error belongs, the receiving end sends a retransmission request to the transmitting end as long as it receives the packet in which the error occurred. Thus, for the above special case, the sender continuously receives two retransmission requests, and the data packet retransmitted by the sender to the receiver according to the latter retransmission request is retransmitted to the receiver according to the previous retransmission request. A subset of the data packet, that is, some data packets are repeatedly sent; and for the receiving end, if the data packet is received after receiving the data packet, the data packet is discarded, which shows that A special situation can also result in wasted resources.
为此, 本实施例的发送端在接收到重传请求并根据其中请求重传的数 据包对应的收包总序列号和本地存储的发包总序列号和每个消息类型的 发包序列号之间的映射关系获取请求重传的数据包所属的消息类型后, 可 以将该请求重传的数据包所属的消息类型与上一个重传请求请求重传的 数据包所属的消息类型进行比较, 判断两者是否相同。 当判断结果为不相 同时, 可以排除上述提到的特殊情况, 则可以执行步骤 103 , 即根据请求 重传的数据包所属的消息类型和请求重传的数据包在自身所属的消息类 型中的发包序列号, 向接收端重新发送请求重传的数据包和在请求重传的 数据包之后发送的与请求重传的数据包属于同一消息类型的数据包。 当判 断结果为相同时, 说明该重传请求与上一个重传请求请求重传的数据包属 于同一消息类型, 属于上述提到的特殊情况, 由于发送端已经根据上一个 重传请求将所述上一个重传请求请求重传的数据包以及在该数据包之后 发送的与该数据包属于同一消息类型的数据包重新发送给了接收端, 因 此, 为了减少资源浪费,发送端可以将该重传请求丟弃, 不进行重传处理。 To this end, the transmitting end of the embodiment receives the retransmission request and according to the total sequence number of the packet corresponding to the data packet in which the retransmission is requested, and the total sequence number of the packet stored locally and the packet sequence number of each message type. After obtaining the message type to which the data packet requested to be retransmitted belongs, the mapping type of the data packet to which the request is retransmitted may be compared with the message type to which the data packet retransmitted by the previous retransmission request request belongs, and two Are they the same? When the judgment result is different, the special case mentioned above may be excluded, and step 103 may be performed, that is, the message type to which the data packet retransmitted according to the request belongs and the data packet requested to be retransmitted are in the message type to which the message belongs. Sending a sequence number, resending the data packet requesting retransmission to the receiving end and the data packet sent after the data packet requesting retransmission belongs to the same message type as the data packet requesting retransmission. When the judgment result is the same, it indicates that the retransmission request belongs to the same message type as the data packet retransmitted by the previous retransmission request, and belongs to the special case mentioned above, because the sender has already described the message according to the previous retransmission request. The last retransmission request requesting the retransmitted data packet and after the data packet The transmitted data packet that belongs to the same message type as the data packet is resent to the receiving end. Therefore, in order to reduce resource waste, the transmitting end may discard the retransmission request without performing retransmission processing.
在本实施例中, 发送端通过将当前请求重传的数据包所属的消息类型 与上一个重传请求请求重传的数据包所属的消息类型进行比较, 判断前后 两个重传请求是否请求重传同一消息类型的连续发生错误的数据包, 在判 断结果为是的情况可以丟弃当前重传请求不进行重传处理, 有利于减少数 据重传造成的资源浪费。  In this embodiment, the sender compares the message type to which the data packet retransmitted by the current request belongs with the message type to which the data packet retransmitted by the previous retransmission request request belongs, and determines whether the two previous retransmission requests are heavy. A packet with the same error of the same message type can be discarded. If the result of the determination is yes, the current retransmission request can be discarded without retransmission processing, which is beneficial to reduce resource waste caused by data retransmission.
在上述各实施例中, 发送端在接收接收端发送的重传请求之前, 还会 向接收端发送第一数据包。 其中, 第一数据包是发送端首次向接收端发送 的数据包。 这里使用第一数据包的目的是为了与重传的数据包或请求重传 的数据包进行区分。 在上述各实施例中, 发送端向接收端发送第一数据包 的过程可以是:发送端向接收端发送第一数据包,将第一数据包进行緩存, 并根据第一数据包所属的消息类型更新发包总序列号与每个消息类型的 发包序列号之间的映射关系。 其中, 发送端发送的第一数据包中包括该数 据包所属的消息类型和该第一数据包在自身所属的消息类型中的发包序 列号。 可选的, 第一数据包所属的消息类型可以通过第一数据包中的一个 标识或标志位实现。  In the above embodiments, the transmitting end sends the first data packet to the receiving end before receiving the retransmission request sent by the receiving end. The first data packet is a data packet sent by the sending end to the receiving end for the first time. The purpose of using the first data packet here is to distinguish it from the retransmitted data packet or the data packet requesting retransmission. In the foregoing embodiments, the sending, by the sending end, the first data packet to the receiving end may be: the sending end sends the first data packet to the receiving end, buffers the first data packet, and according to the message that the first data packet belongs to. The type updates the mapping relationship between the total sequence number of the outgoing packet and the outgoing sequence number of each message type. The first data packet sent by the sending end includes the message type to which the data packet belongs and the sending sequence number of the first data packet in the message type to which the first data packet belongs. Optionally, the message type to which the first data packet belongs may be implemented by an identifier or a flag bit in the first data packet.
其中, 更新发包总序列号与每个消息类型的发包序列号之间的映射关 系主要是在该映射关系中新增发包总序列号、 该第一数据包在所属的消息 类型中的发包序列号以及该第一数据包所属的消息类型之间的一条对应 关系。 在表 1的基础上, 在新发送一个消息类型为 pktO的数据包之后, 新 的映射关系表将如表 2所示。  The mapping relationship between the total number of the updated packet and the sequence number of the packet of each message type is mainly added to the total number of the packet to be sent in the mapping relationship, and the sequence number of the packet in the message type to which the first packet belongs. And a correspondence between the message types to which the first data packet belongs. On the basis of Table 1, after a new packet with the message type pktO is sent, the new mapping table will be as shown in Table 2.
表 2  Table 2
Figure imgf000014_0001
3 1 2 0 pktl
Figure imgf000014_0001
3 1 2 0 pktl
4 1 3 0 pktl4 1 3 0 pktl
5 1 3 1 pkt25 1 3 1 pkt2
6 2 3 1 pktO 由上述可见, 对于发包总序列号是连续计数的, 而对于每个消息类型 的发包序列号也是连续计数的。 6 2 3 1 pktO As can be seen from the above, the total sequence number for the outgoing packet is continuously counted, and the serial number of the packet for each message type is also continuously counted.
其中, 如果发送端使用多个重传緩冲器分别緩存不同消息类型的数据 包,则发送端发送第一数据包之后,将第一数据包进行緩存的过程可以是: 根据第一数据包所属的消息类型, 将第一数据包緩存到该第一数据包对应 的重传緩冲器中。  If the sending end uses multiple retransmission buffers to respectively buffer data packets of different message types, after the transmitting end sends the first data packet, the process of buffering the first data packet may be: according to the first data packet The message type caches the first data packet into a retransmission buffer corresponding to the first data packet.
如果发送端使用一个重传緩冲器同时緩存所有消息类型的数据包并 通过不同链表对不同消息类型的数据包的存储位置进行管理, 则发送端发 送第一数据包之后, 将第一数据包进行緩存的过程可以是: 将第一数据包 緩存到重传緩冲器中, 并根据第一数据包所属的消息类型将第一数据包在 重传緩冲器中的存储位置记录到该消息类型对应的链表中。  If the sender uses a retransmission buffer to simultaneously buffer data packets of all message types and manage the storage locations of data packets of different message types through different linked lists, after the sender sends the first data packet, the first data packet is sent. The process of performing caching may be: buffering the first data packet into the retransmission buffer, and recording the storage location of the first data packet in the retransmission buffer to the message according to the message type to which the first data packet belongs. The type corresponds to the linked list.
可选的, 发送端可以使用计数器对每个消息类型的发包序列号和总发 包序列号进行计数。 当计数器计数到最大值后, 可以从 0开始重新进行计 数, 即可以循环计数。  Optionally, the sender can use a counter to count the packet sequence number and the total packet sequence number of each message type. When the counter has reached the maximum value, it can be re-counted from 0, that is, it can be cycled.
在上述实施方式中, 发送端在发送数据包时将数据包按照所属的消息 类型进行区分, 同时记录发包总序列号和每个消息类型的发包序列号之间 的映射关系, 为在接收到重传请求后, 仅重传请求重传的数据包以及在请 求重传的数据包之后发送的与请求重传的数据包属于同一消息类型的数 据包而不用重传其他消息类型的数据包打下了基础, 有利于减少重传的数 据量, 减少了重传机制造成的资源浪费, 提高了系统的带宽利用率。  In the foregoing implementation manner, the transmitting end distinguishes the data packet according to the type of the message when the data packet is sent, and records the mapping relationship between the total sequence number of the sent packet and the packet sequence number of each message type, so as to receive the heavy After the request is transmitted, only the data packet requesting retransmission and the data packet sent after the requesting retransmission of the data packet requesting retransmission belong to the same message type are not retransmitted to the data packet of other message types. The foundation is beneficial to reduce the amount of data retransmitted, reduce the waste of resources caused by the retransmission mechanism, and improve the bandwidth utilization of the system.
图 3为本发明一实施例提供的数据包接收方法的流程图。如图 3所示, 本实施例的数据包接收方法包括:  FIG. 3 is a flowchart of a data packet receiving method according to an embodiment of the present invention. As shown in FIG. 3, the data packet receiving method in this embodiment includes:
步骤 301、 接收发送端发送的第一数据包, 修改收包总序列号以获取 第一数据包对应的收包总序列号。  Step 301: Receive a first data packet sent by the sending end, and modify a total sequence number of the received packet to obtain a total sequence number of the received packet corresponding to the first data packet.
在本实施例中第一数据包也是指发送端首次发送的数据包, 用于区分 请求重传的数据包或重传的数据包, 而并不限定为某个特定的数据包。 也 就是说, 这里的第一数据包与前面实施例中的第一数据包并不一定是同一 个数据包。 In this embodiment, the first data packet is also a data packet that is sent by the sending end for the first time, and is used to distinguish the data packet requesting retransmission or the data packet to be retransmitted, and is not limited to a specific data packet. and also That is to say, the first data packet here is not necessarily the same data packet as the first data packet in the previous embodiment.
本实施例的执行主体为接收端。 接收端可以是任何具有重传机制的设 备或设备中的模块, 例如接收端可以是服务器、 路由设备等, 还可以是 CPU中的 QPI或互联芯片中的 QPI等。 相应的, 发送端也可以是任何具 有重传机制的设备或设备中的模块, 例如发送端可以是服务器、 路由设备 等, 还可以是 CPU中的 QPI或互联芯片中的 QPI等。  The execution body of this embodiment is a receiving end. The receiving end can be any device with a retransmission mechanism or a module in the device. For example, the receiving end can be a server, a routing device, etc., and can also be a QPI in the CPU or a QPI in the interconnect chip. Correspondingly, the sending end may also be any device in the device or device with a retransmission mechanism, for example, the sending end may be a server, a routing device, etc., or may be a QPI in the CPU or a QPI in the interconnect chip.
其中, 收包总序列号为对接收的所有消息类型的数据包进行计数得到 的序列号; 第一数据包对应的收包总序列号为接收到第一数据包后计数得 到的收包总序列号。 例如, 假设接收第一数据包之前收包总序列号为 5 , 则接收第一数据包之后收包总序列号变为 6 , 则第一数据包对应的收包总 序列号为 6。 其中, 收包总序列号会随着数据包的接收而发生变化, 而某 个数据包对应的收包总序列号是固定的。  The total sequence number of the received packet is a sequence number obtained by counting the data packets of all received message types; the total sequence number of the received packet corresponding to the first data packet is the total sequence of the received packets after receiving the first data packet. number. For example, if the total sequence number of the received packet is 5 before the first data packet is received, the total sequence number of the received packet becomes 6 after receiving the first data packet, and the total sequence number of the received packet corresponding to the first data packet is 6. The total sequence number of the received packet changes with the receipt of the data packet, and the total sequence number of the received packet corresponding to a certain data packet is fixed.
其中, 接收到的第一数据包包括该数据包所属的消息类型和第一数据 包在自身所属的消息类型中的发包序列号。 在本实施例中, 发送端除了会 对所有消息类型的数据包进行计数之外, 还会按照的数据包所属的消息类 型分别对各消息类型的数据包进行计数。 消息类型的发包序列号就是由发 送端对发送的属于该消息类型的数据包进行计数得到的序列号。 而数据包 在自身所属的消息类型中的发包序列号是发送该数据包之后计数到的该 数据包所属的消息类型的发包序列号。 例如, 假设发送该数据包之前, 该 数据包所属的消息类型的发包序列号为 2 , 则发送该数据包之后该数据包 所属的消息类型的发包序列号为 3 , 则该数据包在自身所属的消息类型中 的发包序列号为 3。 即第一数据包在自身所属的消息类型中的发包序列号 是发送第一数据包之后计数到的第一数据包所属的消息类型的发包序列 号。  The received first data packet includes a message type to which the data packet belongs and a transmission sequence number of the first data packet in a message type to which the first data packet belongs. In this embodiment, in addition to counting the data packets of all message types, the transmitting end also counts the data packets of each message type according to the message type to which the data packet belongs. The message sequence number of the message type is the sequence number obtained by the sender to count the packets belonging to the message type. The packet sequence number in the message type to which the packet belongs is the packet sequence number of the message type to which the packet belongs after the packet is sent. For example, suppose that before the data packet is sent, the packet sequence number of the message type to which the data packet belongs is 2, and after the data packet is sent, the packet sequence number of the message type to which the data packet belongs is 3, and the data packet belongs to itself. The delivery sequence number in the message type is 3. That is, the packet sequence number of the first packet in the message type to which it belongs is the packet sequence number of the message type to which the first packet counted after the first packet is transmitted.
在本实施例中, 接收端接收发送端发送的第一数据包, 并会使用收包 总序列号对接收到的第一数据包进行计数。 即每接收到一个第一数据包, 接收端就会修改收包总序列号, 更为具体的是将收包总序列号加 1。 在本 实施例中, 接收端在修改收包总序列号的同时可以获取接收到的第一数据 包对应的收包总序列号。 在此说明, 接收端使用收包总序列号进行计数的数据包是指第一次接 收到的数据包而不包括重传的数据包, 重传的数据包对应的收包总序列号 也就是该数据包被第一次接收时对应的收包总序列号。 In this embodiment, the receiving end receives the first data packet sent by the sending end, and uses the total receiving sequence number to count the received first data packet. That is, each time a first data packet is received, the receiving end modifies the total sequence number of the received packet, and more specifically increases the total sequence number of the received packet by one. In this embodiment, the receiving end may acquire the total number of the received packet corresponding to the received first data packet while modifying the total sequence number of the received packet. Herein, the data packet that the receiving end uses to count the total sequence number of the received packet refers to the first received data packet and does not include the retransmitted data packet, and the total sequence number of the received packet corresponding to the retransmitted data packet is The total sequence number of the corresponding packet received when the packet is received for the first time.
步骤 302、 当确定出接收到的第一数据包未发生错误时, 根据第一数 据包所属的消息类型获取第一数据包所属的消息类型的最后收包序列号。  Step 302: When it is determined that the received first data packet does not have an error, obtain a last received sequence number of the message type to which the first data packet belongs according to the message type to which the first data packet belongs.
在本实施例中, 接收端接收到第一数据包之后, 会对第一数据包进行 解析。 如果能够成功解析第一数据包, 说明第一数据包未发生错误; 如果 不能成功解析第一数据包说明第一数据包发生了错误。  In this embodiment, after receiving the first data packet, the receiving end parses the first data packet. If the first packet can be successfully parsed, the first packet has no error; if the first packet cannot be successfully parsed, the first packet has an error.
当确定第一数据包未发生错误时, 接收端可以从第一数据包中获取到 第一数据包所属的消息类型以及第一数据包在自身所属的消息类型中的 发包序列号。 然后, 接收端会根据第一数据包所属的消息类型在本地记录 的各消息类型的最后收包序列号中获取第一数据包所属的消息类型的最 后收包序列号。 其中, 数据包所属的消息类型的最后收包序列号为在第一 数据包之前最后接收到的与第一数据包属于同一消息类型的数据包在自 身所属的消息类型中的发包序列号。  When it is determined that the first data packet does not have an error, the receiving end may obtain, from the first data packet, the message type to which the first data packet belongs and the delivery sequence number of the first data packet in the message type to which the first data packet belongs. Then, the receiving end obtains the last receiving sequence number of the message type to which the first data packet belongs according to the last received packet sequence number of each message type recorded locally according to the message type to which the first data packet belongs. The last received sequence number of the message type to which the data packet belongs is the packet sequence number of the last received message packet of the same message type as the first data packet in the message type to which the first data packet belongs.
在本实施例中, 接收端可以按照消息类型分别緩存接收到的数据包, 也可以将所有消息类型的数据包进行统一緩存。 但是, 在本实施例中, 对 于每个消息类型来说, 接收端会记录最后接收到的数据包在其所属的消息 类型中的发包序列号, 以便于判断每个消息类型的数据包是否按序接收。  In this embodiment, the receiving end may separately buffer the received data packets according to the message type, or may uniformly cache the data packets of all message types. However, in this embodiment, for each message type, the receiving end records the sequence number of the last received data packet in the message type to which it belongs, so as to determine whether the data packet of each message type is pressed. Order reception.
步骤 303、 判断第一数据包所属的消息类型的最后收包序列号和第一 数据包在自身所属的消息类型中的发包序列号是否连续; 当判断结果为 是, 即连续时, 执行步骤 304; 当判断结果为否, 即不连续时, 执行步骤 305。  Step 303: Determine whether the last received sequence number of the message type to which the first data packet belongs and the delivery sequence number of the first data packet in the message type to which the first data packet belongs are consecutive; when the determination result is yes, that is, continuous, step 304 is performed. When the judgment result is no, that is, discontinuous, step 305 is performed.
具体的, 接收端将接收到的第一数据包在自身所属的消息类型中的发 包序列号和第一数据包所属的消息类型的最后收包序列号进行比较, 可以 判断两者是否连续。  Specifically, the receiving end compares the received first data packet with the last received packet sequence number of the message type to which the first data packet belongs, and can determine whether the two are consecutive.
步骤 304、 将第一数据包所属的消息类型的最后收包序列号更新为第 一数据包在自身所属的消息类型中的发包序列号。  Step 304: Update the last received sequence number of the message type to which the first data packet belongs to the delivery sequence number of the first data packet in the message type to which the first data packet belongs.
当判断结果为第一数据包所属的消息类型的最后收包序列号和第一 数据包在自身所属的消息类型中的发包序列号连续时, 说明第一数据包所 属的消息类型的数据包没有发生错误, 则第一数据包将是当前最后接收到 的数据包, 故接收端将第一数据包所属的消息类型的最后收包序列号更新 为第一数据包在自身所属的消息类型中的发包序列号, 以便于继续接收同 一消息类型的数据包。 When the result of the judgment is that the last received sequence number of the message type to which the first data packet belongs and the initial sequence number of the first data packet in the message type to which the first data packet belongs, the first data packet is described. If there is no error in the packet of the message type of the genus, the first packet will be the last received packet, so the receiving end updates the last packet sequence number of the message type to which the first packet belongs to the first packet. The sequence number of the packet in the message type to which it belongs, in order to continue to receive packets of the same message type.
步骤 305、 将第一数据包在自身所属的消息类型中的发包序列号作为 重传序列号门限记录下来, 将第一数据包丟弃。  Step 305: Record the sequence number of the first packet in the message type to which the packet belongs, as the retransmission sequence number threshold, and discard the first packet.
当判断结果为第一数据包所属的消息类型的最后收包序列号和第一 数据包在自身所属的消息类型中的发包序列号不连续时, 说明第一数据包 之前与第一数据包属于同一消息类型的数据包发生了错误, 并且接收端已 经向发送端发送过重传请求, 第一数据包属于接收端请求重传的数据包之 后发送的与请求重传的数据包属于同一消息类型的数据包, 因此, 发送端 会重传第一数据包, 故接收端在判断出不连续的结果后, 将第一数据包丟 弃。 同时, 接收端会将第一数据包在自身所属的消息类型中的发包序列号 记录下来, 作为重传序列号门限。 该重传序列号门限用于供接收端从发送 端发送的数据包中区分出哪些是重传的数据包。  When the result of the judgment is that the last received sequence number of the message type to which the first data packet belongs and the initial sequence number of the first data packet in the message type to which the first data packet belongs are discontinuous, it indicates that the first data packet belongs to the first data packet before The packet of the same message type has an error, and the receiving end has sent a retransmission request to the transmitting end. The first data packet belongs to the same message type that is sent after the data packet requested by the receiving end to be retransmitted and sent by the requesting retransmission. Therefore, the transmitting end retransmits the first data packet, so the receiving end discards the first data packet after determining the discontinuous result. At the same time, the receiving end records the sequence number of the first packet in the message type to which it belongs, as the retransmission sequence number threshold. The retransmission sequence number threshold is used for distinguishing, among the data packets sent by the receiving end, which packets are retransmitted.
在本实施例中, 接收端接收到数据包后对数据包进行解析, 如果能够 成功解数据包, 会根据数据包中该数据包所属的消息类型和该数据包所属 的消息类型中的发包序列号确定是否丟弃该数据包, 如果不丟弃该数据包 就更新该数据包所属的消息类型的最后收包序列号, 以便于继续接收后续 数据包, 如果丟弃该数据包就相应记录该数据包在所属的消息类型中的发 包序列号, 以便于从发送端发送的数据包中区分出重传的数据包, 实现数 据包的接收。 本实施例提供的数据包接收方法与前述实施例提供的发送端 发送数据包的方法相配合, 为发送端根据消息类型进行数据包的重传, 减 少重传数据量, 降低重传造成的资源消耗提供了条件。  In this embodiment, the receiving end parses the data packet after receiving the data packet, and if the data packet can be successfully solved, according to the message type of the data packet in the data packet and the packet sending sequence in the message type to which the data packet belongs. The number is determined whether to discard the data packet, and if the data packet is not discarded, the last received sequence number of the message type to which the data packet belongs is updated, so as to continue to receive subsequent data packets, and if the data packet is discarded, the corresponding data packet is recorded. The packet sequence number of the packet in the associated message type, so as to distinguish the retransmitted data packet from the data packet sent by the sender, and realize the reception of the data packet. The data packet receiving method provided in this embodiment is matched with the method for sending a data packet by the sending end provided by the foregoing embodiment, and the transmitting end performs data packet retransmission according to the message type, reduces the amount of retransmitted data, and reduces resources caused by retransmission. Consumption provides conditions.
进一步, 如果判断出接收到的第一数据包所属的消息类型的最后收包 序列号和第一数据包在自身所属的消息类型中的发包序列号不连续, 说明 第一数据包之前同一消息类型的数据包发生了错误, 故在接收端接收到第 一数据包之前, 接收端会因接收到发生错误的数据包而向发送端发送重传 请求, 该重传请求中包括请求重传的数据包对应的收包总序列号。 为了便 于区分, 将这里描述的重传请求称为第一重传请求。 其中, 第一重传请求 请求重传的数据包为在第一数据包之前接收到的与第一数据包属于同一 消息类型且发生错误的数据包。 Further, if it is determined that the last received sequence number of the message type to which the received first data packet belongs and the initial sequence number of the first data packet in the message type to which the first data packet belongs are not consecutive, the same message type before the first data packet is indicated. The data packet has an error, so before the receiving end receives the first data packet, the receiving end sends a retransmission request to the transmitting end by receiving the data packet in which the error occurred, and the retransmission request includes the data requesting retransmission. The total serial number of the packet corresponding to the packet. For ease of differentiation, the retransmission request described herein is referred to as a first retransmission request. Wherein, the first retransmission request The data packet requested for retransmission is a data packet received before the first data packet that belongs to the same message type as the first data packet and an error occurs.
基于上述, 接收端在接收到第一数据包后还会接收发送端发送的第一 重传响应, 并会根据发送第一重传请求之前记录的重传序列号门限接收发 送端在发送第一重传响应后发送的重传数据包。 对于重传数据包, 接收端 不会使用收包总序列号对其进行计数, 即接收到重传数据包时, 接收端不 会更新收包总序列号。 其中, 第一重传响应是与第一重传请求对应的重传 响应。 这里描述的重传数据包包括第一重传请求请求重传的数据包、 以及 第一数据包和在请求重传的数据包和第一数据包之间发送的与第一数据 包属于同一消息类型的数据包。  Based on the foregoing, the receiving end receives the first retransmission response sent by the sending end after receiving the first data packet, and sends the first sending end according to the retransmission sequence number threshold recorded before the first retransmission request is sent. Retransmit the packet sent after the response is retransmitted. For retransmitted data packets, the receiving end does not count the total number of received packets, that is, when the retransmitted data packet is received, the receiving end does not update the total receiving sequence number. The first retransmission response is a retransmission response corresponding to the first retransmission request. The retransmission data packet described herein includes a data packet for which the first retransmission request is requested to be retransmitted, and the first data packet and the first data packet transmitted between the data packet requesting retransmission and the first data packet are the same message. Type of packet.
其中, 接收端根据发送第一重传请求之前的重传序列号门限接收发送 端在发送第一重传响应之后发送的重传数据包的过程包括: 接收端接收发 送端在发送第一重传响应后发送的数据包; 发送端在发送第一重传响应后 发送的数据包也会包括自身所属的消息类型和在自身所属的消息类型中 的发包序列号。 然后, 接收端将发送端在发送第一重传响应后发送的数据 包在自身所属的消息类型中的发包序列号与发送第一重传请求之前的重 传序列号门限进行比较。 如果发送端在发送第一重传响应后发送的数据包 在自身所属的消息类型中的发包序列号小于或等于发送第一重传请求之 前的重传序列号门限, 说明该数据包为重传数据包, 故接收端将该数据包 作为重传数据包。 此时, 接收端接收到重传数据包后不会更新收包总序列 号。  The receiving end receives, according to the retransmission sequence number threshold before sending the first retransmission request, the retransmission data packet sent by the transmitting end after sending the first retransmission response, where the receiving end receives the transmitting end and sends the first retransmission. The data packet sent after the response; the data packet sent by the sender after sending the first retransmission response will also include the message type to which it belongs and the packet sequence number in the message type to which it belongs. Then, the receiving end compares the sending sequence number of the data packet sent by the transmitting end after sending the first retransmission response in the message type to which the transmitting end belongs, and the retransmission sequence number threshold before sending the first retransmission request. If the sending sequence of the data packet sent by the sending end after sending the first retransmission response is less than or equal to the retransmission sequence number threshold before sending the first retransmission request, the data packet is retransmitted. The data packet, so the receiving end uses the data packet as a retransmission data packet. At this time, the receiving end does not update the total receiving sequence number after receiving the retransmission packet.
在此说明, 当接收端接收到发送端在发送第一重传响应后发送的数据 包后, 首先会对接收到的数据包进行解析, 并会根据解析结果区分该数据 包是否发生错误。 当判断结果为该数据包未发生错误时, 才会执行后续操 作。  Herein, when the receiving end receives the data packet sent by the transmitting end after transmitting the first retransmission response, it first parses the received data packet, and distinguishes whether the data packet has an error according to the analysis result. Subsequent operations are performed when the result of the judgment is that no error has occurred in the packet.
如果发送端在发送第一重传响应后发送的数据包在自身所属的消息 类型中的发包序列号大于发送第一重传请求之前的重传序列号门限, 说明 该数据包已经不属于重传数据包, 而是新传的数据包, 故接收端在接收到 该数据包后需要更新收包总序列号, 更为具体的是将收包总序列号加 1。 与此同时, 接收端会获取接收到的发送端在发送第一重传响应后发送的数 据包对应的收包总序列号。 即接收端可以按照步骤 301-步骤 304的流程开 始接收该数据包。 If the sending sequence of the data packet sent by the sending end after sending the first retransmission response is greater than the retransmission sequence number threshold before the first retransmission request is sent, the data packet is not retransmitted. The data packet, but the newly transmitted data packet, needs to update the total sequence number of the received packet after receiving the data packet, and more specifically, the total sequence number of the received packet is increased by one. At the same time, the receiving end acquires the number sent by the receiving sender after sending the first retransmission response. According to the total number of the package corresponding to the package. That is, the receiving end can start receiving the data packet according to the process of step 301 to step 304.
上述过程描述了某种消息类型的数据包出错后, 接收端在接收到重传 响应之前又接收到该消息类型的数据包时的处理过程, 通过丟弃并记录该 之后接收到的数据包在所属的消息类型中的发包序列号, 进而从发送端在 发送重传响应之后发送的数据包中区分出哪些是重传的数据包, 保证了收 包总序列号能够正确进行计数, 并与发送端的发包总序列号保持一致, 为 数据包的重传打下了基础。  The above process describes the processing procedure when the receiving end receives the data packet of the message type before receiving the retransmission response after the packet of the certain message type is in error, by discarding and recording the data packet received after the packet is received. The sequence number of the packet to be sent in the message type, and further distinguish which packets are retransmitted from the data packet sent by the sender after sending the retransmission response, ensuring that the total sequence number of the packet can be correctly counted and sent. The total sequence number of the outgoing packet is consistent, which lays the foundation for the retransmission of the data packet.
进一步, 当确定出接收到的第一数据包发生错误时, 接收端向发送端 发送第二重传请求, 所述第二重传请求包括第一数据包对应的收包总序列 号。 基于此, 接收端会接收发送端发送的第二重传响应, 并会接收发送端 重新发送的第一数据包, 并且不会更新收包总序列号, 即不会将收包总序 列号加 1。 在该过程中, 假设接收端在接收到第二重传响应之前没有再接 收到与发生错误的数据包属于同一消息类型的数据包。 如果接收端在接收 到第二重传响应之前又接收到与发生错误的数据包属于同一消息类型的 数据包, 则该情况将与上述过程相同。  Further, when it is determined that the received first data packet has an error, the receiving end sends a second retransmission request to the transmitting end, where the second retransmission request includes a total received sequence number corresponding to the first data packet. Based on this, the receiving end receives the second retransmission response sent by the transmitting end, and receives the first data packet retransmitted by the transmitting end, and does not update the total sequence number of the receiving packet, that is, the total sequence number of the receiving packet is not added. 1. In this process, it is assumed that the receiving end does not receive a packet of the same message type as the packet in which the error occurred before receiving the second retransmission response. If the receiving end receives a packet of the same message type as the packet in which the error occurred before receiving the second retransmission response, the situation will be the same as the above procedure.
进一步, 当接收端发现第一数据包发生错误并向发送端发送第二重传 请求时, 可以记录请求重传的第一数据包对应的收包总序列号。 由于接收 端接收到的发送端重新发送的第一数据包也可能发生错误, 此时, 接收端 需要重新向发送端发送第二重传请求, 但是在该过程中, 随着其他消息类 型的数据包的接收, 收包总序列号可能发生了变化, 故无法根据当前的收 包总序列号获取第一数据包对应的收包总序列号, 故通过之前记录的第一 数据包对应的收包总序列号可以重新生成第二重传请求, 然后发送给发送 端。 如果接收端接收到的发送端重新发送的第一数据包没有发生错误, 则 可以将记录的第一数据包对应的收包总序列号丟弃。  Further, when the receiving end finds that the first data packet has an error and sends a second retransmission request to the transmitting end, the receiving terminal may record the total receiving sequence number corresponding to the first data packet that is requested to be retransmitted. The first data packet retransmitted by the transmitting end received by the receiving end may also generate an error. At this time, the receiving end needs to resend the second retransmission request to the transmitting end, but in the process, along with the data of other message types. After receiving the packet, the total sequence number of the received packet may change, so the total sequence number of the first packet corresponding to the first data packet cannot be obtained according to the current total sequence number of the received packet, so the packet corresponding to the first data packet recorded before is received. The total sequence number can regenerate the second retransmission request and send it to the sender. If the first data packet retransmitted by the sender received by the receiving end does not have an error, the total sequence number of the received packet corresponding to the first data packet may be discarded.
在本实施例中, 接收端在发送重传请求时, 通过记录请求重传的数据 包对应的收包总序列号, 便于在重传的数据包仍然错误时继续向发送端发 送重传请求, 有利于提高数据包的接收成功率。  In this embodiment, when receiving the retransmission request, the receiving end records the total sequence number of the packet corresponding to the data packet requested to be retransmitted, so as to continue to send the retransmission request to the transmitting end when the retransmitted data packet is still in error. It is beneficial to improve the success rate of receiving data packets.
下面将结合发送端和接收端进行数据传输的过程进一步说明本发明 上述各实施例的原理。 如图 4所示, 发送端为 Link— A, 接收端为 Link— B。 假设消息类型为 3种, 分别为 pktO、 pktl和 pkt2。 在图 4中以 pak表示数据包, pak后面 的数字标识数据包对应的发包总序列号或收包总序列号。 The principle of the above embodiments of the present invention will be further described below in conjunction with the process of data transmission between the transmitting end and the receiving end. As shown in Figure 4, the sender is Link-A and the receiver is Link-B. Suppose the message type is 3, which are pktO, pktl, and pkt2. In FIG. 4, the data packet is represented by pak, and the number following the pak identifies the total sequence number of the packet or the total sequence number of the packet corresponding to the packet.
Link— A向 Link— B发送某一消息类型的数据包时, 会记录该消息类型 的发包序列号, 记为 each_pkt— num, 并且还会发送总序列号, 记为 total— pkt—num, 并会建立一张映射关系表, 该映射关系表存储有  When Link-A sends a packet of a certain message type to Link-B, it records the sequence number of the packet of the message type, which is recorded as each_pkt_num, and also sends the total sequence number, which is recorded as total_pkt-num, and A mapping relationship table is created, and the mapping relationship table is stored
total— pkt— num、 each_pkt_num以及消息类型之间的对应关系。 Link— A向 Link— B发送某一消息类型的数据包时, 将此消息类型的数据包对应的 each— pkt— num插入到该数据包内。因此,对于同一消息类型的数据包来说, 其对应的 eack_pkt— num是连续累加 1的。 如图 4所示, 一开始, Link— A 向 Link— B顺序发送数据包 pak0、 pakl、 pak2、 pak3等。 Total—pkt— num, each_pkt_num, and the correspondence between message types. When Link-A sends a packet of a certain message type to Link-B, it inserts each_pkt_num corresponding to the packet of this message type into the packet. Therefore, for a packet of the same message type, its corresponding eack_pkt_num is continuously accumulated by one. As shown in Figure 4, at the beginning, Link_A sends data packets pak0, pakl, pak2, pak3, etc. to Link-B.
当 Link— B接收到数据包时, 会统计所有收到的数据包个数, 即收包 总序列号, 记为 pkt—num , 并会提取每个数据包内包含的 each_pkt— num。 当数据包无误时, 将提取出的 each— pkt— num与该消息类型的最后收包序 列号, 记为 last— each_pkt— num (即上一次接收到的该消息类型的数据包中 的 each— pkt— num ) 进行比较以判断该消息类型的数据包是否连续。 其中, 如果不连续, 说明之前有数据包发生了错误, 则不接收该数据包, 但此时 pkt— num继续累加。 当当前收到的数据包有错误, 则因为 Link— B无法知 道该数据包所属的消息类型, 所以会直接向 Link— A发送 retry— request并 将该错误包对应的收包总序列号 (即接收到该数据包后的 pkt—num的值) 告知 Link— A。 Link— A可以根据错误包对应的收包总序列号查找映射关系 表找到出错包所属的消息类型及对应的 each— pkt— num, 然后开始重传。  When Link-B receives the data packet, it counts the number of all received data packets, that is, the total sequence number of the received packet, which is recorded as pkt_num, and extracts each_pkt_num contained in each data packet. When the data packet is correct, the extracted each_pkt_num and the last received sequence number of the message type are recorded as last_each_pkt_num (that is, each of the last received packet of the message type) Pkt — num ) Compare to determine if the packet of the message type is contiguous. If it is not continuous, it indicates that there is an error in the previous packet, then the packet is not received, but pkt_num continues to accumulate at this time. When there is an error in the currently received data packet, because Link-B cannot know the message type to which the data packet belongs, it will directly send a retry_request to Link_A and the total sequence number of the packet corresponding to the error packet (ie The value of pkt_num after receiving the packet) informs Link_A. Link-A can find the message type to which the error packet belongs and the corresponding each_pkt_num according to the total sequence number of the received packet corresponding to the error packet, and then start retransmission.
结合图 4 , Link— B检测到 pakl (图 4中以点线示出) 出错后, 产生一 个重传请求, 己为 retry— re q (里面含有 akl对应的 pkt—num )给 Link— A, 告知 Link— A有数据包出错, 需要重新发送。  In conjunction with Figure 4, Link-B detects pakl (shown by dotted line in Figure 4). After an error occurs, a retransmission request is generated, which is retry-req (which contains the pkt-num corresponding to akl) to Link-A. Tells Link—A that there is a packet error and needs to be resent.
之后, Link— B会继续接收 Link— A发送的数据包, 例如 pak2、 pak3 等, 并会继续对 pkt—num计数。 此时, 在确定接收到的数据包无误后, Link— B也会将数据包中的 each_pkt— num跟同一消息类型的  After that, Link-B will continue to receive packets sent by Link-A, such as pak2, pak3, etc., and will continue to count pkt_num. At this point, after determining that the received data packet is correct, Link_B will also match each_pkt_num in the data packet with the same message type.
last_each_pkt_num进行比较以判断该消息类型的数据包是否是连续: 如果 连续, 则说明此消息类型的数据包没有出错过, 继续接收; 如果不连续, 说明该消息类型的数据包之前出错了, 则丟弃接收到的数据包, 同时将被 丟弃的数据包中的 each_pkt— num赋给重传序列号门限, 记为 Last_each_pkt_num compares to determine whether the packet of the message type is continuous: if it is continuous, it indicates that the packet of this message type has not been missed and continues to receive; if it is not continuous, If the packet of the message type is wrong before, the received packet is discarded, and each_pkt_num in the discarded packet is assigned to the retransmission sequence number threshold, which is recorded as
max— each_pkt— num。如图 4所示, pak3与 pakl的消息类型相同,故在 akl 出错后又接收到的 pak3需要被丟弃,并且将 pak3中的 each— pkt— num赋给 max— each_pkt— num。 而由于 ak2与 akl属于不同的消息类型, 且与 ak2 属于同一消息类型的之前的数据包没有发生过错误, 故 pak2正常接收, 而不用丟弃。 Max—each_pkt— num. As shown in Figure 4, pak3 and pakl have the same message type, so the pak3 received after the akl error needs to be discarded, and each_pkt_num in pak3 is assigned to max_each_pkt_num. Since ak2 and akl belong to different message types, and there is no error with the previous packet of ak2 belonging to the same message type, pak2 receives normally without discarding.
如图 4所示, 当 Link— B成功接收到 LinK— A发送的数据包后会向 Link— A发送 ack„  As shown in Figure 4, when Link-B successfully receives the data packet sent by LinK-A, it will send ack to Link-A.
当 Link— A发送完毕 pakN后, 收到 retry— req, 停止正常包的发送, 而 是发送一个 retry res给 Link— B。 Link— A根据 retry req中的 pkt— num在映 射关系表中进行查找,获取需要重传的消息类型为 pktl及需要重传的起始 位置为 pktl对应的重传緩冲器( retry buffer ) 中的 pakl。 然后, 从重传緩 冲器中读出所有需要重传的数据包发送给 Link— B。如图 4所示,假设所有 需要重传的数据包包括 pakl、 pak3 - pakM (在图 4中以虚线所示) 。  When Link-A sends pakN, it receives retry_req, stops the normal packet transmission, and sends a retry res to Link-B. Link-A searches in the mapping table according to pkt_num in retry req, and obtains the retry buffer corresponding to the pktl message and the retransmission buffer corresponding to the starting position of pktl that needs to be retransmitted. Pakl. Then, all the packets that need to be retransmitted are read out from the retransmission buffer and sent to Link-B. As shown in Figure 4, assume that all packets that need to be retransmitted include pakl, pak3 - pakM (shown in phantom in Figure 4).
Link— A发送完 pakM后, 继续发送正常数据包, 例如 pak(N+l)等。 Link— B检测到 retry— res后, 停止使用 pkt— num对 pktl类型数据包的 计数, 即在接收到消息类型 pktl的数据包后不会将 pkt— num加 1。 Link— B 接收到 Link— A重传的消息类型为 pktl的数据包后, 将提取出其中的 each— pkt— num , 并将提取出的 each_pkt— num与 max— each_pkt— num比较, 当 each— pkt— num大于 max— each— pkt— num时, 重新启动 pkt— num对消息类 型为 pktl的数据包的计数, 即在检测到消息类型为 pktl的数据包中的 each— pkt— num大于 max— each— pkt— num时, 需要将 kt num力口 1 , 并且在 此之后接收到消息类型为 pktl的新数据包时也需要将 pkt— num加 1。  After Link-A sends pakM, it continues to send normal data packets, such as pak(N+l). After Link-B detects retry_res, it stops counting pkt_num for pktl type packets, that is, it does not increment pkt_num after receiving the packet of message type pktl. Link-B receives the link_A retransmitted message type pktl packet, extracts each_pkt_num, and compares the extracted each_pkt_num with max_each_pkt_num, when each_ When pkt_num is greater than max_each_pkt_num, the pkt_num is restarted for the packet of the message type pktl, that is, each_pkt_num is greater than max in the packet detecting the message type pktl. For each_pkt_num, you need to force kt num 1 and then need to add 1 to pkt_num when receiving a new packet with message type pktl.
Link— B正常的接收后续的数据包,并在成功接收后续数据包时向 Link— A 发送 ack„  Link-B normally receives subsequent data packets and sends ack to Link-A when it successfully receives subsequent data packets.
在此说明, 如果某种消息类型的数据包出错后, Link— B在收到 retry— res之前没有再收到该消息类型的数据包, 则 max_each_pkt_num是 无效的, 说明该期间该消息类型的数据包只错了一次或者该消息类型的数 据包一直在出错, 无法得到正常的 max— each_pkt— num , 为了保证 kt num 的正确 , Link— Β在收到 retry— res之后不会对第一个接收到的数据包进行 计数, 即不会将 pkt— num加 1 , 因为该数据包是重传的数据包已经计数过 了。 Here, if a packet of a certain message type fails, Link_B does not receive the packet of the message type before receiving retry_res, then max_each_pkt_num is invalid, indicating the data of the message type during the period. The packet is only wrong once or the packet of the message type is always in error, and the normal max_each_pkt_num cannot be obtained, in order to guarantee kt num Correct, Link - 不会 will not count the first received packet after receiving retry- res, ie will not add pkt_num to 1, because the packet is retransmitted and the packet has been counted It is.
进一步说明, 当 Link— B检测到某个数据包错误, 还会保存此时的 pkt— num, 即该错误包对应的 pkt— num。 在收到 retry— res之后, 如果第一 个接收到的数据包无错误, 则丟弃保存的 pkt— num; 如果 retry— res之后第 一个接收到的数据包有错误, 需要再次向 Link— A发送 retry— req, 此时 retry req中的 pkt— num为之前已经保存过的 pkt— num, 而不是当前的 pkt— num。这样 Link— A收到 retry req后 ,可以根据 retry req中的 pkt— num 在映射关系表找到正确的重传包类型和重传包的起始位置。  Further, when Link-B detects a packet error, it also saves pkt_num at this time, that is, pkt_num corresponding to the error packet. After receiving the retry_res, if the first received packet has no error, the saved pkt_num is discarded; if the first received packet after retry-res has an error, it needs to be redirected to the Link- A sends retry_req, at which point pkt_num in retry req is the previously saved pkt_num, not the current pkt_num. In this way, after Link-A receives retry req, it can find the correct retransmission packet type and the starting position of the retransmission packet in the mapping table according to pkt_num in retry req.
由上述可见, 本实施例发明实施例提供的数据包重传方法以及数据包 接收方法相互配合, 在需要重传的场景下, 可以做到只重传某种类型的数 据包, 而不需将其后所有其他类型数据包都重传, 减少了重传的数据量, 节约了重传机制造成的资源浪费, 提高了系统的带宽利用率。  It can be seen from the above that the data packet retransmission method and the data packet receiving method provided by the embodiment of the present invention cooperate with each other, and in a scenario requiring retransmission, only a certain type of data packet can be retransmitted without After that, all other types of data packets are retransmitted, which reduces the amount of data retransmitted, saves resource waste caused by the retransmission mechanism, and improves the bandwidth utilization of the system.
图 5为本发明一实施例提供的数据包发送装置的结构示意图。 如图 5 所示, 本实施例的数据包发送装置 5包括: 第一接收模块 51、 第一处理模 块 52和第一发送模块 53。  FIG. 5 is a schematic structural diagram of a data packet sending apparatus according to an embodiment of the present invention. As shown in FIG. 5, the data packet transmitting apparatus 5 of this embodiment includes: a first receiving module 51, a first processing module 52, and a first transmitting module 53.
其中, 第一接收模块 51 , 用于接收重传请求, 该重传请求由接收端发 送, 该重传请求包括请求重传的数据包对应的收包总序列号。 其中, 收包 总序列号是接收端对接收的所有消息类型的数据包进行计数得到的序列 号。 请求重传的数据包对应的收包总序列号是在接收端接收到请求重传的 数据包后计数到的收包总序列号。  The first receiving module 51 is configured to receive a retransmission request, where the retransmission request is sent by the receiving end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission. The total sequence number of the received packet is a sequence number obtained by the receiving end to count the data packets of all received message types. The total sequence number of the packet corresponding to the data packet requesting retransmission is the total sequence number of the packet received after the receiving end receives the data packet requesting retransmission.
第一处理模块 52 , 与第一接收模块 51连接, 用于根据第一接收模块 51接收到的重传请求中的请求重传的数据包对应的收包总序列号和本地 存储的发包总序列号与每个消息类型的发包序列号之间的映射关系, 获取 请求重传的数据包所属的消息类型和请求重传的数据包在自身所属的消 息类型中的发包序列号。 其中, 发包总序列号为对发送的所有消息类型的 数据包进行计数得到的序列号。  The first processing module 52 is connected to the first receiving module 51, and is configured to receive a total sequence number of the packet corresponding to the data packet retransmitted according to the request in the retransmission request received by the first receiving module 51, and a total sequence of the locally stored packet. The mapping relationship between the number and the packet sequence number of each message type obtains the message type to which the data packet requesting retransmission belongs and the packet sequence number of the data packet requesting retransmission in the message type to which it belongs. The total sequence number of the packet is a sequence number obtained by counting packets of all message types sent.
第一发送模块 53 , 与第一处理模块 52连接, 用于根据第一处理模块 52获取的请求重传的数据包所属的消息类型和请求重传的数据包在自身 所属的消息类型中的发包序列号, 向接收端发送请求重传的数据包以及在 请求重传的数据包之后发送的与请求重传的数据包属于同一消息类型的 数据包。 The first sending module 53 is connected to the first processing module 52, and the message type to which the data packet retransmitted according to the request acquired by the first processing module 52 belongs and the data packet requested to be retransmitted are themselves The packet sequence number in the associated message type, the data packet requesting retransmission is sent to the receiving end, and the data packet sent after the requesting retransmitted data packet belongs to the same message type as the data packet requesting retransmission.
本实施例的数据包发送装置的各功能模块可用于执行图 1所示数据包 重传方法的流程, 其具体工作原理不再赘述, 详见方法实施例的描述。  The function modules of the data packet transmitting apparatus in this embodiment can be used to perform the process of the data packet retransmission method shown in FIG. 1. The specific working principle is not described here. For details, refer to the description of the method embodiment.
本实施例的额数据包发送装置可以是任何具有重传机制的设备或设 备中的模块, 例如发送端可以是服务器、 路由设备等, 也可以是 CPU中 的 QPI或互联芯片中的 QPI等。  The packet sending device of this embodiment may be any device or device in the device having a retransmission mechanism. For example, the sender may be a server, a routing device, or the like, or may be a QPI in the CPU or a QPI in the interconnect chip.
本实施例的数据包发送装置, 在接收到接收端发送的重传请求之后, 根据接收端请求重传的数据包对应的收包总序列号和本地存储的发包总 序列号和每个消息类型的发包序列号之间的对应关系, 找到请求重传的数 据包所属的消息类型和请求重传的数据包所属的消息类型中的发包序列 号, 进而根据这些信息从重传緩冲器中获取请求重传的数据包和在请求重 传的数据包之后发送的与请求重传的数据包属于同一消息类型的数据包, 然后将获取的这些数据包重新发送给接收端。 本实施例的数据包发送装置 在数据包重传过程中实现了只重传同一类型的数据包, 而在请求重传的数 据包之后发送的其他类型的数据包在不需要重传的时候不用重传, 与现有 技术中要将请求重传的数据包和请求重传的数据包之后发送的所有数据 包都重新发送给接收端的方案相比, 减少了重传的数据量, 降低了重传机 制造成的资源浪费。  After receiving the retransmission request sent by the receiving end, the data packet transmitting apparatus of the embodiment receives the total sequence number of the packet corresponding to the data packet retransmitted by the receiving end, and the total sequence number of the packet and the message type of each of the locally stored packets. Correspondence between the serial numbers of the outgoing packets, find the message type to which the data packet requesting retransmission belongs, and the sequence number of the outgoing packet in the message type to which the data packet requesting retransmission belongs, and then obtain the request from the retransmission buffer according to the information. The retransmitted data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type, and then the obtained data packets are resent to the receiving end. The data packet transmitting apparatus of this embodiment realizes that only the same type of data packet is retransmitted in the process of data packet retransmission, and other types of data packets sent after requesting the retransmitted data packet are not used when retransmission is not required. Retransmission, which reduces the amount of data retransmitted, and reduces the amount of data that is retransmitted compared with the solution in the prior art that retransmits the data packet that is requested to be retransmitted and all data packets that are sent after the data packet is retransmitted to the receiving end. Waste of resources caused by the transmission mechanism.
图 6A为本发明一实施例提供的数据包发送装置的结构示意图。 本实 施例基于图 5所示实施例实现。 如图 6A所示, 本实施例的数据包发送装 置 6也包括第一接收模块 51、 第一处理模块 52和第一发送模块 53 , 并且 各模块也具有图 5所示实施例中描述的功能。  FIG. 6 is a schematic structural diagram of a data packet sending apparatus according to an embodiment of the present invention. This embodiment is implemented based on the embodiment shown in FIG. As shown in FIG. 6A, the data packet transmitting apparatus 6 of this embodiment also includes a first receiving module 51, a first processing module 52, and a first transmitting module 53, and each module also has the functions described in the embodiment shown in FIG. .
在本实施例中, 第一处理模块 52还用于在第一发送模块 53向接收端 发送请求重传的数据包以及在请求重传的数据包之后发送的与请求重传 的数据包属于同一消息类型的数据包之前, 判断请求重传的数据包所属的 消息类型和前一个重传请求请求重传的数据包所属的消息类型是否相同, 在判断结果为不相同时, 触发第一发送模块 53执行根据请求重传的数据 包所属的消息类型和请求重传的数据包在自身所属的消息类型中的发包 序列号, 向接收端发送请求重传的数据包以及在请求重传的数据包之后发 送的与请求重传的数据包属于同一消息类型的数据包的操作。 In this embodiment, the first processing module 52 is further configured to send, at the first sending module 53, the data packet requesting retransmission to the receiving end, and the data packet sent after requesting the retransmitted data packet to be requested to be retransmitted. Before the data packet of the message type, it is judged whether the message type of the data packet requesting the retransmission belongs to the same message type as the data packet to which the previous retransmission request request retransmission belongs, and when the judgment result is different, the first sending module is triggered. 53 performing the message type to which the data packet retransmitted according to the request belongs and the data packet requested to be retransmitted in the message type to which it belongs The serial number, the operation of transmitting the data packet requesting retransmission to the receiving end and the data packet of the same message type sent after the data packet requesting retransmission is sent after the data packet requesting retransmission is sent.
进一步, 本实施例的第一处理模块 52还用于在判断结果为相同时, 将第一接收模块 51接收到的重传请求丟弃。  Further, the first processing module 52 of the embodiment is further configured to discard the retransmission request received by the first receiving module 51 when the determination result is the same.
进一步, 本实施例的第一发送模块 53还用于向接收端发送第一数据 包。 其中, 第一数据包是首次向接收端发送的数据包, 第一数据包包括第 一数据包所属的消息类型和第一数据包在自身所属的消息类型中的发包 序列号。  Further, the first sending module 53 of this embodiment is further configured to send the first data packet to the receiving end. The first data packet is a data packet sent to the receiving end for the first time, and the first data packet includes a message type to which the first data packet belongs and a delivery sequence number of the first data packet in the message type to which the first data packet belongs.
相应地, 第一处理模块 52还用于将第一数据包进行緩存, 并根据第 一数据包所属的消息类型更新发包总序列号与每个消息类型的发包序列 号之间的映射关系。  Correspondingly, the first processing module 52 is further configured to buffer the first data packet, and update a mapping relationship between the total packet sequence number and the packet sequence number of each message type according to the message type to which the first data packet belongs.
进一步, 本实施例的数据包发送装置包括多个重传緩冲器 54。 不同的 重传緩冲器 54用于緩存不同消息类型的数据包。 则第一处理模块 52具体 用于根据第一数据包所属的消息类型, 将第一数据包緩存到第一数据包对 应的重传緩冲器 54中。  Further, the packet transmitting apparatus of this embodiment includes a plurality of retransmission buffers 54. Different retransmission buffers 54 are used to buffer packets of different message types. The first processing module 52 is specifically configured to buffer the first data packet into the retransmission buffer 54 corresponding to the first data packet according to the message type to which the first data packet belongs.
更进一步, 本实施例的第一发送模块 53包括: 重传控制单元 531、 发 送控制单元 532和发送单元 533。  Further, the first transmitting module 53 of this embodiment includes: a retransmission control unit 531, a transmission control unit 532, and a transmitting unit 533.
其中, 重传控制单元 531 , 与第一处理模块 52连接, 用于根据第一处 理模块 52获取的请求重传的数据包所属的消息类型确定请求重传的数据 包对应的重传緩冲器 54。  The retransmission control unit 531 is connected to the first processing module 52, and is configured to determine, according to the message type to which the data packet retransmitted by the first processing module 52 belongs, a retransmission buffer corresponding to the data packet requesting retransmission. 54.
发送控制单元 532 , 与第一处理模块 52和重传緩冲器 54连接, 用于 根据第一处理模块 52获取的请求重传的数据包在自身所属的消息类型中 的发包序列号, 从请求重传的数据包对应的重传緩冲器 54中获取请求重 传的数据包以及在请求重传的数据包之后发送的与请求重传的数据包属 于同一消息类型的数据包。  The sending control unit 532 is connected to the first processing module 52 and the retransmission buffer 54 for requesting the retransmission of the data packet according to the request acquired by the first processing module 52 in the message type of the message type to which the first processing module 52 belongs. The retransmission buffer 54 corresponding to the retransmitted data packet acquires the data packet requesting retransmission and the data packet transmitted after the data packet requested to be retransmitted belongs to the same message type as the data packet requested to be retransmitted.
发送单元 533 , 与发送控制单元 532连接, 用于向接收端发送重传响 应, 然后向接收端发送由发送控制单元 532获取的请求重传的数据包以及 在请求重传的数据包之后发送的与请求重传的数据包属于同一消息类型 的数据包。  The sending unit 533 is connected to the sending control unit 532, and configured to send a retransmission response to the receiving end, and then send the data packet requested by the sending control unit 532 and retransmitted to the receiving end, and send the data packet after requesting the retransmitted data packet. A packet belonging to the same message type as the packet requested to be retransmitted.
可选的, 发送单元 533具体用于在第一处理模块 52获取请求重传的 数据包所属的消息类型和请求重传的数据包在自身所属的消息类型中的 发包序列号之前, 向接收端发送重传响应。 或者 Optionally, the sending unit 533 is specifically configured to acquire, at the first processing module 52, the request for retransmission. The message type to which the data packet belongs and the data packet requesting retransmission send a retransmission response to the receiving end before the packet sequence number in the message type to which it belongs. or
发送单元 533具体用于在重传控制单元 531根据请求重传的数据包所 属的消息类型确定请求重传的数据包对应的重传緩冲器之前, 向接收端发 送重传响应。 或者  The sending unit 533 is specifically configured to send a retransmission response to the receiving end before the retransmission control unit 531 determines the retransmission buffer corresponding to the data packet requesting retransmission according to the message type of the data packet requested to be retransmitted. Or
发送单元 533具体用于在发送控制单元 532从请求重传的数据包对应 的重传緩冲器中获取请求重传的数据包以及在请求重传的数据包之后发 送的与请求重传的数据包属于同一消息类型的数据包之后, 向接收端发送 重传响应。  The sending unit 533 is specifically configured to: in the retransmission buffer corresponding to the data packet requesting retransmission, the sending control unit 532 acquires the data packet requesting retransmission and the data sent after requesting the retransmitted data packet and requesting retransmission After the packet belongs to the same message type packet, the retransmission response is sent to the receiving end.
进一步, 本实施例的第一发送模块 53还包括: 特殊包产生单元 534。 该特殊包产生单元 534用于生成重传响应。 可选的, 特殊包产生单元 534 与第一处理模块 52和发送单元 533连接, 用于在第一处理模块 52的控制 下生成重传响应, 并提供给发送单元 533。  Further, the first sending module 53 of this embodiment further includes: a special packet generating unit 534. The special packet generation unit 534 is configured to generate a retransmission response. Optionally, the special packet generating unit 534 is connected to the first processing module 52 and the sending unit 533 for generating a retransmission response under the control of the first processing module 52, and providing the retransmission response to the sending unit 533.
可选的, 当本实施例的数据包发送装置接收数据包并且发现数据包发 生错误时, 特殊包产生单元 534还用于生成重传请求。 另外, 本实施的特 殊包产生单元 534还用于产生 ack消息等。  Optionally, when the data packet sending apparatus of the embodiment receives the data packet and finds that the data packet is in error, the special packet generating unit 534 is further configured to generate a retransmission request. In addition, the special packet generating unit 534 of this embodiment is also used to generate an ack message or the like.
进一步, 本实施例的第一处理模块 52可以包括: 接收译码单元 521 和系统控制单元 522。  Further, the first processing module 52 of this embodiment may include: a receiving decoding unit 521 and a system control unit 522.
其中, 接收译码单元 521 , 与第一接收模块 51连接, 用于对第一接收 模块 51接收到的重传请求进行解析, 获取请求重传的数据包对应的收包 总序列号。  The receiving and decoding unit 521 is connected to the first receiving module 51, and configured to parse the retransmission request received by the first receiving module 51, and obtain the total sequence number of the packet corresponding to the data packet requesting retransmission.
系统控制单元 522 , 与接收译码单元 521连接, 用于将请求重传的数 据包对应的收包总序列号与本地存储的映射关系表中的发包总序列号进 行匹配, 将匹配中的发包总序列号所对应的消息类型和消息类型的发包序 列号分别作为请求重传的数据包所属的消息类型和请求重传的数据包在 自身所属的消息类型中的发包序列号。 其中, 映射关系表存储有发包总序 列号与每个消息类型的发包序列号之间的映射关系。  The system control unit 522 is connected to the receiving and decoding unit 521, and is configured to match the total sequence number of the packet corresponding to the data packet requesting retransmission with the total sequence number of the packet in the locally stored mapping relationship table, and send the matching packet in the matching. The message type corresponding to the total sequence number and the packet sequence number of the message type respectively serve as the message type to which the data packet requesting retransmission belongs and the packet sequence number in the message type to which the data packet requested to be retransmitted belongs. The mapping relationship table stores a mapping relationship between the total sequence number of the packet and the packet sequence number of each message type.
具体的, 系统控制单元 522还与重传控制单元 531、发送控制单元 532 和特殊包产生单元 534连接。  Specifically, the system control unit 522 is also connected to the retransmission control unit 531, the transmission control unit 532, and the special packet generation unit 534.
结合第一处理模块 52和第一发送模块 53的上述结构, 第一发送模块 53具体可由其发送单元 533向接收端发送第一数据包。相应地, 第一处理 模块 52具体可由其系统控制单元 522将第一数据包进行緩存, 并根据第 一数据包所属的消息类型更新发包总序列号与每个消息类型的发包序列 号之间的映射关系。 更为具体的, 第一处理模块 52具体可由其系统控制 单元 522根据第一数据包所属的消息类型, 将第一数据包緩存到第一数据 包对应的重传緩冲器 54中。 Combining the above structure of the first processing module 52 and the first sending module 53, the first sending module Specifically, the sending unit 533 can send the first data packet to the receiving end. Correspondingly, the first processing module 52 may specifically cache the first data packet by its system control unit 522, and update between the total packet sequence number and the packet sequence number of each message type according to the message type to which the first data packet belongs. Mapping relations. More specifically, the first processing module 52 may specifically cache the first data packet by the system control unit 522 according to the message type to which the first data packet belongs to the retransmission buffer 54 corresponding to the first data packet.
进一步, 结合第一处理模块 52的上述结构, 第一处理模块 52具体可 由其系统控制单元 522判断请求重传的数据包所属的消息类型和前一个重 传请求请求重传的数据包所属的消息类型是否相同; 在判断结果为不相同 时, 触发第一发送模块 53执行根据请求重传的数据包所属的消息类型和 请求重传的数据包在自身所属的消息类型中的发包序列号, 向接收端发送 请求重传的数据包以及在请求重传的数据包之后发送的与请求重传的数 据包属于同一消息类型的数据包的操作; 在判断结果为相同时, 将第一接 收模块 51接收到的重传请求丟弃。  Further, in combination with the foregoing structure of the first processing module 52, the first processing module 52 may specifically determine, by its system control unit 522, the message type to which the data packet requesting retransmission belongs and the message to which the data packet to which the previous retransmission request requests retransmission belongs. Whether the types are the same; when the judgment result is different, triggering the first sending module 53 to execute the message type to which the data packet retransmitted according to the request belongs and the packet sequence number of the data packet requesting retransmission in the message type to which the request belongs, The receiving end sends the data packet requesting retransmission and the data packet sent after the data packet requesting retransmission belongs to the same message type as the data packet requesting retransmission; when the judgment result is the same, the first receiving module 51 is used. The received retransmission request is discarded.
上述各功能模块或单元可用于执行图 1或图 2所示数据包重传方法的 流程, 其具体工作原理不再赘述, 详见方法实施例的描述。  The foregoing functional modules or units may be used to perform the process of the data packet retransmission method shown in FIG. 1 or FIG. 2, and the specific working principle is not described here. For details, refer to the description of the method embodiments.
本实施例的数据包发送装置, 在接收到接收端发送的重传请求之后, 根据接收端请求重传的数据包对应的收包总序列号和本地存储的发包总 序列号和每个消息类型的发包序列号之间的对应关系, 找到请求重传的数 据包所属的消息类型和请求重传的数据包所属的消息类型中的发包序列 号, 进而根据这些信息从重传緩冲器中获取请求重传的数据包和在请求重 传的数据包之后发送的与请求重传的数据包属于同一消息类型的数据包, 然后将获取的这些数据包重新发送给接收端。 本实施例的数据包发送装置 在数据包重传过程中实现了只重传同一类型的数据包, 而在请求重传的数 据包之后发送的其他类型的数据包在不需要重传的时候不用重传, 与现有 技术中要将请求重传的数据包和请求重传的数据包之后发送的所有数据 包都重新发送给接收端的方案相比, 减少了重传的数据量, 降低了重传机 制造成的资源浪费。  After receiving the retransmission request sent by the receiving end, the data packet transmitting apparatus of the embodiment receives the total sequence number of the packet corresponding to the data packet retransmitted by the receiving end, and the total sequence number of the packet and the message type of each of the locally stored packets. Correspondence between the serial numbers of the outgoing packets, find the message type to which the data packet requesting retransmission belongs, and the sequence number of the outgoing packet in the message type to which the data packet requesting retransmission belongs, and then obtain the request from the retransmission buffer according to the information. The retransmitted data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type, and then the obtained data packets are resent to the receiving end. The data packet transmitting apparatus of this embodiment realizes that only the same type of data packet is retransmitted in the process of data packet retransmission, and other types of data packets sent after requesting the retransmitted data packet are not used when retransmission is not required. Retransmission, which reduces the amount of data retransmitted, and reduces the amount of data that is retransmitted compared with the solution in the prior art that retransmits the data packet that is requested to be retransmitted and all data packets that are sent after the data packet is retransmitted to the receiving end. Waste of resources caused by the transmission mechanism.
图 6B为本发明一实施例提供的 QPI协议的链路层的结构示意图。 如 图 6B所示, 本实施例的 QPI协议包括: QPI的协议层、 QPI的链路层和 QPI的物理层。 QPI的链路层负责数据包的接收和重传。 QPI的链路层主 要包括: 接收模块 rx、 接收译码模块 rx— decode , 系统控制模块 sys— Ctrl、 多个重传控制模块 retry— ctrl、 发送控制模块 tx— Ctrl、 特殊包生成模块 gen sp、 多个重传緩冲器 retry— buf和发送模块 tx。 FIG. 6B is a schematic structural diagram of a link layer of a QPI protocol according to an embodiment of the present invention. As shown in FIG. 6B, the QPI protocol in this embodiment includes: a protocol layer of QPI, a link layer of QPI, and The physical layer of QPI. The link layer of QPI is responsible for receiving and retransmitting data packets. The link layer of QPI mainly includes: receiving module rx, receiving decoding module rx_decode, system control module sys-Ctrl, multiple retransmission control modules retry- ctrl, sending control module tx- Ctrl, special packet generating module gen sp , multiple retransmission buffers retry_buf and sending module tx.
结合图 6A所示数据包发送装置的结构, 本实施例的接收模块 rx相当 于图 6A所示实施例中的第一接收模块 51 ; 本实施例的接收译码模块 rx— decode相当于图 6A所示实施例中的接收译码单元 521 ; 本实施例的系 统控制模块 sys— Ctrl相当于图 6A所示实施例中的系统控制单元 522; 本实 施例的重传控制模块 retry— Ctrl相当于图 6A所示实施例中的重传控制单元 531 ; 本实施例的发送控制模块 tx— Ctrl相当于图 6A所示实施例中的发送 控制单元 532; 本实施例的特殊包生成模块 gen— sp相当于图 6A所示实施 例中的特殊包生成单元 534;本实施例的重传緩冲器 retry— buf相当于图 6A 所示实施例中的重传緩冲器 54;本实施例的发送模块 tx相当于图 6A所示 实施例中的发送单元 533。  With reference to the structure of the data packet transmitting apparatus shown in FIG. 6A, the receiving module rx of this embodiment is equivalent to the first receiving module 51 in the embodiment shown in FIG. 6A; the receiving decoding module rx_decode of this embodiment is equivalent to FIG. 6A. The receiving and decoding unit 521 in the illustrated embodiment; the system control module sys_Ctrl of the embodiment is equivalent to the system control unit 522 in the embodiment shown in FIG. 6A; the retransmission control module retry_Ctrl of the embodiment is equivalent to The retransmission control unit 531 in the embodiment shown in FIG. 6A; the transmission control module tx_Ctrl of the embodiment is equivalent to the transmission control unit 532 in the embodiment shown in FIG. 6A; the special packet generation module gen-sp of this embodiment Corresponding to the special packet generating unit 534 in the embodiment shown in FIG. 6A; the retransmission buffer retry_buf of this embodiment is equivalent to the retransmission buffer 54 in the embodiment shown in FIG. 6A; the sending of this embodiment The module tx corresponds to the transmitting unit 533 in the embodiment shown in Fig. 6A.
在本实施例中, 接收模块 rx, 是链路层与物理层的接口, 用于接收从 物理层来的数据包。 接收译码模块 rx— decode, 用于对接收模块 rx接收到 的数据包进行译码, 将数据包中含有的链路层用到信息提取出来发送给系 统控制模块 sys— Ctrl, 并将收到的数据包是否错误以及哪个包错误的信息 发给重传控制模块 retry— ctrl。 系统控制模块 sys— Ctrl, 主要用于发送控制 信息给重传控制模块 retry— ctrl、发送控制模块 tx— Ctrl以及特殊包生成模块 gen— sp。 重传控制模块 retry— Ctrl, 用于控制重传緩冲器 retry— buf的读写指 针。 发送控制模块 tx— Ctrl, 用于从重传緩冲器 retry— buf、 协议层以及特殊 包生成模块 gen— sp选择需要发送的数据。 特殊包生成模块 gen— sp , 用于 产生链路层使用的特殊包( special packet ) , 例如确认 ( ack ) 、 重传请求 ( retry— request ) 、 重传响应 ( retry— response ) 等。 重传緩冲器 retry— buf, 用于在需要重传时, 根据收到的 retry— requset内的错误包的序号  In this embodiment, the receiving module rx is an interface between the link layer and the physical layer, and is configured to receive data packets from the physical layer. The receiving decoding module rx_decode is used for decoding the data packet received by the receiving module rx, extracting the link layer contained in the data packet and sending the information to the system control module sys_Ctrl, and receiving Whether the packet is incorrect and which packet error is sent to the retransmission control module retry_ctrl. The system control module sys-Ctrl is mainly used to send control information to the retransmission control module retry- ctrl, the send control module tx-Ctrl, and the special packet generation module gen-sp. The retransmission control module retry-Ctrl is used to control the read/write pointer of the retry buffer retry_buf. The send control module tx_Ctrl is used to select the data to be sent from the retransmission buffer retry_buf, the protocol layer, and the special packet generation module gen-sp. The special packet generation module gen-sp is used to generate special packets used by the link layer, such as acknowledgment (ack), retry-request, retry-response, and so on. Retransmission buffer retry_buf, used to receive the sequence number of the error packet in the retry_requset when retransmission is required
( pkt_num ) , 在重传緩冲器中找到需要重传的包的起始位置。 发送模块 tx, 用于发送数据包。  ( pkt_num ), find the starting position of the packet that needs to be retransmitted in the retransmission buffer. The sending module tx is used to send data packets.
本实施例的 QPI协议的链路层同时具有收发数据包的功能,上面从整 体上描述了本实施例的 QPI协议的链路层中各模块的功能, 下面将结合数 据包重传详细说明链路层中各模块在数据包重传时的功能。 The link layer of the QPI protocol of the embodiment has the function of transmitting and receiving data packets at the same time. The functions of the modules in the link layer of the QPI protocol of the present embodiment are described above as a whole. According to the packet retransmission, the functions of each module in the link layer when the data packet is retransmitted are described in detail.
如果物理层来的数据包是接收端发送的重传请求,则接收模块 rx就会 接收从物理层来的重传请求。 接收译码模块 rx— decode用于对接收模块 rx 接收到的重传请求进行译码, 从中提取出请求重传的数据包对应的收包总 序列号, 并将其提供给系统控制模块 sys— ctrl。 系统控制模块 sys— Ctrl将请 求重传的数据包对应的收包总序列号与本地存储的映射关系表中的发包 总序列号进行匹配, 将匹配中的收包总序列号对应的消息类型和消息类型 的发包序列号分别作为请求重传的数据包所属的消息类型和请求重传的 数据包在自身所属的消息类型中的发包序列号, 并请求重传的数据包所属 的消息类型作为控制信息提供给相应的重传控制模块 retry— Ctrl, 将请求重 传的数据包在自身所属的消息类型中的发包序列号作为控制信息提供给 发送控制模块 tx— ctrl。重传控制模块 retry— Ctrl根据请求重传的数据包所属 的消息类型去选择相应的重传緩冲器 retry— buf。发送控制模块 tx— Ctrl根据 请求重传的数据包在自身所属的消息类型中的发包序列号从重传控制模 块 retry— Ctrl选择的重传緩冲器 retry— buf中获取请求重传的数据包以及在 请求重传的数据包之后发送的数据包。发送模块 tx将发送控制模块 tx— Ctrl 获取的数据包发送给接收端。  If the data packet from the physical layer is a retransmission request sent by the receiving end, the receiving module rx receives the retransmission request from the physical layer. The receiving decoding module rx_decode is used to decode the retransmission request received by the receiving module rx, extract the total sequence number of the packet corresponding to the data packet requesting retransmission, and provide it to the system control module sys- Ctrl. The system control module sys_Ctrl matches the total sequence number of the packet corresponding to the retransmitted data packet with the total sequence number of the packet in the locally stored mapping relationship table, and matches the message type corresponding to the total sequence number of the received packet in the match. The message sequence number of the message type is used as the message type to which the data packet requesting retransmission belongs and the packet sequence number of the data packet requesting retransmission in the message type to which the request is retransmitted, and the message type to which the retransmitted data packet belongs is controlled. The information is provided to the corresponding retransmission control module retry_Ctrl, and the packet sequence number of the data packet requesting retransmission in the message type to which it belongs is provided as control information to the transmission control module tx_ctrl. The retransmission control module retry-Ctrl selects the corresponding retransmission buffer retry_buf according to the message type to which the retransmitted packet belongs. The sending control module tx_Ctrl obtains the data packet requesting retransmission from the retransmission buffer retry_buf selected by the retry control module retry_Ctrl according to the packet sequence number in the message type to which the request is retransmitted. A packet sent after a packet that is requested to be retransmitted. The sending module tx sends the data packet obtained by the sending control module tx_Ctrl to the receiving end.
进一步, 特殊包生成模块 gen— sp会在发送模块 tx向接收端发送控制 模块 tx— Ctrl获取的数据包之前, 生成重传响应; 发送模块 tx将重传响应 发送给接收端, 然后再向接收端发送控制模块 tx— Ctrl获取的数据包。  Further, the special packet generation module gen-sp generates a retransmission response before the sending module tx sends the data packet acquired by the control module tx_Ctrl to the receiving end; the sending module tx sends the retransmission response to the receiving end, and then receives the retransmission response. The data packet sent by the control module tx_Ctrl is sent.
在本实施例中, QPI协议的链路层通过设置多个重传緩冲器, 使每个 重传緩冲器对应一个消息类型, 并存储发包总序列号和每个消息类型的发 包序列号之间的对应关系, 使得在接收到接收端的重传请求后, 可以只重 传同一类型的数据包, 而在请求重传的数据包之后发送的其他类型的数据 包在不需要重传的时候不用重传, 与现有技术中要将请求重传的数据包以 及请求重传的数据包之后发送的所有数据包都重新发送给接收端的方案 相比, 减少了重传的数据量, 降低了重传机制造成的资源浪费。  In this embodiment, the link layer of the QPI protocol sets a plurality of retransmission buffers, so that each retransmission buffer corresponds to one message type, and stores the total sequence number of the packet and the packet sequence number of each message type. Correspondence between the two types, so that after receiving the retransmission request from the receiving end, only the same type of data packet can be retransmitted, and other types of data packets sent after requesting the retransmitted data packet do not need to be retransmitted. Without retransmission, compared with the prior art scheme of retransmitting the data packet requesting retransmission and all data packets sent after the data packet requested to be retransmitted to the receiving end, the amount of retransmitted data is reduced, and the number of data is reduced. Waste of resources caused by the retransmission mechanism.
图 7为本发明一实施例提供的数据包接收装置的结构示意图。 如图 7 所示, 本实施例的数据包接收装置 7包括: 第二接收模块 71和第二处理 模块 72。 其中, 第二接收模块 71 , 用于接收发送端发送的第一数据包。 其中, 第一数据包包括第一数据包所属的消息类型和第一数据包在自身所属的 消息类型中的发包序列号。 FIG. 7 is a schematic structural diagram of a data packet receiving apparatus according to an embodiment of the present invention. As shown in FIG. 7, the data packet receiving apparatus 7 of this embodiment includes: a second receiving module 71 and a second processing module 72. The second receiving module 71 is configured to receive the first data packet sent by the sending end. The first data packet includes a message type to which the first data packet belongs and a delivery sequence number of the first data packet in a message type to which the first data packet belongs.
第二处理模块 72 , 与第二接收模块 71连接, 用于在第二接收模块 71 接收到第一数据包后, 修改收包总序列号以获取第一数据包对应的收包总 序列号, 并在确定出第二接收模块 71接收到的第一数据包未发生错误时 , 根据第一数据包所属的消息类型获取第一数据包所属的消息类型的最后 收包序列号, 并判断第一数据包所属的消息类型的最后收包序列号和第一 数据包在自身所属的消息类型中的发包序列号是否连续, 当判断结果为连 续时, 将第一数据包所属的消息类型的最后收包序列号更新为第一数据包 在自身所属的消息类型中的发包序列号。 其中, 收包总序列号为对接收的 所有消息类型的数据包进行计数得到的序列号; 第一数据包所属的消息类 型的最后收包序列号为在第一数据包之前最后接收到的与第一数据包属 于同一消息类型的数据包在自身所属的消息类型中的发包序列号。  The second processing module 72 is connected to the second receiving module 71, and configured to: after receiving the first data packet, the second receiving module 71, modify the total sequence number of the received packet to obtain the total number of the received packet corresponding to the first data packet, And determining that the first packet received by the second receiving module 71 does not generate an error, acquiring the last packet sequence number of the message type to which the first data packet belongs according to the message type to which the first data packet belongs, and determining the first Whether the last received sequence number of the message type to which the data packet belongs and whether the first data packet is consecutive in the message type of the message type to which it belongs, and when the judgment result is continuous, the last message type to which the first data packet belongs is received. The packet sequence number is updated to the packet sequence number of the first packet in the message type to which it belongs. The total sequence number of the received packet is a sequence number obtained by counting the data packets of all received message types; the last received sequence number of the message type to which the first data packet belongs is the last received before the first data packet. The first packet belongs to the packet sequence number of the packet of the same message type in the message type to which it belongs.
本实施例的数据包接收装置的各功能模块可用于执行图 3所示数据包 接收方法的流程图, 其具体工作原理不再赘述, 详见方法实施例的描述。  The function modules of the data packet receiving apparatus of this embodiment can be used to execute the flowchart of the data packet receiving method shown in FIG. 3. The specific working principle is not described here. For details, refer to the description of the method embodiment.
本实施例的数据包接收装置可以是任何具有重传机制的设备或设备 中的模块, 例如接收端也可以是服务器、 路由设备等, 也可以是 CPU中 的 QPI或互联芯片中的 QPI等。  The data packet receiving apparatus in this embodiment may be any device in the device or device having a retransmission mechanism, for example, the receiving end may also be a server, a routing device, or the like, or may be a QPI in the CPU or a QPI in the interconnect chip.
本实施例的数据包接收装置与本发明实施例提供的数据包发送装置 相配合, 在接收到数据包后对数据包进行解析, 如果能够成功解数据包, 会根据数据包中该数据包所属的消息类型和该数据包所属的消息类型中 的发包序列号确定是否丟弃该数据包, 如果不丟弃该数据包就更新该数据 包所属的消息类型的最后收包序列号, 以便于继续接收后续数据包, 如果 丟弃该数据包就相应记录该数据包在所属的消息类型中的发包序列号, 以 便于从发送端发送的数据包中区分出重传的数据包, 实现数据包的接收, 为数据包发送装置根据消息类型进行数据包的重传, 减少重传数据量, 降 低重传造成的资源消耗提供了条件。  The data packet receiving apparatus of the embodiment cooperates with the data packet sending apparatus provided by the embodiment of the present invention, and parses the data packet after receiving the data packet. If the data packet can be successfully solved, according to the data packet, the data packet belongs to The message type and the packet sequence number in the message type to which the packet belongs determine whether to discard the packet, and if the packet is not discarded, update the last packet sequence number of the message type to which the packet belongs, so as to continue Receiving a subsequent data packet, if the data packet is discarded, the packet sequence number of the data packet in the associated message type is recorded correspondingly, so as to distinguish the retransmitted data packet from the data packet sent by the sender, and implement the data packet. The receiving, for the data packet transmitting device, retransmits the data packet according to the message type, reduces the amount of retransmitted data, and reduces the resource consumption caused by the retransmission.
图 8为本发明另一实施例提供的数据包接收装置的结构示意图。 本实 施例基于图 7所示实施例实现。 如图 8所示, 本实施例的数据包接收装置 8也包括: 第二接收模块 71和第二处理模块 72 , 并且各模块也具有图 7 所示实施例描述的功能。 FIG. 8 is a schematic structural diagram of a data packet receiving apparatus according to another embodiment of the present invention. This embodiment is implemented based on the embodiment shown in FIG. As shown in FIG. 8, the data packet receiving apparatus of this embodiment 8 also includes: a second receiving module 71 and a second processing module 72, and each module also has the functions described in the embodiment shown in FIG.
进一步, 本实施例的第二处理模块 72还用于在判断结果为第一数据 包所属的消息类型的最后收包序列号和第一数据包在自身所属的消息类 型中的发包序列号不连续时, 将第一数据包在自身所属的消息类型中的发 包序列号作为重传序列号门限记录下来, 将第一数据包丟弃。  Further, the second processing module 72 of the embodiment is further configured to: when the result of the determination is that the last received sequence number of the message type to which the first data packet belongs and the initial sequence number of the first data packet in the message type to which the first data packet belongs are discontinuous When the first data packet is recorded as the retransmission sequence number threshold in the message sequence number of the message type to which the first data packet belongs, the first data packet is discarded.
进一步, 本实施例的装置还包括: 第二发送模块 73。  Further, the apparatus of this embodiment further includes: a second sending module 73.
第二发送模块 73 , 用于在第二接收模块 71接收第一数据包之前, 向 发送端发送第一重传请求。 其中, 第一重传请求包括请求重传的数据包对 应的收包总序列号; 请求重传的数据包为在第一数据包之前接收的与第一 数据包属于同一消息类型且发生错误的数据包。  The second sending module 73 is configured to send a first retransmission request to the sending end before the second receiving module 71 receives the first data packet. The first retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission; the data packet requested to be retransmitted is the same message type received before the first data packet and the error occurs. data pack.
基于此, 第二接收模块 71还用于接收发送端发送的第一重传响应。 相应地, 第二处理模块 72还用于根据发送第一重传请求之前的重传 序列号门限接收发送端在发送第一重传响应后发送的重传数据包。 其中, 重传数据包包括请求重传的数据包、 第一数据包和在请求重传的数据包和 第一数据包之间发送的与数据包属于同一消息类型的数据包。  Based on this, the second receiving module 71 is further configured to receive the first retransmission response sent by the sending end. Correspondingly, the second processing module 72 is further configured to receive, according to the retransmission sequence number threshold before sending the first retransmission request, the retransmission data packet sent by the transmitting end after sending the first retransmission response. The retransmitted data packet includes a data packet requesting retransmission, a first data packet, and a data packet that is sent between the data packet requesting retransmission and the first data packet and belongs to the same message type as the data packet.
对于第二接收模块 71来说, 还会接收发送端在发送第一重传响应后 发送的数据包。 则第二处理模块 72具体用于将发送端在发送第一重传响 应后发送的数据包在自身所属的消息类型中的发包序列号与发送第一重 传请求之前的重传序列号门限进行比较, 在发送端在发送第一重传响应后 发送的数据包在自身所属的消息类型中的发包序列号小于或等于发送第 一重传请求之前的重传序列号门限时, 将发送端在发送第一重传响应后发 送的数据包作为重传数据包。  For the second receiving module 71, the data packet sent by the transmitting end after transmitting the first retransmission response is also received. The second processing module 72 is specifically configured to: send, by the sending end, the data packet sent by the sending end after sending the first retransmission response, the sequence number of the sending packet in the message type to which the transmitting end belongs, and the retransmission sequence number threshold before sending the first retransmission request. Comparing, when the sending packet sent by the transmitting end after transmitting the first retransmission response has a packet sequence number in the message type to which it belongs is less than or equal to the retransmission sequence number threshold before the first retransmission request is sent, the transmitting end is The data packet sent after the first retransmission response is sent as a retransmission data packet.
进一步, 第二处理模块 72还用于在发送端在发送第一重传响应后发 送的数据包在自身所属的消息类型中的发包序列号大于发送第一重传请 求之前的重传序列号门限时, 更新收包总序列号获取发送端在发送第一重 传响应后发送的数据包对应的收包总序列号。  Further, the second processing module 72 is further configured to: after the sending of the first retransmission response, the data packet sent by the transmitting end in the message type to which the first packet is sent is greater than the retransmission sequence number of the packet before the first retransmission request is sent. The time limit is updated, and the total sequence number of the received packet is obtained, and the total sequence number of the packet corresponding to the data packet sent by the sender after sending the first retransmission response is obtained.
进一步, 第二发送模块 73还用于在确定出第二接收模块 71接收的第 一数据包发生错误时, 向发送端发送第二重传请求。 其中, 第二重传请求 包括第一数据包对应的收包总序列号。 相应地, 第二接收模块 71还用于在接收到发送端发送的第二重传响 应后, 接收发送端重新发送的第一数据包。 Further, the second sending module 73 is further configured to send a second retransmission request to the sending end when it is determined that the first data packet received by the second receiving module 71 is incorrect. The second retransmission request includes a total sequence number of the packet corresponding to the first data packet. Correspondingly, the second receiving module 71 is further configured to: after receiving the second retransmission response sent by the sending end, receive the first data packet retransmitted by the sending end.
更进一步, 第二处理模块 72还用于记录第一数据包对应的收包总序 列号。 则第二发送模块 73还用于在确定重新接收的第一数据包发生错误 时, 根据第二处理模块 72记录的第一数据包对应的收包总序列号重新生 成并向发送端发送第二重传请求。 可选的, 第二处理模块 72和第二发送 模块 73连接。  Further, the second processing module 72 is further configured to record a total sequence number of the packet corresponding to the first data packet. The second sending module 73 is further configured to: when determining that the re-received first data packet has an error, regenerate according to the total received sequence number corresponding to the first data packet recorded by the second processing module 72, and send the second to the sending end. Retransmit the request. Optionally, the second processing module 72 and the second sending module 73 are connected.
上述各功能模块可用于执行前述实施例提供的数据包接收方法的流 程, 其具体工作原理不再赘述。  Each of the foregoing functional modules can be used to perform the process of the data packet receiving method provided in the foregoing embodiment, and the specific working principle is not described herein.
举例说明, 当图 6B所示 QPI协议的链路层在作为接收端接收数据包 时, 其可以作为本实施例的数据包接收装置。 下面将对图 6B所示各模块 和本实施例的数据包接收装置的功能进行关联。 具体的, 图 6B所示实施 例中的接收模块 rx相当于本实施例中的第二接收模块 71 ;图 6B所示实施 例中的接收译码模块 rx— decode和系统控制模块 sys— Ctrl可以作为本实施例 中的第二处理模块 72; 图 6B所示实施例中的发送控制模块 tx— ctrl、 特殊 包生成模块 gen— sp和发送模块 tx相当于本实施例中的第二发送模块 73。 图 6B所示 QPI协议的链路层接收数据包的流程可参见图 3所示实施例或 本实施例的描述, 在此不再赘述。  For example, when the link layer of the QPI protocol shown in FIG. 6B receives a data packet as a receiving end, it can be used as the data packet receiving apparatus of this embodiment. The functions of the respective modules shown in Fig. 6B and the packet receiving apparatus of this embodiment will be described below. Specifically, the receiving module rx in the embodiment shown in FIG. 6B is equivalent to the second receiving module 71 in the embodiment; the receiving decoding module rx_decode and the system control module sys-Ctrl in the embodiment shown in FIG. 6B can be As the second processing module 72 in this embodiment, the transmission control module tx- ctrl, the special packet generation module gen-sp, and the transmission module tx in the embodiment shown in FIG. 6B are equivalent to the second transmission module 73 in this embodiment. . For the process of receiving the data packet, the link layer of the QPI protocol shown in FIG. 6B can be referred to the embodiment shown in FIG. 3 or the description of the embodiment, and details are not described herein again.
本实施例的的数据包接收装置与本发明实施例提供的数据包发送装 置相配合,在接收到数据包后对数据包进行解析,如果能够成功解数据包, 会根据数据包中该数据包所属的消息类型和该数据包所属的消息类型中 的发包序列号确定是否丟弃该数据包, 如果不丟弃该数据包就更新该数据 包所属的消息类型的最后收包序列号, 以便于继续接收后续数据包, 如果 丟弃该数据包就相应记录该数据包在所属的消息类型中的发包序列号, 以 便于从发送端发送的数据包中区分出重传的数据包, 实现数据包的接收, 而在数据包发生错误时, 通过向作为发送端的数据包发送装置发送重传请 求,为数据包发送装置根据消息类型进行数据包的重传,减少重传数据量, 降低重传造成的资源消耗提供了条件。  The data packet receiving apparatus of the embodiment cooperates with the data packet sending apparatus provided by the embodiment of the present invention, and parses the data packet after receiving the data packet. If the data packet can be successfully solved, the data packet is determined according to the data packet. The message type of the message type and the packet sequence number in the message type to which the data packet belongs determine whether to discard the data packet, and if the data packet is not discarded, update the last packet sequence number of the message type to which the data packet belongs, so as to facilitate Continue to receive subsequent data packets. If the data packet is discarded, the packet sequence number of the data packet in the associated message type is recorded correspondingly, so as to distinguish the retransmitted data packet from the data packet sent by the sender, and implement the data packet. Receiving, and when an error occurs in the data packet, by transmitting a retransmission request to the data packet transmitting apparatus as the transmitting end, the data packet transmitting apparatus performs retransmission of the data packet according to the message type, thereby reducing the amount of retransmitted data and reducing retransmission. The resource consumption provides conditions.
本领域普通技术人员可以理解: 实现上述各方法实施例的全部或部分 步骤可以通过程序指令相关的硬件来完成。 前述的程序可以存储于一计算 机可读取存储介质中。 该程序在执行时, 执行包括上述各方法实施例的步 骤; 而前述的存储介质包括: ROM、 RAM, 磁碟或者光盘等各种可以存 储程序代码的介质。 It will be understood by those skilled in the art that all or part of the steps of implementing the above method embodiments may be performed by hardware related to the program instructions. The aforementioned program can be stored in a calculation The machine can be read from the storage medium. When the program is executed, the steps including the foregoing method embodiments are performed; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而非 对其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领域的 普通技术人员应当理解: 其依然可以对前述各实施例所记载的技术方案进 行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这些修改或 者替换, 并不使相应技术方案的本质脱离本发明各实施例技术方案的范 围。  It should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art The technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the technical solutions of the embodiments of the present invention. range.

Claims

权 利 要 求 书 Claim
1、 一种数据包重传方法, 其特征在于, 包括: A data packet retransmission method, characterized in that:
接收重传请求, 所述重传请求由接收端发送, 所述重传请求包括请求 重传的数据包对应的收包总序列号;  Receiving a retransmission request, where the retransmission request is sent by the receiving end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission;
根据所述请求重传的数据包对应的收包总序列号和本地存储的发包 总序列号与每个消息类型的发包序列号之间的映射关系, 获取所述请求重 传的数据包所属的消息类型和所述请求重传的数据包在自身所属的消息 类型中的发包序列号, 所述发包总序列号为对发送的所有消息类型的数据 包进行计数得到的序列号;  Obtaining, according to a mapping relationship between a total number of received packets corresponding to the data packet retransmitted by the request and a total sequence number of the locally stored packet and a packet sequence number of each message type, acquiring the data packet to which the request retransmission belongs The message type and the sequence number of the packet to be retransmitted in the message type to which the request belongs, and the total sequence number of the packet to be sent is a sequence number obtained by counting the data packets of all message types sent;
根据所述请求重传的数据包所属的消息类型和所述请求重传的数据 包在自身所属的消息类型中的发包序列号, 向所述接收端发送所述请求重 传的数据包以及在所述请求重传的数据包之后发送的与所述请求重传的 数据包属于同一消息类型的数据包。  And sending, according to the message type to which the data packet retransmitted by the request belongs, and the packet sequence number of the data packet requested by the retransmission in the message type to which the request belongs, to the receiving end, the data packet requesting retransmission and The data packet sent after the data packet requested to be retransmitted and the request retransmitted belongs to a data packet of the same message type.
2、 根据权利要求 1所述的数据包重传方法, 其特征在于, 所述根据 所述请求重传的数据包所属的消息类型和所述请求重传的数据包在自身 所属的消息类型中的发包序列号, 向所述接收端发送所述请求重传的数据 包以及在所述请求重传的数据包之后发送的与所述请求重传的数据包属 于同一消息类型的数据包之前包括:  The data packet retransmission method according to claim 1, wherein the message type to which the data packet retransmitted according to the request belongs and the data packet to which the request is retransmitted are in a message type to which the message belongs. Sending a sequence number, sending the data packet requesting retransmission to the receiving end, and including before the data packet requesting retransmission, the data packet that belongs to the same message type as the data packet requested to be retransmitted :
判断所述请求重传的数据包所属的消息类型和前一个重传请求请求 重传的数据包所属的消息类型是否相同;  Determining whether the message type to which the request retransmitted data packet belongs is the same as the message type to which the previous retransmission request request retransmitted data packet belongs;
如果不相同, 则根据所述请求重传的数据包所属的消息类型和所述请 求重传的数据包在自身所属的消息类型中的发包序列号, 向所述接收端发 送所述请求重传的数据包以及在所述请求重传的数据包之后发送的与所 述请求重传的数据包属于同一消息类型的数据包。  If not, the request retransmission is sent to the receiving end according to the message type to which the retransmitted data packet belongs and the data packet sequence number of the request retransmitted data packet in the message type to which the request belongs. The data packet and the data packet sent after the data packet requested to be retransmitted belong to the same message type as the data packet retransmitted by the request.
3、 根据权利要求 1或 2所述的数据包重传方法, 其特征在于, 所述 根据所述请求重传的数据包所属的消息类型和所述请求重传的数据包在 自身所属的消息类型中的发包序列号, 向所述接收端发送所述请求重传的 数据包以及在所述请求重传的数据包之后发送的与所述请求重传的数据 包属于同一消息类型的数据包包括: 根据所述请求重传的数据包所属的消息类型确定所述请求重传的数 据包对应的重传緩冲器; The data packet retransmission method according to claim 1 or 2, wherein the message type to which the data packet retransmitted according to the request belongs and the message that the request retransmitted data packet belong to a packet sequence number in the type, sending, to the receiving end, the data packet requesting retransmission and the data packet sent after the data packet requested to be retransmitted and belonging to the same message type as the data packet retransmitted by the request include: Determining, according to a message type to which the data packet retransmitted by the request belongs, a retransmission buffer corresponding to the data packet requested to be retransmitted;
根据所述请求重传的数据包在自身所属的消息类型中的发包序列号, 从所述请求重传的数据包对应的重传緩冲器中获取所述请求重传的数据 包以及在所述请求重传的数据包之后发送的与所述请求重传的数据包属 于同一消息类型的数据包;  Obtaining, according to the packet sequence number of the message type to which the request is retransmitted, the data packet requesting retransmission from the retransmission buffer corresponding to the data packet that is requested to be retransmitted, and the And the data packet that is sent after the data packet that is requested to be retransmitted and that is retransmitted by the request belongs to a data packet of the same message type;
向所述接收端发送重传响应, 然后向所述接收端发送所述请求重传的 数据包以及在所述请求重传的数据包之后发送的与所述请求重传的数据 包属于同一消息类型的数据包。  Sending a retransmission response to the receiving end, and then transmitting, to the receiving end, the data packet requesting retransmission and the data packet sent after the requesting retransmitted data packet and the data packet retransmitted by the request belong to the same message Type of packet.
4、 根据权利要求 1或 2所述的数据包重传方法, 其特征在于, 所述 根据所述请求重传的数据包对应的收包总序列号和本地存储的发包总序 列号与每个消息类型的发包序列号之间的映射关系, 获取所述请求重传的 数据包所属的消息类型和所述请求重传的数据包在自身所属的消息类型 中的发包序列号包括:  The method for retransmitting a data packet according to claim 1 or 2, wherein the total sequence number of the packet corresponding to the data packet retransmitted according to the request and the total sequence number of the locally stored packet are each The mapping relationship between the message sequence numbers of the message types, the message type to which the data packet requested to be retransmitted belongs, and the packet sequence number of the data packet requested to be retransmitted in the message type to which the request belongs include:
对所述重传请求进行解析, 获取所述请求重传的数据包对应的收包总 序列号;  Parsing the retransmission request, and obtaining a total sequence number of the packet corresponding to the data packet that is requested to be retransmitted;
将所述请求重传的数据包对应的收包总序列号与本地存储的映射关 系表中的所述发包总序列号进行匹配; 所述映射关系表存储有所述发包总 序列号与每个消息类型的发包序列号之间的映射关系;  And matching the total sequence number of the packet corresponding to the data packet that is requested to be retransmitted with the total sequence number of the packet in the locally stored mapping relationship table; the mapping relationship table stores the total sequence number of the packet and each of the packets The mapping relationship between the message sequence numbers of the message types;
将匹配中的所述发包总序列号所对应的消息类型和消息类型的发包 序列号分别作为所述请求重传的数据包所属的消息类型和所述请求重传 的数据包在自身所属的消息类型中的发包序列号。  The message type corresponding to the total sequence number of the delivery packet and the delivery sequence number of the message type are respectively used as the message type to which the data packet requested to be retransmitted and the message to which the request retransmitted packet belongs. The serial number of the packet in the type.
5、 根据权利要求 1或 2所述的数据包重传方法, 其特征在于, 还包 括:  The data packet retransmission method according to claim 1 or 2, further comprising:
向所述接收端发送第一数据包, 将所述第一数据包进行緩存, 并根据 所述第一数据包所属的消息类型更新所述发包总序列号与每个消息类型 的发包序列号之间的映射关系; 所述第一数据包是首次向所述接收端发送 的数据包, 所述第一数据包包括所述第一数据包所属的消息类型和所述第 一数据包在自身所属的消息类型中的发包序列号。  Sending a first data packet to the receiving end, buffering the first data packet, and updating the total packet serial number and the sending sequence number of each message type according to the message type to which the first data packet belongs The first data packet is a data packet sent to the receiving end for the first time, and the first data packet includes a message type to which the first data packet belongs and the first data packet belongs to the first data packet. The serial number of the packet in the message type.
6、 根据权利要求 5所述的数据包重传方法, 其特征在于, 所述将所 述第一数据包进行緩存包括: 6. The data packet retransmission method according to claim 5, wherein The first data packet is cached, including:
根据所述第一数据包所属的消息类型, 将所述第一数据包緩存到所述 第一数据包对应的重传緩冲器中。  And storing, according to the message type to which the first data packet belongs, the first data packet into a retransmission buffer corresponding to the first data packet.
7、 一种数据包接收方法, 其特征在于, 包括:  7. A data packet receiving method, comprising:
接收发送端发送的第一数据包, 修改收包总序列号以获取所述第一数 据包对应的收包总序列号; 所述收包总序列号为对接收的所有消息类型的 数据包进行计数得到的序列号; 所述第一数据包包括所述第一数据包所属 的消息类型和所述第一数据包在自身所属的消息类型中的发包序列号; 当确定出所述第一数据包未发生错误时, 根据所述第一数据包所属的 消息类型获取所述第一数据包所属的消息类型的最后收包序列号, 所述第 一数据包所属的消息类型的最后收包序列号为在所述第一数据包之前最 后接收到的与所述第一数据包属于同一消息类型的数据包在自身所属的 消息类型中的发包序列号;  Receiving a first data packet sent by the sending end, and modifying a total sequence number of the received packet to obtain a total sequence number of the received packet corresponding to the first data packet; the total sequence number of the receiving packet is a data packet of all message types received Counting the obtained serial number; the first data packet includes a message type to which the first data packet belongs and a delivery sequence number of the first data packet in a message type to which the first data packet belongs; when the first data is determined Obtaining, according to the message type to which the first data packet belongs, the last received sequence number of the message type to which the first data packet belongs, and the last received sequence of the message type to which the first data packet belongs. The number of the packet sent in the message type to which the data packet of the same message type that was last received before the first data packet belongs in the message type to which the first data packet belongs;
判断所述第一数据包所属的消息类型的最后收包序列号和所述第一 数据包在自身所属的消息类型中的发包序列号是否连续;  Determining whether a last received sequence number of the message type to which the first data packet belongs and a delivery sequence number in the message type to which the first data packet belongs are consecutive;
当判断结果为所述第一数据包所属的消息类型的最后收包序列号和 所述第一数据包在自身所属的消息类型中的发包序列号连续时, 将所述第 一数据包所属的消息类型的最后收包序列号更新为所述第一数据包在自 身所属的消息类型中的发包序列号。  When the result of the judgment is that the last received sequence number of the message type to which the first data packet belongs and the delivery sequence number of the first data packet in the message type to which the first data packet belongs are consecutive, the first data packet belongs to The last received sequence number of the message type is updated to the delivery sequence number of the first data packet in the message type to which the first data packet belongs.
8、 根据权利要求 7所述的数据包接收方法, 其特征在于, 还包括: 当判断结果为所述第一数据包所属的消息类型的最后收包序列号和 所述第一数据包在自身所属的消息类型中的发包序列号不连续时, 将所述 第一数据包在自身所属的消息类型中的发包序列号作为重传序列号门限 记录下来, 将所述第一数据包丟弃。  8. The data packet receiving method according to claim 7, further comprising: when the determination result is a last received sequence number of the message type to which the first data packet belongs and the first data packet is in itself If the sequence number of the packet in the associated message type is not continuous, the packet sequence number of the first packet in the message type to which the packet belongs is recorded as a retransmission sequence number threshold, and the first packet is discarded.
9、 根据权利要求 8所述的数据包接收方法, 其特征在于, 所述接收 发送端发送的第一数据包之前包括:  The data packet receiving method according to claim 8, wherein the receiving the first data packet sent by the transmitting end comprises:
向所述发送端发送第一重传请求, 所述第一重传请求包括请求重传的 数据包对应的收包总序列号; 所述请求重传的数据包为在所述第一数据包 之前接收的与所述第一数据包属于同一消息类型且发生错误的数据包; 所述方法还包括: 接收所述发送端发送的第一重传响应, 并根据发送所述第一重传请求 之前的重传序列号门限接收所述发送端在发送所述第一重传响应后发送 的重传数据包; 所述重传数据包包括所述请求重传的数据包、 所述第一数 据包和在所述请求重传的数据包和所述第一数据包之间发送的与所述数 据包属于同一消息类型的数据包。 Sending a first retransmission request to the sending end, where the first retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission; and the data packet requested to be retransmitted is in the first data packet a previously received data packet that belongs to the same message type as the first data packet and that has an error; the method further includes: Receiving a first retransmission response sent by the sending end, and receiving retransmission data sent by the sending end after sending the first retransmission response according to a retransmission sequence number threshold before sending the first retransmission request The retransmission data packet includes the data packet requesting retransmission, the first data packet, and the data packet sent between the data packet requesting retransmission and the first data packet Packets belonging to the same message type.
10、 根据权利要求 9所述的数据包接收方法, 其特征在于, 所述根据 所述重传序列号门限接收所述发送端在发送所述第一重传响应后发送的 重传数据包包括:  The data packet receiving method according to claim 9, wherein the receiving, according to the retransmission sequence number threshold, the retransmission data packet sent by the transmitting end after sending the first retransmission response includes :
接收所述发送端在发送所述第一重传响应后发送的数据包; 将所述发送端在发送所述第一重传响应后发送的数据包在自身所属 的消息类型中的发包序列号与发送所述第一重传请求之前的重传序列号 门限进行比较;  Receiving a data packet sent by the sending end after sending the first retransmission response; sending a packet sequence number of the data packet sent by the sending end after sending the first retransmission response in a message type to which the transmitting end belongs Comparing with a retransmission sequence number threshold before sending the first retransmission request;
如果所述发送端在发送所述第一重传响应后发送的数据包在自身所 属的消息类型中的发包序列号小于或等于发送所述第一重传请求之前的 重传序列号门限, 将所述发送端在发送所述第一重传响应后发送的数据包 作为所述重传数据包。  If the sending sequence of the data packet sent by the sending end after sending the first retransmission response is less than or equal to the retransmission sequence number threshold before sending the first retransmission request, The data packet sent by the transmitting end after sending the first retransmission response is used as the retransmission data packet.
11、 一种数据包发送装置, 其特征在于, 包括:  11. A data packet transmitting apparatus, comprising:
第一接收模块, 用于接收重传请求, 所述重传请求由发送端发送, 所 述重传请求包括请求重传的数据包对应的收包总序列号;  a first receiving module, configured to receive a retransmission request, where the retransmission request is sent by a sending end, where the retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission;
第一处理模块, 用于根据所述请求重传的数据包对应的收包总序列号 和本地存储的发包总序列号与每个消息类型的发包序列号之间的映射关 系, 获取所述请求重传的数据包所属的消息类型和所述请求重传的数据包 在自身所属的消息类型中的发包序列号, 所述发包总序列号为对发送的所 有消息类型的数据包进行计数得到的序列号;  a first processing module, configured to acquire the request according to a mapping relationship between a total sequence number of the packet corresponding to the retransmitted data packet and a total sequence number of the locally stored packet and a packet sequence number of each message type. The message type to which the retransmitted data packet belongs and the sequence number of the packet to be retransmitted in the message type to which the request is retransmitted, and the total sequence number of the sent packet is obtained by counting the data packets of all the message types sent. serial number;
第一发送模块, 用于根据所述请求重传的数据包所属的消息类型和所 述请求重传的数据包在自身所属的消息类型中的发包序列号, 向所述接收 端发送所述请求重传的数据包以及在所述请求重传的数据包之后发送的 与所述请求重传的数据包属于同一消息类型的数据包。  a first sending module, configured to send the request to the receiving end according to a message type to which the data packet retransmitted according to the request belongs and a sending sequence number of the data packet requested to be retransmitted in a message type to which the request belongs The retransmitted data packet and the data packet transmitted after the requesting retransmitted data packet and the data packet retransmitted by the request belong to the same message type.
12、 根据权利要求 11所述的数据包发送装置, 其特征在于, 所述第 一处理模块还用于判断所述请求重传的数据包所属的消息类型和前一个 重传请求请求重传的数据包所属的消息类型是否相同, 在判断结果为不相 同时, 触发所述第一发送模块执行根据所述请求重传的数据包所属的消息 类型和所述请求重传的数据包在自身所属的消息类型中的发包序列号, 向 所述接收端发送所述请求重传的数据包以及在所述请求重传的数据包之 后发送的与所述请求重传的数据包属于同一消息类型的数据包的操作。 The data packet transmitting apparatus according to claim 11, wherein the first processing module is further configured to determine a message type to which the data packet requested to be retransmitted belongs and a previous one The message type of the data packet to which the retransmission request is retransmitted is the same. If the result of the determination is not the same, the first sending module is triggered to execute the message type to which the data packet retransmitted according to the request belongs and the request is heavy. Sending a sequence number of the transmitted data packet in the message type to which the packet belongs, sending the data packet requesting retransmission to the receiving end, and retransmitting the request and transmitting the data packet after the requesting retransmission The operation of a packet belonging to a packet of the same message type.
13、 根据权利要求 11或 12所述的数据包发送装置, 其特征在于, 还 包括:  The data packet transmitting apparatus according to claim 11 or 12, further comprising:
多个重传緩冲器, 用于緩存发送的数据包;  Multiple retransmission buffers for buffering transmitted data packets;
所述第一发送模块包括:  The first sending module includes:
重传控制单元, 用于根据所述请求重传的数据包所属的消息类型确定 所述请求重传的数据包对应的重传緩冲器;  a retransmission control unit, configured to determine, according to a message type to which the data packet retransmitted by the request belongs, a retransmission buffer corresponding to the data packet requested to be retransmitted;
发送控制单元, 用于根据所述请求重传的数据包在自身所属的消息类 型中的发包序列号, 从所述请求重传的数据包对应的重传緩冲器中获取所 述请求重传的数据包以及在所述请求重传的数据包之后发送的与所述请 求重传的数据包属于同一消息类型的数据包;  a sending control unit, configured to obtain, according to the packet sequence number of the message type to which the request is retransmitted, the retransmission request from the retransmission buffer corresponding to the data packet that is requested to be retransmitted a data packet and a data packet sent after the data packet requested to be retransmitted and belonging to the same message type as the data packet retransmitted by the request;
发送单元, 用于向所述接收端发送重传响应, 然后向所述接收端发送 所述请求重传的数据包以及在所述请求重传的数据包之后发送的与所述 请求重传的数据包属于同一消息类型的数据包。  a sending unit, configured to send a retransmission response to the receiving end, and then send the data packet requesting retransmission to the receiving end, and the retransmission with the request sent after the requesting retransmitted data packet Packets belong to packets of the same message type.
14、 根据权利要求 11或 12所述的数据包发送装置, 其特征在于, 所 述第一处理模块包括:  The data packet transmitting apparatus according to claim 11 or 12, wherein the first processing module comprises:
接收译码单元, 用于对所述重传请求进行解析, 获取所述请求重传的 数据包对应的收包总序列号;  a receiving decoding unit, configured to parse the retransmission request, and obtain a total sequence number of the packet corresponding to the data packet requested to be retransmitted;
系统控制单元, 用于将所述请求重传的数据包对应的收包总序列号与 本地存储的映射关系表中的所述发包总序列号进行匹配, 将匹配中的所述 发包总序列号所对应的消息类型和消息类型的发包序列号分别作为所述 请求重传的数据包所属的消息类型和所述请求重传的数据包在自身所属 的消息类型中的发包序列号; 所述映射关系表存储有所述发包总序列号与 每个消息类型的发包序列号之间的映射关系。  a system control unit, configured to match a total sequence number of the packet corresponding to the data packet that is retransmitted to the total sequence number of the packet in the locally stored mapping relationship table, and to match the total sequence number of the packet in the matching The corresponding message type and the message sequence number of the message type respectively serve as the message type to which the data packet requested to be retransmitted belongs and the packet sequence number in which the data packet requested to be retransmitted belongs in the message type to which the request belongs; The relationship table stores a mapping relationship between the total sequence number of the packet and the packet sequence number of each message type.
15、 根据权利要求 11或 12所述的数据包发送装置, 其特征在于, 所 述第一发送模块还用于向所述接收端发送第一数据包, 所述第一数据包是 首次向所述接收端发送的数据包, 所述第一数据包包括所述第一数据包所 属的消息类型和所述第一数据包在自身所属的消息类型中的发包序列号; 所述第一处理模块还用于将所述第一数据包进行緩存, 并根据所述第 一数据包所属的消息类型更新所述发包总序列号与每个消息类型的发包 序列号之间的映射关系。 The data packet transmitting apparatus according to claim 11 or 12, wherein the first sending module is further configured to send the first data packet to the receiving end, where the first data packet is a data packet sent to the receiving end for the first time, the first data packet includes a message type to which the first data packet belongs and a packet sequence number of the first data packet in a message type to which the first data packet belongs; A processing module is further configured to buffer the first data packet, and update a mapping relationship between the total packet sequence number and the packet sequence number of each message type according to the message type to which the first data packet belongs.
16、 一种数据包接收装置, 其特征在于, 包括:  16. A data packet receiving apparatus, comprising:
第二接收模块, 用于接收发送端发送的第一数据包, 所述第一数据包 包括所述第一数据包所属的消息类型和所述第一数据包在自身所属的消 息类型中的发包序列号;  a second receiving module, configured to receive a first data packet sent by the sending end, where the first data packet includes a message type to which the first data packet belongs and an outgoing packet of the first data packet in a message type to which the first data packet belongs serial number;
第二处理模块, 用于在所述第二接收模块接收到所述第一数据包后, 修改收包总序列号以获取所述第一数据包对应的收包总序列号, 在确定出 所述第一数据包未发生错误时, 根据所述第一数据包所属的消息类型获取 所述第一数据包所属的消息类型的最后收包序列号, 并判断所述第一数据 包所属的消息类型的最后收包序列号和所述第一数据包在自身所属的消 息类型中的发包序列号是否连续, 当判断结果为连续时, 将所述第一数据 包所属的消息类型的最后收包序列号更新为所述第一数据包在自身所属 的消息类型中的发包序列号; 所述收包总序列号为对接收的所有消息类型 的数据包进行计数得到的序列号; 所述第一数据包所属的消息类型的最后 收包序列号为在所述第一数据包之前最后接收到的与所述第一数据包属 于同一消息类型的数据包在自身所属的消息类型中的发包序列号。  a second processing module, configured to: after the second receiving module receives the first data packet, modify a total sequence number of the received packet to obtain a total sequence number of the packet corresponding to the first data packet, where When the error occurs in the first data packet, the last received packet sequence number of the message type to which the first data packet belongs is obtained according to the message type to which the first data packet belongs, and the message to which the first data packet belongs is determined. Whether the last received sequence number of the type and the initial sequence number of the first data packet in the message type to which the first data packet belongs are consecutive, and when the judgment result is continuous, the last packet of the message type to which the first data packet belongs is The serial number is updated to the sequence number of the packet in which the first data packet belongs in the message type to which the first data packet belongs; the total sequence number of the received packet is a sequence number obtained by counting the data packets of all received message types; The last received sequence number of the message type to which the data packet belongs is the last received data packet belonging to the same message type as the first data packet before the first data packet. SEQ ID NO contract itself belongs message types.
17、 根据权利要求 16所述的数据包接收装置, 其特征在于, 所述第 二处理模块还用于在判断结果为所述第一数据包所属的消息类型的最后 收包序列号和所述第一数据包在自身所属的消息类型中的发包序列号不 连续时, 将所述第一数据包在自身所属的消息类型中的发包序列号作为重 传序列号门限记录下来, 将所述第一数据包丟弃。  The data packet receiving apparatus according to claim 16, wherein the second processing module is further configured to: in the determination result, a last received sequence number of the message type to which the first data packet belongs, and the When the first data packet is discontinuous in the message sequence number of the message type to which the first data packet belongs, the first data packet is recorded as the retransmission sequence number threshold in the message sequence number of the message type to which the first data packet belongs, and the first data packet is recorded as the retransmission sequence number threshold. A packet is dropped.
18、 根据权利要求 17所述的数据包接收装置, 其特征在于, 还包括: 第二发送模块, 用于在所述第二接收模块接收所述第一数据包之前, 向所述发送端发送第一重传请求, 所述第一重传请求包括请求重传的数据 包对应的收包总序列号; 所述请求重传的数据包为在所述第一数据包之前 接收的与所述第一数据包属于同一消息类型且发生错误的数据包; 所述第二接收模块还用于接收到所述发送端发送的第一重传响应; 所述第二处理模块还用于根据发送所述第一重传请求之前的重传序 列号门限接收所述发送端在发送所述第一重传响应后发送的重传数据包; 所述重传数据包包括所述请求重传的数据包、 所述第一数据包和在所述请 求重传的数据包和所述第一数据包之间发送的与所述数据包属于同一消 息类型的数据包。 The data packet receiving apparatus according to claim 17, further comprising: a second sending module, configured to send, to the sending end, before the second receiving module receives the first data packet a first retransmission request, where the first retransmission request includes a total sequence number of the packet corresponding to the data packet requesting retransmission; and the data packet requested to be retransmitted is received before the first data packet and The first packet belongs to the same message type and the packet in which the error occurred; The second receiving module is further configured to receive a first retransmission response sent by the sending end, where the second processing module is further configured to receive, according to a retransmission sequence number threshold before sending the first retransmission request Transmitting a retransmission data packet sent by the transmitting end after sending the first retransmission response; the retransmission data packet includes the data packet requesting retransmission, the first data packet, and retransmission in the request A data packet transmitted between the data packet and the first data packet that belongs to the same message type as the data packet.
19、 根据权利要求 18所述的数据包接收装置, 其特征在于, 所述第 二接收模块还用于接收所述发送端在发送所述第一重传响应后发送的数 据包;  The data packet receiving apparatus according to claim 18, wherein the second receiving module is further configured to receive a data packet that is sent by the sending end after sending the first retransmission response;
所述第二处理模块具体用于将所述发送端在发送所述第一重传响应 后发送的数据包在自身所属的消息类型中的发包序列号与发送所述第一 重传请求之前的重传序列号门限进行比较, 在所述发送端在发送所述第一 重传响应后发送的数据包在自身所属的消息类型中的发包序列号小于或 等于发送所述第一重传请求之前的重传序列号门限时, 将所述发送端在发 送所述第一重传响应后发送的数据包作为所述重传数据包。  The second processing module is specifically configured to send, by the sending end, a data packet sent by the sending end after the sending the first retransmission response, a packet sequence number in a message type to which the transmitting end belongs, and before sending the first retransmission request. The retransmission sequence number threshold is compared, and the data packet sent by the sending end after sending the first retransmission response in the message type to which the UE belongs is less than or equal to the first retransmission request before sending the first retransmission request. When the sequence number threshold is retransmitted, the data packet sent by the transmitting end after transmitting the first retransmission response is used as the retransmission data packet.
PCT/CN2012/083544 2012-04-10 2012-10-26 Data packet retransmission method, data packet receiving method and device WO2013152586A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210103340.8 2012-04-10
CN201210103340.8A CN103368703B (en) 2012-04-10 2012-04-10 Data package retransmission method, data packet receiving method and device

Publications (1)

Publication Number Publication Date
WO2013152586A1 true WO2013152586A1 (en) 2013-10-17

Family

ID=49327042

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/083544 WO2013152586A1 (en) 2012-04-10 2012-10-26 Data packet retransmission method, data packet receiving method and device

Country Status (2)

Country Link
CN (1) CN103368703B (en)
WO (1) WO2013152586A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111953655B (en) * 2017-02-28 2023-03-10 华为云计算技术有限公司 Method and equipment for server to respond to request message in communication system
CN108881140A (en) * 2017-10-31 2018-11-23 北京视联动力国际信息技术有限公司 A kind of document down loading method and device based on view networking
CN111106902B (en) * 2018-10-26 2022-11-15 杭州海康威视系统技术有限公司 Data message transmission method, device, equipment and computer readable storage medium
CN111431672A (en) * 2019-01-09 2020-07-17 中兴通讯股份有限公司 Data retransmission method and device, storage medium and electronic device
CN113315664B (en) * 2021-06-16 2023-07-11 无锡江南计算技术研究所 Message processing chip verification method
CN114257350A (en) * 2021-12-31 2022-03-29 广东省教育研究院 Transmission quality optimization method, device and transmission system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080099746A (en) * 2007-05-10 2008-11-13 포스데이타 주식회사 Method and apparatus for arq feedback in wireless telecommunication system
CN101645766A (en) * 2009-09-09 2010-02-10 成都市华为赛门铁克科技有限公司 Method, device and system for realizing data packet retransmission
CN101697504A (en) * 2009-09-08 2010-04-21 杭州华三通信技术有限公司 Method and device for improving data transmission quality
CN102043752A (en) * 2010-10-06 2011-05-04 钰创科技股份有限公司 Method and apparatus for reducing the size of retransmission buffer required for immediate transmission

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100461148C (en) * 2007-07-30 2009-02-11 威盛电子股份有限公司 Data chain connecting layer of chip group and method used in processing pack
CN101222311B (en) * 2008-01-29 2010-12-08 杭州华三通信技术有限公司 Real-time packet loss recovery method, system and receiving terminal unit
CN101511013B (en) * 2009-03-26 2012-01-04 华为技术有限公司 Method, equipment and system for processing video message

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080099746A (en) * 2007-05-10 2008-11-13 포스데이타 주식회사 Method and apparatus for arq feedback in wireless telecommunication system
CN101697504A (en) * 2009-09-08 2010-04-21 杭州华三通信技术有限公司 Method and device for improving data transmission quality
CN101645766A (en) * 2009-09-09 2010-02-10 成都市华为赛门铁克科技有限公司 Method, device and system for realizing data packet retransmission
CN102043752A (en) * 2010-10-06 2011-05-04 钰创科技股份有限公司 Method and apparatus for reducing the size of retransmission buffer required for immediate transmission

Also Published As

Publication number Publication date
CN103368703A (en) 2013-10-23
CN103368703B (en) 2016-08-17

Similar Documents

Publication Publication Date Title
US11272420B2 (en) Method and apparatus for transmitting data packets using dual sequence numbers
US7895494B2 (en) Method and system for implementing H-ARQ-assisted ARQ operation
US7979768B2 (en) Method and system for implementing hybrid automatic repeat request
WO2013152586A1 (en) Data packet retransmission method, data packet receiving method and device
US8050247B2 (en) Method and apparatus for retransmitting packet in a mobile communication system, and system thereof
US8473825B2 (en) Evolved universal terrestrial radio access acknowledged mode radio link control status report for segmented protocol data units
JP5035969B2 (en) Method and apparatus for processing packet data in a wireless communication system
KR100684307B1 (en) Method for receiving arq block and computer-readable medium for recording program thereof
US9577791B2 (en) Notification by network element of packet drops
US20090319850A1 (en) Local drop control for a transmit buffer in a repeat transmission protocol device
US20060195753A1 (en) Bitmap manager, method of allocating a bitmap memory, method of generating an acknowledgement between network entities, and network entity implementing the same
WO2014092779A1 (en) Notification by network element of packet drops
BRPI0621173A2 (en) METHOD AND SYSTEM AND IMPLEMENTATION OF ARCH OPERATION ASSISTED BY H-ARQ
WO2011103836A2 (en) Data retransmission method, apparatus and system
WO2013104241A1 (en) Data retransmission method and system, multicast server and user terminal
KR101178625B1 (en) Status report triggering in wireless communication system
WO2013097642A1 (en) Data packet retransmission method and node in quick path interconnect system
WO2013159516A1 (en) Wireless side tcp data retransmission method and device
WO2011018050A1 (en) Method for transmitting data packets, method for acquiring data packets and devices thereof
WO2015066836A1 (en) Video service data transmission method, data receiving device and data transmitting device
WO2012142906A1 (en) Method and apparatus for processing harq combined storage space
WO2014186944A1 (en) Acknowledgement packet transmission method and device thereof
WO2012083762A1 (en) Data transmission method, apparatus, and system
WO2013097434A1 (en) Reliable udp link failure positioning method and device
EP1708404A1 (en) Method and apparatus for error recovery performed at the access node of a core network

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12874144

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12874144

Country of ref document: EP

Kind code of ref document: A1