net/mlx5: fix assert on getting register of sample flow
PATCH 1/1 net/mlx5: fix assert on getting register of sample flow
From: Jiawei Wang <[email protected]>
The sample flow tried to get the reserved metadata register for match implicitly, and if the reserved metadata register was invalid then back to use the application tag.
The assertion failure was caused while getting register due to the reserved metadata regC is invalid on CX-5 trusted device(VF/SF).
This patch adds the checking for reserved metadata register before getting the register, to avoid assertion failure.
--- drivers/net/mlx5/mlx5_flow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow.c +3 -2
@@ -6125,13 +6125,14 @@ flow_sample_split_prep(struct rte_eth_dev *dev,/* Prepare the prefix tag action. */ append_index++; set_tag = (void *)(actions_pre + actions_n + append_index); - ret =mlx5_flow_get_reg_id (dev,MLX5_SAMPLE_ID ,0 , error);/* Trust VF/SF on CX5 not supported meter so that the reserved * metadata regC is REG_NON, back to use application tag * index 0. */ -if (unlikely (ret ==REG_NON )) +if (unlikely (priv->mtr_color_reg ==REG_NON )) ret =mlx5_flow_get_reg_id (dev,MLX5_APP_TAG ,0 , error); +else + ret =mlx5_flow_get_reg_id (dev,MLX5_SAMPLE_ID ,0 , error);if (ret <0 )return ret; mlx5_ipool_malloc(priv->sh->ipool
Signature · 1 line
2.18.1
PATCH v2 1/1 net/mlx5: fix assert on getting register of sample flow
The sample flow tried to get the reserved metadata register for match implicitly, and if the reserved metadata register was invalid then back to use the application tag.
The assertion failure was caused while getting register due to the reserved metadata regC is invalid on CX-5 trusted device(VF/SF).
This patch adds the checking for reserved metadata register before getting the register, to avoid assertion failure.
---
v2: fix commit mailmap error
--- drivers/net/mlx5/mlx5_flow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow.c +3 -2
@@ -6125,13 +6125,14 @@ flow_sample_split_prep(struct rte_eth_dev *dev,/* Prepare the prefix tag action. */ append_index++; set_tag = (void *)(actions_pre + actions_n + append_index); - ret =mlx5_flow_get_reg_id (dev,MLX5_SAMPLE_ID ,0 , error);/* Trust VF/SF on CX5 not supported meter so that the reserved * metadata regC is REG_NON, back to use application tag * index 0. */ -if (unlikely (ret ==REG_NON )) +if (unlikely (priv->mtr_color_reg ==REG_NON )) ret =mlx5_flow_get_reg_id (dev,MLX5_APP_TAG ,0 , error); +else + ret =mlx5_flow_get_reg_id (dev,MLX5_SAMPLE_ID ,0 , error);if (ret <0 )return ret; mlx5_ipool_malloc(priv->sh->ipool
Signature · 1 line
2.18.1
PATCH v3 1/1 net/mlx5: fix assert on getting register of sample flow
In reply to Jiawei WangThe sample flow tried to get the reserved metadata register for match implicitly, and if the reserved metadata register was invalid then back to use the application tag.
The assertion failure was caused while getting register due to the reserved metadata regC is invalid on CX-5 trusted device(VF/SF).
This patch adds the checking for reserved metadata register before getting the register, to avoid assertion failure.
---
v2: fix commit mailmap issue
v3: fix commit mailmap issue
--- drivers/net/mlx5/mlx5_flow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow.c +3 -2
@@ -6125,13 +6125,14 @@ flow_sample_split_prep(struct rte_eth_dev *dev,/* Prepare the prefix tag action. */ append_index++; set_tag = (void *)(actions_pre + actions_n + append_index); - ret =mlx5_flow_get_reg_id (dev,MLX5_SAMPLE_ID ,0 , error);/* Trust VF/SF on CX5 not supported meter so that the reserved * metadata regC is REG_NON, back to use application tag * index 0. */ -if (unlikely (ret ==REG_NON )) +if (unlikely (priv->mtr_color_reg ==REG_NON )) ret =mlx5_flow_get_reg_id (dev,MLX5_APP_TAG ,0 , error); +else + ret =mlx5_flow_get_reg_id (dev,MLX5_SAMPLE_ID ,0 , error);if (ret <0 )return ret; mlx5_ipool_malloc(priv->sh->ipool
Signature · 1 line
2.18.1
Hi,
Quoted 18 lines
-----Original Message-----
From: Jiawei(Jonny) Wang <[email protected]>
Sent: Friday, December 9, 2022 3:59 PM
To: Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Jiawei(Jonny) Wang <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix assert on getting register of sample flowFrom: Jiawei Wang <[email protected]>
The sample flow tried to get the reserved metadata register for match implicitly, and if the reserved metadata register was invalid then back to use the application tag.
The assertion failure was caused while getting register due to the reserved metadata regC is invalid on CX-5 trusted device(VF/SF).
Quoted 8 lines
This patch adds the checking for reserved metadata register before getting the register, to avoid assertion failure.
Fixes 9a726360dd30 ("net/mlx5: fix sample flow action on trusted device")Signed-off-by Jiawei Wang <[email protected]>Acked-by Slava Ovsiienko <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh