- Determine the number of CplH credits required by a Max_Request_Size
packet:
Max_Header_Count = ceiling(Max_Request_Size / RCB)
- Determine the greatest number of maximum-sized completions supported by the CplD credit
pool:
Max_Packet_Count_CplD = floor(CplD / Max_Request_Size)
- Determine the greatest number of maximum-sized completions supported by the CplH
credit pool:
Max_Packet_Count_CplH = floor(CplH / Max_Header_Count)
- Use the smaller of the two quantities from steps 2 and 3 to obtain the maximum
number of outstanding Non-Posted requests:
MAX_NP = min(Max_Packet_Count_CplH, Max_Packet_Count_CplD)
With knowledge of MAX_NP, the user application can load a register NP_PENDING with zero at reset and make sure it always stays with the range 0 to MAX_NP. When a non-posted request is transmitted, NP_PENDING decreases by one. When all completions for an outstanding non-posted request are received, NP_PENDING increases by one. For example:
- Max_Request_Size = 128B
- RCB = 64B
- CplH = 64
- CplD = 15,872B
- Max_Header_Count = 2
- Max_Packet_Count_CplD = 124
- Max_Packet_Count_CplH = 32
- MAX_NP = 32
Although this method is the simplest to implement, it can waste the greatest receiver space because an entire Max_Request_Size block of completion credit is allocated for each non-posted request, regardless of actual request size. The amount of waste becomes greater when the user application issues a larger proportion of short memory reads (on the order of a single DWORD), I/O reads and I/O writes.