patch 'net/mlx5: fix access to flow template operations' has been queued to stable release 23.11.2

Xueming Li xuemingl at nvidia.com
Fri Jul 12 13:01:44 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/14/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=aba6289d562f7583deb7654bed08e0e101db8f70

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From aba6289d562f7583deb7654bed08e0e101db8f70 Mon Sep 17 00:00:00 2001
From: Gregory Etelson <getelson at nvidia.com>
Date: Sun, 2 Jun 2024 09:00:49 +0300
Subject: [PATCH] net/mlx5: fix access to flow template operations
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit acbb57b25d30147d1fd0edf1e8314a0a3d3c38c9 ]

PMD activates HWS template API context during port configuration.

There was no validation that the HWS context was activated before
the PMD tried to process other template function calls.

The patch adds HWS context validation.

Fixes: b401400db24e ("net/mlx5: add port flow configuration")

Signed-off-by: Gregory Etelson <getelson at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 9667bad68e..fa6ae623c9 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -124,6 +124,20 @@ mlx5_tbl_multi_pattern_process(struct rte_eth_dev *dev,
 static __rte_always_inline enum mlx5_indirect_list_type
 flow_hw_inlist_type_get(const struct rte_flow_action *actions);
 
+static bool
+mlx5_hw_ctx_validate(const struct rte_eth_dev *dev, struct rte_flow_error *error)
+{
+	const struct mlx5_priv *priv = dev->data->dev_private;
+
+	if (!priv->dr_ctx) {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+				   "non-template flow engine was not configured");
+		return false;
+	}
+	return true;
+}
+
 static __rte_always_inline int
 mlx5_multi_pattern_reformat_to_index(enum mlx5dr_action_type type)
 {
@@ -5754,6 +5768,8 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev,
 	int ret;
 	const struct rte_flow_action_ipv6_ext_remove *remove_data;
 
+	if (!mlx5_hw_ctx_validate(dev, error))
+		return -rte_errno;
 	/* FDB actions are only valid to proxy port. */
 	if (attr->transfer && (!priv->sh->config.dv_esw_en || !priv->master))
 		return rte_flow_error_set(error, EINVAL,
@@ -6766,6 +6782,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
 	bool items_end = false;
 	uint32_t tag_bitmap = 0;
 
+	if (!mlx5_hw_ctx_validate(dev, error))
+		return -rte_errno;
 	if (!attr->ingress && !attr->egress && !attr->transfer)
 		return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR, NULL,
 					  "at least one of the direction attributes"
@@ -10269,6 +10287,8 @@ flow_hw_action_handle_create(struct rte_eth_dev *dev, uint32_t queue,
 	bool aso = false;
 	bool force_job = action->type == RTE_FLOW_ACTION_TYPE_METER_MARK;
 
+	if (!mlx5_hw_ctx_validate(dev, error))
+		return NULL;
 	if (attr || force_job) {
 		job = flow_hw_action_job_init(priv, queue, NULL, user_data,
 					      NULL, MLX5_HW_Q_JOB_TYPE_CREATE,
@@ -11540,6 +11560,8 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
 		}
 	};
 
+	if (!mlx5_hw_ctx_validate(dev, error))
+		return NULL;
 	if (!actions) {
 		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
 				   NULL, "No action list");
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-07-12 18:40:18.265080128 +0800
+++ 0093-net-mlx5-fix-access-to-flow-template-operations.patch	2024-07-12 18:40:14.316594202 +0800
@@ -1 +1 @@
-From acbb57b25d30147d1fd0edf1e8314a0a3d3c38c9 Mon Sep 17 00:00:00 2001
+From aba6289d562f7583deb7654bed08e0e101db8f70 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit acbb57b25d30147d1fd0edf1e8314a0a3d3c38c9 ]
@@ -14 +16,0 @@
-Cc: stable at dpdk.org
@@ -23 +25 @@
-index 53c6cc5961..e97afb0c86 100644
+index 9667bad68e..fa6ae623c9 100644
@@ -26 +28 @@
-@@ -206,6 +206,20 @@ mlx5_destroy_multi_pattern_segment(struct mlx5_multi_pattern_segment *segment);
+@@ -124,6 +124,20 @@ mlx5_tbl_multi_pattern_process(struct rte_eth_dev *dev,
@@ -47 +49 @@
-@@ -6399,6 +6413,8 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev,
+@@ -5754,6 +5768,8 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev,
@@ -56 +58,2 @@
-@@ -7528,6 +7544,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
+@@ -6766,6 +6782,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev,
+ 	bool items_end = false;
@@ -58 +60,0 @@
- 	int ret;
@@ -65 +67 @@
-@@ -11259,6 +11277,8 @@ flow_hw_action_handle_create(struct rte_eth_dev *dev, uint32_t queue,
+@@ -10269,6 +10287,8 @@ flow_hw_action_handle_create(struct rte_eth_dev *dev, uint32_t queue,
@@ -74 +76 @@
-@@ -12541,6 +12561,8 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,
+@@ -11540,6 +11560,8 @@ flow_hw_async_action_list_handle_create(struct rte_eth_dev *dev, uint32_t queue,


More information about the stable mailing list