DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC] ethdev: support MPLS tunnel encapsulation action
@ 2018-06-10  8:21 Ori Kam
  2018-06-11 10:55 ` Ori Kam
  0 siblings, 1 reply; 2+ messages in thread
From: Ori Kam @ 2018-06-10  8:21 UTC (permalink / raw)
  To: ferruh.yigit, declan.doherty, dev, adrien.mazarguil,
	nelio.laranjeiro, orika, shahafsh, matan

Due to time risk and to enable more discussion over
the proposed generic tunnel encapsulation [1]

This RFC only adds encapsulation for MPLS tunnel type,
which is based on the current tunnel encapsulaiton actions.

[1] http://dpdk.org/ml/archives/dev/2018-June/103485.html

Signed-off-by: Ori Kam <orika@mellanox.com>
---
 doc/guides/prog_guide/rte_flow.rst |   54 ++++++++++++++++++++++++++++++++++++
 lib/librte_ethdev/rte_flow.h       |   54 ++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index b305a72..e40f9fe 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -2076,6 +2076,60 @@ RTE_FLOW_ERROR_TYPE_ACTION error should be returned.
 
 This action modifies the payload of matched flows.
 
+Action: ``MPLS_L2_ENCAP``
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Performs MPLS encapsulation action over L2 inner packet by encapsulating
+the matched flow with the requested MPLS tunnel as defined in 
+the``rte_flow_action_mpls_l2_encap`` flow item
+definition.
+
+This action modifies the payload of matched flows. The flow definition specified
+in the ``rte_flow_action_mpls_l2_encap`` action structure must defined a valid
+MPLS network overlay. The pattern must be
+terminated with the RTE_FLOW_ITEM_TYPE_END item type.
+
+.. _table_rte_flow_action_mpls_l2_encap:
+
+.. table:: MPLS_ENCAP
+
+   +----------------+-------------------------------------+
+   | Field          | Value                               |
+   +================+=====================================+
+   | ``definition`` | MPLS end-point overlay definition  |
+   +----------------+-------------------------------------+
+
+.. _table_rte_flow_action_mpls_l2_encap_example:
+
+.. table:: IPv4 GRE MPLS flow pattern example.
+
+   +-------+----------+
+   | Index | Item     |
+   +=======+==========+
+   | 0     | Ethernet |
+   +-------+----------+
+   | 1     | IPv4     |
+   +-------+----------+
+   | 2     | GRE      |
+   +-------+----------+
+   | 3     | MPLS     |
+   +-------+----------+
+   | 4     | END      |
+   +-------+----------+
+
+Action: ``MPLS_l2_DECAP``
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Performs a decapsulation action by stripping all headers of the MPLS tunnel
+network overlay from the matched flow.
+
+The flow items pattern defined for the flow rule with which a ``MPLS_DECAP``
+action is specified, must define a valid MPLS tunnel. If the
+flow pattern does not specify a valid MPLS tunnel then a
+RTE_FLOW_ERROR_TYPE_ACTION error should be returned.
+
+This action modifies the payload of matched flows.
+
 Negative types
 ~~~~~~~~~~~~~~
 
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index f8ba71c..6edce68 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1505,6 +1505,23 @@ enum rte_flow_action_type {
 	 * error.
 	 */
 	RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
+
+	/**
+	 * Encapsulate flow in MPLS L2 tunnel defined in the
+	 * rte_flow_action_mpls_l2_encap action structure.
+	 *
+	 * See struct rte_flow_action_mpls_l2_encap.
+	 */
+	RTE_FLOW_ACTION_TYPE_MPLS_L2_ENCAP,
+
+	/**
+	 * Decapsulate outer most MPLS L2 tunnel from matched flow.
+	 *
+	 * If flow pattern does not define a valid MPLS L2 tunnel
+	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
+	 * error.
+	 */
+	RTE_FLOW_ACTION_TYPE_MPLS_L2_DECAP,
 };
 
 /**
@@ -1868,6 +1885,43 @@ struct rte_flow_action_nvgre_encap {
 	struct rte_flow_item *definition;
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_MPLS_L2_ENCAP
+ *
+ * MPLS l2 tunnel end-point encapsulation data definition
+ *
+ * The tunnel definition is provided through the flow item pattern.
+ * This action includes both MPLSoGRE and MPLSoUDP.
+ * The flow definition must be provided in order from the 
+ * RTE_FLOW_ITEM_TYPE_ETH definition up the end item,
+ * which is specified by RTE_FLOW_ITEM_TYPE_END.
+ *
+ * The mask field allows user to specify which fields in the flow item
+ * definitions can be ignored and which have valid data and can be used
+ * verbatim.
+ *
+ * Note: the last field is not used in the definition of a tunnel and can be
+ * ignored.
+ *
+ * Example of valid flow definition for RTE_FLOW_ACTION_TYPE_MPLS_L2_ENCAP:
+ *
+ * - ETH / IPV4 / GRE / MPLS / END
+ * - ETH / VLAN / IPV4 / GRE / MPLS / END
+ * - ETH / IPV4 / UDP / MPLS / END
+ * - ETH / VLAN / IPV4 / UDP / MPLS / END
+ *
+ */
+struct rte_flow_action_mpls_l2_encap {
+	/**
+	 * Encapsulating mpls tunnel definition
+	 * (terminated by the END pattern item).
+	 */
+	struct rte_flow_item *definition;
+};
+
 /*
  * Definition of a single action.
  *
-- 
1.7.1

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

* Re: [dpdk-dev] [RFC] ethdev: support MPLS tunnel encapsulation action
  2018-06-10  8:21 [dpdk-dev] [RFC] ethdev: support MPLS tunnel encapsulation action Ori Kam
@ 2018-06-11 10:55 ` Ori Kam
  0 siblings, 0 replies; 2+ messages in thread
From: Ori Kam @ 2018-06-11 10:55 UTC (permalink / raw)
  To: ferruh.yigit, declan.doherty, dev, Adrien Mazarguil,
	Nélio Laranjeiro, Matan Azrad

The generic encapsulation approach has been
replaced by this more specific MPLS API.

As a consequence it is better threaded as v2 of the
generic API proposal, which may be considered again for 
later release.

This version of the RFC is discarded in patchwork

> -----Original Message-----
> Due to time risk and to enable more discussion over
> the proposed generic tunnel encapsulation [1]
> 
> This RFC only adds encapsulation for MPLS tunnel type,
> which is based on the current tunnel encapsulaiton actions.
> 
> [1] http://dpdk.org/ml/archives/dev/2018-June/103485.html
> 
> Signed-off-by: Ori Kam <orika@mellanox.com>

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

end of thread, other threads:[~2018-06-11 10:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-10  8:21 [dpdk-dev] [RFC] ethdev: support MPLS tunnel encapsulation action Ori Kam
2018-06-11 10:55 ` Ori Kam

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