From: Eran Ben Elisha Date: Tue, 19 Feb 2019 13:26:04 +0000 (+0200) Subject: net/mlx5e: Re-add support for TX timeout when TX reporter is not valid X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2c493ae03a24db7117c812c5fd0adc90c19cc833;p=openwrt%2Fstaging%2Fblogic.git net/mlx5e: Re-add support for TX timeout when TX reporter is not valid When TX reporter was introduced, it took ownership over TX timeout error handling. this introduced a regression in case TX reporter is not valid (NET_DEVLINK is not set, or devlink_health_reporter_create failure). Fix mlx5e_tx_reporter_timeout function so it can be called at all times. In addition, remove a warning print that indicates that a TX timeout won't be handled in case of no valid TX reporter. Fixes: 7d91126b1aea ("net/mlx5e: Add tx timeout support for mlx5e tx reporter") Signed-off-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c index e05b8fce8dbb..201ea73e3021 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c @@ -113,6 +113,18 @@ static int mlx5e_tx_reporter_err_cqe_recover(struct mlx5e_txqsq *sq) return 0; } +static int mlx5_tx_health_report(struct devlink_health_reporter *tx_reporter, + char *err_str, + struct mlx5e_tx_err_ctx *err_ctx) +{ + if (IS_ERR_OR_NULL(tx_reporter)) { + netdev_err(err_ctx->sq->channel->netdev, err_str); + return err_ctx->recover(err_ctx->sq); + } + + return devlink_health_report(tx_reporter, err_str, err_ctx); +} + void mlx5e_tx_reporter_err_cqe(struct mlx5e_txqsq *sq) { char err_str[MLX5E_TX_REPORTER_PER_SQ_MAX_LEN]; @@ -122,7 +134,7 @@ void mlx5e_tx_reporter_err_cqe(struct mlx5e_txqsq *sq) err_ctx.recover = mlx5e_tx_reporter_err_cqe_recover; sprintf(err_str, "ERR CQE on SQ: 0x%x", sq->sqn); - devlink_health_report(sq->channel->priv->tx_reporter, err_str, + mlx5_tx_health_report(sq->channel->priv->tx_reporter, err_str, &err_ctx); } @@ -160,7 +172,7 @@ int mlx5e_tx_reporter_timeout(struct mlx5e_txqsq *sq) sq->channel->ix, sq->sqn, sq->cq.mcq.cqn, sq->cc, sq->pc, jiffies_to_usecs(jiffies - sq->txq->trans_start)); - return devlink_health_report(sq->channel->priv->tx_reporter, err_str, + return mlx5_tx_health_report(sq->channel->priv->tx_reporter, err_str, &err_ctx); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 878b3467e459..4f971f3d8ce7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4173,12 +4173,6 @@ static void mlx5e_tx_timeout(struct net_device *dev) struct mlx5e_priv *priv = netdev_priv(dev); netdev_err(dev, "TX timeout detected\n"); - - if (IS_ERR_OR_NULL(priv->tx_reporter)) { - netdev_err_once(priv->netdev, "tx timeout will not be handled, no valid tx reporter\n"); - return; - } - queue_work(priv->wq, &priv->tx_timeout_work); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index c1334a8ac8f3..d5fadbd6577e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -519,9 +519,8 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget) &sq->state)) { mlx5e_dump_error_cqe(sq, (struct mlx5_err_cqe *)cqe); - if (!IS_ERR_OR_NULL(cq->channel->priv->tx_reporter)) - queue_work(cq->channel->priv->wq, - &sq->recover_work); + queue_work(cq->channel->priv->wq, + &sq->recover_work); } stats->cqe_err++; }