DMA data transmission method and device

By obtaining the DMA descriptor in the memory of the first PCIe device and directly transmitting data to the second PCIe device, the problem of DMA data transmission occupies bandwidth in the current technology is solved, efficient data transmission between PCIe devices is achieved, and system performance is improved.

CN119690881APending Publication Date: 2025-03-25WELL CORE MICROELECTRONICS TECH (TIANJIN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411735882.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The current DMA data transmission method in the technology will occupy the bandwidth of PCIe devices to the host, resulting in a degradation of overall system performance.

Method used

By obtaining the DMA descriptor in the memory of the first PCIe device and reading the data to be transmitted from the memory based on the descriptor, it is directly transmitted to the target address of the second PCIe device through the PCIe message, thereby avoiding the process of sending PCIe messages to the host.

Benefits of technology

It realizes 100% data transmission from PCIe devices to PCIe devices, avoids bandwidth usage and improves overall system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690881A_ABST
    Figure CN119690881A_ABST
Patent Text Reader

Abstract

The invention discloses a DMA data transmission method and device, and relates to the technical field of computers. The method comprises the steps of obtaining a DMA descriptor from a memory of a first PCIe device; reading the data to be transmitted from the memory of the first PCIe device based on the DMA descriptor; and transmitting the to-be-transmitted data to a target address corresponding to the DMA descriptor through the PCIe message so as to realize data transmission from the first PCIe device to the second PCIe device. According to the data transmission method and device, the DMA descriptor is stored in the memory of the first PCIe device, a PCIe message does not need to be sent to the host to obtain / access the DMA descriptor stored in the memory of the host, the bandwidth from the PCIe devices to the host is not occupied, 100% data transmission from the PCIe devices to the PCIe devices is achieved, and therefore the performance of the whole system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a DMA data transmission method and device. Background Art

[0002] With the development of science and technology, the application of PCIe bus in computer systems is becoming more and more extensive. For example, it has been increasingly used in many high-performance integrated electronic platforms and systems. PCI-Express (Peripheral Component Interconnect Express, referred to as PCIe) is a high-speed serial computer expansion bus standard used for communication between internal components of a computer. It has high throughput and low latency transmission characteristics. Furthermore, the use of direct memory access (DMA) data transmission is one of the most commonly used technical means to give full play to the high bandwidth and high performance of the PCIe bus.

[0003] In one case, when the PCIe ports on the host are insufficient to meet the needs of multiple high-performance devices, a PCIe bridge can be used to expand the number of PCIe ports, that is, two or more PCIe devices are connected to the host through the PCIe bridge.

[0004] In the above situation, when DMA data transmission is performed between two PCIe devices among two or more PCIe devices, the DMA data transmission method in the current technology is: one PCIe device sends a PCIe message to the host to which it is connected through a PCIe bridge to obtain a DMA descriptor from the host memory; then the PCIe device implements DMA data transmission with another PCIe device based on the DMA descriptor obtained from the host memory.

[0005] It can be seen from this that in the current DMA data transmission method, the bandwidth from the PCIe device to the host will be occupied, resulting in a decrease in the performance of the overall system. Summary of the invention

[0006] Based on the above problems, the present application provides a DMA data transmission method and apparatus, which will not occupy the bandwidth from the PCIe device to the host, and realizes 100% (complete) PCIe device to PCIe device data transmission, thereby improving the performance of the overall system.

[0007] The embodiments of the present application disclose the following technical solutions:

[0008] In a first aspect, the present application provides a DMA data transmission method, applied to a first PCIe device, the method comprising:

[0009] Obtaining a DMA descriptor from the memory of the first PCIe device; wherein the DMA descriptor includes: a source address, a target address and a data length; the source address represents a starting address of data transmission; the target address represents a target address of data transmission, which is a memory address of the second PCIe device;

[0010] Based on the DMA descriptor, read the data to be transmitted from the memory of the first PCIe device;

[0011] The data to be transmitted is transmitted to the target address corresponding to the DMA descriptor through the PCIe message, so as to realize the data transmission from the first PCIe device to the second PCIe device.

[0012] Optionally, reading the data to be transmitted from the memory of the first PCIe device based on the DMA descriptor includes:

[0013] Starting from the source address corresponding to the DMA descriptor in the memory of the first PCIe device, data of the data length corresponding to the DMA descriptor is read to obtain the data to be transmitted.

[0014] Optionally, the first PCIe device and the second PCIe device are respectively connected to a downstream port of a PCIe bridge;

[0015] The method of transmitting the data to be transmitted to the target address corresponding to the DMA descriptor through the PCIe message includes:

[0016] The data to be transmitted is directly transmitted through the PCIe bridge to the target address corresponding to the DMA descriptor in the second PCIe device through the PCIe message.

[0017] Optionally, the DMA descriptor further includes: a preset flag bit; wherein the preset flag bit is used to indicate whether the corresponding DMA descriptor is the last DMA descriptor;

[0018] The obtaining of a DMA descriptor from the memory of the first PCIe device includes:

[0019] Reading a first DMA descriptor from the memory of the first PCIe device, and determining whether it is the last DMA descriptor based on a preset flag bit in the first DMA descriptor;

[0020] If not, continue to read the next DMA descriptor from the memory of the first PCIe device, and determine whether it is the last DMA descriptor based on a preset flag bit in the DMA descriptor;

[0021] If so, the process of obtaining the DMA descriptor from the memory of the first PCIe device is completed.

[0022] Optionally, obtaining a DMA descriptor from a memory of the first PCIe device includes:

[0023] Acquire multiple DMA descriptors from the memory of the first PCIe device; wherein the multiple DMA descriptors are arranged in a preset order to form a linked list structure.

[0024] Optionally, reading the data to be transmitted from the memory of the first PCIe device based on the DMA descriptor includes:

[0025] Based on the multiple DMA descriptors, read a plurality of to-be-transmitted data corresponding one-to-one to the multiple DMA descriptors from the memory of the first PCIe device;

[0026] The method of transmitting the data to be transmitted to the target address corresponding to the DMA descriptor through the PCIe message includes:

[0027] The multiple data to be transmitted are respectively transmitted to the target addresses corresponding to the corresponding DMA descriptors through PCIe messages, so as to realize data transmission from the first PCIe device to the second PCIe device.

[0028] Optionally, the PCIe message includes a TLP message; the TLP message carries the data to be transmitted and a target address corresponding to the DMA descriptor;

[0029] The method of transmitting the data to be transmitted to the target address corresponding to the DMA descriptor through the PCIe message includes:

[0030] The TLP message is sent to the second PCIe device so that the second PCIe device stores the data to be transmitted carried by the TLP message into the target address corresponding to the DMA descriptor carried by the TLP message, so as to realize data transmission from the first PCIe device to the second PCIe device.

[0031] Optionally, the DMA descriptor is created in advance by a driver and stored in the memory of the first PCIe device.

[0032] In a second aspect, the present application provides a DMA data transmission device, applied to a first PCIe device, the device comprising:

[0033] An acquisition module is used to acquire a DMA descriptor from the memory of the first PCIe device; wherein the DMA descriptor includes: a source address, a target address and a data length; the source address represents the starting address of the data transmission; the target address represents the target address of the data transmission, which is the memory address of the second PCIe device;

[0034] A reading module, configured to read data to be transmitted from a memory of the first PCIe device based on the DMA descriptor;

[0035] The transmission module is used to transmit the data to be transmitted to the target address corresponding to the DMA descriptor through a PCIe message, so as to realize the data transmission from the first PCIe device to the second PCIe device.

[0036] Optionally, the reading module is specifically used to read data of a data length corresponding to the DMA descriptor from a source address corresponding to the DMA descriptor in the memory of the first PCIe device to obtain data to be transmitted.

[0037] Optionally, the first PCIe device and the second PCIe device are respectively connected to the downstream port of the PCIe bridge; the transmission module is specifically used to transmit the data to be transmitted directly through the PCIe bridge to the target address corresponding to the DMA descriptor in the second PCIe device through the PCIe message.

[0038] Optionally, the DMA descriptor also includes: a preset flag bit; wherein the preset flag bit is used to indicate whether the corresponding DMA descriptor is the last DMA descriptor. The acquisition module is specifically used to read the first DMA descriptor from the memory of the first PCIe device, and determine whether it is the last DMA descriptor based on the preset flag bit in the first DMA descriptor; if not, continue to read the next DMA descriptor from the memory of the first PCIe device, and determine whether it is the last DMA descriptor based on the preset flag bit in the DMA descriptor; if so, complete the acquisition of the DMA descriptor from the memory of the first PCIe device.

[0039] Optionally, the acquisition module is specifically used to acquire multiple DMA descriptors from the memory of the first PCIe device; wherein the multiple DMA descriptors are arranged in a preset order to form a linked list structure.

[0040] Optionally, a reading module is specifically used to read multiple data to be transmitted corresponding to multiple DMA descriptors from the memory of the first PCIe device based on multiple DMA descriptors; the transmission module is specifically used to transmit the multiple data to be transmitted to the target addresses corresponding to the corresponding DMA descriptors through PCIe messages, so as to realize data transmission from the first PCIe device to the second PCIe device.

[0041] Optionally, the PCIe message includes a TLP message; the TLP message carries data to be transmitted and a target address corresponding to the DMA descriptor. The transmission module is specifically used to send the TLP message to the second PCIe device, so that the second PCIe device stores the data to be transmitted carried by the TLP message in the target address corresponding to the DMA descriptor carried by the TLP message, so as to realize data transmission from the first PCIe device to the second PCIe device.

[0042] Compared with the prior art, the present application has the following beneficial effects: the DMA descriptor is stored in the memory of the first PCIe device, and there is no need to send a PCIe message to the host to obtain / access the DMA descriptor stored in the host memory, and the bandwidth from the PCIe device to the host is not occupied, thereby achieving 100% (complete) data transmission from PCIe device to PCIe device, thereby improving the performance of the overall system. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0044] Figure 1 A schematic diagram of a topological structure of a PCIe bridge provided in an embodiment of the present application;

