Comments and questions related to the "Down to the TLP" pages


Postby Guest » Fri Feb 19, 2016 2:26 pm

Can you please explain the following. That is how a write request can happen before a read request?
Are these checked for different addresses. If yes, then why a read cant happen before a write?


• A read request will never arrive before a write request or MSI sent before it. As a matter of fact, performing a Read Request is a safe way to wait for a write to complete.
• Write requests may very well come before read requests sent before them. This mechanism prevents deadlock in certain exotic scenarios. Don’t write to a certain memory area while waiting for the read completion to come in.

Best Regards

Re: reordering

Postby support » Fri Feb 19, 2016 2:52 pm


The PCIe spec defines certain rules, that allow and disallow the packet switching network (including the endpoints' internal logic) to swap the order of any two TLPs, depending on their attributes. These rules don't depend on the addresses of the packets.

Such swapping can occur for any reason, but swapping is often mentioned in context with a low credit situation. For example, suppose that the TLP transmitter queues one read request and then one write request. But alas, the credit level at the moment for non-posted packets doesn't allow sending the read request. On the other hand, it has enough credits for posted packets, so it can send the write request.

The reordering rules allow the transmitter to transmit the write request before the read request, even though they were queued in the opposite order. The alternative would have been to wait for the non-posted credit to get high enough to send the read request, and holding the transmission line idle. That's a waste of channel bandwidth.

Therefore, if you issue a read request to a certain address, and then a write request to the same address, the answer to the read request may be the value in the write request, and not what was there before. This is the point to pay attention to.

As for the opposite situation, a write followed by a read, the reordering rules don't allow swapping. This is why a readback followed by a write will always work like one would expect.

Posts: 762
Joined: Tue Apr 24, 2012 3:46 pm

Return to General PCIe