A PCIe message conversion method, system, medium and device

By using a non-transparent bridge module and mapping table mechanism on the upstream port of the PCIe device, the problem of low communication efficiency in multiple partitions of the PCIe switch is solved, enabling efficient interaction and flexible access of cross-domain data flows and improving the utilization rate of PCIe ports.

CN121151350BActive Publication Date: 2026-03-17GUIZHOU HUAXINTONG SEMICON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511666633.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-14
Publication Date
2026-03-17
Estimated Expiration
2045-11-14

AI Technical Summary

Technical Problem

Traditional PCIe switches, when supporting multi-zone functionality, suffer from low PCIe port utilization, inefficient cross-zone communication, and complex configuration, making it impossible to achieve efficient data flow interaction between different PCIe domains.

Method used

A non-transparent bridge is used as a type 0 functional module. Through the upstream port of the PCIe device, packet conversion between different PCIe domains is realized. Parallel connections between different partitions on the same PCIe switch are supported. Cross-domain communication is carried out using the non-transparent bridge mapping table and address substitution mechanism.

Benefits of technology

It enables flexible access between different PCIe domains, improves PCIe port utilization and cross-partition communication efficiency, avoids external wiring, supports multiple topologies and device configurations, and is compatible with existing PCIe architectures for seamless integration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121151350B_ABST
    Figure CN121151350B_ABST
Patent Text Reader

Abstract

This application provides a PCIe packet conversion method, system, medium, and device, relating to the field of computer hardware technology. The method includes: upon receiving a transaction layer packet, determining the packet source of the transaction layer packet, and then performing corresponding routing conversion operations based on the packet source and access address. This enables parallel design of multiple non-transparent bridges under the PCIe protocol, supporting communication between upstream devices in different PCIe domains through non-transparent bridges within their respective PCIe domains, supporting communication between downstream devices in different PCIe domains through non-transparent bridges within their respective PCIe domains, and supporting communication between upstream devices in one PCIe domain and downstream devices in other PCIe domains through non-transparent bridges within their respective PCIe domains. This eliminates the need for external wiring between different partitions on the same PCIe switch, supports parallel connections between different partitions on the same PCIe switch, and enables flexible access between devices in different PCIe domains.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer hardware technology, and in particular to a PCIe message conversion method, system, medium and device. Background Technology

[0002] In traditional PCIe (Peripheral Component Interconnect Express) systems, a non-transparent bridge (NTB) is an important component for connecting different PCIe domains. One end of a traditional non-transparent bridge acts as a virtual downstream port (VDP) and initialization endpoint (iEP) on a PCIe switch, connecting to a transparent bridge (TB) within the PCIe switch, serving as an endpoint (EP) of the upstream root complex (RC) of the PCIe switch. The other end acts as an EP, connecting to external downstream ports or EPs, existing as an EP in another PCIe domain. When the RC accesses the base address register (BAR) space of an EP on a non-transparent bridge within its PCIe domain, the non-transparent bridge translates the message and forwards it to a device in the other PCIe domain.

[0003] However, when a PCIe switch supports multi-partition functionality, traditional non-transparent bridges have several limitations. They can only achieve interconnection between two multi-partitions on the PCIe switch by connecting the external interface of the non-transparent bridge to the downstream port of another multi-partition via an external cable. This not only limits the connectivity between multiple partitions on the PCIe switch but also reduces the utilization of PCIe ports on the PCIe switch. Furthermore, when multiple multi-partitions need to be interconnected, they can only be connected serially, resulting in extremely low communication efficiency across partitions and complex configuration.

[0004] Current PCIe solutions can only enable RC access to RCs in other PCIe domains between different partitions, and EP access to RCs in other PCIe domains. Therefore, how to achieve cross-PCIe domain data flow interaction is a technical problem that those skilled in the art need to solve. Summary of the Invention

[0005] The purpose of this application is to provide a PCIe message conversion method, system, computer-readable storage medium, and electronic device that enables interaction between different PCIe partitions without the need for wiring.

[0006] To address the aforementioned technical problems, this application provides a PCIe packet conversion method applied to the first PCIe partition of a PCIe device. A non-transparent bridge, as a type 0 functional module, is located on the upstream port of the PCIe device. The upstream port includes a physical layer, a data link layer, and a routing layer. The method includes:

[0007] Upon receiving a transaction layer message, determine the message source of the transaction layer message;

[0008] If the message originates from a peer device, determine the access object of the transaction layer message; if the access object is a non-transparent bridge, forward the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, forward the transaction layer message to the transparent bridge.

[0009] If the message originates from a downstream device in the same PCIe domain, determine the access object of the transaction layer message; if the access object is a non-transparent bridge, forward the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, discard the transaction layer message and reply with a completion message to the downstream device.

[0010] If the message originates from another PCIe domain, determine the access target of the transaction layer message; if the access target is a downstream device of the transparent bridge, forward the transaction layer message to the transparent bridge; if the access target is another object, send the transaction layer message to the peer device through the data link layer.

[0011] Optionally, if the transaction layer message is a completion message, it also includes:

[0012] If the completion message originates from the peer device and the requester ID information of the completion message matches the non-transparent bridge mapping table, the completion message is sent to the non-transparent bridge; if the completion message does not match the non-transparent bridge mapping table and is used to access the downstream device of the upstream port transparent bridge, the completion message is sent to the transparent bridge.

[0013] If the completion message originates from the transparent bridge and the requester ID information of the completion message matches the non-transparent bridge mapping table, the completion message is sent to the non-transparent bridge; if the completion message does not match the non-transparent bridge mapping table and is used to access the downstream device of the upstream port transparent bridge, the completion message is discarded; if the completion message does not match the non-transparent bridge mapping table and is used to access the peer device, the completion message is forwarded to the peer device via the data link layer.

[0014] If the completion message originates from a non-transparent bridge, and if the completion message is used to access the downstream device of the upstream port transparent bridge, the completion message is sent to the transparent bridge; if the completion message is used to access the peer device, the completion message is forwarded to the peer device via the data link layer.

[0015] Optionally, if the transaction layer message is a request message, it also includes:

[0016] If the request message originates from the peer device and is used to access the non-transparent bridge, and the requester ID information of the request message matches the non-transparent bridge mapping table, the request message is sent to the non-transparent bridge; if the request message does not match the non-transparent bridge mapping table and is used to access the downstream device of the upstream port transparent bridge, the request message is sent to the transparent bridge; if the request message is used to access the upstream device or the access address is abnormal, the request message is discarded and a completion message is sent back to the peer device.

[0017] If the request message originates from a transparent bridge and is used to access a non-transparent bridge, and the requester ID information of the request message matches the non-transparent bridge mapping table, the request message is sent to the non-transparent bridge; if the request message does not match the non-transparent bridge mapping table and is used to access the downstream device of the upstream port transparent bridge, the request message is discarded; if the request message does not match the non-transparent bridge mapping table and is used to access the peer device, the request message is forwarded to the peer device via the data link layer.