[0045] Figure 2 A flow chart of a DMA data transmission method provided in an embodiment of the present application;

[0046] Figure 3 A flowchart of another DMA data transmission method provided in an embodiment of the present application;

[0047] Figure 4 An example diagram of a linked list structure of multiple DMA descriptors provided in an embodiment of the present application;

[0048] Figure 5 A schematic diagram of the structure of a DMA data transmission device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] First combine Figure 1 , give an example to introduce the topology of the PCIe bridge.

[0050] like Figure 1As shown, the host is connected to the upstream port of the PCIe bridge through the upstream bus; the upstream port of the PCIe bridge is connected to the two downstream ports of the PCIe bridge through the internal virtual PCIe bus; the two downstream ports of the PCIe bridge are connected to the PCIe devices through the downstream buses.

[0051] A host is a computer or device that plays a central role in a network or system.

[0052] A PCIe bridge (PCI Express Bridge, PCI-to-PCI Bridge) is a device used to expand or reconfigure a PCIe link. It is usually used to expand one or more PCIe ports into more ports, or to change the bandwidth and configuration of a port. The upstream port of a PCIe bridge is a PCIe port used to connect to a host, and the downstream port is a PCIe port used to connect to a PCIe device. Figure 1 As shown, the PCIe bridge is used to expand one PCIe port into two PCIe ports.

