[v1] net/mlx5: fix meter policy creation assert
Checks
Commit Message
The meter policy creation doesn't belong to RTE flow creation
process, so thread workspace was not initialized and there will be
assert error when using it.
This patch removes the incorrect using of thread workspace in meter
policy creation, and adds a flag in policy instead. When creating
RTE flow, can use the flag to set the mark flag in thread workspace.
Fixes: 082becbf1f35 ("net/mlx5: fix mark enabling for Rx")
Cc: stable@dpdk.org
Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/mlx5.h | 2 ++
drivers/net/mlx5/mlx5_flow.c | 2 ++
drivers/net/mlx5/mlx5_flow_dv.c | 6 +++---
3 files changed, 7 insertions(+), 3 deletions(-)
Comments
Hi,
> -----Original Message-----
> From: Shun Hao <shunh@nvidia.com>
> Sent: Wednesday, March 2, 2022 12:33 PM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; orika@nvidia.com ; thomas@monjalon.net ; Raja
> Zidane <rzidane@nvidia.com>
> Cc: dev@dpdk.org ; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v1] net/mlx5: fix meter policy creation assert
>
> The meter policy creation doesn't belong to RTE flow creation
> process, so thread workspace was not initialized and there will be
> assert error when using it.
>
> This patch removes the incorrect using of thread workspace in meter
> policy creation, and adds a flag in policy instead. When creating
> RTE flow, can use the flag to set the mark flag in thread workspace.
>
> Fixes: 082becbf1f35 ("net/mlx5: fix mark enabling for Rx")
> 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
@@ -779,6 +779,8 @@ struct mlx5_flow_meter_policy {
/* If yellow color policy is skipped. */
uint32_t skip_g:1;
/* If green color policy is skipped. */
+ uint32_t mark:1;
+ /* If policy contains mark action. */
rte_spinlock_t sl;
uint32_t ref_cnt;
/* Use count. */
@@ -6287,6 +6287,8 @@ flow_create_split_meter(struct rte_eth_dev *dev,
fm->policy_id,
NULL);
MLX5_ASSERT(wks->policy);
+ if (wks->policy->mark)
+ wks->mark = 1;
if (wks->policy->is_hierarchy) {
wks->final_policy =
mlx5_flow_meter_hierarchy_get_final_policy(dev,
@@ -15524,9 +15524,7 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
(MLX5_MAX_MODIFY_NUM + 1)];
} mhdr_dummy;
struct mlx5_flow_dv_modify_hdr_resource *mhdr_res = &mhdr_dummy.res;
- struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace();
- MLX5_ASSERT(wks);
egress = (domain == MLX5_MTR_DOMAIN_EGRESS) ? 1 : 0;
transfer = (domain == MLX5_MTR_DOMAIN_TRANSFER) ? 1 : 0;
memset(&dh, 0, sizeof(struct mlx5_flow_handle));
@@ -15564,7 +15562,6 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
NULL,
"cannot create policy "
"mark action for this color");
- wks->mark = 1;
if (flow_dv_tag_resource_register(dev, tag_be,
&dev_flow, &flow_err))
return -rte_mtr_error_set(error,
@@ -15576,6 +15573,7 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
act_cnt->rix_mark =
dev_flow.handle->dvh.rix_tag;
action_flags |= MLX5_FLOW_ACTION_MARK;
+ mtr_policy->mark = 1;
break;
}
case RTE_FLOW_ACTION_TYPE_SET_TAG:
@@ -15859,6 +15857,8 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
act_cnt->next_sub_policy = NULL;
mtr_policy->is_hierarchy = 1;
mtr_policy->dev = next_policy->dev;
+ if (next_policy->mark)
+ mtr_policy->mark = 1;
action_flags |=
MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY;
break;