Data transmission method, electronic equipment, system and storage medium

By encapsulating and sending a specific type of TLP message in the PCIe bus system, the problem of updating the descriptor status when the RC device data is not completely written is solved, and the reliability of data transmission is improved.

CN120658694APending Publication Date: 2025-09-16PHYTIUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510662424.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-21
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

In the PCIe bus system, when the RC device writes data to the memory and updates the descriptor status, the descriptor status is updated before the data is completely written, causing the CPU to read incomplete data and reducing data transmission reliability.

Method used

The EP device encapsulates multiple TLP messages, including a first TLP message for transmitting data and a second TLP message for transmitting a descriptor status update instruction, and sends a descriptor status update instruction of the second TLP message after sending all the first TLP message data to ensure that the descriptor status is updated after the data transmission is completed.

Benefits of technology

Improves the reliability of data transmission and ensures that the processor reads complete and correct data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120658694A_ABST
    Figure CN120658694A_ABST
Patent Text Reader

Abstract

The invention provides a data transmission method, related equipment, a system and a storage medium, which are applied to the technical field of computers, the method is applied to a PCIe bus system comprising RC equipment and EP equipment, the EP equipment packages a plurality of TLP messages including a first TLP message and a second TLP message, and after the RC equipment acquires the plurality of TLP messages, the first TLP message and the second TLP message are transmitted to the storage medium. Identifying a first TLP message used for transmitting data and a second TLP message used for transmitting a descriptor state updating instruction in the plurality of TLP messages, and sending the descriptor state updating instruction of the second TLP message after sending all the data of the first TLP message, the descriptor state updating instruction is limited to be sent after the data of all the first TLP messages are sent, so that the descriptor state can be updated after data transmission is completed, the processor can be ensured to read complete and correct data, and the reliability of data transmission is effectively 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 data transmission method, electronic device, system, and storage medium. Background Art

[0002] In the existing PCIe (Peripheral Component Interconnect express) bus system, EP (End Point) devices are integrated with DMA (Direct Memory Access) controllers. EP devices can use DMA controllers to directly read or write data from the host memory without excessive CPU (Central Processing Unit) involvement, reducing the CPU burden and significantly improving data transmission efficiency.

[0003] Based on the DMA data transmission mechanism, after the EP device sends the TLP (Transaction Layer Packet) message to the RC (Root Complex) device, the RC device sends the TLP message to the memory to write data to the storage space of the memory. Afterwards, the descriptor status of the descriptor corresponding to the storage space is updated, and the CPU responds to the descriptor status update to obtain the data in the storage space.

[0004] However, the inventors have found that in the process of the RC device writing data to the memory and updating the descriptor status, it is possible that the data has not been completely written to the storage space, but the descriptor status has been updated. That is, the order of data writing and descriptor status updating is disordered. Since the CPU will immediately read the data in the storage space after the descriptor status is updated, this will cause the CPU to read incomplete data, and the reliability of data transmission is poor. Summary of the Invention

[0005] In view of this, the present application is dedicated to providing a data transmission method, electronic device, system and storage medium to solve the problem of poor data transmission reliability in existing PCIe systems.

[0006] In a first aspect, the present application provides a data transmission method, applied to a root complex RC device, the method comprising:

[0007] Get multiple transaction layer data packets TLP messages;

[0008] Identifying a first TLP message and a second TLP message among the plurality of TLP messages, wherein the first TLP message is used to transmit data, and the second TLP message is used to transmit a descriptor status update instruction;

[0009] After sending the data of each of the first TLP messages, the descriptor status update instruction is sent to update the descriptor status after the data transmission is completed.

[0010] In an optional implementation, identifying the first TLP message and the second TLP message in the plurality of TLP messages includes:

[0011] Extracting a device identifier in a target TLP message, wherein the target TLP message is any one of the multiple TLP messages;

[0012] If the device identifier indicates that the endpoint EP device sends data and updates the descriptor, identifying that the target TLP message belongs to the first TLP message or the second TLP message;

[0013] If the device identifier indicates that the EP device to which it belongs only sends data, the data of the target TLP message is sent.

[0014] In an optional implementation, the TLP message includes a flag field, and the flag field is used to indicate a message type of the TLP message;

[0015] Identifying whether the target TLP message belongs to the first TLP message or the second TLP message includes:

[0016] Extract the current field value of the flag field of the target TLP message;

[0017] It is identified based on the current field value of the target TLP message that the target TLP message belongs to the first TLP message or the second TLP message.

[0018] In an optional implementation, identifying whether the target TLP message belongs to the first TLP message or the second TLP message based on the current field value of the target TLP message includes:

[0019] If the current field value of the flag field in the target TLP message is the first field value, determining that the target TLP message is the first TLP message;

[0020] If the current field value of the flag field in the target TLP message is the second field value, it is determined that the target TLP message is the second TLP message.

[0021] In an optional implementation manner, after sending the data of each first TLP message, sending the descriptor status update instruction includes:

