[P4-dev] Dynamically loading P4 Modification

Vladimir Gurevich vladimir.gurevich at barefootnetworks.com
Sun Oct 15 11:31:12 EDT 2017


Hello Satish,

Let me expand Nate's answer a little bit.

One of the most interesting properties of P4 is that the compiler
automatically generates two outputs for each P4 program:

   1. The compiled code for the data plane program in a form suitable to be
   loaded on the target
   2. The set of APIs that control plane can use to control that data plane
   program

While the details of the API are not yet standardized and are currently
platform-specific, the essence is that if an object has a name in a P4
program, a set of APIs can be generated for it.

Today, all the implementations I am familiar with provide APIs to manage
entries in the tables, get counters, set meter configurations, etc.
However, P4 controls, parser states, etc. also have names and thus (even
though no implementations known to me do that) it is not inconceivable that
future implementations will provide APIs such as:

   - Set action code (or create new action) that will take the action name
   and a string, representing action code in some language (not even
   necessarily in P4). Or for the SW implementations it might not be a string,
   but a pointer to a C function
   - Add action to a table that will take a table name and an action and
   add action to the table
   - Set control code that will take a name of a P4 control and a string,
   representing the desired code in some language (or a pointer to precompiled
   code)
   - etc, etc.

Again, various implementations might be more or less conducive to these
APIs, but even the implementations, based on the high-speed ASICs might
support some. Software-based implementations especially (e.g. the likes of
BMv2) can be very flexible. Again, I do not think these capabilities exits
yet but maybe you'll be the first one to implement something like this. The
point is that the language itself does support (or, better, is agnostic to)
such flexibility.

The new P4Runtime framework that has been recently announced is quite
flexible and should be able to accommodate a variety of such APIs once the
need arises.

Happy hacking,
Vladimir

On Sun, Oct 15, 2017 at 2:16 AM, Nate Foster <jnfoster at cs.cornell.edu>
wrote:

> It depends. Whether or not a device supports this functionality is not
> mandated by P4.
>
> However, I believe some targets will/do support such dynamic
> reconfiguration.
>
> -N
>
> On Sun, Oct 15, 2017 at 5:04 AM, satish karunanithi <satish.fdio at gmail.com
> > wrote:
>
>> Ok Thanks.
>>
>> If a program or fix can be compiled and loaded dynamically like the
>> patch/ inservice upgradation can this new patch can be loaded into system
>> without restarting this process or target.
>>
>> On Sun, Oct 15, 2017 at 2:22 PM, Nate Foster <jnfoster at cs.cornell.edu>
>> wrote:
>>
>>> Can i add some new actions/tables which was not pre-compiled initially?
>>>>
>>>
>>> No.
>>>
>>>
>>>> Can on existing p4 switch can i add one new table without restarting
>>>> the switch?
>>>>
>>>
>>> Depends on the switch and what exactly you mean by restarting.
>>>
>>> -N
>>>
>>
>>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>



-- 
*Vladimir Gurevich*

*Barefoot Networks*
*Technical Lead, Customer Engineering*
Email: 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/20171015/db568afc/attachment-0002.html>


More information about the P4-dev mailing list