[0018] If the request message originates from a non-transparent bridge, and if the request message is used to access a downstream device of the upstream port transparent bridge, the request message is sent to the transparent bridge; if the request message is used to access a peer device, the request message is forwarded to the peer device via the data link layer.

[0019] Optionally, the method further includes:

[0020] Retrieve the transaction layer protocol configuration message of type 0;

[0021] Configure the first function bit register and at least one of the transparent bridge register and the non-transparent bridge register according to the transaction layer protocol configuration message;

[0022] If the transaction layer protocol configuration message is used to indicate the activation of the transparent bridge, the function number of the transparent bridge is set as the first function bit, and the corresponding transparent bridge register is located in the configuration space where the first function bit is located.

[0023] If the transaction layer protocol configuration message is used to indicate that the transparent bridge is enabled and the non-transparent bridge is enabled at the same time, the function number of the non-transparent bridge is set as the second function bit, and the non-transparent bridge register corresponding to the non-transparent bridge is located in the configuration space where the second function bit is located.

[0024] If the transaction layer protocol configuration message is used to indicate that only the non-transparent bridge is enabled, the function number of the non-transparent bridge is set as the first function bit, and the corresponding non-transparent bridge register is located in the configuration space where the first function bit is located.

[0025] Optionally, the method further includes:

[0026] Receive data packets originating from cross-partition packets and forward them to the routing layer;

[0027] Determine the message type of the cross-partition message data;

[0028] If the transaction layer message is a request message, replace the bus number corresponding to the requester's identity information in the request message with the bus number of this port;

[0029] If the transaction layer message is a completion message, the identity information of the person who completed the completion message is replaced with the identity information of the non-transparent bridge on this port.

[0030] Optionally, if the transaction layer message is a request message, replacing the bus number corresponding to the requester's identity information in the request message with the bus number of this port includes:

[0031] Record the requester information and corresponding partition number of the cross-partition message data into the index space of the non-transparent bridge mapping table;

[0032] According to the non-transparent bridge mapping table, the second requester information corresponding to the second PCIe partition of the cross-partition message data is replaced with the first requester information corresponding to the first PCIe partition, the destination address of the second PCIe partition corresponding to the cross-partition message data is replaced with the destination address of the first PCIe partition in the first PCIe partition, and the destination partition number corresponding to the destination address of the first PCIe partition is determined.

[0033] The cross-partition message data is sent to the non-transparent bridge corresponding to the destination partition according to the destination partition number, so as to forward the cross-partition message data to the destination partition corresponding to the destination address of the second PCIe partition.

[0034] Optionally, replacing the second requester information belonging to the second PCIe partition with the first requester information belonging to the first PCIe partition in the cross-partition packet data according to the non-transparent bridge mapping table includes:

[0035] The corresponding index number is determined based on the source partition number of the transaction layer message and the device identifier corresponding to the second requester information;

[0036] The first requester information is obtained by combining the index number with the bus number corresponding to the non-transparent bridge of the first PCIe partition.

[0037] Optionally, if the message type is determined to be a completion message, the method further includes:

[0038] The non-transparent bridge mapping table is retrieved based on the device identifier corresponding to the second requester information to determine the partition corresponding to the completion message and the device identifier corresponding to the partition.

[0039] Use the device identifier as the requester ID corresponding to the second requester;

[0040] The device identifier of the non-transparent bridge in the PCIe domain where the destination partition of the completion message is located is used as the completion ID of the completion message.

[0041] The completion message is forwarded to the non-transparent bridge of the destination partition based on the requester ID and the completer ID.

[0042] This application also provides a PCIe packet translation system applied to the first PCIe partition of a PCIe device. A non-transparent bridge, as a type 0 functional module, is located on the upstream port of the PCIe device. The upstream port includes a physical layer, a data link layer, and a routing layer. The system includes:

[0043] The message source detection module is used to determine the message source of a transaction layer message when it is received.

[0044] The first message conversion module is used to determine the access object of the transaction layer message if the message source is a peer device; if the access object is a non-transparent bridge, forward the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, forward the transaction layer message to the transparent bridge.

[0045] The second message conversion module is used to determine the access object of the transaction layer message if the message originates from a downstream device in the same PCIe domain; if the access object is a non-transparent bridge, forward the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, discard the transaction layer message and reply with a completion message to the downstream device.

[0046] The third message conversion module is used to determine the access object of the transaction layer message if the message originates from another PCIe domain; if the access object is a downstream device of the transparent bridge, forward the transaction layer message to the transparent bridge; if the access object is another object, send the transaction layer message to the peer device through the data link layer.

[0047] This application provides a PCIe packet translation method applied to the first PCIe partition of a PCIe device. A non-transparent bridge, as a type 0 functional module, is located on the upstream port of the PCIe device. The upstream port includes a physical layer, a data link layer, and a routing layer. The method includes: upon receiving a transaction layer packet, determining the packet source of the transaction layer packet; if the packet source is a peer device, determining the access object of the transaction layer packet; if the access object is a non-transparent bridge, forwarding the transaction layer packet to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, forwarding the transaction layer packet. If the message originates from a downstream device within the same PCIe domain, the target of the transaction layer message is determined. If the target is a non-transparent bridge, the transaction layer message is forwarded to the non-transparent bridge. If the target is a downstream device of the transparent bridge, the transaction layer message is discarded and a completion message is sent back to the downstream device. If the message originates from another PCIe domain, the target of the transaction layer message is determined. If the target is a downstream device of the transparent bridge, the transaction layer message is forwarded to the transparent bridge. If the target is another object, the transaction layer message is sent to the peer device via the data link layer.

[0048] This application implements a parallel design of multiple non-transparent bridges under the PCIe protocol, supporting communication between upstream devices in different PCIe domains through non-transparent bridges within their respective PCIe domains, communication between downstream devices in different PCIe domains through non-transparent bridges within their respective PCIe domains, and communication between upstream devices in one PCIe domain and downstream devices in other PCIe domains through non-transparent bridges within their respective PCIe domains. This eliminates the need for external wiring between different partitions on the same PCIe switch, supports parallel connections between different partitions on the same PCIe switch, and enables flexible access between all devices in different PCIe domains.

[0049] This application also provides a PCIe message conversion system, a computer-readable storage medium, and an electronic device, which have the above-mentioned beneficial effects, and will not be elaborated here. Attached Figure Description

[0050] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0051] Figure 1 A flowchart illustrating a PCIe packet conversion method provided in this application embodiment;

[0052] Figure 2 This is a schematic diagram of the upstream port structure provided in an embodiment of this application;

[0053] Figure 3 This is a schematic diagram of the registers corresponding to the transparent bridge and the non-transparent bridge provided in the embodiments of this application;

[0054] Figure 4 This is a schematic diagram of the requester ID replacement process provided in an embodiment of this application;

