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.

Building on the TLP

The TLP transmission path through the Data Link Layer prepares the packet for reliable transmission across the link. The Data Link Layer adds the sequence number and LCRC code before passing it along to its Physi­cal Layer. It does not process or modify the contents of the TLP-the Data Link Layer simply appends information to the beginning and end of the packet, as seen in below Figure,

Data Link Layer -Overview

This blog describes the details of the middle PCI Express architec­tural layer, the Data Link Layer. The Data Link Layer's main responsible is "error detection and correction as well as link management support".

The Data Link Layer serves as the "gatekeeper" for each individual link within a PCI Express system. It ensures that the data being sent back and forth across the link is correct and received in the same order it was sent. The Data Link Layer makes sure that each packet makes it across the link, and makes it across intact. This layer takes TLPs from the transmit side of the Transaction Layer and continues the process of building them into a PCI Express transaction.

The Data Link Layer adds a sequence number to the front of the packet and an LCRC error checker to the tail. Once the transmit side of the Data Link Layer has applied these to the TLP, the Data link layer forwards it on to the Physical Layer. Like the Transaction the Data Link Layer has unique duties for duties for both outgoing packets and incoming packets.

For incoming TLPs, the Data Link Layer accepts the from the Physical Layer and checks the sequence number and LCRC make sure the TLP is correct. If it is correct, the Data Link Layer the sequence number and LCRC, then passes the TLP up to the side of the Transaction Layer. If an error is detected (either wrong sequence number or LCRC does not match), the Data Link Layer does not pass the "bad" packet on to the Transaction Layer. Instead, the Data Layer communicates with its link mate to try and resolve the through a retry attempt.

The Data Link Layer only passes a TLP through to the Transaction Layer if the packet's sequence number and LCRC values check out. It is important to note this because this "gate-keeping' lows the Transaction Layer to assume that everything it receives from link is correct. Below figure gives the clear idea, the Data Link Layer forwards outgoing transactions from the Transaction Layer to the Physical Layer, and coming transactions from the Physical Layer to the Transaction Layer.

In order to accomplish several link management functions, the Data Link Layer generates and processes Data Link Layer Packets (DLLPs). The Data Link Layer uses these packets for error notification, power man­agement, flow control, and so on.

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.