p4lang / behavioral-model

The reference P4 software switch
Apache License 2.0
542 stars 330 forks source link

Parsing extra headers in resub packets.. #971

Closed castilhorosa closed 3 years ago

castilhorosa commented 3 years ago

Hi guys.

In PSA architecture, what happen in ingress parser when I resubmit a packet emiting extra headers in ingress deparser? Can I extract such extra headers in ingress parser? I'm a litte confused because, according to Figure 2 in PSA specification, it seems to me that a resubimited packet cross the ingress deparser and, therefore, it takes into account the valid headers in all emits. However, the section 6.1.2 in the same specification says that I won't be able to see any modifications into the packets done in ingress (i.e adding new headers) in the resubmited packets.

6.1.2. Initial packet contents for resubmitted packets For RESUB packets, packet_in is the same as the pre-IngressParser contents of packet_in, for the packet that caused this resubmitted packet to occur (i.e. with NO modifications from any ingress processing).

Do semantic in emits functions in ingress deparser varies from resubmit packets to normal ones?

Its very likely that I am misinterpreting the PSA spec regards to this.

Thanks.

jafingerhut commented 3 years ago

The intent of the PSA specification is that even if the ingress deparser executes, the resulting packet is discarded when you cause a resubmit to occur. Only the original packet before the ingress parser executed remains, and is processed again, but with the packet path standard metadata indicating it is a resubmitted packet, and with any user-defined metadata preserved in the ingress deparser execution.

castilhorosa commented 3 years ago

I got it. Great. Thanks @jafingerhut