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
Cc: thomas@monjalon.net
Subject: [dpdk-dev] [RFC v2] ethdev: support MPLS tunnel encapsulation action
Date: Mon, 11 Jun 2018 13:46:39 +0300	[thread overview]
Message-ID: <1528713999-25914-1-git-send-email-orika@mellanox.com> (raw)
In-Reply-To: <1528213708-5247-1-git-send-email-orika@mellanox.com>

Until now MPLS tunnel is supported only for checksum and
TSO offloading.

IN DPDK 18.05 some encapsulation API has been added for
VXLAN and NVGRE.

This patch adds the encapsulation offload for the MPLS tunnel type.

Signed-off-by: Ori Kam <orika@mellanox.com>

---
v2: Specific MPLS encapsulation RFC

v1: generic tunnel encapsulation RFC [1].
The generic approach must be discussed some more
so it will not be ready for the 18.08 DPDK release.

This MPLS-specific API targets 18.08 and is based on the current
encapsulation API.

[1] http://dpdk.org/ml/archives/dev/2018-June/103485.html
---
---
 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

  parent reply	other threads:[~2018-06-11 10:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 15:48 [dpdk-dev] [RFC] ethdev: support " Ori Kam
2018-06-11  6:53 ` Nélio Laranjeiro
2018-06-11  7:27   ` Ori Kam
2018-06-11  7:53     ` Nélio Laranjeiro
2018-06-11 10:46 ` Ori Kam [this message]
2018-06-11 11:03 ` Ori Kam
2018-06-11 11:20   ` Thomas Monjalon

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=1528713999-25914-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 \
    --cc=thomas@monjalon.net \
    /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).