tool to merge two P4 programs

12 views
Skip to first unread message

hem...@mnkcg.com

unread,
Nov 8, 2022, 3:24:02 PM11/8/22
to p4-...@lists.p4.org, p4-d...@lists.p4.org

In P4 dev meeting today, it was asked if means exist to merge two P4 programs.

 

See https://mnkcg.com/products/p4-ansible/

 

Please contact me if you’d like to try the tool for free. My company made changes to p4c frontend to create the tool. We have a Python wrapper to help use the modified p4c.  Also, once the two programs are merged and the merged program is compiled with a target compiler, a new control plane is generated for the merged P4 program.

 

Hemant

hem...@mnkcg.com

unread,
Nov 9, 2022, 12:16:23 AM11/9/22
to hem...@mnkcg.com, p4-...@lists.p4.org, p4-d...@lists.p4.org

I put the Python scripts and test P4 programs in a public repo. Feel free to improve any script and test with more P4 programs.

 

https://github.com/hesingh/mnkcg.git

 

See the p4-ansible directory under mnkcg.

 

Hemant

--
You received this message because you are subscribed to the Google Groups "p4-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p4-dev+un...@lists.p4.org.
To view this discussion on the web visit https://groups.google.com/a/lists.p4.org/d/msgid/p4-dev/020501d8f3b0%2407294b10%24157be130%24%40mnkcg.com.

hem...@mnkcg.com

unread,
Nov 10, 2022, 11:59:51 AM11/10/22
to p4-...@lists.p4.org, p4-d...@lists.p4.org

Our P4-Ansible tool uses a modified version of open-source p4c to merge P4 programs. The free version of the tool uses a p4c from two years ago. The free version does not include any Tofino examples. Usually, a Tofino with 12 stages, is using all stages in a production switch. However, the Tofino2 has 20 stages and then our tool can merge new P4 code with Tofino code and run the merged code on Tofino2.  Our paid version can remove/add specific functionality.

 

Thereafter, a software implementation of P4, e.g., P4toVPP or P4toDPDK, is even better for use of our tool.

hem...@mnkcg.com

unread,
Nov 13, 2022, 9:02:19 PM11/13/22
to hem...@mnkcg.com, p4-...@lists.p4.org, p4-d...@lists.p4.org

Please go to the bottom of this page and read new documentation added for P4 Modularity.  I am adding to docs as I get feedback from users.

 

https://github.com/hesingh/mnkcg/blob/master/p4-code-reuse/ansible.md

 

We tackled the hardest problem first – it was to merge P4 parsers. We don’t support fine-grained merging of P4 Control elements such as table key, table list of actions, and action. However, the design to merge such elements is complete and published in the above doc. Until fine grained P4 Control is supported, we support overriding of base control causing new control replacing base control.  In summary P4 merging is supported for the whole P4 Program with some manual merge operations when writing new code in P4++.

 

I stopped at this juncture until I get a customer who will fund the extra work.

 

Thanks,

 

Hemant

 

From: hemant via p4-design <p4-d...@lists.p4.org>
Sent: Wednesday, November 09, 2022 12:16 AM
To: hem...@mnkcg.com; p4-...@lists.p4.org; p4-d...@lists.p4.org

--
You received this message because you are subscribed to the Google Groups "p4-design" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p4-design+...@lists.p4.org.
To view this discussion on the web visit https://groups.google.com/a/lists.p4.org/d/msgid/p4-design/02c001d8f3fa%2465ad7630%2431086290%24%40mnkcg.com.

hem...@mnkcg.com

unread,
Nov 14, 2022, 4:43:12 AM11/14/22
to p4-...@lists.p4.org, p4-d...@lists.p4.org

To use the tool, the documentation asks to contact me to give access to download a p4c repo.

Please contact with a work email address, unless you are Andy Fingerhut, who I know already, and will add him with a non-work email address.

 

Thanks.

 

Hemant

Reply all
Reply to author
Forward
0 new messages