[P4] Fwd: Actions in P4-16
Tejfel Máté
matej at caesar.elte.hu
Fri Nov 10 00:36:16 CET 2017
Sziasztok!
A mai megbeszélés alapján elkezdtem válaszolni (lásd lent). Kérlek
esetleg egészítsétek ki/pontosítsátok. Főleg a 4. és 6. pontra lehetne
kicsit bőbeszédűbb a válasz... Ha lehet péntek délután továbbküldeném
Cristian felé...
Köszi!
M.
2017-11-09 13:36 keltezéssel, Tejfel Máté írta:
>
>
>
>
> -------- Továbbított üzenet --------
> Tárgy: Actions in P4-16
> Dátum: Tue, 7 Nov 2017 17:16:50 +0000
> Feladó: Dumitrescu, Cristian <cristian.dumitrescu at intel.com>
> Címzett: Sándor Laki <lakis at inf.elte.hu>, Tejfel Máté
> <matej at caesar.elte.hu>, 'Horpácsi Dániel' <daniel-h at elte.hu>
> CC: Gergely.Pongracz at Ericsson.com <Gergely.Pongracz at Ericsson.com>,
> Kinsella, Ray <ray.kinsella at intel.com>, Ferriter, Cian
> <cian.ferriter at intel.com>, Zhu, Heqing <heqing.zhu at intel.com>
>
>
>
> Hi guys,
>
> I have read the P4-16 spec and I have some questions on actions, it
> would be great to have your input:
>
> 1.Action implementations. My takeaway is that actions are implemented
> using the two mechanisms below, did I miss any other mechanism?
>
> a.Statements and expressions. Similar to writing a C function.
> Departure from P4-14, where actions could only be built using a
> (small) predefined set of primitive actions.
>
> i.Inputs: packet headers, packet meta-data, table entry data
>
> ii.Outputs: packet headers, packet meta-data, (table entry data?)
>
> b.Extern object instantiations and extern functions. This allows
> pushing out of the language some P4-14 objects such as: meters,
> registers, counters.
>
Basically this s right but probably not this is the best classification,
because calling extern function will be also a statement, so you can
create block like this:
action actionA(){
externFun();
hdr.ethernet.srcAddr = hdr.ethernet.dstAddr;
}
As well as you can call an other action inside an action. For example:
action actionB(macAddr_t dstAddr){
actionA();
hdr.ethernet.dstAddr = dstAddr;
}
> 2.For a given table, several actions can be defined; each table entry
> (including the default entry) has exactly one action from the action
> list of the table, right?
>
Right. For one entry you can have one action with a given parameter list.
> a.If entry X does operations {A, B, C, D, E} and entry Y does
> operations {A, B, C, D, F}, we need to implement actionX (doing A, B,
> C, D,E) and actionY (doing A, B, C, D, F) explicitly and map them to
> entries X and Y, as opposed to saying: entry X executes actions A, B,
> C, D, E and entry Y executes actions A, B, C, D, F, right?
>
Technically you can create a common part: commonXY (doing A,B,C,D) and
call it from actionX and actionY, but basically right, you need two
different action.
>
> 3.Action portability. If we use extern objects and functions, the
> actions are not that portable anymore, right? They become target
> specific and P4 program can only work for that target.
>
You have to define the possible externs in the architecture file. So the
concept is, the program will be portable between targets supporting the
same architecture file.
>
> 4.Can an action modify the table entry data or is table entry data
> read-only?
>
Only the controller can modify table entry data. In an action you can
generate a digest to the controller "asking it" to modify the data...
>
> a.Example: implement a packet counter per flow; pkt hits table entry,
> a counter stored in the entry gets incremented. Is this possible in P4-16?
>
You can do something similar with the counter method, but in that case
the counter will not stored in the entry...
>
> 5.Do you have examples of P4-16 actions that you could share? The more
> examples the better.
>
For example you can find examples as exercises solutions of P4 tutorials
(in 2017). See https://github.com/p4lang/tutorials
>
> 6.Can somebody give me an example for the “implementation” key word
> from section 12.2.1.5 Additional properties and the associated concept
> of action profile, please ?
>
We have no real example, but if we understand well in this case you can
define the action list for a table as a list of external function calls.
Here you don not need to define precisely the external functions only
the maximum number of possible functions. Probably you can see P4_14
action_profile
construct for more detail.
>
> 7.When should we expect P4-16 support in the T4P4S compiler?
>
We like to create a T4P4S version supporting v1 model until end of
January 2018.
>
> Thanks very much for your help!
>
> Regards,
>
> Cristian
>
>
>
> _______________________________________________
> P4 mailing list
> P4 at plc.inf.elte.hu
> https://plc.inf.elte.hu/mailman/listinfo/p4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://plc.inf.elte.hu/pipermail/p4/attachments/20171110/5d9dcbfb/attachment-0001.html>
More information about the P4
mailing list