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: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Yevgeny Petrilin 2009-04-20 04:26:05 +00:00 committed by David S. Miller
parent 9a4f92a603
commit 1e338db56e

View File

@ -348,12 +348,10 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
if (netif_msg_timer(priv))
mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port);
if (netif_carrier_ok(dev)) {
priv->port_stats.tx_timeout++;
mlx4_dbg(DRV, priv, "Scheduling watchdog\n");
queue_work(mdev->workqueue, &priv->watchdog_task);
}
}
static struct net_device_stats *mlx4_en_get_stats(struct net_device *dev)
@ -761,10 +759,15 @@ static void mlx4_en_restart(struct work_struct *work)
struct net_device *dev = priv->dev;
mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port);
mutex_lock(&mdev->state_lock);
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);
}
static int mlx4_en_open(struct net_device *dev)