[0055] Figure 5 This is a schematic diagram of the structure of the non-transparent bridge mapping table provided in the embodiments of this application;

[0056] Figure 6 This is a schematic diagram of a non-transparent bridge connection structure across partitions provided in an embodiment of this application;

[0057] Figure 7 This is a schematic diagram of a non-transparent bridge connection structure between the present application and an external PCIe domain, provided in an embodiment of the present application.

[0058] Figure 8 This is a schematic diagram of a non-transparent bridge parallel connection provided in an embodiment of this application;

[0059] Figure 9 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0060] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0061] See Figure 1 , Figure 1 This application provides a flowchart of a PCIe packet conversion method. The method is applied to the first PCIe partition of a PCIe device. A non-transparent bridge, as a type 0 functional module, is located on the upstream port of the PCIe device. The upstream port includes a physical layer, a data link layer, and a routing layer, specifically including:

[0062] Upon receiving a transaction layer message, determine the message source of the transaction layer message;

[0063] If the message originates from a peer device, determine the access object of the transaction layer message; if the access object is a non-transparent bridge, forward the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, forward the transaction layer message to the transparent bridge.

[0064] If the message originates from a downstream device in the same PCIe domain, determine the access object of the transaction layer message; if the access object is a non-transparent bridge, forward the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, discard the transaction layer message and reply with a completion message to the downstream device.

[0065] If the message originates from another PCIe domain, determine the access target of the transaction layer message; if the access target is a downstream device of the transparent bridge, forward the transaction layer message to the transparent bridge; if the access target is another object, send the transaction layer message to the peer device through the data link layer.

[0066] As can be seen, steps S102 to S104 are parallel steps. The numbering in this embodiment is only used to distinguish the conversion methods of transaction layer messages from different message sources. The corresponding forwarding processing methods differ for cross-partition message data from different sources.

[0067] The following section uses the routing process of request messages and CPL messages at the routing layer as an example to illustrate the process of receiving and sending cross-partition message data. Memory messages are transaction layer messages used for memory read and write operations, while CPL messages are completion messages, a special message type used to respond to request messages.

[0068] For request messages:

[0069] If the request message originates from the peer device and is used to access the non-transparent bridge, and the requester ID information of the request message matches the non-transparent bridge mapping table, the request message is sent to the non-transparent bridge; if the request message does not match the non-transparent bridge mapping table and is used to access the downstream device of the upstream port transparent bridge, the request message is sent to the transparent bridge; if the request message is used to access the upstream device or the access address is abnormal, the request message is discarded and a completion message is sent back to the peer device.

[0070] If the request message originates from a transparent bridge and is used to access a non-transparent bridge, and the requester ID information of the request message matches the non-transparent bridge mapping table, the request message is sent to the non-transparent bridge; if the request message does not match the non-transparent bridge mapping table and is used to access the downstream device of the upstream port transparent bridge, the request message is discarded; if the request message does not match the non-transparent bridge mapping table and is used to access the peer device, the request message is forwarded to the peer device via the data link layer.

[0071] If the request message originates from a non-transparent bridge, and if the request message is used to access a downstream device of the upstream port transparent bridge, the request message is sent to the transparent bridge; if the request message is used to access a peer device, the request message is forwarded to the peer device via the data link layer.

[0072] When the routing layer of the upstream port (i.e., this port) receives a request packet from the data link layer (i.e., the peer device), it determines the access address of the request packet. If the request packet accesses the storage space of a non-transparent bridge on this port, it sends the request packet to the non-transparent bridge. If the packet accesses a downstream device of a transparent bridge on this port, it sends the request packet to the transparent bridge; otherwise, it discards the request packet and replies to the data link layer with an upstream port completion message.

[0073] If the transaction layer message originates from the transparent bridge, it is determined that the transaction layer message is a downstream device transaction layer message.

[0074] If the destination access address of the downstream device transaction layer message is the storage space of the non-transparent bridge in the upstream port, the downstream device transaction layer message is forwarded to the non-transparent bridge.

[0075] If the destination access address of the peer device transaction layer message is the downstream device of the transparent bridge in the upstream port, discard the downstream device transaction layer message and reply with a completion message to the transparent bridge from the upstream port;

[0076] If the destination address of the downstream device transaction layer message is the peer device, the downstream device transaction layer message is forwarded to the peer device via the data link layer.

[0077] When the routing layer of this port receives a request packet from a transparent bridge (i.e., a downstream device in this PCIe domain), it determines the access address. If the request packet accesses the storage space of a non-transparent bridge on this port, it sends the request packet to the non-transparent bridge. If the request packet accesses a downstream device of a transparent bridge on this port, it discards the request packet and replies with a UR CPL packet in the direction of the transparent bridge; otherwise, it sends the request packet to the data link layer, which then forwards it to the peer device.

[0078] When the routing layer on this port receives a request packet from a non-transparent bridge (i.e., from another PCIe domain), it determines the access address. If the request packet accesses a downstream device of the transparent bridge on this port, it sends the request packet to the transparent bridge; otherwise, it sends the request packet to the data link layer, which then forwards it to the peer device.

[0079] The routing process for completion messages, also known as CPL messages, is as follows:

[0080] If the completion message originates from the peer device and the requester ID information of the completion message matches the non-transparent bridge mapping table, the completion message is sent to the non-transparent bridge; if the completion message does not match the non-transparent bridge mapping table and is used to access the downstream device of the upstream port transparent bridge, the completion message is sent to the transparent bridge.

[0081] If the completion message originates from the transparent bridge and the requester ID information of the completion message matches the non-transparent bridge mapping table, the completion message is sent to the non-transparent bridge; if the completion message does not match the non-transparent bridge mapping table and is used to access the downstream device of the upstream port transparent bridge, the completion message is discarded; if the completion message does not match the non-transparent bridge mapping table and is used to access the peer device, the completion message is forwarded to the peer device via the data link layer.

[0082] If the completion message originates from a non-transparent bridge, and if the completion message is used to access the downstream device of the upstream port transparent bridge, the completion message is sent to the transparent bridge; if the completion message is used to access the peer device, the completion message is forwarded to the peer device via the data link layer.

[0083] When the routing layer on this port receives a CPL message from a transparent bridge (i.e., a downstream device in this PCIe domain), it checks the requester ID. If the CPL message matches the mapping table of a non-transparent bridge, it is sent to the non-transparent bridge. If the CPL message is for accessing a downstream device of a transparent bridge on this port, it is discarded; otherwise, it is sent to the data link layer, which then forwards it to the peer device.

[0084] If the completion message originates from a non-transparent bridge, and if the completion message is used to access the downstream device of the upstream port transparent bridge, the completion message is sent to the transparent bridge; if the completion message is used to access the peer device, the completion message is forwarded to the peer device via the data link layer.

[0085] When the routing layer on this port receives a CPL message from a non-transparent bridge (i.e., from another PCIe domain), it determines the requester ID. If the CPL message requests access to a downstream device of the transparent bridge on this port, it sends the CPL message to the transparent bridge; otherwise, it sends the CPL message to the data link layer, which then forwards it to the peer device.

