[1/8] librte_ethdev: add new flow types and action
diff mbox series

Message ID 1591194009-4086-2-git-send-email-bernard.iremonger@intel.com
State New
Delegated to: Ferruh Yigit
Headers show
Series
  • add flow action map
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-testing warning Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Iremonger, Bernard June 3, 2020, 2:20 p.m. UTC
In rte_flow.h:
add RTE_FLOW_ITEM_TYPE_PCTYPE
add RTE_FLOW_ITEM_TYPE_FLOWTYPE
add RTE_FLOW_ACTION_TYPE_MAP
add structs and masks for new flow types

In rte_flow.rst:
add items for pctype and flowtype
add action for map

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 doc/guides/prog_guide/rte_flow.rst | 55 +++++++++++++++++++++++++++
 lib/librte_ethdev/rte_flow.h       | 78 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+)

Patch
diff mbox series

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index d5dd18c..9b54154 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1362,6 +1362,44 @@  Matches a PFCP Header.
 - ``seid``: session endpoint identifier.
 - Default ``mask`` matches s_field and seid.
 
+Item: ``PCTYPE``
+^^^^^^^^^^^^^^^^
+
+Matches a PCTYPE
+
+.. _table_rte_flow_item_pctype:
+
+.. table:: PCTYPE
+
+   +----------+----------+---------------------------------------+
+   | Field    | Subfield | Value                                 |
+   +==========+==========+=======================================+
+   | ``spec`` | ``data`` | 64 bit pctype value                   |
+   +----------+----------+---------------------------------------+
+   | ``last`` | ``data`` | upper range value                     |
+   +----------+----------+---------------------------------------+
+   | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" |
+   +----------+----------+---------------------------------------+
+
+Item: ``FLOWTYPE``
+^^^^^^^^^^^^^^^^^^
+
+Matches a FLOWTYPE
+
+.. _table_rte_flow_item_flowtype:
+
+.. table:: FLOWTYPE
+
+   +----------+----------+---------------------------------------+
+   | Field    | Subfield | Value                                 |
+   +==========+==========+=======================================+
+   | ``spec`` | ``data`` | 16 bit flowtype value                 |
+   +----------+----------+---------------------------------------+
+   | ``last`` | ``data`` | upper range value                     |
+   +----------+----------+---------------------------------------+
+   | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" |
+   +----------+----------+---------------------------------------+
+
 Actions
 ~~~~~~~
 
@@ -2645,6 +2683,23 @@  timeout passed without any matching on the flow.
    | ``context``  | user input flow context         |
    +--------------+---------------------------------+
 
+Action: ``MAP``
+^^^^^^^^^^^^^^^
+
+Map pctype to flowtype.
+
+.. _table_rte_flow_action_map:
+
+.. table:: MAP
+
+   +--------------+---------------------------------+
+   | Field        | Value                           |
+   +==============+=================================+
+   | ``pctype``   | 64 bit pctype value             |
+   +--------------+---------------------------------+
+   | ``flowtype`` | 16 bit flowtype value           |
+   +--------------+---------------------------------+
+
 Negative types
 ~~~~~~~~~~~~~~
 
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index b0e4199..dcae7b9 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -527,6 +527,20 @@  enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_PFCP,
 
+	/**
+	 * Matches Packet Classification type (PCTYPE).
+	 * See struct rte_flow_item_pctype.
+	 *
+	 */
+	RTE_FLOW_ITEM_TYPE_PCTYPE,
+
+	/**
+	 * Matches flow type.
+	 * See struct rte_flow_item_flowtype.
+	 *
+	 */
+	RTE_FLOW_ITEM_TYPE_FLOWTYPE,
+
 };
 
 /**
@@ -1547,6 +1561,46 @@  static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
 #endif
 
 /**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_PCTYPE
+ *
+ * Match Packet Classification type (PCTYPE)
+ *
+ */
+struct rte_flow_item_pctype {
+	uint64_t pctype;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_PCTYPE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_pctype rte_flow_item_pctype_mask = {
+	.pctype = 0xffffffffffffffff,
+};
+#endif
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_FLOWTYPE
+ *
+ * Match flow type
+ *
+ */
+struct rte_flow_item_flowtype {
+	uint16_t flowtype;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_FLOWTYPE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_flowtype rte_flow_item_flowtype_mask = {
+	.flowtype = 0xffff,
+};
+#endif
+
+/**
  * Matching pattern item definition.
  *
  * A pattern is formed by stacking items starting from the lowest protocol
@@ -2099,6 +2153,17 @@  enum rte_flow_action_type {
 	 * see enum RTE_ETH_EVENT_FLOW_AGED
 	 */
 	RTE_FLOW_ACTION_TYPE_AGE,
+
+	/**
+	 * Map Packet Classification type to flow type.
+	 *
+	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_PCTYPE,
+	 * and a valid RTE_FLOW_ITEM_FLOWTYPE the PMD should return a
+	 * RTE_FLOW_ERROR_TYPE_ACTION error.
+	 *
+	 * See struct rte_flow_action_map.
+	 */
+	RTE_FLOW_ACTION_TYPE_MAP,
 };
 
 /**
@@ -2660,6 +2725,19 @@  struct rte_flow_action_set_dscp {
 	uint8_t dscp;
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_MAP
+ *
+ * Map a packet classification type to a flow type.
+ */
+struct rte_flow_action_map {
+	uint16_t flowtype;
+	uint64_t pctype;
+};
+
 /* Mbuf dynamic field offset for metadata. */
 extern int32_t rte_flow_dynf_metadata_offs;