oxidecomputer / oxidecomputer/p4
Global `const` symbols not resolved within action/parser bodies
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 137
- Forks
- 12
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 3
Description
const symbols defined in the global scope do not seem to be usable for reads/writes within parser bodies or actions, as below:
const bit<16> GENEVE_OPT_CLASS_OXIDE = 16w0x0129;
control x (
/* ... */
) {
action y (
inout headers_t hdr,
/* ... */
) {
hdr.ox_external_tag.class = GENEVE_OPT_CLASS_OXIDE;
}
/* ... */
}
This produces the following error message:
error: could not resolve lvalue: GENEVE_OPT_CLASS_OXIDE
GENEVE_OPT_CLASS_OXIDE not found
[361:37] sidecar-lite.p4
hdr.ox_external_tag.class = GENEVE_OPT_CLASS_OXIDE;
^^^^^^^^^^^^^^^^^^^^^^
From my testing, this also applies to use of constants within expressions in parser states.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the P4 example with the global const used in an action, then check the corresponding parser-state expression case. Trace name resolution for reads and writes from parser bodies and actions; done means both uses resolve without the reported lvalue error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100