[dpdk-dev] [PATCH v2] net/mlx5: fix debug variable initialization

Gregory Etelson getelson at nvidia.com
Thu Nov 4 14:28:53 CET 2021


MLX5_ASSERT macro expansion depends on RTE_LIBRTE_MLX5_DEBUG and
RTE_ENABLE_ASSERT.
Existing implementation ignored the RTE_ENABLE_ASSERT dependency
in the mlx5_flex_flow_translate_item() scope.
As the result, the `priv` variable was not defined.

Fixes: 91f0e029ce5f ("net/mlx5: translate flex item pattern into matcher")
Signed-off-by: Gregory Etelson <getelson at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_flex.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c
index bdfa383c45..64867dc9e2 100644
--- a/drivers/net/mlx5/mlx5_flow_flex.c
+++ b/drivers/net/mlx5/mlx5_flow_flex.c
@@ -222,9 +222,6 @@ mlx5_flex_flow_translate_item(struct rte_eth_dev *dev,
 			      const struct rte_flow_item *item,
 			      bool is_inner)
 {
-#ifdef RTE_LIBRTE_MLX5_DEBUG
-	struct mlx5_priv *priv = dev->data->dev_private;
-#endif
 	const struct rte_flow_item_flex *spec, *mask;
 	void *misc4_m = MLX5_ADDR_OF(fte_match_param, matcher,
 				     misc_parameters_4);
@@ -237,7 +234,7 @@ mlx5_flex_flow_translate_item(struct rte_eth_dev *dev,
 	spec = item->spec;
 	mask = item->mask;
 	tp = (struct mlx5_flex_item *)spec->handle;
-	MLX5_ASSERT(mlx5_flex_index(priv, tp) >= 0);
+	MLX5_ASSERT(mlx5_flex_index(dev->data->dev_private, tp) >= 0);
 	for (i = 0; i < tp->mapnum; i++) {
 		struct mlx5_flex_pattern_field *map = tp->map + i;
 		uint32_t id = map->reg_id;
-- 
2.33.1



More information about the dev mailing list