DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix assert when creating meter policy
@ 2022-11-09  7:53 Shun Hao
  2022-11-09  9:55 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Shun Hao @ 2022-11-09  7:53 UTC (permalink / raw)
  To: viacheslavo, matan, orika, Jiawei Wang; +Cc: dev, rasland, stable

When creating meter policy rules, it's possible to use flow items
translation to add src port match criteria. Currently the items
translation process needs to get thread workspace to store vport
metadata tag, but in policy creation, the thread workspace was not
initialized so it will cause assert failure.

This patch adds initialization of thread-local workspace when creating
meter policy rules to avoid that assert.

Fixes: 65c86202 ("net/mlx5: fix flow source port checking in sample flow rule")
CC: stable@dpdk.org

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 57af95b8a9..e9da59320a 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -17425,8 +17425,11 @@ flow_dv_create_policy_rules(struct rte_eth_dev *dev,
 			     struct mlx5_flow_meter_policy *mtr_policy)
 {
 	int i;
+	int ret = 0;
 	uint16_t sub_policy_num;
+	struct mlx5_flow_workspace *wks = mlx5_flow_push_thread_workspace();
 
+	RTE_SET_USED(wks);
 	for (i = 0; i < MLX5_MTR_DOMAIN_MAX; i++) {
 		sub_policy_num = (mtr_policy->sub_policy_num >>
 			(MLX5_MTR_SUB_POLICY_NUM_SHIFT * i)) &
@@ -17438,10 +17441,13 @@ flow_dv_create_policy_rules(struct rte_eth_dev *dev,
 			mtr_policy->sub_policys[i][0], i)) {
 			DRV_LOG(ERR, "Failed to create policy action "
 				"list per domain.");
-			return -1;
+			ret = -1;
+			goto exit;
 		}
 	}
-	return 0;
+exit:
+	mlx5_flow_pop_thread_workspace();
+	return ret;
 }
 
 static int
-- 
2.20.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH] net/mlx5: fix assert when creating meter policy
  2022-11-09  7:53 [PATCH] net/mlx5: fix assert when creating meter policy Shun Hao
@ 2022-11-09  9:55 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2022-11-09  9:55 UTC (permalink / raw)
  To: Shun Hao, Slava Ovsiienko, Matan Azrad, Ori Kam, Jiawei(Jonny) Wang
  Cc: dev, stable

Hi,

> -----Original Message-----
> From: Shun Hao <shunh@nvidia.com>
> Sent: Wednesday, November 9, 2022 9:53 AM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Ori Kam <orika@nvidia.com>; Jiawei(Jonny) Wang
> <jiaweiw@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix assert when creating meter policy
> 
> When creating meter policy rules, it's possible to use flow items
> translation to add src port match criteria. Currently the items
> translation process needs to get thread workspace to store vport
> metadata tag, but in policy creation, the thread workspace was not
> initialized so it will cause assert failure.
> 
> This patch adds initialization of thread-local workspace when creating
> meter policy rules to avoid that assert.
> 
> Fixes: 65c86202 ("net/mlx5: fix flow source port checking in sample flow
> rule")
> CC: stable@dpdk.org
> 
> Signed-off-by: Shun Hao <shunh@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-09  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09  7:53 [PATCH] net/mlx5: fix assert when creating meter policy Shun Hao
2022-11-09  9:55 ` Raslan Darawsheh

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).