DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] examples/pipeline: simplify the L2 forwarding example
@ 2024-02-13 12:13 Cristian Dumitrescu
  2024-02-13 12:19 ` [PATCH V2] " Cristian Dumitrescu
  2024-02-15 19:26 ` [PATCH V3] examples/pipeline: simplify the L2 forwarding examples Cristian Dumitrescu
  0 siblings, 2 replies; 4+ messages in thread
From: Cristian Dumitrescu @ 2024-02-13 12:13 UTC (permalink / raw)
  To: dev

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(-)

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
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V2] examples/pipeline: simplify the L2 forwarding example
  2024-02-13 12:13 [PATCH] examples/pipeline: simplify the L2 forwarding example Cristian Dumitrescu
@ 2024-02-13 12:19 ` Cristian Dumitrescu
  2024-02-15 19:26 ` [PATCH V3] examples/pipeline: simplify the L2 forwarding examples Cristian Dumitrescu
  1 sibling, 0 replies; 4+ messages in thread
From: Cristian Dumitrescu @ 2024-02-13 12:19 UTC (permalink / raw)
  To: dev

Simplified the L2 forwarding examples by removing all tables and
actions, as they are not really needed for this simplest use-case.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 examples/pipeline/examples/l2fwd.spec | 34 +++++++--------------------
 1 file changed, 8 insertions(+), 26 deletions(-)

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
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V3] examples/pipeline: simplify the L2 forwarding examples
  2024-02-13 12:13 [PATCH] examples/pipeline: simplify the L2 forwarding example Cristian Dumitrescu
  2024-02-13 12:19 ` [PATCH V2] " Cristian Dumitrescu
@ 2024-02-15 19:26 ` Cristian Dumitrescu
  2024-02-19  0:55   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Cristian Dumitrescu @ 2024-02-15 19:26 UTC (permalink / raw)
  To: dev

Simplified the L2 forwarding examples by removing all tables and
actions, as they are not really needed for these simple use-cases.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 examples/pipeline/examples/l2fwd.spec        | 34 +++++-------------
 examples/pipeline/examples/l2fwd_macswp.spec | 36 ++++++--------------
 2 files changed, 19 insertions(+), 51 deletions(-)

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
 }
diff --git a/examples/pipeline/examples/l2fwd_macswp.spec b/examples/pipeline/examples/l2fwd_macswp.spec
index e81f20622e..4bd5c23c7a 100644
--- a/examples/pipeline/examples/l2fwd_macswp.spec
+++ b/examples/pipeline/examples/l2fwd_macswp.spec
@@ -1,6 +1,9 @@
 ; SPDX-License-Identifier: BSD-3-Clause
 ; Copyright(c) 2020 Intel Corporation
 
+; Layer 2 Forwarding with MACADDR swapping (i.e. within the Ethernet header of the output packet,
+; the destination MAC address is swapped with the source MAC address).
+
 //
 // Packet headers.
 //
@@ -22,37 +25,20 @@ struct metadata_t {
 
 metadata instanceof metadata_t
 
-//
-// Actions.
-//
-action macswp args none {
-	mov m.addr h.ethernet.dst_addr
-	mov h.ethernet.dst_addr h.ethernet.src_addr
-	mov h.ethernet.src_addr m.addr
-	return
-}
-
-//
-// Tables.
-//
-table stub {
-	key {
-	}
-
-	actions {
-		macswp
-	}
-
-	default_action macswp args none const
-}
-
 //
 // Pipeline.
 //
 apply {
 	rx m.port
 	extract h.ethernet
-	table stub
+
+	//
+	// Ethernet header: dst_addr swapped with src_addr.
+	//
+	mov m.addr h.ethernet.dst_addr
+	mov h.ethernet.dst_addr h.ethernet.src_addr
+	mov h.ethernet.src_addr m.addr
+
 	xor m.port 1
 	emit h.ethernet
 	tx m.port
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V3] examples/pipeline: simplify the L2 forwarding examples
  2024-02-15 19:26 ` [PATCH V3] examples/pipeline: simplify the L2 forwarding examples Cristian Dumitrescu
@ 2024-02-19  0:55   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2024-02-19  0:55 UTC (permalink / raw)
  To: Cristian Dumitrescu; +Cc: dev

15/02/2024 20:26, Cristian Dumitrescu:
> Simplified the L2 forwarding examples by removing all tables and
> actions, as they are not really needed for these simple use-cases.
> 
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied, thanks.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-19  0:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 12:13 [PATCH] examples/pipeline: simplify the L2 forwarding example Cristian Dumitrescu
2024-02-13 12:19 ` [PATCH V2] " Cristian Dumitrescu
2024-02-15 19:26 ` [PATCH V3] examples/pipeline: simplify the L2 forwarding examples Cristian Dumitrescu
2024-02-19  0:55   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).