[P4-dev] no semantic check for a variable-length match field into the table definition
antonin at barefootnetworks.com
Thu Aug 6 11:03:00 EDT 2015
Matching on variable length fields would be easy to achieve in a software
switch. I expect that some hardware targets will be able to do it while
some won't. Maybe this case does deserve some special treatment in the P4
spec: while doing an exact match on a variable length field sounds pretty
straightforward, ternary and lpm matches sound trickier. I don't see how we
could define lpm match on a variable length field. Maybe the frontend
should issue an error for this case (non-exact match) as you initially
suggested. Since we haven't implemented this yet in the software switch
-for the sake of time-, I haven't given it much thought... I don't even
know if there is an interesting use case for matching on variable length
On Wed, Aug 5, 2015 at 11:18 PM, Salvatore Signorello <
salvatore.signorello at uni.lu> wrote:
> Hi Antonin,
> thank you for answering, few cents in line.
> On 08/05/2015 10:53 PM, Antonin Bas wrote:
> 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.
> I think you're right saying that this is something that has to be
> eventually raised by the back-end compiler comparing the computed size
> against the available resources on a certain target. Nevertheless, I wonder
> more about how this variable-length field could affect the match logic
> built on such table, but I've not come up with a definitive idea about this
> Do you see any issue with this? Note that the software switch on p4lang
> does not support variable length field (not even their extraction).
> was it for sake of time
> 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?
>> 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...
More information about the P4-dev