From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Ori Kam <orika@nvidia.com>,
Aman Singh <aman.deep.singh@intel.com>,
"Yuying Zhang" <yuying.zhang@intel.com>,
Ferruh Yigit <ferruh.yigit@amd.com>,
"Thomas Monjalon" <thomas@monjalon.net>
Subject: [PATCH v2 1/2] ethdev: add random item support
Date: Mon, 11 Sep 2023 10:41:48 +0300 [thread overview]
Message-ID: <20230911074149.697944-2-michaelba@nvidia.com> (raw)
In-Reply-To: <20230911074149.697944-1-michaelba@nvidia.com>
Add support for a new item type "RTE_FLOW_ITEM_TYPE_RANDOM".
This item enables to match on some random value as a part of flow rule.
Signed-off-by: Michael Baum <michaelba@nvidia.com>
---
doc/guides/nics/features/default.ini | 1 +
doc/guides/prog_guide/rte_flow.rst | 11 +++++++++
doc/guides/rel_notes/release_23_11.rst | 4 ++++
lib/ethdev/rte_flow.c | 1 +
lib/ethdev/rte_flow.h | 33 ++++++++++++++++++++++++++
5 files changed, 50 insertions(+)
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index 2011e97127..0a790dafe8 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -139,6 +139,7 @@ pppoes =
pppoe_proto_id =
quota =
raw =
+random =
represented_port =
sctp =
tag =
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 5bc998a433..5ad699dff7 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1566,6 +1566,17 @@ Matches an InfiniBand base transport header in RoCE packet.
- ``hdr``: InfiniBand base transport header definition (``rte_ib.h``).
+Item: ``RANDOM``
+^^^^^^^^^^^^^^^^
+
+Matches a random value.
+
+This value is not based on the packet data/headers.
+Application shouldn't assume that this value is kept during the life time of
+the packet.
+
+- ``value``: Random value.
+
Actions
~~~~~~~
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 333e1d95a2..bcd71138cb 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -78,6 +78,10 @@ New Features
* build: Optional libraries can now be selected with the new ``enable_libs``
build option similarly to the existing ``enable_drivers`` build option.
+* **Added flow matching of random value.**
+
+ Added ``RTE_FLOW_ITEM_RANDOM`` to match random value.
+
Removed Items
-------------
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 271d854f78..51db3e5aec 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -136,6 +136,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
sizeof(struct rte_flow_item_icmp6_nd_opt_tla_eth)),
MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)),
MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
+ MK_FLOW_ITEM(RANDOM, sizeof(struct rte_flow_item_random)),
MK_FLOW_ITEM(TAG, sizeof(struct rte_flow_item_tag)),
MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
MK_FLOW_ITEM(GRE_OPTION, sizeof(struct rte_flow_item_gre_opt)),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 2ebb76dbc0..b5228b293c 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -688,6 +688,19 @@ enum rte_flow_item_type {
* @see struct rte_flow_item_ib_bth.
*/
RTE_FLOW_ITEM_TYPE_IB_BTH,
+
+ /**
+ * [META]
+ *
+ * Matches a random value.
+ *
+ * This value is not based on the packet data/headers.
+ * Application shouldn't assume that this value is kept during the life
+ * time of the packet.
+ *
+ * @see struct rte_flow_item_random.
+ */
+ RTE_FLOW_ITEM_TYPE_RANDOM,
};
/**
@@ -2031,6 +2044,25 @@ static const struct rte_flow_item_ib_bth rte_flow_item_ib_bth_mask = {
};
#endif
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ITEM_TYPE_RANDOM
+ *
+ * Matches a random value.
+ */
+struct rte_flow_item_random {
+ uint32_t value;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_RANDOM. */
+#ifndef __cplusplus
+static const struct rte_flow_item_random rte_flow_item_random_mask = {
+ .value = UINT32_MAX,
+};
+#endif
+
/**
* Matching pattern item definition.
*
@@ -3875,6 +3907,7 @@ enum rte_flow_field_id {
RTE_FLOW_FIELD_GENEVE_OPT_CLASS,/**< GENEVE option class. */
RTE_FLOW_FIELD_GENEVE_OPT_DATA, /**< GENEVE option data. */
RTE_FLOW_FIELD_MPLS, /**< MPLS header. */
+ RTE_FLOW_FIELD_RANDOM /**< Random value. */
};
/**
--
2.25.1
next prev parent reply other threads:[~2023-09-11 7:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 9:05 [PATCH v1 0/2] ethdev: add random item support Michael Baum
2023-08-22 9:05 ` [PATCH v1 1/2] " Michael Baum
2023-08-22 9:05 ` [PATCH v1 2/2] app/testpmd: " Michael Baum
2023-08-22 12:41 ` [PATCH v1 0/2] ethdev: " Ivan Malov
2023-08-22 14:09 ` Michael Baum
2023-08-22 14:09 ` Stephen Hemminger
2023-09-11 7:41 ` [PATCH v2 " Michael Baum
2023-09-11 7:41 ` Michael Baum [this message]
2023-09-11 15:59 ` [PATCH v2 1/2] " Thomas Monjalon
2023-10-12 10:14 ` Michael Baum
2023-09-11 7:41 ` [PATCH v2 2/2] app/testpmd: " Michael Baum
2023-09-18 11:44 ` Ori Kam
2023-09-11 16:55 ` [PATCH v2 0/2] ethdev: " Morten Brørup
2023-09-11 17:53 ` Stephen Hemminger
2023-10-12 9:48 ` Michael Baum
2023-09-12 8:40 ` Michael Baum
2023-11-30 16:32 ` [PATCH v3 " Michael Baum
2023-11-30 16:32 ` [PATCH v3 1/2] " Michael Baum
2023-12-08 18:54 ` Dariusz Sosnowski
2023-12-14 10:32 ` Michael Baum
2023-12-14 10:54 ` Dariusz Sosnowski
2023-12-08 19:03 ` Dariusz Sosnowski
2023-11-30 16:32 ` [PATCH v3 2/2] app/testpmd: " Michael Baum
2023-12-08 18:52 ` Dariusz Sosnowski
2023-12-14 10:58 ` [PATCH v4 0/2] ethdev: " Michael Baum
2023-12-14 10:58 ` [PATCH v4 1/2] " Michael Baum
2023-12-14 11:12 ` Dariusz Sosnowski
2023-12-14 11:32 ` Ori Kam
2023-12-14 12:18 ` Ferruh Yigit
2023-12-14 13:43 ` Michael Baum
2023-12-14 15:55 ` Ferruh Yigit
2023-12-15 7:47 ` Michael Baum
2023-12-14 10:58 ` [PATCH v4 2/2] app/testpmd: " Michael Baum
2023-12-15 12:07 ` [PATCH v4 0/2] ethdev: " Ferruh Yigit
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=20230911074149.697944-2-michaelba@nvidia.com \
--to=michaelba@nvidia.com \
--cc=aman.deep.singh@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=orika@nvidia.com \
--cc=thomas@monjalon.net \
--cc=yuying.zhang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.