Initialization method and device for flow control
By conducting initial negotiation of traffic control in Flit-Mode mode of PCIe interface, the problems of resource waste and bandwidth performance degradation during data transmission of PCIe interface are solved, and more reasonable resource allocation and bandwidth performance improvement are achieved.
Patent Information
- Application Number
- CN202411965341.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-28
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-28
AI Technical Summary
The existing PCIe interface lacks an effective flow control mechanism during data transmission, which causes the sending end to be unable to accurately judge the receiving capability of the receiving end, resulting in waste of resources and degradation of bandwidth performance.
A traffic control initialization method is proposed. By switching to the negotiation state in the Flit-Mode mode of the PCIe data link, the reserved size of each header field of the TLP data packet is obtained, and the negotiation data packet is generated. The negotiation parties determine the initial credit quantity based on the negotiation results.
By accurately calculating the number of Header Credits, saving redundant cache space, increasing the number of Header Credits by 126% to 271%, achieving more reasonable allocation of resources, and improving the bandwidth performance of the PCIe bus.
Smart Images

Figure CN119854220A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of chip technology, and in particular relates to a method and device for initializing flow control. Background Art
[0002] As modern computer systems have increasing requirements for both performance and power consumption, PCIe, as a high-bandwidth, low-latency interface standard, is widely used in various computer systems.
[0003] In the earlier PCI versions of PCIe, there is no flow control mechanism, and the sender does not know whether the receiver can receive the corresponding TLP (Transaction Layer Packets) at the current moment. Therefore, the sender can only try to send, during which multiple waiting cycles may be inserted (due to reasons such as the receiving device is not ready), or even retries, etc. These problems have seriously affected the bandwidth performance of the bus as the PCIe bus evolves, including the increase in data rate and transmission bandwidth requirements. Summary of the invention
[0004] The purpose of the present application is to provide a method and device for initializing flow control, aiming to solve the problem in the related art that the header field size in the TLP data packet is reserved according to the worst case, making it impossible to flexibly allocate and calculate the required credit quantity according to actual needs, resulting in resource waste.
[0005] According to a first aspect of the present application, a method for initializing flow control is provided, the method being applied to a Flit-Mode mode of a local end of a PCIE data link, comprising:
[0006] In response to entering the initialization phase of the data link layer, switching to a negotiation state;
[0007] In the negotiation state, obtaining the reserved size corresponding to each header field of the TLP data packet;
[0008] Generate a first negotiation data packet based on the reserved sizes corresponding to the header fields;
[0009] The first negotiation data packet is sent to the PCIE data link peer end, so that the PCIE data link peer end determines the initial credit quantity of the PCIE data link peer end according to the reserved size of each header field carried in the first negotiation data packet.
[0010] In an optional implementation manner, in the negotiation state, obtaining the reserved size corresponding to each header field of the TLP data packet includes:
[0011] Determine the first reserved size of the header field basic field of the TLP data packet based on whether the newly added message type of Flit-Mode in the TLP data packet is a reserved type;
[0012] Determine a second reserved size of the header OHC field of the TLP data packet based on whether the TLP data packet supports the OHC-E type;
[0013] Based on whether the header and tail fields of the TLP data packet support ECRC and IDE MAC, determine the third reserved size of the header and tail fields of the TLP data packet.
[0014] In an optional embodiment, the method further comprises:
[0015] Receive a second negotiation data packet sent by the PCIE data link peer; wherein the second negotiation data packet carries the reserved size of each header field of the TLP data packet of the PCIE data link peer;
[0016] Determine the initial credit quantity of the local end of the PCIE data link based on the reserved size of each header field of the TLP data packet of the opposite end of the PCIE data link in the second negotiation data packet, and switch to the initialization state of the initialization phase of the data link layer;
[0017] In the initialization state, flow control DLLPs corresponding to different types of TLP data packets are sent to the PCIE data link peer based on the initial credit quantity.
[0018] In an optional implementation manner, the reserved size of each header field of the TLP data packet of the PCIE data link peer end in the second negotiation data packet includes: a first reserved size of a header field basic field, a second reserved size of a header field OHC field, and a third reserved size of a header field tail field; and determining the initial credit quantity of the PCIE data link local end based on the reserved size of each header field of the TLP data packet of the PCIE data link peer end in the second negotiation data packet includes:
[0019] Calculate the header field size of the TLP data packet at the opposite end of the PCIE data link based on the first reserved size of the header field base field, the second reserved size of the header field OHC field, and the third reserved size of the header field tail field of the TLP data packet at the opposite end of the PCIE data link;
[0020] The initial credit quantity is determined based on the header field size, other field sizes of the TLP data packet at the opposite end of the PCIE data link and the receive data buffer size at the local end of the PCIE data link.
[0021] In an optional embodiment, the method further comprises:
[0022] In the negotiation state, if a flow control DLLP sent by the PCIE data link peer in the initialization state of the initialization phase of the data link layer is received, directly switching to the initialization state of the initialization phase of the data link layer;
[0023] In the initialization state, flow control DLLPs corresponding to different types of TLP data packets are sent to the PCIE data link peer based on a default credit quantity.
[0024] According to a second aspect of the present application, a flow control initialization device is provided, the device being applied in a Flit-Mode mode of a local end of a PCIE data link, comprising:
[0025] A response unit, configured to switch to a negotiation state in response to entering an initialization phase of a data link layer;
[0026] An acquiring unit, configured to acquire, in the negotiation state, a reserved size corresponding to each header field of a TLP data packet;
[0027] A generating unit, configured to generate a first negotiation data packet based on the reserved sizes corresponding to the header fields;
[0028] The first sending unit is used to send the first negotiation data packet to the PCIE data link peer, so that the PCIE data link peer determines the initial credit quantity of the PCIE data link peer according to the reserved size of each header field carried in the first negotiation data packet.
[0029] In an optional implementation manner, the acquisition unit includes:
[0030] A first determining subunit, configured to determine a first reserved size of a header field basic field of a TLP data packet based on whether a newly added message type of Flit-Mode in the TLP data packet is a reserved type;
[0031] A second determining subunit, configured to determine a second reserved size of the header OHC field of the TLP data packet based on whether the TLP data packet supports the OHC-E type;
[0032] The third determining subunit is used to determine the third reserved size of the header and tail fields of the TLP data packet based on whether the header and tail fields of the TLP data packet support ECRC and IDE MAC.
[0033] In an optional embodiment, the device further comprises:
[0034] A receiving unit, configured to receive a second negotiation data packet sent by the PCIE data link peer; wherein the second negotiation data packet carries the reserved size of each header field of the TLP data packet of the PCIE data link peer;
[0035] A determining unit, configured to determine the initial credit quantity of the PCIE data link local end based on the reserved size of each header field of the TLP data packet of the PCIE data link opposite end in the second negotiation data packet, and switch to the initialization state of the initialization phase of the data link layer;
[0036] The second sending unit is used to send flow control DLLPs corresponding to different types of TLP data packets to the PCIE data link peer end based on the initial credit quantity in the initial state.
[0037] In an optional implementation manner, the reserved size of each header field of the TLP data packet of the PCIE data link peer in the second negotiation data packet includes: a first reserved size of a header field basic field, a second reserved size of a header field OHC field, and a third reserved size of a header field tail field; the determining unit includes:
[0038] A calculation subunit, configured to calculate the header field size of the TLP data packet at the opposite end of the PCIE data link based on a first reserved size of a header field base field, a second reserved size of a header field OHC field, and a third reserved size of a header field tail field of the TLP data packet at the opposite end of the PCIE data link;
[0039] The fourth determining subunit is used to determine the initial credit quantity based on the header field size, other field sizes of the TLP data packet at the opposite end of the PCIE data link and the receiving data buffer size at the local end of the PCIE data link.
[0040] In an optional embodiment, the device further comprises:
[0041] A switching unit, configured to directly switch to the initialization state of the initialization phase of the data link layer in the negotiation state if a flow control DLLP sent by the PCIE data link peer in the initialization state of the initialization phase of the data link layer is received;
[0042] The third sending unit is used to send flow control DLLPs corresponding to different types of TLP data packets to the PCIE data link peer end based on a default credit quantity in the initialization state.
[0043] Compared with the related art, the technical solution of the present application has at least the following advantages:
[0044] This application adds the FCINIT_HDR_SIZE state and related negotiation processes on the basis of the original PCIE protocol. For PCIE6.X devices, there is no need to reserve resources based on the worst case scenario. Instead, the number of Header Credits is accurately calculated based on the size of the Header Credit unit after the negotiation and synchronization between the two parties of the PCIE link, combined with the size of the Header credit buffer resources on the local side. This can save redundant cache space, increase the number of Header Credits by 126% to 271%, and achieve a more reasonable allocation of resources. Other features and advantages of this application will be described in the subsequent specification, and will partially become apparent from the specification, or can be understood through the implementation of this application. The purposes and other advantages of this application can be achieved and obtained through the structures and processes indicated in the specification and the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] 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.
[0046] Figure 1 It is a schematic diagram of the basic principle of PCIE system flow control based on relevant technologies.
[0047] Figure 2 It is a flow control cache classification diagram of a PCIE system based on related technologies.
[0048] Figure 3 It is a protocol description diagram of the newly added reserved 5 / 6 / 7DW of the TLP Header Base in the PCIE6.X protocol according to the relevant technology.
[0049] Figure 4 It is a flowchart of a method for initializing flow control according to an exemplary embodiment of the present application.
[0050] Figure 5 It is a schematic diagram illustrating the optimization of data link state jump according to an exemplary embodiment of the present application.
[0051] Figure 6 It is a structural block diagram of a flow control initialization device according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0052] 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.
[0053] In order to ensure that the data sent by the sending PCIe device does not exceed the receiving capacity of the receiving device, and to avoid triggering data retransmission and thus reducing data output efficiency or data overflow leading to data loss, the PCIe protocol provides a set of flow control (FC) solutions to improve the data transmission efficiency of the PCIe bus.
[0054] The flow control of the PCIe bus uses the Credit-Based principle, which is coordinated by the transaction layer and the data link layer. Figure 1 As shown, Flow Control DLLPs (Data Link Layer Packe) are sent between the data link layers of two adjacent ports. During initialization, the receiving end notifies the sending end of the size of its cache buffer. Later, during normal operation, the sending end is periodically informed of the size of each buffer of the receiving end through Flow Control DLLPs. Before sending, the sending end can know whether the receiving end can receive the TLP (Transaction Layer Packets) to be sent through the Flow Control mechanism. The TLP types sent and received by PCIe devices are divided into three categories: P (Posted Request) messages, NP (Non-Posted Request) messages, and CPL (Completion) messages. The receiving buffer of the receiving device is also divided into three categories according to the three TLP types, in order to store the three types of P / NP / CPLTLP messages respectively, see Figure 2 As shown in the figure, each type of buffer in its TLP is further divided into Header Buffer and Data Buffer according to whether it stores the message header field or the message data field. The buffer storing the P type message header field (Header) is defined as PH (Posted request Header buffer), and the buffer storing the P type data field is defined as PD (Posted request Data buffer). The same type of message that stores NP / CPL type message header field and data field is defined as: NPH / NPD, CPLH / CPLD.
[0055] The receiving buffer of all types of messages of the PCIe receiving device is based on Credit (credit), and the number of Credits is used to reflect the size of the buffer.
[0056] In the PCIe6.X protocol, a new transmission mode is added, Flit mode, and the traditional transmission mode is called non-Flit mode. In the traditional mode, TLP is of indefinite length, and the physical layer needs to use start and end flags to mark the head and tail of the data packet. Moreover, TLP and DLLP work in different layers and are independent of each other. Flit Mode packages the information of multiple TLPs and a DLLP into a large data frame, called Flit. Data transmission is in units of Flit, and each flit is fixed to 256Byte. A new TLP format is defined in this mode, and its composition is as follows:
[0057] 1) Local TLP prefixes (optional).
[0058] 2)TLP Header Base (1DW(nop), 3DW, 4DW, 5DW(R), 6DW(R), 7DW(R)).
[0059] 3) Orthogonal Header Content (OHC) (optional), 0 to 7 DW, a total of four types: OHC-A, OHC-B, OHC-C, OHC-E; the specific type and size are indicated by OHC[4:0] of the first DW in the TLP Header Base.
[0060] 4) TLP data payload.
[0061] 5) TLP Trailer (optional), the specific type and size are indicated by TS[2:0] of the first DW in the TLP Header Base.
[0062] The parts that are counted as TLP Header and occupy TLP Header Credit resources include: TLP Header Base (TLP header basic field), OHC (TLP header OHC field) and TLP Trailer (TLP header tail field).
[0063] According to the PCIE6.X protocol, the three parts counted as the message header field are described as follows:
[0064] 1. For TLP Header Base, 1DW, 5DW,
[0065] There are 4 new formats, 6DW and 7DW, of which 1DW is used as NOP (empty), and 5DW, 6DW,
[0066] 7DW has three lengths of message headers. In FM mode, there are 40 coding types among the 256 coding types of 8-bit type. However, in the current protocol, all of them are marked as Reserved. Some of the protocol screenshots are as follows: Figure 3 shown.
[0067] 2. For OHC, we mainly focus on the size of various OHCs. In the PCIE6.X protocol, four major types of OHCs are given, namely OHC-A, OHC-B, OHC-C, and OHC-E. Their sizes are shown in Table 1 below:
[0068] Table 1
[0069] OHC Type Size(DW) OHC-A 1DW OHC-B 1DW OHC-C 1DW OHC-E 1DW(E1), 2DW(E2), 4DW(E4)
[0070] Among them, OHC-A / B / C may exist at the same time, and OHC-E is equivalent to EE TLPPrefix in the protocol before PCIE6.X, which is an optional part;
[0071] 3. For PCIe Trailer, the specific type and size are indicated by TS[2:0] of the first DW in the TLP Header Base. The Trailer size and meaning corresponding to the TS value are shown in Table 2 below:
[0072] Table 2
[0073]
[0074]
[0075] PCIe Trailer is similar to TLP Digiest in the protocol before PCIE6.X, and has been enhanced in the latest protocol, but it is still optional and its size ranges from 0 to 5DW.
[0076] According to the PCIE6.X protocol, for FM (Flit-Mode), the definition and calculation of the Header creditunit size (header field size) corresponding to the TLP Header is shown in Table 3 below:
[0077] Table 3
[0078]
[0079] For Switch (switch port receiver) and EP / RP (endpoint upstream port / root port receiver), the calculation rules of FC (Flow control) Header credit unit size (that is, TLP header field size) are consistent. Referring to the analysis of the size of each component in the previous article, the size of a Header credit unit size can be calculated as:
[0080] Header Credit Unit size = 1 largest Base hdr (TLP Header Base) (7DW) + OHC-A (1DW) + OHC-B (1DW) + OHC-C (1DW) + OHC-E (4DW) + 1 largest TLP tail (TLP Trailer) (5DW) = 7+1+1+1+4+5 = 19DW.
[0081] In the PCIe6.X protocol, the demand for the number of Header Credits at higher rates has increased exponentially, and the size of a Header Credit Unit has also increased to 19 DWs (PCIE5.0 and earlier protocols, without considering Local-prefix, only require a maximum of 9 DWs), more than doubling. In FM mode, this expansion and reservation of TLPs not only improves the protocol to absorb more features in the future, but also places higher demands on the storage resources of the device.
[0082] According to the previous analysis of the components of TLP Headerbase, we can see:
[0083] 1. The maximum size of a TLP Headerbase is 7DW, but TLPs of 5DW, 6DW, and 7DW are currently reserved.
[0084] 2. A total of 7DWs are reserved for each type of OHC, but for the optional messages of the OHC-E type, at least if OHC-E is not supported, OHC only needs to occupy 3DW of space.
[0085] 3. For TLP Trailer, if only ECRC is retained, only 1DW is needed. In most cases, 5DW is not needed.
[0086] Therefore, according to the different features supported, the required Header Credit Unit size is calculated as shown in Table 4:
[0087] Table 4
[0088]
[0089] In Table 4, in the first row, when TLP base hdr5 / 6 / 7 is not supported, the maximum space occupied by TLP base hdr is 3DW, and when OHC-E is not supported, the maximum space occupied by OHC is 4DW, and TLP Trailer does not support ECRC or IDE, so the space occupied is 0, so the size of Header Credit Unit in the first row can be 3+4=7. The second to fourth rows support different fields on this basis, so the space occupied by the supported fields can be added on this basis.
[0090] In the PCIe6.X protocol, the protocol recommends a Header Credit Unit to reserve Header credit buffer resources according to the worst case scenario. However, according to the above calculation, it is difficult to fully utilize the resources in actual situations. Even if only the reserved cases in the current protocol are excluded, the size of a Header credit unit can be reduced to 15DW. Compared with the recommended value of 19DW, there is still 21% room for resource optimization.
[0091] Because the protocol recommends reserving resources in the worst possible way, the initialization phase of Flow Control lacks a step for negotiating the Header Credit Size. Instead, it only negotiates the number of Credits. This leads to a serious waste of the Header Credit buffer.
[0092] Based on the original PCIE protocol, this application proposes a new flow control message format (FC DLLP) in Flit-Mode mode, and uses the message format to propose an optimized PCIE initialization flow control process. By executing this process, the latest devices supporting the PCIE6.X protocol do not need to reserve Header credit Buffer resources according to the worst case. By executing the new flow control negotiation process, both ends of the PCIE link can accurately know the characteristics supported by the other end that may affect the size of the Header Credit Buffer, and then flexibly allocate and calculate the number of credits on the local end according to the negotiation results, so as to achieve the optimization adjustment of the Header Credit Buffer resources on both sides.
[0093] See also Figure 4 As shown, the present application exemplarily proposes a method for initializing flow control, which is applied to the Flit-Mode mode of the local end of the PCIE data link, including:
[0094] In step S401, in response to entering the initialization phase of the data link layer, switching to a negotiation state;
[0095] In step S402, in the negotiation state, the reserved size corresponding to each header field of the TLP data packet is obtained;
[0096] In step S403, a first negotiation data packet is generated based on the reserved size corresponding to each header field;
[0097] In step S404, the first negotiation data packet is sent to the PCIE data link peer, so that the PCIE data link peer determines the initial credit quantity of the PCIE data link peer according to the reserved size of each header field carried in the first negotiation data packet.
[0098] For example, after the PCIe6.X protocol introduced the FM (Flit-Mode) mode, the DLLP message types were expanded from the original 46 to 181, and the 8-bit DLLP type encoding was still used. In order to confirm the size of the Header credit unit (that is, the size of the header field), a DLLP message type is added for the link parties to negotiate the characteristics that affect the size of the Header credit unit.
[0099] From the reserved code patterns of DLLP Type encoding, select 00111V2V1V0 (V2V1V0 indicates the virtual channel VC number) as the new custom FC DLLP message type initFC_hdr_size. The message format definition is shown in Table 5 below:
[0100] Table 5
[0101]
[0102] Among them, 1) Byte0 still represents the DLLP type; 2) Byte1 / 2 / 3 respectively represent the number of DWs occupied in the worst case in the Header base (header field base field), OCH-E (OCH-E type in the header field OHC field), and TLP Trailer (header field tail field) of the P / NP / CPL TLP message, and the format is the same. The new FC DLLP (for the convenience of description, it is also called a negotiation data packet in this application, the first negotiation data packet corresponds to the PCIE data link local end, and the second negotiation data packet corresponds to the PCIE data link opposite end) field segment and the corresponding reserved size are shown in Table 6 below:
[0103] Table 6
[0104]
[0105] Among them, bit[7:5] indicates the number of DWs reserved for Headerbase; bit[4:3] indicates the number of DWs reserved for OHC-E; bit[2:0] indicates the number of DWs reserved for TLP Trailer. The 16-bit CRC checksum included in the original FC DLLP message is no longer generated separately in Flit Mode, but is included in the Flit TLP for unified calculation.
[0106] In the Flit-Mode mode of the PCIe6.X protocol, the sending of DLLP in the DL_INIT phase (initialization phase of the data link layer) is optimized and improved.
[0107] For example, taking the local end of the PCIE data link as an example, Figure 5 The DL (Data Link) state machine jump optimization shown is as follows:
[0108] 1) Add a new state FC_INIT_HDR_SIZE (for the convenience of description, this application refers to it as a negotiation state). After the local end of the PCIE data link enters the DL_INIT phase (initialization phase of the data link layer), it first enters the negotiation state first, and sends the newly added FC DLLP initFC_hdr_size (the first negotiation data packet, which carries the reserved size corresponding to each header field of the TLP data packet) to the other end of the PCIE data link in the negotiation state to negotiate the size of the TLPheader credit unit (header field of the TLP data packet). Among them, the reserved size corresponding to each header field of the TLP data packet sends the maximum occupied DW quantity information of each header field supported by itself, such as Header base, OHC-E, and TLP_Trailer, to the other end of the PCIE data link through the first negotiation data packet. It should be noted that the local end of the PCIE data link can be the data receiver or the data sender. If the local end of the PCIE data link is the data receiver, the other end of the PCIE data link is the data sender. If the local end of the PCIE data link is the data sender, the other end of the PCIE data link is the data receiver.
[0109] 2) After receiving the first negotiation data packet, the other end of the PCIE data link calculates the size of the actually required Header credit unit according to the information carried in the first negotiation data packet, that is, the size of the entire header field of the TLP data packet. Then, based on the resources of the Header credit receiving buffer of this end, the maximum number of Header credits that it can support, that is, the initial credit number, is calculated. It is understandable that during the data transmission process, as the data is received and stored in the receiving data buffer, the initial credit number will change, and the change will be periodically sent to the other party in the subsequent process.
[0110] In some optional implementations, in the negotiation state, obtaining the reserved size corresponding to each header field of the TLP data packet includes:
[0111] Determine the first reserved size of the header field basic field of the TLP data packet based on whether the newly added message type of Flit-Mode in the TLP data packet is a reserved type;
[0112] Determine a second reserved size of the header OHC field of the TLP data packet based on whether the TLP data packet supports the OHC-E type;
[0113] Based on whether the header and tail fields of the TLP data packet support ECRC and IDE MAC, determine the third reserved size of the header and tail fields of the TLP data packet.
[0114] Exemplarily, as recorded above, the header size of the TLP data packet depends on three fields, namely, the header base field Header base, the header OHC field and the header tail field TLP Trailer, and the maximum occupied size of these three fields is as described above. The header base field Header base depends on whether the newly added message type in Flit-Mode is a reserved type, that is, if the newly added 1DW, 5DW, 6DW and 7DW of Flit-Mode are all marked as Reserved (reserved) type, it can be understood that the header base field only needs to retain the original part, that is, the maximum occupied size is 4DW, and if the newly added 1DW, 5DW, 6DW and 7DW of Flit-Mode are not all marked as Reserved (reserved) type, the maximum occupied size of the header base field can be determined as 5DW, 6DW or 7DW according to actual conditions.
[0115] Similarly, for the header OHC field, in Flit-mode, a total of 7DW is reserved for various types of OHC, but if OHC-E is not supported, OHC only needs to occupy 3DW of space, so the maximum size of the header OHC field can be determined to be 3DW or 7DW based on whether the OHC-E type is supported. For the header tail field, if only ECRC is retained, only 1DW is required, and if IDE MAC (integrated development environment) is also supported, 4DW is required. Therefore, the reserved size of the header tail field can be determined by determining whether ECRC is supported and whether IDE MAC is supported.
[0116] In some optional implementations, the method further includes:
[0117] Receive a second negotiation data packet sent by the PCIE data link peer; wherein the second negotiation data packet carries the reserved size of each header field of the TLP data packet of the PCIE data link peer;
[0118] Determine the initial credit quantity of the PCIE data link local end based on the reserved size of each header field of the TLP data packet of the PCIE data link opposite end in the second negotiation data packet, and switch to the initialization state of the initialization phase of the data link layer;
[0119] In the initialization state, flow control DLLPs corresponding to different types of TLP data packets are sent to the PCIE data link peer based on the initial credit quantity.
[0120] Exemplarily, after the PCIE data link local end enters the initialization phase of the data link layer, it switches to the negotiation state first and then sends a first negotiation data packet to the PCIE data link peer end; at the same time, the PCIE data link peer end, like the PCIE data link local end, also switches to the negotiation state first after entering the initialization phase of the data link layer and sends a second negotiation data packet to the PCIE data link local end. The first negotiation data packet is the same as the second negotiation data packet, except that the second negotiation data packet is sent by the PCIE data link peer end to the PCIE data link local end, and the second negotiation data packet carries the reserved size of each header field of the PCIE data link peer end.
[0121] Exemplarily, if the PCIE data link peer sends a second negotiation data packet to the PCIE data link local end and is received by the PCIE data link local end, the PCIE data link local end will calculate the space occupied by the header field of the TLP data packet of the PCIE data link peer end based on the reserved size of each header field field carried in the second negotiation data packet, that is, the header field size, so as to determine how much space the header field in the TLP data packet received from the PCIE data link peer end will occupy at most, and the space occupied by the data payload part of the TLP data packet other than the header field is fixed, so based on the maximum occupied size of the header field and the space size of the data payload, the maximum occupied space size of a TLP data packet can be determined, so that when the size of the received data buffer is known, the number of credits of the PCIE data link local end in the initial situation can be determined. The number of credits will be provided by the PCIE data link local end to the PCIE data link peer end, so that when the PCIE data link peer end sends data to the PCIE data link local end, flow control measures are taken based on the number of credits.
[0122] Exemplarily, after the PCIE data link local end receives the second negotiation data packet sent by the PCIE data link opposite end and completes the calculation of the initial credit quantity, it enters the initialization state FC INIT1 of the initialization phase of the data link layer. The initialization state FC INIT1 is a state specified by the protocol. In this state, the PCIE data link local end sends an initFC-P / NP / CPL DLLP message to the PCIE data link opposite end, that is, sends flow control DLLP corresponding to different types of TLP data packets to the PCIE data link opposite end, so as to inform the PCIE data link opposite end of the initial credit quantities corresponding to different types of TLP data packets.
[0123] In some optional implementations, the reserved size of each header field of the TLP data packet of the PCIE data link peer end in the second negotiation data packet includes: a first reserved size of the header field basic field, a second reserved size of the header field OHC field, and a third reserved size of the header field tail field; based on the reserved size of each header field of the TLP data packet of the PCIE data link peer end in the second negotiation data packet, determining the initial credit quantity of the PCIE data link local end includes:
[0124] Calculate the header field size of the TLP data packet at the opposite end of the PCIE data link based on the first reserved size of the header field base field, the second reserved size of the header field OHC field, and the third reserved size of the header field tail field of the TLP data packet at the opposite end of the PCIE data link;
[0125] The initial credit quantity is determined based on the header field size, other field sizes of the TLP data packet at the other end of the PCIE data link, and the receive data buffer size at the local end of the PCIE data link.
[0126] Exemplarily, the second negotiation data packet sent by the PCIE data link opposite end includes the first reserved size of the header field basic field, the second reserved size of the header field OHC field, and the third reserved size of the header field tail field, like the PCIE data link local end. And the PCIE data link local end calculates the header field size of the TLP data packet of the PCIE data link opposite end based on the above three reserved sizes in the second negotiation data packet. The TLP data packet of the PCIE data link opposite end is received by the PCIE data link local end and stored in the receive data cache, so it is necessary to calculate the initial credit quantity based on the header field size of the TLP data packet of the PCIE data link opposite end, the other field sizes of the TLP data packet, and the receive data cache size. The other field sizes of the TLP data packet may, for example, include the data size of the effective data payload, which is usually fixed.
[0127] In some optional implementations, the method further includes:
[0128] In the negotiation state, if a flow control DLLP is received from the PCIE data link peer in the initialization state of the initialization phase of the data link layer, the communication is directly switched to the initialization state of the initialization phase of the data link layer;
[0129] In the initialization state, flow control DLLPs corresponding to different types of TLP data packets are sent to the PCIE data link peer based on the default credit quantity.
[0130] Exemplarily, as described above, in order to flexibly allocate and calculate the number of credits on this end and optimize the adjustment of the received data cache resources between this end and the other end, the present application adds a new state, namely the negotiation state, after entering the initial stage of the data link layer, so that in this state, the local end sends a first negotiation data packet to the other end, and the other end also sends a second negotiation data packet to the local end. However, if the other end is still the original unimproved device and does not support the scheme provided by the present application, the PCIE data link local end will not be able to receive the second negotiation data packet sent by the other end in the negotiation state, but will directly receive the flow control DLLP of various TLP data packets sent by the PCIE data link other end in the initialization state of the initialization stage of the data link layer. In this case, the PCIE data link local end can determine that the other end is an original unimproved device and does not support the scheme provided by the present application. Therefore, it is necessary to follow the method specified in the protocol, no longer negotiate the header field size of the TLP data packet, and no longer need to recalculate the initial credit number, but directly use the default credit number. The default credit number is calculated according to the maximum occupied size 19DW in the header field size of the TLP data packet. Therefore, after the PCIE data link local end directly receives the flow control DLLP of various TLP data packets sent by the other end in the initialization state of the initialization phase of the data link layer, it switches to the initialization state under the initialization phase of the data link layer, and also sends flow control DLLP of various TLP data packets to the other end, and the credit numbers in these flow control DLLPs are determined based on the default credit number. It should be noted that after entering FC_INIT1, the process of the PCIE data link opposite end and the PCIE data link local end is consistent with the original PCIE6.X initialization process until entering the DL_Active state.
[0131] Combined with the previous analysis, for a device that supports PCIE6.X, if the Header Credit buffer reserves 128 credit resources in the worst case according to the protocol requirements, after the newly added FC_INIT_HDR_SIZE process negotiation adjustment, the change in the number of Credits is shown in Table 7 below:
[0132] Table 7
[0133]
[0134] It can be seen from the calculation in the table that after adding the FCINIT_HDR_SIZE state and related negotiation processes, for PCIE6.X devices, there is no need to reserve resources based on the worst case scenario. Instead, the number of Header Credits is accurately calculated based on the size of the Header Credit unit after negotiation and synchronization between the two parties of the PCIE link, combined with the size of the Header Credit buffer resources on the local side. This can save redundant cache space, increase the number of Header Credits by 126% to 271%, and achieve a more reasonable allocation of resources.
[0135] Accordingly, see Figure 6 As shown, the present application exemplarily proposes a flow control initialization device, which is applied to the Flit-Mode mode of the local end of the PCIE data link, including:
[0136] A response unit 601 is used to switch to a negotiation state in response to entering the initialization phase of the data link layer;
[0137] The acquisition unit 602 is used to acquire the reserved size corresponding to each header field of the TLP data packet in the negotiation state;
[0138] A generating unit 603 is configured to generate a first negotiation data packet based on a reserved size corresponding to each header field;
[0139] The first sending unit 604 is used to send the first negotiation data packet to the PCIE data link peer, so that the PCIE data link peer determines the initial credit quantity of the PCIE data link peer according to the reserved size of each header field carried in the first negotiation data packet.
[0140] In some optional implementations, the acquisition unit includes:
[0141] A first determining subunit, configured to determine a first reserved size of a header field basic field of a TLP data packet based on whether a newly added message type of Flit-Mode in the TLP data packet is a reserved type;
[0142] A second determining subunit, configured to determine a second reserved size of the header OHC field of the TLP data packet based on whether the TLP data packet supports the OHC-E type;
[0143] The third determining subunit is used to determine the third reserved size of the header and tail fields of the TLP data packet based on whether the header and tail fields of the TLP data packet support ECRC and IDE MAC.
[0144] In some optional implementations, the device further includes:
[0145] A receiving unit, configured to receive a second negotiation data packet sent by a PCIE data link peer; wherein the second negotiation data packet carries a reserved size of each header field of a TLP data packet of the PCIE data link peer;
[0146] A determination unit, configured to determine the initial credit quantity of the local end of the PCIE data link based on the reserved size of each header field of the TLP data packet of the other end of the PCIE data link in the second negotiation data packet, and switch to the initialization state of the initialization phase of the data link layer;
[0147] The second sending unit is used to send flow control DLLPs corresponding to different types of TLP data packets to the PCIE data link peer end based on the initial credit quantity in an initial state.
[0148] In some optional implementations, the reserved size of each header field of the TLP data packet of the PCIE data link peer in the second negotiation data packet includes: a first reserved size of the header field basic field, a second reserved size of the header field OHC field, and a third reserved size of the header field tail field; the determination unit includes:
[0149] A calculation subunit, configured to calculate a header field size of the TLP data packet at the opposite end of the PCIE data link based on a first reserved size of a header field base field, a second reserved size of a header field OHC field, and a third reserved size of a header field tail field of the TLP data packet at the opposite end of the PCIE data link;
[0150] The fourth determination subunit is used to determine the initial credit quantity based on the header field size, other field sizes of the TLP data packet at the other end of the PCIE data link and the receiving data buffer size at the local end of the PCIE data link.
[0151] In some optional implementations, the device further includes:
[0152] The switching unit is used to directly switch to the initialization state of the initialization phase of the data link layer if a flow control DLLP sent by the PCIE data link peer in the initialization state of the initialization phase of the data link layer is received in the negotiation state;
[0153] The third sending unit is used to send flow control DLLPs corresponding to different types of TLP data packets to the PCIE data link peer end based on the default credit quantity in an initialization state.
[0154] The above-mentioned device is used to implement the initialization method of flow control provided in the above-mentioned embodiment. For specific details, please refer to the description of the initialization method of flow control in the above-mentioned embodiment, which will not be repeated here.
[0155] It is understood that the circuit structures, names and parameters described in the above embodiments are only examples. Those skilled in the art can also easily combine and adjust 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.
[0156] 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 method for initializing flow control, characterized in that: The method is applied to the Flit-Mode mode of the local end of the PCIE data link, including: In response to entering the initialization phase of the data link layer, switching to a negotiation state; In the negotiation state, obtaining the reserved size corresponding to each header field of the TLP data packet; Generate a first negotiation data packet based on the reserved sizes corresponding to the header fields; The first negotiation data packet is sent to the PCIE data link peer end, so that the PCIE data link peer end determines the initial credit quantity of the PCIE data link peer end according to the reserved size of each header field carried in the first negotiation data packet.
2. The method for initializing flow control according to claim 1, characterized in that: In the negotiation state, obtaining the reserved size corresponding to each header field of the TLP data packet includes: Determine the first reserved size of the header field basic field of the TLP data packet based on whether the newly added message type of Flit-Mode in the TLP data packet is a reserved type; Determine a second reserved size of the header OHC field of the TLP data packet based on whether the TLP data packet supports the OHC-E type; Based on whether the header and tail fields of the TLP data packet support ECRC and IDE MAC, determine the third reserved size of the header and tail fields of the TLP data packet.
3. The method for initializing flow control according to claim 1 or 2, characterized in that: The method further comprises: Receive a second negotiation data packet sent by the PCIE data link peer; wherein the second negotiation data packet carries the reserved size of each header field of the TLP data packet of the PCIE data link peer; Based on the reserved size of each header field of the TLP data packet of the PCIE data link counterpart in the second negotiation data packet, determine the initial credit quantity of the PCIE data link local end, and switch to the initialization state of the initialization phase of the data link layer; in the initialization state, send flow control DLLPs corresponding to different types of TLP data packets to the PCIE data link counterpart based on the initial credit quantity.
4. The method for initializing flow control according to claim 3, characterized in that: The reserved size of each header field of the TLP data packet of the PCIE data link peer end in the second negotiation data packet includes: a first reserved size of a header field basic field, a second reserved size of a header field OHC field, and a third reserved size of a header field tail field; the determining the initial credit quantity of the PCIE data link local end based on the reserved size of each header field of the TLP data packet of the PCIE data link peer end in the second negotiation data packet includes: Calculate the header field size of the TLP data packet at the opposite end of the PCIE data link based on the first reserved size of the header field base field, the second reserved size of the header field OHC field, and the third reserved size of the header field tail field of the TLP data packet at the opposite end of the PCIE data link; The initial credit quantity is determined based on the header field size, other field sizes of the TLP data packet at the opposite end of the PCIE data link and the receive data buffer size at the local end of the PCIE data link.
5. The method for initializing flow control according to any one of claims 1, 2 and 4, characterized in that: The method further comprises: In the negotiation state, if a flow control DLLP sent by the PCIE data link peer in the initialization state of the initialization phase of the data link layer is received, directly switching to the initialization state of the initialization phase of the data link layer; In the initialization state, flow control DLLPs corresponding to different types of TLP data packets are sent to the PCIE data link peer based on a default credit quantity.
6. A flow control initialization device, characterized in that: The device is applied in the Flit-Mode mode of the local end of the PCIE data link, including: A response unit, configured to switch to a negotiation state in response to entering an initialization phase of a data link layer; An acquiring unit, configured to acquire, in the negotiation state, a reserved size corresponding to each header field of a TLP data packet; A generating unit, configured to generate a first negotiation data packet based on the reserved sizes corresponding to the header fields; The first sending unit is used to send the first negotiation data packet to the PCIE data link peer, so that the PCIE data link peer determines the initial credit quantity of the PCIE data link peer according to the reserved size of each header field carried in the first negotiation data packet.
7. The flow control initialization device according to claim 6, characterized in that: The acquisition unit comprises: A first determining subunit, configured to determine a first reserved size of a header field basic field of a TLP data packet based on whether a newly added message type of Flit-Mode in the TLP data packet is a reserved type; A second determining subunit, configured to determine a second reserved size of the header OHC field of the TLP data packet based on whether the TLP data packet supports the OHC-E type; The third determining subunit is used to determine the third reserved size of the header and tail fields of the TLP data packet based on whether the header and tail fields of the TLP data packet support ECRC and IDE MAC.
8. The flow control initialization device according to claim 6 or 7, characterized in that: The device also includes: A receiving unit, configured to receive a second negotiation data packet sent by the PCIE data link peer; wherein the second negotiation data packet carries the reserved size of each header field of the TLP data packet of the PCIE data link peer; A determining unit, configured to determine the initial credit quantity of the PCIE data link local end based on the reserved size of each header field of the TLP data packet of the PCIE data link opposite end in the second negotiation data packet, and switch to the initialization state of the initialization phase of the data link layer; The second sending unit is used to send flow control DLLPs corresponding to different types of TLP data packets to the PCIE data link peer end based on the initial credit quantity in the initial state.
9. The flow control initialization device according to claim 8, characterized in that: The reserved size of each header field of the TLP data packet of the PCIE data link peer in the second negotiation data packet includes: a first reserved size of a header field basic field, a second reserved size of a header field OHC field, and a third reserved size of a header field tail field; the determining unit includes: A calculation subunit, configured to calculate the header field size of the TLP data packet at the opposite end of the PCIE data link based on a first reserved size of a header field base field, a second reserved size of a header field OHC field, and a third reserved size of a header field tail field of the TLP data packet at the opposite end of the PCIE data link; The fourth determining subunit is used to determine the initial credit quantity based on the header field size, other field sizes of the TLP data packet at the opposite end of the PCIE data link and the receiving data buffer size at the local end of the PCIE data link.
10. The flow control initialization device according to any one of claims 6, 7 and 9, characterized in that: The device also includes: A switching unit, configured to directly switch to the initialization state of the initialization phase of the data link layer in the negotiation state if a flow control DLLP sent by the PCIE data link peer in the initialization state of the initialization phase of the data link layer is received; The third sending unit is used to send flow control DLLPs corresponding to different types of TLP data packets to the PCIE data link peer end based on a default credit quantity in the initialization state.
Citation Information
Patent Citations
Processing layer data packet generation method and apparatus, and PCI Express system
CN105608029A
Flow control credit updates for virtual channels in the advanced switching (as) architecture
CN1783839A
Credit Management When Resource Granularity is Larger than Credit Granularity
US20100165842A1
Scaled PCI express credits
US20170052924A1
Peripheral component interconnect express (PCIE) pseudo-virtual channels and non-blocking writes
US9483424B1
Cited By
Flow control initialization method and apparatus
WO2026138743A1