[P4-dev] no semantic check for a variable-length match field into the table definition

Antonin Bas antonin at barefootnetworks.com
Wed Aug 5 16:53:06 EDT 2015

Hi Salvatore,

I can see that there is no warning / error, but do we really need one? The
compiler knows what the maximum length of a field is, so in theory a table
could match on this field. The compiler allocates for the worst case and
the match will compare the values, independently of the actual bit width of
the extracted field. Do you see any issue with this? Note that the software
switch on p4lang does not support variable length field (not even their

The TODO at line 923 probably refers to doing more checks on the size
attributes (what if max_size and min_size and size are specified), but I am
not sure. Probably just needs to be removed at this point...



On Tue, Aug 4, 2015 at 3:12 PM, Salvatore Signorello <
salvatore.signorello at uni.lu> wrote:

> Hi all,
> I've realized that the actual front-end doesn't generate any
> warning/error if a table defines a field_match using a variable-length
> header field.
> There is a TODO at line 923 of the semantic_check.py (hlir module)
> suggesting that this check has been voluntarily skipped. Could please
> someone shed light on this?
> Best,
> Salvatore
> _______________________________________________
> P4-dev mailing list
> P4-dev at p4.org
> Listinfo - http://mail.p4.org/mailman/listinfo/p4-dev_p4.org
> Archives - http://mail.p4.org/pipermail/p4-dev_p4.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150805/f737df69/attachment-0001.html>

More information about the P4-dev mailing list