Data transmission and retransmission control method and system, storage medium and electronic device

文档序号:172371 发布日期:2021-10-29 浏览:17次 中文

阅读说明:本技术 数据发送、重传控制方法及系统、存储介质及电子设备 (Data transmission and retransmission control method and system, storage medium and electronic device ) 是由 杨帆 王展 元国军 谭光明 安学军 马潇潇 康宁 马振龙 于 2021-07-15 设计创作,主要内容包括:本发明公开了一种数据发送控制方法,包括以下步骤:步骤1、发送控制模块通过系统总线模块从内存模块中读取待发送数据,并将所述待发送数据封装为网络数据包;步骤2、所述发送控制模块从元数据模块中获取缓冲区模块的当前状态来判断所述缓冲区模块的存储空间是否已满,若是,则执行步骤3;否则,执行步骤4;步骤3、根据替换算法用所述网络数据包将所述缓冲区模块的数据换出;步骤4、将所述网络数据包写入所述缓冲区模块;步骤5、将所述网络数据包推送到网络中。(The invention discloses a data transmission control method, which comprises the following steps: step 1, a sending control module reads data to be sent from a memory module through a system bus module and packages the data to be sent into a network data packet; step 2, the sending control module acquires the current state of the buffer module from the metadata module to judge whether the storage space of the buffer module is full, if yes, step 3 is executed; otherwise, executing step 4; step 3, exchanging the data of the buffer module by the network data packet according to a replacement algorithm; step 4, writing the network data packet into the buffer area module; and 5, pushing the network data packet to a network.)

1. A data transmission control method, comprising:

step 1, a sending control module reads data to be sent from a memory module through a system bus module and packages the data to be sent into a network data packet;

step 2, the sending control module acquires the current state of the buffer module from the metadata module to judge whether the storage space of the buffer module is full, if yes, step 3 is executed; otherwise, executing step 4;

step 3, exchanging the data of the buffer module by the network data packet according to a replacement algorithm;

step 4, writing the network data packet into the buffer area module;

and 5, pushing the network data packet to a network.

2. The data transmission control method according to claim 1, wherein the encapsulating the data to be transmitted into a network packet in step 1 includes:

the sending control module divides the data to be sent into a plurality of data segments, and respectively adds network packet headers to the data segments to correspondingly obtain a plurality of network data packets.

3. The data transmission control method according to claim 1, wherein the step 3 includes: and acquiring the information of the buffer area module occupied by the current connection from the metadata module, writing the new network data packet into the head of the queue of the buffer area module, covering the data of the original head of the queue, enabling the new network data packet to become the new tail of the queue, enabling the second network data packet in the original queue to become the new head of the queue, and updating the head of the queue and the tail information of the queue in the buffer area module.

4. The data transmission control method according to claim 1, wherein the step 4 includes: and writing the network data packet into the tail of the queue in the buffer area module, and updating the tail information of the queue in the buffer area module.

5. The data transmission control method according to any one of claims 1 to 4, wherein the network packet occupies the buffer module by a continuous allocation or a discrete allocation.

6. A data retransmission control method, comprising:

step 6, the receiving control module receives a timer overtime event;

and 7, acquiring buffer module information occupied by the current connection from a metadata module according to the connection information carried in the overtime event of the timer, and acquiring a sequence number M of a head network data packet in the buffer module and a sequence number N of a network data packet which is not confirmed currently.

Step 8, comparing the sequence number M of the head-of-line network data packet with the sequence number N of the unacknowledged network data packet, if M > N, executing step 9, and if M < ═ N, executing step 10;

step 9, calculating the position of the unconfirmed network data packet in a memory module according to the serial number of the unconfirmed network data packet, and reading the unconfirmed network data packet from the memory module to push the unconfirmed network data packet to the network again;

and step 10, reading the head-of-line network data packet from the buffer module and pushing the head-of-line network data packet to a network.

7. A network card device, comprising: the device comprises a buffer area module, a sending control module, a receiving control module and a metadata module;

