net/mlx5e: Re-add support for TX timeout when TX reporter is not valid
authorEran Ben Elisha <eranbe@mellanox.com>
Tue, 19 Feb 2019 13:26:04 +0000 (15:26 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 22 Feb 2019 21:38:24 +0000 (13:38 -0800)
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 <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

index e05b8fc..201ea73 100644 (file)
@@ -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);
 }
 
index 878b346..4f971f3 100644 (file)
@@ -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);
 }
 
index c1334a8..d5fadbd 100644 (file)
@@ -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++;
                }