#include <linux/kernel.h>
#include <linux/random.h>
#include <linux/vmalloc.h>
#include <linux/hardirq.h>
#include <linux/mlx5/driver.h>
#include <linux/kern_levels.h>
#include "mlx5_core.h"
#include "lib/eq.h"
#include "lib/mlx5.h"
#include "lib/events.h"
#include "lib/pci_vsc.h"
#include "lib/tout.h"
#include "diag/fw_tracer.h"
#include "diag/reporter_vnic.h"
enum { … };
enum { … };
enum { … };
enum { … };
u8 mlx5_get_nic_state(struct mlx5_core_dev *dev)
{ … }
void mlx5_set_nic_state(struct mlx5_core_dev *dev, u8 state)
{ … }
static bool sensor_pci_not_working(struct mlx5_core_dev *dev)
{ … }
static int mlx5_health_get_rfr(u8 rfr_severity)
{ … }
static bool sensor_fw_synd_rfr(struct mlx5_core_dev *dev)
{ … }
u32 mlx5_health_check_fatal_sensors(struct mlx5_core_dev *dev)
{ … }
static int lock_sem_sw_reset(struct mlx5_core_dev *dev, bool lock)
{ … }
static bool reset_fw_if_needed(struct mlx5_core_dev *dev)
{ … }
static void enter_error_state(struct mlx5_core_dev *dev, bool force)
{ … }
void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force)
{ … }
void mlx5_error_sw_reset(struct mlx5_core_dev *dev)
{ … }
static void mlx5_handle_bad_state(struct mlx5_core_dev *dev)
{ … }
int mlx5_health_wait_pci_up(struct mlx5_core_dev *dev)
{ … }
static int mlx5_health_try_recover(struct mlx5_core_dev *dev)
{ … }
static const char *hsynd_str(u8 synd)
{ … }
static const char *mlx5_loglevel_str(int level)
{ … }
static int mlx5_health_get_severity(u8 rfr_severity)
{ … }
static void print_health_info(struct mlx5_core_dev *dev)
{ … }
static int
mlx5_fw_reporter_diagnose(struct devlink_health_reporter *reporter,
struct devlink_fmsg *fmsg,
struct netlink_ext_ack *extack)
{ … }
struct mlx5_fw_reporter_ctx { … };
static void
mlx5_fw_reporter_ctx_pairs_put(struct devlink_fmsg *fmsg,
struct mlx5_fw_reporter_ctx *fw_reporter_ctx)
{ … }
static void
mlx5_fw_reporter_heath_buffer_data_put(struct mlx5_core_dev *dev,
struct devlink_fmsg *fmsg)
{ … }
static int
mlx5_fw_reporter_dump(struct devlink_health_reporter *reporter,
struct devlink_fmsg *fmsg, void *priv_ctx,
struct netlink_ext_ack *extack)
{ … }
static void mlx5_fw_reporter_err_work(struct work_struct *work)
{ … }
static const struct devlink_health_reporter_ops mlx5_fw_reporter_pf_ops = …;
static const struct devlink_health_reporter_ops mlx5_fw_reporter_ops = …;
static int
mlx5_fw_fatal_reporter_recover(struct devlink_health_reporter *reporter,
void *priv_ctx,
struct netlink_ext_ack *extack)
{ … }
static int
mlx5_fw_fatal_reporter_dump(struct devlink_health_reporter *reporter,
struct devlink_fmsg *fmsg, void *priv_ctx,
struct netlink_ext_ack *extack)
{ … }
static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work)
{ … }
static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_pf_ops = …;
static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_ops = …;
#define MLX5_FW_REPORTER_ECPF_GRACEFUL_PERIOD …
#define MLX5_FW_REPORTER_PF_GRACEFUL_PERIOD …
#define MLX5_FW_REPORTER_VF_GRACEFUL_PERIOD …
#define MLX5_FW_REPORTER_DEFAULT_GRACEFUL_PERIOD …
void mlx5_fw_reporters_create(struct mlx5_core_dev *dev)
{ … }
static void mlx5_fw_reporters_destroy(struct mlx5_core_dev *dev)
{ … }
static unsigned long get_next_poll_jiffies(struct mlx5_core_dev *dev)
{ … }
void mlx5_trigger_health_work(struct mlx5_core_dev *dev)
{ … }
#define MLX5_MSEC_PER_HOUR …
static void mlx5_health_log_ts_update(struct work_struct *work)
{ … }
static void poll_health(struct timer_list *t)
{ … }
void mlx5_start_health_poll(struct mlx5_core_dev *dev)
{ … }
void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health)
{ … }
void mlx5_start_health_fw_log_up(struct mlx5_core_dev *dev)
{ … }
void mlx5_drain_health_wq(struct mlx5_core_dev *dev)
{ … }
void mlx5_health_cleanup(struct mlx5_core_dev *dev)
{ … }
int mlx5_health_init(struct mlx5_core_dev *dev)
{ … }