[P4-dev] Any use case for resubmit and recirculation in P4?
hemant at mnkcg.com
hemant at mnkcg.com
Fri Dec 16 19:45:09 EST 2016
As you have seen even IPv6 can parse the options in one pass without sending the packet to any resubmit/recirculation queue as the TLV_parsing.p4 example has shown for IPv4 options. Maybe, the terminology is mis-understood or could be better – you can take that up with the P4 specification mailer.
However, for the sake of the example you asked of here are some notes.
First time, the parser gets an IPv6 packet and sees that the packet has a next_header as 0x0 which is the IPv6 Hop-by-Hop option. Thus the parser sends the packet to a recycle queue (or what is called as recirculation queue). Router vendors call the queue as a recycle queue. The recycle queue is setup apriori to handle parsing of IPv6 options. When the packet arrives at the recycle queue, the queue parses the option and adds the information of the IPv6 packet (src-, dst- address, and option) to a db. After all if the option is parsed, one purpose is to store the information in the router database.
From: HAOJU XIAO [mailto:hamkuu at gmail.com]
Sent: Friday, December 16, 2016 3:48 AM
To: hemant at mnkcg.com
Cc: p4-dev at lists.p4.org
Subject: Re: [P4-dev] Any use case for resubmit and recirculation in P4?
Thanks for your advice.
Motivated by what you mentioned as follows:
An example of recursive packet processing is parsing options in IPv6 packet.
I was trying to implement a P4 program that can parse IPv6 extension headers. But I’m still confused on how to implement it in a recursive way.
Whether “resubmit” or “recirculation”, they will move the packet back to the Parser and start parsing all over again, though different parsing decision might be made. But I don’t think that’s kind of “recursive packet processing”.
Besides, I noticed that IPv6 extension header and IPv4 options are similar in terms of organization, i.e. in a chaining way. And the example program “TLV_parsing.p4” obviously does not use “resubmit” or “recirculation” for parsing IPv4 options.
Can you articulate what you mean by “An example of recursive packet processing is parsing options in IPv6 packet”?
If that’s wrong literally, can you provide any example concerning “recursive packet processing”?
Thanks in advance.
On Dec 2, 2016, at 9:29 PM, hemant at mnkcg.com <mailto:hemant at mnkcg.com> wrote:
The P4 specification is clear. See text from the P4 document shown between squared brackets below.
[Many standard networking functions, such as mirroring and recursive packet processing, require more complicated primitives than setting or testing fields. To support such operations, P4 provides primitive actions that allow a packet to be recirculated (sent back to the start of the processing pipeline) or cloned (a second instance of the packet is created).]
Have programmed a router/switch data plane before? If you had, it’s very common for the data plane to send a packet to the recycle queue, say, for packet replication. Replication is same as mirroring. Another use case is, by default, the data plane matches 64-bits of an IPv6 address but in some cases, the whole 128-bits of the IPv6 address needs matching. Then the data plane sends the packet to the recycle queue. An example of recursive packet processing is parsing options in IPv6 packet.
From: P4-dev [mailto:p4-dev-bounces at lists.p4.org] On Behalf Of HAOJU XIAO
Sent: Friday, December 02, 2016 5:13 AM
To: p4-dev at lists.p4.org <mailto:p4-dev at lists.p4.org>
Subject: [P4-dev] Any use case for resubmit and recirculation in P4?
I noticed that P4 provides primitive operations like resubmit and recirculation. They can redirect packet back to the Parser to have different parsing decisions.
I'm wondering what kind of scenario when we need "different parsing decisions"? Any hint is appreciated.
Sent from my iPhone
P4-dev mailing list
<mailto:P4-dev at lists.p4.org> P4-dev at lists.p4.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the P4-dev