Skip to contentSkip to conversation

net/mlx5: fix the delay drop bit set overflow

PATCH In review Bing Zhao 2 participants 2 messages Nov 12, 2021 – Nov 14, 2021 Network drivers

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 net/mlx5: fix the 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")
---
 drivers/net/mlx5/mlx5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5.c +2 -2
index f5990dd757..2f5d74105a 100644
@@ -1978,8 +1978,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;
Signature · 1 line
2.27.0
#1 lore raw

Hi,

Quoted 17 lines

-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Friday, November 12, 2021 4:39 PM
To: Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH] net/mlx5: fix the 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.

Quoted 6 lines

With the commit, the double logical negation is used to fix this.

Fixes febcac7b46cd ("net/mlx5: support Rx queue delay drop")

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh