Data transmission method and device, electronic equipment, storage medium and product
By splitting the target descriptor into multiple sub-descriptors and obtaining some sub-data from the host side, the problem of high data packet loss rate after DPU deployment in cloud computing servers is solved, improving the reliability of data transmission and reducing costs.
Patent Information
- Application Number
- CN202411731242.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-21
AI Technical Summary
After the cloud computing server is deployed to scale, the data packet loss rate increases, seriously affecting the reliability of data transmission.
By segmenting the target descriptor, multiple sub-descriptors are generated, and some sub-data in the target data are obtained from the host side by using these sub-descriptors, and multiple sub-data are integrated into complete target data to achieve the transmission processing of the target data.
It reduces the probability of packet loss in the DMA reception direction, improves the reliability of data transmission, saves the space of the data cache area, and reduces chip costs.
Smart Images

Figure CN119669122A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of server technology, and in particular to a method, device, electronic device, storage medium and product for data transmission. Background Art
[0002] With the rapid development of cloud computing, DPU (Data Processing Unit) has become the foundation of cloud computing; cloud computing servers have very strict requirements on network data packet loss rate. With the large-scale deployment of DPU, a large data packet loss rate seriously affects the reliability of data transmission. Summary of the invention
[0003] In view of this, the present disclosure provides a method, device, electronic device, storage medium and product for data transmission to reduce data packet loss rate.
[0004] In a first aspect, the present disclosure provides a data transmission method, applied to a network card, comprising:
[0005] Get the target descriptor for reading target data;
[0006] Splitting the target descriptor to generate multiple sub-descriptors;
[0007] Generate a corresponding read request according to the sub-descriptor, and send the read request to the host; the read request is used to obtain part of the sub-data in the target data;
[0008] Acquire sub-data corresponding to the sub-descriptor sent by the host through a data bus;
[0009] The sub-data corresponding to the plurality of sub-descriptors are integrated into the target data, and a sending process is performed on the target data.
[0010] In a second aspect, the present disclosure provides a data transmission device, applied to a network card, comprising:
[0011] A descriptor acquisition module, used for acquiring a target descriptor for reading target data;
[0012] A segmentation module, used for segmenting the target descriptor to generate multiple sub-descriptors;
[0013] A request module, used for generating a corresponding read request according to the sub-descriptor, and sending the read request to a host; the read request is used for obtaining part of the sub-data in the target data;
[0014] A data acquisition module, used for acquiring sub-data corresponding to the sub-descriptor sent by the host through a data bus;
[0015] The processing module is used to integrate the sub-data corresponding to the multiple sub-descriptors into the target data, and perform sending processing on the target data.
[0016] In a third aspect, the present disclosure provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the data transmission method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0017] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the data transmission method of the first aspect or any corresponding embodiment thereof.
[0018] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, where the computer instructions are used to enable a computer to execute the data transmission method of the above-mentioned first aspect or any corresponding embodiment thereof.
[0019] When acquiring target data, the present disclosure divides the corresponding target descriptor into a plurality of sub-descriptors, uses the plurality of sub-descriptors to acquire part of the sub-data in the target data from the host side, and then integrates the plurality of sub-data into the complete target data, thereby realizing the sending and processing of the target data. The sub-data corresponding to each sub-descriptor has a smaller data length, and when the host transmits the sub-data through the data bus, the data bus will only be occupied for a short time in the DMA sending direction, reducing the impact on the DMA receiving direction, effectively avoiding descriptor starvation caused by uneven data bus bandwidth allocation, thereby effectively reducing the probability of packet loss in the DMA receiving direction, and improving the reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 is a flowchart of a method for data transmission according to an embodiment of the present disclosure;
[0022] Figure 2 is a structural diagram of a server according to an embodiment of the present disclosure;
[0023] Figure 3 is a flowchart of another data transmission method according to an embodiment of the present disclosure;
[0024] Figure 4 is a flowchart of yet another data transmission method according to an embodiment of the present disclosure;
[0025] Figure 5 is a structural block diagram of a device for data transmission according to an embodiment of the present disclosure;
[0026] Figure 6 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.
[0028] The packet loss rate is affected by many factors. In the process of completing the embodiments of the present disclosure, the inventors found that in the process of transmitting data packets, especially data packets with large data volumes, when the network card reads data in the host memory based on DMA (Direct Memory Access), it will cause the host's PCIe bus (Peripheral Component Interconnect express, a high-speed serial computer expansion bus standard) to be occupied for a long time, causing the DMA receiving direction to be in a descriptor-starved state for a long time; that is, the DMA sending end occupies the PCIe bus, while the DMA receiving end cannot obtain the write descriptor, resulting in the inability to transmit data packets in the receiving direction, causing packet loss at the DMA receiving end.
[0029] The data transmission method provided by the embodiment of the present disclosure divides the target descriptor into multiple smaller target descriptors, and reads data based on these smaller target descriptors, thereby reducing the time that the PCIe bus is occupied and reducing the probability of packet loss at the DMA receiving end.
[0030] According to an embodiment of the present disclosure, a method embodiment of data transmission is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0031] In this embodiment, a data transmission method is provided, which can be applied to a network card of a server. Figure 1is a flowchart of a method for data transmission according to an embodiment of the present disclosure. Figure 1 As shown, the process includes the following steps.
[0032] Step S101, obtaining a target descriptor for reading target data.
[0033] In this embodiment, a certain number of descriptors can be allocated for DMA transmission, and the descriptors are specifically DMA descriptors used to manage DMA operations. When the network card needs to read data in the host memory, it needs to obtain corresponding descriptors from these descriptors so as to be able to read the required data based on the descriptors; for the convenience of description, the data to be read is called target data, and the obtained descriptors are called target descriptors.
[0034] Step S102, dividing the target descriptor into multiple sub-descriptors.
[0035] In this embodiment, the target descriptor is used to read the complete target data. If data is read directly based on the target descriptor, packet loss is likely to occur. The target descriptor is divided into multiple subdescriptors, so that each subdescriptor is used to obtain part of the target data, that is, the complete target data is not obtained at one time, which can reduce the packet loss rate. This will be described in detail later.
[0036] It can be understood that the sub-descriptor is essentially also a descriptor, but the sub-descriptor is only used to read a part of the data, that is, the sub-descriptor is used to read data with a smaller amount of data.
[0037] Step S103, generating a corresponding read request according to the sub-descriptor, and sending the read request to the host; the read request is used to obtain part of the sub-data in the target data.
[0038] In this embodiment, for the divided sub-descriptor, a corresponding read request can be generated based on the sub-descriptor, and the read request is a DMA read request; the read request is sent to the host to read a part of the target data on the host side; for the convenience of description, the data that can be read by the sub-descriptor is called sub-data, and it can be understood that the sub-data is a part of the target data.
[0039] Among them, each sub-descriptor can generate a corresponding read request, and multiple read requests are sent to the host. Each read request can obtain the corresponding sub-data in the target data, so that the network card can restore the complete target data based on the obtained sub-data.
[0040] Step S104, obtaining sub-data corresponding to the sub-descriptor sent by the host through the data bus.
[0041] In this embodiment, after receiving the read request, the host can respond to it and use its DMA controller to send the sub-data corresponding to the sub-descriptor to the network card. The host and the network card are connected via a data bus, that is, the host sends the corresponding sub-data to the network card via the data bus.
[0042] Figure 2 A schematic diagram of the server structure is shown. Figure 2 As shown, the server includes a host and a network card, and the two communicate through a data bus, which is specifically a PCIe bus.
[0043] When the host transmits data to the network card through the data bus, the data bus will be occupied. The time it is occupied is related to the length of the data transmitted and the transmission rate of the data bus. Specifically, the time t busy =L data / TPS, where L data Indicates the data length of the transmitted data, and TPS indicates the transmission rate of the data bus. Since the transmission rate TPS of the data bus is generally fixed, the data length L of the transmitted data data The larger the value, the longer the data bus will be occupied. busy Also longer.
[0044] For example, if the data bus transmission rate is 100Gbit / s, and the data length of the target data is 68Kbyte (i.e., 544Kbit), when the host directly transmits the complete target data through the data bus, the data bus is occupied for a time t busy It is 68KByte / (100Gbit / s), which is about 5μs (microseconds). That is, within 5μs, the host's data bus clock is occupied by the DMA sending direction. In this scenario, it is very easy to cause the DMA receiving direction to be in a descriptor starvation state, and it cannot be supplied for 5μs, which will cause packet loss at the DMA receiving end.
[0045] In this embodiment, by dividing the target descriptor into multiple smaller sub-descriptors, the sub-data transmitted by the host through the data bus is made smaller, so as to shorten the time of occupying the data bus. For example, if the data length of the sub-data is 4Kbyte (i.e. 32Kbit); when the host transmits the sub-data through the data bus, the time t that the data bus is occupied is busy4KByte / (100Gbit / s), which is about 0.3μs, that is, the time the data bus is occupied by the DMA transmitter is about 0.3μs. When the host transmits 4Kbyte sub-data to the network card through the data bus, if the data is also received in the receiving direction, the DMA receiver only needs to wait for 0.3μs at most, which effectively avoids the problem of descriptor starvation in the DMA receiving direction, thereby reducing the probability of packet loss.
[0046] Step S105 , integrating the sub-data corresponding to the multiple sub-descriptors into target data, and performing a sending process on the target data.
[0047] In this embodiment, after the network card sends read requests for multiple subdescriptors to the host, the host can respond to these read requests in sequence, thereby sending the sub-data corresponding to each subdescriptor to the network card in sequence. After obtaining the sub-data corresponding to each subdescriptor, the network card can integrate all the sub-data to obtain complete target data, and then perform sending processing on the target data, that is, send the target data externally. Figure 2 As shown, the network card can send the target data to a downstream module, which is a device that needs to receive the target data, and can be, for example, a network card of another server.
[0048] The data transmission method provided in this embodiment divides the corresponding target descriptor into multiple sub-descriptors when acquiring target data, uses the multiple sub-descriptors to acquire part of the sub-data in the target data from the host side, and then integrates the multiple sub-data into complete target data, thereby realizing the sending and processing of the target data. The sub-data corresponding to each sub-descriptor has a smaller data length. When the host transmits the sub-data through the data bus, it will only occupy the data bus for a short time in the DMA sending direction, reducing the impact on the DMA receiving direction, effectively avoiding descriptor starvation caused by uneven distribution of data bus bandwidth, thereby effectively reducing the probability of packet loss in the DMA receiving direction and improving the reliability of data transmission.
[0049] In this embodiment, another data transmission method is provided, which can be applied to the network card of the server. Figure 3 is a flowchart of a method for data transmission according to an embodiment of the present disclosure. Figure 3 As shown, the process includes the following steps.
[0050] Step S301, pre-configure a data cache area.
[0051] In this embodiment, a data buffer area (Data Buffer) for DMA operation is pre-configured, and the data buffer area is used to cache data to be sent during the sending process, such as target data.
[0052] In some optional implementations, the above step S301 "pre-configure data cache area" may specifically include the following steps a1 to a2.
[0053] Step a1, predetermine the total data length that can be transmitted by the network card in the process of acquiring target data.
[0054] Step a2, configuring a data buffer area according to the total data length; the space size of the data buffer area is not less than the total data length.
[0055] In this embodiment, in order to ensure that the network card can continuously send data to the downstream module in a streaming manner, a data buffer area of a certain size needs to be allocated, and the data buffer area is the on-chip buffer of the network card chip. The data length of the target data can be predetermined; for example, the data length of the data sent by the network card can be fixed. Based on the data length of the target data, the total time required for the network card to obtain the target data can be determined.
[0056] Among them, the process of the network card obtaining the target data refers to the process from the network card initiating a read request to the network card receiving the complete target data. This process can specifically include three parts: the host response process, the data bus transmission process and the network card receiving data process.
[0057] Specifically, the host needs a certain response time t1 to respond to the read request, and the response time t1 is about 1 μs. The transmission time t2 of the data bus to transmit data is related to the data length of the transmitted data and the transmission rate of the data bus; busy Similarly, the transmission duration t2 = L data / TPS, where L data Indicates the data length of the transmitted data, and TPS indicates the transmission rate of the data bus. The process of the network card receiving data requires a certain receiving time t3, which is related to the data length L of the transmitted data. data , the bus width BW of the network card chip is related to the clock cycle T, and the receiving time t3 = (L data / BW)*T. Accordingly, the total time required for the network card to obtain the target data is: t1+t2+t3.
[0058] If the transmission rate of the network card to send data is Tx, then within the total time, the total data length Cal_buffer that the network card can transmit is: Cal_buffer = (t1+t2+t3)*Tx.
[0059] The network card cannot send data continuously to the downstream module in a streaming manner. It is necessary to ensure that the data buffer has enough data to send to the downstream module during the process of the network card acquiring the target data. Therefore, the space size of the buffer is set to be no less than the total data length Cal_buffer, so that data can be sent to the downstream module all the time during the process of the network card acquiring the target data.
[0060] Optionally, in order to enable the data buffer area to cache the complete target data, the space size of the data buffer area is an integer multiple of the data length of the target data. Specifically, the space size of the data buffer area can be: the minimum integer multiple of the data length of the target data, and it is not less than the total data length.
[0061] In this embodiment, since the network card divides the descriptor, the transmission time t2 of the data bus data transmission is shortened, thereby making the total data length Cal_buffer, which can reduce the space size of the data buffer area, thereby saving on-chip buffer space. This will be further explained later.
[0062] Step S302, obtaining a target descriptor for reading target data.
[0063] For details, see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0064] Step S303, dividing the target descriptor into multiple sub-descriptors.
[0065] In this embodiment, the target descriptor specifically includes a descriptor length, and the descriptor length is used to indicate the data length of the target data; for example, if the data length of the target data is 68 Kbyte, then the descriptor length of the target descriptor is also 68 Kbyte.
[0066] Furthermore, the above step S303 "segmenting the target descriptor to generate multiple sub-descriptors" may specifically include:
[0067] Step S3031 , dividing the target descriptor into a plurality of sub-descriptors according to a preset segmentation length; the sub-descriptor includes a descriptor length consistent with the segmentation length.
[0068] In this embodiment, a length for segmenting the descriptor, namely, a segmentation length, is preset. When segmenting the target descriptor, segmentation is performed based on the segmentation length to segment the target descriptor into a plurality of sub-descriptors whose descriptor length is the segmentation length.
[0069] For example, if the segmentation length is 4 Kbyte and the descriptor length of the target descriptor is 68 Kbyte, the target descriptor can be segmented into 17 sub-descriptors by segmenting with 4 Kbyte as the granularity, thus forming 17 read requests in total.
[0070] In some optional implementations, the method may further include the following steps b1 to b2.
[0071] Step b1, determining whether the descriptor length of the target descriptor exceeds a preset length; the preset length is not less than the segmentation length.
[0072] Step b2: when the descriptor length of the target descriptor exceeds a preset length, executing a step of segmenting the target descriptor.
[0073] In this embodiment, a preset length not less than the segmentation length is set; for example, if the segmentation length is 4Kbyte, the preset length may be set to 4Kbyte, 8Kbyte, etc. If the descriptor length of the target descriptor exceeds the preset length, it means that the data length of the target data is small, and the descriptor starvation problem is not likely to occur even if it is not segmented, so the target descriptor may not be segmented at this time. On the contrary, if the descriptor length of the target descriptor exceeds the preset length, in order to avoid a high packet loss rate, the target descriptor needs to be segmented, that is, the process of "segmenting the target descriptor" shown in the above step S303 is executed.
[0074] Optionally, the segmentation length may be a preset fixed value, for example, the segmentation length is 4Kbyte; or, the segmentation length may also satisfy the following conditions.
[0075] When the data length of the target data is greater than the data length that the network card can transmit within the preset time, the segmentation length shall not exceed: the difference between the data length of the target data and the data length that the network card can transmit within the preset time. The preset time is the sum of the response time of the host responding to the read request and the time the network card receives the target data from the data bus.
[0076] When n times the data length of the target data is less than the data length that the network card can transmit within the preset time, and n+1 times the data length of the target data is greater than the data length that the network card can transmit within the preset time, the segmentation length shall not exceed: n+1 times the data length of the target data and the difference between the data length that the network card can transmit within the preset time; n is a positive integer, that is, n=1, 2,….
[0077] In this embodiment, as described above, the host needs a certain response time t1 to respond to the read request, and the response time t1 is about 1 μs. In addition, the network card also needs a certain time to receive the complete target data from the data bus, that is, the above-mentioned receiving time t3.
[0078] In addition, the target descriptor is divided into multiple sub-descriptors, and only a smaller amount of sub-data needs to be obtained each time; at this time, the host transmits the sub-data through the data bus for a transmission time t2, which is the same as the above-mentioned data bus occupancy time t busy Similarly, the transmission duration t2 = L data / TPS, at this time, L data Specifically, it is the data length of the sub-data, that is, the segmentation length. Although the data bus needs to transmit multiple sub-data in sequence, the process of the data bus transmitting the sub-data and the process of the network card receiving each sub-data can be executed synchronously, so the total time required for the network card to obtain the target data can still be expressed as t1+t2+t3. At this time, the transmission time t2 is specifically the time required for the data bus to transmit the sub-data of the segmentation length.
[0079] In this embodiment, when setting the data buffer area, if the space size of the data buffer area needs to be set to the minimum integer multiple of the data length of the target data, a suitable integer n can be determined so that: n*L<(t1+t2+t3)*Tx≤(n+1)*L. Wherein, L represents the data length of the target data.
[0080] The sum of the host's response time t1 to the read request and the time t3 for the network card to receive the target data from the data bus is taken as the preset time, that is, the preset time is: t1+t3. The length of data that the network card can transmit within the preset time is (t1+t3)*Tx; in general, the transmission rate Tx of the network card is consistent with the transmission rate TPS of the data bus, so t2*Tx can represent the data length of the sub-data, that is, the slice length. Therefore, the slice length cannot exceed (n+1)*L-(t1+t3)*Tx, that is, the segmentation length does not exceed: n+1 times the data length of the target data, and the difference between the length of data that the network card can transmit within the preset time.
[0081] Among them, when n in the above formula is 0, it is equivalent to that the data length L of the target data is greater than the data length (t1+t3)*Tx that the network card can transmit within the preset time, which will not be repeated here.
[0082] In this embodiment, when the data length L of the target data is constant, since the response time t1 of the host responding to the read request and the time t3 of the network card receiving the target data from the data bus are relatively fixed, that is, the preset time is fixed, at this time, setting the segmentation length under the above-mentioned restrictions can set the size of the data cache area to (n+1)*L, which can effectively reduce the size of the data cache area.
[0083] For example, assuming that the data bus transmission rate is 100 Gbit / s, the data length of the target data is 68 Kbyte, the bus width BW of the network card chip is 64 Byte, the clock cycle T is 3.8 ns (the inverse of the main frequency), and the transmission rate of the network card sending data is also 100 Gbit / s. Among them, the response time t1 is 1 μs.
[0084] If the network card obtains the complete target data at one time, that is, the descriptor is not split, the transmission time of the data bus is t2 = 68KByte / (100Gbit / s), which is about 5μs. The reception time of the network card is t3 = (68KByte / 64Byte)*3.8ns, which is about 4μs. Therefore, the total data length Cal_buffer that the network card can transmit is about (1μs+5μs+4μs)*100Gbit=1Mbit.
[0085] Since the total data length Cal_buffer>68Kbyte, and Cal_buffer<2*68Kbyte, therefore, among the "integer multiples of the data length of the target data" that is not less than the total data length Cal_buffer, twice the data length of the target data is the smallest, so twice the data length of the target data is used as the space size of the data buffer area, that is, the space size of the data buffer area is: 2*68Kbyte=136Kbyte.
[0086] In this embodiment, if the segmentation length is 4Kbyte, that is, the data length of the sub-data is 4Kbyte; when the host transmits the sub-data through the data bus, the transmission time t2 of the data bus to transmit the sub-data is 4KByte / (100Gbit / s), which is about 0.3μs. Therefore, the total data length Cal_buffer that the network card can transmit is about (1μs+0.3μs+4μs)*100Gbit, which is about 0.53Mbit. Since the data length of the target message is 64Kbyte, which is greater than the total data length Cal_buffer (i.e. 0.53Mbit) at this time, therefore, the space size of the data buffer area can be set to double the data length of the target message, that is, the space size of the data buffer area is: 68Kbyte.
[0087] Therefore, by dividing the target descriptor by a suitable division length, a smaller data buffer area can be used, thereby saving on-chip buffer resources.
[0088] Step S304, generating a corresponding read request according to the sub-descriptor, and sending the read request to the host; the read request is used to obtain part of the sub-data in the target data.
[0089] For details, see Figure 1Step S103 of the illustrated embodiment will not be described in detail here.
[0090] In some optional embodiments, the method may further include: determining whether the remaining space of the data cache area is greater than the descriptor length of the subdescriptor; and sending a read request to the host if the remaining space of the data cache area is greater than the descriptor length of the subdescriptor.
[0091] In this embodiment, when it is necessary to initiate a read request to the host, in order to avoid insufficient cache space for the read data, it is possible to first determine whether the remaining space in the data cache area is greater than the descriptor length of the sub-descriptor; if the remaining space in the data cache area is greater than the descriptor length of the sub-descriptor, a read request can be initiated to the host, that is, the above-mentioned step S304 process is executed.
[0092] It can be understood that since there are multiple read requests and the network card generally needs to send multiple different target data continuously, the above steps can be executed in a loop.
[0093] Step S305, obtaining the sub-data corresponding to the sub-descriptor sent by the host through the data bus.
[0094] For details, see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0095] Step S306: Integrate the sub-data corresponding to the multiple sub-descriptors into target data, and perform sending processing on the target data.
[0096] For details, see Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.
[0097] Figure 4 The figure shows an interactive diagram of the network card reading target data from the host side. The network card includes a DMA reading module and a DMA receiving module. Taking the sending of a 68Kbyte message as an example, the network card divides the message according to the 4Kbyte granularity, that is, the length of the division is 4Kbyte; Figure 4 As shown, the process includes steps S401 to S407.
[0098] Step S401: the DAM reading module of the network card obtains the target descriptor of the target data.
[0099] Step S402: the DAM reading module divides the target descriptor into 4Kbytes to generate 17 sub-descriptors.
[0100] Step S403, the DAM read module determines whether the remaining space in the data buffer is greater than the descriptor length of the subdescriptor; if so, a corresponding read request is sent to the host. At this time, it is determined whether the remaining space in the data buffer is sufficient, and if so, a corresponding read request is sent to the host.
[0101] Among them, 17 read requests are sent sequentially.
[0102] Step S404: After receiving the read request, the host sends the corresponding sub-data to the PCIe bus after a certain response time t1.
[0103] For example, the host generates a slice message of 4Kbyte size, and the slice message includes corresponding sub-data. In this embodiment, t1≈1μs.
[0104] Step S405: The PCIe bus needs a certain transmission time t2 to receive the sub-data and send the sub-data to the DMA receiving module of the network card.
[0105] A TLP (Transaction Layer Packet) adaptor response module (TLP adaptor rsp) may be provided to receive a 4Kbyte slice message sent by the host based on the TLP adaptor response module. In this embodiment, t2 = 4KByte / (100Gbit / s), which is approximately 0.3μs.
[0106] When a complete slice message is received, it is sent to the DMA receiving module of the network card.
[0107] Step S406: The DMA receiving module needs a certain receiving time t3 to receive each sub-data.
[0108] In this embodiment, t3 = (68 KByte / 64 Byte)*3.8 ns, which is approximately 4 μs.
[0109] In step S407 , the DMA receiving module integrates the multiple sub-data into complete target data, and sends the target data to the downstream module.
[0110] The data transmission method provided in this embodiment divides the target descriptor into multiple sub-descriptors. When the host transmits the sub-data through the data bus, the data bus will only be occupied for a short time in the DMA sending direction. For example, the data bus is occupied for about 0.3μs, which can effectively avoid the problem of descriptor starvation caused by uneven distribution of data bus bandwidth, reduce the probability of packet loss in the DMA receiving direction, and improve the reliability of data transmission. In addition, by adopting a suitable slice length, a smaller data cache area can be used, which can save on-chip cache resources, reduce the specifications of the chip on-chip cache, and reduce chip costs.
[0111] In the present embodiment, a device for data transmission is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0112] This embodiment provides a data transmission device, which is applied to a network card, such as Figure 5 As shown, including:
[0113] A descriptor acquisition module 501 is used to acquire a target descriptor for reading target data;
[0114] A segmentation module 502, used for segmenting the target descriptor to generate a plurality of sub-descriptors;
[0115] The request module 503 is used to generate a corresponding read request according to the sub-descriptor and send the read request to the host; the read request is used to obtain part of the sub-data in the target data;
[0116] A data acquisition module 504, used for acquiring sub-data corresponding to the sub-descriptor sent by the host through a data bus;
[0117] The processing module 505 is used to integrate the sub-data corresponding to the multiple sub-descriptors into the target data, and perform sending processing on the target data.
[0118] In some optional embodiments, the target descriptor includes a descriptor length;
[0119] The segmentation module 502 segments the target descriptor to generate a plurality of sub-descriptors, including:
[0120] According to a preset segmentation length, the target descriptor is segmented into a plurality of sub-descriptors; the sub-descriptors include a descriptor length consistent with the segmentation length.
[0121] In some optional implementations, the segmentation module 502 is further configured to:
[0122] Determine whether the descriptor length of the target descriptor exceeds a preset length; the preset length is not less than the segmentation length;
[0123] When the descriptor length of the target descriptor exceeds a preset length, the step of segmenting the target descriptor is performed.
[0124] In some optional implementations, the request module 503 is further configured to:
[0125] Determine whether the remaining space of the data buffer is greater than the descriptor length of the subdescriptor;
[0126] The step of sending the read request to the host when the remaining space of the data buffer area is greater than the descriptor length of the subdescriptor.
[0127] In some optional implementations, the device further includes a configuration module, configured to:
[0128] Predetermining the total data length that can be transmitted by the network card in the process of acquiring the target data;
[0129] The data buffer area is configured according to the total data length; the space size of the data buffer area is not less than the total data length.
[0130] In some optional implementations, the space size of the data cache area is an integer multiple of the data length of the target data.
[0131] In some optional implementations, when the data length of the target data is greater than the data length that the network card can transmit within a preset time, the segmentation length does not exceed: the difference between the data length of the target data and the data length that the network card can transmit within a preset time; the preset time is the sum of the response time of the host responding to the read request and the time the network card receives the target data from the data bus;
[0132] When n times the data length of the target data is smaller than the data length that the network card can transmit within the preset time length, and n+1 times the data length of the target data is larger than the data length that the network card can transmit within the preset time length, the segmentation length shall not exceed: the difference between n+1 times the data length of the target data and the data length that the network card can transmit within the preset time length; n is a positive integer.
[0133] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0134] The data transmission device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, including a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0135] The present disclosure also provides an electronic device having the above Figure 5 The data transmission device is shown.
[0136] See also Figure 6 , Figure 6 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present disclosure, such as Figure 6 As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0137] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0138] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0139] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0140] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0141] The electronic device further comprises a communication interface 30 for the electronic device to communicate with other devices or a communication network.
[0142] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0143] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0144] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for data transmission, characterized in that: Applied to a network card, the method comprises: Get the target descriptor for reading target data; Splitting the target descriptor to generate multiple sub-descriptors; Generate a corresponding read request according to the sub-descriptor, and send the read request to the host; the read request is used to obtain part of the sub-data in the target data; Acquire sub-data corresponding to the sub-descriptor sent by the host through a data bus; The sub-data corresponding to the plurality of sub-descriptors are integrated into the target data, and a sending process is performed on the target data.
2. The method according to claim 1, characterized in that The target descriptor includes a descriptor length; The target descriptor is segmented to generate a plurality of sub-descriptors, including: According to a preset segmentation length, the target descriptor is segmented into a plurality of sub-descriptors; The subdescriptor includes a descriptor length that is consistent with the segmentation length.
3. The method according to claim 2, characterized in that Also includes: Determining whether the descriptor length of the target descriptor exceeds a preset length; The preset length is not less than the cutting length; When the descriptor length of the target descriptor exceeds a preset length, the step of segmenting the target descriptor is performed.
4. The method according to claim 2, characterized in that: Also includes: Determine whether the remaining space of the data buffer is greater than the descriptor length of the subdescriptor; The step of sending the read request to the host when the remaining space of the data buffer area is greater than the descriptor length of the subdescriptor.
5. The method according to claim 4, characterized in that Also includes: Predetermining the total data length that can be transmitted by the network card in the process of acquiring the target data; Configuring the data buffer area according to the total data length; The space size of the data buffer area is not less than the total data length.
6. The method according to claim 5, characterized in that The space size of the data buffer area is an integer multiple of the data length of the target data.
7. The method according to any one of claims 2 to 6, characterized in that In the case where the data length of the target data is greater than the data length that the network card can transmit within the preset time length, the segmentation length does not exceed: the difference between the data length of the target data and the data length that the network card can transmit within the preset time length; The preset duration is the sum of the duration of the host responding to the read request and the duration of the network card receiving the target data from the data bus; When n times the data length of the target data is smaller than the data length that the network card can transmit within the preset time length, and n+1 times the data length of the target data is larger than the data length that the network card can transmit within the preset time length, the segmentation length shall not exceed: the difference between n+1 times the data length of the target data and the data length that the network card can transmit within the preset time length; n is a positive integer.
8. A data transmission device, characterized in that: Applied to a network card, the device comprises: A descriptor acquisition module, used for acquiring a target descriptor for reading target data; A segmentation module, used for segmenting the target descriptor to generate multiple sub-descriptors; A request module, configured to generate a corresponding read request according to the sub-descriptor, and send the read request to a host; the read request is used to obtain part of the sub-data in the target data; A data acquisition module, used for acquiring sub-data corresponding to the sub-descriptor sent by the host through a data bus; The processing module is used to integrate the sub-data corresponding to the multiple sub-descriptors into the target data, and perform sending processing on the target data.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data transmission method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data transmission method according to any one of claims 1 to 7.
11. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the data transmission method according to any one of claims 1 to 7.
Citation Information
Cited By
Data transmission method, system, product, equipment, medium and device
CN120567801A
A data transmission method, system, product, equipment, medium, and apparatus
CN120567801B