P4 16 Language design - why tables are not allowed to be updated from Data plane

35 views
Skip to first unread message

Stavan Christian

unread,
May 21, 2023, 10:24:20 AM5/21/23
to p4-discuss

Hey

I was reading through P416 and P4Runtime specifications and was trying to understand the modification of tables - the look-up tables and not the table objects defined in the p4 program - and wanted to know/understand the design logic behind the following specifications: -

  1. In the sections 6.4.1 of P4Runtime API (P4~16~ Language Specification) and 14.2.1.4 of P416 specs (P4~16~ Language Specification), it simply mentions that table modifications can be done by Control Plane. It does not explicitly state anywhere that table updates are not possible by P4 prrograms installed on the target or via Dataplane. Is it true that table updates are only allowed via Control plane? If yes then please consider the following question as well: -
  2. Why are table modifications - add, delete, modification of table entries - only allowed through Control Plane? Why aren’t table updates possible via code logic in p4 programs via the Data plane? (For example, if packet processing metadata indicates increase or decrease in traffic on some link, then updating packet forwarding rules directly by calling necessary APIs from the packet processing pipeline.)

Stavan Christian

unread,
May 21, 2023, 12:34:43 PM5/21/23
to p4-discuss

Mario Baldi

unread,
May 21, 2023, 12:35:12 PM5/21/23
to Stavan Christian, p4-discuss

Hi Christian,

 

It is true that the language does not allow a P4 program to modify a table entry (in other words, the action data passed to an action as parameters).


As to why this is the case, I was not there when the decision was made, but I could imagine it was due to the fact that, especially in switches that operate with very large volumes of packets, implementing such a feature would be very challenging.

 

In work done in the context of the Portable NIC Architecture we have concluded that this could be a desirable feature in NICs, but the community has agreed that before deciding to modify the language specification we need to make sure that the feature is useful and that we know what is the best way to support it in the language.

Hence, we have defined the possibility of modifying table entries from the dataplane as experimental:

 

https://github.com/p4lang/p4-spec/pull/1239

 

This way we can see whether target vendors and developers will embrace it and, if so, whether the proposed changes to the language will prove suitable.

 

Best,

---

Mario

 

 

From: p4-di...@lists.p4.org <p4-di...@lists.p4.org> On Behalf Of Stavan Christian
Sent: Sunday, May 21, 2023 10:24 AM
To: p4-discuss <p4-di...@lists.p4.org>
Subject: [P4-discuss] P4 16 Language design - why tables are not allowed to be updated from Data plane

 

Hey

I was reading through P416 and P4Runtime specifications and was trying to understand the modification of tables - the look-up tables and not the table objects defined in the p4 program - and wanted to know/understand the design logic behind the following specifications: -

1.     In the sections 6.4.1 of P4Runtime API (P4~16~ Language Specification) and 14.2.1.4 of P416 specs (P4~16~ Language Specification), it simply mentions that table modifications can be done by Control Plane. It does not explicitly state anywhere that table updates are not possible by P4 prrograms installed on the target or via Dataplane. Is it true that table updates are only allowed via Control plane? If yes then please consider the following question as well: -

2.     Why are table modifications - add, delete, modification of table entries - only allowed through Control Plane? Why aren’t table updates possible via code logic in p4 programs via the Data plane? (For example, if packet processing metadata indicates increase or decrease in traffic on some link, then updating packet forwarding rules directly by calling necessary APIs from the packet processing pipeline.)

--
You received this message because you are subscribed to the Google Groups "p4-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p4-discuss+...@lists.p4.org.
To view this discussion on the web visit https://groups.google.com/a/lists.p4.org/d/msgid/p4-discuss/ce29f637-8451-46f5-9030-db579ec6282dn%40lists.p4.org.

Nate Foster

unread,
May 23, 2023, 7:05:01 AM5/23/23
to Mario Baldi, Stavan Christian, p4-discuss
Hi Stravan,

I see you've asked your question on all of the P4 channels -- Slack, email lists, and P4 Forum. And you're getting answers from different people on different channels. Let me propose that folks continue the discussion on the P4 Forum.

Mario discusses one possible interpretation of data plane modifications of tables -- modifying values provided as action parameters.

As Andy Fingerhut nicely explained in his P4 Forum post (https://forum.p4.org/t/p4-16-language-design-why-tables-are-not-allowed-to-be-updated-from-data-plane/783/5), the P4 language does not forbid data plane updates to table entries, though it certainly emphasizes the common case, where table entries are maintained by the control plane. This emphasis is primarily driven by the capabilities of current high-speed hardware targets. It is not a fundamental language restriction. For instance, the Portable NIC Architecture (PNA) explicitly supports it using special properties like add-on-miss. In the future, the Language Design Working Group could consider other language constructs to support it.

-N

Stavan Christian

unread,
Jun 10, 2023, 2:30:01 AM6/10/23
to p4-discuss, Nate Foster, Stavan Christian, p4-discuss, Mario Baldi
Thank you so much for your response @Nate.
I apologise for posting the same question on multiple forums.

I had a query - Is data plane, specifically the P4 program aware of table entry updates made by the control plane? I understand the answers a no, since P4RT server calls switch OS/SDK to make table updates and P4 programs are not involved in that process pipeline.
Please correct me if am wrong.

Andy Fingerhut

unread,
Jun 11, 2023, 1:25:55 PM6/11/23
to Stavan Christian, p4-discuss, Nate Foster, Mario Baldi
Hopefully you will not mind if I copy your question to add it to this web forum question, and give my answer there: P4 16 Language design - why tables are not allowed to be updated from Data plane - Language Design Working Group - P4 Programming Language

Andy

Reply all
Reply to author
Forward
0 new messages