the buffer module is used for buffering network data packets which are injected into the network but not confirmed; the sending control module is used for reading and packaging data to be sent from a memory module into the network data packet, writing the network data packet into the buffer area module and pushing the network data packet into a network; the receiving control module comprises a timer, and is used for notifying the sending control module of retransmission information generated when a timer overtime event occurs to retransmit the network data packet; the metadata module is used for using information of the network data packet to the buffer module and a starting address of the network data packet in the memory module which is not confirmed.

8. A data transmission and retransmission control system for implementing the data transmission control method according to any one of claims 1 to 5 and/or the data retransmission control method according to claim 6, comprising:

a memory module, a system bus module and the network card device of claim 7;

the memory module is used for storing data to be sent; and the sending control module reads and packages the data to be sent from the memory module into the network data packet through the system bus module, and writes the network data packet into the buffer area module.

9. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the data transmission control method according to any one of claims 1 to 5 and/or the data retransmission control method according to claim 6.

10. An electronic device, comprising: a processor and a memory, in which a computer program is stored, the computer program being executable by the processor and, when being executed by the processor, implementing a data transmission control method according to any one of claims 1 to 5 and/or a data retransmission control method according to claim 6.

Technical Field

The present invention relates to the field of network communication technologies, and in particular, to a method and a system for controlling data transmission and retransmission, a storage medium, and an electronic device.

Background

Within contemporary data centers, distributed applications carry the vast majority of core traffic, and a wide variety of distributed applications are used to meet the diverse needs of users. These applications will perform a lot of network communications during the operation process, and once packet loss occurs, the application performance will be seriously affected. Therefore, how to provide reliable network transmission guarantee for the application is a crucial issue.

At present, there are two types of methods for guaranteeing reliable network transmission: one class of algorithms for realizing data packet retransmission through software has the main advantages that a transport layer protocol can be flexibly changed and can be adapted to different network environments, but because the data retransmission process is participated in by a processor in the whole process, the retransmission delay is higher, and a large amount of processor resources can be consumed; the other type is that a data retransmission algorithm is realized on a network card chip to reduce the delay overhead of retransmission, and the main advantage is that the retransmission algorithm is realized as a specific hardware module, the processing delay is lower than that of a processor, and meanwhile, the processor does not participate in the processing of data transmission any more, so that the use efficiency of the processor can be effectively improved.

The following is an analysis of the problems that exist in two conventional dedicated hardware-based retransmission systems.

First, when the processor prepares network data to be sent, the network card sending controller reads the data from the memory, performs data packet encapsulation, and pushes the data into the network. When the data receiver receives the network data packet, a response packet is returned to inform the sender that the data has been successfully received. When the receiving controller of the sender receives a response packet, the receiving controller informs the processor that the processing of the current data packet is completed in an interrupt mode, and the memory buffer occupied by the receiving controller can be released. When the receiving controller of the sender does not receive a response packet for a period of time, it will trigger a retransmission mechanism that will retransmit the oldest sent unacknowledged data packet. The problems with such systems are as follows: when the data packet needs to be retransmitted, the network card needs to acquire data from the memory of the host through the system bus for retransmission, so that retransmission delay is increased.

Secondly, when the processor prepares network data to be sent, the network card sending controller reads the data from the memory, writes the data into the memory cache of the network card, packages the data packet, and pushes the data packet into the network, and once the data packet enters the network, the data buffer area in the memory can be released. When the data receiver receives the network data packet, a response packet is returned to inform the sender that the data has been successfully received. And when the receiving controller of the sender receives a response packet, releasing the buffer on the network card. When the receiving controller of the sender does not receive the response packet within a period of time, it will trigger a retransmission mechanism, which will read the earliest sent unacknowledged data packet from the network card internal buffer and reset the timer. The problems with such systems are as follows: the release of the buffer area on the network card depends on the arrival of the response packet, when the network delay is higher, the acknowledgement packet cannot arrive in time, and the buffer area cannot be effectively released, so that the transmission of the subsequent data packet is blocked.

Disclosure of Invention

In order to solve the above problems, it is a primary object of the present invention to provide a data transmission method, a data retransmission method, a data transmission and retransmission system, a storage medium, and an electronic device.

