[P4-dev] DIfference between on_miss and default

Anandakumar ananth.padfoot at gmail.com
Thu Oct 5 01:51:40 EDT 2017


Thank you very much for the clarification!

On 05-Oct-2017 7:25 AM, "Vladimir Gurevich" <
vladimir.gurevich at barefootnetworks.com> wrote:

> Hello Anand,
>
> The keyword "default" used in the context of the apply() statement with
> the case clause does not mean "the default" action. Instead it means "any
> action, other that those that were explicitly listed".  In that sense it is
> very much the "catch all" keyword, similar to "default" as used in C switch
> statements.
>
> So, the statement in question reads like this:
>
> If the chosen action (after the outer_rmac table has been applied) is
> "on_miss", then execute "process_outer_multicast" control. In all other
> cases, if ipv4 header is valid, then call process_ipv4_vtep() control
> otherwise, if ipv6 header is valid, then call (apply) process_ip6_vtep()
> control.
>
> Normally, you would expect the "on_miss" action to be the default action
> in the table outer_rmac, but individual entries can have it as well.
>
> I hope this answers the rest of your questions as well. Again, "default"
> does not mean "default action".
>
> Happy Hacking,
> Vladimir
>
> On Wed, Oct 4, 2017 at 6:01 PM, Anandakumar <ananth.padfoot at gmail.com>
> wrote:
>
>> Hi Everyone,
>>
>> I’m fairly new to P4 and was looking at this snippet in process_tunnel
>> and was wondering how the on_miss and default are different?
>> Can someone please help me in demystifying the following?
>>
>>    1. How the on_miss and default are different?
>>    2. Is the on_miss taken only if there’s an on_miss action programmed
>>    in the table against a specific key?
>>    3. What’s the behavior expected here, if on_miss is programmed as the
>>    default_action for the table in the program itself or from the
>>    control plane via the PD API?
>>    Would it make missed take the path of process_outer_multicast or the
>>    default?
>>    4. What’s the behavior expected here, if say an example action like
>>    another_action is programmed as the default_action for the table?
>>    Would it still execute the default block or just the action and
>>    nothing in this snippet?
>>
>> What’s the suggested way to easily search the whole mailing list archive
>> so that I don’t repeat the questions that are already probably answered! :)
>> Thank you very much.
>>
>>         /* outer RMAC lookup for tunnel termination */
>>           apply(outer_rmac) {
>>               on_miss {
>>                   process_outer_multicast();
>>               }
>>               default {
>>                   if (valid(ipv4)) {
>>                       process_ipv4_vtep();
>>                   } else {
>>                       if (valid(ipv6)) {
>>                           process_ipv6_vtep();
>>                       }
>>                   }
>>               }
>>           }
>>
>> Thank you very much.
>> -Anand
>>>>
>> _______________________________________________
>> P4-dev mailing list
>> P4-dev at lists.p4.org
>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>
>
>
>
> --
> *Vladimir Gurevich*
>
> *Barefoot Networks*
> *Technical Lead, Customer Engineering*
> Email: vag at barefootnetworks.com
> Phone: (408) 833-4505
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20171005/d71f6fe1/attachment-0002.html>


More information about the P4-dev mailing list