[P4-dev] [P4-discuss] Can I get the processing time in switch?

Antonin Bas antonin at barefootnetworks.com
Mon Nov 28 13:17:18 EST 2016


Hi,

Different P4 architectures may expose different pieces of information. Some
architectures may expose a variety of timestamps as metadata fields. As of
today, there isn't really any "standard metadata" fields for what you want
to do.
In the case of bmv2 (https://github.com/p4lang/behavioral-model)
simple_switch architecture, we expose a few timestamps, whose description
can be found in this document:
https://github.com/p4lang/behavioral-model/blob/master/docs/simple_switch.md.
If you need more, you may have to implement your own architecture in bmv2,
based on simple_switch, and add any metadata fields you need. This does
require writing some C++ code, but is pretty straightforward. For example,
these 3 lines of code are used to set "
intrinsic_metadata.ingress_global_timestamp":
https://github.com/p4lang/behavioral-model/blob/master/targets/simple_switch/simple_switch.cpp#L147
.

Thanks,

Antonin

On Mon, Nov 28, 2016 at 12:40 AM, <jingy at zju.edu.cn> wrote:

> Hello.
>
>     I have written some codes using P4, but I am not familiar with the
> underlying implementation of the P4 switch in mininet, and I just want to
> use the abstraction of P4 to implement some functions.
>
>     Here I have a question, that is can I get the processing time in which
> a packet passes a switch? For example, when a packet arrives at a
> swicth, this switch needs to check the destination field in the header
> and find a correct engress port in a table. It requires a period of time to
> complete this process. Can I get the time easily (not to modify many codes
> about underlying implementation )?
>
> Thanks.
>
> _______________________________________________
> P4-discuss mailing list
> P4-discuss at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-discuss_lists.p4.org
>



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


More information about the P4-dev mailing list