DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>,
	 Raslan Darawsheh <rasland@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Ori Kam <orika@nvidia.com>, Suanming Mou <suanmingm@nvidia.com>
Subject: [PATCH v3 2/2] net/mlx5: add random item support
Date: Thu, 14 Dec 2023 17:12:48 +0200	[thread overview]
Message-ID: <20231214151248.1654878-3-michaelba@nvidia.com> (raw)
In-Reply-To: <20231214151248.1654878-1-michaelba@nvidia.com>

Add support for random item in HWS mode.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
---
 doc/guides/nics/features/mlx5.ini      | 1 +
 doc/guides/nics/mlx5.rst               | 9 +++++++++
 doc/guides/rel_notes/release_24_03.rst | 3 +++
 drivers/net/mlx5/mlx5_flow_dv.c        | 5 +++++
 drivers/net/mlx5/mlx5_flow_hw.c        | 5 +++++
 5 files changed, 23 insertions(+)

diff --git a/doc/guides/nics/features/mlx5.ini b/doc/guides/nics/features/mlx5.ini
index 0739fe9d63..6261b7d657 100644
--- a/doc/guides/nics/features/mlx5.ini
+++ b/doc/guides/nics/features/mlx5.ini
@@ -88,6 +88,7 @@ port_id              = Y
 port_representor     = Y
 ptype                = Y
 quota                = Y
+random               = Y
 tag                  = Y
 tcp                  = Y
 udp                  = Y
diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 6b52fb93c5..971c229850 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -167,6 +167,7 @@ Features
 - Sub-Function.
 - Matching on represented port.
 - Matching on aggregated affinity.
+- Matching on random value.
 
 
 Limitations
@@ -564,6 +565,7 @@ Limitations
   - Modification of the MPLS header is supported only in HWS and only to copy from,
     the encapsulation level is always 0.
   - Modification of the 802.1Q Tag, VXLAN Network or GENEVE Network ID's is not supported.
+  - Modify field action using ``RTE_FLOW_FIELD_RANDOM`` is not supported.
   - Encapsulation levels are not supported, can modify outermost header fields only.
   - Offsets cannot skip past the boundary of a field.
   - If the field type is ``RTE_FLOW_FIELD_MAC_TYPE``
@@ -770,6 +772,13 @@ Limitations
   - In HW steering (``dv_flow_en`` = 2):
     - not supported on guest port.
 
+- Match on random value:
+
+  - Supported only with HW Steering enabled (``dv_flow_en`` = 2).
+  - Supported only in table with ``nb_flows=1``.
+  - NIC ingress/egress flow in group 0 is not supported.
+  - Supports matching only 16 bits (LSB).
+
 - During live migration to a new process set its flow engine as standby mode,
   the user should only program flow rules in group 0 (``fdb_def_rule_en=0``).
   Live migration is only supported under SWS (``dv_flow_en=1``).
diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 819cef7f20..93e58b55ca 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -60,6 +60,9 @@ New Features
   * Added ``RTE_FLOW_ITEM_TYPE_RANDOM`` to match random value.
   * Added ``RTE_FLOW_FIELD_RANDOM`` to represent it in field API.
 
+* **Updated NVIDIA mlx5 net driver.**
+
+  * Added support for ``RTE_FLOW_ITEM_TYPE_RANDOM`` flow item.
 
 Removed Items
 -------------
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 115d730317..67a44095d7 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5396,6 +5396,11 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
 				"modifications of the MPLS header "
 				"is not supported");
+	if (dst_data->field == RTE_FLOW_FIELD_RANDOM ||
+	    src_data->field == RTE_FLOW_FIELD_RANDOM)
+		return rte_flow_error_set(error, ENOTSUP,
+				RTE_FLOW_ERROR_TYPE_ACTION, action,
+				"modifications of random value is not supported");
 	if (dst_data->field == RTE_FLOW_FIELD_MARK ||
 	    src_data->field == RTE_FLOW_FIELD_MARK)
 		if (config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index da873ae2e2..af4e9abd89 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -5047,6 +5047,10 @@ flow_hw_validate_action_modify_field(struct rte_eth_dev *dev,
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
 				"modifying vlan_type is not supported");
+	if (flow_hw_modify_field_is_used(action_conf, RTE_FLOW_FIELD_RANDOM))
+		return rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ACTION, action,
+				"modifying random value is not supported");
 	if (flow_hw_modify_field_is_used(action_conf, RTE_FLOW_FIELD_GENEVE_VNI))
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
@@ -6807,6 +6811,7 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_FLEX:
 		case RTE_FLOW_ITEM_TYPE_IB_BTH:
 		case RTE_FLOW_ITEM_TYPE_PTYPE:
+		case RTE_FLOW_ITEM_TYPE_RANDOM:
 			break;
 		case RTE_FLOW_ITEM_TYPE_INTEGRITY:
 			/*
-- 
2.25.1


  parent reply	other threads:[~2023-12-14 15:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 10:35 [PATCH 0/2] " Michael Baum
2023-08-22 10:35 ` [PATCH 1/2] net/mlx5/hws: add support for random number match Michael Baum
2023-10-29 15:55   ` Ori Kam
2023-08-22 10:36 ` [PATCH 2/2] net/mlx5: add random item support Michael Baum
2023-10-29 15:57   ` Ori Kam
2023-11-30 16:39 ` [PATCH v2 0/2] " Michael Baum
2023-11-30 16:40   ` [PATCH v2 1/2] net/mlx5/hws: add support for random number match Michael Baum
2023-12-08 19:31     ` Dariusz Sosnowski
2023-11-30 16:40   ` [PATCH v2 2/2] net/mlx5: add random item support Michael Baum
2023-12-08 19:58     ` Dariusz Sosnowski
2023-12-14 15:12   ` [PATCH v3 0/2] " Michael Baum
2023-12-14 15:12     ` [PATCH v3 1/2] net/mlx5/hws: add support for random number match Michael Baum
2023-12-18  9:08       ` Dariusz Sosnowski
2023-12-14 15:12     ` Michael Baum [this message]
2023-12-18  9:11       ` [PATCH v3 2/2] net/mlx5: add random item support Dariusz Sosnowski
2023-12-25 10:24     ` [PATCH v4 0/2] " Michael Baum
2023-12-25 10:24       ` [PATCH v4 1/2] net/mlx5/hws: add support for random number match Michael Baum
2024-01-05  9:05         ` Dariusz Sosnowski
2023-12-25 10:24       ` [PATCH v4 2/2] net/mlx5: add random item support Michael Baum
2024-01-25 12:37       ` [PATCH v5 0/2] " Michael Baum
2024-01-25 12:37         ` [PATCH v5 1/2] net/mlx5/hws: add support for random number match Michael Baum
2024-01-25 12:37         ` [PATCH v5 2/2] net/mlx5: add random item support Michael Baum
2024-01-28  8:45         ` [PATCH v5 0/2] " Raslan Darawsheh

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=20231214151248.1654878-3-michaelba@nvidia.com \
    --to=michaelba@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --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).