From ce78c51833a847d4b93841231907f1a7f5cf7114 Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Fri, 12 Nov 2021 16:38:42 +0200 Subject: [PATCH] net/mlx5: fix delay drop bit set overflow The attribute to record the global control of hairpin queues' delay drop was defined as a bit-field with one bit, and the intention was to reduce the memory overhead. In the meanwhile, the macro was defined as an enumerated value 0x2. No matter what value inputted via devarg, the lowest bit was always zero and the higher bits would be ignored. For hairpin queues, the delay drop attribute couldn't be enabled. With the commit, the double logical negation is used to fix this. Fixes: febcac7b46cd ("net/mlx5: support Rx queue delay drop") Signed-off-by: Bing Zhao Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 2a3efb3588..4e04817d11 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1972,8 +1972,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque) } else if (strcmp(MLX5_ALLOW_DUPLICATE_PATTERN, key) == 0) { config->allow_duplicate_pattern = !!tmp; } else if (strcmp(MLX5_DELAY_DROP, key) == 0) { - config->std_delay_drop = tmp & MLX5_DELAY_DROP_STANDARD; - config->hp_delay_drop = tmp & MLX5_DELAY_DROP_HAIRPIN; + config->std_delay_drop = !!(tmp & MLX5_DELAY_DROP_STANDARD); + config->hp_delay_drop = !!(tmp & MLX5_DELAY_DROP_HAIRPIN); } else { DRV_LOG(WARNING, "%s: unknown parameter", key); rte_errno = EINVAL; -- 2.39.5