本文将mark下PCIe flow control机制的相关notes。

The receiver of each port reports the size of its Flow Control buffers in units called credits.
在一条链路的两端设备分别向对方通知其自己可以使用的缓冲区大小或数量。这里通知的空间大小就是信用(credit)。

A定期的告诉B,我这里还有地方,来吧,来吧~。B因此知道A是有空余空间接收的。同样,B也是采用同样的方式告知A。流控信用会定期在两者间发送,这叫做更新流控信用(Update FC)。

The data link layer has a Flow Control (FC) mechanism, which makes sure that a TLP is transmitted only when the link partner has enough buffer space to accept it.

The Flow Control mechanism uses a credit‐based mechanism that allows the transmitting port to be aware of buffer space available at the receiving port. As part of its initialization, each receiver reports the size of its buffers to the transmitter on the other end of the Link, and then during run‐time it regularly updates the number of credits available using Flow Control DLLPs. Technically, of course, DLLPs are overhead because they don’t convey any data payload, but they are kept small to minimize their impact on performance.


参考资料:

  1. PCI Express Technology(Mike Jackson, Ravi Budruk)
  2. Down to the TLP: How PCI express devices talk (Part II)
  3. PCI Express Basics Background
  4. Credit timeout & Completion timeout