[P4-dev] Some questions about the architecture declaration P4_16language .

Mihai Budiu mbudiu at vmware.com
Mon Oct 23 11:51:58 EDT 2017


I apologize for the additional reply, the answer to the question 1 is “ideally yes”. The P4-14 language should stop evolving. In fact, P4-16 should not change either, we should perhaps have a new language P4-18 or something similar. Each version should be frozen once adopted.

From: P4-dev [mailto:p4-dev-bounces at lists.p4.org] On Behalf Of Mihai Budiu
Sent: Monday, October 23, 2017 8:40 AM
To: ding.rui at zte.com.cn; vladimir.gurevich at barefootnetworks.com
Cc: p4-dev at lists.p4.org
Subject: Re: [P4-dev] Some questions about the architecture declaration P4_16language .


1)      Ideally, no. Maybe to fix bugs only. P4-16 was designed to be a superset of P4-14.

2)      Yes, but the architecture file makes explicit the capabilities of the target.

3)      Yes, a platform can support multiple architectures. But someone needs to write a compiler for each architecture.

You should try to write superset.p4, I think you will discover that it’s not so easy.


Mihai

From: P4-dev [mailto:p4-dev-bounces at lists.p4.org] On Behalf Of ding.rui at zte.com.cn<mailto:ding.rui at zte.com.cn>
Sent: Sunday, October 22, 2017 11:12 PM
To: vladimir.gurevich at barefootnetworks.com<mailto:vladimir.gurevich at barefootnetworks.com>
Cc: p4-dev at lists.p4.org<mailto:p4-dev at lists.p4.org>
Subject: Re: [P4-dev] Some questions about the architecture declaration P4_16language .


Thank you Vladimir, I am learning the introduction video. I would like to ask a few other questions.

1) Will the P4_14 version stop evolving later? What is the relationship between the two versions later?

2) Why we need the architecture file? In my opinion, different targets have different backend compiler

    and we can know the architecture from chip datasheet in detail.

3) Can a hardware platform support multiple architectures? e.g. VSS, v1model and PSA. If so, just need

    to support their superset, in my program just only include the superset.p4.








原始邮件
发件人: <vladimir.gurevich at barefootnetworks.com<mailto:vladimir.gurevich at barefootnetworks.com>>;
收件人:丁瑞10106591;
抄送人: <p4-dev at lists.p4.org<mailto:p4-dev at lists.p4.org>>;
日 期 :2017年10月20日 11:45
主 题 :Re: [P4-dev] Some questions about the architecture declaration P4_16language .


Hello DingRui,
These are very good questions! The answers are as follows:

1) Why the first parameter (packet_in) has no direction?

The reason is that this is an extern, and externs do not have a direction. I think there are two main reasons for that:

1.      Externs do not follow copy-in/copy-out semantics, but are rather passed by reference.

2.      By looking at the definition of the extern methods, a compiler cannot really say what a particular extern method does to an extern (does it modify it, does it modify just the part we care about, does it modify something else, etc.). So, enforcing the direction is not really possible -- extern is a blackbox.
In the example you are referring to (packet_in in the parser), we do not know and cannot define the state packet_in will have after the packet leaves the parser. And the reason is -- we don't care (at least in VSS or V1 or PSA architectures), since we know we are not going to refer to this extern again.

2) Why the parser declaration use the keyword 'parser', while deparser declaration use 'control' ?

This happens because parsers are coded using FSM style and therefore contain parser states and control is passed via transition statement. In case of a deparser, there is no need to do that: a simple (mostly linear) control flow is all that is required and that's the style that is used inside the controls. Thus, deparsers (in VSS and other architectures I know of) are controls.

Having said that, please, understand that all these two constructs are is just a representation of two styles of expressing control flows. If you have an architecture, where the main ingress processing is done in some FSM (e.g. it's a regular expression parsing), the authors are free to use parser to represent that processing.

3) How to understand the extern objects in P4_16, I'm a little confused. Is it a functional unit physically?

As another shameless plug on this mailing list, I'd recommend the video Introduction to P4_16. Part 2<https://urldefense.proofpoint.com/v2/url?u=https-3A__youtu.be_yqxpypXIOtQ&d=DwMGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=FOLVBD65dvUjGbMLyiXnjuE_a7BeaYZiiBB4hnzjuXc&s=XLwA9vN4p1f-rNsvEXTLWlADfvorKa30HzwTqZowQIE&e=> specifically starting at the mark 45:27<https://urldefense.proofpoint.com/v2/url?u=https-3A__youtu.be_yqxpypXIOtQ-3Ft-3D45m27s&d=DwMGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=FOLVBD65dvUjGbMLyiXnjuE_a7BeaYZiiBB4hnzjuXc&s=86SR94Zp8G54Jp_-lssZujXbLv8t7R7EkiRYAKAa3o8&e=> as an introduction to what externs are. Physically they can come in any form or shape; the important thing is that we can't normally express in P4 what they are doing, but we do have mechanisms to interface with these objects and take advantages of their functionality.

Happy hacking,
Vladimir

On Thu, Oct 19, 2017 at 7:38 PM,  <ding.rui at zte.com.cn<mailto:ding.rui at zte.com.cn>> wrote:

Hi, everyone.

     In P4_16 language specifcation(version 1.0.0 2017-05-22) page 13, it provides a declaration of VSS in P4

language, I would like to ask a few conceptual questions.



1) Why the first parameter has no direction? What kind of parameters need direction?  I think the packet_in

parameter is an input of the parser. And I also want to know why the payload of the packet is not the output

of the parser?

parser Parser<H>(packet_in b,

                             out H parsedHeaders);



2)Why the parser declaration use the keyword 'parser', while deparser declaration use 'control' ?

   What are the differences between the two keywords in semantics?

control Pipe<H>(inout H headers,
                          in error parseError,// parser error
                          in InControl inCtrl,// input port
                          out OutControl outCtrl); // output port

control Deparser<H>(inout H outputHeaders,

                                  packet_out b);

3) How to understand the extern objects in P4_16, I'm a little confused. Is it a functional unit physically?











_______________________________________________
P4-dev mailing list
P4-dev at lists.p4.org<mailto:P4-dev at lists.p4.org>
http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.p4.org_mailman_listinfo_p4-2Ddev-5Flists.p4.org&d=DwMGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=tGW6TKXajnoXSyy1S1P4DHGPe8sj54GGvw-b21n7aWg&m=FOLVBD65dvUjGbMLyiXnjuE_a7BeaYZiiBB4hnzjuXc&s=72ABra6_sln2Gt_sa2wjOrsnvNVrRGXNfqvMiZ-fhOo&e=>



--
Vladimir Gurevich

Barefoot Networks
Technical Lead, Customer Engineering
Email: vag at barefootnetworks.com<mailto: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/20171023/45ef7636/attachment-0002.html>


More information about the P4-dev mailing list