[0022] Sending data carried by each of the first TLP messages in sequence, and obtaining notification information corresponding to each of the first TLP messages, wherein the notification information is used to indicate that the data transmission carried by the first TLP message is completed;

[0023] The descriptor status update instruction is sent in response to target notification information, wherein the target notification information is notification information corresponding to the last first TLP message sent among the first TLP messages.

[0024] In a second aspect, the present application provides a data transmission method, applied to an endpoint EP device, the method comprising:

[0025] Encapsulating multiple transaction layer data packets (TLP) messages, wherein the multiple TLP messages include a first TLP message and a second TLP message, wherein the first TLP message is used to transmit data, and the second TLP message is used to transmit a descriptor status update instruction;

[0026] Each of the TLP messages is sent to the root complex RC device. The RC device sends the descriptor status update instruction after the data transmission of the first TLP message is completed, so as to update the descriptor status after the data transmission is completed.

[0027] In an optional implementation, the TLP message includes a flag field, and the flag field is used to indicate a message type of the TLP message;

[0028] The process of encapsulating the TLP message includes:

[0029] Obtaining a target storage address, where the target storage address is a storage address of data to be transmitted;

[0030] A plurality of TLP messages are encapsulated based on the target storage address, the data, the descriptor status update instruction, and the field value of the flag field.

[0031] In an optional implementation, encapsulating multiple TLP messages based on the target storage address, the data, the descriptor status update instruction, and the field value of the flag field includes:

[0032] Encapsulating the data, the target storage address, and the first field value of the flag field into a TLP message to obtain a first TLP message;

[0033] Furthermore, the target storage address, the descriptor status update instruction, and the second field value of the flag field are encapsulated into a TLP message to obtain a second TLP message.

[0034] In an optional implementation, the process of encapsulating the TLP message further includes:

[0035] A device identifier is added to the TLP message, where the device identifier is used to indicate that the EP device to which the TLP message belongs only sends data or sends data and updates a descriptor.

[0036] In an optional implementation, the sending each of the TLP messages to the root complex RC device includes:

[0037] Sending each of the first TLP messages to the RC device in sequence;

[0038] After sending all of the first TLP messages, send the second TLP message.

[0039] In a third aspect, the present application provides an electronic device, comprising:

[0040] a memory for storing instructions;

[0041] A processor is used to execute the data transmission method as described in any embodiment of the first aspect or the second aspect of the present application according to the instructions stored in the memory.

[0042] In a fourth aspect, the present application provides a data transmission system, comprising: a root complex RC device and an endpoint EP device communicatively connected to the RC device, wherein:

[0043] The RC device executes the data transmission method as described in any embodiment of the first aspect of the present application;

[0044] The EP device executes the data transmission method as described in any embodiment of the second aspect of this application.

[0045] In a fifth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed, implements the data transmission method as described in any embodiment of the first aspect or the second aspect of the present application.

[0046] Based on the above content, the EP device encapsulates multiple TLP messages, including a first TLP message and a second TLP message. After the RC device obtains the multiple TLP messages, it identifies the first TLP message used to transmit data and the second TLP message used to transmit the descriptor status update instruction in the obtained multiple TLP messages, and sends the descriptor status update instruction of the second TLP message after sending the data of all the first TLP messages. By limiting the sending of the descriptor status update instruction to after the data of all the first TLP messages is sent, it can ensure that the descriptor status is updated after the data transmission is completed, thereby ensuring that the processor can read complete and correct data, effectively improving the reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0048] Figure 1 This is a structural diagram of a PCIe bus system in the prior art.

[0049] Figure 2 This is a flow chart of a data transmission method provided by this application.

[0050] Figure 3 This is a schematic diagram of the correspondence between DMA descriptors and storage space.

[0051] Figure 4 This is a schematic diagram of the structure of the TLP header of the TLP message.

[0052] Figure 5 This is a flowchart of another data transmission method provided by this application.

[0053] Figure 6 This is a structural block diagram of an electronic device provided by this application. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0055] PCIe is a high-speed serial computer expansion bus standard, widely used for communication between processors and high-speed peripherals. In actual applications, the PCIe bus system consists of multiple point-to-point interconnected components. Figure 1 As shown in the topology diagram of the PCIe bus system, the PCIe bus system generally adopts a tree topology. The aforementioned interconnected components mainly include PCIe nodes of types such as CPU, RC device, switch device (Switch) and EP device. In addition, the PCIe bus system may also include memory. The CPU, RC device and memory in the aforementioned PCIe nodes are respectively connected to the on-chip system and communicate with each other through the on-chip network to complete data transmission.

[0056] In a typical CPU+accelerator heterogeneous computing system, the RC device sits between the CPU and the PCIe topology, connecting to the CPU via a bus and managing the nodes in the PCIe tree. The RC device and CPU are interconnected via an on-chip network, which in practice can be an AXI (Advanced eXtensible Interface) bus. The RC device's primary function is to translate addresses from the memory domain to the PCIe bus domain. It also serves as the root of the PCIe bus system, integrating interfaces for the PCIe bus system and peripherals. It can expose several PCIe interfaces, each of which can connect to a PCIe node. The RC device receives messages transmitted by PCIe nodes to access memory. Conversely, the RC device can also forward processor requests to the EP devices mounted on the system, enabling communication between the processor and the EP devices.

