From 2167c221011ef6389705b144a22c1a2bf52278a9 Mon Sep 17 00:00:00 2001 From: Steffen Smolka Date: Wed, 9 Feb 2022 12:27:19 -0800 Subject: [PATCH 1/2] Support for specifying type translations as part of the forwarding configuration. --- proto/p4/v1/p4runtime.proto | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/proto/p4/v1/p4runtime.proto b/proto/p4/v1/p4runtime.proto index 1787f5ce..f9ff3fd5 100755 --- a/proto/p4/v1/p4runtime.proto +++ b/proto/p4/v1/p4runtime.proto @@ -714,6 +714,16 @@ message ForwardingPipelineConfig { uint64 cookie = 1; } Cookie cookie = 3; + // Optional: Translations for `@p4runtime_translation`-annotated types, keyed + // by the unique resource identifiers (URIs) of the types. + map p4runtime_translation_by_uri = 4; +} + +message P4RuntimeTranslation { + // Specifies the mapping between values in P4 and values in P4Runtime for + // some type annotated with a `@p4runtime_translation`. The mapping is + // required to be reversible (injective). + map p4_value_by_p4runtime_value; } message GetForwardingPipelineConfigRequest { From b9a833c0e08f113e9f62a39125929d012b54188b Mon Sep 17 00:00:00 2001 From: Steffen Smolka Date: Wed, 9 Feb 2022 15:04:37 -0800 Subject: [PATCH 2/2] Support static and dynamic p4runtime translations. --- proto/p4/v1/p4runtime.proto | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/proto/p4/v1/p4runtime.proto b/proto/p4/v1/p4runtime.proto index f9ff3fd5..f014447f 100755 --- a/proto/p4/v1/p4runtime.proto +++ b/proto/p4/v1/p4runtime.proto @@ -721,9 +721,21 @@ message ForwardingPipelineConfig { message P4RuntimeTranslation { // Specifies the mapping between values in P4 and values in P4Runtime for - // some type annotated with a `@p4runtime_translation`. The mapping is - // required to be reversible (injective). - map p4_value_by_p4runtime_value; + // some type annotated with a `@p4runtime_translation`. + oneof translation { + // Static mapping, given by an explicit, reversible (injective) map. + Static static = 1; + // Dynamic mapping, to be generated by the switch lazily at runtime. + // Whenever a P4Runtime value is seen by the switch for the first time, it + // is mapped to a fresh P4 value; this mapping is then persisted and applied + // to all further occurrences of the P4Runtime value. + Dynmaic dynamic = 2; + } + + message Static { + map p4_value_by_p4runtime_value = 1; + } + message Dynamic {} } message GetForwardingPipelineConfigRequest {