Link negotiation method and device in PCIe equipment loopback mode
By negotiating physical channel numbering between PCIe devices, the problem of poor interoperability of devices of different manufacturers in EQ Loopback mode is solved, the normal execution of link negotiation and testing is achieved, and the compatibility of the PCIe protocol is ensured.
Patent Information
- Application Number
- CN202411947496.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In the EQ Loopback mode of PCIe devices, devices from different manufacturers may have different implementation methods for loopback testing mode, resulting in poor interoperability, which in turn affects the normal execution of link negotiation and tests.
By negotiating physical channel numbering between PCIe devices, we ensure that both parties to the link use the same physical channel numbering information in loopback mode, thereby achieving correct scrambling and descrambling of the test code stream. The specific method includes sending the preconfigured physical channel number information to the slave device through the test code stream when the master device enters the loopback mode, and saving the information when the slave device supports negotiation for the code stream processing during rate switching.
Improves interoperability between PCIe devices in EQ Loopback mode, ensures normal execution of link negotiation and tests, and avoids test failures due to inconsistent physical channel numbers. At the same time, the device compatibility problem that does not support channel number negotiation is solved through the software configuration registers.
Smart Images

Figure CN119766705A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of link testing, and in particular relates to a link negotiation method and apparatus in a PCIe device loopback mode. Background Art
[0002] As the link rate of PCIe (Peripheral Component Interconnect Express) continues to increase, it is critical to ensure link quality and control bit error rate. To meet this demand, the PCIe 5.0 protocol introduces an enhanced test mode - Equalization Loopback (EQ loopback). This mode allows independent evaluation of a single physical channel (Lane under test) within the PCIe device controller, rather than testing all physical channels at the same time as previous versions of PCIe 5.0.
[0003] In EQ loopback mode, users can flexibly select specific physical channels for separate testing, thereby more accurately measuring the performance and bit error rate of each channel without being affected by the activities of other channels. However, in actual applications, PCIe devices from different manufacturers may have different implementations of EQ loopback mode, resulting in poor interoperability and other issues. Summary of the invention
[0004] The purpose of this application is to provide a link negotiation method and apparatus in a PCIe device loopback mode, aiming 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 the present application, a link negotiation method in a PCIe device loopback mode is provided, comprising:
[0006] When the PCIe master device enters the loopback mode, the physical channel number information to be tested pre-configured by the software is sent to the PCIe slave device through the test code stream;
[0007] When the PCIe slave device enters the loopback mode, if it is determined that the PCIe slave device supports channel number negotiation, then saving the physical channel number information in the test bit stream;
[0008] In response to the occurrence of rate switching, the master device and the slave device use the same stored physical channel number information to perform scrambling and descrambling of the test code stream.
[0009] In an optional implementation manner, before sending the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test bit stream, the method further includes:
[0010] A register is defined in the PCIe master device to store the physical channel number information to be tested pre-configured by software in the register.
[0011] In an optional implementation manner, if it is determined that the PCIe slave device supports channel number negotiation, saving the physical channel number information in the test bit stream further includes:
[0012] When receiving two consecutive test code streams, check whether the Lane number field of the test code stream is PAD;
[0013] If the Lane number field is not PAD, it is determined that the PCIe slave device supports lane number negotiation, and the physical lane number information in the received test bit stream is saved.
[0014] In an optional embodiment, it also includes:
[0015] If the Lane number field is PAD, it is determined that the PCIe slave device does not support lane number negotiation, and the physical lane number information to be tested pre-configured by software is used.
[0016] In an optional implementation manner, using the same stored physical channel number information to perform scrambling and descrambling of the test code stream in the master device and the slave device further includes:
[0017] The physical channel number information is used in the master 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.
[0018] According to a second aspect of the present application, a link negotiation device in a PCIe device loopback mode is provided, comprising:
[0019] The sending unit is used to send the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test code stream when the PCIe master device enters the loopback mode.
[0020] The negotiation unit is configured to save the 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.
[0021] The switching unit is used for scrambling and descrambling the test code stream using the same stored physical channel number information in the master device and the slave device in response to the occurrence of rate switching.
[0022] In an optional embodiment, the sending unit is further used to: define a register in the PCIe master device to store the physical channel number information to be tested pre-configured by the software in the register before sending the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test code stream.
[0023] In an optional implementation, the negotiation unit is further used to: when receiving two consecutive test code streams, check whether the Lane number field of the test code 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 code 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 lane number negotiation, and use the physical lane number information to be tested pre-configured by software.
[0025] In an optional implementation, the switching unit is further configured to: use the physical channel number information in the master 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.
[0026] Compared with the related art, the technical solution of this application has the following advantages:
[0027] When the PCIe device is in EQ Loopback mode, the entire test process can be prevented from being unable to execute correctly due to the inability of the devices on both sides of the link to negotiate the physical channel number. Furthermore, the software can add new registers to ensure that the channel number information on both sides of the link is consistent, ensuring that the PCIe protocol compatibility requirements are met.
[0028] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained through the structures and processes indicated in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. It is obvious that the drawings described below are certain embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0030] Figure 1 and Figure 2 The present invention is a schematic diagram of two processes in which the physical channel numbers of the two devices on the PCIe link are consistent according to the related technology.
[0031] Figure 3 It is a flowchart of a PCIe device entering a loopback mode according to the related art.
[0032] Figure 4 It is a flowchart of a link negotiation method in a PCIe device loopback mode according to an exemplary embodiment of the present application.
[0033] Figure 5 It is a schematic diagram of a link negotiation process according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0035] The technical terms involved in this application and their Chinese interpretations are shown in Table 1 below.
[0036] Table 1
[0037]
[0038]
[0039] The PCIe5.0 protocol stipulates that in EQ loopback mode, when the state machine LTSSM that controls the physical layer link negotiation enters the Loopback.Entry state, the PCIe devices on both sides of the link switch the rate from 2.5GT / s to 32GT / s. After the rate is switched to 32GT / s, both sides of the link perform PCIe link equalization to optimize the quality of the link, and finally LTSSM enters the Loopback.Active state to start the loopback test.
[0040] The PCIe protocol stipulates that when the link rate is greater than or equal to 8GT / s, the training set (TS) code stream sent by each channel will be scrambled, and the receiver uses the same seed to descramble the TS code stream (the sent TS does not need to be scrambled at 2.5GT / s and 5GT / s). The seed of each channel linear feedback shift register (LFSR) is related to the number information Lanenumber of the current channel. If the number of the corresponding channel of the sender is unknown, the receiver cannot parse and restore the correct information in the TS code stream. Table 2 shows the correspondence between the Lane number and the corresponding LSFR seed specified in the PCIe protocol.
[0041] Table 2
[0042]
[0043]
[0044] The PCIe protocol stipulates that the devices on both sides of the link need to determine the Lane number of each physical channel by sending a TS code stream and the Lane number information in the received TS code stream when the LTSSM state machine is in the Configuration.Lanenum state.
[0045] like Figure 1 and Figure 2 As shown in the figure, the default physical channel numbers of the devices on both sides of the PCIe link may be inconsistent. In the normal link establishment process of the PCIe device, the LTSSM of both sides of the link need to reach a consensus on Lanenumber after Configuration.Lanenum negotiation. Figure 1 Lane reversal indicates physical lane reversal, that is, the order of physical lane numbers on both sides of the link is reversed. Figure 2 Lane flip indicates physical lane flipping, that is, the link widths of both ends of the link are different and the lane numbers are flipped.
[0046] like Figure 3 As shown in the figure, 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 code stream is PAD (filling information of a specific domain segment in the TS code stream), and the Lane number is not negotiated in the Configuration.Lanenum state. When the link rate increases from 2.5GT / s to 32GT / s (i.e. Figure 3The received TS code stream cannot be descrambled correctly, and the subsequent EQ cannot be executed normally. The LTSSM state machine times out, resulting in the failure of the final loopback test.
[0047] The PCIe protocol does not specify how the two parties in the link negotiate the Lane number in this mode, which will lead to two problems: the EQ Loopback test cannot be performed normally because the Lane number is not negotiated in some way. In addition, there will be compatibility issues with synchronization manufacturers. Because each manufacturer uses a customized method, the EQ Loopback test cannot be performed normally when devices from different manufacturers are connected.
[0048] Based on the above analysis, the present application provides a link negotiation method and apparatus in the loopback mode of a PCIe device, which improves the behavior of the PCIe master device (Loopback master) and the PCIe slave device (slave) that actively initiate the Loopback mode, so that the LTS SM state machines of both parties of the link negotiate the Lane number in the Loopback.Entry state, thereby solving the problem that the EQ Loopback test cannot be performed normally. Furthermore, for devices that do not support channel number negotiation, the Lane number information is specified by configuring registers through software to avoid compatibility issues.
[0049] See also Figure 4 Flow chart, illustratively, the link negotiation method in the PCIe device loopback mode provided by the present application includes:
[0050] Step 401: When the PCIe master device enters the loopback mode, the physical channel number information to be tested pre-configured by the software is sent to the PCIe slave device through the test code stream.
[0051] For example, 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 by the software is sent to the slave device through the TS1 code stream.
[0052] Before sending the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test code stream, it also includes defining a register in the PCIe master device to store the physical channel number information to be tested pre-configured by the software in the register.
[0053] The lane under test information configured by software is pre-stored in a register defined in the PCIe master device and is used to configure the number of the physical channel to be tested in the EQ Loopback test mode in the software configuration.
[0054] Furthermore, registers are set in the master device and the slave device respectively. As described above, the register of the master device is used to determine the lane under test information of the local device and send this information to the slave device; the register of the slave device is used to store the Lane number information received from TS1 in the master device in this register for software query and problem analysis and location when docking with a master device that does not support negotiation; when docking with a master device that does not support negotiation, the register can be configured by software to ensure that the Lane that needs to be loopbacked in the slave device is consistent with that of the master device.
[0055] Step 402: When the PCIe slave device enters the loopback mode, if it is determined that the PCIe slave device supports channel number negotiation, then the physical channel number information in the test bit stream is saved.
[0056] For example, for a Loopback slave device, when the LTSSM enters the Loopback.Entry state, when two consecutive TS1 code streams are received ( Figure 5 In S1-S2), check whether 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 lane number negotiation. In this case, the Lane number information in the received TS1 code 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. In this case, the lane under test register value previously configured by the software is used.
[0059] Step 403: In response to the occurrence of rate switching, the master device and the slave device use the same stored physical channel number information to perform scrambling and descrambling of the test code stream.
[0060] like Figure 5 As shown in Figure 2, when the rate is switched 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 code stream in the previous Loopback.Entry state (that is, lane undertest configured by the software) for scrambling the TS in the sending direction and descrambling the TS code stream in the receiving direction.
[0062] The Loopback slave device uses the Lane number information previously saved in the Loopback.Entry state to scramble the TS in the sending direction and descramble the TS code stream in the receiving direction.
[0063] Because the Lane number information of the Loopback master and slave devices has been synchronized at the 2.5GT / s rate, when the rate is switched to 32GT / s, the receiving end uses the same Lane number information as the sending end to descramble the TS code stream. Therefore, both parties in 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] It can be seen that the link negotiation method in the PCIe device loopback mode provided by the present application has the following advantages compared with the related technologies:
[0065] When the PCIe device is in EQ Loopback mode, the entire test process can be prevented from being executed correctly due to the inability of the devices on both sides of the link to negotiate the physical channel number. At the same time, for PCIe devices that do not support negotiation, new registers can be defined by software to ensure that the channel number information on both sides of the link is consistent, ensuring that the PCIe protocol compatibility requirements are met.
[0066] Accordingly, the present application provides, in a second aspect, a link negotiation device in a PCIe device loopback mode, comprising:
[0067] The sending unit is used to send the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test code stream when the PCIe master device enters the loopback mode.
[0068] The negotiation unit is used for saving the 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.
[0069] The switching unit is used for scrambling and descrambling the test code stream in the master device and the slave device using the same stored physical channel number information in response to the occurrence of rate switching.
[0070] In an optional embodiment, the sending unit is further used to: define a register in the PCIe master device to store the physical channel number information to be tested pre-configured by the software in the register before sending the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test code stream.
[0071] In an optional implementation, the negotiation unit is further used to: when receiving two consecutive test code streams, check whether the Lane number field of the test code 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 code 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 lane number negotiation, and use the physical lane number information to be tested pre-configured by software.
[0073] In an optional implementation, the switching unit is further configured to: use the physical channel number information in the master 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.
[0074] The above-mentioned device can be implemented by the link negotiation method in the PCIe device loopback mode provided by the embodiment of the first aspect above. The specific implementation method can be found in the description of the embodiment of the first aspect, which will not be repeated here.
[0075] It is understood that the structures, names and parameters described in the above embodiments are only examples. Those skilled in the art can also easily think of combinations and adjustments to the structural features of the above embodiments according to the use requirements, and should not limit the concept of the present application to the specific details of the above examples.
[0076] Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that he or she may still modify the technical solutions described in the aforementioned embodiments, or make equivalent substitutions for some of the technical features therein; 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 the present application.
Claims
1. A link negotiation method in a PCIe device loopback mode, characterized in that: include: When the PCIe master device enters the loopback mode, the physical channel number information to be tested pre-configured by the software is sent to the PCIe slave device through the 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, then saving the physical channel number information in the test bit stream; In response to the occurrence of rate switching, the master device and the slave device use the same stored physical channel number information to perform scrambling and descrambling of the test code stream.
2. The link negotiation method in the PCIe device loopback mode according to claim 1, characterized in that: Before sending the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test code stream, the method further includes: A register is defined in the PCIe master device to store the physical channel number information to be tested pre-configured by software in the register.
3. The link negotiation method in the PCIe device loopback mode according to claim 1, characterized in that: If it is determined that the PCIe slave device supports channel number negotiation, then saving the physical channel number information in the test bit stream further includes: When receiving two consecutive test code streams, check whether the Lane number field of the test code stream is PAD; If the Lane number field is not PAD, it is determined that the PCIe slave device supports lane number negotiation, and the physical lane number information in the received test bit stream is saved.
4. The link negotiation method in the PCIe device loopback mode according to claim 3, characterized in that: Also includes: If the Lane number field is PAD, it is determined that the PCIe slave device does not support lane number negotiation, and the physical lane number information to be tested pre-configured by software is used.
5. The link negotiation method in the PCIe device loopback mode according to claim 1, characterized in that: Using the same saved physical channel number information in the master device and the slave device to perform scrambling and descrambling of the test code stream further includes: The physical channel number information is used in the master 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.
6. A link negotiation device in a PCIe device loopback mode, characterized in that: include: The sending unit is used to send the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test code stream when the PCIe master device enters the loopback mode; A negotiation unit, configured to save the physical channel number information in the test bit stream if it is determined that the PCIe slave device supports channel number negotiation when the PCIe slave device enters the loopback mode; The switching unit is used for scrambling and descrambling the test code stream using the same stored physical channel number information in the master device and the slave device in response to the occurrence of rate switching.
7. The link negotiation device in the PCIe device loopback mode according to claim 6, characterized in that: The sending unit is further used for: Before sending the physical channel number information to be tested pre-configured by the software to the PCIe slave device through the test code stream, a register is defined in the PCIe master device to store the physical channel number information to be tested pre-configured by the software in the register.
8. The link negotiation device in the PCIe device loopback mode according to claim 6, characterized in that: The negotiation unit is further configured to: When receiving two consecutive test code streams, check whether the Lane number field of the test code stream is PAD; If the Lane number field is not PAD, it is determined that the PCIe slave device supports lane number negotiation, and the physical lane number information in the received test bit stream is saved.
9. The link negotiation device in the PCIe device loopback mode according to claim 8, characterized in that: The negotiation unit is further configured to: If the Lane number field is PAD, it is determined that the PCIe slave device does not support lane number negotiation, and the physical lane number information to be tested pre-configured by software is used.
10. The link negotiation device in the PCIe device loopback mode according to claim 6, characterized in that: The switching unit is further used for: The physical channel number information is used in the master 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
Semiconductor device, method for operating semiconductor device, and system incorporating same
CN107918594A
Methods for multi-lane sequence automatic adjustment and related electronic devices
CN109697181A
Method, system and device for accelerating execution of NVMe protocol and storage medium
CN116382581A
Testing method and device for equipment link loopback and medium
CN118170594A
Cited By
PCIe-based high-speed data transmission method, device and system
CN120336240A