[0057] The main function of a switch is to expand PCIe links. Each data link on a PCIe bus only covers two devices, which is not enough to meet the needs. Therefore, a switch can be used to expand the link. It is understandable that if the PCIe bus system is small, a switch may not be required.

[0058] EP devices can be understood as devices that implement independent functions in the PCIe bus system. Different EP devices often support different functions, allowing the PCIe bus system as a whole to support diverse application functions. In actual applications, more typical EP devices include graphics cards, network cards, etc. At the same time, EP devices are also the initiators and responders of PCIe transactions. Figure 1 As shown, the EP device can be directly connected to the RC device for communication, or it can be connected to the RC device for communication through a switching device. It should be noted that regardless of whether a switching device is set up, the message transmission process between the RC device and the EP device is not affected. In the data transmission method provided in the subsequent embodiments of this application, the role of the switching device in the message transmission process between the RC device and the EP device is omitted, and the subsequent content will not reiterate this premise.

[0059] It is understandable that Figure 1 The PCIe bus system architecture shown can also represent a structural example of a system on a chip. Accordingly, in another optional implementation, the system on a chip may not include a switching device, which will not be described in detail here.

[0060] Based on the setting of PCIe bus rules, the PCIe bus system includes two data transmission paths, namely Direct Memory Access (DMA) path and Programmable Input-Output (PIO) path. Among them, when the processor transfers data to the EP device via the RC device, the PIO path is usually used, and under the PIO path, the data transmission process is completed by the processor executing PIO instructions in bytes or larger data units. Under the PIO path, the device relationship is defined according to the data transmission flow direction. The upstream device connected to the RC device can usually be the processor, and the downstream device connected to the RC device can be the EP device. Of course, it also includes the EP device connected to the RC device through the switching device. This application does not elaborate on the process of the processor transmitting data to the EP device via the PIO path. For details, please refer to the relevant technology.

[0061] When EP devices write data to memory, they typically use a DMA channel. EP devices have an integrated DMA controller that can be used to read or write data directly from the host memory without requiring excessive CPU involvement, thereby reducing the CPU burden and significantly improving data transfer efficiency.

[0062] Based on the DMA data transmission mechanism, after the EP device sends the TLP (Transaction Layer Packet) message to the RC device, the RC device sends the TLP message to the memory. The memory controller extracts the data transmitted by the TLP message and writes the data into the storage space of the memory. After that, the descriptor status of the descriptor corresponding to the storage space is updated. The CPU responds to the descriptor status update and obtains the data in the storage space.

[0063] However, the inventors have found that in the process of the RC device writing data to the memory and updating the descriptor status, it is possible that the data has not been completely written to the storage space, but the descriptor status has been updated. That is, the order of data writing and descriptor status updating is disordered. Since the CPU will immediately read the data in the storage space after the descriptor status is updated, this will cause the CPU to read incomplete data, and the reliability of data transmission is poor.

[0064] In order to solve the above problems, this application provides a data transmission method, which is applied to Figure 1In the PCIe system shown in the present method, the EP device encapsulates multiple TLP messages, and after the RC device obtains the multiple TLP messages, it identifies the first TLP message used to transmit data and the second TLP message used to transmit the descriptor status update instruction in the obtained multiple TLP messages, and after sending the data of all the first TLP messages, sends the descriptor status update instruction of the second TLP message. By limiting the sending of the descriptor status update instruction to after the data of all the first TLP messages are sent, it can be ensured that the descriptor status is updated after the data transmission is completed, thereby ensuring that the processor can read complete and correct data, effectively improving the reliability of data transmission.

[0065] Based on the above content, this application provides a data transmission method, which is specifically applied to the EP device of the PCIe chip system. Figure 2 As shown, the data transmission method provided by this embodiment may include the following steps.

[0066] S100: Encapsulate multiple TLP messages.

[0067] Data is transmitted between PCIe nodes in the PCIe bus system in the form of messages. Usually, PCIe nodes encapsulate TLP messages according to the type of communication request, destination address, specific data to be transmitted, and other related attributes.

[0068] Different from the related art, the multiple TLP messages encapsulated by the EP device in this application include a first TLP message and a second TLP message, wherein the first TLP message is used to transmit data and the second TLP message is used to transmit descriptor status update instructions. Based on this, it can be understood that the multiple TLPs described in each embodiment of the present application include two or more TLP messages.

[0069] Based on the rules of the DMA communication mechanism, the CPU configures the DMA descriptors and memory storage used during data transfer. In practice, before the PCIe bus system begins data transfer, the CPU first creates memory space in memory to store the data to be transferred, essentially allocating memory space for the data to be transferred. In one optional embodiment, the capacity of the memory space configured by the CPU corresponds to the size of the data to be transferred, and at least cannot be less than the size of the data to be transferred.