[0086] In summary, in this application, when the transparent bridge acts as a sender, it receives transaction layer packets from other ports within the same partition on the PCIe switch and then forwards them to the routing layer. When the transparent bridge acts as a receiver, it receives transaction layer packets from the routing layer and forwards them to other ports within the same PCIe partition.

[0087] For non-transparent bridges, as the sender, it receives transaction layer messages from non-transparent bridges on other ports within other partitions of the PCIe switch and forwards them to the routing layer. For memory messages, it replaces the requester ID's bus number with the bus number of this port; for CPL messages, it replaces the completer ID with the ID number of the non-transparent bridge function on this port.

[0088] When acting as a receiver, it receives transaction layer messages from the routing layer and forwards them to non-transparent bridges to other destination partitions.

[0089] Based on the above embodiments, as a preferred embodiment, the following further explains the routing and forwarding process for cross-partition packets:

[0090] The first step is to receive cross-partition packet data and forward it to the routing layer;

[0091] The second step is to determine the message type of the cross-partition message data.

[0092] Third step: If the transaction layer message is a request message, replace the bus number of the requester identity information corresponding to the request message with the bus number of this port;

[0093] Fourth step: If the transaction layer message is a completion message, replace the identity information of the completer of the completion message with the identity information of the non-transparent bridge of this port.