In order to achieve the above object, the present invention provides a data transmission method, including the steps of:

step 1, a sending control module reads data to be sent from a memory module through a system bus module and packages the data to be sent into a network data packet;

step 2, the sending control module acquires the current state of the buffer module from the metadata module to judge whether the storage space of the buffer module is full, if yes, step 3 is executed; otherwise, executing step 4;

step 3, exchanging the data of the buffer module by the network data packet according to a replacement algorithm;

step 4, writing the network data packet into the buffer area module;

and 5, pushing the network data packet to a network.

In order to achieve the above object, the present invention further provides a data retransmission method, including the following steps:

step 6, the receiving control module receives a timer overtime event;

and 7, acquiring buffer module information occupied by the current connection from a metadata module according to the connection information carried in the overtime event of the timer, and acquiring the sequence number of a head network data packet in the buffer module and the sequence number N of a network data packet which is not confirmed currently.

Step 8, the sending control module reads the head of line network data packet in the buffer module and obtains the serial number M of the head of line network data packet, compares the serial number of the head of line network data packet with the serial number of the unconfirmed network data packet, if M is greater than N, executes step 9, if M < ═ N, executes step 10;

step 9, calculating the position of the unconfirmed network data packet in the memory module according to the serial number of the unconfirmed network data packet, reading the unconfirmed network data packet from the memory module and pushing the unconfirmed network data packet to the network again;

and step 10, reading the head-of-line network data packet from the buffer module and pushing the head-of-line network data packet to a network.

In order to achieve the above object, the present invention further provides a network card device, including: the device comprises a buffer area module, a sending control module, a receiving control module and a metadata module;

the buffer module is used for buffering network data packets which are injected into the network but not confirmed; the sending control module is used for reading and packaging data to be sent from a memory module into the network data packet, writing the network data packet into the buffer area module and pushing the network data packet into a network; the receiving control module comprises a timer, and is used for notifying the sending control module of retransmission information generated when a timer overtime event occurs to retransmit the network data packet; the metadata module is used for using information of the network data packet to the buffer module and a starting address of the network data packet in the memory module which is not confirmed.

In order to achieve the above object, the present invention further provides a data transmission and retransmission system, configured to implement the above data transmission method and/or the above data retransmission method, including:

a memory module, a system bus module and the network card device;

the memory module is used for storing data to be sent; and the sending control module reads and packages the data to be sent from the memory module into the network data packet through the system bus module, and writes the network data packet into the buffer area module.

In order to achieve the above object, the present invention further provides a computer-readable storage medium storing a computer program, which when executed by a processor, implements the above-mentioned data transmission method and/or the above-mentioned data retransmission method.

In order to achieve the above object, the present invention also provides an electronic device comprising: a processor and a memory, in which a computer program is stored, the computer program being executable by the processor and being adapted to implement the above-mentioned data transmission method and/or the above-mentioned data retransmission method when the computer program is executed by the processor.

The invention has the beneficial effects that:

firstly, the network card device can still continue to send network data packets without blocking after the space of the buffer module is occupied, so that the problem of network data packet blocking caused by the fact that the space of the buffer module is occupied due to too high network delay can be effectively avoided;

secondly, data buffer areas are maintained on the network card device and in the memory module at the same time, so that if the network data packet is lost, and the network data packet is temporarily stored in the buffer area module on the network card device, the network data packet can be retransmitted as soon as possible, and retransmission delay can be effectively reduced.

The invention is described in detail below with reference to the drawings and specific examples, but the invention is not limited thereto.

Drawings

Fig. 1 is a block diagram of a data transmission and retransmission control system according to an embodiment of the present invention.

Fig. 2 is a flowchart of a data transmission control method according to an embodiment of the present invention.

Fig. 3 is a flowchart of a data retransmission control method according to an embodiment of the present invention.

Detailed Description

The invention will be described in detail with reference to the following drawings, which are provided for illustration purposes and the like:

