When a Transaction Layer Packet (TLP) completes its journey across the physical link and arrives at the receiving device’s Data Link Layer, it doesn’t just get a free pass to the Transaction Layer. To guarantee the PCIe required Bit Error Rate (BER) of 10−12, the receiver acts as a strict gatekeeper, putting every incoming TLP through a rigid two-step inspection process.
Here is a walk-through of exactly how a receiver evaluates the LCRC and Sequence Number to ensure perfect data integrity.
Step 1: The 32-Bit LCRC Check (Catching Bit Errors)
The very first thing the Link Layer evaluates is the 32-bit Link Cyclic Redundancy Code (LCRC).
When the packet arrives, the receiver independently calculates what the LCRC should be based on the actual bits it just received (excluding the attached LCRC field itself). It then compares its calculated value directly against the 32-bit LCRC physically attached to the end of the incoming packet.
- If they match: The receiver knows that all the bits in the packet arrived exactly as they were transmitted.
- If they do not match: The receiver instantly knows a bit error occurred in transit. The corrupted TLP is immediately discarded, and the receiver schedules a “Nak” (Negative Acknowledge) DLLP to force the transmitter to replay the packet.
Step 2: The Sequence Number Check (Catching Lost Packets)
If the TLP successfully passes the LCRC check, the receiver must then verify that the packet arrived in the correct order.
To manage this, the receiver utilizes an internal 12-bit counter known as the NEXT_RCV_SEQ (NRS) counter. This counter strictly tracks the exact Sequence Number the receiver expects to see next.
The receiver compares the TLP’s embedded Sequence Number against its expected NRS count, resulting in one of three possible outcomes:
Outcome 1: A Perfect Match (In-Sequence) If the incoming Sequence Number equals the expected NRS count, everything is flowing flawlessly. The receiver accepts the good TLP, forwards it up to the Transaction Layer, and increments its expected NRS count by one. An Ack is then scheduled to eventually notify the transmitter of the success.
Outcome 2: An Earlier Number (The Duplicate TLP) If the incoming Sequence Number is logically smaller (earlier) than the expected value, the receiver knows the transmitter decided to re-send a packet it has actually already processed. This is considered a harmless duplicate and is not an error. The receiver silently drops the redundant packet and sends an Ack carrying the sequence number of the last good TLP it received (NRS – 1) to remind the transmitter of its furthest progress.
Outcome 3: A Later Number (The Lost TLP) If the incoming Sequence Number is logically larger (later) than the expected value (for example, the receiver is expecting packet 30, but packet 31 arrives), the receiver immediately knows a previous TLP was lost in transit. Because PCIe architecture requires that all TLPs be accepted in strict sequential order, the receiver discards this out-of-sequence packet, regardless of the fact that its LCRC was perfect. It then schedules a Nak to demand a replay starting from the missing data.
Summary By forcing every packet to survive a rigorous 32-bit mathematical check followed by a strict sequential ordering validation, the Data Link Layer creates an airtight safety net. This two-step process ensures that neither corrupted bits nor missing packets will ever make their way into your system’s Transaction Layer.
