Skip to contentSkip to conversation

common/mlx5: fix missing default devargs initialization

PATCH Superseded Michael Baum 3 participants 4 messages Feb 27, 2022 – Mar 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/mlx5: fix missing default devargs initialization

Device arguments list is provided along with its identifier as part of EAL arguments.
The arguments specified in the list are taken from it, and the rest is initialized to the default values.

When no list is provided at all, all arguments should have been initialized to their default values. However, they are mistakenly initialized to zero which may be a valid value for some.

This patch initializes the default values before checking whether arguments have been specified.

Fixes 04054be4331c ("common/mlx5: refactor devargs management")
---
 drivers/common/mlx5/mlx5_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +2 -2
index 94c303ce81..ef1604d223 100644
@@ -326,8 +326,6 @@ mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist,
 	};
 	int ret = 0;
 
-	if (mkvlist == NULL)
-		return 0;
 	/* Set defaults. */
 	config->mr_ext_memseg_en = 1;
 	config->mr_mempool_reg_en = 1;
@@ -335,6 +333,8 @@ mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist,
 	config->dbnc = MLX5_ARG_UNSET;
 	config->device_fd = MLX5_ARG_UNSET;
 	config->pd_handle = MLX5_ARG_UNSET;
+	if (mkvlist == NULL)
+		return 0;
 	/* Process common parameters. */
 	ret = mlx5_kvargs_process(mkvlist, params,
 				  mlx5_common_args_check_handler, config);
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 common/mlx5: fix missing default devargs initialization

Device arguments list is provided along with its identifier as part of EAL arguments.
The arguments specified in the list are taken from it, and the rest is initialized to the default values.

When no list is provided at all, all arguments should have been initialized to their default values. However, they are mistakenly initialized to zero which may be a valid value for some.

This patch initializes the default values before checking whether arguments have been specified.

Fixes a729d2f093e9 ("common/mlx5: refactor devargs management")

---

v2: updating Fixes reference hash.

 drivers/common/mlx5/mlx5_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +2 -2
index 94c303ce81..ef1604d223 100644
@@ -326,8 +326,6 @@ mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist,
 	};
 	int ret = 0;
 
-	if (mkvlist == NULL)
-		return 0;
 	/* Set defaults. */
 	config->mr_ext_memseg_en = 1;
 	config->mr_mempool_reg_en = 1;
@@ -335,6 +333,8 @@ mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist,
 	config->dbnc = MLX5_ARG_UNSET;
 	config->device_fd = MLX5_ARG_UNSET;
 	config->pd_handle = MLX5_ARG_UNSET;
+	if (mkvlist == NULL)
+		return 0;
 	/* Process common parameters. */
 	ret = mlx5_kvargs_process(mkvlist, params,
 				  mlx5_common_args_check_handler, config);
Signature · 1 line
2.25.1
#2 lore raw

Hi,

Quoted 13 lines

-----Original Message-----
From: Michael Baum <[email protected]>
Sent: Tuesday, March 1, 2022 1:10 PM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH v2] common/mlx5: fix missing default devargs initialization

Device arguments list is provided along with its identifier as part of EAL arguments.
The arguments specified in the list are taken from it, and the rest is initialized to the default values.

Quoted 8 lines

When no list is provided at all, all arguments should have been initialized to their default values. However, they are mistakenly initialized to zero which may be a valid value for some.

This patch initializes the default values before checking whether arguments have been specified.

Fixes a729d2f093e9 ("common/mlx5: refactor devargs management")

added:
Reported-at: https://bugs.dpdk.org/show_bug.cgi?id=945

Quoted 10 lines

---

v2: updating Fixes reference hash.

 drivers/common/mlx5/mlx5_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

#3 lore raw
Quoted 19 lines · Raslan Darawsheh

Hi,

Quoted 17 lines

-----Original Message-----
From: Michael Baum <[email protected]>
Sent: Tuesday, March 1, 2022 1:10 PM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH v2] common/mlx5: fix missing default devargs initialization

Device arguments list is provided along with its identifier as part of EAL arguments.
The arguments specified in the list are taken from it, and the rest is initialized to the default values.

When no list is provided at all, all arguments should have been initialized to their default values. However, they are mistakenly initialized to zero which may be a valid value for some.

Quoted 6 lines
Quoted 4 lines

This patch initializes the default values before checking whether arguments have been specified.

Fixes a729d2f093e9 ("common/mlx5: refactor devargs management")

added:
Reported-at: https://bugs.dpdk.org/show_bug.cgi?id=945

We have a defined keyword for it, and it should go before Fixes tag, like:

Bugzilla ID: 945

Fixes a729d2f093e9 ("common/mlx5: refactor devargs management")

updated accordingly in next-net

Quoted 15 lines
Quoted 10 lines

---

v2: updating Fixes reference hash.

  drivers/common/mlx5/mlx5_common.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh