FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP

PCIe TAGs

Altera_Forum
Honored Contributor II
4,993 Views

Hello all.  

 

I can't understand how to use TAGs in PCIe. I have a memory papped registers. When I read "read requect" I'm replay with competition with same TAG. When I need a write some data to computer memory I'm use "memory write" with zero tag. But when I make memory read with TAG = 5 (or any other number) the PCIe froze and stop work.  

 

I will make a some DMA channel each with different registers (dma_mem_start, etc) and with different TAGs. First DMA write_to_PC_memory channel is TAG 1, second is TAG 2, etc.
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
3,311 Views

If I understand correctly, it sounds like you are using the tags correctly. If so, I am not sure that your issue is tag related. 

 

To summarize tag usage: 

(1) When you receive a memory read request, the response you send back must be marked with the same tag as the request that you are responding to. 

(2) Since there is not a response associated with a memory write request, sending a memory write request with a tag of zero is just find. 

(3) When you send a memory read request, you need to make sure there are no outstanding requests marked with the same tag. That is, you can not reuse a tag from a memory read request until you have received the memory read response for that request.
0 Kudos
Altera_Forum
Honored Contributor II
3,311 Views

brettfavre, (http://www.alteraforum.com/forum/member.php?u=2888) Thanks. Looks like you right.

0 Kudos
Altera_Forum
Honored Contributor II
3,311 Views

 

--- Quote Start ---  

 

(3) When you send a memory read request, you need to make sure there are no outstanding requests marked with the same tag. That is, you can not reuse a tag from a memory read request until you have received the memory read response for that request. 

--- Quote End ---  

 

The tags in different for request from PC and from PCIe device? En example: I replay for memory read request from PC with tag 5. I can send memory read from PCIe device to PC with tag 5 too?
0 Kudos
Altera_Forum
Honored Contributor II
3,311 Views

I am not sure that I understand what you are saying in your last post. It sounds like you are talking about two different devices performing memory read requests where the two devices assign the same tag to the requests. Short of analyzing packets on the bus, I don't know how you could know that this is the case. You simply need to guarantee that your PCIe device does not make two memory read requests with the same ID. You can only re-use the ID for a new request after a completion comes back for the first request containing that same ID. 

 

Sorry if I am not getting to the heart of your question.
0 Kudos
Altera_Forum
Honored Contributor II
3,311 Views

 

--- Quote Start ---  

I am not sure that I understand what you are saying in your last post. It sounds like you are talking about two different devices performing memory read requests where the two devices assign the same tag to the requests. Short of analyzing packets on the bus, I don't know how you could know that this is the case. You simply need to guarantee that your PCIe device does not make two memory read requests with the same ID. You can only re-use the ID for a new request after a completion comes back for the first request containing that same ID. 

 

Sorry if I am not getting to the heart of your question. 

--- Quote End ---  

 

One device. The PC can access to the memory on this device. And this device can access to the main memory on PC (bus mastering). PC make memory read request to the device memory. And device make memory read request to PC memory. PC and device make memory read request in same time. I can guarantee that my device does not make two memory read request in same time. But I can't guarantee that PC does not make memory read request with same tag. My device make memory read request from PC memory with tag 5 and and same time PC make memory read request with tag 5 from device memory. In this case will be two memory read request in system with same tag. One from my device and other from PC. Is this problem?
0 Kudos
Altera_Forum
Honored Contributor II
3,311 Views

Thanks for clarifying. Now I understand what you are saying. You shouldn't have to worry about the PC making a request to your PCIe device with the same tag as a request your PCIe card makes to memory. This should be tracked independently.

0 Kudos
Altera_Forum
Honored Contributor II
3,311 Views

PCIe says: »Tag[7:0] is a 8-bit field generated by each Requestor, and it must be unique for all outstanding Requests that require a Completion for that Requester«. Requester ID and Tag together form the Transaction ID. This Transaction ID must be unique for all outstanding requests in the system, not the Tag alone, just the Tags of a single Requester. 

 

The Requester always knows which transactions, initiated by him, are not completed yet, so it must not use a tag of those unfinished requests. The Tags used by other Requesters, probably reading data from this device, are completely independent from that. In the process of completing such Requests, you have to return the Requester’s Transaction ID, irrespective of your own Tag housekeeping. 

 

There are different strategies for keeping track of valid Tags to be used in Requests initiated by your device: Just use a single Tag if you can live with waiting for all returned data before you re-use this tag. For higher performance, one would issue interleaved requests, for which one might want to keep a pool of Tags. A Tag is consumed from this pool upon starting a request, and Tags are recycled when all Completions for it are have been received. Furthermore, one should keep track of outstanding Requests and recycle those Tags that didn’t get the expected completions within the Completion Timeout.
0 Kudos
Altera_Forum
Honored Contributor II
3,311 Views

All thanks! Problem was in bits 126:125. I'm change TLP_FMT_4DW_W to TLP_FMT_4DW_R and now I can see replay from PC.

0 Kudos
Reply