[0094] To better understand the PCIe packet translation method disclosed in this application, the following section will further explain the upstream ports involved in this application. See [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic diagram of the upstream port structure provided in an embodiment of this application.

[0095] The non-transparent bridge functions as an upstream port, with its PCIe register header being type 0. It exists as an endpoint and can support six memory spaces. When accessing the memory space of a non-transparent bridge, it forwards the packet via its internal bus to the destination non-transparent bridge, which then forwards it to the destination device. Furthermore, a global non-transparent bridge mapping table is supported to record the ID number of the requester accessing the non-transparent bridge and its corresponding partition, ensuring proper packet routing.

[0096] In the PCIe architecture, Type 0 and Type 1 are two different configuration space header types used to describe the functionality and topology of PCIe devices. Type 0 configuration space headers represent Endpoint Devices. Endpoint Devices are leaf nodes in the PCIe topology, typically actual hardware devices such as graphics cards, network cards, and storage controllers. Type 1 configuration space headers represent Bridge Devices. Bridge Devices connect different layers in the PCIe topology, such as connections from the Root Complex to the Switch, or connections from the Switch to the Endpoint. In this application, a PCIE domain refers to different PCIE address domains, i.e., PCI trees belonging to different RCs (Root Complex, the root node of the PCIe device tree). A partition is a concept related to the Switch. A Switch is a PCIe-based switch that supports multiple partitions. Each partition can be considered an independent small switch. Each Switch serves one PCIe domain. That is, the number of partitions on a Switch determines the number of PCIe domains it can support, i.e., the number of RCs. In this application, NT messages perform cross-partition operations on the Switch, thereby enabling cross-PCIe domain operations.

[0097] like Figure 2 As shown, in the upstream port, the transaction layer is divided into three parts, two of which serve as the upstream port's functions.

[0098] The upstream port's function 0 is a transparent bridge, serving as a type 1 functional device used to implement message transmission between upstream and downstream ports.

[0099] The upstream port's function 1 is a non-transparent bridge, serving as a type 0 functional device used to implement packet transmission between different partitions. The upstream port supports flexible function configuration: it can enable only transparent bridges, only non-transparent bridges, or both. Furthermore, the transaction layer contains a routing layer responsible for data routing between the data link layer, transparent bridges, and non-transparent bridges.

[0100] Users can configure the functionality of transparent and non-transparent bridges by sending a type 0 configuration transaction layer message to the upstream port. See also Figure 3 , Figure 3 This is a schematic diagram of the registers corresponding to the transparent bridge and the non-transparent bridge provided in an embodiment of this application. When the upstream port obtains a transaction layer protocol configuration message of type 0, it can configure the first function bit register, as well as at least one of the transparent bridge register and the non-transparent bridge register, according to the transaction layer protocol configuration message.

[0101] When a transparent bridge is enabled, its function number is the first function bit 0 (i.e., "function 0"), and its register is located in the configuration space where function 0 is located. If the register of a non-transparent bridge is enabled, its function number is the second function bit, i.e., function number 1 (i.e., "function 1"), and its register is located in the configuration space where function 1 is located.

[0102] When only the non-transparent bridge is enabled, the function number of the non-transparent bridge is 0, and its register is located in the configuration space where function 0 is located.

[0103] The configuration space of a PCIe device contains capability registers that are only supported by Function 0. Therefore, the register space is divided into three parts: the first function bit register, the transparent bridge register, and the non-transparent bridge register. The first function bit register contains registers supported only by Function 0, including the link capability register, virtual channel register, L1 sub-state, and DL Feature. The transparent bridge register includes the type 1 dedicated header register, the advanced error reporting capability of the transparent bridge, and the interrupt register of the transparent bridge. The non-transparent bridge register includes the type 0 dedicated header register, the advanced error reporting capability of the non-transparent bridge, and the interrupt register of the non-transparent bridge. The transparent and non-transparent bridge registers can only be accessed by accessing their corresponding ID numbers when the corresponding function is enabled. However, the first function bit register can be accessed by requests to access Function 0 in any mode.

[0104] In this embodiment, the routing layer of the upstream port receives cross-partition packet data from the second PCIe partition and captures and processes packets from other partitions. The routing layer analyzes the captured packet data to determine its packet type. Different types of packets (such as transaction layer packets, data link layer packets, etc.) have corresponding processing methods. By identifying the packet type, subsequent processing can be performed in a targeted manner.

[0105] If the message type is determined to be a transaction layer message (including request and completion messages), the requester information (such as the source address) and the corresponding partition number are recorded in the corresponding index space of the non-transparent bridge mapping table. This provides necessary information for subsequent address replacement and message forwarding, while ensuring that the original message information is preserved for recovery or verification in subsequent steps. Specifically, if the message type is a request message, the bus number that replaces the requester's identity information in the request message is the bus number of this port; if the message type is a completion message, the completioner's identity information that replaces the completion message is the identity information of the non-transparent bridge of this port.

[0106] Taking a request message as an example, its address replacement process is as follows:

[0107] The first step is to record the requester information and the corresponding partition number of the cross-partition message data into the index space of the non-transparent bridge mapping table;

[0108] The second step is to replace the second requester information belonging to the second PCIe partition with the first requester information belonging to the first PCIe partition according to the non-transparent bridge mapping table, replace the destination address of the second PCIe partition corresponding to the cross-partition message data with the destination address of the first PCIe partition in the first PCIe partition, and determine the destination partition number corresponding to the destination address of the first PCIe partition.

[0109] The third step is to send the cross-partition packet data to the non-transparent bridge corresponding to the destination partition according to the destination partition number, so as to forward the cross-partition packet data to the destination partition corresponding to the destination address of the second PCIe partition.

[0110] When performing the replacement of the requester information, the corresponding index number can be determined first based on the source partition number of the transaction layer message and the device identifier corresponding to the second requester information. Then, the index number and the bus number corresponding to the non-transparent bridge of the first PCIe partition are combined to obtain the first requester information.

[0111] In the above process, based on the non-transparent bridge mapping table, the requester information belonging to the second PCIe partition in the cross-partition message data is replaced with the requester information of the first PCIe partition, and the destination address of the message is replaced from the destination address of the second PCIe partition to the destination address in the first PCIe partition. Simultaneously, the destination partition number corresponding to the destination address of the first PCIe partition is determined. Through the replacement of the address and requester information, the cross-partition message data can be correctly identified and processed in the first PCIe partition, thereby achieving cross-partition communication.

[0112] Finally, based on the destination partition number, the packet can be sent to the corresponding non-transparent bridge in the partition. The non-transparent bridge is responsible for forwarding the packet to the corresponding destination device in the first PCIe partition, ensuring that the packet can reach its target address in the first PCIe partition.

[0113] Taking the completion message as an example, the replacement process is as follows:

[0114] Step 1: Retrieve the non-transparent bridge mapping table based on the device identifier corresponding to the second requester information to determine the partition corresponding to the completion message and the device identifier corresponding to the partition;

[0115] The second step is to use the device identifier as the requester ID corresponding to the second requester.

[0116] Third step: Use the device identifier of the non-transparent bridge in the PCIe domain where the destination partition of the completion message is located as the completioner ID of the completion message;

[0117] Step 4: Forward the completion message to the non-transparent bridge of the destination partition based on the requester ID and the completer ID.

[0118] This application's embodiments utilize a non-transparent bridge mapping table and address substitution mechanism to achieve cross-domain transmission of PCIe packets between different PCIe partitions, avoiding complex protocol conversions and additional processing delays, thus improving the efficiency of cross-domain communication. By employing a non-transparent bridge mapping table, flexible configuration and management of cross-domain communication mapping relationships are achieved, adapting to the packet interaction needs between different PCIe domains and supporting various topologies and device configurations. Furthermore, this application is based on the PCIe standard protocol, exhibiting excellent compatibility and seamless integration into existing PCIe architectures. This allows interaction between different PCIe partitions on the same PCIe switch without external wiring, supporting parallel connections between different partitions on the same PCIe switch, i.e., without requiring large-scale hardware modifications, significantly reducing hardware implementation costs.

[0119] Because ID allocation between different PCIe systems is opaque, the requester ID of a packet accessing the non-transparent bridge storage space within the current partition must be translated into the requester ID for the PCIe domain of the target partition. This translation is done by looking up the non-transparent bridge mapping table. Before using the non-transparent bridge mapping table, the user needs to record the requester ID and its partition number for the upcoming access to the non-transparent bridge storage space in the space pointed to by a certain index in the non-transparent bridge mapping table. This non-transparent bridge mapping table is globally visible; that is, all non-transparent bridges on the entire PCIe switch look up the ID and partition number through the index, or look up the index through the ID and partition number.

[0120] See Figure 4 and Figure 5 , Figure 4 This is a schematic diagram illustrating the requester ID replacement process provided in an embodiment of this application. Figure 5 This is a schematic diagram of the structure of the non-transparent bridge mapping table provided in this application embodiment. For memory messages, the corresponding index number can be determined based on the source partition number of the transaction layer message and the device identifier corresponding to the second requester information. Then, the index number is combined with the bus number corresponding to the non-transparent bridge of the first PCIe partition to obtain the first requester information. The type of device identifier used is not limited here; it is used to perform the addressing function of the PCIe device. For example, a BDF number can be used, which includes a bus number, a device number, and a function number.

[0121] In practice, the partition number (the source partition of the transaction layer message), bus number, device number, and function number are compared in the non-transparent bridge mapping table to find the corresponding index number. This index number is then used as part of the translated device number and function number. The length of the index number is not limited and can be set according to the size of the non-transparent bridge mapping table, with 1s added to any insufficient positions. Simultaneously, the index number is combined with the bus number of another non-transparent bridge in the same PCIe domain to form a new requester ID. The translated memory message is then sent to the non-transparent bridge of the destination partition.

[0122] When a non-transparent bridge receives a CPL message with all high-order bits of its requester ID's device number set to 1, it indicates that the message is intended to access the non-transparent bridge. Next, based on the index number, the non-transparent bridge mapping table is used to determine which partition the CPL message belongs to, as well as its bus number, device number, and function number within that partition. These three values ​​are then combined to form the requester ID for the original PCIe domain. Furthermore, the completer ID is replaced with the bus number, device number, and function number of the non-transparent bridge in the target partition's PCIe domain, indicating that the message belongs to the target PCIe domain. The translated CPL message is then sent to the non-transparent bridge in the destination partition.

[0123] See Figure 6 , Figure 6 This is a schematic diagram of a cross-partition non-transparent bridge connection structure provided in an embodiment of this application. When different partitions within a PCIe switch need to be connected, the upstream port modes of the two partitions can be modified to enable transparent bridge and non-transparent bridge modes. Then, the internal address translation of the two non-transparent bridges and the global non-transparent bridge mapping table are configured to achieve non-transparent bridge connections between different partitions. In this scenario, all devices in the PCIe domain of partition 0 and all devices in the PCIe domain of partition 1 can access each other.

[0124] See Figure 7 , Figure 7 This is a schematic diagram of a non-transparent bridge connection structure between a PCIe switch and an external PCIe domain, provided in an embodiment of this application. When a PCIe switch needs to connect to other external PCIe domains, the upstream port mode of the PCIe switch partition is modified to enable both transparent and non-transparent bridge modes, and the port connecting to another PCIe domain is modified to enable only non-transparent bridge mode. Then, address translation for the two non-transparent bridges and a global non-transparent bridge mapping table are configured to achieve non-transparent bridge connections with other external PCIe domains. In this scenario, all devices in the PCIe domain where partition 0 is located and all devices in the PCIe domain where partition 2 is located can access each other.

[0125] exist Figure 7 Based on this, the parallel connection process of non-transparent bridges can be further realized, see [link to relevant documentation]. Figure 8 , Figure 8 This is a schematic diagram of a non-transparent bridge parallel connection provided in an embodiment of this application.

[0126] At this point, the following access methods can be implemented:

[0127] The first method involves RC0 accessing the non-transparent bridge on the upstream port within partition 0, translating it, and then accessing the non-transparent bridge within partition 1. The routing layer of the upstream port then routes the packet again (if the address or ID does not match the downstream device of the transparent bridge on the upstream port), thus enabling access to RC1.

[0128] The second method involves RC0 accessing the non-transparent bridge on the upstream port within partition 0, translating it, and then accessing the non-transparent bridge within partition 1. The routing layer of the upstream port then routes the packet again (the address or ID matches the downstream device of the transparent bridge on the upstream port), thus enabling access to EP2.

[0129] The third method involves EP0 accessing the transparent bridge on the upstream port within partition 0. Because it accesses a non-transparent bridge, the packet is forwarded by the routing layer to the non-transparent bridge in partition 0. After translation, it accesses the non-transparent bridge in partition 1. The routing layer on the upstream port then routes the packet again (if the address or ID does not match the downstream device of the transparent bridge on the upstream port), thus enabling access to RC1.

[0130] The fourth type involves EP0 accessing the transparent bridge on the upstream port within partition 0. Because it is accessing a non-transparent bridge, the packet is forwarded by the routing layer to the non-transparent bridge in partition 0. After translation, it accesses the non-transparent bridge in partition 1. The routing layer on the upstream port then routes the packet again (the address or ID matches the downstream device of the transparent bridge on the upstream port), thus enabling access to EP2.

[0131] Based on the above embodiments, the data interaction of the non-transparent bridge that can be implemented by this application includes the following scenarios:

[0132] 1. Communication between upstream devices in this PCIe partition and upstream devices in other PCIe partitions: Upstream devices in this PCIe partition access non-transparent bridges on upstream ports within this PCIe partition, and then access non-transparent bridges in other PCIe partitions. The address or ID of the translated packets does not match the downstream device of the transparent bridge in the destination PCIe partition, so they are sent by the routing layer to the link peer device and finally routed to the destination device.

[0133] 2. Communication between upstream devices in this PCIe partition and downstream devices in other PCIe partitions: Upstream devices in this PCIe partition access non-transparent bridges on upstream ports within this PCIe partition, and then access non-transparent bridges in other PCIe partitions. The address or ID of the translated packets matches the downstream device of the transparent bridge in the destination PCIe partition, and is therefore sent by the routing layer to the transparent bridge on the upstream port of the destination PCIe partition, and finally routed to the destination device.

[0134] 3. Communication between downstream devices in this PCIe partition and upstream devices in other PCIe partitions: Downstream devices within this PCIe partition access the transparent bridge of the upstream port within this PCIe partition, and then access the routing layer within that upstream port. The routing layer determines if the address or ID matches the non-transparent bridge of this PCIe partition and forwards it to the non-transparent bridge. The non-transparent bridge translates the packet and forwards it to the non-transparent bridge of the destination PCIe partition. If the address or ID of the translated packet does not match the downstream device of the transparent bridge in the destination PCIe partition, it is forwarded by the routing layer to the peer device on the link, and finally routed to the destination device.

[0135] 4. Communication between downstream devices in this PCIe partition and downstream devices in other PCIe partitions: Downstream devices within this PCIe partition access the transparent bridge of the upstream port within this PCIe partition, and then access the routing layer within that upstream port. The routing layer determines if the address or ID matches the non-transparent bridge of this PCIe partition and forwards it to the non-transparent bridge. The non-transparent bridge translates the packet and forwards it to the non-transparent bridge of the destination PCIe partition. The address or ID of the translated packet matches the downstream device of the transparent bridge in the destination PCIe partition, and therefore it is forwarded to the transparent bridge by the routing layer, and finally routed to the destination device.

[0136] The following description uses two specific application data streams as examples to illustrate this application. For instance, consider a downstream device within this partition accessing the storage space of a non-transparent bridge on an upstream port within this partition, and subsequently accessing downstream devices in other partitions:

[0137] The transmission path of a cross-partition NP request (Non-Posted, a transaction layer message that requires the target device to return a completion message, i.e., a CPL message) is as follows:

[0138] 1. A downstream device initiates a memory read request. After the packet is received by the downstream port of this partition, it is routed to the global routing layer of this partition because the downstream address of the downstream port is not matched.

[0139] 2. The global routing layer of the partition determines that the packet does not hit any downstream port within the partition, so it sends the packet to the transparent bridge of the upstream port of the partition.

[0140] 3. If the transparent bridge determines that the packet does not match any of its downstream devices, it will forward the packet to the routing layer.

[0141] 4. After the routing layer determines that the packet hits a non-transparent bridge on the upstream port, it forwards the packet to the non-transparent bridge within the upstream port.

[0142] 5. The non-transparent bridge on the upstream port translates the packet, converting the original PCIe domain destination address to the destination PCIe domain address, the original PCIe domain requester ID to the destination PCIe domain requester ID, and obtaining the destination partition number. The non-transparent bridge then routes the packet globally at the routing layer.

[0143] 6. The global routing layer forwards the packet to the non-transparent bridge of the destination partition based on the destination partition number;

[0144] 7. The non-transparent bridge of the destination partition forwards the packet to the routing layer of the upstream port of the destination;

[0145] 8. The routing layer of the destination upstream port confirms that the packet belongs to the downstream device of the transparent bridge within the upstream port, and routes the packet to the transparent bridge within the upstream port;

[0146] 9. The transparent bridge within the upstream port forwards the message to the global routing layer;

[0147] 10. After the global routing layer confirms that the packet belongs to a device under a certain downstream port, it sends the packet to the destination downstream port;

[0148] 11. The downstream port then forwards the message to the destination device.

[0149] Corresponding to the NP request mentioned above, the transmission path of a cross-partition CPL message is as follows:

[0150] 1. A downstream device initiates a CPL message. After the CPL message is received by the downstream port of this partition, it is routed to the global routing layer of this partition because the bus number of the downstream port is not matched.

[0151] 2. The global routing layer of this partition determines that the CPL message does not hit any downstream port within the partition, so it sends the CPL message to the transparent bridge of the upstream port of this partition.

[0152] 3. If the transparent bridge determines that the CPL message does not hit any of its downstream devices, it will forward the CPL message to the routing layer;

[0153] 4. After the routing layer determines that the CPL message has hit the non-transparent bridge of the upstream port, it sends the CPL message to the non-transparent bridge in the upstream port.

[0154] 5. The non-transparent bridge on the upstream port translates the CPL message, replacing the requester ID of the original PCIe domain with the requester ID of the destination PCIe domain by looking up the non-transparent bridge mapping table, and obtaining the destination partition number. The non-transparent bridge routes the CPL message globally at the routing layer.

[0155] 6. The global routing layer sends the CPL message to the non-transparent bridge of the destination partition based on the destination partition number;

[0156] 7. The non-transparent bridge of the destination partition sends CPL messages to the routing layer of the upstream port of the destination;

[0157] 8. The routing layer of the destination upstream port confirms that the CPL message belongs to the downstream device of the transparent bridge within the upstream port, and routes the CPL message to the transparent bridge within the upstream port;

[0158] 9. The transparent bridge within the upstream port forwards the CPL message to the global routing layer;

[0159] 10. After the global routing layer confirms that the CPL message belongs to a device under a certain downstream port, it sends the CPL message to the destination downstream port;

[0160] 11. The downstream port then sends the CPL message to the destination device.

[0161] As can be seen, this application can realize the parallel design of multiple non-transparent bridges under the PCIe protocol, so that the connection between different partitions on the same PCIe switch does not require external wiring, while supporting the parallel connection of different partitions on the same PCIe switch, and realizing flexible access between all devices in different PCIe domains.

[0162] This application also provides a PCIe packet translation system applied to the first PCIe partition of a PCIe device. A non-transparent bridge, as a type 0 functional module, is located on the upstream port of the PCIe device. The upstream port includes a physical layer, a data link layer, and a routing layer. The system includes:

[0163] The message source detection module is used to determine the message source of a transaction layer message when it is received.

[0164] The first message conversion module is used to determine the access object of the transaction layer message if the message source is a peer device; if the access object is a non-transparent bridge, forward the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, forward the transaction layer message to the transparent bridge.

[0165] The second message conversion module is used to determine the access object of the transaction layer message if the message originates from a downstream device in the same PCIe domain; if the access object is a non-transparent bridge, forward the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, discard the transaction layer message and reply with a completion message to the downstream device.

[0166] The third message conversion module is used to determine the access object of the transaction layer message if the message originates from another PCIe domain; if the access object is a downstream device of the transparent bridge, forward the transaction layer message to the transparent bridge; if the access object is another object, send the transaction layer message to the peer device through the data link layer.

[0167] This application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in the above method embodiments.

[0168] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0169] The computer-readable storage medium provided in this embodiment includes the method mentioned above, and has the same effect.

