[v2] net/mlx5: fix debug variable initialization

Message ID 20211104132853.31403-1-getelson@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series [v2] net/mlx5: fix debug variable initialization |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing warning apply patch failure
ci/Intel-compilation warning apply issues

Commit Message

Gregory Etelson Nov. 4, 2021, 1:28 p.m. UTC
  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@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_flex.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Comments

Raslan Darawsheh Nov. 4, 2021, 2 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: Gregory Etelson <getelson@nvidia.com>
> Sent: Thursday, November 4, 2021 3:29 PM
> To: dev@dpdk.org; Gregory Etelson <getelson@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: ferruh.yigit@intel.com; Raslan Darawsheh <rasland@nvidia.com>; Matan
> Azrad <matan@nvidia.com>
> Subject: [PATCH v2] net/mlx5: fix debug variable initialization
> 
> 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@nvidia.com>

Squashed into relevant commit in next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

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;