Commit 1e338db5 authored by Yevgeny Petrilin's avatar Yevgeny Petrilin Committed by David S. Miller

mlx4_en: Fix a race at restart task

The query whether the port is up or not should be done at
the execution of the restart task and not when it is queued.
Signed-off-by: default avatarYevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9a4f92a6
...@@ -348,11 +348,9 @@ static void mlx4_en_tx_timeout(struct net_device *dev) ...@@ -348,11 +348,9 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
if (netif_msg_timer(priv)) if (netif_msg_timer(priv))
mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port); mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port);
if (netif_carrier_ok(dev)) { priv->port_stats.tx_timeout++;
priv->port_stats.tx_timeout++; mlx4_dbg(DRV, priv, "Scheduling watchdog\n");
mlx4_dbg(DRV, priv, "Scheduling watchdog\n"); queue_work(mdev->workqueue, &priv->watchdog_task);
queue_work(mdev->workqueue, &priv->watchdog_task);
}
} }
...@@ -761,9 +759,14 @@ static void mlx4_en_restart(struct work_struct *work) ...@@ -761,9 +759,14 @@ static void mlx4_en_restart(struct work_struct *work)
struct net_device *dev = priv->dev; struct net_device *dev = priv->dev;
mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port); mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port);
mlx4_en_stop_port(dev);
if (mlx4_en_start_port(dev)) mutex_lock(&mdev->state_lock);
mlx4_err(mdev, "Failed restarting port %d\n", priv->port); if (priv->port_up) {
mlx4_en_stop_port(dev);
if (mlx4_en_start_port(dev))
mlx4_err(mdev, "Failed restarting port %d\n", priv->port);
}
mutex_unlock(&mdev->state_lock);
} }
......
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