[0053] PCIe devices refer to hardware devices that follow the PCIe standard and connect to a computer system through a PCIe port.

[0054] In such Figure 1 In the case of the topology of the PCIe bridge shown, when DMA data transmission is performed between two PCIe devices connected to two downstream ports of the PCIe bridge, the DMA data transmission method in the current technology is: a PCIe device sends a PCIe message to the host through the PCIe bridge to obtain / access a DMA descriptor from the host memory; the PCIe device implements DMA data transmission with another PCIe device based on the DMA descriptor.

[0055] In the current technology, DMA descriptors are pre-stored in the host's memory, so when DMA data is transmitted between PCIe devices, it is necessary to send PCIe messages to the host to obtain / access the DMA descriptors stored in the host's memory. Therefore, each time DMA data is transmitted between PCIe devices connected by a PCIe bridge, it is necessary to access / acquire the DMA descriptors stored in the host's memory, that is, it is necessary to send PCIe messages to the host, which will occupy the bandwidth from the PCIe device to the host. Since the bandwidth from the PCIe device to the host is occupied by obtaining / accessing DMA descriptors, the bandwidth used by other service functions will be reduced, resulting in a decrease in the performance of the overall system.

[0056] Furthermore, there is a delay in the process of the PCIe device obtaining / accessing the DMA descriptor in the host memory. Especially when DMA operations are performed frequently, this delay accumulates and has a significant impact on the performance of the overall DMA data transfer.

