[P4-dev] Few questions on the working of P4

Leo Alterman leo at barefootnetworks.com
Wed Jun 24 14:27:50 EDT 2015


> For the second question, my guess is that the possible actions will help
to hint the compiler to provision some necessary resources on specific
targets. If this is the case, then this requirement should be made optional
because in some other platforms, this is not necessary at all and could
even hurt the potential flexibility.  Correct me if I’m wrong.

More importantly, it provides guarantees about the control flow and
behavior of a P4 program (to both the compiler and programmer). Looking at
a P4 table, you can map out exactly which parts of the packet may be
modified and how.

By analogy: computers can technically jump to any point in instruction
memory, but C limits program flow using function call semantics. This hurts
flexibility but helps us reason about the code immensely. Similarly, P4
makes guarantees about the actions a table can execute and from this you
can reason about what a given match action table may do to a packet.

~Leo

On Wed, Jun 24, 2015 at 11:13 AM, Haoyu song <haoyu.song at huawei.com> wrote:

>  For the second question, my guess is that the possible actions will help
> to hint the compiler to provision some necessary resources on specific
> targets. If this is the case, then this requirement should be made optional
> because in some other platforms, this is not necessary at all and could
> even hurt the potential flexibility.  Correct me if I’m wrong.
>
>
>
> -Haoyu
>
>
>
> *From:* P4-dev [mailto:p4-dev-bounces at p4.org] *On Behalf Of *Anubhav Nidhi
> *Sent:* Tuesday, June 23, 2015 6:49 PM
> *To:* p4-dev at p4.org
> *Subject:* [P4-dev] Few questions on the working of P4
>
>
>
> Hi,
>
>      I am new to P4. After reading the P4 specification paper and trying
> out the example given here
> <https://github.com/p4lang/p4factory/tree/master/targets/simple_router>,
> I have following questions regarding P4
>
> 1.    Do you have any code/repository which generates the JSON version of
> the P4 compiler output?
>
> 2.    Also just want to make sure I understand how the table entries
> work. Right now the example given in simple router here
> <https://github.com/p4lang/p4factory/tree/master/targets/simple_router> says
> that to enter a rule like drop packet with ip.dest = A1, I need to manually
> enter a entry in a table e.g. add_entry table1 10.0.0.10 32 *_drop*. Is
> the manually entering the table entry true? If that is the case and I need
> to enter the action-name (name given in action specification) manually in
> the table, then what is the purpose of mentioning the possible actions used?
>
>
>
> Thanks,
>
> Archie
>
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at p4.org
> Listinfo - http://mail.p4.org/mailman/listinfo/p4-dev_p4.org
> Archives - http://mail.p4.org/pipermail/p4-dev_p4.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150624/bcb15e8a/attachment-0001.html>


More information about the P4-dev mailing list