[P4-dev] [bmv2] Why does the <H> headers struct forbit nested structs?

hemant at mnkcg.com hemant at mnkcg.com
Fri Feb 1 11:49:14 EST 2019

Since around January 7th, 2019, p4c supports a nested bit-vector struct inside a P4 header.  However, since the p4c bmv2 backend does not support nested structs, a midend pass flattens the header.   See the spec changes that are being made to p4c regarding the code that was checked in.




Off hand, I don’t know of an alternative target that supports nested structs. 




From: P4-dev <p4-dev-bounces at lists.p4.org> On Behalf Of Kamila Soucková
Sent: Friday, February 01, 2019 11:42 AM
To: p4-dev at lists.p4.org
Subject: Re: [P4-dev] [bmv2] Why does the <H> headers struct forbit nested structs?




I am trying to create a modular design in P4, and I have come across the "Type struct scion_all_headers_t should only contain headers, header stacks, or header unions" error. After some searching, I found https://github.com/p4lang/behavioral-model/blob/master/docs/simple_switch.md#p4_16-plus-v1model-architecture-notes , which confirms that structs in the headers type are in fact not allowed in v1model, although the spec does not forbid it. This means that I cannot easily keep things hierarchical. So I am wondering, why does this restriction exist? And is there any chance that it might go away?

A possible alternative question would be "is there an alternative target that can be used with p4c and does not have this restriction"?


(Also, did my email make it through? I do not see it in the archives...)


Thank you!




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

More information about the P4-dev mailing list