Commit 1865ea9a authored by Ilan Tayari's avatar Ilan Tayari Committed by David S. Miller

net/mlx5: Add temperature warning event to log

Temperature warning event is sent by FW to indicate high temperature
as detected by one of the sensors on the board.
Add handling of this event by writing the numbers of the alert sensors
to the kernel log.
Signed-off-by: default avatarIlan Tayari <ilant@mellanox.com>
Signed-off-by: default avatarAdi Nissim <adin@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 35aada99
...@@ -144,6 +144,8 @@ static const char *eqe_type_str(u8 type) ...@@ -144,6 +144,8 @@ static const char *eqe_type_str(u8 type)
return "MLX5_EVENT_TYPE_GPIO_EVENT"; return "MLX5_EVENT_TYPE_GPIO_EVENT";
case MLX5_EVENT_TYPE_PORT_MODULE_EVENT: case MLX5_EVENT_TYPE_PORT_MODULE_EVENT:
return "MLX5_EVENT_TYPE_PORT_MODULE_EVENT"; return "MLX5_EVENT_TYPE_PORT_MODULE_EVENT";
case MLX5_EVENT_TYPE_TEMP_WARN_EVENT:
return "MLX5_EVENT_TYPE_TEMP_WARN_EVENT";
case MLX5_EVENT_TYPE_REMOTE_CONFIG: case MLX5_EVENT_TYPE_REMOTE_CONFIG:
return "MLX5_EVENT_TYPE_REMOTE_CONFIG"; return "MLX5_EVENT_TYPE_REMOTE_CONFIG";
case MLX5_EVENT_TYPE_DB_BF_CONGESTION: case MLX5_EVENT_TYPE_DB_BF_CONGESTION:
...@@ -396,6 +398,20 @@ static void general_event_handler(struct mlx5_core_dev *dev, ...@@ -396,6 +398,20 @@ static void general_event_handler(struct mlx5_core_dev *dev,
} }
} }
static void mlx5_temp_warning_event(struct mlx5_core_dev *dev,
struct mlx5_eqe *eqe)
{
u64 value_lsb;
u64 value_msb;
value_lsb = be64_to_cpu(eqe->data.temp_warning.sensor_warning_lsb);
value_msb = be64_to_cpu(eqe->data.temp_warning.sensor_warning_msb);
mlx5_core_warn(dev,
"High temperature on sensors with bit set %llx %llx",
value_msb, value_lsb);
}
/* caller must eventually call mlx5_cq_put on the returned cq */ /* caller must eventually call mlx5_cq_put on the returned cq */
static struct mlx5_core_cq *mlx5_eq_cq_get(struct mlx5_eq *eq, u32 cqn) static struct mlx5_core_cq *mlx5_eq_cq_get(struct mlx5_eq *eq, u32 cqn)
{ {
...@@ -550,6 +566,10 @@ static irqreturn_t mlx5_eq_int(int irq, void *eq_ptr) ...@@ -550,6 +566,10 @@ static irqreturn_t mlx5_eq_int(int irq, void *eq_ptr)
mlx5_fpga_event(dev, eqe->type, &eqe->data.raw); mlx5_fpga_event(dev, eqe->type, &eqe->data.raw);
break; break;
case MLX5_EVENT_TYPE_TEMP_WARN_EVENT:
mlx5_temp_warning_event(dev, eqe);
break;
case MLX5_EVENT_TYPE_GENERAL_EVENT: case MLX5_EVENT_TYPE_GENERAL_EVENT:
general_event_handler(dev, eqe); general_event_handler(dev, eqe);
break; break;
...@@ -827,6 +847,9 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) ...@@ -827,6 +847,9 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev)
async_event_mask |= (1ull << MLX5_EVENT_TYPE_DCT_DRAINED); async_event_mask |= (1ull << MLX5_EVENT_TYPE_DCT_DRAINED);
if (MLX5_CAP_GEN(dev, temp_warn_event))
async_event_mask |= (1ull << MLX5_EVENT_TYPE_TEMP_WARN_EVENT);
err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD, err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD,
MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD,
"mlx5_cmd_eq", MLX5_EQ_TYPE_ASYNC); "mlx5_cmd_eq", MLX5_EQ_TYPE_ASYNC);
......
...@@ -314,6 +314,7 @@ enum mlx5_event { ...@@ -314,6 +314,7 @@ enum mlx5_event {
MLX5_EVENT_TYPE_PORT_CHANGE = 0x09, MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
MLX5_EVENT_TYPE_GPIO_EVENT = 0x15, MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
MLX5_EVENT_TYPE_PORT_MODULE_EVENT = 0x16, MLX5_EVENT_TYPE_PORT_MODULE_EVENT = 0x16,
MLX5_EVENT_TYPE_TEMP_WARN_EVENT = 0x17,
MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19, MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
MLX5_EVENT_TYPE_GENERAL_EVENT = 0x22, MLX5_EVENT_TYPE_GENERAL_EVENT = 0x22,
MLX5_EVENT_TYPE_PPS_EVENT = 0x25, MLX5_EVENT_TYPE_PPS_EVENT = 0x25,
...@@ -626,6 +627,11 @@ struct mlx5_eqe_dct { ...@@ -626,6 +627,11 @@ struct mlx5_eqe_dct {
__be32 dctn; __be32 dctn;
}; };
struct mlx5_eqe_temp_warning {
__be64 sensor_warning_msb;
__be64 sensor_warning_lsb;
} __packed;
union ev_data { union ev_data {
__be32 raw[7]; __be32 raw[7];
struct mlx5_eqe_cmd cmd; struct mlx5_eqe_cmd cmd;
...@@ -642,6 +648,7 @@ union ev_data { ...@@ -642,6 +648,7 @@ union ev_data {
struct mlx5_eqe_port_module port_module; struct mlx5_eqe_port_module port_module;
struct mlx5_eqe_pps pps; struct mlx5_eqe_pps pps;
struct mlx5_eqe_dct dct; struct mlx5_eqe_dct dct;
struct mlx5_eqe_temp_warning temp_warning;
} __packed; } __packed;
struct mlx5_eqe { struct mlx5_eqe {
......
...@@ -912,7 +912,7 @@ struct mlx5_ifc_cmd_hca_cap_bits { ...@@ -912,7 +912,7 @@ struct mlx5_ifc_cmd_hca_cap_bits {
u8 log_max_msg[0x5]; u8 log_max_msg[0x5];
u8 reserved_at_1c8[0x4]; u8 reserved_at_1c8[0x4];
u8 max_tc[0x4]; u8 max_tc[0x4];
u8 reserved_at_1d0[0x1]; u8 temp_warn_event[0x1];
u8 dcbx[0x1]; u8 dcbx[0x1];
u8 general_notification_event[0x1]; u8 general_notification_event[0x1];
u8 reserved_at_1d3[0x2]; u8 reserved_at_1d3[0x2];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment