[P4-dev] Extern objects: examples

Antonin Bas antonin at barefootnetworks.com
Tue May 9 13:28:31 EDT 2017


That's a good point. We are working on the Portable Switch Architecture
(PSA) definition, which will be the de facto standard architecture for
P4_16 programs: https://github.com/p4lang/p4c/pull/569
Once it is defined, the architecture will eventually be implemented using
the bmv2 library and will replace simple_switch. You can look at
https://github.com/p4lang/bmv2-psa, even though this repo is no longer
up-to-date. At that point we will need to have full extern support in the
p4c bmv2 backend and we will have a way to test the code because bmv2-psa
will include externs.
However, I am not sure that should prevent you from submitting a pull
request with some code. We have to start somewhere :)

On Mon, May 8, 2017 at 7:12 PM, Jeferson Santiago da Silva <
eng.jefersonsantiago at gmail.com> wrote:

> Hey Antonin,
>
> good to hear from you.
> I think it is a good idea. I have just one doubt: how to to add an auto
> test for it? Could you enlighten me? I think it is a bit trick since extern
> methods are target specific, and then not supported in the original bmv2.
> All tests I made required modifications in the bmv2. One awful idea would
> be to add a "standard" extern in the bmv2.
>
> Let me know what you think on that.
>
> Regards,
> Jeferson
>
> 2017-05-08 18:36 GMT-04:00 Antonin Bas <antonin at barefootnetworks.com>:
>
>> Hi Jeferson,
>>
>> Thanks for sending this to the list. I believe the p4c bmv2 backend
>> ("json generator") is undergoing some serious code refactoring at the
>> moment. However, support for arbitrary externs is definitely a priority.
>> Since you have already written some code for this, it may be a good idea to
>> open a pull request in p4lang/p4c. What do you think?
>>
>> Thanks,
>>
>> Antonin
>>
>> On Sun, May 7, 2017 at 5:37 PM, Jeferson Santiago da Silva <
>> eng.jefersonsantiago at gmail.com> wrote:
>>
>>> Dear all,
>>>
>>> I've seen recently some questions regarding external methods with P4. So
>>> I decided to share something.
>>>
>>> I worked last year with extern methods in the version 1.1, the same one
>>> that has been deprecated. I modified the json generator and with Antonin's
>>> support it was pushed to the p4c-bm repo.
>>>
>>> In meantime, the P4-16 language and compiler was developed. Lots of
>>> extern methods are available, but all of them are seen as primitives in the
>>> BMv2. So, I modified the p4c json generator to test "actual" extern
>>> instances with the new P4-16 version.
>>>
>>> I invite all you that are interested in extern methods to visit my
>>> github page. There I have implemented externs for both P4-14 (1.1) and
>>> P4-16.
>>>
>>> https://github.com/engjefersonsantiago/p4-programs
>>>
>>> Regards,
>>> Jeferson
>>>
>>> --
>>> Jeferson Santiago da Silva, M.Sc.
>>> <http://br.linkedin.com/in/engjefersonsantiago>
>>> Polytechnique Montréal
>>> Ph.D. Candidate in Computer Engineering
>>> Hardware and Programmable Logic Design Engineer
>>> Phone: +1 (514) 581-1004 <(514)%20581-1004>
>>> Skype: eng.jefersonsantiago
>>> Montreal/QC - Canada
>>> Lattes CV: http://lattes.cnpq.br/9568850258686622
>>>
>>> _______________________________________________
>>> P4-dev mailing list
>>> P4-dev at lists.p4.org
>>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>>
>>
>>
>>
>> --
>> Antonin
>>
>
>
>
> --
> Jeferson Santiago da Silva, M.Sc.
> <http://br.linkedin.com/in/engjefersonsantiago>
> Polytechnique Montréal
> Ph.D. Candidate in Computer Engineering
> Hardware and Programmable Logic Design Engineer
> Phone: +1 (514) 581-1004 <(514)%20581-1004>
> Skype: eng.jefersonsantiago
> Montreal/QC - Canada
> Lattes CV: http://lattes.cnpq.br/9568850258686622
>



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


More information about the P4-dev mailing list