ACK/NAK Protocol Summary
Refer to Figure 5-3 on page 212 and the following subsections for a summary of the elements of the Data Link Layer.
Transmitter Side
Non-Error Case (ACK DLLP Management)
Unless blocked by the Data Link Layer, the Transaction Layer passes down the Header, Data, and Digest information for each TLP to be sent. Each TLP is assigned a 12-bit Sequence Number using current NEXT_TRANSMIT_SEQ count. A check is made to see if the acceptance of new TLPs from the Transaction Layer should be blocked. The transmitter performs a modulo 4096 subtraction of the ACKD_SEQ count from the NEXT_TRANSMIT_SEQ count to see if the result is >= 2048d. If it is, further TLPs are blocked until incoming ACK/NAK DLLPs render the equation untrue. The NEXT_TRANSMIT_SEQ counter increments by one for each TLP processed. Note: if the transmitter wants to nullify a TLP being sent, it sends an inverted CRC to the physical layer and indicates an EDB end (End Bad Packet) symbol should be used (NEXT_TRANSMIT_SEQ is not incremented). See the "Switch Cut-Through Mode" on page 248 for details. A 32-bit LCRC value is calculated for the TLP (the LCRC calculation includes the Sequence Number). A copy of the TLP is placed in the Replay Buffer and the TLP is forwarded to the Physical Layer for transmission. The Physical Layer adds STP and END framing symbols, then transmits the packet. At a later time, assume the transmitter receives an ACK DLLP from the receiver. It performs a CRC error check and, if the check fails, discards the ACK DLLP (the same holds true if a bad NAK DLLP is received). If the check is OK, it purges the Replay buffer of TLPs from the oldest TLP up to and including the TLP with Sequence Number that matches the Sequence Number in the ACK DLLP.
Error Case (NAK DLLP Management)
Repeat the process described in the previous section, but this time, assume that the transmitter receives a NAK DLLP:
Receiver Side
Non-Error Case
TLPs are received at the Physical Layer where they are checked for framing errors and other receiver-related errors. Assume that there are no errors. If the Physical Layer reports the end symbol was EDB and the CRC value was inverted, this is not an error condition; discard the packet and free any allocated space (see "Switch Cut-Through Mode" on page 248). There will be no ACK or NAK DLLP returned for this case.
The sequence of steps performed are as follows:
Calculate the CRC for the incoming TLP and check it against the LCRC provided with the packet. If the CRC passes, go to the next step. Compare the Sequence Number for the inbound packet against the current value in the NEXT_RCV_SEQ count. If they are the same, this is the next expected TLP. Forward the TLP to the Transaction Layer. Also increment the NEXT_RCV_SEQ count. Clear the NAK_SCHEDULED flag if set. If the ACKNAK_LATENCY_TIMER expires, schedule and ACK DLLP with AckNak_Seq_Num[11:0] = NEXT_RCV_SEQ count - 1.
Error Case
TLPs are received at the Physical Layer where they are checked for framing errors and other receiver-related errors. In the event of an error, the Physical Layer discards the packet, reports the error, and frees any storage allocated for the TLP. If the EDB is set and the CRC is not inverted, this is a bad packet: discard the TLP and set the error flag. If the NAK_SCHEDULED flag is clear, set it, and schedule a NAK DLLP with the NEXT_RCV_SEQ count - 1 value used as the Sequence Number.
If there are no Physical Layer errors detected, forward the TLP to the Data Link Layer. Calculate the CRC for the incoming TLP and check it against the LCRC provided with the packet. If the CRC fails, set the NAK_SCHEDULED flag. Schedule a NAK DLLP with NEXT_RCV_SEQ count - 1 used as the Sequence Number. If LCRC error check passes, go to the next bullet. If the LCRC check passes, then compare the Sequence Number for the inbound packet against the current value in the NEXT_RCV_SEQ count. If the TLP Sequence Number is not equal to NEXT_RCV_SEQ count and if (NEXT_RCV_SEQ - TLP Sequence Number) mod 4096 <= 2048, the TLP is a duplicate TLP. Discard the TLP, and schedule an ACK with NEXT_RCV_SEQ count - 1 value used as AckNak_Seq_Num[11:0]. Discard TLPs received with Sequence Number other than the Sequence Number described by the above bullet. If the NAK_SCHEDULED flag is clear, set it, and schedule a NAK DLLP with NEXT_RCV_SEQ count - 1 used as AckNak_Seq_Num[11:0]. If the NAK _SCHEDULED flag bit is already set, keep it set and do not schedule a NAK DLLP.
 |