I suggest reading the PCI and PCIe Specs from the PCI-SIG. Those clearly state what to do in reaction to a received TLP and how to construct transmit TLPs. The Altera PCI Express User Guide just tells you how you interface these TLPs with the Avalon-ST interface.
You might get a first impression looking at this article (
http://billauer.co.il/blog/2011/03/pci-express-tlp-pcie-primer-tutorial-guide-1/), continued here (
http://billauer.co.il/blog/2011/03/pci-express-tlp-pcie-primer-tutorial-guide-2/). That is a very brief introduction to the topic, alongside with a lot of advertisment for the author’s solution (Xillybus) which I can neither recommend nor discourage to use because I don’t know it. At least it might be hard to make it work on Altera because it seems to be written solely for Xilinx FPGAs.
– Matthias