[0170] This application also provides an electronic device, see [link to document]. Figure 9 The present application provides a structural diagram of an electronic device, such as... Figure 9 As shown, it may include a processor 1010 and a memory 1020.

[0171] The processor 1010 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 1010 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1010 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 1010 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 1010 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0172] The memory 1020 may include one or more computer-readable storage media, which may be non-transitory. The memory 1020 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 1020 is used to store at least the following computer program 1021, which, after being loaded and executed by the processor 1010, is capable of implementing the relevant steps in the method executed by the electronic device side as disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 1020 may also include an operating system 1022 and data 1023, etc., and the storage method may be temporary storage or permanent storage. The operating system 1022 may include Windows, Linux, Android, etc.

[0173] In some embodiments, the electronic device may further include a display screen 1030, an input / output interface 1040, a communication interface 1050, a sensor 1060, a power supply 1070, and a communication bus 1080.

[0174] certainly, Figure 9 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiments of this application. In practical applications, the electronic device may include more than [other components]. Figure 9 More or fewer components as shown, or combinations of certain components.

[0175] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. As the system provided in the embodiments corresponds to the method provided in the embodiments, the description is relatively simple; relevant parts can be found in the method section.

[0176] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of this application.

[0177] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A PCIe packet conversion method, characterized in that, The application is applied to a first PCIe partition of a PCIe device, a non-transparent bridge is arranged at an upstream port of the PCIe device as a type 0 type function module, the upstream port comprises a physical layer, a data link layer and a routing layer, and the method comprises the following steps: When a transaction layer message is received, determining a message source of the transaction layer message; If the message source is a peer device, determining an access object of the transaction layer message; if the access object is a non-transparent bridge, forwarding the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, forwarding the transaction layer message to the transparent bridge; If the message source is a downstream device of the same PCIe domain, determining an access object of the transaction layer message; if the access object is a non-transparent bridge, forwarding the transaction layer message to the non-transparent bridge; if the access object is a downstream device of a transparent bridge, discarding the transaction layer message and replying a completion message to the downstream device; If the message source is another PCIe domain, determining an access object of the transaction layer message; if the access object is a downstream device of a transparent bridge, forwarding the transaction layer message to the transparent bridge; if the access object is another object, sending the transaction layer message to a peer device through a data link layer; Obtaining a transaction layer protocol configuration message of type 0 type; Configuring a first function bit register, and at least one of a transparent bridge register and a non-transparent bridge register according to the transaction layer protocol configuration message; If the transaction layer protocol configuration message is used to indicate that the transparent bridge is enabled, setting a function number of the transparent bridge as a first function bit, and a corresponding transparent bridge register is located in a configuration space where the first function bit is located; If the transaction layer protocol configuration message is used to indicate that the transparent bridge and the non-transparent bridge are both enabled, setting a function number of the non-transparent bridge as a second function bit, and a corresponding non-transparent bridge register of the non-transparent bridge is located in a configuration space where the second function bit is located; If the transaction layer protocol configuration message is used to indicate that only the non-transparent bridge is enabled, setting a function number of the non-transparent bridge as the first function bit, and a corresponding non-transparent bridge register is located in the configuration space where the first function bit is located.

