A link negotiation method and device in a PCIe device loopback mode

By actively negotiating the channel number of the PCIe device, the problem of poor interoperability in EQ Loopback mode was resolved, ensuring the normal execution of the test process and protocol compatibility.

CN119766705BActive Publication Date: 2026-03-31WUXI STARS MICRO SYSTEM TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In the EQ Loopback mode of PCIe devices, devices from different manufacturers may have poor interoperability, leading to link negotiation failure and the inability to perform tests normally.

Method used

By proactively initiating channel number negotiation between both parties in the link, and using software configuration registers to ensure that the channel numbers of both parties in the link are consistent, the normal execution of the test process is ensured.

Benefits of technology

Successful link negotiation in EQ Loopback mode was achieved, avoiding test process failures and ensuring interoperability and protocol compatibility between PCIe devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119766705B_ABST
    Figure CN119766705B_ABST
Patent Text Reader

Abstract

The application provides a link negotiation method and device in a PCIe device loopback mode, the method comprising: when a PCIe host device enters a loopback mode, sending software pre-configured physical channel number information to be tested to a PCIe slave device through a test code stream. When the PCIe slave device enters the loopback mode, if it is determined that the PCIe slave device supports channel number negotiation, the physical channel number information in the test code stream is saved. In response to a rate switch, the same physical channel number information saved is used in the host device and the slave device for scrambling and descrambling of the test code stream. The technical solution of the application realizes normal execution of EQ Loopback testing through channel number negotiation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of link testing, and specifically relates to a link negotiation method and apparatus in the loopback mode of a PCIe device. Background Technology

[0002] With the continuous increase in PCIe (Peripheral Component Interconnect Express) link speeds, ensuring link quality and controlling bit error rate has become crucial. To meet this need, the PCIe 5.0 protocol introduced an enhanced test mode—Equalization Loopback (EQ loopback). This mode allows for the independent evaluation of individual physical lanes (lanes under test) within the PCIe device controller, instead of requiring simultaneous testing of all physical lanes as in previous versions of PCIe 5.0.

[0003] In EQ loopback mode, users can flexibly select specific physical channels for individual testing, thereby more accurately measuring the performance and bit error rate of each channel without being affected by the activity of other channels. However, in practical applications, different manufacturers' PCIe devices may have different implementations of EQ loopback mode, leading to problems such as poor interoperability. Summary of the Invention

[0004] The purpose of this application is to provide a link negotiation method and apparatus in the loopback mode of PCIe devices, which aims to achieve normal execution of EQ Loopback test through channel number negotiation, thereby effectively improving the interoperability of EQ loopback mode between PCIe devices.

[0005] According to a first aspect of this application, a link negotiation method in PCIe device loopback mode is provided, comprising:

[0006] When the PCIe master device enters loopback mode, it sends the pre-configured physical channel number information to be tested to the PCIe slave device through the test stream.

[0007] When the PCIe slave device enters loopback mode, if it is determined that the PCIe slave device supports channel number negotiation, the physical channel number information in the test stream is saved.

[0008] In response to a rate switch, the same stored physical channel number information is used to scramble and descramble the test stream in both the master and slave devices.

[0009] In an optional implementation, before sending the pre-configured physical channel number information to be tested via the test stream to the PCIe slave device, the method further includes:

[0010] Define a register within the PCIe master device to store the pre-configured physical channel number information to be tested in the register.

[0011] In an optional implementation, the step of saving the physical channel number information in the test stream if it is determined that the PCIe slave device supports channel number negotiation further includes:

[0012] When two consecutive test streams are received, check whether the Lane number field of the test stream is PAD;

[0013] If the Lane number field is not a PAD, then the PCIe slave device is determined to support channel number negotiation, and the physical channel number information in the received test stream is saved.

[0014] In an optional implementation, it further includes:

[0015] If the Lane number field is PAD, it is determined that the PCIe slave device does not support channel number negotiation, and the pre-configured physical channel number information to be tested is used.

