behavioral-model
behavioral-model copied to clipboard
Applying the same table twice
Today, BMv2 does not allow us to apply the same table twice, see e.g. https://github.com/p4lang/behavioral-model/issues/231 and https://github.com/p4lang/behavioral-model/issues/1158.
@jafingerhut noted in https://github.com/p4lang/behavioral-model/issues/1158:
bmv2 does have some artificially imposed limitations in the P4 programs you can write, e.g. you cannot apply() the same table twice in the same control
I would like to understand why this restriction was "artificially imposed", if there are any concerns about lifting it, and how challenging that might be.
I suspect the restriction may just exist to mimic hardware switches like the Tofino? cc @kheradmandg
For some discussion on this, see this issue, especially the recently added comments: https://github.com/p4lang/p4c/issues/457
Note that my "artificially imposed" phrase might have been poorly chosen -- there were some reasons for that choice, but I did not develop bmv2 and do not know all the reasons for its design decisions. Certainly from the point of view of "what can a general purpose CPU do?" it seems like an artificial restriction.
Thanks for the pointer, I missed/forget about the discussion on the p4c repo. cc @fruffy.
That issue also contains an explanation by @antoninbas why the restriction exist: https://github.com/p4lang/p4c/issues/457#issuecomment-292658545. The take away is that it could be lifted but requires some architectural changes.