[P4-dev] control-plane API generation

hemant at mnkcg.com hemant at mnkcg.com
Mon Sep 10 10:54:45 EDT 2018

Got it.  At the June 2018 P4 Workshop, in the Mellanox P4 to SAI demo, I asked where is the SAI API generated from in p4c?  I thought I heard, “by the midend”.   Since SAI is also independent of any asic, SAI API generation should also be invoked after the frontend.  Maybe, someone from Mellanox can confirm since I don’t see details in their slide nor the abstract.  I would like to what, if SAI API generation is done after the frontend processing, before any midend processing is run?






From: Antonin Bas <antonin at barefootnetworks.com> 
Sent: Monday, September 10, 2018 10:09 AM
To: hemant at mnkcg.com
Cc: p4-dev <p4-dev at lists.p4.org>
Subject: Re: [P4-dev] control-plane API generation


This is a hard rule as far as I'm concerned. We actually worked hard to ensure that API generation happens right after the frontend and does not depend on the backend (or the midend passes that this backend chooses to use). The generated P4Info message should be exactly the same independently of which backend you are using.

What we can do though is invoke midend passes independently of the backend in the P4Info generation code (https://github.com/p4lang/p4c/blob/master/control-plane/p4RuntimeSerializer.cpp#L1328). I believe that usually it is best avoided: you want the P4Info message / the runtime APIs to match exactly the contents of the P4 program.


On Wed, Sep 5, 2018 at 1:33 PM, <hemant at mnkcg.com <mailto:hemant at mnkcg.com> > wrote:

In the bmv2 backend, I see that P4Runtime/control-plane API generation is called in p4c/backends/bmv2/simple_switch/main.cpp after frontend.run().   Is this a hard rule or can one move the API generation, for example, to be after midend.process()?   


Thanks in advance.




MNK Consulting

http://mnkcg.com <http://mnkcg.com/> 


P4-dev mailing list
P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org> 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20180910/17c21053/attachment.html>

More information about the P4-dev mailing list