[0057] The present application provides a DMA data transmission method, including: obtaining a DMA descriptor from the memory of a first PCIe device; based on the DMA descriptor, reading the data to be transmitted from the memory of the first PCIe device; and transmitting the data to be transmitted to the target address corresponding to the DMA descriptor through a PCIe message, so as to realize the data transmission from the first PCIe device to the second PCIe device. In the present application, the DMA descriptor is stored in the memory of the first PCIe device, and it is no longer necessary to send a PCIe message to the host to obtain / access the DMA descriptor stored in the host memory, and the bandwidth from the PCIe device to the host is not occupied, and 100% (complete) data transmission from the PCIe device to the PCIe device is realized, thereby improving the performance of the overall system.

[0058] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0059] Embodiment 1:

[0060] Combine the following Figure 2 , a DMA data transmission method provided by an embodiment of the present application is introduced in detail. The method is applied to a first PCIe device.

[0061] like Figure 2 As shown, a DMA data transmission method provided in an embodiment of the present application includes the following steps:

[0062] S201. Obtain a DMA descriptor from a memory of a first PCIe device.

[0063] Among them, the DMA descriptor (Direct Memory Access Descriptor) is a data structure used for DMA (Direct Memory Access) operations, which contains the information required for DMA data transmission to facilitate data transmission without using a central processing unit.

[0064] The DMA descriptor includes: source address, destination address and data length.

[0065] The source address represents the starting address of data transmission, that is, specifies the starting position of the data to be transmitted. In the embodiment of the present application, the source address is an address in the memory of the first PCIe device.

[0066] The destination address represents the target address of data transmission, that is, specifies the destination of the data to be transmitted, which is generally the memory address or register of another PCIe device. In the embodiment of the present application, the destination address is the memory address of the second PCIe device.

[0067] The data length (Transfer Length) represents the total amount of data to be transferred, usually in bytes.

[0068] It should be noted that in addition to the source address, destination address and data length, the DMA descriptor can also include: control flags, status information, etc. The control flag contains a series of flag bits used to control the behavior of the DMA operation, such as whether to start chained transfers, whether to trigger an interrupt after the transfer is completed, etc.; the status information is used to record the status of the DMA operation, such as whether it was completed successfully, whether an error occurred, etc.

[0069] Specifically, the DMA descriptor is created in advance by a driver and stored in the memory of the first PCIe device.

[0070] In an embodiment of the present application, since the DMA descriptor is stored in the memory of the first PCIe device, there is no need to send a PCIe message to the host to obtain / access the DMA descriptor stored in the host memory, and the bandwidth from the first PCIe device to the host will not be occupied, thereby improving the performance of the overall system.

[0071] In a possible implementation, the DMA descriptor is stored in a random access memory (RAM) within the PCIe device to facilitate fast reading and writing of data.

[0072] S202: Read data to be transmitted from the memory of the first PCIe device based on the DMA descriptor.

[0073] Specifically, starting from the source address corresponding to the DMA descriptor in the memory of the first PCIe device, data of the data length corresponding to the DMA descriptor is read to obtain the data to be transmitted. That is, based on the source address and data length in the DMA descriptor, starting from the source address in the memory of the first PCIe device, data of the data length is read to obtain the data to be transmitted.

[0074] S203 . Transfer the data to be transferred to the target address corresponding to the DMA descriptor through a PCIe message.

[0075] Specifically, the PCIe message carries the data to be transmitted, and the PCIe message is transmitted to the target address corresponding to the DMA descriptor to realize the data transmission from the first PCIe device to the second PCIe device.

