Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

p4c-bmv2 assumes older behavioral-model behavior for push operations #106

Open
jafingerhut opened this issue Nov 12, 2019 · 1 comment
Open

Comments

@jafingerhut
Copy link
Contributor

Before this commit to the behavioral-model repository in March 2018, p4c-bmv2 and behavioral-model had the same assumptions about how push operations in the JSON file worked: p4lang/behavioral-model@9131ed9

After that commit, the default builds of behavioral-model changed, but p4c-bmv2 did not change to update with it.

If you encounter this, options you have:

  • Use latest p4c and behavioral-model together, which have common assumptions on how the BMv2 JSON push operation works (which is: the new pushed headers are invalid, and when compiling P4_14 programs, the p4_14 compiler when creating the BMv2 JSON file should insert add_header primitive operations after push operations, to make the newly inserted headers valid)

  • Use p4c-bmv2, and also use the option mentioned in the commit message linked above when building behavioral-model, i.e. "The legacy implementation can be toggled by passing the
    --disable-WP4-16-stacks flag to configure."

  • Convince someone, or yourself, to update p4c-bmv2 to follow the new behavior implemented by behavioral-model.

@jafingerhut
Copy link
Contributor Author

jafingerhut commented Nov 12, 2019

Another alternative:

  • continue using p4c-bmv2 as it is now, but every time in your P4_14 program that you invoke a push(my_header_stack, n) operation, immediately follow it with add_header(my_header_stack[0]); add_header(my_header_stack[1]); ... add_header(my_header_stack[n-1]); , which is effectively what p4c is doing for you under the covers after every P4_14 push operation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant