Skip to content

Reads of fields from invalid headers: additional options for return value #1370

@grg

Description

@grg

The P4 language specification (v1.2.5, §8.25) states:

The result of reading a value in any of the situations below is that some unspecified value will be used for that field.

  • reading a field from a header that is currently invalid.
  • ...

The behavioral model currently returns that last written value when reading a field from an invalid header.

I propose adding two additional modes when reading from invalid headers:

  1. Return 0: All reads of fields in invalid headers return 0. (Likely mirrors some hardware implementations.)
  2. Return the last written value and print a warning.

I suggest that the choice of mode is a compile-time setting (e.g., via a cmake parameter).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions