net/mlx5: fix meter policy creation assert
PATCH 1/1 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.
--- 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(-)
drivers/net/mlx5/mlx5.h +2 -0
@@ -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. */
drivers/net/mlx5/mlx5_flow.c +2 -0
@@ -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,
drivers/net/mlx5/mlx5_flow_dv.c +3 -3
@@ -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 ;
Signature · 1 line
2.20.0
Hi,
Quoted 18 lines
-----Original Message-----
From: Shun Hao <[email protected]>
Sent: Wednesday, March 2, 2022 12:33 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; [email protected] ; [email protected] ; Raja Zidane <[email protected]>
Cc: [email protected] ; Raslan Darawsheh <[email protected]>; [email protected]
Subject: [PATCH v1] net/mlx5: fix meter policy creation assertThe 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.
Quoted 5 lines
Fixes 082becbf1f35 ("net/mlx5: fix mark enabling for Rx")Signed-off-by Shun Hao <[email protected]>Acked-by Matan Azrad <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh