From 94029962b995e2107e5757dd1890f85c3868efb2 Mon Sep 17 00:00:00 2001 From: hselasky Date: Wed, 7 Mar 2018 14:51:50 +0000 Subject: [PATCH] Add log message for unsupported QSFPs in mlx5core. Submitted by: Matthew Finlay MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/dev/mlx5/device.h | 9 +++++---- sys/dev/mlx5/mlx5_core/mlx5_eq.c | 12 ++++++++---- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 6 ++++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/sys/dev/mlx5/device.h b/sys/dev/mlx5/device.h index b387131a2f7d..277e7a90b262 100644 --- a/sys/dev/mlx5/device.h +++ b/sys/dev/mlx5/device.h @@ -501,9 +501,10 @@ struct mlx5_eqe_vport_change { #define PORT_MODULE_EVENT_ERROR_TYPE_MASK 0xF enum { - MLX5_MODULE_STATUS_PLUGGED = 0x1, - MLX5_MODULE_STATUS_UNPLUGGED = 0x2, - MLX5_MODULE_STATUS_ERROR = 0x3, + MLX5_MODULE_STATUS_PLUGGED_ENABLED = 0x1, + MLX5_MODULE_STATUS_UNPLUGGED = 0x2, + MLX5_MODULE_STATUS_ERROR = 0x3, + MLX5_MODULE_STATUS_PLUGGED_DISABLED = 0x4, }; enum { @@ -512,7 +513,7 @@ enum { MLX5_MODULE_EVENT_ERROR_BUS_STUCK = 0x2, MLX5_MODULE_EVENT_ERROR_NO_EEPROM_RETRY_TIMEOUT = 0x3, MLX5_MODULE_EVENT_ERROR_ENFORCE_PART_NUMBER_LIST = 0x4, - MLX5_MODULE_EVENT_ERROR_UNKNOWN_IDENTIFIER = 0x5, + MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE = 0x5, MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE = 0x6, MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED = 0x7, }; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c index f4d1f0a198ad..df19dc2a9311 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c @@ -618,8 +618,8 @@ static const char *mlx5_port_module_event_error_type_to_string(u8 error_type) return "No EEPROM/retry timeout"; case MLX5_MODULE_EVENT_ERROR_ENFORCE_PART_NUMBER_LIST: return "Enforce part number list"; - case MLX5_MODULE_EVENT_ERROR_UNKNOWN_IDENTIFIER: - return "Unknown identifier"; + case MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE: + return "Unsupported Cable"; case MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE: return "High Temperature"; case MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED: @@ -655,8 +655,8 @@ static void mlx5_port_module_event(struct mlx5_core_dev *dev, PORT_MODULE_EVENT_ERROR_TYPE_MASK; switch (module_status) { - case MLX5_MODULE_STATUS_PLUGGED: - device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: plugged\n", module_num); + case MLX5_MODULE_STATUS_PLUGGED_ENABLED: + device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: plugged and enabled\n", module_num); break; case MLX5_MODULE_STATUS_UNPLUGGED: @@ -667,6 +667,10 @@ static void mlx5_port_module_event(struct mlx5_core_dev *dev, device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: error, %s\n", module_num, mlx5_port_module_event_error_type_to_string(error_type)); break; + case MLX5_MODULE_STATUS_PLUGGED_DISABLED: + device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: plugged but disabled\n", module_num); + break; + default: device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, unknown status\n", module_num); } diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 7e8900b704df..1bde343ff4f0 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2639,6 +2639,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) int error = 0; int mask = 0; int size_read = 0; + int module_status; int module_num; int max_mtu; uint8_t read_addr; @@ -2838,8 +2839,9 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) goto err_i2c; } /* Check if module is present before doing an access */ - if (mlx5_query_module_status(priv->mdev, module_num) != - MLX5_MODULE_STATUS_PLUGGED) { + module_status = mlx5_query_module_status(priv->mdev, module_num); + if (module_status != MLX5_MODULE_STATUS_PLUGGED_ENABLED && + module_status != MLX5_MODULE_STATUS_PLUGGED_DISABLED) { error = EINVAL; goto err_i2c; }