[RFC,v1,1/2] ethdev: add IPv6 extension push remove action
Checks
Commit Message
Add new rte_actions to push and remove the specific
type of IPv6 extension to and from original packets.
A new extension to be pushed should be the last extension
due to the next header awareness.
Remove can support the IPv6 extension in any position.
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
---
doc/guides/prog_guide/rte_flow.rst | 21 ++++++++++++
lib/ethdev/rte_flow.c | 2 ++
lib/ethdev/rte_flow.h | 52 ++++++++++++++++++++++++++++++
3 files changed, 75 insertions(+)
@@ -3308,6 +3308,27 @@ and rte_mtr_policy_get() API respectively.
| ``policy`` | Meter policy object |
+------------------+----------------------+
+Action: ``IPV6_EXT_PUSH``
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Add an IPv6 extension into IPv6 header and its template is provided in
+its data buffer with the specific type as defined in the
+``rte_flow_action_ipv6_ext_push`` definition.
+
+This action modifies the payload of matched flows. The data supplied must
+be a valid extension in the specified type, it should be added the last one
+if preceding extension existed. When applied to the original packet the
+resulting packet must be a valid packet.
+
+Action: ``IPV6_EXT_REMOVE``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Remove an IPv6 extension whose type is provided in its type as defined in
+the ``rte_flow_action_ipv6_ext_remove``.
+
+This action modifies the payload of matched flow and the packet should be
+valid after removing.
+
Negative types
~~~~~~~~~~~~~~
@@ -272,6 +272,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(SEND_TO_KERNEL, 0),
MK_FLOW_ACTION(QUOTA, sizeof(struct rte_flow_action_quota)),
MK_FLOW_ACTION(INDIRECT_LIST, 0),
+ MK_FLOW_ACTION(IPV6_EXT_PUSH, sizeof(struct rte_flow_action_ipv6_ext_push)),
+ MK_FLOW_ACTION(IPV6_EXT_REMOVE, sizeof(struct rte_flow_action_ipv6_ext_remove)),
};
int
@@ -3029,6 +3029,25 @@ enum rte_flow_action_type {
* RTE_FLOW_ACTION_TYPE_INDIRECT_LIST
*/
RTE_FLOW_ACTION_TYPE_INDIRECT_LIST,
+
+ /**
+ * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH
+ *
+ * Push IPv6 extension into IPv6 packet.
+ *
+ * @see struct rte_flow_action_ipv6_ext_push.
+ */
+ RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH,
+
+ /**
+ * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE
+ *
+ * Remove IPv6 extension from IPv6 packet whose type
+ * is provided in its configuration buffer.
+ *
+ * @see struct rte_flow_action_ipv6_ext_remove.
+ */
+ RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE,
};
/**
@@ -3469,6 +3488,39 @@ struct rte_flow_action_vxlan_encap {
struct rte_flow_item *definition;
};
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH
+ *
+ * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH include:
+ *
+ * - IPV6_EXT TYPE / IPV6_EXT_HEADER_IN_TYPE / END
+ *
+ * size holds the number of bytes in @p data.
+ * The data must be added as the last IPv6 extension.
+ */
+struct rte_flow_action_ipv6_ext_push {
+ uint8_t *data; /**< IPv6 extension header data. */
+ size_t size; /**< Size of @p data. */
+ uint8_t type; /**< Type of IPv6 extension. */
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE
+ *
+ * Valid flow definition for RTE_FLOW_ACTION_TYPE_IPV6_EXT_REMOVE include:
+ *
+ * - IPV6_EXT TYPE / END
+ */
+struct rte_flow_action_ipv6_ext_remove {
+ uint8_t type; /**< Type of IPv6 extension. */
+};
+
/**
* @warning
* @b EXPERIMENTAL: this structure may change without prior notice