2. The PCIe packet conversion method of claim 1, wherein, If the transaction layer message is a completion message, the method further comprises the following steps: If the completion message is a completion message originated from a peer device, and requester ID information of the completion message hits a non-transparent bridge mapping table, sending the completion message to the non-transparent bridge; if the completion message does not hit the non-transparent bridge mapping table and is used to access a downstream device of the upstream port transparent bridge, sending the completion message to the transparent bridge; If the completion message is a completion message originated from a transparent bridge, and requester ID information of the completion message hits a non-transparent bridge mapping table, sending the completion message to the non-transparent bridge; if the completion message does not hit the non-transparent bridge mapping table and is used to access a downstream device of the upstream port transparent bridge, discarding the completion message; if the completion message does not hit the non-transparent bridge mapping table and is used to access a peer device, forwarding the completion message to the peer device through the data link layer. If the completion message is a completion message originated from a non-transparent bridge, if the completion message is used to access a downstream device of the upstream port transparent bridge, the completion message is sent to the transparent bridge; if the completion message is used to access a peer device, the completion message is forwarded to the peer device via the data link layer.

3. The PCIe packet conversion method of claim 1, wherein, If the transaction layer message is a request message, correspondingly, the method further comprises: If the request message is a request message originated from a peer device, is used to access a non-transparent bridge, and the requester ID information of the request message hits a non-transparent bridge mapping table, the request message is sent to the non-transparent bridge; if the request message does not hit the non-transparent bridge mapping table and is used to access a downstream device of the upstream port transparent bridge, the request message is sent to the transparent bridge; if the request message is used to access an upstream device or access an abnormal address, the request message is discarded and a completion message is replied to the peer device; If the request message is a request message originated from a transparent bridge, is used to access a non-transparent bridge, and the requester ID information of the request message hits a non-transparent bridge mapping table, the request message is sent to the non-transparent bridge; if the request message does not hit the non-transparent bridge mapping table and is used to access a downstream device of the upstream port transparent bridge, the request message is discarded; if the request message does not hit the non-transparent bridge mapping table and is used to access a peer device, the request message is forwarded to the peer device via the data link layer; If the request message is a request message originated from a non-transparent bridge, if the request message is used to access a downstream device of the upstream port transparent bridge, the request message is sent to the transparent bridge; if the request message is used to access a peer device, the request message is forwarded to the peer device via the data link layer.