[0070] Furthermore, the CPU configures the DMA descriptors corresponding to each storage space. In actual applications, the storage space and the DMA descriptor are in a one-to-one correspondence, and each descriptor is used to uniquely represent a storage space. Figure 3As shown in the figure, for example, DMA descriptor 0 corresponds to storage space 0, DMA descriptor 1 corresponds to storage space 1, and so on. DMA descriptor n corresponds to storage space n, where n is a positive integer. The DMA descriptor and the corresponding data to be transmitted are both stored in the memory.

[0071] The DMA descriptor can be used to record a lot of information related to the data to be transmitted, such as the storage address of the data, the data length, and the data size. Of course, other information can also be recorded through the DMA descriptor. In short, any information related to the data transmission process can be recorded through the descriptor. It should be emphasized that the DMA descriptor includes a descriptor status bit, which is used to record the descriptor status. In actual applications, the descriptor status is used to indicate whether the data in the corresponding storage space has been updated. Specifically, when the descriptor status is a first state, it indicates that the data in the corresponding storage space has been updated. When the descriptor status is a second state, it indicates that the data in the corresponding storage space has not been updated. In an optional embodiment, a first value, such as 1, represents the aforementioned first state, and correspondingly, a second value, such as 0, represents the aforementioned second state. By updating the value of the descriptor status bit, the descriptor status can be updated. As for the application of the descriptor status in this application, it will be expanded in detail in the subsequent content and will not be described in detail here.

[0072] It should be noted that, in actual applications, each EP device corresponds to a corresponding cache space, and the data uploaded by the EP device is stored in its corresponding cache space. Based on the description of the correspondence between the above descriptors and storage spaces, it can be understood that for any EP device, its corresponding cache space at least covers the storage space corresponding to one descriptor. As for the size of the cache space corresponding to the EP device, it can be determined in combination with the data interaction requirements of the EP device and the actual capacity of the memory. This application does not limit the specific division of the cache space of each EP device.

[0073] After the CPU completes the creation of the DMA descriptor and the corresponding storage space, it initiates the DMA communication mechanism via the PIO path. Specifically, the EP device is equipped with a DMA controller, which includes multiple descriptor registers, each of which corresponds to a DMA descriptor. Based on this, the CPU writes to a descriptor register in the EP device's DMA controller via the PIO path, notifying the DMA controller that the DMA descriptor corresponding to that descriptor register has been configured. The specific implementation of the CPU writing to the descriptor register via the PIO path can be referenced in related art and will not be detailed here.

[0074] The EP device responds to the CPU's write operation on the descriptor register and determines the target DMA descriptor corresponding to the descriptor register based on the one-to-one correspondence between the descriptor register and the DMA descriptor. Furthermore, the EP device accesses the target DMA descriptor in the memory to obtain the target storage address recorded in the target DMA descriptor. The target storage address is the address of the storage space where the EP device needs to store data in this application.

[0075] As mentioned above, the TLP messages transmitted by the EP device to the RC device in the present application include two types, namely, a first TLP message for transmitting data and a second TLP message for transmitting a descriptor status update instruction. As a preferred embodiment, the present application configures a flag field in the TLP message, and indicates the type of the TLP message through the flag field. Specifically, the field value of the flag field can be any one of the first field value and the second field value, wherein the first field value is used to indicate that the TLP message is the first TLP message, and correspondingly, the second field value is used to indicate that the TLP message is the second TLP message. In actual applications, the field value of the flag field is configured according to the specific type of the TLP message. For example, the first field value can be configured to 1, and the second field value can be configured to 0. Of course, other specific values ​​can also be selected according to needs, which will not be described in detail here.

[0076] In the PCIe standard, a TLP message consists of three main parts: the TLP header, data, and cyclic redundancy check (CRC) fields. The TLP header plays a crucial role in TLP message implementation, primarily recording information such as the sender, the destination address of the message recipient, the TLP type, and the data length.

[0077] The structure of a typical TLP header can be found in Figure 4 As shown, the Fmt (Format) field is used to indicate whether the TLP message carries data and whether the TLP header is 3 double words or 4 double words (DW); the Type field is used to characterize the type of the TLP message. It should be noted that the message types here mainly include memory read (Memory Read), memory write (MemoryWrite), etc. The R field is a reserved field (Reserved). The field value is generally 0 in the default state; the TC field (TrafficClass). In existing applications, the TC field in the TLP header is used to characterize the transmission level of the TLP message. It includes 3 bits, which can represent 8 different transmission levels, namely TC0-TC7. The larger the code value of the field, the higher the transmission level of the TLP message.

[0078] Based on the above, in an optional embodiment, at least one of the reserved fields and the multiplexed fields in the TLP header can be used as a flag field, for example, the aforementioned reserved field (R field) can be used as a flag field. Of course, the TC field can also be used as a flag field. For example, TC=7 can be used to indicate that the first TLP message is transmitted first during transmission, and correspondingly, TC=0 can be used to indicate that the second TLP message is transmitted last during transmission. Of course, other fields in the TLP header can also be selected as the flag fields described in this application. They will not be described in detail here. As long as they do not exceed the core concept of this application, they also fall within the scope of protection of this application.

