Packet Replication Engine

What are the differences between the Packet Replication Engine (PRE) extern as implemented in the Portable Switch Architecture (PSA) and the Packet Replication Engine in the Tofino Native Architecture (TNA)?

Thankyou.

I doubt this will be a complete list of differences, but a couple that occur to me off the top of my head.

One thing they have in common is that ingress specifies a multicast group id (or actually up to 2 for TNA, but only 1 in PSA and v1model), and the multicast group id is configured in the control plane to specify everywhere that a packet should be replicated to, when a packet uses that multicast group id.

In PSA (and v1model) architectures, each multicast group id is configured with a set of (output_port, replication_id) pairs, and copies are always made to each of those.

In TNA, the multicast group configuration can be that simple, but it can also contain objects intended to represent an Ethernet link aggregation group (LAG), such that a hash value is used to specify which of a set of possible output ports the packet should be replicated to. This is useful for supporting LAGs.

TNA also supports the ability to specify that some copies are “pruned”, i.e. discarded in the replication engine, without being sent to the egress processing at all. This is useful for things like PIM-Bidir(ectional), where a packet can arrive on a port, and should be replicated to a set of ports except the one it arrived on. Of course in PSA and v1model you can implement that by dropping that copy during egress processing, but it is nice as a small optimization if that copy is never made in the first place.

And as mentioned above, TNA lets the P4 program specify 2 multicast group ids for each packet, instead of only 1. This is useful if you have a network device operating as a hybrid of a L3 router, plus one or more layer 2 broadcast domains/VLANs, and. you want to in your P4 code specify one multicast group id for the copies to make for layer 3 multicast routing, and a separate multicast group id for the copies to make for layer 2 bridging. That is not the only use case, I would guess, but I suspect the motivation for creating that feature.

For more details on TNA, at least for Tofino1, see the Open Tofino repo and in particular the TNA architecture document there: GitHub - barefootnetworks/Open-Tofino
See especially Section 5.7 “Packet Replication Engine” and its sub-sections.

Thanks @andyfingerhut

Just a small doubt, this Packet Replication Block is Vendor Specific?

If you are programming a physical P4-programmable device, my recommendation is always that you read the vendor’s documentation about their product, and how it works. The v1model and PSA architectures were defined with a few organizations contributing, but actual devices tend to implement additional features and options.