From ed5d23656e925ea8b271d4a84eec8e4046f66fa9 Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Wed, 24 Jun 2020 13:20:31 +0000 Subject: [PATCH] common/mlx5: fix code arrangement in tag allocation Flow tag action is supported only when the driver has DR or DV support. The tag allocation is adjusted to the modes DV or DR. In case both DR and DV are not supported in the system, the driver handles static code for error report. This error code, wrongly, was compiled when DV is supported while in this case it cannot be accessed at all. Ignore the aforementioned static error code in case of DV by preprocessor commands rearrangement. Fixes: cbb66daa3c85 ("net/mlx5: prepare Direct Verbs for Direct Rule") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/linux/mlx5_glue.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c index 62c4cc74b0..048207eb70 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.c +++ b/drivers/common/mlx5/linux/mlx5_glue.c @@ -752,7 +752,7 @@ mlx5_glue_dv_create_flow_action_tag(uint32_t tag) #ifdef HAVE_IBV_FLOW_DV_SUPPORT #ifdef HAVE_MLX5DV_DR return mlx5dv_dr_action_create_tag(tag); -#else +#else /* HAVE_MLX5DV_DR */ struct mlx5dv_flow_action_attr *action; action = malloc(sizeof(*action)); if (!action) @@ -760,11 +760,12 @@ mlx5_glue_dv_create_flow_action_tag(uint32_t tag) action->type = MLX5DV_FLOW_ACTION_TAG; action->tag_value = tag; return action; -#endif -#endif +#endif /* HAVE_MLX5DV_DR */ +#else /* HAVE_IBV_FLOW_DV_SUPPORT */ (void)tag; errno = ENOTSUP; return NULL; +#endif /* HAVE_IBV_FLOW_DV_SUPPORT */ } static void * -- 2.20.1