[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 +++++++++++
doc/guides/rel_notes/release_23_07.rst | 6 +++
lib/ethdev/rte_flow.c | 2 +
lib/ethdev/rte_flow.h | 52 ++++++++++++++++++++++++++
4 files changed, 81 insertions(+)
Comments
Hi,
> -----Original Message-----
> From: Rongwei Liu <rongweil@nvidia.com>
> Sent: Wednesday, May 24, 2023 10:39 AM
>
> 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>
> ---
Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
@@ -3300,6 +3300,27 @@ The ``quota`` value is reduced according to ``mode`` setting.
| ``RTE_FLOW_QUOTA_MODE_L3`` | Count packet bytes starting from L3 |
+------------------+----------------------------------------------------+
+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
~~~~~~~~~~~~~~
@@ -27,6 +27,12 @@ New Features
.. This section should contain new features added in this release.
Sample format:
+ * **Added actions to push or remove the specific type of IPv6 extension.**
+
+ Added ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH`` and ``RTE_FLOW_ACTION_TYPE_IPV6_EXT_PUSH``
+ to push or remove the specific IPv6 extension into or from the packets.
+ Push always put the new extension as the last one due to the next header awareness.
+
* **Add a title in the past tense with a full stop.**
Add a short 1-2 sentence description in the past tense.
@@ -259,6 +259,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
MK_FLOW_ACTION(METER_MARK, sizeof(struct rte_flow_action_meter_mark)),
MK_FLOW_ACTION(SEND_TO_KERNEL, 0),
MK_FLOW_ACTION(QUOTA, sizeof(struct rte_flow_action_quota)),
+ 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
@@ -2912,6 +2912,25 @@ enum rte_flow_action_type {
* applied to the given ethdev Rx queue.
*/
RTE_FLOW_ACTION_TYPE_SKIP_CMAN,
+
+ /**
+ * 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,
};
/**
@@ -3352,6 +3371,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