[P4-dev] 2 questions

Antonin Bas antonin at barefootnetworks.com
Mon Jun 12 14:19:06 EDT 2017


Hi,

The example that Nate sent is written in P4_14, so no it will not compile
with a P4_16 compiler.
v1model does include a clone primitive (https://github.com/p4lang/
p4c/blob/master/p4include/v1model.p4#L138), but I do not know how well it
works. I found an example P4_16 program in the p4c repo (
https://github.com/p4lang/p4c/blob/master/testdata/p4_
16_samples/clone-bmv2.p4#L30) that uses clone, but based on the comment in
the file ("this causes a crash in bmv2"), it is unlikely that it works...
Support in the p4c bmv2 backend may be incomplete, but more importantly I
am not sure v1model is sufficient to replicate the P4_14 cloning abilities.
You may have to wait for the new Portable Switch Architecture (PSA), which
is meant to provide more complete packet forwarding abstractions, and is
supposed to be a more natural architecture for P4_16 programs (than
v1model).

Thanks,

Antonin


On Mon, Jun 12, 2017 at 9:34 AM, Garegin Grigoryan <grigorg at clarkson.edu>
wrote:

> 1) Is this example is compatible with P4_16?
>
> It gives me an error (“could not find declaration for “
> clone_ingress_pkt_to_egress”")
>
> Sincerely,
> Garegin Grigoryan
> grigorg at clarkson.edu
>
> On Jun 8, 2017, at 2:42 AM, Nate Foster <jnfoster at cs.cornell.edu> wrote:
>
> 1) You can see an example of packet cloning here:
> https://github.com/p4lang/switch/blob/21d750ce6015c54978ee9a35198383
> 40698876c7/p4src/sflow.p4#L69
> https://github.com/p4lang/switch/blob/135599947d53d7dc2f830b12f4e169
> f430d78af0/p4src/acl.p4
>
> 2) See the P4 tutorial slides, starting around page 91, for a description
> of the "PD" API.
> https://github.com/p4lang/tutorials/blob/master/SIGCOMM_
> 2016/p4-tutorial-slides.pdf
>
> -N
>
> On Sun, Jun 4, 2017 at 1:08 PM, Garegin Grigoryan <grigorg at clarkson.edu>
> wrote:
>
>> Thank you!
>>
>> 1) Could you give a code example (or a reference) for P4_16 standard
>> regarding packet cloning?
>> 2) What kind of control plane API for bmv2 model is available?
>>
>>
>> On Fri, Jun 2, 2017 at 2:21 PM, Nate Foster <jnfoster at cs.cornell.edu>
>> wrote:
>>
>>> 1) Is it possible to clone packets at the data plane and forward a
>>>> cloned packet through the pipeline to the egress and then output it?
>>>>
>>>
>>> Yes, although the details of how cloning works are architecture specific.
>>>
>>>
>>>> 2) How can I print the contents of a table and registers in P4?
>>>>
>>>
>>> You need to write a program against the control-plane API for your P4
>>> program to do this.
>>>
>>> -N
>>>
>>
>>
>>
>> --
>> Sincerely,
>> Garegin Grigoryan
>>
>
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170612/94c9b0e0/attachment-0002.html>


More information about the P4-dev mailing list