R 6.2 : Processing a Nak (TLP Replay): How the PCIe Transmitter Rescues Data

In the PCI Express (PCIe) Data Link Layer, the Negative Acknowledge (Nak) Data Link Layer Packet (DLLP) acts as a critical distress signal. When a receiver encounters a corrupted packet or a sequence number violation, it drops the bad packet and fires off a Nak to demand a rescue operation.

When this Nak arrives back at the transmitting device, it triggers an immediate, hardware-based sequence of events to rescue the lost data. Here is the step-by-step process of what happens inside the transmitter during a TLP Replay.

Step 1: The Silver Lining (Purging Older TLPs)

Even though a Nak is a report of an error, it actually carries positive news as well. The sequence number stamped inside a Nak always indicates the sequence number of the last good packet successfully received.

Before the transmitter attempts to fix the error, it first uses this sequence number to clean house. The transmitter purges from its Replay Buffer all Transaction Layer Packets (TLPs) with sequence numbers equal to or earlier than the number in the Nak. Because PCIe enforces strict sequential ordering, the transmitter knows these purged packets arrived perfectly. If this purge clears out at least one packet, the transmitter recognizes that forward progress was made, updates its internal ACKD_SEQ register, and resets its watchdog timers.

Step 2: Blocking New Traffic

Once the successful TLPs are cleared out, the transmitter must prepare to fix the remaining pipeline. To do this efficiently, the transmitter temporarily blocks the acceptance of any new TLPs from the Transaction Layer. Halting new inbound traffic ensures the transmitter can focus entirely on clearing the error without the Replay Buffer overflowing.

Step 3: Executing the Replay

With the pipeline paused and the successful packets purged, everything left in the Replay Buffer represents data that was either dropped, corrupted, or ignored by the receiver.

The transmitter now begins the actual Replay event. It re-transmits every single TLP remaining in the Replay Buffer, sending them across the link in the exact same order they were originally queued (like a FIFO). For example, if the receiver sent a Nak with sequence number 9, the transmitter will have purged packet 9 and everything before it, and will immediately begin replaying the buffer starting with packet 10.

Step 4: Updating the Watchdogs

As the replay begins, the transmitter must update its internal tracking counters to monitor this new rescue attempt:

  • The REPLAY_NUM Counter: This counter increments by one to officially log that a replay attempt has occurred. If this counter eventually rolls over from 3 back to 0, the Link Layer will assume the physical link is severely broken and force a complete retraining of the link.
  • The REPLAY_TIMER: The transmitter resets and restarts this countdown clock as the replayed packets are transmitted, ensuring it doesn’t wait indefinitely for a response to the newly replayed data.

Step 5: Unblocking the Pipeline

Once the transmitter successfully finishes re-transmitting the last packet currently sitting in the Replay Buffer, the Replay event is officially over. The Data Link Layer immediately unblocks the connection to the Transaction Layer, allowing new TLPs to flow into the transmitter once again. The replayed TLPs safely remain in the Replay Buffer until the receiver eventually returns an Ack to confirm they survived the second attempt.

Summary Processing a Nak requires swift, coordinated action. By systematically purging successful data, temporarily halting new traffic, and re-transmitting the remaining buffer in order, the PCIe Data Link Layer ensures that transient link errors are resolved instantly without sacrificing the integrity of the data stream.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top