4. The PCIe packet conversion method of claim 1, wherein, Further comprising: Receiving a message data originated from a cross-partition message, and forwarding to the routing layer; Determining a message type of the cross-partition message data; If the transaction layer message is a request message, replacing a bus number of the corresponding requester identity information of the request message with a bus number of a local port; If the transaction layer message is a completion message, replacing a completer identity information of the completion message with an identity information of a non-transparent bridge of a local port.

5. The PCIe packet conversion method of claim 4, wherein, If the transaction layer message is a request message, replacing a bus number of the corresponding requester identity information of the request message with a bus number of a local port comprises: Recording requester information and a corresponding partition number of the cross-partition message data to a corresponding index space of a non-transparent bridge mapping table; According to the non-transparent bridge mapping table, replacing second requester information of the cross-partition message data belonging to a second PCIe partition with first requester information belonging to the first PCIe partition, replacing a second PCIe partition destination address of the cross-partition message data with a first PCIe partition destination address in the first PCIe partition, and determining a destination partition number corresponding to the first PCIe partition destination address; According to the destination partition number, the cross-partition message data is sent to a non-transparent bridge corresponding to the destination partition, so as to forward the cross-partition message data to a destination partition corresponding to the second PCIe partition destination address.

6. The PCIe packet conversion method of claim 5, wherein, According to the non-transparent bridge mapping table, the second requester information corresponding to the second PCIe partition is replaced by first requester information belonging to the first PCIe partition, including: According to the source partition number of the transaction layer message and the device identifier corresponding to the second requester information, a corresponding index number is determined; The index number and the non-transparent bridge corresponding bus number of the first PCIe partition are combined to obtain the first requester information.

7. The PCIe packet conversion method of claim 5, wherein, If it is determined that the message type is a completion message, further comprising: According to the device identifier corresponding to the second requester information, a non-transparent bridge mapping table is retrieved to determine the partition corresponding to the completion message and the device identifier corresponding to the partition; The device identifier is taken as the requester ID corresponding to the second requester; The device identifier of the non-transparent bridge of the PCIe domain where the destination partition of the completion message is located is taken as the completer ID corresponding to the completion message; According to the requester ID and the completer ID, the completion message is forwarded to the non-transparent bridge of the destination partition.

8. A PCIe message conversion system, comprising: The first PCIe partition applied to a PCIe device, a non-transparent bridge as a type0 type function module is arranged at an upstream port of the PCIe device, the upstream port includes a physical layer, a data link layer and a routing layer, and the system includes: A message source detection module is configured to determine the message source of the transaction layer message when the transaction layer message is received; A first message conversion module is configured to determine the access object of the transaction layer message if the message source is a peer device, and forward the transaction layer message to a non-transparent bridge if the access object is a non-transparent bridge, and forward the transaction layer message to a transparent bridge if the access object is a downstream device of the transparent bridge; A second message conversion module is configured to determine the access object of the transaction layer message if the message source is a downstream device of the same PCIe domain, and forward the transaction layer message to a non-transparent bridge if the access object is a non-transparent bridge, and discard the transaction layer message and reply a completion message to the downstream device if the access object is a downstream device of a transparent bridge; A third message conversion module is configured to determine the access object of the transaction layer message if the message source is another PCIe domain, and forward the transaction layer message to a transparent bridge if the access object is a downstream device of the transparent bridge, and send the transaction layer message to a peer device through a data link layer if the access object is another object; And a module configured to perform the following steps: Obtain a transaction layer protocol configuration message of type0 type; According to the transaction layer protocol configuration message, configure a first function bit register, and at least one of a transparent bridge register and a non-transparent bridge register; If it is determined that the message type is a completion message, further comprising: According to the device identifier corresponding to the second requester information, a non-transparent bridge mapping table is retrieved to determine the partition corresponding to the completion message and the device identifier corresponding to the partition; The device identifier is taken as the requester ID corresponding to the second requester; The device identifier of the non-transparent bridge of the PCIe domain where the destination partition of the completion message is located is taken as the completer ID corresponding to the completion message; According to the requester ID and the completer ID, the completion message is forwarded to the non-transparent bridge of the destination partition. The first PCIe partition applied to a PCIe device, a non-transparent bridge as a type0 type function module is arranged at an upstream port of the PCIe device, the upstream port includes a physical layer, a data link layer and a routing layer, and the system includes: A message source detection module is configured to determine the message source of the transaction layer message when the transaction layer message is received; A first message conversion module is configured to determine the access object of the transaction layer message if the message source is a peer device, and forward the transaction layer message to a non-transparent bridge if the access object is a non-transparent bridge, and forward the transaction layer message to a transparent bridge if the access object is a downstream device of the transparent bridge; A second message conversion module is configured to determine the access object of the transaction layer message if the message source is a downstream device of the same PCIe domain, and forward the transaction layer message to a non-transparent bridge if the access object is a non-transparent bridge, and discard the transaction layer message and reply a completion message to the downstream device if the access object is a downstream device of a transparent bridge; A third message conversion module is configured to determine the access object of the transaction layer message if the message source is another PCIe domain, and forward the transaction layer message to a transparent bridge if the access object is a downstream device of the transparent bridge, and send the transaction layer message to a peer device through a data link layer if the access object is another object; And a module configured to perform the following steps: Obtain a transaction layer protocol configuration message of type0 type; According to the transaction layer protocol configuration message, configure a first function bit register, and at least one of a transparent bridge register and a non-transparent bridge register; If the transaction layer protocol configuration message is used to indicate that the transparent bridge is enabled, a function number of the transparent bridge is set as a first function bit, and a corresponding transparent bridge register is located in a configuration space where the first function bit is located. If the transaction layer protocol configuration message is used to indicate that the transparent bridge is enabled and the non-transparent bridge is enabled, a function number of the non-transparent bridge is set as a second function bit, and a corresponding non-transparent bridge register is located in a configuration space where the second function bit is located. If the transaction layer protocol configuration message is used to indicate that only the non-transparent bridge is enabled, a function number of the non-transparent bridge is set as a first function bit, and a corresponding non-transparent bridge register is located in a configuration space where the first function bit is located.

9. An electronic device, comprising: The computer readable storage medium has stored thereon a computer program, and the computer program is executed to implement the steps of the method according to any one of claims 1 to 7. The computer readable storage medium has stored thereon a computer program, and the computer program is executed to implement the steps of the method according to any one of claims 1 to 7. ​ 10. A computer-readable storage medium, characterized in that, ​

Citation Information

Patent Citations

  • PCIE (Peripheral Component Interface Express) exchanger with selectable functions of transparent bridge and non-transparent bridge and multi-host system

    CN111597135A

  • PCIE switch based on non-transparent bridge module and host system

    CN117009274A