Communication method, system, computer device, computer readable storage medium and computer program product
Patent Information
- Application Number
- CN202411728312.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2044-11-28
AI Technical Summary
[0004]基于此,有必要针对上述通信效率较低的技术问题,提供一种能够提高通信效率的通信方法、系统、计算机设备、计算机可读存储介质和计算机程序产品
[0043]上述通信方法、系统、计算机设备、计算机可读存储介质和计算机程序产品,首先,第一端向第二端传输通信报文;第二端,用于在第一端与第二端之间的收发队列对的接收队列中,不存在通信报文对应的工作队列元素的情况下,向第一端返回对应于通信报文的第一报文;然后,第一端在接收到第二端返回的第一报文的情况下,将与第二端之间的通信状态设置为第一状态;第一状态用于指示第一端暂停向第二端传输通信报文;接着,第一端在接收到第二端发送的对应于通信报文的第二报文的情况下,解除第一端的第一状态,向第二端重新传输通信报文;第二报文用于指示第一端进行重传,第二报文根据确认报文的拓展传输报文头中的保留字段得到,确认报文为第二端在成功接收通信报文的情况下返回至第一端的报文。基于上述过程的通信方法,第一端通过在接收到第二端返回的第一报文的情况下,将与第二端之间的通信状态设置为第一状态,以及,在接收到第二端发送的用于指示进行重传的第二报文的情况下,解除第一状态并进行重传,能够在不需要等待定时器超时的情况下立即进行重传,因此提高了通信效率。
Smart Images

