From: Rongwei Liu <rongweil@nvidia.com>
To: <dev@dpdk.org>, <matan@nvidia.com>, <viacheslavo@nvidia.com>,
<orika@nvidia.com>, <thomas@monjalon.net>
Cc: Ferruh Yigit <ferruh.yigit@amd.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [RFC v1 1/2] ethdev: add IPv6 extension push remove action
Date: Mon, 17 Apr 2023 05:26:29 +0300 [thread overview]
Message-ID: <20230417022630.2377505-2-rongweil@nvidia.com> (raw)
In-Reply-To: <20230417022630.2377505-1-rongweil@nvidia.com>
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(+)
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 43e38839ae..6a7401c98a 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -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
~~~~~~~~~~~~~~
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 26531ecb8e..4504bb3ae9 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -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
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index dfad6d1af4..f5e0c22389 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -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
--
2.27.0
next prev parent reply other threads:[~2023-04-17 2:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 2:26 [RFC v1 0/2] add IPv6 extenstion push remove Rongwei Liu
2023-04-17 2:26 ` Rongwei Liu [this message]
2023-04-17 2:26 ` [RFC v1 2/2] app/testpmd: add IPv6 extension push remove cli Rongwei Liu
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=20230417022630.2377505-2-rongweil@nvidia.com \
--to=rongweil@nvidia.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=thomas@monjalon.net \
--cc=viacheslavo@nvidia.com \
/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).