DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@mellanox.com>
To: ferruh.yigit@intel.com, declan.doherty@intel.com, dev@dpdk.org,
	adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com,
	orika@mellanox.com, shahafsh@mellanox.com, matan@mellanox.com
Subject: [dpdk-dev] [RFC] ethdev: support MPLS tunnel encapsulation action
Date: Sun, 10 Jun 2018 11:21:31 +0300	[thread overview]
Message-ID: <1528618891-978-1-git-send-email-orika@mellanox.com> (raw)

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

             reply	other threads:[~2018-06-10  8:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-10  8:21 Ori Kam [this message]
2018-06-11 10:55 ` Ori Kam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1528618891-978-1-git-send-email-orika@mellanox.com \
    --to=orika@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@mellanox.com \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=shahafsh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).