PCIe literacy --Ack / Nak mechanism to explain (a)

Address reprint: http://blog.chinaaet.com/justlxy/p/5100053468

In front of the entry of the data link layer of the article briefly mentioned principles and the role of Ack / Nak mechanism, will Ack / Nak mechanisms are described in detail in the next two articles.

Ack / Nak is implemented by a hardware, fully automatic mechanism designed to ensure the effective and reliable transmission of TLP. Ack DLLP used to confirm TLP was successfully received, Nak DLLP is used to indicate the TLP transmission encountered an error.

blob.png

As shown, the sender will have to do a backup of each TLP in the Replay Buffer in the above chart, until it receives Ack DLLP from the receiver, confirm that the DLP has successfully been accepted, will delete the backup. If the receiver finds the TLP errors, it is sent to the transmission Nak DLLP issued, then the sender will retrieve data from the Replay Buffer, re-transmits the TLP.

Detailed structure of the inside of the Ack / Nak mechanism as shown below:

blob.png

Hereinafter Elements in the figures are, respectively, to make a simple introduction.

The first is the sender of Elements:

To a big close-up map:

blob.png

·        NEXT_TRANSMIT_SEQ Counter

NEXT_TRANSMIT_SEQ Counter, i.e. NTS counter is a 12-bit counter. When the data link layer in the DL-Down state or reset, the counter is initialized to zero. The counter will increment operations performed, i.e. when it reaches the maximum value 4095, an operation will be performed plus becomes 0 (Roll Over). The TLP counter for generating a sequence number (Sequence Number) to be transmitted next. Each with a serial number is unique to the TLP, we can say it is the key to the Ack / Nak mechanism of the serial number.

·        LCRC Generator

LCRC generator for generating a 32-bit CRC value, which is applied to the entire TLP and its corresponding sequence number.

·        Replay Buffer

Replay Buffer is a popular name Mindshare book, in PCIe Spec, this name is called Buffer Retry Buffer. Replay Buffer in accordance with the order of transmission, the TLP is stored whole, the serial number and the LCRC, as shown below:

blob.png

When the sender receives Ack DLLP from the receiving end, the TLP will corresponding Buffer (including the corresponding sequence number and the LCRC) removed; if the received Nak DLLP, will be the response of the TLP Buffer (including the corresponding serial number and the LCRC) re-sent to the receiver.

·        REPLAY_TIMER Count

REPLAY_TIMER is a watchdog timer, when the timer expires, it indicates that the transmitting end has transmitted one or more of the TLP, but did not receive a response signal from the receiving terminal (Ack / Nak). At this time, the transmit end of the TLP Replay Buffer will resend, and restarting the watchdog timer.

As long as the sender sends any TLP, the timer will start, will continue to run before receiving a response signal from the receiving end. After receiving the response signal, the timer will be cleared immediately. At this point if there is still Replay Buffer TLP (TLP show that there is to be sent, but not answered), the timer will be restarted immediately. If the Buffer is empty, the timer will not be restarted until the new TLP is sent.

·        REPLAY_NUM Count

This is a 2-bit counter for recording the same number of failed transmission TLP, when its value changes from 11b 00b (overflow, indicates the failed attempt to send a TLP 4), the data link layer is automatically forcedly re link training physical layer (i.e., into the Recovery state LTSSM). After completion of link training, it will be sent before resending failed TLP.

When the sender receives the Nak DLLP from the receiving end or transmitting end of the watchdog timer (REPLAY_TIMER) overflows, the counter will be incremented; Upon receiving the Ack DLLP, the counter will be cleared.

·        ACKD_SEQ Register

ACKD_SEQ register for storing a sequence number most recently received the Ack or Nak DLLP. When the reset or the data link layer in the inactive state, the registers are initialized to all. Specific usage of registers ACKD_SEQ subsequent article will be described in detail by way of example.

·        DLLP CRC Check

