[P4-dev] How do P4 tables decide which actions are executed?

LJ Wobker ljw at barefootnetworks.com
Tue Jun 23 00:45:10 EDT 2015


Robert-



The actions defined in the program are the set of **possible** actions that
the given table can execute.  The action that is taken for any given
matching entry is defined by the user via the API.



In your example, any “known” routing entry would be programmed with
parameters for the “fib_hit_nexthop”, while entries for unknown routes
would be programmed with the “on_miss” action.  Note that these two actions
might have very different action parameters.  (In practice, the default
action would likely be a catch-all entry for routes that don’t match)





--lj











*From:* P4-dev [mailto:p4-dev-bounces at p4.org] *On Behalf Of *Robert Halstead
*Sent:* Monday, June 22, 2015 12:13 PM
*To:* p4-dev at p4.org
*Subject:* [P4-dev] How do P4 tables decide which actions are executed?



I'm having trouble understanding how the control flow executes, and just
wanted to ask some clarifying questions. They will all pertain to the
basic_routing example under the p4-factory repository.



First, how is an action chosen when a table has multiple actions available?
For example the ipv4_fib and ipv4_fib_lpm tables both have two actions;
on_miss & fib_hit_nexthop. Are both actions executed, or is the first/last
action that gets executed, or is it dependent on the statements under
control ingress?



I think my issue is with the following statement. I'm not sure how to read
it, and I just can't get it to gel in my head.

apply(ipv4_fib) {

               on_miss {apply(ipv4_fib_lpm);}

}



The first way I'm reading it is: "apply table ipv4_fib" only executing
"action on_miss" then "apply table ipv4_fib_lpm" executing "actions on_miss
& fib_nexthop". This interpretation doesn't make too much sense to me
because the on_miss action does nothing, and the statement would be
equivalent to apply(ipv4_fib_lpm).



Another way I'm reading it is: "apply table ipv4_fib" but after completing
"action on_miss" "apply table ipv4_fib_lpm". However, this interpretation
means the action fib_nexthop is executed twice.



I don't think they are, but are either of these interpretations correct? If
not what is the correct way to read the statement?



Thank you,

- Robert





This email and any attachments are intended for the sole use of the named
recipient(s) and contain(s) confidential information that may be
proprietary, privileged or copyrighted under applicable law. If you are not
the intended recipient, do not read, copy, or forward this email message or
any attachments. Delete this email message and any attachments immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150622/a0b0c76e/attachment-0001.html>


More information about the P4-dev mailing list