[P4-dev] Queries regarding reading/writing in key-action part of match-action table

Raj Joshi rajjoshi at comp.nus.edu.sg
Wed May 6 02:28:25 EDT 2020

Hi Sahil,

Following are the answers:
1. Counters are typically not available for access to dataplane packets.
But you can implement a counter using a register. In that case, answer to
your question is "yes". You can first read the register value in a metadata
field and have that metadata field in the key part of the match-action
2. Registers are externs and implemented by target architectures. Some
architectures like v1model should allow you to update a register value in
an action. So the answer is "mostly yes".
3. For hardcoded value, you could just use the control plane to add the
hardcoded value match into your table and make sure you don't change it (so
that it remains hardcoded). OR you can even hardcode a value in a register.
Then read it in a metadata field and compare the metadata field with your
packet header field. Some architectures can allow you to directly compare a
header field value with a hardcoded register value. So, in general the
answer is "yes".

-- Raj

On Wed, May 6, 2020 at 8:50 AM Sahil Gupta <sg5414 at rit.edu> wrote:

> Hi all,
> Is it possible:
> 1. to read/match register or counters in key parts of match-action tables?
> 2. to update register value in the action field?
> 3. to match any field of header packet to arbitrary hardcoded value or
> value of some register in P4?
> Regards
> Sahil Gupta
> [image: Mailtrack]
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&> Sender
> notified by
> Mailtrack
> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&> 05/05/20,
> 11:17:09 PM
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20200506/3ffb585f/attachment.html>

More information about the P4-dev mailing list