diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index db1c9f0bb46c..cdefe7e013f6 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -723,7 +723,8 @@ struct mlx5_core_dev { u32 vsc_addr; u32 issi; struct mlx5_special_contexts special_contexts; - unsigned int module_status[MLX5_MAX_PORTS]; + unsigned int module_status; + unsigned int module_num; struct mlx5_flow_root_namespace *root_ns; struct mlx5_flow_root_namespace *fdb_root_ns; struct mlx5_flow_root_namespace *esw_egress_root_ns; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c index 29c12e41650e..1090f8638171 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c @@ -690,9 +690,9 @@ static const char *mlx5_port_module_event_error_type_to_string(u8 error_type) unsigned int mlx5_query_module_status(struct mlx5_core_dev *dev, int module_num) { - if (module_num < 0 || module_num >= MLX5_MAX_PORTS) - return 0; /* undefined */ - return dev->module_status[module_num]; + if (module_num != dev->module_num) + return 0; /* module num doesn't equal to what FW reported */ + return dev->module_status; } static void mlx5_port_module_event(struct mlx5_core_dev *dev, @@ -740,8 +740,8 @@ static void mlx5_port_module_event(struct mlx5_core_dev *dev, "Module %u, unknown status %d\n", module_num, module_status); } /* store module status */ - if (module_num < MLX5_MAX_PORTS) - dev->module_status[module_num] = module_status; + dev->module_status = module_status; + dev->module_num = module_num; } static void mlx5_port_general_notification_event(struct mlx5_core_dev *dev,