PCI Express - Data Link Layer

This blog provides information/ideas about PCI Express Data Link Layer.

We changed!Check out our new look!

Monday, August 18, 2008

RETRIES

The transmitter cannot assume that a transaction has been properly re­ceived until it gets a proper acknowledgement back from the receiver. If the receiver sends back a Nak (for something like a had sequence num­ber or LCRC), or fails to send back an Ack in an appropriate amount of time, the transmitter needs to retry all unacknowledged TLPs. To accom­plish this, the transmitter implements a Data Link Layer retry buffer.


All copies of transmitted TLPs must be stored in the Data Link Layer retry buffer. Once the transmitter receives an appropriate acknowledge­ment back, it purges the appropriate TLPs from its retry buffer. It also updates its acknowledgement sequence number counter.


TLPs may be retried for two reasons,

First, it is retried if the receiver sends back a Nak DLLP indicating some sort of transmission error.

The second reason for a retry deals with a replay timer, which helps ensure that forward progress is being made. The transmitter side of the Data Link Layer needs to implement a replay timer that counts the time since the last Ack or Nak DLLP was received. This timer runs anytime there is an outstanding TLP and is reset every time an Ack or Nak DLLP is received. When no TLPs are outstanding, the timer should reset and hold so that it does not unnecessarily cause a time-out. The replay timer limit depends upon the link width and maximum payload size. The larger the maximum payload size and the narrower the link width, the longer the replay timer can run before timing out (since each packet requires more time to transmit). If the replay timer times out, the Data Link Layer reports an error condition.


If either of these events occurs-either a Nak reception or a replay timer expiration-the transmitter's Data Link Layer begins a retry. The Data Link Layer increments a replay number counter. This is a 2-hit
counter that keeps track of the number of times the retry buffer has been retransmitted. If the replay counter rolls over from 1 lb to 00b (that is, this is the fourth retry attempt) the Data Link Layer indicates an error condition that requires the Physical Layer to retrain the link. The Data Link Layer resets its replay counter every time it successfully receives an acknowledgement, so the retrain procedure only occurs if are try attempt continuously fails. In other words, four unsuccessful attempt s at a single retry create this error. Four unsuccessful retry attempts across numerous packets with numerous intermediate acknowledgements do not.

Link CRC(LCRC)

The Data Link Layer protects the contents of the TLP by using a 32-bit LCRC value. The Data Link Layer calculates the LCRC value based on the TLP received from the Transaction Layer and the sequence number it has just applied. The LCRC calculation utilizes each bit in the packet, includ­ing the reserved bits (such as bits 7:4 of byte 0).

On the receiver side, the first step that the Data Link Layer takes is to check the LCRC value. It does this by applying the same LCRC algorithm to the received TLP (not including the attached 32-bit LCRC). If a single or multiple-bit error occurs during transmission, the calculated LCRC value should not match the received LCRC value. If the calculated LCRC value does not equal the received value, the TLP is discarded and a Nak DLLP is scheduled for transmission. If the calculated value equals the re­ceived value, the Data Link Layer then proceeds to check the sequence number.

Like sequence numbers, the LCRC protects the contents of a TLP on a link-by-link basis. If a TLP travels across several links (for example, passes through a switch on its way to the root complex), an LCRC value is generated and checked for each link. In this way, it is different than the ECRC value that may be generated for a TLP. The ECRC serves to protect the TLP contents from one end of the PCI Express topology to the other end, while the LCRC only ensures TLP reliability for a give link. The 32-bit LCRC value for TLPs is also differentiated from the 16-bit CRC value that is used for DLLP packets.

Sequence Number

The Data Link Layer assigns a 12-bit sequence number to each TLP as it is passed from the transmit side of its Transaction Layer. The Data Link Laver applies the sequence number, along with a 4-bit reserved field to the front of the TLP. Refer to Figure for the sequence number format. To accomplish this, the transmit side of this layer needs to implement two simple counters, one indicating what the next transmit sequence number should be, and one indicating the most recently acknowledged sequence number. When a sequence number is applied to an outgoing TLP. the Data Link Layer refers to its next sequence counter for the ap­propriate value. Once that sequence number is applied, the Data Link Layer increments its next sequence counter by one.

On the receiver side, the Data Link Layer receives incoming TLPs from the Physical Layer, then checks the sequence number and LCRC. If they check out properly, the TLP is passed on to the Transaction Layer. If the sequence number (or LCRC) is incorrect, the Data Link Layer requests a retry. To accomplish this, the receive side of this layer needs to implement a counter for the next receiver sequence number, which in­dicates the next expected sequence number. If the sequence number of the received TLP matches that counter (and the LCRC checks), the Data Link Layer then removes the sequence number, associated reserved bits, and the LCRC. Once the layer removes that data, it forwards the incom­ing TLP on to the receive side of the Transaction Layer. When this oc­curs, the Data Link Layer increments its next receiver sequence counter.

If the sequence number does not match the value stored in the re­ceiver's next sequence counter, that Data Link Layer discards that TLP. The Data Link Layer checks to see if the TLP is a duplicate. If it is, it schedules an acknowledgement (Ack) DLLP to be sent out for that packet. If the TLP is not a duplicate, it schedules a negative acknowl­edgement (Nak) DLLP to report a missing TLP. Then "Retry" process takes place.


The Data Link Layer does not differentiate among types of TLP when assigning the sequence number. Transactions destined to I/O space do
not have a different set of sequence numbers than memory transactions. Nor are sequence numbers dependent on the ultimate completer of the transaction. The Data Link Layer of the transmitting device is the sole de­terminant of the sequence number assigned to a TLP.

DISCLAMIER

Verilog Course Team does not warrant or assume any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed. No warranty of any kind, implied, expressed or statutory, including to fitness for a particular purpose and freedom from computer virus, is given with respect to the contents of this blog or its hyper links to other Internet resources. Reference in this blog to any specific commercial products, processes, or services, or the use of any trade, firm or corporation name is for the information, and does not constitute endorsement, recommendation, or favoring.