[P4-dev] Populate table with "valid" matches in "reads" (p4-14)

Antonin Bas antonin at barefootnetworks.com
Wed Apr 19 12:41:53 EDT 2017


If you are using the bmv2 CLI, you should be able to use "true" / "false",
"True" / "False", "0" / "1" (as per
https://github.com/p4lang/behavioral-model/blob/master/tools/runtime_CLI.py#L676
).
For example:
table_add t1 myAction True =>

A valid match is just a "special" case of exact match, where we are
matching on a 1-bit boolean value.

On Wed, Apr 19, 2017 at 4:13 AM, Diogo Pinto <diogo.f1.p2 at gmail.com> wrote:

> Hello,
>
> Suppose I have a parser that, under some condition, might extract*
> "myHeader"* or not. I added some impossible conditions in the parser, for
> the case when I don't want to extract the header, so that *"myHeader"* is
> always reachable and not removed during semantic checking.
>
> If *"myHeader" *is extracted, I want to perform some action.
> If I have:
>
> action myAction () { // no parameters
>
> ....
>
> }
>
> table t1 {
>
> reads {
>
> myHeader : valid;
>
> }
>
> actions {
>
> _nop;
>
> myAction;
>
> }
>
> }
>
> How do I populate this table ????
>
> I know that if the table had *"myHeader.field : exact;"*, instead of *"myHeader
> : valid;"*, I would do something like:
>
> table_set_default   t1    _nop
> table_add              t1    myAction 1000 =>
>
>
> However, as far as I know, and tested, the *match_fields* of* table_add*
> need to be some integer.
>
> How do I perform a *table_add*, in the presence of a *"valid"* match in
> *"reads"* ? If i just set do:
>
> table_set_default   t1    _nop
>
>
> The action *myAction *will never be executed, even if *myHeader *was
> extracted.
> So, how do I populate this table ?
>
> Thanks,
> Diogo.
>
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170419/6cc5bc21/attachment-0002.html>


More information about the P4-dev mailing list