[P4-dev] Why do we need header stacks?

Wu, Xiaoban Xiaoban_Wu at student.uml.edu
Thu Dec 27 12:24:42 EST 2018


Dear All,


Thanks very much for your quick reply. With Q-IN-Q VLAN and MPLS(multiple labels), I now see how header stacks are useful.


Best wishes,

Xiaoban

________________________________
From: hemant at mnkcg.com <hemant at mnkcg.com>
Sent: Thursday, December 27, 2018 12:07:34 PM
To: Wu, Xiaoban; p4-dev at lists.p4.org
Subject: RE: [P4-dev] Why do we need header stacks?


MPLS and VLAN protocols push/pop labels or add/delete tags respectively.  For example with q-in-q VLAN, one VLAN tag is removed or added.  An array of headers helps because P4 can uses h[0].setInvalid() to remove a label and use h[0].isValid() to check for a valid label.  An array is easier than using a linked list.  You can look for examples of mpls[] and vlan[] in P4-16 switch code with URL below.



https://github.com/jafingerhut/p4lang-tests/blob/master/v1.0.3/switch-2017-03-07/out1/switch-translated-to-p4-16.p4<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_jafingerhut_p4lang-2Dtests_blob_master_v1.0.3_switch-2D2017-2D03-2D07_out1_switch-2Dtranslated-2Dto-2Dp4-2D16.p4&d=DwMFAg&c=UycKcnKpT5zzKpcCVf29TA&r=NAfqbdZpYio_GjgwEysEgS0WV4l9eSbIbehFm-ZuE3w&m=pfYmvY2X7GjzC1ULH9-dDDtPzBXIKuTTrOZ7HGvtkRk&s=uP0zO1Vh_IIC2NFyze-NO1G_lQ-lzC0HnTolNLkE9mc&e=>



Hemant



From: P4-dev <p4-dev-bounces at lists.p4.org> On Behalf Of Wu, Xiaoban
Sent: Thursday, December 27, 2018 11:45 AM
To: p4-dev at lists.p4.org
Subject: [P4-dev] Why do we need header stacks?



Dear All,



Could anyone please tell me in the real-world application, in which scenario would we consider using an array of header instances with the same header type?



In the P4 spec, it says "MPLS and VLAN tags are examples that might be treated this way", however I still don't quite understand it. Could anyone please elaborate on this? Thanks very much.



Best wishes,

Xiaoban




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20181227/296caa74/attachment.html>


More information about the P4-dev mailing list