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: e9de8f33ca ("net/mlx5: fix 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>
This commit is contained in:
Shun Hao 2022-11-09 09:53:09 +02:00 committed by Raslan Darawsheh
parent 232eb09fdf
commit afb98009a0

View File

@ -17421,8 +17421,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)) &
@ -17434,10 +17437,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