the invention aims to solve the problem of reliable network data transmission and retransmission technology in the prior art, and provides a method and a system for accelerating reliability of data transmission and retransmission. As shown in fig. 1, the data transmission and retransmission control system 100 includes: the network card device 10 (including the buffer module 11, the sending control module 12, the receiving control module 13, and the metadata module 14), the memory module 20, and the system bus module 30. The memory module 20 includes a data buffer 21 for storing data to be transmitted, that is, network data to be transmitted.

In the embodiment of the present invention, the buffer module 11 may be a storage module independent of the memory module 20 of the host, and is located between the network card device 10 and the memory module 20 of the host, or may be a cache module attached to the network card device 19, or may be an independent newly added storage module. The buffer module 11 is used to buffer network packets that have been injected into the network but not yet acknowledged by the receiver, and when the network detects a packet loss, the buffer module 11 or the memory module 20 (the data buffer 21 to be transmitted) can retrieve data again for retransmission. In addition, the network packets of the same connection are logically managed in the buffer module 11 in the form of a queue, and the network packet queued first is injected into the network earlier than the network packet queued later. The embodiment of the present invention does not limit the way in which the queue occupies the space of the buffer module 11, and may adopt continuous allocation or discrete allocation. Unlike the buffer module in the second system in the background art, the buffer module 11 in the system according to the embodiment of the present invention has an alternative capability, that is, when the buffer space is full and new data needs to be written, the buffer module 11 may clear part of the data to obtain a new space for use.

The transmission control module 12 has a function of, when data to be transmitted needs to be transmitted in the memory module 20 of the host, acquiring data to be transmitted from the memory module 20, performing data segmentation according to the link layer maximum message transmission unit, adding a corresponding packet header to the segmented data segment, and writing the data to be transmitted into the buffer module 11. If the space of the buffer module 11 is already full, part of the data in the buffer module 11 is swapped out according to the replacement algorithm, and then the data to be sent is written into the buffer module 11 and pushed to the network. When packet loss occurs and a data packet needs to be retransmitted, the sending control module selects an appropriate network data packet from the memory module 20 of the host or the buffer module 11 of the network card device 10 for retransmission according to the metadata information in the metadata module 14. The present invention does not limit the type of network transmission protocol, and may be InfiniBand, ethernet, Fibre Channel, etc.

The receiving control module 13 is configured to process the received network data packet and detect whether a packet loss occurs during network transmission, so as to notify the sending control module to perform space release or network data packet retransmission by the buffer module 11. Which internally maintains a timer for each communication connection. In the initial state, the timer is set to an off state. The timer is activated when the transmission control module 12 pushes the network data packet to the network. The receiving control module 13 will then notify the timer to reset each time it receives an acknowledgement of a network data packet. When a timer timeout event occurs, which indicates that the receiving control module 13 has not received the acknowledgement packet for a long time, the receiving control module 13 will generate retransmission information to notify the sending control module 12 to retransmit the network data packet. If the receiving control module 13 receives a valid acknowledgement packet, which represents that a part of network data packets in the current network request have been acknowledged by the correspondent node, at this time, the receiving control module 13 will generate a completion event or interrupt to notify the processor that the processing of the network data packets is completed, notify the sending control module 12 to release the buffer module 11 for the acknowledged network data packets, and update the metadata information of the connection.

The metadata module 14, whose function is to save the current usage status of each connection to the buffer module 11. For each reliable connection, the module maintains two types of metadata information:

1. space usage information of the buffer module 11. Since the buffer module 11 on the network card device 10 is shared by a plurality of connections, the space usage of each connection to the buffer module 11 needs to be recorded, so that the sending control module 12 applies for using and releasing the space of the buffer module;

2. unacknowledged network packet information in the memory module 20 of the host. Since the network data packet in the buffer module 11 may be replaced by a newly transmitted network data packet, it is necessary to record the start address of each network data packet with unacknowledged connection in the memory module 20, so that when the transmission control module 12 cannot acquire the network data packet from the buffer module 11 of the network card device 10 for retransmission, the data for retransmission can be acquired from the memory module 20 of the host.

The system bus module 30 is used for connecting each functional module in the node, has a routing function, and can forward control information and data information between different modules in the system according to relevant bus protocol fields in a carried network data packet. The present invention is not limited to the type of system bus, and may be PCI, PCI-X, PCIe, AXI, etc.

