examples/pipeline: simplify the L2 forwarding example

Message ID 20240213121337.1521711-1-cristian.dumitrescu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series examples/pipeline: simplify the L2 forwarding example |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Cristian Dumitrescu Feb. 13, 2024, 12:13 p.m. UTC
  Simplified the L2 forwarding examples by removing all tables and
actions, as they are not really needed for this simplest use-case.
---
 examples/pipeline/examples/l2fwd.spec | 34 +++++++--------------------
 1 file changed, 8 insertions(+), 26 deletions(-)
  

Patch

diff --git a/examples/pipeline/examples/l2fwd.spec b/examples/pipeline/examples/l2fwd.spec
index 0aebafd07b..1e3e1ad040 100644
--- a/examples/pipeline/examples/l2fwd.spec
+++ b/examples/pipeline/examples/l2fwd.spec
@@ -1,42 +1,24 @@ 
 ; SPDX-License-Identifier: BSD-3-Clause
 ; Copyright(c) 2020 Intel Corporation
 
+; The simplest pipeline processing with just packet reception and transmission. No header parsing,
+; table lookup or action execution involved. Packets received on port 0 are sent out on port 1,
+; those received on port 1 are sent out on port 0, etc.
+
 //
 // Meta-data.
 //
 struct metadata_t {
-	bit<32> port_in
-	bit<32> port_out
+	bit<32> port
 }
 
 metadata instanceof metadata_t
 
-//
-// Actions.
-//
-action NoAction args none {
-	return
-}
-
-//
-// Tables.
-//
-table stub {
-	key {
-	}
-
-	actions {
-		NoAction
-	}
-
-	default_action NoAction args none const
-}
-
 //
 // Pipeline.
 //
 apply {
-	rx m.port_in
-	table stub
-	tx m.port_in
+	rx m.port
+	xor m.port 1
+	tx m.port
 }