[0079] In an optional embodiment, each TLP message can be encapsulated based on the aforementioned target storage address, data to be transmitted, descriptor status update instruction, and field value of the flag field. Specifically, according to the TLP message format, the data to be transmitted, the target storage address of the data in the memory, and the first field value of the flag field in the TLP message can be encapsulated into a TLP message, that is, a first TLP message is obtained. Correspondingly, the target storage address, descriptor status update instruction, and the second field value of the flag field can be encapsulated into a TLP message, that is, a second TLP message is obtained. As for the specific encapsulation process of the TLP message, it can be implemented with reference to related technologies and will not be described in detail here.

[0080] It is understandable that in actual applications, the number of first TLP messages will vary depending on the size of the data to be transmitted, but for any complete data transmission process, only one second TLP message is included, that is, the end of the data transmission process is represented by the second TLP message. This point will be elaborated in subsequent embodiments and will not be described in detail here.

[0081] Furthermore, in actual applications, EP devices can be roughly divided into two categories, one type of EP device only uploads data and does not update the descriptor, and the other type of EP device not only sends data but also updates the descriptor. It can be understood that for the EP device that does not update the descriptor, there is no need to identify whether the TLP message it sends belongs to the aforementioned first TLP message or the second TLP message. The TLP message can be directly sent. Therefore, it is necessary to identify the EP device to which the TLP message belongs. To this end, the device identification of the EP device can also be encapsulated in the TLP message. The device identification is used to indicate whether the corresponding EP device is an EP device that only sends data or an EP device that both sends data and updates the descriptor. By encapsulating the device identification, the process of the RC device sending the TLP message can be simplified and the data transmission efficiency can be improved. The details will be expanded in the subsequent content and will not be described in detail here.

[0082] S110 , sending each TLP message to the RC device.

[0083] After encapsulating multiple TLP messages, the RP device sends each TLP message to the RC device. As a preferred embodiment, the EP device preferentially sends each first TLP message to the RC device in a predetermined order. After all first TLP messages have been sent, the EP device sends the second TLP message to the RC device. The predetermined order can be the order in which the first TLP messages were encapsulated, or the order in which the first TLP messages were identified. Of course, other transmission criteria are also possible, which will not be detailed here.

[0084] Based on the communication mechanism of the PCIe bus system, the EP device and the RC device use point-to-point serial communication. This ensures that the first and second TLP messages, when sent from the EP device to the RC device, strictly follow the aforementioned rules and are not out of order. In an optional embodiment, after the EP device sends all first TLP messages, it waits for a response from the RC device. In response to the response from the RC device, the EP device further sends a second TLP message.

[0085] Accordingly, the RC device receives each TLP message in the aforementioned transmission order, identifies the first TLP message and the second TLP message by identifying the message type, and after sending all the data carried by the first TLP message to the memory, sends the descriptor status update instruction carried by the second TLP message to ensure that the descriptor status is updated after the data transmission is completed. This process will be explained in detail in the subsequent content and will not be described in detail here.

[0086] To sum up, through the data transmission method provided by this embodiment, the EP device encapsulates multiple TLP messages, including a first TLP message and a second TLP message. After the RC device obtains the multiple TLP messages, it identifies the first TLP message used to transmit data and the second TLP message used to transmit the descriptor status update instruction in the obtained multiple TLP messages, and after sending the data of all the first TLP messages, it sends the descriptor status update instruction of the second TLP message. By limiting the sending of the descriptor status update instruction to after the data of all the first TLP messages is sent, it can ensure that the descriptor status is updated after the data transmission is completed, thereby ensuring that the processor can read complete and correct data, thereby effectively improving the reliability of data transmission.

[0087] Furthermore, the present application provides another data transmission method, which is specifically applied to the RC device of the PCIe system on chip, combined with Figure 5 As shown, the data transmission method provided by this embodiment may include the following steps.

[0088] S200: Acquire multiple transaction layer data packets (TLPs).

[0089] Combine Figure 1 As shown, the RC device can communicate directly with the downstream EP device or connect to the EP device through a switch. Based on this, when the EP device writes data to the memory by sending a message, the RC device can obtain the TLP message sent by the EP device based on the communication link directly connected to the EP device. Alternatively, the RC device can obtain the TLP message sent by the EP device through the switch. In actual applications, the specific implementation of the RC device obtaining the TLP message provided by the EP device needs to be determined in conjunction with the specific architecture of the PCIe bus system and will not be detailed here. Of course, in actual applications, if the EP device and the RC device can also transmit TLP messages through other methods, this is also optional.

[0090] As mentioned above, the EP device and the RC device use point-to-point serial communication. The order in which the RC device receives the first TLP message and the second TLP message is exactly the same as the order in which the EP device sends each message, which can ensure that the RC device receives the second TLP message after receiving each first TLP message in sequence.

[0091] S210: Identify a first TLP message and a second TLP message among a plurality of TLP messages.

