Linux Audio

Check our new training course

Loading...
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/* Copyright (c) 2019 Mellanox Technologies. */
 3
 4#ifndef __MLX5E_EN_HEALTH_H
 5#define __MLX5E_EN_HEALTH_H
 6
 7#include "en.h"
 8#include "diag/rsc_dump.h"
 9
10static inline bool cqe_syndrome_needs_recover(u8 syndrome)
11{
12	return syndrome == MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR ||
13	       syndrome == MLX5_CQE_SYNDROME_LOCAL_PROT_ERR ||
14	       syndrome == MLX5_CQE_SYNDROME_WR_FLUSH_ERR;
15}
16
17void mlx5e_reporter_tx_create(struct mlx5e_priv *priv);
18void mlx5e_reporter_tx_destroy(struct mlx5e_priv *priv);
19void mlx5e_reporter_tx_err_cqe(struct mlx5e_txqsq *sq);
20int mlx5e_reporter_tx_timeout(struct mlx5e_txqsq *sq);
21void mlx5e_reporter_tx_ptpsq_unhealthy(struct mlx5e_ptpsq *ptpsq);
22
23void mlx5e_health_cq_diag_fmsg(struct mlx5e_cq *cq, struct devlink_fmsg *fmsg);
24void mlx5e_health_cq_common_diag_fmsg(struct mlx5e_cq *cq, struct devlink_fmsg *fmsg);
25void mlx5e_health_eq_diag_fmsg(struct mlx5_eq_comp *eq, struct devlink_fmsg *fmsg);
26void mlx5e_health_fmsg_named_obj_nest_start(struct devlink_fmsg *fmsg, char *name);
27void mlx5e_health_fmsg_named_obj_nest_end(struct devlink_fmsg *fmsg);
28
29void mlx5e_reporter_rx_create(struct mlx5e_priv *priv);
30void mlx5e_reporter_rx_destroy(struct mlx5e_priv *priv);
31void mlx5e_reporter_icosq_cqe_err(struct mlx5e_icosq *icosq);
32void mlx5e_reporter_rq_cqe_err(struct mlx5e_rq *rq);
33void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq);
34void mlx5e_reporter_icosq_suspend_recovery(struct mlx5e_channel *c);
35void mlx5e_reporter_icosq_resume_recovery(struct mlx5e_channel *c);
36
37#define MLX5E_REPORTER_PER_Q_MAX_LEN 256
38
39struct mlx5e_err_ctx {
40	int (*recover)(void *ctx);
41	int (*dump)(struct mlx5e_priv *priv, struct devlink_fmsg *fmsg, void *ctx);
42	void *ctx;
43};
44
45int mlx5e_health_sq_to_ready(struct mlx5_core_dev *mdev, struct net_device *dev, u32 sqn);
46int mlx5e_health_channel_eq_recover(struct net_device *dev, struct mlx5_eq_comp *eq,
47				    struct mlx5e_ch_stats *stats);
48int mlx5e_health_recover_channels(struct mlx5e_priv *priv);
49int mlx5e_health_report(struct mlx5e_priv *priv,
50			struct devlink_health_reporter *reporter, char *err_str,
51			struct mlx5e_err_ctx *err_ctx);
52void mlx5e_health_create_reporters(struct mlx5e_priv *priv);
53void mlx5e_health_destroy_reporters(struct mlx5e_priv *priv);
54void mlx5e_health_channels_update(struct mlx5e_priv *priv);
55int mlx5e_health_rsc_fmsg_dump(struct mlx5e_priv *priv, struct mlx5_rsc_key *key,
56			       struct devlink_fmsg *fmsg);
57void mlx5e_health_queue_dump(struct mlx5e_priv *priv, struct devlink_fmsg *fmsg,
58			     int queue_idx, char *lbl);
59#endif