From a5646d504d3c6945235dc400ccd2aad278df58b1 Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Mon, 2 Mar 2026 14:13:04 -0800 Subject: [PATCH 1/3] Update ideas_list.md Signed-off-by: Matthew Lam --- 2026/ideas_list.md | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/2026/ideas_list.md b/2026/ideas_list.md index 88ae44fb75..083737cf27 100644 --- a/2026/ideas_list.md +++ b/2026/ideas_list.md @@ -65,7 +65,7 @@ It means we expect you to have made relevant contributions in order to demonstra ### Index **Category 1: Core P4 Tooling** - - [Under Review] [Project 1.1: Modernizing the P4 Software Switch BMv2](#project-1.1) + - [Project 1.1: BMv2 packet trace support](#project-1.1) **Category 2: Exploratory P4 Tooling** - [Project 2.1: Realistic Traffic Manager and Queueing Architecture for P4 Switch Simulation in ns-3 (P4sim)](#project-2.1) @@ -80,7 +80,7 @@ It means we expect you to have made relevant contributions in order to demonstra --- -### Project 1.1: Modernizing the P4 Software Switch BMv2 [⤴️](#index) +### Project 1.1: BMv2 packet trace support [⤴️](#index) **Note** @@ -107,24 +107,15 @@ Presently, BMv2 can only be built with CMake. The goal is to modernize BMv2 and Create a PR under https://github.com/p4lang/behavioral-model. **Project description** -BMv2 is a P4-based packet processor that has not been well maintained over the years due to lack of accessibility, slow builds/tests, lack of readability and complexity. One factor contributing towards the lack of accessibility is the difficulty of setting up the project prior to development. +Having programmatic access to the trace of a packet going through a P4 pipeline (e.g. applied tables, actions, entries hit, etc) has many use cases from human comprehension to use by automated tools for test coverage measurement, automated test generation, automated root causing, etc. -There are many different enhancements to the repository that can be made including: -* Extending support for BMv2 to build using Bazel -* Refactoring BMv2 to use Google style guide (https://google.github.io/styleguide/cppguide.html) - * Absl Integration - * Discourage exceptions (use status-based error propagation) - * Use smart pointer over manual memory - * Explicit constructors - * Flatten the directory structure - * Deprecating unused features -* Converting textual logs that manually track the packet through the pipeline into a structured and programmatic form (e.g. .proto) - * Can read more information [here](https://github.com/p4lang/gsoc/blob/main/2025/ideas_list.md#project-2). +BMv2 currently does provide textual logs that can be used to manually track the packet as it goes through the pipeline. However there is no API to access the trace in a more structured and programmatic form (i.e. in a way that can potentially be digested by other tools). +The goal of this project is to provide a mechanism for BMv2 to record the trace and provide it to the user in a structured format. **Expected outcomes** + * Building BMv2 using Bazel will make it easier to set up, manage dependencies, and faster builds and tests -* Improving readability of BMv2 and reducing complexity of the repository * Structured packet trace outputs supported in BMv2. **Resources** From ca2850b8846e4ddb91f6b0e5238c9a7a9c74c5aa Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Mon, 2 Mar 2026 14:21:27 -0800 Subject: [PATCH 2/3] Update ideas_list.md Signed-off-by: Matthew Lam --- 2026/ideas_list.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/2026/ideas_list.md b/2026/ideas_list.md index 083737cf27..371d8569f1 100644 --- a/2026/ideas_list.md +++ b/2026/ideas_list.md @@ -106,17 +106,21 @@ Presently, BMv2 can only be built with CMake. The goal is to modernize BMv2 and Create a PR under https://github.com/p4lang/behavioral-model. +Note: This must not break the current Make build system. + **Project description** Having programmatic access to the trace of a packet going through a P4 pipeline (e.g. applied tables, actions, entries hit, etc) has many use cases from human comprehension to use by automated tools for test coverage measurement, automated test generation, automated root causing, etc. -BMv2 currently does provide textual logs that can be used to manually track the packet as it goes through the pipeline. However there is no API to access the trace in a more structured and programmatic form (i.e. in a way that can potentially be digested by other tools). +BMv2 currently does provide textual logs that can be used to manually track the packet as it goes through the pipeline. However there is no API to access the trace in a more structured and programmatic form (i.e. in a way that can potentially be digested by other tools). Perhaps, using protobuf since protobuf supports serialization/deserialization to/from JSON. The goal of this project is to provide a mechanism for BMv2 to record the trace and provide it to the user in a structured format. **Expected outcomes** - * Building BMv2 using Bazel will make it easier to set up, manage dependencies, and faster builds and tests * Structured packet trace outputs supported in BMv2. +* Clean-up the code + * Higher performance data structures (ex. absl::flat_hash_map, ankerl::unordered_dense or phmap::flat_hash_map) + * Avoid using raw pointers and use smart pointers **Resources** * BMv2: https://github.com/p4lang/behavioral-model From a107360c863f1a86fa2c0e01fcc70fbec0c5a6cf Mon Sep 17 00:00:00 2001 From: Matthew Lam Date: Tue, 3 Mar 2026 10:07:49 -0800 Subject: [PATCH 3/3] Update ideas_list.md Signed-off-by: Matthew Lam --- 2026/ideas_list.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2026/ideas_list.md b/2026/ideas_list.md index 371d8569f1..31904fdfea 100644 --- a/2026/ideas_list.md +++ b/2026/ideas_list.md @@ -111,7 +111,7 @@ Note: This must not break the current Make build system. **Project description** Having programmatic access to the trace of a packet going through a P4 pipeline (e.g. applied tables, actions, entries hit, etc) has many use cases from human comprehension to use by automated tools for test coverage measurement, automated test generation, automated root causing, etc. -BMv2 currently does provide textual logs that can be used to manually track the packet as it goes through the pipeline. However there is no API to access the trace in a more structured and programmatic form (i.e. in a way that can potentially be digested by other tools). Perhaps, using protobuf since protobuf supports serialization/deserialization to/from JSON. +BMv2 currently does provide textual logs that can be used to manually track the packet as it goes through the pipeline. Currently, internally at Google, the BMv2 textual logs get parsed using Regex as there is no API to access the trace in a more structured and programmatic form (i.e. in a way that can potentially be digested by other tools). Perhaps, a structured form like protobuf may be used. Also, protobuf supports serialization/deserialization to/from JSON, which allows additional flexibility in the desired format. The goal of this project is to provide a mechanism for BMv2 to record the trace and provide it to the user in a structured format.