Skip to content

Commit 839db99

Browse files
author
Mohammad Kabat
committed
net/mlx5: Fix driver use of uninitialized timeout
Bugzilla: https://bugzilla.redhat.com/2112940 Upstream-status: v6.0-rc1 commit 42b4f7f Author: Shay Drory <shayd@nvidia.com> Date: Mon Jun 27 16:05:31 2022 +0300 net/mlx5: Fix driver use of uninitialized timeout Currently, driver is setting default values to all timeouts during function setup. The offending commit is using a timeout before function setup, meaning: the timeout is 0 (or garbage), since no value have been set. This may result in failure to probe the driver: mlx5_function_setup:1034:(pid 69850): Firmware over 4294967296 MS in pre-initializing state, aborting probe_one:1591:(pid 69850): mlx5_init_one failed with error code -16 Hence, set default values to timeouts during tout_init() Fixes: 37ca95e ("net/mlx5: Increase FW pre-init timeout for health recovery") Signed-off-by: Shay Drory <shayd@nvidia.com> Reviewed-by: Moshe Shemesh <moshe@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Mohammad Kabat <mkabat@redhat.com>
1 parent ea5b7ff commit 839db99

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,17 @@ static void tout_set(struct mlx5_core_dev *dev, u64 val, enum mlx5_timeouts_type
3232
dev->timeouts->to[type] = val;
3333
}
3434

35-
void mlx5_tout_set_def_val(struct mlx5_core_dev *dev)
35+
int mlx5_tout_init(struct mlx5_core_dev *dev)
3636
{
3737
int i;
3838

39-
for (i = 0; i < MAX_TIMEOUT_TYPES; i++)
40-
tout_set(dev, tout_def_sw_val[i], i);
41-
}
42-
43-
int mlx5_tout_init(struct mlx5_core_dev *dev)
44-
{
4539
dev->timeouts = kmalloc(sizeof(*dev->timeouts), GFP_KERNEL);
4640
if (!dev->timeouts)
4741
return -ENOMEM;
4842

43+
for (i = 0; i < MAX_TIMEOUT_TYPES; i++)
44+
tout_set(dev, tout_def_sw_val[i], i);
45+
4946
return 0;
5047
}
5148

drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ int mlx5_tout_init(struct mlx5_core_dev *dev);
3535
void mlx5_tout_cleanup(struct mlx5_core_dev *dev);
3636
void mlx5_tout_query_iseg(struct mlx5_core_dev *dev);
3737
int mlx5_tout_query_dtor(struct mlx5_core_dev *dev);
38-
void mlx5_tout_set_def_val(struct mlx5_core_dev *dev);
3938
u64 _mlx5_tout_ms(struct mlx5_core_dev *dev, enum mlx5_timeouts_types type);
4039

4140
#define mlx5_tout_ms(dev, type) _mlx5_tout_ms(dev, MLX5_TO_##type##_MS)

drivers/net/ethernet/mellanox/mlx5/core/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,6 @@ static int mlx5_function_setup(struct mlx5_core_dev *dev, u64 timeout)
10231023
if (mlx5_core_is_pf(dev))
10241024
pcie_print_link_status(dev->pdev);
10251025

1026-
mlx5_tout_set_def_val(dev);
1027-
10281026
/* wait for firmware to accept initialization segments configurations
10291027
*/
10301028
err = wait_fw_init(dev, timeout,

0 commit comments

Comments
 (0)