[0092] The RC device further identifies the message type of each obtained TLP message and determines the message type corresponding to the obtained multiple TLP messages. As previously mentioned, in this application, the TLP messages involved in data transmission between the EP device and the RC device are divided into two categories: first TLP messages used to transmit data, and second TLP messages used to transmit descriptor status update instructions. In actual applications, a data transmission process of the EP device requires one second TLP message and at least one first TLP message. The specific number of first TLP messages needs to be determined based on the amount of data to be transmitted, and this application does not impose any restrictions on this.

[0093] As mentioned above, EP devices can be divided into two categories, one of which is EP devices that only sends data, and the other is EP devices that send data and update descriptors. For the former, there is no need to identify whether the TLP message it sends belongs to the first TLP message or the second TLP message. It can directly send the TLP message it provides, thereby improving data transmission efficiency.

[0094] Based on the above content, as a preferred implementation method, after obtaining multiple TLP messages, the RC device takes each of the obtained TLP messages as the target TLP message, extracts the device identifier in the target TLP message, and if the obtained device identifier indicates that the EP device to which the target TLP message belongs sends data and updates the descriptor, then it is identified whether the target TLP message belongs to the first TLP message or the second TLP message. On the contrary, if the obtained device identifier indicates that the EP device to which the target TLP message belongs only sends data and does not update the descriptor, it is not necessary to identify whether the target TLP belongs to the first TLP message or the second TLP message, and the target TLP message can be directly sent, thereby simplifying the TLP message sending process, reducing the logical consumption of the RC device due to identifying the message type, and improving data transmission efficiency.

[0095] In an optional embodiment, the TLP message encapsulated by the EP device includes a flag field that indicates the message type of the TLP message. The specific implementation of indicating the TLP message type using the flag field can be referenced to the relevant content of the aforementioned embodiment and will not be repeated here. After receiving any target TLP message provided by the EP device, the RC device extracts the current field value of the flag field of the target TLP message and, based on the obtained current field value, determines whether the target TLP message belongs to the first TLP message or the second TLP message.

[0096] In combination with the relevant content in the aforementioned embodiments, it can be seen that when the EP device encapsulates the TLP message, it encapsulates the first TLP message based on the first field value of the flag field, and accordingly, it encapsulates the second TLP message based on the second field value of the flag field. As mentioned above, in actual applications, the field value of the flag field can be configured according to the specific type of the TLP message. For example, the first field value can be configured to 1, and the second field value can be configured to 0. Of course, other specific values ​​can also be selected according to needs, which will not be described in detail here. Based on this, after the RC device extracts the current field value of the flag field of the target TLP message, if the current field value obtained is the first field value, it determines that the target TLP message is the first TLP message. Correspondingly, if the current field value obtained is the second field value, it determines that the target TLP message is the second TLP message.

[0097] According to the above method, by traversing all TLP messages, the first TLP message and the second TLP message can be distinguished.

[0098] S220: After sending the data of each first TLP message, send a descriptor status update instruction.

[0099] As previously described, the first TLP message is used to transmit data. After receiving the first TLP message, the RC device parses the first TLP message to obtain the data it carries and then sends the data to memory. It will be appreciated that the first TLP message also carries the target storage address of the data in memory. Based on this, the RC device parses the first TLP message to obtain the target storage address and the corresponding data, and then sends the data to the target storage address, completing the data storage. The specific process of the RC device parsing the first TLP message and storing the data in memory can be referenced to related technical implementations and will not be detailed here.

[0100] In an optional embodiment, the RC device sends the data carried by each first TLP message in sequence according to the above process. After the data of any first TLP message is sent, the memory will feedback a notification message indicating that the data transmission of the first TLP message is completed. The RC device responds to the notification message and continues to send the next TLP message.

[0101] The descriptor status update instruction carried by the second TLP message will be sent only after the data of all the first TLP messages are sent. Based on this, the notification information corresponding to the last first TLP message sent is used as the target notification information. After obtaining the target notification information, the RC device sends the descriptor status update instruction carried by the second TLP message.

[0102] As previously mentioned, the descriptor status bit of the DMA descriptor can record two descriptor states. Specifically, when the descriptor state is the first state, it indicates that the data in the corresponding storage space has been updated. When the descriptor state is the second state, it indicates that the data in the corresponding storage space has not yet been updated. When the CPU configures the descriptor status bit of the DMA descriptor, it configures the descriptor state to the second state to facilitate subsequent data update operations. Based on this, the descriptor state update instruction carried by the second TLP message in this application is used to update the descriptor state to the aforementioned first state, that is, to indicate that the data in the storage space has been updated.

[0103] It can be understood that the second TLP message also encapsulates the target storage address, and, as mentioned above, the descriptor and the storage space are in a one-to-one correspondence. Correspondingly, the descriptor and the storage address of the storage space are also in a one-to-one correspondence. The RC device can determine the target descriptor corresponding to the target storage address based on the target storage address. Based on this, the RC device updates the descriptor status recorded in the descriptor status bit in the target descriptor to the first state through the descriptor status update instruction. For example, the first value representing the first state is written into the descriptor status bit, thereby marking the completion of data transmission.