[0076] In a possible implementation, the first PCIe device and the second PCIe device are respectively connected to the downstream port of the PCIe bridge, and the data to be transmitted is directly transmitted through the PCIe bridge to the target address corresponding to the DMA descriptor in the second PCIe device through the PCIe message. That is, the PCIe message carrying the data to be transmitted is directly transmitted through the PCIe bridge to the target address corresponding to the DMA descriptor in the second PCIe device.

[0077] In a possible implementation, the PCIe message includes a TLP message, and the TLP message carries data to be transmitted and a target address corresponding to a DMA descriptor. The TLP message is sent to a second PCIe device so that the second PCIe device stores the data to be transmitted carried by the TLP message in the target address corresponding to the DMA descriptor carried by the TLP message, so as to realize data transmission from the first PCIe device to the second PCIe device.

[0078] TLP (Transaction Layer Packet) message, also known as transaction layer message. TLP message is a data transmission format defined in the PCIe specification, used to transfer data and control information between PCIe devices. TLP message is designed to efficiently and reliably transmit data between PCIe devices. TLP message can accurately describe and control data transmission behavior, ensuring that data can be transmitted efficiently and reliably between PCIe devices.

[0079] Specifically, a TLP message usually includes a prefix (Prefix), a payload (Payload) and a suffix (Suffix).

[0080] The prefix includes information such as type, label, attribute, etc., and is used to indicate the type, priority and other control parameters of the TLP message. In the embodiment of the present application, the target address corresponding to the DMA descriptor is stored in the prefix part of the TLP message.

[0081] The payload includes actual data and control information and is used to transmit data or control information. In the embodiment of the present application, the data to be transmitted is stored in the payload part of the TLP message.

[0082] The suffix contains an error detection code (such as CRC) and other end markers to ensure the integrity and reliability of data transmission.

[0083] The embodiment of the present application provides a DMA data transmission method, including: obtaining a DMA descriptor from the memory of a first PCIe device; based on the DMA descriptor, reading the data to be transmitted from the memory of the first PCIe device; and transmitting the data to be transmitted to the target address corresponding to the DMA descriptor through a PCIe message, so as to realize the data transmission from the first PCIe device to the second PCIe device. In the embodiment of the present application, the DMA descriptor is stored in the memory of the first PCIe device, and it is no longer necessary to send a PCIe message to the host to obtain / access the DMA descriptor stored in the host memory, and the bandwidth from the PCIe device to the host is not occupied, and 100% (complete) data transmission from the PCIe device to the PCIe device is realized, thereby improving the performance of the overall system.

[0084] Furthermore, the PCIe device obtains the DMA descriptor from the internal memory and does not need to obtain / access the DMA descriptor in the host memory, thereby avoiding the delay in the process of the PCIe device obtaining / accessing the DMA descriptor in the host memory and avoiding the impact of accumulated delays on the performance of the overall DMA data transfer.

[0085] Embodiment 2:

[0086] Combine the following Figure 3 and Figure 4 , a DMA data transmission method provided in an embodiment of the present application is introduced in detail.

[0087] like Figure 3 As shown, a DMA data transmission method provided in an embodiment of the present application includes the following method.

[0088] S301. Acquire multiple DMA descriptors from a memory of a first PCIe device.

[0089] Wherein, multiple DMA descriptors are arranged in a preset order to form a linked list structure.

[0090] In a possible implementation, the DMA descriptor further includes: a preset flag bit. The preset flag bit is used to indicate whether the corresponding DMA descriptor is the last DMA descriptor.

[0091] At this time, the first DMA descriptor is read from the memory of the first PCIe device, and based on the preset flag bit in the first DMA descriptor, it is determined whether the first DMA descriptor is the last DMA descriptor; if so, the next DMA descriptor is read from the memory of the first PCIe device, and based on the preset flag bit in the DMA descriptor, it is determined whether it is the last DMA descriptor, until the preset flag bit in the acquired DMA descriptor indicates that the DMA descriptor is the last descriptor, and the acquisition of multiple DMA descriptors is completed.

[0092] In another possible implementation, the first DMA descriptor is read from the memory of the first PCIe device, and based on a preset flag bit in the first DMA descriptor, it is determined that the first DMA descriptor is the last DMA descriptor, and then a DMA descriptor is obtained from the memory in the first PCIe device.