Figure CN119520422B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a communication method, system, computer device, computer-readable storage medium, and computer program product. Background Technology
[0002] In an RDMA (Remote Direct Memory Access) network, communication between the sender and receiver is achieved through a sender-receiver queue pair (QP). During communication, if the receiver's receive queue (RQ) has no work queue element (WQE), the receiver will reply to the sender with an RNR (Recv Not Ready) NAK (Negative Acknowledgment) message. In response to the RNR NAK message, the sender will start an RNR timer and retransmit after the RNR timer expires.
[0003] Because in related technologies, the sending end needs to retransmit after the RNR timer expires, the communication efficiency is low. Summary of the Invention
[0004] Therefore, it is necessary to provide a communication method, system, computer device, computer-readable storage medium, and computer program product that can improve communication efficiency in response to the aforementioned technical problem of low communication efficiency.
[0005] In a first aspect, this application provides a communication method applied to a first end, comprising:
[0006] The second end transmits a communication message to the second end; the second end is used to return a first message corresponding to the communication message to the first end when there is no work queue element corresponding to the communication message in the receive queue of the transmit / receive queue pair between the first end and the second end.
[0007] Upon receiving the first message returned by the second end, the communication status with the second end is set to a first state; the first state is used to instruct the first end to suspend the transmission of the communication message to the second end.
[0008] Upon receiving a second message corresponding to the communication message sent by the second end, the first state of the first end is released, and the communication message is retransmitted to the second end; the second message is used to instruct the first end to retransmit, and the second message is obtained according to the reserved field in the extended transmission header of the acknowledgment message, which is the message returned by the second end to the first end when the communication message is successfully received.
[0009] In one embodiment, after setting the communication state with the second end to a first state, the method further includes:
[0010] Start the timer corresponding to the first state;
[0011] If the time corresponding to the timer is reached and the second message is not received, the communication message is retransmitted to the second end.
[0012] In one embodiment, the step of releasing the first state of the first end upon receiving a second message corresponding to the communication message sent by the second end includes:
[0013] If the time corresponding to the timer has not been reached and the second message is received, the timer and the first state of the first end are released, and the communication message is retransmitted to the second end.
[0014] Secondly, this application also provides a communication method applied to a second end, comprising:
[0015] If there is no work queue element corresponding to the communication message transmitted from the first end to the second end in the receive queue of the transmit / receive queue pair between the first end and the second end, the first message corresponding to the communication message is returned to the first end, so that the first end sets the communication status with the second end to a first state; the first state is used to instruct the first end to suspend the transmission of the communication message to the second end.
[0016] Based on the reserved fields in the extended transport header of the acknowledgment message, a second message corresponding to the communication message is obtained; the acknowledgment message is a message returned by the second end to the first end when the communication message is successfully received; the second message is used to instruct the first end to retransmit.
[0017] Send the second message to the first end to cause the first end to release the first state of the first end and retransmit the communication message to the second end.
[0018] In one embodiment, before returning the first message corresponding to the communication message to the first end, the method further includes:
[0019] Set the communication status with the first end to a second state; the second state is used to indicate that the second end is not ready to receive the message from the first end.
[0020] Sending the second message to the first end further includes:
[0021] If the communication status between the second end and the first end is in the second state, the second state of the second end is released, and the second message is sent to the first end.
[0022] In one embodiment, after sending the second message to the first end to cause the first end to release its first state and retransmit the communication message to the second end, the method further includes:
[0023] Receive the communication message retransmitted by the first end;
[0024] The acknowledgment message corresponding to the communication message is returned to the first end.
[0025] Thirdly, this application also provides a communication system, the system comprising a first end and a second end;
[0026] The first end is used to transmit communication messages to the second end;
[0027] The second end is used to return a first message corresponding to the communication message to the first end when there is no work queue element corresponding to the communication message sent by the first end in the receive queue of the transmit / receive queue pair between the first end and the second end.
[0028] The first end is further configured to, upon receiving the first message, set the communication status with the second end to a first state; the first state is configured to instruct the first end to suspend the transmission of the communication message to the second end;
[0029] The second end is further configured to obtain a second message corresponding to the communication message based on the reserved fields in the extended transmission header of the acknowledgment message, and send the second message to the first end; the acknowledgment message is a message returned by the second end to the first end when the communication message is successfully received; the second message is used to instruct the first end to retransmit;
[0030] The first end is also configured to, upon receiving the second message, release the first state of the first end and retransmit the communication message to the second end.
[0031] Fourthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0032] The second end transmits a communication message to the second end; the second end is used to return a first message corresponding to the communication message to the first end when there is no work queue element corresponding to the communication message in the receive queue of the transmit / receive queue pair between the first end and the second end.
[0033] Upon receiving the first message returned by the second end, the communication status with the second end is set to a first state; the first state is used to instruct the first end to suspend the transmission of the communication message to the second end.
[0034] Upon receiving a second message corresponding to the communication message sent by the second end, the first state of the first end is released, and the communication message is retransmitted to the second end; the second message is used to instruct the first end to retransmit, and the second message is obtained according to the reserved field in the extended transmission header of the acknowledgment message, which is the message returned by the second end to the first end when the communication message is successfully received.
[0035] Fifthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0036] The second end transmits a communication message to the second end; the second end is used to return a first message corresponding to the communication message to the first end when there is no work queue element corresponding to the communication message in the receive queue of the transmit / receive queue pair between the first end and the second end.
[0037] Upon receiving the first message returned by the second end, the communication status with the second end is set to a first state; the first state is used to instruct the first end to suspend the transmission of the communication message to the second end.
[0038] Upon receiving a second message corresponding to the communication message sent by the second end, the first state of the first end is released, and the communication message is retransmitted to the second end; the second message is used to instruct the first end to retransmit, and the second message is obtained according to the reserved field in the extended transmission header of the acknowledgment message, which is the message returned by the second end to the first end when the communication message is successfully received.
[0039] Sixthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0040] The second end transmits a communication message to the second end; the second end is used to return a first message corresponding to the communication message to the first end when there is no work queue element corresponding to the communication message in the receive queue of the transmit / receive queue pair between the first end and the second end.
[0041] Upon receiving the first message returned by the second end, the communication status with the second end is set to a first state; the first state is used to instruct the first end to suspend the transmission of the communication message to the second end.
[0042] Upon receiving a second message corresponding to the communication message sent by the second end, the first state of the first end is released, and the communication message is retransmitted to the second end; the second message is used to instruct the first end to retransmit, and the second message is obtained according to the reserved field in the extended transmission header of the acknowledgment message, which is the message returned by the second end to the first end when the communication message is successfully received.
[0043] In the aforementioned communication method, system, computer device, computer-readable storage medium, and computer program product, firstly, a first end transmits a communication message to a second end; the second end, when there is no work queue element corresponding to the communication message in the receive queue of the transmit / receive queue pair between the first and second ends, returns a first message corresponding to the communication message to the first end; then, upon receiving the first message returned by the second end, the first end sets the communication state with the second end to a first state; the first state is used to instruct the first end to suspend the transmission of communication messages to the second end; next, upon receiving a second message corresponding to the communication message sent by the second end, the first end cancels the first state and retransmits the communication message to the second end; the second message is used to instruct the first end to retransmit, and the second message is obtained from the reserved field in the extended transmission header of the acknowledgment message, which is the message returned by the second end to the first end upon successfully receiving the communication message. Based on the above process, the communication method allows the first end to set the communication state with the second end to a first state when it receives a first message returned by the second end, and to release the first state and retransmit when it receives a second message sent by the second end to indicate that retransmission is to be performed. This allows retransmission to be performed immediately without waiting for the timer to expire, thus improving communication efficiency. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a diagram illustrating the application environment of a communication method in one embodiment;
[0046] Figure 2 This is a flowchart illustrating a communication method applied to the first end in one embodiment;
[0047] Figure 3 This is a flowchart illustrating a communication method applied to the first end in another embodiment;
[0048] Figure 4 This is a flowchart illustrating a communication method applied to the second end in one embodiment;
[0049] Figure 5 This is a flowchart illustrating a communication method applied to the second end in another embodiment;
[0050] Figure 6 This is a flowchart illustrating a communication method in one embodiment;
[0051] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0053] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0054] The communication method provided in this application embodiment can be applied to, for example... Figure 1 The application environment shown is a communication system, which includes a first end and a second end, wherein the first end is the sending end in the communication process, and the second end is the receiving end in the communication process.
[0055] Specifically, both the first and second ends are servers or terminals, and can also be systems comprising servers and terminals, implemented through interaction between them. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can include virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc.
[0056] Specifically, see Figure 1 Both the first and second ends include the service side, the driver side, and the network interface card (NIC). The service side and the driver side are located in the CPU (Central Processing Unit). The service side refers to the part that runs in user space, and the driver side refers to the part that runs in kernel space; the NIC refers to an RDMA NIC.
[0057] Specifically, see Figure 1 The first end transmits a communication message to the second end. If the second end does not have a work queue element corresponding to the communication message sent by the first end in the receive queue of the transmit / receive queue pair between the first and second ends, it returns a first message corresponding to the communication message to the first end. Upon receiving the first message, the first end sets the communication state with the second end to a first state. The first state is used to instruct the first end to pause transmitting communication messages to the second end. The second end, based on the reserved fields in the extended transmit header of the acknowledgment message, obtains a second message corresponding to the communication message and sends the second message to the first end. The acknowledgment message is a message returned by the second end to the first end upon successfully receiving the communication message. The second message is used to instruct the first end to retransmit. Upon receiving the second message, the first end cancels its first state and retransmits the communication message to the second end.
[0058] In one exemplary embodiment, such as Figure 2 As shown, a communication method is provided, which can be applied to, for example... Figure 1 The following steps are used as an example of the first end of the communication system shown:
[0059] Step S202: Transmit communication messages to the second end.
[0060] In this context, the first end is the sending end in the communication process, and the second end is the receiving end. In an RDMA network, communication between the sender and receiver is achieved through transmit and receive queues (QPs). Specifically, a QP includes the send queue (SQ) of the sending end and the receive queue (RQ) of the receiving end.
[0061] The second end is used to return the first message corresponding to the communication message to the first end when there is no work queue element corresponding to the communication message in the receive queue of the send / receive queue pair between the first end and the second end.
[0062] In practical applications, the first message is the RNR NAK message.
[0063] Specifically, see Figure 1 During the communication process, the first end transmits communication messages to the second end based on the QP between the first end and the second end, and sends a transmission request SEND to the second end; upon receiving SEND, the second end prepares to obtain the WQE corresponding to the communication message from the RQ; if the second end finds that there is no WQE corresponding to the communication message in the RQ, it returns a first message RNR NAK message corresponding to the notification message to the first end to notify the first end that there is no WQE.
[0064] For specific applications, please refer to Figure 1 During the transmission of communication messages from the first end to the second end, the service side of the first end sends a work request (WR) for the communication message to the driver side of the first end. The driver side of the first end converts the WR into the corresponding WQE and fills it into the SQ. It also sends a doorbell (in the field of communication, doorbell refers to a mechanism or signal that reminds or notifies the receiver that there is data or event that needs to be processed) to the RDMA network card of the first end to notify the RDMA network card of the first end to send packets.
[0065] Next, the RDMA network card at the first end obtains the WQE from the SQ, parses the WQE, assembles the packet to obtain the communication message and writes it into the RQ, and then sends SEND to the RDMA network card at the second end.
[0066] The second-end RDMA network card receives SEND and prepares to obtain the corresponding WQE from RQ. When the second end detects that the PI (Productor Index) and CI (Customer Index) of RQ are equal, it means that there is no WQE corresponding to the communication message in RQ. Then, it returns the first message RNR NAK message corresponding to the notification message to the first-end RDMA network card.
[0067] Step S204: Upon receiving the first message returned by the second end, set the communication status with the second end to the first state.
[0068] The first state is used to indicate that the first end suspends the transmission of communication messages to the second end. In specific applications, the first state is the RNR state.
[0069] Specifically, see Figure 1 When the first end receives the first message RNR NAK message returned by the second end, it sets the communication status of the communication resources with the second end to the first state RNR state, so as to suspend the retransmission of communication messages to the second end.
[0070] For specific applications, please refer to Figure 1 The RDMA network card at the first end receives the first message RNR NAK message returned by the second end and sets the communication resources between the first end to the first state RNR state.
[0071] Step S206: Upon receiving a second message corresponding to a communication message sent by the second end, the first state of the first end is deactivated, and the communication message is retransmitted to the second end.
[0072] The second message is used to instruct the second end to be ready to receive communication messages, and then to instruct the first end to retransmit.
[0073] The second message is obtained from the reserved fields in the extended transport header of the acknowledgment message. In specific applications, the second message is an RTR (Ready To Recv) message.
[0074] In this context, the acknowledgment message indicates that the receiver has successfully received the communication message sent by the sender during the communication process. In this application, the acknowledgment message is the message returned by the second end to the first end after successfully receiving the communication message. In specific applications, the acknowledgment message is an ACK (Acknowledgment) message; the extended transport header of the acknowledgment message is AETH (ACKExtended Transport Header). In the field of communication, fields that are not currently used in data protocols, data structures, or message formats but are reserved for future expansion or functionality are called reserved fields.
[0075] Specifically, see Figure 1 After returning the first message RNR NAK message, the second end will further send the second message RTR message corresponding to the communication message to the first end; then, in response to the second message RTR message, the first end will release its first state RNR state and retransmit the communication message to the second end.
[0076] For specific applications, please refer to Figure 1 After the second end returns the first message RNR NAK message, the service side of the second end sends the WR of the second message RTR message corresponding to the communication message to the driver side of the second end. The driver side of the second end converts the WR into the corresponding WQE and fills it into RQ. Then, it sends the doorbell to the RDMA network card of the second end through the doorbell notification module in the RDMA network card of the second end to notify the RDMA network card of the second end that it can receive packets.
[0077] Then, the RDMA network card at the second end sends a second message RTR message to the first end; the RDMA network card at the first end responds to the second message RTR message, cancels the first state RNR state at the first end, and immediately retransmits communication messages to the second end after the cancellation.
[0078] In the communication process of related technologies, when there is no WQE in the RQ, the receiving end will reply to the sending end with RNR NAK. In response to the RNR NAK message, the sending end will start an RNR timer and retransmit after the RNR timer expires, resulting in low communication efficiency. In the communication method described above, firstly, the first end transmits a communication message to the second end. The second end, when there is no corresponding work queue element in the receive queue of the transmit / receive queue pair between the first and second ends, returns a first message corresponding to the communication message to the first end. Then, upon receiving the first message returned by the second end, the first end sets the communication state with the second end to a first state. The first state instructs the first end to pause transmitting communication messages to the second end. Next, upon receiving a second message corresponding to the communication message sent by the second end, the first end cancels the first state and retransmits the communication message to the second end. The second message instructs the first end to retransmit; the second message is obtained from the reserved fields in the extended transport header of the acknowledgment message, which is the message returned by the second end to the first end upon successfully receiving the communication message. Based on the above process, the communication method allows the first end to set the communication state with the second end to a first state when it receives a first message returned by the second end, and to release the first state and retransmit when it receives a second message sent by the second end to indicate that retransmission is to be performed. This allows retransmission to be performed immediately without waiting for the timer to expire, thus improving communication efficiency.
[0079] Furthermore, it should be noted that in related technologies, the first end cannot guarantee whether the second end is ready to receive communication messages during retransmission. Therefore, if the first end retransmits after the timer expires, the retransmission may fail because the second end cannot receive the communication messages, thus wasting communication resources. In the communication method described above, the first end retransmits when the second end sends a second message (RTR message). The RTR message indicates that the second end is ready to receive communication messages. Therefore, this process avoids further retransmission failures or even multiple failures, thus ensuring successful retransmission and preventing the waste of communication resources.
[0080] In an exemplary embodiment, after setting the communication state with the second end to the first state in step S204, the method further includes the following: starting a timer corresponding to the first state; and retransmitting the communication message to the second end when the timer reaches its corresponding time and no second message is received.
[0081] Specifically, see Figure 1 After the RDMA network card at the first end sets the communication state with the second end to the first state RNR state, it will also start the RNR timer corresponding to the first state RNR state. If the RNR timer expires and the RDMA network card at the first end has not yet received the second message RTR message sent by the second end, it will retransmit the communication message to the second end.
[0082] In this embodiment, if the timer expires and the second message has not been received, the first end can directly retransmit the message and transmit the communication message to the second end again.
[0083] In an exemplary embodiment, step S206 above, in the case of receiving a second message corresponding to a communication message sent by the second end, canceling the first state of the first end, specifically includes the following: if the time corresponding to the timer has not been reached and the second message has been received, cancel the timer and the first state of the first end, and retransmit the communication message to the second end.
[0084] Specifically, see Figure 1 After the RNR timer starts, if the RDMA network card at the first end receives the second message RTR message before the RNR timer expires, the RDMA network card at the first end responds to the second message RTR message, cancels the first state RNR state at the first end, and immediately retransmits the communication message to the second end.
[0085] In this embodiment, the first end can retransmit without waiting for the timer to expire by deactivating the first state and immediately retransmitting upon receiving the second message, thus improving communication efficiency.
[0086] In one exemplary embodiment, such as Figure 3 As shown, the communication method applied to the first end provided in this application further includes the following steps:
[0087] Step S302: Transmit communication messages to the second end.
[0088] Step S304: Upon receiving the first message returned by the second end, set the communication state with the second end to the first state and start the timer corresponding to the first state.
[0089] Step S306: If the time corresponding to the timer has not been reached, and a second message corresponding to the communication message is received from the second end, the timer and the first state of the first end are released, and the communication message is retransmitted to the second end.
[0090] Step S308: If the time corresponding to the timer is reached and the second message corresponding to the communication message is not received from the second end, the communication message is retransmitted to the second end.
[0091] Based on the same inventive concept, embodiments of this application also provide an application for, for example... Figure 1 The communication method for the second end of the communication system shown is similar to the implementation scheme described in the communication method applied to the first end. Therefore, the specific limitations of one or more embodiments of the communication method applied to the second end provided below can be found in the limitations of the communication method applied to the first end above, and will not be repeated here.
[0092] In one exemplary embodiment, such as Figure 4 As shown, a communication method is provided, which can be applied to, for example... Figure 1 The following steps are used as an example of the second end of the communication system shown:
[0093] In step S402, if there is no work queue element corresponding to the communication message transmitted from the first end to the second end in the receive queue of the transmit / receive queue pair between the first end and the second end, the first message corresponding to the communication message is returned to the first end so that the first end sets the communication state between the first end and the second end to the first state.
[0094] In practical applications, the first message is the RNR NAK message.
[0095] The first state is used to indicate that the first end suspends the transmission of communication messages to the second end; in specific applications, the first state is the RNR state.
[0096] Specifically, see Figure 1During the communication process, the first end transmits communication messages to the second end based on the QP between them and sends a transmission request SEND to the second end. Upon receiving SEND, the second end prepares to retrieve the WQE corresponding to the communication message from the RQ. If the second end finds that there is no WQE corresponding to the communication message in the RQ, it returns an RNR NAK message to the first end to notify that there is no WQE. In response to the first message RNR NAK message, the first end sets the communication status of the communication resources between it and the second end to the first state RNR state to suspend the retransmission of communication messages to the second end.
[0097] Step S404: Based on the reserved fields in the extended transmission header of the acknowledgment message, obtain the second message corresponding to the communication message.
[0098] In this context, the acknowledgment message indicates that the receiver has successfully received the communication message sent by the sender during the communication process. In this application, the acknowledgment message is the message returned by the second end to the first end after successfully receiving the communication message. In specific applications, the acknowledgment message is an ACK message; the extended transport header of the acknowledgment message is AETH; in the field of communication, fields that are not currently used in data protocols, data structures, or message formats but are reserved for future expansion or functionality are called reserved fields.
[0099] The second message is used to indicate that the second end is ready to receive communication messages, and then to instruct the first end to retransmit. In specific applications, the second message is an RTR message.
[0100] Specifically, see Figure 1 After returning the first message RNR NAK message, the second end fills in the reserved fields in the extended transport header AETH of the acknowledgment message ACK message to obtain the second message RTR message corresponding to the communication message.
[0101] For specific applications, please refer to Figure 1 After the second end returns the first message RNR NAK message, the service side of the second end sends the WR (Write-Out) of the second message RTR message corresponding to the communication message to the driver side of the second end. The driver side of the second end converts the WR into the corresponding WQE and fills it into the RQ. It also sends a doorbell to the RDMA network card of the second end through the doorbell notification module to notify the RDMA network card of the second end that it can receive packets. Then, the RDMA network card of the second end sends the second message RTR message to the first end.
[0102] In practical applications, the format of AETH is shown in Table 1:
[0103] Table 1. Format of AETH
[0104]
[0105] The Syndrome field indicates the corresponding message type, such as whether it is an ACK message or a NAK message.
[0106] The MSN (Message Sequence Number) field represents the sequence number of the corresponding message.
[0107] Furthermore, the format of the Syndrome field is shown in Table 2:
[0108] Table 2 Format of the Syndrome field
[0109]
[0110] Among them, reserved is the reserved field.
[0111] Table 3 shows the format of the second RTR message. The reserved fields at the second end are filled with 01000000 to obtain the second RTR message:
[0112] Table 3 Format of the Second Message RTR Message
[0113]
[0114] S406, send a second message to the first end to cause the first end to release its first state and retransmit the communication message to the second end.
[0115] Specifically, see Figure 1 The second end sends a second message RTR message corresponding to the communication message to the first end; in response to the second message RTR message, the first end cancels its first state RNR state and retransmits the communication message to the second end.
[0116] For specific applications, please refer to Figure 1 The RDMA network card at the first end responds to the second message RTR message, cancels the first state RNR state at the first end, and immediately retransmits the communication message to the second end after the cancellation.
[0117] In this embodiment, the second end can promptly inform the first end of its readiness to receive the message via the second message, thereby instructing the first end to retransmit the message immediately. This allows the first end to retransmit the communication message immediately without waiting for the timer to expire, thus improving communication efficiency.
[0118] Furthermore, it can prevent retransmissions from failing again or even failing multiple times, thus ensuring successful retransmissions and avoiding waste of communication resources.
[0119] In an exemplary embodiment, before returning the first message corresponding to the communication message to the first end in step S402 above, the following is further included: setting the communication state with the first end to a second state.
[0120] The second state is used to indicate that the second end is not ready to receive the data corresponding to the first end.
[0121] Specifically, see Figure 1 Before returning the first message RNR NAK message, the second end also needs to set the communication status of the communication resources with the first end to the second state RNR state, in order to indicate that the second end is not ready to receive the message from the first end, so as to avoid the first end from transmitting the communication message again.
[0122] For specific applications, please refer to Figure 1 If the second-end RDMA network card does not have WQE in RQ, it sets the communication resources with the first end to the second state RNR state and returns the first message RNR NAK message to the first-end RDMA network card.
[0123] In this embodiment, step S406, which involves sending a second message to the first end, further includes the following: if the communication state between the second end and the first end is in a second state, the second state of the second end is deactivated, and a second message is sent to the first end.
[0124] In practical applications, the second state is the RNR state.
[0125] Specifically, see Figure 1 Before sending the second message RTR message, the second end needs to check whether the communication status with the first end is the second state RNR state. If it is the second state RNR state, then the second end is in the second state RNR state and sends the second message RTR message to the first end.
[0126] For specific applications, please refer to Figure 1 The second-end RDMA network card detects whether the communication resources between the second end and the first end are in the second state RNR state. If so, the second state RNR state of the second end is released, and the second message RTR message is sent to the first-end RDMA network card.
[0127] In this embodiment, by setting a second state and deactivating the second state, the second end can prevent the first end from transmitting communication messages again and successfully receive communication messages transmitted by the first end again.
[0128] In an exemplary embodiment, after sending a second message to the first end in step S406 to release the first end from its first state and retransmit the communication message to the second end, the method further includes the following: receiving the retransmitted communication message from the first end; and returning an acknowledgment message corresponding to the communication message to the first end.
[0129] Specifically, after the first end retransmits the communication message to the second end, the second end successfully receives the communication message and returns an ACK message corresponding to the communication message to the first end to notify the first end that it has successfully received the communication message, thereby completing the communication between the first end and the second end regarding the communication message.
[0130] For specific applications, please refer to Figure 1 When the RDMA network card at the first end retransmits the communication message to the second end, it will also send a transmission request SEND to the second end again. When the RDMA network card at the second end receives the SEND, it will obtain the WQE corresponding to the communication message from the RQ to complete the reception, and return an ACK message to the RDMA network card at the first end.
[0131] In this embodiment, the second end can notify the first end that it has successfully received the communication message by returning an acknowledgment message after successfully receiving the communication message retransmitted by the first end, thereby completing the communication between the first end and the second end regarding the communication message.
[0132] In one exemplary embodiment, such as Figure 5 As shown, the communication method applied to the second end provided in this application further includes the following steps:
[0133] In step S502, if there is no work queue element corresponding to the communication message transmitted from the first end to the second end in the receive queue of the transmit / receive queue pair between the first end and the second end, the communication state with the first end is set to the second state, and the first message corresponding to the communication message is returned to the first end.
[0134] Step S504: Based on the reserved fields in the extended transmission header of the acknowledgment message, a second message corresponding to the communication message is obtained.
[0135] Step S506: If the communication state between the second end and the first end is in the second state, release the second state of the second end and send a second message to the first end.
[0136] Step S508: Receive the communication message retransmitted by the first end, and return an acknowledgment message corresponding to the communication message to the first end.
[0137] In one exemplary embodiment, such as Figure 6 As shown, another communication method is provided, which can be applied to, for example... Figure 1 The following steps are used as an example of the communication system shown:
[0138] Step S602: The first end transmits a communication message to the second end.
[0139] In step S604, if there is no work queue element corresponding to the communication message transmitted from the first end to the second end in the receive queue of the transmit / receive queue pair between the first end and the second end, the second end sets the communication state with the first end to the second state and returns the first message corresponding to the communication message to the first end.
[0140] Step S606: When the first end receives the first message returned by the second end, the first end sets the communication state with the second end to the first state and starts the timer corresponding to the first state.
[0141] In step S608, the second end obtains the second message corresponding to the communication message based on the reserved fields in the extended transmission header of the acknowledgment message.
[0142] In step S610, if the second end is in the second state of communication with the first end, the second end cancels the second state and sends a second message to the first end.
[0143] In step S612, if the timer has not been reached and the first end receives the second message corresponding to the communication message sent by the second end, the first end releases the timer and the first state of the first end, and retransmits the communication message to the second end.
[0144] In step S614, the second end receives the communication message retransmitted by the first end and returns an acknowledgment message corresponding to the communication message to the first end.
[0145] In this embodiment, the second end promptly informs the first end of its readiness to receive the message via a second message. Firstly, this allows the first end to be instructed to retransmit the message immediately, without waiting for the timer to expire, thus improving communication efficiency. Secondly, it avoids retransmission failures or even multiple failures, thereby ensuring successful retransmission and preventing the waste of communication resources.
[0146] To more clearly illustrate the communication method provided in the embodiments of this application, a specific embodiment is described below. However, it should be understood that the embodiments of this application are not limited thereto. In one exemplary embodiment, this application also provides a method for accelerating data transmission in RDMA in RNR state, specifically including the following:
[0147] This method is applied to, for example Figure 1The communication system shown includes a first end as a transmitter and a second end as a receiver; both the first end and the second end include a service side, a driver side, and an RDMA network card.
[0148] The second-end RDMA network card supports sending RNR NAK messages and sets the communication resources to RNR state.
[0149] Among them, the RDMA network card at the first end supports processing RNR NAK messages, starts the RNR timeout timer, and sets the communication resources to RNR state.
[0150] Among them, the driver side of the second end supports sending a doorbell when post recv (referring to the operation of the receiving end "publishing" a receive request before receiving data, indicating that it is ready to receive data and allocating a buffer for the upcoming data), to notify the RDMA network card RQ of the second end to fill WQE.
[0151] The second-end RDMA network card also supports receiving and processing doorbells sent during post-recv from the driver side.
[0152] The second-end RDMA network card also supports extending the RDMA AETH header to generate RTR packets.
[0153] The second-end RDMA network card also supports detecting whether the communication resource to which the doorbell belongs is in the RNR state when processing the doorbell. If it is not in the RNR state, the processing ends; if it is in the RNR state, it sends an RTR message to the first end to inform the first end that retransmission can be performed.
[0154] Among them, the RDMA network card at the first end also supports canceling the RNR status and RNR timeout timer when receiving an RTR message and immediately retransmitting.
[0155] See Figure 1 This method specifically includes the following steps:
[0156] 1. The first and second ends are initialized.
[0157] 2. The business side on the first end sends a WR to the driver side on the first end via POST send (meaning the sending end "publishes" a send request before sending data, indicating that the sending end has filled in the data to be sent, and at the same time specifies the content of the data and the target operation).
[0158] 3. The driver side at the first end converts WR to the corresponding WQE and fills it into SQ. Then, it sends a doorbell to the RDMA network card at the first end through the doorbell notification module in the RDMA network card at the first end, so as to notify the RDMA network card at the first end to send packets.
[0159] 4. The RDMA network card at the first end obtains the WQE from the SQ, parses the WQE, assembles the packets to obtain the communication message and writes it into the RQ, and then sends SEND to the RDMA network card at the second end.
[0160] 5. The second-end RDMA network card receives SEND.
[0161] 6. The second end prepares to obtain the corresponding WQE from RQ, and finds that PI and CI of RQ are equal, indicating that there is no WQE in RQ.
[0162] 7. The second end replies with an RNR NAK message, setting the communication resource to RNR state.
[0163] 8. When the RDMA network card at the first end receives the RNR NAK message, it starts the RNR timeout timer and sets the communication resource to the RNR state.
[0164] 9. The business side at the second end sends WR to the driver side at the second end via post recv.
[0165] 10. The driver side at the second end converts WR to the corresponding WQE and fills it into RQ. Then, it sends a doorbell to the RDMA network card at the second end through the doorbell notification module in the RDMA network card at the second end to notify the RDMA network card at the second end that it can receive packets.
[0166] 11. The RDMA network card at the second end cancels the RNR state and sends an RTR message.
[0167] 12. When the RDMA network card at the first end receives the RTR message, it cancels the RNR status and the RNR timeout timer, and immediately retransmits.
[0168] 13. Upon receiving the retransmitted SEND message, the second end processes the message and replies with an ACK message.
[0169] 14. The first and second ends complete the message transmission.
[0170] In this embodiment, firstly, by extending the AETH header of RDMA to support RTR messages, RTR messages are sent in the RNR state to inform the first end that packets can be sent immediately without waiting for the timeout timer to expire or frequently triggering retransmissions. Secondly, by eliminating the need to wait for the timeout timer, the transmission rate of RDMA in the RNR state is accelerated, improving data transmission performance.
[0171] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0172] Based on the same inventive concept, this application also provides a communication system for implementing the various communication methods described above. The solution provided by this system is similar to the implementation schemes described in the methods above; therefore, the specific limitations in one or more communication system embodiments provided below can be found in the limitations of the communication methods described above, and will not be repeated here.
[0173] In one exemplary embodiment, such as Figure 1 As shown, a communication system is provided, including: a first end and a second end, wherein:
[0174] The first end is used to transmit communication messages to the second end.
[0175] The second end is used to return the first message corresponding to the communication message to the first end when there is no work queue element corresponding to the communication message sent by the first end in the receive queue of the send / receive queue pair between the first end and the second end.
[0176] The first end is also used to set the communication status with the second end to a first state upon receiving the first message; the first state is used to instruct the first end to suspend the transmission of communication messages to the second end.
[0177] The second end is also used to obtain a second message corresponding to the communication message based on the reserved fields in the extended transmission header of the acknowledgment message, and send the second message to the first end; the acknowledgment message is a message returned by the second end to the first end when the communication message is successfully received; the second message is used to instruct the first end to retransmit.
[0178] The first end is also used to, upon receiving the second message, cancel the first state of the first end and retransmit the communication message to the second end.
[0179] In an exemplary embodiment, the first end is further configured to start a timer corresponding to the first state; and if the time corresponding to the timer is reached and no second message is received, to retransmit the communication message to the second end.
[0180] In an exemplary embodiment, the first end is further configured to release the timer and the first state of the first end and retransmit the communication message to the second end if the time corresponding to the timer has not been reached and the second message has been received.
[0181] In an exemplary embodiment, the second end is further configured to set the communication state with the first end to a second state; the second state is configured to indicate that the second end is not ready to receive from the first end; when the communication state with the first end is the second state, the second state of the second end is deactivated and a second message is sent to the first end.
[0182] In one exemplary embodiment, the second end is further configured to receive a communication message retransmitted by the first end and return an acknowledgment message corresponding to the communication message to the first end.
[0183] Each module in the aforementioned communication system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0184] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and databases. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media to run. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a communication method.
[0185] Those skilled in the art will understand that Figure 7The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0186] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0187] In one exemplary embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above-described method embodiments.
[0188] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0189] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0190] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0191] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A communication method, characterized in that, Applied to the first end, the method includes: The second end transmits a communication message to the second end; the second end is used to return a first message corresponding to the communication message to the first end when there is no work queue element WQE (WorkQueue Entry) corresponding to the communication message in the receive queue RQ (Recv Queue) of the transmit / receive queue pair between the first end and the second end. The first message is used to inform the first end that there is no work queue element WQE corresponding to the communication message in the receive queue. Upon receiving the first message returned by the second end, the communication status between the first end and the second end is set to a first state. The first state is used to instruct the first end to suspend the transmission of the communication message to the second end. The second end includes a service side, a driver side, and a network interface card (NIC). The service side is used to send a work request (WR) corresponding to the communication message to the driver side after the second end returns the first message. The driver side is used to convert the work request (WR) into a corresponding work queue element (WQE) and fill it into the receive queue (RQ). The driver side then notifies the NIC to send the second message to the first end through the notification module in the NIC. The second message is used to instruct the first end to retransmit. The second message is obtained by filling the reserved fields in the extended transport header of the acknowledgment message. The acknowledgment message is the message returned by the second end to the first end after successfully receiving the communication message. Upon receiving the second message sent by the second end, the first state of the first end is released, and the communication message is retransmitted to the second end.
2. The method according to claim 1, characterized in that, After setting the communication state with the second end to the first state, the process also includes: Start the timer corresponding to the first state; If the time corresponding to the timer is reached and the second message has not been received, the communication message is retransmitted to the second end.
3. The method according to claim 2, characterized in that, The step of releasing the first state of the first end upon receiving the second message sent by the second end includes: If the time corresponding to the timer has not been reached and the second message is received, the timer and the first state of the first end are released, and the communication message is retransmitted to the second end.
4. A communication method, characterized in that, Applied to the second end, the method includes: If there is no work queue element (WQE) in the receive queue (RQ) of the transmit / receive queue pair between the first end and the second end for the communication message transmitted from the first end to the second end, the first end returns a first message corresponding to the communication message to the first end to inform the first end that there is no work queue element (WQE) corresponding to the communication message in the receive queue, and causes the first end to set the communication status between the first end and the second end to a first state; the first state is used to instruct the first end to suspend the transmission of the communication message to the second end. Based on the filling of reserved fields in the extended transport header of the acknowledgment message, a second message corresponding to the communication message is obtained; the acknowledgment message is a message returned by the second end to the first end when the communication message is successfully received; the second message is used to instruct the first end to retransmit. Send the second message to the first end so that the first end can release the first state of the first end and retransmit the communication message to the second end; The second end includes a service side, a driver side, and a network interface card (NIC). The service side is used to send a work request (WR) corresponding to the second message to the driver side after the second end returns the first message. The driver side is used to convert the work request (WR) into a corresponding work queue element (WQE) and fill it into the receive queue (RQ). The driver side then notifies the NIC to send the second message to the first end through the notification module in the NIC.
5. The method according to claim 4, characterized in that, Before returning the first message corresponding to the communication message to the first end, the method further includes: Set the communication status with the first end to a second state; the second state is used to indicate that the second end is not ready to receive the message from the first end. Sending the second message to the first end further includes: If the communication status between the second end and the first end is in the second state, the second state of the second end is released, and the second message is sent to the first end.
6. The method according to claim 4, characterized in that, After sending the second message to the first end to cause the first end to release its first state and retransmit the communication message to the second end, the method further includes: Receive the communication message retransmitted by the first end; The acknowledgment message corresponding to the communication message is returned to the first end.
7. A communication system, characterized in that, The system includes a first end and a second end; The first end is used to transmit communication messages to the second end; The second end is used to return a first message corresponding to the communication message to the first end when there is no work queue element WQE (Work QueueEntry) corresponding to the communication message sent by the first end in the receive queue RQ (RecvQueue) of the transmit and receive queue pair between the first end and the second end. The first message is used to inform the first end that there is no work queue element WQE corresponding to the communication message in the receiving queue; The first end is further configured to, upon receiving the first message, set the communication status with the second end to a first state; the first state is configured to instruct the first end to suspend the transmission of the communication message to the second end; The second end is further configured to obtain a second message corresponding to the communication message based on filling the reserved fields in the extended transport header of the acknowledgment message, and send the second message to the first end; the acknowledgment message is a message returned by the second end to the first end when the communication message is successfully received; the second message is used to instruct the first end to retransmit; the second end includes a service side, a driver side, and a network interface card (NIC); the service side is configured to send a work request (WR) corresponding to the second message to the driver side after the second end returns the first message; the driver side is configured to convert the work request (WR) into a corresponding work queue element (WQE) and fill it into the receive queue (RQ), and notify the NIC to send the second message to the first end through the notification module in the NIC; The first end is also configured to, upon receiving the second message, release the first state of the first end and retransmit the communication message to the second end.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data transmission method, device, equipment, system and storage medium
CN118118424A
Message transmission method based on DPU network card, DPU network card, network equipment and computer storage medium
CN118555249A