After receiving the receiving end DLLP from the sender, first check its DLLP CRC, if there are errors, it will directly discarded that in fact invalid DLLP.

Then the receiving end of Elements:

First, to a large map close-up:

blob.png

·        LCRC Error Check

As the name suggests, LCRC Error Check for checking whether the received TLP errors. If there are errors, then discards the corresponding TLP, and then generates a Nak DLLP is sent to the transmitting side resends the TLP allowed.

·        NEXT_RCV_SEQ Counter

NEXT_RCV_SEQ is a 12-bit counter, i.e. Next Receive Sequence Number, the value of which TLP sequence number plus 1 has been successfully received. TLP is mainly used to check the currently received is not to be received TLP.

If the current sequence number value and NEXT_RCV_SEQ received TLP are equal, this is considered a valid TLP, but the receiving side does not immediately transmit Ack DLLP to the sender, but only until AckNak_LATENCY_TIMER overflow to the transmitting end Ack DLLP. That is, a plurality of Ack DLLP TLP might correspond, for each receiving end does not receive a successful sender sends the TLP Bianxiang Ack DLLP.

If the currently received sequence number is less than the TLP NEXT_RCV_SEQ (and the difference does not exceed 2048), it is considered that the TLP has been sent previously passed, the transmission is repeated. Note that, PCIe Spec that an error is not repeated transmission, the TLP simply discarded directly, no Nak or Error Reporting, but will return a sequence number with TLP (NRS-1) of the last successfully received Ack DLLP to the sender.

If the currently received sequence number is greater than the TLP NEXT_RCV_SEQ, show some missing during transmission TLP. In this case, the receiving end will return Nak DLLP, and discards the TLP.

A simple example is shown below:

blob.png

·        NAK_SCHEDULED Flag

NAK_SCHEDULED is a flag when the receiving side is generated Nak DLLP, the flag will be set. When the receiving end successfully receives a valid TLP, the flag will be cleared. Special attention is required when the flag is in the set state, the receiver should not have other Nak DLLP.

·        AckNak_LATENCY_TIMER

AckNak_LATENCY_TIMER timer at the receiving end successfully receives a valid TLP, and did not return before running Ack DLLP to the sender. When the timer overflows AckNak_LATENCY_TIMER, the receiving side immediately returns Ack to the transmitting end the DLLP (SEQ ID NO is carried NRS-1, i.e., corresponding to a plurality of valid Ack TLP). Whether the receiving end returns Ack or Nak, the timer will be reset, but only when the receiver receives a valid TLP again, the timer will be restarted.

The value of this timer (REPLAY_TIMER) and Lane is the number specified by the relevant Max_Payload PCIe Spec, Gen1 values ​​as shown below:

blob.png

Gen2 (5GT / s) as shown below:

blob.png

Note: The value of this timer (REPLAY_TIMER) is three times AckNak_LATENCY_TIMER timer value.

· Ack / Nak Generator

Obviously, Ack / Nak Generator function is generated Ack or Nak DLLP. The format is as follows:

blob.png

blob.png

Finally, tell us about PCIe Spec package recommended in priority order. We know that, in the PCIe bus communication, there are many types of packets, including TLP, DLLP Ordered Sets, and the like. In order to be able to achieve optimal transmission efficiency of the bus, PCIe Spec recommend doing these on priority packets following settings :( course this is only recommended, not mandatory and manufacturers have to go to achieve this)

Completion of the any or the TLP 1. Currently in the DLLP Progress (Highest priority)
2. the Ordered the Set
3. Nak
4. the Ack
5. The Flow Control
6. The Re-Replay Buffer Transmissions
7. The Waiting TLPs that are in the Transaction Layer The
8. The All OTHER DLLP transmissions (lowest priority) 
Note: here that the QoS priority and said the priority is different, do not be confused.

Guess you like

Origin blog.csdn.net/kunkliu/article/details/94431596