A data transmission method, DMA controller, device and storage medium
By adjusting the data transmission speed and bandwidth based on the node throughput using the DMA controller, the problems of data congestion and resource waste in on-chip networks are solved, achieving efficient data transmission quality assurance and hardware resource saving.
Patent Information
- Application Number
- CN202410453481.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-16
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-04-16
AI Technical Summary
In DMA communication scenarios of on-chip networks, the lack of quality of service guarantees leads to data congestion and resource waste. Existing QoS mechanisms cannot effectively solve this problem when bandwidth is insufficient, and they also increase hardware overhead and computational complexity.
The DMA controller adjusts the data transmission speed based on the actual throughput of the source and target nodes, determines the matching transmission channel and bandwidth, avoids data congestion, and uses the DMA controller's arbitrator to achieve data arbitration without the need for additional hardware resources.
It effectively ensures data transmission quality, avoids data congestion and resource waste, simplifies hardware implementation, and improves system efficiency and performance.
Smart Images

Figure CN118175111B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data communication technology, and in particular, relates to a data transmission method, a DMA controller, a device and a storage medium. Background Art
[0002] In a direct memory access (DMA) mechanism of network on chip (Network on Chip, NoC) communication scenario, when there is no quality of service (QoS) guarantee, each node of the network on chip is allowed to transmit or request data to a common bus at the maximum speed in an independent manner.
[0003] In this case, if the bus bandwidth is insufficient, data congestion is likely to occur. For the target node that cannot receive data in time, the source node is requested to retransmit the data, which will further aggravate the data congestion. If the bus bandwidth is designed to be large enough, it will not only increase the network layout and wiring overhead, but also cause data backlog at the sender or receiver for communication scenarios with asynchronous sending and receiving speeds, which requires additional cache space; and for communication scenarios with slow data transmission speeds, the bus bandwidth cannot be well utilized, resulting in a huge waste of communication resources.
[0004] Therefore, it is urgent to design a new technical solution to overcome the above-mentioned technical problems. Summary of the invention
[0005] The present application provides a data transmission method, a DMA controller, a device and a storage medium for a DMA controller, which are used to adjust the data transmission speed according to the actual throughput capacity of the start and end nodes of the transmission data without increasing the hardware overhead, so as to ensure the data transmission quality.
[0006] In a first aspect, the present application provides a data transmission method applicable to a DMA controller, comprising: receiving a DMA request, the DMA request comprising a source address, a target address and a data volume of data to be transmitted; determining, based on the source address and the target address, actual throughputs corresponding to the corresponding source node and the target node respectively; determining, based on the actual throughputs corresponding to the source node and the target node respectively, a data bandwidth for the data to be transmitted this time; and determining, based on the data bandwidth, a matching transmission channel to transmit the data to be transmitted corresponding to the data volume from the source node to the target node through the transmission channel.
[0007] In an optional embodiment, the data bandwidth of the data to be transmitted is determined according to the actual throughputs corresponding to the source node and the target node respectively, including: determining a node with a smaller throughput as a reference node according to the actual throughputs corresponding to the source node and the target node respectively; and determining the data bandwidth of the data to be transmitted according to the actual throughput of the reference node.
[0008] In an optional embodiment, determining a matching transmission channel according to the data bandwidth includes: determining a matching target virtual channel according to the data bandwidth; determining a target physical channel corresponding to the target virtual channel; allocating access rights to the target physical channel to the target virtual channel, and using the target physical channel as a transmission channel.
[0009] In an optional embodiment, determining a matching target virtual channel according to the data bandwidth includes: acquiring first configuration information, the first configuration information including a transmission bandwidth of each virtual channel; and determining a target virtual channel adapted to the data bandwidth according to the transmission bandwidth of each virtual channel.
[0010] In an optional embodiment, determining the target physical channel corresponding to the target virtual channel includes: acquiring second configuration information, the second configuration information including a mapping relationship between each physical channel and each virtual channel; and determining a target physical channel matching the target virtual channel according to the mapping relationship.
[0011] In an optional embodiment, allocating access rights to the target physical channel to the target virtual channel includes: acquiring a first access frequency pre-set for the current transmission data; and allocating access rights to the target physical channel to the target virtual channel according to the first access frequency.
[0012] In an optional embodiment, allocating access rights to the target physical channel to the target virtual channel includes: determining a second access frequency according to the data volume and the transmission bandwidth; and allocating access rights to the target physical channel to the target virtual channel according to the second access frequency.
[0013] In a second aspect, an embodiment of the present application provides a DMA controller for implementing the data transmission method described in the first aspect.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, including a DMA controller, wherein the DMA controller is used to implement the data transmission method described in the first aspect.
[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed, the data transmission method described in the first aspect is implemented.
[0016] In an embodiment of the present application, the DMA controller can determine the actual throughput of the corresponding source node and the target node based on the received DMA request; further, the data bandwidth of this data transmission is determined based on the smaller actual throughput, which can ensure that the rate of subsequent control data transmission does not exceed the sending and receiving rate between the source node and the target node, avoiding data congestion, target node blindness, etc., and effectively ensuring the quality of data transmission; and, by using the hardware function of the DMA controller itself, the virtual channel and physical channel of the corresponding data bandwidth are matched for this data transmission, without the need for additional hardware overhead, which is conducive to saving equipment resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1a is a flow chart of a data transmission method for a DMA controller according to an embodiment of the present application;
[0019] Figure 1b A schematic diagram of a data transmission process for a DMA controller according to an embodiment of the present application;
[0020] Figure 2 is a structural block diagram of a DMA controller according to an embodiment of the present application;
[0021] Figure 3 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, 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 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.
[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0024] Compared with the traditional bus-type communication network, the network on chip (NoC) can not only support parallel communication, but also be easy to expand and reconstruct, and is more flexible in design. In a multi-core communication network on chip system, many cores are connected together through the network on chip, and data communication between different cores is completed by the network on chip. In a multi-core communication network on chip system, the traditional data communication method is completed by the central processing unit (CPU) with data transmission requirements. For communication scenarios with frequent data transmission, this will result in a large amount of CPU computing resources being occupied for repetitive work such as data transmission and reception, reducing the efficiency and performance of the CPU in handling other important tasks.
[0025] In order to solve this problem, the Direct Memory Access (DMA) mechanism was born. Through the DMA controller, data can be transferred between peripherals and memory or between memory and memory, and data can be copied from one address space to another. Moreover, in the entire communication project, the CPU only needs to send a communication instruction to the DMA controller without participating in the data transfer process. The idle CPU can complete other more important tasks. This data transmission method can not only save CPU computing resources, but also improve the overall processing performance and efficiency of the system.
[0026] In order to ensure the quality of communication, a certain Quality of Service (QoS) guarantee mechanism is usually set up to control the stability of data transmission. For example, common QoS guarantee methods include best effort and differentiated service. Among them, best effort is also called transmission at the maximum throughput capacity of the network. This method is a dynamic negative feedback adjustment based on the network transmission status. After data congestion occurs at a node in the network, a feedback signal is transmitted from the congested node to the source node of the data to notify the source node to reduce or even suspend data transmission. Differentiated service refers to distinguishing according to the type of data packet sent by the source node. During data transmission, the hardware device responsible for data forwarding, such as the router on the transmission path, can distinguish and transmit according to different types of data packets. For example, taking the method of marking the priority to distinguish the type of data packet as an example, a data packet that is more sensitive to delay can be marked with a higher priority, and this type of data packet will be distributed preferentially during data transmission.
[0027] Although the above-mentioned service quality assurance method can alleviate the problem of data congestion and low transmission efficiency caused by insufficient bandwidth to a certain extent, for the best-effort service method, negative feedback adjustment is performed after data congestion occurs, and the reflection speed is difficult to guarantee, and data congestion cannot be avoided. For the differentiated service method, when different types of data packets are processed differently, one or even multiple arbitrations are required, which not only consumes more computing resources, but also makes the processing logic more complicated. Therefore, it is necessary to provide a service quality assurance method with simple processing logic and low resource consumption to improve the efficiency and performance of on-chip network data transmission.
[0028] To this end, the embodiments of the present application provide a data transmission method, a DMA controller, a device and a storage medium for a DMA controller, which can adjust the speed of data transmission according to the throughput capacity of the source node or the target node sending the data, thereby reducing the load pressure of the network transmission; and, the arbitrator of the DMA controller itself is used to implement arbitration and judgment of different data, without the need for additional hardware resources, and is also simpler in physical implementation.
[0029] The data transmission method, DMA controller, device and storage medium provided in the embodiments of the present application are described below in conjunction with the accompanying drawings.
[0030] Figure 1a A data transmission method for a DMA controller provided in an embodiment of the present application is as follows: Figure 1a As shown, the method includes:
[0031] S1. Receive a DMA request, which includes the source address, target address and data amount of the data to be transferred;
[0032] S2. Determine the actual throughputs corresponding to the source node and the target node respectively according to the source address and the target address;
[0033] S3. Determine the data bandwidth of the current transmission data according to the actual throughputs corresponding to the source node and the target node respectively;
[0034] S4. Determine a matching transmission channel according to the data bandwidth, so as to transmit the corresponding amount of data to be transmitted from the source node to the target node through the transmission channel.
[0035] Before describing each step in the above method in detail, it is first explained that in the embodiment of the present application, the way in which the DMA controller transmits data is not limited. The transmission method will be different according to the different application scenarios of the DMA controller, and the specific transmission method can be determined according to actual needs. For example, in one optional method, DMA control is applied to a separate electronic device. In this case, the way the DMA controller transmits data can be to transfer the data in the memory of the electronic device where it is located from one memory address space to another memory address space, or to transfer the data in the memory of the electronic device where it is located to an external device. For another example, in another optional method, for a network system composed of multiple independent electronic devices, the DMA controller can be applied to the control device in the system. In this case, the way the DMA controller transmits data can be to transfer data from one electronic device to another electronic device.
[0036] In the above description, two optional situations are mentioned, namely, the DMA controller is applied to a single electronic device and is applied to a control device in a network system composed of multiple independent electronic devices. The following will illustrate the way in which the DMA controller transmits data in these two situations.
[0037] Taking the application of DMA controller to a separate electronic device as an example, suppose there is a stand-alone embedded system that contains a DMA controller and a memory for storing data. In this case, the DMA controller can transfer data in the following ways: First, transfer from one memory address space to another memory address space. For example, suppose there is an application that needs to process a large amount of data and can store the data in the system's memory. The DMA controller can be configured to read data from one memory address and then transfer it to another memory address so that other processing units can directly access the data without the intermediary of the CPU. Then, the data is transferred to an external device. In another case, the DMA controller can be used to transfer data from the system memory to an external device, such as a storage device, a network interface, a display device, etc. For example, when audio data needs to be sent to a sound card for playback, the DMA controller can be configured to transfer the audio data from the memory to the buffer of the sound card so that the sound card can play it.
[0038] In another example, a DMA controller is applied to a control device in a network system consisting of multiple independent electronic devices. Assume that there is a network system consisting of multiple independent electronic devices, each of which has its own DMA controller. In this case, the DMA controller can be used to transfer data between different devices, for example, to transfer data from one electronic device to another electronic device: for example, in a local area network, if a device needs to transfer data to another device, the DMA controller can be configured to directly transfer data between the two devices without the intermediary of the CPU. Thus, the efficiency of data transmission can be improved and the burden on the CPU can be reduced. Exemplarily, a DMA controller is applied in a network switch or router. In a network device, a DMA controller can be used to manage the transmission of data packets. For example, in a router, when a data packet arrives, a DMA controller can be used to transfer the data packet from an input port to an appropriate output port without the intervention of the CPU, thereby realizing fast forwarding of data. In summary, the DMA controller can adopt different transmission modes in different application scenarios to meet actual needs and improve the performance and efficiency of the system.
[0039] In the embodiment of the present application, the implementation process of the above method is exemplified by taking the DMA controller applied to an on-chip network system composed of multiple independent electronic devices as an example. It can be understood that the DMA controller can realize the transmission of data to be transmitted from one electronic device to another electronic device. For the convenience of explanation, for the data to be transmitted, the electronic device that sends the data is called a source node, and the electronic device that receives the data is called a target node.
[0040] Based on the above, when any electronic device has a data transmission demand, a DMA request can be sent to the DMA controller to initialize the DMA controller. In the embodiment of the present application, the specific method of the electronic device sending the DMA request to the DMA controller is not limited. For example, the electronic device can use any one of the single-byte transmission mode, the group transmission mode or the query transmission mode to send the DMA request to the DMA controller. According to different actual needs, the method of sending the DMA request can be different. Further, the embodiment of this application also does not limit the specific content of the electronic device performing the initialization operation on the DMA controller, including but not limited to executing necessary input or output (Input / Output, I / O) instructions, setting the starting address and data amount of the data to be transmitted, setting the initial value of the relevant register of the DMA controller, testing the use status of the external device, starting the external device, etc., which can be determined according to actual needs and will not be described in detail here.
[0041] In an embodiment of the present application, a DMA request includes a source address, a target address, and a data volume of the data to be transmitted. Based on this, after receiving the DMA request, the DMA controller can determine the source address, the target address, and the data volume of the data to be transmitted this time. Further, based on the source address and the target address, the DMA controller can determine the actual throughput corresponding to the corresponding source node and the target node, respectively, so as to determine the data bandwidth of the data transmitted this time according to the actual throughput corresponding to the source node and the target node, respectively. In this way, in the subsequent data transmission process, the speed of the data transmission this time can be controlled according to the actual throughput of the source node sending the data or the target node receiving the data, without the need for hardware equipment, and the implementation method is simpler.
[0042] It should be noted that the embodiment of the present application does not limit the specific method by which the DMA controller determines the actual throughput corresponding to the source node and the target node respectively. The determination method may also be different according to the specific situation of the DMA controller application. For example, the DMA controller may determine the data transmission rate, data bandwidth, transmission protocol, etc. through the hardware interface and specifications matching the source node and the target node to determine the actual throughput corresponding to the source node and the target node respectively. For another example, the DMA controller may also determine the actual throughput corresponding to the source node and the target node respectively through the device driver program in the source node and the target node that is connected to the DMA controller for communication. For another example, in the case of the specific bandwidth monitoring and feedback function of the DMA controller, the data transmission rate between the source node and the target node may also be monitored and measured in real time through the function, and then, according to the monitored and measured data transmission rate, the DMA controller may determine the actual throughput corresponding to the source node and the target node respectively. Of course, the above method is only an exemplary description and is not limited to this in practical applications.
[0043] Further, after determining the data bandwidth of the data to be transmitted this time, the DMA controller can also determine a transmission channel that matches the data bandwidth, so as to transmit the corresponding amount of data to be transmitted from the source node to the target node through the matching transmission channel. Among them, the specific method of determining the transmission channel is not limited in the embodiment of the present application. For example, the transmission channel that can be used to transmit data from the source node to the target node can be determined according to the preset correspondence between the transmission channel in the DMA controller and the external device; for another example, the transmission channel that matches the type of data to be transmitted this time can be determined according to the data type that can be transmitted by the transmission channel in the DMA controller; for another example, the transmission channel that is preferentially used for the data to be transmitted this time can be determined according to the priority set by the DMA controller for different transmission channels; for another example, the matching transmission channel can be dynamically determined for the data to be transmitted this time according to the current load and performance of the system determined by the operating system or device driver, and so on. Regarding the specific method of determining the transmission channel, it can be flexibly determined according to actual needs. In actual applications, it is not limited to the above-mentioned examples.
[0044] The following is an illustrative description of the specific implementation of each step in the above method.
[0045] In an optional embodiment, when the DMA controller determines the data bandwidth of the current transmission data according to the actual throughputs corresponding to the source node and the target node respectively, it can determine the node with a small throughput as the reference node according to the actual throughputs corresponding to the source node and the target node respectively, and then determine the data bandwidth of the current transmission data according to the actual throughput of the reference node. Among them, the purpose of using the node with a small throughput as the reference node is to ensure that the data bandwidth of the current transmission data does not exceed the actual throughput of the reference node. In this way, during the data transmission process, there will be no situation where data is accumulated at the target node because the sending speed of the source node is greater than the receiving speed of the target node, and there will be no situation where the target node is blind because the sending speed of the source node is less than the receiving speed of the target node. Optionally, when determining the data bandwidth of the current transmission data according to the actual throughput of the reference node, the transmission rate corresponding to the actual throughput of the reference node can be directly used as the maximum value of the data bandwidth of the current transmission data. Of course, in order to ensure a certain fault tolerance rate, it is also possible to make appropriate adjustments based on the transmission rate corresponding to the actual throughput of the reference node, such as reducing the transmission rate according to a preset adjustment ratio, and using the adjusted transmission rate as the maximum value of the data bandwidth of the current transmission data. The specific determination method can be determined according to actual needs and is not limited here.
[0046] As an optional embodiment, the following describes how to determine the data bandwidth of the current data transmission according to the actual throughput of the source node and the target node in combination with a specific example.
[0047] First, according to the actual throughputs corresponding to the source node and the target node respectively, the node with the smaller throughput is first determined as the reference node. The purpose of this is to ensure that the data bandwidth of the data transmitted this time will not exceed the actual throughput of the reference node. For example, if the actual throughput of the source node is 100Mbps, and the actual throughput of the target node is 80Mbps, the target node is selected as the reference node. Furthermore, the transmission rate corresponding to the actual throughput of the reference node can be directly used as the maximum value of the data bandwidth of the data transmitted this time. Continuing with the above example, if the actual throughput of the target node is 80Mbps, 80Mbps is used as the maximum value of the data bandwidth of the data transmitted this time. Alternatively, appropriate adjustments are made based on the transmission rate corresponding to the actual throughput of the reference node to ensure a certain fault tolerance rate. For example, the transmission rate of the reference node can be adjusted according to a preset adjustment ratio (for example, reduced by 10%), and then the adjusted transmission rate is used as the maximum value of the data bandwidth of the data transmitted this time.
[0048] In this way, problems caused by throughput mismatch between the source node and the target node can be avoided. If the sending speed of the source node is greater than the receiving speed of the target node, data may accumulate at the target node. Conversely, if the sending speed of the source node is less than the receiving speed of the target node, the target node may be blinded, affecting the overall transmission efficiency.
[0049] It is worth noting that the specific adjustment method and fault tolerance can be determined according to actual needs and system characteristics, and can be flexibly adjusted according to actual conditions. This method can effectively manage the bandwidth of data transmission and improve the stability and efficiency of the system.
[0050] In an optional embodiment, when the DMA controller determines the matching transmission channel according to the data bandwidth of the data to be transmitted this time, it can first determine the matching target virtual channel according to the data bandwidth of the data to be transmitted this time; and then determine the target physical channel that matches the target virtual channel, so as to use the target physical channel as the transmission channel. Among them, the specific method of determining the target virtual channel is not limited in the embodiment of the present application. Optionally, the DMA controller can configure different transmission bandwidths for each virtual channel through the first configuration information. Based on this, by obtaining the first configuration information, the DMA controller can determine the transmission bandwidth of each virtual channel, and then, according to the transmission bandwidth of each virtual channel, determine the target virtual channel that is adapted to the data bandwidth of the data to be transmitted this time. Correspondingly, the method of determining the target physical channel is not limited in the embodiment of the present application. Optionally, the DMA controller can configure the mapping relationship between each physical channel and each virtual channel through the second configuration information. Based on this, by obtaining the second configuration information, the DMA controller can determine the target physical channel that matches the target virtual channel.
[0051] In addition, the DMA controller may also adopt other strategies to match the target virtual channel to the target physical channel. For example, for a single-threaded communication scenario, the DMA controller may detect the usage status of each physical channel in a polling manner, and when it is determined that there is an idle physical channel, the idle physical channel is determined as the target physical channel that matches the target virtual channel. For another example, for a multi-threaded communication scenario, if there are multiple virtual channels requesting access to the physical channel, the DMA controller may determine the target physical channel that matches the target virtual channel according to the priority of each virtual channel; accordingly, the priority of each virtual channel may be pre-configured or determined based on the principle of first come first serve (FCFS) in the order in which each virtual channel requests access, and the specific method is not limited. Further optionally, if there are multiple idle physical channels, the priority of each physical channel may be further combined to match the target virtual channel to the target physical channel, and so on. It should be noted that the above determination method is only an exemplary description, and is not limited to this in practical applications. All feasible determination methods are applicable to the embodiments of the present application, and will not be repeated here.
[0052] Based on this, after the target virtual channel is assigned access rights to the target physical channel, the data to be transmitted can be transmitted from the source node to the target node through the target physical channel. The specific method of assigning access rights to the target physical channel to the target virtual channel is not limited in the embodiment of the present application, and different methods can be selected according to actual communication scenarios and communication requirements.
[0053] For example, when the DMA controller determines a matching transmission channel, it needs to consider the data transmission requirements between the source node and the target node and the channel resources available in the system. The following is a specific example of how the DMA controller determines a matching transmission channel. In this example, it is assumed that there is an embedded system that includes a DMA controller and multiple virtual channels, each of which corresponds to a specific data transmission requirement. In addition, there are multiple physical channels in the system that can be used by the DMA controller. First, the DMA controller obtains the transmission bandwidth of each virtual channel according to the first configuration information. For example, it is assumed that there are three virtual channels in the system: A, B, and C, and their transmission bandwidths are 100Mbps, 80Mbps, and 120Mbps, respectively. Assume that the data bandwidth currently required to be transmitted is 90Mbps. The DMA controller selects a target virtual channel that matches this data bandwidth. In this case, the transmission bandwidth of virtual channel B is closest to the requirement, so the DMA controller selects virtual channel B as the target virtual channel. Then, the DMA controller obtains the mapping relationship between each virtual channel and the physical channel according to the second configuration information. Assume that the mapping relationship is as follows: virtual channel A corresponds to physical channel 1, virtual channel B corresponds to physical channel 2, and virtual channel C corresponds to physical channel 3. In addition, the DMA controller also checks the usage status of each physical channel. Assume that physical channels 1 and 3 are currently in use, while physical channel 2 is idle. In this case, the DMA controller selects physical channel 2 corresponding to virtual channel B as the target physical channel. Therefore, the matching transmission channels determined by the DMA controller are virtual channel B and physical channel 2. In this way, the DMA controller can use physical channel 2 to transmit the data to be transmitted, thereby meeting the transmission requirements and ensuring the effective use of channel resources in the system.
[0054] In an optional manner, before the data is transmitted this time, a first access frequency for accessing the physical channel can be pre-set for the data to be transmitted this time. Based on this, by obtaining the first access rate, the DMA controller can allocate the target virtual channel with the access right of the target physical channel. The specific form of the first access frequency is not limited in this embodiment. Optionally, the first access frequency can be a pre-set access cycle including n clock cycles; wherein the value of n is not limited and can be flexibly determined according to the actual conditions such as network load, the amount of data transmitted this time, and the throughput of the source node and the target node. Further optionally, the pre-set access cycle can be stored in the control and status registers (Control and Status Registers, CSR). Based on this, after the DMA controller obtains the pre-set access cycle from the control and status registers, it can allocate the target virtual channel with the access right of the target physical channel according to the access cycle.
[0055] In another optional manner, the DMA controller can also dynamically determine the second access frequency according to the transmission bandwidth of the target virtual channel for the data transmission this time. For example, according to the data volume of the data transmission this time and the transmission bandwidth of the target virtual channel, the DMA controller can determine the total duration of the data transmission this time, and then, in combination with the actual conditions such as the network load, the data volume of the transmission this time, the throughput of the source node and the target node, an appropriate second access frequency can be determined. Based on this, the DMA controller can allocate the access right of the target physical channel to the target virtual channel according to the second access frequency.
[0056] Of course, the above method is only an exemplary description. In actual application, an optional method may also be used to allocate the access right of the target physical channel to the target virtual channel, which will not be described in detail here.
[0057] Based on the above, after the target virtual channel obtains the access right to the target physical channel, it can enter the on-chip network through the matching physical channel, transmit the corresponding data from the source node to the target node, and complete the data transmission process.
[0058] The following is a brief description of the application process of the above method from the perspective of data transmission process in conjunction with the accompanying drawings.
[0059] Figure 1b A schematic diagram of a data transmission process provided in an embodiment of the present application, such as Figure 1b As shown, when multiple electronic devices have data transmission requirements, they can send DMA requests to the DMA controller respectively; based on this, after receiving the DMA requests sent by multiple electronic devices, the DMA controller can determine the process of each electronic device requesting data transmission as a processing task, and according to the DMA request corresponding to each processing task, the actual throughput corresponding to the source node and the target node of the corresponding request can be determined, and the data bandwidth corresponding to each processing task can be determined; further, according to the data bandwidth corresponding to each processing task, the matching virtual channel is determined, and the access right of the physical channel is allocated to each virtual channel, so as to complete the corresponding processing task through the corresponding physical channel via the on-chip network. As shown Figure 1b As shown, when the DMA controller allocates the access right of the physical channel to each virtual channel, it can be implemented through the arbitration module inside the DMA controller without adding additional hardware overhead. While ensuring the quality of data transmission, it can also save device resources.
[0060] It should be noted that Figure 1bThe number of virtual channels and physical channels in the DMA controller shown is only shown as an example and is not limited to this in actual applications. This example uses multiple electronic devices requesting the same DMA controller to process data transmission as an example for illustration, in order to demonstrate that the data transmission method provided in the embodiment of the present application can achieve reasonable scheduling of multiple data processing tasks with different data bandwidths, but it is not limited to this in actual applications. For example, in the case where a communication system includes multiple DMA controllers, multiple electronic devices can also send DMA requests to different DMA controllers respectively, where each DMA controller processes the data transmission differently. Figure 1b The principles of the processes shown are the same and will not be repeated here.
[0061] It should be further explained that Figure 1b The example shown only provides an overview of the application process of the above method from the perspective of the data transmission process. For other specific processing processes, please refer to the corresponding part of the description of the aforementioned method embodiment, which will not be described in detail here.
[0062] In an embodiment of the present application, the DMA controller can determine the actual throughput of the corresponding source node and the target node based on the received DMA request; further, the data bandwidth of this data transmission is determined based on the smaller actual throughput, which can ensure that the rate of subsequent control data transmission does not exceed the sending and receiving rate between the source node and the target node, avoiding data congestion, target node blindness, etc., and effectively ensuring the quality of data transmission; and, by using the hardware function of the DMA controller itself, the virtual channel and physical channel of the corresponding data bandwidth are matched for this data transmission, without the need for additional hardware overhead, which is conducive to saving equipment resources.
[0063] Based on the same implementation principle, an embodiment of the present application also provides a DMA controller for implementing the data transmission method in the above embodiment.
[0064] Figure 2 The structural block diagram of the DMA controller 200 provided in the embodiment of the present application is as follows: Figure 2 As shown, the DMA controller 200 includes: a receiving module 201, a determining module 202 and an arbitration module 203; wherein,
[0065] The receiving module 201 is used to receive a DMA request, which includes a source address, a target address and a data amount of the data to be transmitted;
[0066] The determination module 202 is used to determine the actual throughputs corresponding to the corresponding source node and the target node respectively according to the source address and the target address; and determine the data bandwidth of the current transmission data according to the actual throughputs corresponding to the source node and the target node respectively;
[0067] The arbitration module 203 is used to determine a matching transmission channel according to the data bandwidth, so as to transmit the corresponding data volume of the to-be-transmitted data from the source node to the target node through the transmission channel.
[0068] In an optional embodiment, when determining the data bandwidth of the current data transmission based on the actual throughputs corresponding to the source node and the target node respectively, the determination module 202 is used to: determine a node with a smaller throughput as a reference node based on the actual throughputs corresponding to the source node and the target node respectively; and determine the data bandwidth of the current data transmission based on the actual throughput of the reference node.
[0069] In an optional embodiment, when determining a matching transmission channel according to the data bandwidth, the arbitration module 203 is used to: determine a matching target virtual channel according to the data bandwidth, and determine a target physical channel corresponding to the target virtual channel, allocate access rights to the target physical channel to the target virtual channel, and use the target physical channel as a transmission channel.
[0070] In an optional embodiment, when determining a matching target virtual channel according to the data bandwidth, the arbitration module 203 is used to: obtain first configuration information, wherein the first configuration information includes a transmission bandwidth of each virtual channel; and determine a target virtual channel adapted to the data bandwidth according to the transmission bandwidth of each virtual channel.
[0071] In an optional embodiment, when determining the target physical channel corresponding to the target virtual channel, the arbitration module 203 is used to: obtain second configuration information, wherein the second configuration information includes a mapping relationship between each physical channel and each virtual channel; and determine a target physical channel that matches the target virtual channel according to the mapping relationship.
[0072] In an optional embodiment, when allocating access rights of a target physical channel to a target virtual channel, the arbitration module 203 is used to: obtain a first access frequency pre-set for the current transmission data; and allocate access rights of the target physical channel to the target virtual channel according to the first access frequency.
[0073] In an optional embodiment, when allocating access rights of a target physical channel to a target virtual channel, the arbitration module 203 is configured to: determine a second access frequency according to data volume and transmission bandwidth; and allocate access rights of a target physical channel to the target virtual channel according to the second access frequency.
[0074] It should be noted that, regarding the DMA controller provided in the implementation of this application, the specific functions and implementation details of each module therein have the same implementation principles as the implementation process of the corresponding steps in the aforementioned method embodiment. For details, please refer to the description of the corresponding parts in the aforementioned method embodiment, which will not be repeated here.
[0075] Based on the same implementation principle, the embodiment of the present application also provides an electronic device, Figure 3 is a structural block diagram of the electronic device 300, such as Figure 3 As shown, the electronic device 300 includes: a processor 301, a memory 302, a communication interface 303, a communication bus 304 and a DMA controller 305; wherein the processor 301, the memory 302, and the communication interface 303 communicate with each other through the communication bus 304; the memory 302 is used to store computer programs; the processor 301 is used to execute the programs stored in the memory 302 to realize the corresponding processing functions; the communication interface 304 is used for communication between the electronic device 300 and other devices; the DMA controller 305 is used to realize the data transmission method described in the above method embodiment.
[0076] In the embodiment of the present application, the communication bus 304 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus 304 may be divided into an address bus, a data bus, a control bus, etc., and the specific form is not limited. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0077] The memory 302 may include a random access memory (RAM) or a non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor 301 .
[0078] The processor 301 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other editable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the specific form can be determined according to actual needs.
[0079] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed, can implement each step that can be executed by an electronic device in the above method embodiment.
[0080] It should be noted that although one or more embodiments of the present application provide method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, in a parallel processor or multi-threaded processing environment).
[0081] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices (systems) or computer program products. Therefore, the embodiments of the present application may take the form of complete hardware embodiments, complete software embodiments or embodiments combining software and hardware. Moreover, one or more embodiments of the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0082] One or more embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to one or more embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0083] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0084] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0085] Each embodiment in this application 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 device and system 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.
[0086] In this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. For those of ordinary skill in the art, the specific meaning of the above terms in one or more embodiments of the present application can be understood according to the specific circumstances.
[0087] It should be noted that, in the absence of conflict, the features in one or more embodiments of the present application and the embodiments may be combined with each other. The one or more embodiments of the present application are not limited to any single aspect, nor to any single embodiment, nor to any combination and / or replacement of these aspects and / or embodiments. Moreover, each aspect and / or embodiment of one or more embodiments of the present application may be used alone or in combination with one or more other aspects and / or embodiments thereof.
[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of one or more embodiments of the present application, rather than to limit them. Although one or more embodiments of the present application have been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features may be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of one or more embodiments of the present application, and they should all be included in the scope of the claims and specifications of one or more embodiments of the present application.
[0089] One or more embodiments of the present application are described above in conjunction with optional implementation methods, but these implementation methods are only exemplary and serve only as an illustration. On this basis, multiple replacements and improvements can be made to one or more embodiments of the present application, all of which fall within the scope of protection of one or more embodiments of the present application.
Claims
1. A data transmission method, applicable to a DMA controller, characterized in that: include: receiving a DMA request, wherein the DMA request includes a source address, a destination address, and a data amount of data to be transmitted; Determine actual throughputs corresponding to the source node and the target node respectively according to the source address and the target address; Determine the data bandwidth of the current transmission data according to the actual throughputs corresponding to the source node and the target node respectively; Determine a matching transmission channel according to the data bandwidth, so as to transmit the to-be-transmitted data corresponding to the data volume from the source node to the target node through the transmission channel; The step of determining the data bandwidth of the current transmission data according to the actual throughputs corresponding to the source node and the target node respectively includes: According to the actual throughputs respectively corresponding to the source node and the target node, determine a node with a small throughput as a reference node; Determining the data bandwidth of the current transmission data according to the actual throughput of the reference node includes: based on the transmission rate corresponding to the actual throughput of the reference node, directly using the transmission rate corresponding to the actual throughput of the reference node as the maximum value of the data bandwidth of the current transmission data, or reducing the transmission rate corresponding to the actual throughput of the reference node according to a preset adjustment ratio, and using the reduced transmission rate as the maximum value of the data bandwidth of the current transmission data; Wherein, determining a matching transmission channel according to the data bandwidth includes: Determine a matching target virtual channel according to the data bandwidth; Determining a target physical channel corresponding to the target virtual channel; The target virtual channel is allocated access rights to the target physical channel, and the target physical channel is used as a transmission channel; the access rights are set based on a first access frequency, the first access frequency is determined by an access cycle, and the access cycle is obtained from a control and status register.
2. The method according to claim 1, characterized in that Determining a matching target virtual channel according to the data bandwidth includes: Acquire first configuration information, where the first configuration information includes a transmission bandwidth of each virtual channel; According to the transmission bandwidth of each virtual channel, a target virtual channel adapted to the data bandwidth is determined.
3. The method according to claim 1, characterized in that Determining a target physical channel corresponding to the target virtual channel includes: Acquire second configuration information, where the second configuration information includes a mapping relationship between each physical channel and each virtual channel; A target physical channel matching the target virtual channel is determined according to the mapping relationship.
4. The method according to claim 2, characterized in that: Allocating access rights of the target physical channel to the target virtual channel includes: Obtaining a first access frequency pre-set for the current transmission data; According to the first access frequency, the access right of the target physical channel is allocated to the target virtual channel.
5. The method according to claim 2, characterized in that: Allocating access rights of the target physical channel to the target virtual channel includes: Determining a second access frequency according to the data volume and the transmission bandwidth; According to the second access frequency, the access right of the target physical channel is allocated to the target virtual channel.
6. An electronic device, characterized in that: It includes a DMA controller, and the DMA controller is used to implement the data transmission method described in any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed, implement the data transmission method described in any one of claims 1 to 5.