[0016] In an optional implementation, the same stored physical channel number information is used in both the master and slave devices to scramble and descramble the test stream, further including:

[0017] The physical channel number information is used in the master and slave devices to scramble the test stream in the transmission direction and descramble the test stream in the reception direction.

[0018] According to a second aspect of this application, a link negotiation apparatus in PCIe device loopback mode is provided, comprising:

[0019] The sending unit is used to send the pre-configured physical channel number information to be tested to the PCIe slave device via a test stream when the PCIe master device enters loopback mode.

[0020] The negotiation unit is used to save the physical channel number information in the test stream if it is determined that the PCIe slave device supports channel number negotiation when the PCIe slave device enters loopback mode.

[0021] A switching unit is used to scramble and descramble the test stream using the same stored physical channel number information in both the master and slave devices in response to a rate switch.

[0022] In an optional implementation, the sending unit is further configured to: define a register in the PCIe master device to store the software-preconfigured physical channel number information to be tested in the register before sending the software-preconfigured physical channel number information to the PCIe slave device via the test stream.

[0023] In an optional implementation, the negotiation unit is further configured to: upon receiving two consecutive test streams, check whether the Lane number field of the test stream is PAD; if the Lane number field is not PAD, determine that the PCIe slave device supports channel number negotiation, and save the physical channel number information in the received test stream.

[0024] In an optional implementation, the negotiation unit is further configured to: if the Lane number field is PAD, determine that the PCIe slave device does not support channel number negotiation, and use the software-preconfigured physical channel number information to be tested.

[0025] In an optional implementation, the switching unit is further configured to: use physical channel number information in the master device and slave device to scramble the test stream in the transmission direction and descramble the test stream in the reception direction.

[0026] Compared with related technologies, the technical solution of this application has the following advantages:

[0027] When a PCIe device is in EQ Loopback mode, the entire test process cannot be executed correctly due to the inability of the two devices on the link to negotiate the physical channel number. Furthermore, a register defined by the software can be added to ensure that the channel number information on both sides of the link is consistent, thus ensuring that the PCIe protocol compatibility requirements are met.

[0028] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures and processes shown in the description and the accompanying drawings. Attached Figure Description

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

[0030] Figure 1 and Figure 2 These are two schematic diagrams illustrating the process of ensuring that the physical channel numbers of both devices in a PCIe link are consistent, based on relevant technologies.

[0031] Figure 3 This is a schematic diagram illustrating the process of a PCIe device entering loopback mode based on relevant technologies.

[0032] Figure 4 This is a flowchart illustrating a link negotiation method in loopback mode of a PCIe device according to an exemplary embodiment of this application.

[0033] Figure 5 This is a schematic diagram of a link negotiation process according to an exemplary embodiment of this application. Detailed Implementation

[0034] 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.

[0035] The technical terms and their Chinese definitions used in this application are shown in Table 1 below.

[0036] Table 1

[0037]

[0038]

[0039] The PCIe 5.0 protocol specifies that in EQ loopback mode, when the LTSSM state machine controlling physical layer link negotiation enters the Loopback.Entry state, the PCIe devices on both sides of the link switch the speed from 2.5GT / s to 32GT / s. After the speed switches to 32GT / s, both sides of the link perform PCIe link equalization to optimize link quality. Finally, the LTSSM enters the Loopback.Active state to initiate the loopback test.

[0040] The PCIe protocol specifies that when the link rate is greater than or equal to 8GT / s, the training set (TS) bitstream transmitted on each channel is scrambled, and the receiver uses the same seed to descramble the TS bitstream (scrambling is not required for 2.5GT / s and 5GT / s). The seed of each channel's Linear Feedback Shift Register (LFSR) is related to the Lane number of the current channel. If the lane number of the sender is unknown, the receiver cannot parse and reconstruct the correct information in the TS bitstream. Table 2 shows the correspondence between Lane number and corresponding LSFR seed specified in the PCIe protocol.

[0041] Table 2

[0042]

[0043]

