Add log message for unsupported QSFPs in mlx5core.

Submitted by:	Matthew Finlay <matt@mellanox.com>
MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
hselasky 2018-03-07 14:51:50 +00:00
parent ab9224328e
commit 94029962b9
3 changed files with 17 additions and 10 deletions

View File

@ -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,
};

View File

@ -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);
}

View File

@ -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;
}