[0093] For ease of understanding, the following Figure 4 The linked list structure composed of multiple DMA descriptors shown in the figure gives an example of how to obtain Figure 4 The multiple DMA descriptors shown in FIG. 1 . If the preset flag bit in the DMA descriptor is 1, it indicates that the DMA descriptor is the last DMA descriptor; if the preset flag bit in the DMA descriptor is 0, it indicates that the DMA descriptor is not the last DMA descriptor.

[0094] First, obtain DMA descriptor A from the memory of the first PCIe device, and based on the preset flag bit 0 of DMA descriptor A, determine that DMA descriptor A is not the last DMA descriptor; then continue to obtain DMA descriptor B from the memory of the first PCIe device, and based on the preset flag bit 0 of DMA descriptor B, determine that DMA descriptor B is not the last DMA descriptor; continue to obtain DMA descriptor C from the memory of the first PCIe device, and based on the preset flag bit 1 of DMA descriptor C, determine that DMA descriptor C is the last DMA descriptor, and complete the acquisition of multiple DMA descriptors from the memory of the first PCIe device.

[0095] S302: Based on the multiple DMA descriptors, read a plurality of to-be-transmitted data corresponding one-to-one to the multiple DMA descriptors from the memory of the first PCIe device.

[0096] Among them, one DMA descriptor corresponds to one data to be transmitted, that is, the number of DMA descriptors is the same as the number of data (segments) to be transmitted. Exemplarily, the multiple DMA descriptors are DMA descriptor A, DMA descriptor B and DMA descriptor C, and DMA descriptor A corresponds to data a to be transmitted, DMA descriptor B corresponds to data b to be transmitted, and DMA descriptor C corresponds to data c to be transmitted. Based on the above three DMA descriptors, data a to be transmitted, data b to be transmitted, and data c to be transmitted are read from the memory of the first PCIe device.

[0097] S303 . Transmit multiple data to be transmitted to the target addresses in the corresponding DMA descriptors respectively through PCIe messages.

[0098] Exemplarily, DMA descriptor A corresponds to data a to be transmitted, DMA descriptor B corresponds to data b to be transmitted, and DMA descriptor C corresponds to data c to be transmitted. Then, through the PCIe message, data a to be transmitted is transmitted to the target address corresponding to DMA descriptor A, data b to be transmitted is transmitted to the target address corresponding to DMA descriptor B, and data c to be transmitted is transmitted to the target address corresponding to DMA descriptor C. Thus, data transmission from the first PCIe device to the second PCIe device is completed.

[0099] A DMA data transmission method provided in an embodiment of the present application includes: obtaining multiple DMA descriptors from the memory of a first PCIe device; based on the multiple DMA descriptors, reading multiple data to be transmitted corresponding to the multiple DMA descriptors from the memory of the first PCIe device; and transmitting the multiple data to be transmitted to the target addresses in the corresponding DMA descriptors respectively through PCIe messages to complete the data transmission from the first PCIe device to the second PCIe device. In the embodiment of the present application, the DMA descriptors are stored in the memory of the first PCIe device, and it is no longer necessary to send PCIe messages to the host to obtain / access the DMA descriptors stored in the host memory, which will not occupy the bandwidth from the PCIe device to the host, and 100% (complete) data transmission from the PCIe device to the PCIe device is achieved, thereby improving the performance of the overall system.

[0100] Furthermore, multiple DMA descriptors are stored in the memory of the first PCIe device in a linked list structure. When multiple DMA data transfers are required, multiple DMA descriptors can be read at one time through the linked list structure, avoiding the need to frequently read the DMA descriptors when multiple DMA data transfers are frequently continued, thereby reducing the resource consumption of reading DMA descriptors and further improving the performance of the overall system.

[0101] Embodiment three:

[0102] Combine the following Figure 5, a DMA data transmission device provided in an embodiment of the present application is introduced in detail, and the device is applied to a first PCIe device.

[0103] like Figure 5 As shown, a DMA data transmission device provided in an embodiment of the present application includes the following modules:

[0104] The acquisition module 501 is used to acquire a DMA descriptor from the memory of the first PCIe device; wherein the DMA descriptor includes: a source address, a target address and a data length; the source address represents the starting address of the data transmission; the target address represents the target address of the data transmission, which is the memory address of the second PCIe device;

[0105] A reading module 502, configured to read data to be transmitted from a memory of a first PCIe device based on a DMA descriptor;

[0106] The transmission module 503 is used to transmit the data to be transmitted to the target address corresponding to the DMA descriptor through the PCIe message, so as to realize the data transmission from the first PCIe device to the second PCIe device.

[0107] In a possible implementation, the reading module 502 is specifically configured to read data of a data length corresponding to the DMA descriptor from a source address corresponding to the DMA descriptor in the memory of the first PCIe device to obtain data to be transmitted.

[0108] In a possible implementation, the first PCIe device and the second PCIe device are respectively connected to the downstream ports of the PCIe bridge; the transmission module 503 is specifically used to transmit the data to be transmitted directly through the PCIe bridge to the target address corresponding to the DMA descriptor in the second PCIe device through the PCIe message.

[0109] In a possible implementation, the DMA descriptor further includes: a preset flag bit; wherein the preset flag bit is used to indicate whether the corresponding DMA descriptor is the last DMA descriptor.

[0110] The acquisition module 501 is specifically used to read the first DMA descriptor from the memory of the first PCIe device, and determine whether it is the last DMA descriptor based on the preset flag bit in the first DMA descriptor; if not, continue to read the next DMA descriptor from the memory of the first PCIe device, and determine whether it is the last DMA descriptor based on the preset flag bit in the DMA descriptor; if so, complete the acquisition of the DMA descriptor from the memory of the first PCIe device.

[0111] In a possible implementation, the acquisition module 501 is specifically configured to acquire a plurality of DMA descriptors from a memory of the first PCIe device; wherein the plurality of DMA descriptors are arranged in a preset order to form a linked list structure.

[0112] In one possible implementation, the reading module 502 is specifically used to read multiple data to be transmitted corresponding to multiple DMA descriptors from the memory of the first PCIe device based on multiple DMA descriptors; the transmission module 503 is specifically used to transmit the multiple data to be transmitted to the target addresses corresponding to the corresponding DMA descriptors through PCIe messages, so as to realize data transmission from the first PCIe device to the second PCIe device.

[0113] In a possible implementation, the PCIe message includes a TLP message; the TLP message carries data to be transmitted and a target address corresponding to a DMA descriptor. The transmission module 503 is specifically used to send the TLP message to the second PCIe device, so that the second PCIe device stores the data to be transmitted carried by the TLP message in the target address corresponding to the DMA descriptor carried by the TLP message, so as to realize data transmission from the first PCIe device to the second PCIe device.

[0114] The embodiment of the present application provides a DMA data transmission device, including: an acquisition module 501, used to obtain a DMA descriptor from the memory of a first PCIe device; a reading module 502, used to read the data to be transmitted from the memory of the first PCIe device based on the DMA descriptor; a transmission module 503, used to transmit the data to be transmitted to the target address corresponding to the DMA descriptor through a PCIe message, so as to realize the data transmission from the first PCIe device to the second PCIe device. In the embodiment of the present application, the DMA descriptor is stored in the memory of the first PCIe device, and it is no longer necessary to send a PCIe message to the host to obtain / access the DMA descriptor stored in the host memory, and the bandwidth from the PCIe device to the host is not occupied, and 100% (complete) data transmission from the PCIe device to the PCIe device is realized, thereby improving the performance of the overall system.

[0115] Furthermore, the PCIe device obtains the DMA descriptor from the internal memory and does not need to obtain / access the DMA descriptor in the host memory, thereby avoiding the delay in the process of the PCIe device obtaining / accessing the DMA descriptor in the host memory and avoiding the impact of accumulated delays on the performance of the overall DMA data transfer.

[0116] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the method and device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments. The method and device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0117] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A DMA data transmission method, characterized in that: Applied to a first PCIe device, the method comprises: Obtaining a DMA descriptor from the memory of the first PCIe device; wherein the DMA descriptor includes: a source address, a target address and a data length; the source address represents a starting address of data transmission; the target address represents a target address of data transmission, which is a memory address of the second PCIe device; Based on the DMA descriptor, read the data to be transmitted from the memory of the first PCIe device; The data to be transmitted is transmitted to the target address corresponding to the DMA descriptor through the PCIe message, so as to realize the data transmission from the first PCIe device to the second PCIe device.