The memory module 20 is configured to store network data to be transmitted.

The embodiment of the invention also provides a data transmission control method and a data retransmission control method, and the method can be realized by the data transmission and retransmission control system of the embodiment.

As shown in fig. 2, in the present embodiment, a data transmission control method includes:

in step S1, the transmission control module 12 reads the data to be transmitted from the memory module 20 through the system bus module 30, and encapsulates the data to be transmitted into a network data packet. The transmission control module 12 divides data to be transmitted into a plurality of data segments, and adds a network packet header to each of the plurality of data segments to obtain a plurality of network data packets correspondingly.

Step S2, the sending control module obtains the current status of the buffer module from the metadata module to determine whether the storage space of the buffer module is full, if yes, then step S3 is executed; otherwise, step S4 is executed.

And step S3, exchanging the data of the buffer module by the network data packet according to the replacement algorithm. The method comprises the steps of obtaining information of a buffer area module occupied by a current connection from a metadata module, writing a new network data packet into a queue head of the buffer area module, covering data of the original queue head, enabling the new network data packet to become a new queue tail, enabling a second network data packet in the original queue to become the new queue head, and updating information of the queue head and the queue tail in the buffer area module.

And step S4, writing the network data packet into a buffer module. And writing the network data packet into the tail of the queue in the buffer module, and updating the tail information of the queue in the buffer module.

And step S5, pushing the network data packet to the network.

As shown in fig. 3, in this embodiment, a data retransmission control method includes:

step S6, the receiving control module 13 receives the timer timeout event;

step S7, obtaining the buffer module 11 information occupied by the current connection from the metadata module 14 according to the connection information carried in the timeout event of the timer, and obtaining the sequence number of the head network packet in the buffer module 11, which is recorded as M, and the sequence number of the network packet that is not currently confirmed, which is recorded as N.

Step S8, comparing the sequence number M of the head-of-line network packet with the sequence number N of the unconfirmed network packet, if M > N, executing step S9, and if M < ═ N, executing step S10;

step S9, calculating the position of the unconfirmed network packet in the memory module 20 according to the serial number of the unconfirmed network packet, and reading the unconfirmed network packet from the memory module 20 and pushing the network packet to the network again;

and step 10, reading the head-of-line network data packet from the buffer module 11 and pushing the head-of-line network data packet into a network.

In summary, when the transmission control module 12 needs to transmit a network data packet, it first determines whether the current buffer module 11 has free space, and if so, writes the network data packet to be transmitted into the buffer module 11, and pushes the network data packet to the network; if the space of the current buffer module 11 is already full, a part of network data packets are selected from the buffer module 11 according to the connection state information stored in the metadata module 14 to be removed to release a part of space, so as to write the network data packets to be sent. When the sending control module 12 needs to retransmit the network data packet, the location of the current network data packet is determined according to the serial number of the network data packet which is not confirmed and maintained by the sending control module, and if the network data packet is located in the memory module 20 of the host, the network data packet is obtained from the memory module 20 for retransmission; if the network data packet is located in the buffer module 11, the network data packet is read and retransmitted from the buffer module 11.

The above is further illustrated by the following specific example. The data transmission and retransmission control system of the above embodiment includes: the network card device 10 (including the buffer module 11, the sending control module 12, the receiving control module 13, and the metadata module 14), the memory module 20, and the system bus module 30.

The network card device 10 includes an RDMA (Remote Direct Memory Access) network card implementation, and is a standard PCIe device;

the buffer module 11 is implemented by an on-chip Block RAM of the network card device 10, and other modules may read and write the contents of the buffer module through the high-speed AXI interface. In order to maximize the space utilization efficiency of the buffer area modules, a discrete allocation strategy is adopted for the application of the space of the buffer area modules, different buffer area modules are organized through a linked list, logically, each connected network data packet forms a queue, and each queue has own head pointer and tail pointer information. The available free buffer module information is stored via a queue, the depth of which characterizes the size of the available space of the current buffer module.

