[RFC] ethdev: support MPLS tunnel encapsulation action
Checks
Commit 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>
---
doc/guides/prog_guide/rte_flow.rst | 54 ++++++++++++++++++++++++++++++++++++
lib/librte_ethdev/rte_flow.h | 54 ++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+), 0 deletions(-)
Comments
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>
@@ -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
~~~~~~~~~~~~~~
@@ -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.
*