2. The method according to claim 1, characterized in that: The reading the to-be-transmitted data from the memory of the first PCIe device based on the DMA descriptor includes: Starting from the source address corresponding to the DMA descriptor in the memory of the first PCIe device, data of the data length corresponding to the DMA descriptor is read to obtain the data to be transmitted.

3. The method according to claim 1, characterized in that: The first PCIe device and the second PCIe device are respectively connected to the downstream port of the PCIe bridge; The method of transmitting the data to be transmitted to the target address corresponding to the DMA descriptor through the PCIe message includes: The data to be transmitted is directly transmitted through the PCIe bridge to the target address corresponding to the DMA descriptor in the second PCIe device through the PCIe message.

4. The method according to claim 1, characterized in that: The DMA descriptor further includes: a preset flag bit; wherein the preset flag bit is used to indicate whether the corresponding DMA descriptor is the last DMA descriptor; The obtaining of a DMA descriptor from the memory of the first PCIe device includes: Reading a first DMA descriptor from the memory of the first PCIe device, and determining whether it is the last DMA descriptor based on a preset flag bit in the first DMA descriptor; If not, continue to read the next DMA descriptor from the memory of the first PCIe device, and determine whether it is the last DMA descriptor based on a preset flag bit in the DMA descriptor; If so, the process of obtaining the DMA descriptor from the memory of the first PCIe device is completed.

5. The method according to claim 4, characterized in that The obtaining of a DMA descriptor from the memory of the first PCIe device includes: Acquire multiple DMA descriptors from the memory of the first PCIe device; wherein the multiple DMA descriptors are arranged in a preset order to form a linked list structure.

6. The method according to claim 5, characterized in that The reading the to-be-transmitted data from the memory of the first PCIe device based on the DMA descriptor includes: Based on the multiple DMA descriptors, read a plurality of to-be-transmitted data corresponding one-to-one to the multiple DMA descriptors from the memory of the first PCIe device; The method of transmitting the data to be transmitted to the target address corresponding to the DMA descriptor through the PCIe message includes: The multiple data to be transmitted are respectively transmitted to the target addresses corresponding to the corresponding DMA descriptors through PCIe messages, so as to realize data transmission from the first PCIe device to the second PCIe device.

7. The method according to claim 1, characterized in that The PCIe message includes a TLP message; the TLP message carries the data to be transmitted and the target address corresponding to the DMA descriptor; The method of transmitting the data to be transmitted to the target address corresponding to the DMA descriptor through the PCIe message includes: The TLP message is sent to the second PCIe device so that the second PCIe device stores the data to be transmitted carried by the TLP message into the target address corresponding to the DMA descriptor carried by the TLP message, so as to realize data transmission from the first PCIe device to the second PCIe device.

8. The method according to any one of claims 1 to 7, characterized in that: The DMA descriptor is created in advance by a driver and stored in the memory of the first PCIe device.

9. A DMA data transmission device, characterized in that: Applied to a first PCIe device, the apparatus comprises: An acquisition module is used to acquire a DMA descriptor from the memory of the first PCIe device; wherein the DMA descriptor includes: a source address, a target address and a data length; the source address represents the starting address of the data transmission; the target address represents the target address of the data transmission, which is the memory address of the second PCIe device; A reading module, configured to read the data to be transmitted from the memory of the first PCIe device based on the DMA descriptor; The transmission module is used to transmit the data to be transmitted to the target address corresponding to the DMA descriptor through a PCIe message, so as to realize the data transmission from the first PCIe device to the second PCIe device.

10. The device according to claim 9, characterized in that The reading module is specifically used to read data of a data length corresponding to the DMA descriptor from a source address corresponding to the DMA descriptor in the memory of the first PCIe device to obtain data to be transmitted.

Citation Information

Cited By

  • Direct memory access control method and system, electronic equipment and storage medium

    CN120179588A

  • Message receiving method and message sending method

    CN120343119A