[0104] Furthermore, the CPU can obtain the transmitted complete data in response to the update of the descriptor status, thereby achieving a reliable data transmission. As for the specific implementation process of the CPU obtaining data based on the descriptor status update, reference can be made to the relevant technology, and this application does not make specific limitations on this.

[0105] Furthermore, as mentioned above, in the initialization phase, the processor allocates corresponding cache space to each EP device, and the RC device can determine the cache space to which any TLP message belongs based on the device identifier carried by the TLP message. Based on this, when the RC device sends the first TLP message and the second TLP message, it can determine the EP device to which the TLP message belongs based on the device identifier of the TLP message, and then determine the cache space corresponding to the EP device, and send the TLP message to the corresponding cache space, thereby avoiding data storage confusion between different EP devices.

[0106] It should be noted that when the RC device uploads the obtained data or descriptor update instructions, it also involves the process of encapsulating the message, such as generating a new message header and CRC (Cyclic Redundancy Check) check value, etc. The specific implementation can be referred to the relevant technology, which will not be described in detail here.

[0107] In summary, in the data transmission method provided by this embodiment, the EP device encapsulates multiple TLP messages, including a first TLP message and a second TLP message. After the RC device obtains the multiple TLP messages, it identifies the first TLP message used to transmit data and the second TLP message used to transmit the descriptor status update instruction in the obtained multiple TLP messages, and after sending the data of all the first TLP messages, it sends the descriptor status update instruction of the second TLP message. By limiting the sending of the descriptor status update instruction to after the data of all the first TLP messages is completed, it can ensure that the descriptor status is updated after the data transmission is completed, thereby ensuring that the processor can read complete and correct data, effectively improving the reliability of data transmission.

[0108] Below, reference Figure 6 To describe the electronic device provided by the embodiment of the present invention, the electronic device provided by this embodiment may include: at least one processor 100, at least one communication interface 200, at least one memory 300 and at least one communication bus 400;

[0109] In the embodiment of the present invention, the number of the processor 100, the communication interface 200, the memory 300, and the communication bus 400 is at least one, and the processor 100, the communication interface 200, and the memory 300 communicate with each other through the communication bus 400; obviously, Figure 6The communication connections shown for the processor 100, communication interface 200, memory 300, and communication bus 400 are merely optional;

[0110] Optionally, the communication interface 200 may be an interface of a communication module, such as an interface of a GSM module; the processor 100 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement an embodiment of the present invention.

[0111] The memory 300 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0112] The processor 100 is specifically configured to execute an application program in the memory to implement the steps of the above-mentioned data transmission method.

[0113] The present application also provides a data transmission system, including: a root complex RC device and an endpoint EP device connected to the RC device for communication. The optional components of the data transmission system can be found in Figure 1 As shown, no further description is given here.

[0114] The RC device in the data transmission system provided by the present application performs the steps performed by the RC device in the data transmission method provided by any of the aforementioned embodiments;

[0115] The EP device in the data transmission system provided in the present application performs the steps performed by the EP device in the data transmission method provided in any of the aforementioned embodiments.

[0116] In some embodiments, this embodiment further provides a computer-readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, an SD (Secure Digital Memory Card), or an MMC (Multimedia Card). The computer-readable storage medium stores one or more instructions for implementing the aforementioned steps. When executed by one or more processors, these one or more instructions cause the processors to perform the data transmission method described above. For the specific implementation, please refer to the aforementioned description and will not be elaborated upon here.

[0117] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the data transmission method according to various embodiments of the present application described in the above content of this specification.

[0118] The computer program product may be written in any combination of one or more programming languages ​​to implement the program code for performing the operations of the embodiments of the present application, including object-oriented programming languages ​​such as Java, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0119] Those skilled in the art will appreciate that the contents disclosed in this disclosure may be subject to various modifications and improvements. For example, the various devices or components described above may be implemented through hardware, software, firmware, or a combination of some or all of the three.

[0120] In addition, although the present disclosure makes various references to certain units in the system according to embodiments of the present disclosure, any number of different units can be used and run on the client and / or server. The units are only illustrative, and different aspects of the system and method can use different units.

[0121] Flowcharts are used in this disclosure to illustrate the steps of the methods according to the embodiments of the present disclosure. It should be understood that the preceding or following steps do not necessarily need to be performed in exact order. Instead, the various steps may be performed in reverse order or simultaneously. Furthermore, other operations may be added to these processes.

[0122] Those skilled in the art will appreciate that all or part of the steps in the above method can be performed by instructing the relevant hardware using a computer program, and the program can be stored in a computer-readable storage medium, such as a read-only memory. Alternatively, all or part of the steps in the above embodiment can also be implemented using one or more integrated circuits. Accordingly, each module / unit in the above embodiment can be implemented in the form of hardware or in the form of software functional modules. The present disclosure is not limited to any particular combination of hardware and software.

