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

Diogo Pinto diogo.f1.p2 at gmail.com
Wed Apr 19 07:13:46 EDT 2017


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 {





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
So, how do I populate this table ?

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

More information about the P4-dev mailing list