[P4-dev] Contribution to P4 development

Antonin Bas antonin at barefootnetworks.com
Mon Jun 1 19:14:41 EDT 2015


Hi Sandor,

Thanks for your interest in p4 and the p4lang code.
Please see answers inline.

On Mon, Jun 1, 2015 at 9:39 AM, Sandor Laki <lakis at elte.hu> wrote:

> Dear All,
>
> In collaboration with one of our industrial partners, we started analysing
> the capabilities of P4 about a month ago.  We had first made an attempt to
> implement a L2-demo with mac learning, and after that we realized that you
> also moved into this direction (l2_switch appeared in github [p4factory]).
>
> However, the current implementation of pd-cli in p4factory is not
> complete. E.g. to make l2_switch partially work in Mininet, we had to
> extend pd-cli with e.g. the method set_default_action, and other methods
> needed for Mininet testing seems not being available there. Currently, we
> are working on extending pd-cli with the necessary functions that may be
> useful to directly add to the master branch of p4factory instead of fixing
> our local copy. We would be happy to contribute to the effort directly. How
> can we move forward into this direction?
>

There is currently no plan to extend pd_cli, which is why we would be
thrilled if you could contribute some code. The best way to do that is to
fork the p4factory repository through Github, commit code to your fork and
then submit a pull request. I will then review this pull request,
optionally comment on it, then merge it into the master branch.


>
> Furthermore, in the example implementation available on github we have
> experienced that if there is no rule that matches in a given table, the
> switch simply drops the packet instead of doing nothing. E.g. in case of
> l2_switch we apply smac and dmac on ingress traffic sequentially, however
> if smac is empty and default action is not set, the packet is simply
> dropped and dmac is not applied at all. Is it a normal behaviour or a bug?
>

The current p4 specification states that:
"If no default action is specified and no entry matches, the table does not
affect the packet and processing continues according to the imperative
control
flow"  (page 52)
The correct behavior would therefore be to simply continue to the next
table. However the switch implementation on p4lang (the behavioral model)
does not implement this correctly. If no rule matches and no default action
were specified, the packet will skip to the end of the pipeline.
This inconsistency is due to an evolution of the spec and we will try to
correct it in the future to make the switch implementation consistent.


>
> Finally, mac learning requires two tables smac and dmac, however their key
> sets are basically always the same. So in a practical implementation they
> could use the "same" lookup table, storing the mac addresses only once. Are
> you planning to handle it in the language (e.g. by adding a marking that
> dmac table extends smac or they share the same key values) or it should be
> done outside P4 e.g. via specific compiler options?
>

Because of current hardware architecture constraints, we originally chose
not to include this in the language. Most hardware would actually need to
duplicate the table in memory to allow for multiple consecutive lookups.
However, we are currently working on the P4 language to make it more
flexible and able to leverage the abilities of a wider range of network
devices, and this kind of optimization may be useful for some targets. It
is too early to say what this specific case may look like though. We may
end up with some marking in the language and it will be left to the
target-specific compiler to leverage this marking (or ignore it).


Best,
Antonin


>
> Thank you for your reply in advance!
>
> Best,
> Sandor
>
> --
> Sándor Laki
> Department of Information Systems
> Eötvös Loránd University
> Pázmány Péter stny. 1/C
> H-1117, Budapest, Hungary
> Room 2.506
> Web: http://lakis.web.elte.hu
> Phone: +36 1 372 2869 / 8477
> Cell: +36 70 374 2646
>
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at mail.p4.org
> Listinfo - http://mail.p4.org/mailman/listinfo/p4-dev_p4.org
> Archives - http://mail.p4.org/pipermail/p4-dev_p4.org/
>



-- 
Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150601/f2a4c088/attachment-0001.html>


More information about the P4-dev mailing list