From d5bd84bed6b697a2e2b041f5bdd440386df6db52 Mon Sep 17 00:00:00 2001 From: Alan Lo Date: Mon, 7 Aug 2023 23:33:45 -0600 Subject: [PATCH] WIP: Reconfiguration APIs to allow multiple P4 pipelines to be chained. Operations include add, remove, enable and disable pipeline. Each pipeline has a unique pipeline ID. Entities are referenced per pipeline. SetForwardingPipelineConfig allows the user to specify the placement of a new pipeline relative to the reference/default pipeline in the ForwardingPipelineConfig --- proto/p4/v1/p4runtime.proto | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/proto/p4/v1/p4runtime.proto b/proto/p4/v1/p4runtime.proto index bcb9266b..3dfbc1e3 100755 --- a/proto/p4/v1/p4runtime.proto +++ b/proto/p4/v1/p4runtime.proto @@ -124,6 +124,23 @@ message Update { Entity entity = 2; } +// Pipeline ID to uniquely identify a pipeline on a device. +message PipelineId { + uint32 id = 1; + bool enabled = 2; // Indicates if the pipeline is enabled or disabled. +} + +// Define a message to specify the position for a new pipeline. +message PipelinePosition { + enum RelativePosition { + NONE = 0; + BEFORE = 1; + AFTER = 2; + } + PipelineId reference_id = 1; // The ID of the reference pipeline. + RelativePosition position = 2; // Load the new pipeline BEFORE or AFTER the reference pipeline. +} + message Entity { oneof entity { ExternEntry extern_entry = 1; @@ -139,6 +156,8 @@ message Entity { RegisterEntry register_entry = 11; DigestEntry digest_entry = 12; } + // Optionally specify the target pipeline. Default is the primary pipeline. + PipelineId pipeline_id = 100; } message ExternEntry { @@ -730,6 +749,17 @@ message ForwardingPipelineConfig { uint64 cookie = 1; } Cookie cookie = 3; + // Extend to support multiple pipeline operations + enum PipelineOperation { + ADD = 0; // Add a new pipeline. + REMOVE = 1; // Remove an existing pipeline. + UPDATE = 2; // Update an existing pipeline. + ENABLE = 3; // Enable a loaded pipeline. + DISABLE = 4; // Disable a loaded pipeline. + } + PipelineOperation operation = 4; // Define the operation type: ADD, REMOVE, or UPDATE. + PipelineId pipeline_id = 5; // ID to identify the pipeline. For ADD, this can be auto-generated by the server. + PipelinePosition pipeline_position = 6; // Position for the pipeline (relevant for ADD operation). } message GetForwardingPipelineConfigRequest {