The transmission control module 12 may segment data to be transmitted, add a network packet header to the data, and retransmit the data packet when packet loss occurs. Which may be a hardware module in the network card device 10 or a piece of control program running on an embedded processor on the network card device 10. In the present embodiment, the transmission control module 12 is, for example, a hardware module;

and a reception control module 13, which can detect packet loss. Which may be a hardware module in the network card device 10 or a piece of control program running on an embedded processor on the network card device 10. In the present embodiment, the reception control module 13 is, for example, a hardware module;

the metadata module 14 is configured to store relevant metadata information of each connection, and is implemented by an on-chip Block RAM of the network card device 10, and the other modules may read and write the content of the module through the high-speed AXI interface. The metadata information stored by the metadata module 14 includes: queue head and tail pointer information for each connection, sequence number information for unacknowledged packets for each connection, and start address information for packets sent by each connection in memory module 20.

The memory module 20 is configured to store network data to be sent, and specifically, in an RDMA network, each piece of data to be sent belongs to one or more memory regions;

a system bus module 30 employing a PCIe bus;

the following is a specific embodiment of a data transmission control method for reliable transmission, which includes the following steps:

1. the sending control module 12 reads data to be sent from the data buffer area to be sent 21 of the memory module 20 through a PCIe bus (bus module 30), and encapsulates the data to be sent into RDMA network data packets, where a packet header of each RDMA network data packet carries address information, length information, and sequence number information of a communication peer;

2. the sending control module 12 initiates an AXI data read request, reads the state of the current buffer module 11 from the metadata module 14, and if the space of the buffer module 11 is full, executes step 3; otherwise, executing step 4;

3. and writing the new RDMA network data packet into the buffer pointed by the head pointer, and covering the original head-of-queue RDMA network data packet. Meanwhile, assigning a head pointer to the current tail pointer, and pointing the head pointer to the next data element pointed by the original head pointer;

4. the RDMA network packet is written to the queue tail of the buffer module 11 and the tail pointer is updated to point to the newly written RDMA network packet.

5. Pushing RDMA network packets into the network.

The following is a specific embodiment of a data retransmission control method for reliable transmission, which includes the following steps:

1. the receiving control module 13 receives the timer timeout event;

2. according to Queue Pair (QP) information (connection information) carried in the event, the information of the buffer module 11 occupied by the current connection is obtained from the metadata module 14, and a Sequence Number (PSN) of a head-of-Queue RDMA network data Packet of the buffer module 11 and a Sequence Number of an RDMA network data Packet not currently acknowledged are obtained, and retransmission control information is transmitted to the transmission control module 12.

3. The sending control module 12 receives the retransmission control information, reads the head-of-queue RDMA network packet from the buffer module 11 according to the QP information, and obtains the sequence number information thereof. The sequence number of the head-of-queue RDMA network packet is compared to the sequence number size of the unacknowledged RDMA network packet. The sequence number of the RDMA network data packet at the head of the queue is M, and the sequence number of the unacknowledged RDMA network data packet is N. If M is larger than N, turning to the step 4; if M < ═ N, turning to step 5;

4. calculating the position of the RDMA network data packet in the memory module 20 of the host according to the sequence number of the RDMA network data packet, reading the data needing to be retransmitted from the memory module 20 of the host, generating the RDMA network data packet and sending the RDMA network data packet to the network;

5. the head-of-queue RDMA network packet is read from the buffer module 11 and sent to the network.

Based on the same inventive concept, an embodiment of the present invention further provides an electronic device, in this embodiment, the electronic device includes a processor and a memory; the processor and the memory are electrically connected directly or indirectly to enable data transmission or interaction. The memory stores therein a computer program executable by the processor, and when the computer program is executed by the processor, the data transmission control method or the data retransmission control method proposed in the above embodiments is implemented.

Based on the same inventive concept, embodiments of the present invention also propose a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the data transmission control method or the data retransmission control method proposed in the above embodiments.

The present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof, and it should be understood that various changes and modifications can be effected therein by one skilled in the art without departing from the spirit and scope of the invention as defined in the appended claims.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:通信方法和通信装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类