p4lang / tutorials

P4 language tutorials
Apache License 2.0
1.36k stars 887 forks source link

Update advanced_tunnel.p4 to P4~16 format #501

Closed davidjosearaujo closed 1 year ago

davidjosearaujo commented 1 year ago

During my reading of the P4~16 Language Specification I wasn't understanding why the counters were written in this way

counter(MAX_TUNNEL_ID, CounterType.packets_and_bytes) ingressTunnelCounter;
counter(MAX_TUNNEL_ID, CounterType.packets_and_bytes) egressTunnelCounter;

And because of that I wetn searching and found P4~14 Language Specification - page 27 that explained the used format.

This meaning that it could be updated to the new P4~16 format, soo that is what I did :)

Counter(MAX_TUNNEL_ID, CounterType.Both) ingressTunnelCounter;
Counter(MAX_TUNNEL_ID, CounterType.Both) egressTunnelCounter;

Hope it helps! I'm loving learning P4!

Update: I'm just an *diot