Commit 0a56be3c authored by Aya Levin's avatar Aya Levin Committed by Saeed Mahameed

net/mlx5e: Gather reporters APIs together

Assemble all the API's to ease insertion of dump callbacks in the
following patches in the set.
Signed-off-by: default avatarAya Levin <ayal@mellanox.com>
Reviewed-by: default avatarMoshe Shemesh <moshe@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 12206b17
...@@ -102,19 +102,6 @@ static int mlx5e_rx_reporter_err_icosq_cqe_recover(void *ctx) ...@@ -102,19 +102,6 @@ static int mlx5e_rx_reporter_err_icosq_cqe_recover(void *ctx)
return err; return err;
} }
void mlx5e_reporter_icosq_cqe_err(struct mlx5e_icosq *icosq)
{
struct mlx5e_priv *priv = icosq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {};
err_ctx.ctx = icosq;
err_ctx.recover = mlx5e_rx_reporter_err_icosq_cqe_recover;
sprintf(err_str, "ERR CQE on ICOSQ: 0x%x", icosq->sqn);
mlx5e_health_report(priv, priv->rx_reporter, err_str, &err_ctx);
}
static int mlx5e_rq_to_ready(struct mlx5e_rq *rq, int curr_state) static int mlx5e_rq_to_ready(struct mlx5e_rq *rq, int curr_state)
{ {
struct net_device *dev = rq->netdev; struct net_device *dev = rq->netdev;
...@@ -171,19 +158,6 @@ static int mlx5e_rx_reporter_err_rq_cqe_recover(void *ctx) ...@@ -171,19 +158,6 @@ static int mlx5e_rx_reporter_err_rq_cqe_recover(void *ctx)
return err; return err;
} }
void mlx5e_reporter_rq_cqe_err(struct mlx5e_rq *rq)
{
struct mlx5e_priv *priv = rq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {};
err_ctx.ctx = rq;
err_ctx.recover = mlx5e_rx_reporter_err_rq_cqe_recover;
sprintf(err_str, "ERR CQE on RQ: 0x%x", rq->rqn);
mlx5e_health_report(priv, priv->rx_reporter, err_str, &err_ctx);
}
static int mlx5e_rx_reporter_timeout_recover(void *ctx) static int mlx5e_rx_reporter_timeout_recover(void *ctx)
{ {
struct mlx5e_icosq *icosq; struct mlx5e_icosq *icosq;
...@@ -201,21 +175,6 @@ static int mlx5e_rx_reporter_timeout_recover(void *ctx) ...@@ -201,21 +175,6 @@ static int mlx5e_rx_reporter_timeout_recover(void *ctx)
return err; return err;
} }
void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq)
{
struct mlx5e_icosq *icosq = &rq->channel->icosq;
struct mlx5e_priv *priv = rq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {};
err_ctx.ctx = rq;
err_ctx.recover = mlx5e_rx_reporter_timeout_recover;
sprintf(err_str, "RX timeout on channel: %d, ICOSQ: 0x%x RQ: 0x%x, CQ: 0x%x\n",
icosq->channel->ix, icosq->sqn, rq->rqn, rq->cq.mcq.cqn);
mlx5e_health_report(priv, priv->rx_reporter, err_str, &err_ctx);
}
static int mlx5e_rx_reporter_recover_from_ctx(struct mlx5e_err_ctx *err_ctx) static int mlx5e_rx_reporter_recover_from_ctx(struct mlx5e_err_ctx *err_ctx)
{ {
return err_ctx->recover(err_ctx->ctx); return err_ctx->recover(err_ctx->ctx);
...@@ -371,6 +330,47 @@ static int mlx5e_rx_reporter_diagnose(struct devlink_health_reporter *reporter, ...@@ -371,6 +330,47 @@ static int mlx5e_rx_reporter_diagnose(struct devlink_health_reporter *reporter,
return err; return err;
} }
void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq)
{
struct mlx5e_icosq *icosq = &rq->channel->icosq;
struct mlx5e_priv *priv = rq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {};
err_ctx.ctx = rq;
err_ctx.recover = mlx5e_rx_reporter_timeout_recover;
sprintf(err_str, "RX timeout on channel: %d, ICOSQ: 0x%x RQ: 0x%x, CQ: 0x%x\n",
icosq->channel->ix, icosq->sqn, rq->rqn, rq->cq.mcq.cqn);
mlx5e_health_report(priv, priv->rx_reporter, err_str, &err_ctx);
}
void mlx5e_reporter_rq_cqe_err(struct mlx5e_rq *rq)
{
struct mlx5e_priv *priv = rq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {};
err_ctx.ctx = rq;
err_ctx.recover = mlx5e_rx_reporter_err_rq_cqe_recover;
sprintf(err_str, "ERR CQE on RQ: 0x%x", rq->rqn);
mlx5e_health_report(priv, priv->rx_reporter, err_str, &err_ctx);
}
void mlx5e_reporter_icosq_cqe_err(struct mlx5e_icosq *icosq)
{
struct mlx5e_priv *priv = icosq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {};
err_ctx.ctx = icosq;
err_ctx.recover = mlx5e_rx_reporter_err_icosq_cqe_recover;
sprintf(err_str, "ERR CQE on ICOSQ: 0x%x", icosq->sqn);
mlx5e_health_report(priv, priv->rx_reporter, err_str, &err_ctx);
}
static const struct devlink_health_reporter_ops mlx5_rx_reporter_ops = { static const struct devlink_health_reporter_ops mlx5_rx_reporter_ops = {
.name = "rx", .name = "rx",
.recover = mlx5e_rx_reporter_recover, .recover = mlx5e_rx_reporter_recover,
......
...@@ -82,19 +82,6 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx) ...@@ -82,19 +82,6 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx)
return err; return err;
} }
void mlx5e_reporter_tx_err_cqe(struct mlx5e_txqsq *sq)
{
struct mlx5e_priv *priv = sq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {0};
err_ctx.ctx = sq;
err_ctx.recover = mlx5e_tx_reporter_err_cqe_recover;
sprintf(err_str, "ERR CQE on SQ: 0x%x", sq->sqn);
mlx5e_health_report(priv, priv->tx_reporter, err_str, &err_ctx);
}
static int mlx5e_tx_reporter_timeout_recover(void *ctx) static int mlx5e_tx_reporter_timeout_recover(void *ctx)
{ {
struct mlx5_eq_comp *eq; struct mlx5_eq_comp *eq;
...@@ -110,22 +97,6 @@ static int mlx5e_tx_reporter_timeout_recover(void *ctx) ...@@ -110,22 +97,6 @@ static int mlx5e_tx_reporter_timeout_recover(void *ctx)
return err; return err;
} }
int mlx5e_reporter_tx_timeout(struct mlx5e_txqsq *sq)
{
struct mlx5e_priv *priv = sq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx;
err_ctx.ctx = sq;
err_ctx.recover = mlx5e_tx_reporter_timeout_recover;
sprintf(err_str,
"TX timeout on queue: %d, SQ: 0x%x, CQ: 0x%x, SQ Cons: 0x%x SQ Prod: 0x%x, usecs since last trans: %u\n",
sq->channel->ix, sq->sqn, sq->cq.mcq.cqn, sq->cc, sq->pc,
jiffies_to_usecs(jiffies - sq->txq->trans_start));
return mlx5e_health_report(priv, priv->tx_reporter, err_str, &err_ctx);
}
/* state lock cannot be grabbed within this function. /* state lock cannot be grabbed within this function.
* It can cause a dead lock or a read-after-free. * It can cause a dead lock or a read-after-free.
*/ */
...@@ -275,6 +246,35 @@ static int mlx5e_tx_reporter_diagnose(struct devlink_health_reporter *reporter, ...@@ -275,6 +246,35 @@ static int mlx5e_tx_reporter_diagnose(struct devlink_health_reporter *reporter,
return err; return err;
} }
void mlx5e_reporter_tx_err_cqe(struct mlx5e_txqsq *sq)
{
struct mlx5e_priv *priv = sq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {};
err_ctx.ctx = sq;
err_ctx.recover = mlx5e_tx_reporter_err_cqe_recover;
sprintf(err_str, "ERR CQE on SQ: 0x%x", sq->sqn);
mlx5e_health_report(priv, priv->tx_reporter, err_str, &err_ctx);
}
int mlx5e_reporter_tx_timeout(struct mlx5e_txqsq *sq)
{
struct mlx5e_priv *priv = sq->channel->priv;
char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN];
struct mlx5e_err_ctx err_ctx = {};
err_ctx.ctx = sq;
err_ctx.recover = mlx5e_tx_reporter_timeout_recover;
sprintf(err_str,
"TX timeout on queue: %d, SQ: 0x%x, CQ: 0x%x, SQ Cons: 0x%x SQ Prod: 0x%x, usecs since last trans: %u\n",
sq->channel->ix, sq->sqn, sq->cq.mcq.cqn, sq->cc, sq->pc,
jiffies_to_usecs(jiffies - sq->txq->trans_start));
return mlx5e_health_report(priv, priv->tx_reporter, err_str, &err_ctx);
}
static const struct devlink_health_reporter_ops mlx5_tx_reporter_ops = { static const struct devlink_health_reporter_ops mlx5_tx_reporter_ops = {
.name = "tx", .name = "tx",
.recover = mlx5e_tx_reporter_recover, .recover = mlx5e_tx_reporter_recover,
......
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