Skip to content

Giving MASK in table keys #5654

@maheswari-s

Description

@maheswari-s

There is requirement to take the key and mask it to given value and then go for rule matching. And the mask can be 0 also.

Example:

keys = {
hdrs.mac.type & 0x0 : exact;
// other keys
}

But, the above mask expression is optimized by frontend and 0 is present in the place of (hdrs.mac.type & 0x0) at the end of frontend passes.
I checked if Mask operator (&&&) would help. But this operation is allowed only in constant entries of a table as per P4 language spec.

Is there any other cleaner way available? Or, should we stop frontend to optimize the & with 0 in table key expression?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThis is a topic requesting clarification.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions