[P4-dev] How to know the flow_id from a table.

Andy Fingerhut andy.fingerhut at gmail.com
Sun Nov 4 12:39:01 EST 2018


You may need to explain what 'flow_id on a hit' means in the context you
are thinking about it, before anyone can give you an answer.

For example, perhaps by that phrase you mean that you want to get back a
'hardware address' of the matching table entry.  If so, there is no way in
the standard language specs for P4_14 or P4_16 to get that.  Some
implementations might provide a way to do it as an extension over and above
what the language specs require, but for that you would need to consult the
documentation for your implementation.  I am pretty sure BMV2 does not
implement such an extension.

If by 'flow_id on a hit' you mean 'an id that is different for each table
entry, and is chosen by the control plane software when it created the
table entry', then that is straightforward -- make the flow_id a parameter
of all of the actions for that table, like this (code snippet uses P4_16
syntax):

table t1 {
    action a1 (bit<16> flow_id, // ... other a1 action parameters here
                    )
    {
        meta.my_flow_id = flow_id;
        // other a1 action statements go here
    }
    // action a2 and a3 are similar, in that they all have a bit<16>
flow_id parameter, and an assignment of it to meta.my_flow_id
    key = {
        // ... table key fields go here, not relevant for this example ...
    }
    actions = { a1; a2; a3; }
    // other table properties go here
}

Andy

On Sun, Nov 4, 2018 at 8:53 AM Kamal Bhatt <Kamal.Bhatt at stordis.com> wrote:

> Hello Everyone,
>
> How to know the flow_id on a hit , in BMV2 for example.​
>
>
> Thanks,
>
> Kamal Bhatt.
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20181104/965c6255/attachment.html>


More information about the P4-dev mailing list