Commit 0cc5c8bf authored by Eugenia Emantayev's avatar Eugenia Emantayev Committed by David S. Miller

net/mlx4_en: Fix a race between napi poll function and RX ring cleanup

The RX rings were cleaned while there was still possible RX traffic completion
handling.
Change the sequance of events so that the port is closed and the QPs are being
stopped before RX cleanup.
Signed-off-by: default avatarEugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: default avatarAmir Vadai <amirv@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e19b545
...@@ -1635,6 +1635,9 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) ...@@ -1635,6 +1635,9 @@ void mlx4_en_stop_port(struct net_device *dev, int detach)
return; return;
} }
/* close port*/
mlx4_CLOSE_PORT(mdev->dev, priv->port);
/* Synchronize with tx routine */ /* Synchronize with tx routine */
netif_tx_lock_bh(dev); netif_tx_lock_bh(dev);
if (detach) if (detach)
...@@ -1735,14 +1738,11 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) ...@@ -1735,14 +1738,11 @@ void mlx4_en_stop_port(struct net_device *dev, int detach)
} }
local_bh_enable(); local_bh_enable();
mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]);
while (test_bit(NAPI_STATE_SCHED, &cq->napi.state)) while (test_bit(NAPI_STATE_SCHED, &cq->napi.state))
msleep(1); msleep(1);
mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]);
mlx4_en_deactivate_cq(priv, cq); mlx4_en_deactivate_cq(priv, cq);
} }
/* close port*/
mlx4_CLOSE_PORT(mdev->dev, priv->port);
} }
static void mlx4_en_restart(struct work_struct *work) static void mlx4_en_restart(struct work_struct *work)
......
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