[P4-dev] where to add_header?

Yuliang Li yuliangl at usc.edu
Sun Sep 25 14:40:00 EDT 2016


Thank you Antonin.

I have a question regarding the copy to cpu example. In the parser start,
it uses current(0,64)==0 to decide if parse the CPU header or not, but the
CPU header only has16 bits. So I am a bit confused.

On Sat, Sep 24, 2016 at 7:38 PM, Antonin Bas <antonin at barefootnetworks.com>
wrote:

> Hi Yuliang,
>
> Your header has to be part of the parse graph. From the parse graph, we
> compute a topological sorting which determines in which order the headers
> are emitted when the packet is deparsed.
> There is one example on p4lang of a P4 program which adds a CPU header to
> packets: https://github.com/p4lang/tutorials/tree/master/
> examples/copy_to_cpu
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_p4lang_tutorials_tree_master_examples_copy-5Fto-5Fcpu&d=DQMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=-sjq3J2b6bOdupF1bsRuzQ&m=hVPplGkytizsR3NIsQ8BCRg2pRnf0nNOY4WEMIiBdDI&s=__hem8X-_ofBe4kKAJS8fA4Oy6ejfycH8JCaVtIXYuc&e=>
> There are a few threads on this mailing list which talk about this in more
> details. I would recommend looking at this one:
> http://lists.p4.org/pipermail/p4-dev_lists.p4.org/2016-May/000319.html
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.p4.org_pipermail_p4-2Ddev-5Flists.p4.org_2016-2DMay_000319.html&d=DQMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=-sjq3J2b6bOdupF1bsRuzQ&m=hVPplGkytizsR3NIsQ8BCRg2pRnf0nNOY4WEMIiBdDI&s=Tz7wFzp_ppqkl3kdcFIQfIUunIebmZj15Tze6iAX8wI&e=>
>
> Thanks,
>
> Antonin
>
> On Sat, Sep 24, 2016 at 4:22 PM, Yuliang Li <yuliangl at usc.edu> wrote:
>
>> Hi all,
>>
>> I want to add a header to each packet. I see there is a add_header API.
>> But how do I indicate where to add the header (e.g. after TCP header).
>>
>> Thanks,
>> Yuliang
>>
>> _______________________________________________
>> P4-dev mailing list
>> P4-dev at lists.p4.org
>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.p4.org_mailman_listinfo_p4-2Ddev-5Flists.p4.org&d=DQMFaQ&c=clK7kQUTWtAVEOVIgvi0NU5BOUHhpN0H8p7CSfnc_gI&r=-sjq3J2b6bOdupF1bsRuzQ&m=hVPplGkytizsR3NIsQ8BCRg2pRnf0nNOY4WEMIiBdDI&s=mAMbIbM0dOLPeD5OVocPsNV1-Gp7YPWw3OyL_-ds2CY&e=>
>>
>
>
>
> --
> Antonin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20160925/08b3c96e/attachment-0002.html>


More information about the P4-dev mailing list