[0123] Unless otherwise defined, all terms used herein have the same meaning as commonly understood by those skilled in the art to which the present disclosure belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and should not be interpreted in an idealized or highly formal sense unless expressly defined as such herein.

[0124] The above is an illustration of the present disclosure and should not be considered as a limitation thereof. Although several exemplary embodiments of the present disclosure have been described, it will be readily understood by those skilled in the art that many modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present disclosure. Therefore, all such modifications are intended to be included within the scope of the present disclosure as defined by the claims. It should be understood that the above is an illustration of the present disclosure and should not be considered as limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are intended to be included within the scope of the appended claims. The present disclosure is defined by the claims and their equivalents.

Claims

1. A data transmission method, characterized in that: Applied to a root complex RC device, the method comprises: Get multiple transaction layer data packets TLP messages; Identifying a first TLP message and a second TLP message among the plurality of TLP messages, wherein the first TLP message is used to transmit data, and the second TLP message is used to transmit a descriptor status update instruction; After sending the data of each of the first TLP messages, the descriptor status update instruction is sent to update the descriptor status after the data transmission is completed.

2. The method according to claim 1, characterized in that Identifying a first TLP message and a second TLP message among the plurality of TLP messages, comprising: Extracting a device identifier in a target TLP message, wherein the target TLP message is any one of the multiple TLP messages; If the device identifier indicates that the endpoint EP device sends data and updates the descriptor, identifying that the target TLP message belongs to the first TLP message or the second TLP message; If the device identifier indicates that the EP device to which it belongs only sends data, the data of the target TLP message is sent.

3. The method according to claim 2, characterized in that The TLP message includes a flag field, and the flag field is used to indicate the message type of the TLP message; Identifying whether the target TLP message belongs to the first TLP message or the second TLP message includes: Extract the current field value of the flag field of the target TLP message; It is identified based on the current field value of the target TLP message that the target TLP message belongs to the first TLP message or the second TLP message.

4. The method according to claim 3, characterized in that Identifying, based on a current field value of the target TLP message, whether the target TLP message belongs to the first TLP message or the second TLP message, comprising: If the current field value of the flag field in the target TLP message is the first field value, determining that the target TLP message is the first TLP message; If the current field value of the flag field in the target TLP message is the second field value, it is determined that the target TLP message is the second TLP message.

5. The method according to claim 1, characterized in that After sending the data of each of the first TLP messages, sending the descriptor status update instruction includes: Sending data carried by each of the first TLP messages in sequence, and obtaining notification information corresponding to each of the first TLP messages, wherein the notification information is used to indicate that the data transmission carried by the first TLP message is completed; The descriptor status update instruction is sent in response to target notification information, wherein the target notification information is notification information corresponding to the last first TLP message sent among the first TLP messages.

6. A data transmission method, characterized in that: Applied to an endpoint EP device, the method includes: Encapsulating multiple transaction layer data packets (TLP) messages, wherein the multiple TLP messages include a first TLP message and a second TLP message, wherein the first TLP message is used to transmit data, and the second TLP message is used to transmit a descriptor status update instruction; Each of the TLP messages is sent to the root complex RC device. The RC device sends the descriptor status update instruction after the data transmission of the first TLP message is completed, so as to update the descriptor status after the data transmission is completed.

7. The method according to claim 6, characterized in that The TLP message includes a flag field, and the flag field is used to indicate the message type of the TLP message; The process of encapsulating the TLP message includes: Obtaining a target storage address, where the target storage address is a storage address of data to be transmitted; A plurality of TLP messages are encapsulated based on the target storage address, the data, the descriptor status update instruction, and the field value of the flag field.

8. The method according to claim 7, characterized in that Encapsulating multiple TLP messages based on the target storage address, the data, the descriptor status update instruction, and the field value of the flag field, including: Encapsulating the data, the target storage address, and the first field value of the flag field into a TLP message to obtain a first TLP message; Furthermore, the target storage address, the descriptor status update instruction, and the second field value of the flag field are encapsulated into a TLP message to obtain a second TLP message.

9. The method according to claim 7, characterized in that The process of encapsulating the TLP message also includes: A device identifier is added to the TLP message, where the device identifier is used to indicate that the EP device to which the TLP message belongs only sends data or sends data and updates a descriptor.

10. The method according to any one of claims 6 to 9, characterized in that The sending of each of the TLP messages to the root complex RC device includes: Sending each of the first TLP messages to the RC device in sequence; After sending all of the first TLP messages, send the second TLP message.

11. An electronic device, characterized in that: include: a memory for storing instructions; A processor, configured to execute the data transmission method according to any one of claims 1 to 5 or 6 to 10 according to the instructions stored in the memory.

12. A data transmission system, characterized in that: include: A root complex RC device and an endpoint EP device communicatively connected to the RC device, wherein: The RC device performs the data transmission method according to any one of claims 1 to 5; The EP device executes the data transmission method according to any one of claims 6 to 10.

13. A computer-readable storage medium, characterized in that A computer program is stored, and when the computer program is executed, the data transmission method according to any one of claims 1 to 5 or 6 to 10 is implemented.