[0044] The PCIe protocol stipulates that when the LTSSM state machine is in the Configuration.Lanenum state, the devices on both sides of the link need to determine the Lane number of each physical channel by sending a TS stream and receiving the Lane number information in the TS stream.

[0045] like Figure 1 and Figure 2 As shown, the default physical channel numbers of the two devices in a PCIe link may be inconsistent. During the normal link establishment process of PCIe devices, the LTSSMs of both parties need to reach an agreement on the Lane number after negotiation in Configuration.Lanenum. Figure 1 Lane reversal means physical channel reversal, that is, the physical channel numbering order of the two sides of the link is reversed. Figure 2 Lane flip indicates a physical channel flip, meaning that the link widths of the two sides of the link are different, and the channel number is flipped.

[0046] like Figure 3 As shown, in EQ Loopback mode, the PCIe devices on both sides of the link jump directly from Configuration.Linkwidth.Start to Loopback.Entry state. At this time, the physical channel number (Lane number) in the TS stream is PAD (padding information for a specific segment in the TS stream), without negotiating the Lane number through the Configuration.Lanenum state. When the link rate increases from 2.5GT / s to 32GT / s (i.e., ... Figure 3At points M3-M4 and S3-S4, the received TS stream may not be descrambled correctly due to the different Lane numbers of the PCIe devices on both sides of the link. As a result, the subsequent EQ cannot be executed properly, the LTSSM state machine times out, and the loopback test ultimately fails.

[0047] The PCIe protocol does not specify a method for negotiating the Lane number between the two parties in this mode, which leads to two problems: First, the EQ Loopback test cannot be executed correctly because the Lane number is not negotiated in some way. Second, there are compatibility issues with different vendors; because each vendor uses its own custom method, the EQ Loopback test cannot be executed correctly when devices from different vendors are connected.

[0048] Based on the above analysis, this application provides a link negotiation method and apparatus in PCIe device loopback mode. By improving the behavior of the PCIe master and PCIe slave initiating the loopback mode, the LTS SM state machines of both parties negotiate the Lane number in the Loopback.Entry state, thus solving the problem of EQ Loopback testing failing to execute normally. Furthermore, for devices that do not support channel number negotiation, the Lane number information is specified through software configuration registers to avoid compatibility issues.

[0049] Please see Figure 4 The flowchart, exemplarily, illustrates that the link negotiation method in PCIe device loopback mode provided in this application includes:

[0050] Step 401: When the PCIe master device enters loopback mode, it sends the pre-configured physical channel number information to be tested to the PCIe slave device through the test stream.

[0051] For example, such as Figure 5 For the Loopback master device, when the LTSSM enters the Loopback.Entry state (i.e., during M1 to M2), the lane under test information configured in the software is sent to the slave device through the TS1 stream.

[0052] Before sending the pre-configured physical channel number information to be tested to the PCIe slave device via the test stream, the method also includes defining a register within the PCIe master device to store the pre-configured physical channel number information to be tested in the register.

[0053] The lane under test information configured by the software is pre-stored in a register defined within the PCIe master device and is used to configure the physical channel number to be tested in the EQ Loopback test mode.

[0054] Furthermore, registers are configured in both the master and slave devices. As mentioned above, the master device's register is used to determine the lane under test information of its local device and send this information to the slave device. The slave device's register is used to store the Lane number information received from the master device's TS1 when connecting to a master device that supports negotiation, for software querying and problem analysis and localization. When connecting to a master device that does not support negotiation, the software can configure this register to ensure that the lane required for loopback on the slave device is consistent with that on the master device.

[0055] Step 402: When the PCIe slave device enters loopback mode, if it is determined that the PCIe slave device supports channel number negotiation, then save the physical channel number information in the test stream.

[0056] For example, for a Loopback slave device, when the LTSSM enters the Loopback.Entry state, upon receiving two consecutive TS1 streams ( Figure 5 In S1~S2), check if the Lane number field is PAD:

[0057] If the Lane number field is not PAD, it indicates that the connected device is a PCIe device that supports channel number negotiation, and the Lane number information in the received TS1 stream is saved.

[0058] If the Lane number field is PAD, it indicates that the connected device is a PCIe device that does not support lane number negotiation, and the value of the lane under test register previously configured by the software is used.

[0059] Step 403: In response to a rate switch, scrambling and descrambling of the test stream are performed on both the master and slave devices using the same saved physical channel number information.

[0060] like Figure 5 As shown, when the rate switches from 2.5GT / s to 32GT / s ( Figure 5 (M3 and S3):

[0061] The Loopback master device uses the Lane number information sent in the TS1 stream during the previous Loopback.Entry state (i.e., the lane undertest configured in the software) for scrambling the TS in the transmission direction and descrambling the TS stream in the reception direction.

[0062] The Loopback slave device uses the Lane number information previously saved in the Loopback.Entry state for scrambling the TS in the transmit direction and descrambling the TS stream in the receive direction.

[0063] Since the Loopback master and slave devices have already synchronized the Lane number information at a rate of 2.5GT / s, when the rate is switched to 32GT / s, the receiver uses the same Lane number information as the transmitter to descramble the TS stream. Therefore, both sides of the link can correctly identify the information in the TS sent by the other end, so that the EQ Loopback test can be executed correctly.

[0064] As can be seen, the link negotiation method in PCIe device loopback mode provided in this application has the following advantages compared with related technologies:

[0065] When PCIe devices are in EQ Loopback mode, the entire test process cannot be executed correctly due to the inability of the two devices on the link to negotiate the physical channel number. At the same time, for PCIe devices that do not support negotiation, a register defined by software can be added to ensure that the channel number information on both sides of the link is consistent, thus ensuring that the PCIe protocol compatibility requirements are met.

[0066] Accordingly, this application provides a link negotiation apparatus in PCIe device loopback mode in a second aspect, comprising:

[0067] The sending unit is used to send the pre-configured physical channel number information to be tested to the PCIe slave device via a test stream when the PCIe master device enters loopback mode.

[0068] The negotiation unit is used to save the physical channel number information in the test stream if it is determined that the PCIe slave device supports channel number negotiation when the PCIe slave device enters loopback mode.

[0069] The switching unit is used to scramble and descramble the test stream in both the master and slave devices using the same stored physical channel number information in response to a rate switch.

[0070] In an optional implementation, the sending unit is further configured to: define a register in the PCIe master device to store the software-preconfigured physical channel number information to be tested in the register before sending the software-preconfigured physical channel number information to the PCIe slave device via the test stream.

[0071] In an optional implementation, the negotiation unit is further configured to: upon receiving two consecutive test streams, check whether the Lane number field of the test stream is PAD; if the Lane number field is not PAD, determine that the PCIe slave device supports channel number negotiation, and save the physical channel number information in the received test stream.

[0072] In an optional implementation, the negotiation unit is further configured to: if the Lane number field is PAD, determine that the PCIe slave device does not support channel number negotiation, and use the software-preconfigured physical channel number information to be tested.

[0073] In an optional implementation, the switching unit is further configured to: use physical channel number information in the master device and slave device to scramble the test stream in the transmission direction and descramble the test stream in the reception direction.

[0074] The above-mentioned device can be implemented by the link negotiation method in the PCIe device loopback mode provided in the first aspect embodiment. For the specific implementation method, please refer to the description in the first aspect embodiment, which will not be repeated here.

[0075] It is understood that the structures, names, and parameters described in the above embodiments are merely examples. Those skilled in the art can also make readily conceived combinations and adjustments to the structural features of the above embodiments according to their needs, and the concept of this application should not be limited to the specific details of the above examples.

[0076] Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for link negotiation in a PCIe device loopback mode, the method comprising: The application comprises the following steps: When the PCIe host device enters the loopback mode, software pre-configured physical channel number information to be tested is sent to the PCIe slave device through a test code stream; When the PCIe slave device enters the loopback mode, if it is determined that the PCIe slave device supports channel number negotiation, the physical channel number information in the test code stream is saved; In response to a rate switch, the same saved physical channel number information is used in the host device and the slave device for scrambling and descrambling of the test code stream; Before the step of sending the software pre-configured physical channel number information to be tested to the PCIe slave device through the test code stream, the application further comprises the step of defining a register in the PCIe host device to store the software pre-configured physical channel number information to be tested in the register; The step of saving the physical channel number information in the test code stream comprises the steps of: when the PCIe slave device is connected to a PCIe host device supporting channel number negotiation, saving the physical channel number information received from the PCIe host device in a register in the PCIe slave device; and when the PCIe slave device is connected to a PCIe host device not supporting channel number negotiation, configuring the register in the PCIe slave device by software so that the physical channels in the PCIe slave device that need to be tested in the loopback mode are consistent with those in the PCIe host device.

2. The method of link negotiation in the PCIe device loopback mode according to claim 1, wherein, The step of saving the physical channel number information in the test code stream further comprises the steps of: When two continuous test code streams are received, checking whether a Lane number field segment of the test code stream is PAD; If the Lane number field segment is not PAD, it is determined that the PCIe slave device supports channel number negotiation, and the physical channel number information in the received test code stream is saved.

3. The method of link negotiation in the PCIe device loopback mode according to claim 2, wherein, The application further comprises the steps of: If the Lane number field segment is PAD, it is determined that the PCIe slave device does not support channel number negotiation, and software pre-configured physical channel number information to be tested is used.

4. The method of link negotiation in the PCIe device loopback mode according to claim 1, wherein, The step of using the saved same physical channel number information in the host device and the slave device for scrambling and descrambling of the test code stream further comprises the steps of: The physical channel number information is used in the host device and the slave device to scramble the test code stream in the sending direction and to descramble the test code stream in the receiving direction.

5. A device for link negotiation in a PCIe loopback mode, the device comprising: The application comprises the following steps: A sending unit is configured to send software pre-configured physical channel number information to be tested to a PCIe slave device through a test code stream when a PCIe host device enters a loopback mode; A negotiation unit is configured to save physical channel number information in the test code stream if it is determined that the PCIe slave device supports channel number negotiation when the PCIe slave device enters the loopback mode; A switching unit is configured to use the same saved physical channel number information in the host device and the slave device for scrambling and descrambling of the test code stream in response to a rate switch. The sending unit is further used for defining a register in the PCIe host device before sending the software preconfigured physical channel number information to be tested through the test code stream to the PCIe slave device, so as to store the software preconfigured physical channel number information to be tested in the register; The saving of the physical channel number information in the test code stream comprises: when the PCIe slave device is connected to the PCIe host device supporting channel number negotiation, the received physical channel number information from the PCIe host device is saved in the register in the PCIe slave device; When the PCIe host device not supporting channel number negotiation is connected, the register in the PCIe slave device is configured by software, so that the physical channels needing loopback test in the PCIe slave device are consistent with the PCIe host device.

6. The apparatus of claim 5, wherein, The negotiation unit is further used for: When two continuous test code streams are received, checking whether the Lane number field segment of the test code stream is PAD; If the Lane number field segment is not PAD, it is determined that the PCIe slave device supports channel number negotiation, and the physical channel number information in the received test code stream is saved.

7. The apparatus of claim 6, wherein, The negotiation unit is further used for: If the Lane number field segment is PAD, it is determined that the PCIe slave device does not support channel number negotiation, and the software preconfigured physical channel number information to be tested is used.

8. The apparatus of claim 6, wherein, The switching unit is further used for: Using the physical channel number information in the host device and the slave device to scramble the test code stream in the sending direction and to descramble the test code stream in the receiving direction.

Citation Information

Patent Citations

  • Method and device used for managing channel resources of high-speed serial link

    CN105407025A

  • Electronic device for controlling state machine and method of operating the same

    CN118689828A