[P4-dev] Query regarding P4 bmv2 code versions and specs

Hardik Soni hardik.soni at inria.fr
Tue Aug 1 16:24:45 EDT 2017


great... 
Thanks Antonin, for the confirmation on P4Objects::init_objects method. 
-Hardik 

----- Original Message -----

> From: "Antonin Bas" <antonin at barefootnetworks.com>
> To: "Andy Fingerhut" <andy.fingerhut at gmail.com>
> Cc: "Hardik Soni" <hardik.soni at inria.fr>, "p4-dev" <p4-dev at lists.p4.org>
> Sent: Tuesday, 1 August, 2017 8:27:29 PM
> Subject: Re: [P4-dev] Query regarding P4 bmv2 code versions and specs

> The JSON format is meant to be the same whether the program is compiled with
> the old compiler (P4_14 only) or the new one (P4_14 or P4_16). The two
> compilers may produce different JSON files for the same P4_14 program, just
> like gcc and clang would produce different assembly code. But the format is
> the same and the P4Objects::init_objects method is not affected by which
> version of the compiler or which version of the language you are using. Of
> course, you may run into some issues with the new compiler (
> https://github.com/p4lang/p4c ) as it is not as mature, but we would be
> happy to help you solve them.

> On Tue, Aug 1, 2017 at 9:21 AM, Andy Fingerhut < andy.fingerhut at gmail.com >
> wrote:

> > Q1:
> 

> > If you go to p4.org and click on the SPEC link near the upper right you get
> > to this page: https://p4lang.github.io/p4-spec/
> 

> > That is where the most recently released versions of the language specs are
> > published. It currently includes v1.0.4 of the P4_14 language, which is
> > still the same syntax as older versions of the P4_14 language, and version
> > 1.0.0 of the P4_16 language, which has a noticeably different syntax.
> 

> > Q2:
> 

> > I have run this bash script to mostly automate the steps given in the
> > relevant README's for the behavioral-model and p4c Github projects, to get
> > a
> > copy of those repositories and build them. As mentioned in the READMEs, it
> > also gets a copy of Google protobuf and builds and installs that, required
> > for building p4c.
> 

> > https://github.com/jafingerhut/p4-guide/blob/master/bin/install-p4dev.sh
> 

> > I have only ever tested that script on an Ubuntu 16.04 Linux machine.
> 

> > Q3:
> 

> > I do not know enough about the init_objects() method that you mention to
> > know
> > whether there are any significant differences in how that method is called
> > between P4_14 and P4_16 JSON files produced by the compiler. Sorry. Perhaps
> > someone else can help there, or you can just try an experiment with it and
> > see if things go well.
> 

> > Andy
> 

> > On Tue, Aug 1, 2017 at 3:29 AM, Hardik Soni < hardik.soni at inria.fr > wrote:
> 

> > > Hello All,
> > 
> 

> > > I need some information on versions of specs, p4c code and bmv2 code.
> > 
> 

> > > Q1:
> > 
> 

> > > There is a spec ( Version 1.0.3) of P416 dated November 2, 2016.
> > 
> 
> > > That BNF is not of P416 compiler, am I right?
> > 
> 
> > > A recent, May 2017, spec has different grammar.
> > 
> 

> > > Q2:
> > 
> 
> > > I have BMV2 clone with following last commit.
> > 
> 
> > > ----------------------------------------------------------------------
> > 
> 

> > > commit 41c1f2ed487ff086a1d582069e8bc68cab8ffdb0
> > 
> 
> > > Author: Antonin Bas < antonin at barefootnetworks.com >
> > 
> 
> > > Date: Fri Jul 7 11:49:00 2017 -0700
> > 
> 

> > > Fix installation for simple_switch_grpc (#409)
> > 
> 
> > > Fixed error: "Recursive variable 'includep4bmdir' references itself"
> > 
> 

> > > ----------------------------------------------------------------------
> > 
> 

> > > And
> > 
> 

> > > I have p4c compiler clone with following last commit.
> > 
> 

> > > ----------------------------------------------------------------------
> > 
> 

> > > commit ae458b34014e23f095accac80088757a07612a7a
> > 
> 
> > > Author: Calin Cascaval < cascaval at barefootnetworks.com >
> > 
> 
> > > Date: Tue Jul 11 21:02:41 2017 -0700
> > 
> 

> > > proper path to include directory
> > 
> 

> > > ----------------------------------------------------------------------
> > 
> 

> > > If any one can confirm the exact commands to compile for
> > > bmv2(simple_switch
> > > target) and run on it, it will be great.(for the above commit versions)
> > 
> 

> > > Though, I used python script in mininet folder.
> > 
> 

> > > And the most important question
> > 
> 

> > > Q3:
> > 
> 

> > > I could run simple_router json file(probably precompile from P414 ) on
> > > bmv2
> > > simple_router target.
> > 
> 

> > > It could run safely.
> > 
> 

> > > So, is there any big change in execution of json files of P414 and p416?
> > 
> 

> > > Being more precise, my code heavily depends on
> > 
> 

> > > P4Objects::init_objects(std::istream *is, LookupStructureFactory
> > > *lookup_factory, int device_id, size_t cxt_id,
> > 
> 

> > > std::shared_ptr<TransportIface> notifications_transport, const
> > > std::set<header_field_pair>
> > 
> 

> > > &required_fields, const ForceArith &arith_objects) {
> > 
> 

> > > /* All the data structures(maps and vectors etc) being initialized here
> > > */
> > 
> 

> > > }
> > 
> 

> > > Is there any difference in filling up the data-structures for P4-14 and
> > > p4-16
> > > jsons?
> > 
> 

> > > Best Regards,
> > 
> 
> > > Hardik Soni
> > 
> 

> > > _______________________________________________
> > 
> 
> > > P4-dev mailing list
> > 
> 
> > > P4-dev at lists.p4.org
> > 
> 
> > > http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
> > 
> 

> > _______________________________________________
> 
> > P4-dev mailing list
> 
> > P4-dev at lists.p4.org
> 
> > http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
> 

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


More information about the P4-dev mailing list