mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 09:34:17 +00:00
net/mlx4_en: Fix transmit timeout when driver restarts port
Under heavy CPU load, changing, ring size/mtu/etc. could result in transmit timeout, since stop-start port might take more than 10 seconds. Calling netif_detach_device to prevent tx queue transmit timeout. netif_detach_device() is not called under ndo_stop, because netif_carrier_off will prevent the timeout, and device should not be marked as not present, or else user won't be able to start it later on. CC: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
955154fa33
commit
3484aac161
@ -496,7 +496,7 @@ static int mlx4_en_set_ringparam(struct net_device *dev,
|
|||||||
mutex_lock(&mdev->state_lock);
|
mutex_lock(&mdev->state_lock);
|
||||||
if (priv->port_up) {
|
if (priv->port_up) {
|
||||||
port_up = 1;
|
port_up = 1;
|
||||||
mlx4_en_stop_port(dev);
|
mlx4_en_stop_port(dev, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
mlx4_en_free_resources(priv);
|
mlx4_en_free_resources(priv);
|
||||||
@ -591,7 +591,7 @@ static int mlx4_en_set_rxfh_indir(struct net_device *dev,
|
|||||||
mutex_lock(&mdev->state_lock);
|
mutex_lock(&mdev->state_lock);
|
||||||
if (priv->port_up) {
|
if (priv->port_up) {
|
||||||
port_up = 1;
|
port_up = 1;
|
||||||
mlx4_en_stop_port(dev);
|
mlx4_en_stop_port(dev, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->prof->rss_rings = rss_rings;
|
priv->prof->rss_rings = rss_rings;
|
||||||
@ -1096,7 +1096,7 @@ static int mlx4_en_set_channels(struct net_device *dev,
|
|||||||
mutex_lock(&mdev->state_lock);
|
mutex_lock(&mdev->state_lock);
|
||||||
if (priv->port_up) {
|
if (priv->port_up) {
|
||||||
port_up = 1;
|
port_up = 1;
|
||||||
mlx4_en_stop_port(dev);
|
mlx4_en_stop_port(dev, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
mlx4_en_free_resources(priv);
|
mlx4_en_free_resources(priv);
|
||||||
|
@ -1178,6 +1178,8 @@ int mlx4_en_start_port(struct net_device *dev)
|
|||||||
|
|
||||||
priv->port_up = true;
|
priv->port_up = true;
|
||||||
netif_tx_start_all_queues(dev);
|
netif_tx_start_all_queues(dev);
|
||||||
|
netif_device_attach(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tx_err:
|
tx_err:
|
||||||
@ -1200,7 +1202,7 @@ cq_err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void mlx4_en_stop_port(struct net_device *dev)
|
void mlx4_en_stop_port(struct net_device *dev, int detach)
|
||||||
{
|
{
|
||||||
struct mlx4_en_priv *priv = netdev_priv(dev);
|
struct mlx4_en_priv *priv = netdev_priv(dev);
|
||||||
struct mlx4_en_dev *mdev = priv->mdev;
|
struct mlx4_en_dev *mdev = priv->mdev;
|
||||||
@ -1216,9 +1218,13 @@ void mlx4_en_stop_port(struct net_device *dev)
|
|||||||
|
|
||||||
/* Synchronize with tx routine */
|
/* Synchronize with tx routine */
|
||||||
netif_tx_lock_bh(dev);
|
netif_tx_lock_bh(dev);
|
||||||
|
if (detach)
|
||||||
|
netif_device_detach(dev);
|
||||||
netif_tx_stop_all_queues(dev);
|
netif_tx_stop_all_queues(dev);
|
||||||
netif_tx_unlock_bh(dev);
|
netif_tx_unlock_bh(dev);
|
||||||
|
|
||||||
|
netif_tx_disable(dev);
|
||||||
|
|
||||||
/* Set port as not active */
|
/* Set port as not active */
|
||||||
priv->port_up = false;
|
priv->port_up = false;
|
||||||
|
|
||||||
@ -1323,7 +1329,7 @@ static void mlx4_en_restart(struct work_struct *work)
|
|||||||
|
|
||||||
mutex_lock(&mdev->state_lock);
|
mutex_lock(&mdev->state_lock);
|
||||||
if (priv->port_up) {
|
if (priv->port_up) {
|
||||||
mlx4_en_stop_port(dev);
|
mlx4_en_stop_port(dev, 1);
|
||||||
for (i = 0; i < priv->tx_ring_num; i++)
|
for (i = 0; i < priv->tx_ring_num; i++)
|
||||||
netdev_tx_reset_queue(priv->tx_ring[i].tx_queue);
|
netdev_tx_reset_queue(priv->tx_ring[i].tx_queue);
|
||||||
if (mlx4_en_start_port(dev))
|
if (mlx4_en_start_port(dev))
|
||||||
@ -1395,7 +1401,7 @@ static int mlx4_en_close(struct net_device *dev)
|
|||||||
|
|
||||||
mutex_lock(&mdev->state_lock);
|
mutex_lock(&mdev->state_lock);
|
||||||
|
|
||||||
mlx4_en_stop_port(dev);
|
mlx4_en_stop_port(dev, 0);
|
||||||
netif_carrier_off(dev);
|
netif_carrier_off(dev);
|
||||||
|
|
||||||
mutex_unlock(&mdev->state_lock);
|
mutex_unlock(&mdev->state_lock);
|
||||||
@ -1533,7 +1539,7 @@ static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
|
|||||||
* the port */
|
* the port */
|
||||||
en_dbg(DRV, priv, "Change MTU called with card down!?\n");
|
en_dbg(DRV, priv, "Change MTU called with card down!?\n");
|
||||||
} else {
|
} else {
|
||||||
mlx4_en_stop_port(dev);
|
mlx4_en_stop_port(dev, 1);
|
||||||
err = mlx4_en_start_port(dev);
|
err = mlx4_en_start_port(dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
en_err(priv, "Failed restarting port:%d\n",
|
en_err(priv, "Failed restarting port:%d\n",
|
||||||
|
@ -539,7 +539,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
|
|||||||
struct mlx4_en_port_profile *prof);
|
struct mlx4_en_port_profile *prof);
|
||||||
|
|
||||||
int mlx4_en_start_port(struct net_device *dev);
|
int mlx4_en_start_port(struct net_device *dev);
|
||||||
void mlx4_en_stop_port(struct net_device *dev);
|
void mlx4_en_stop_port(struct net_device *dev, int detach);
|
||||||
|
|
||||||
void mlx4_en_free_resources(struct mlx4_en_priv *priv);
|
void mlx4_en_free_resources(struct mlx4_en_priv *priv);
|
||||||
int mlx4_en_alloc_resources(struct mlx4_en_priv *priv);
|
int mlx4_en_alloc_resources(struct mlx4_en_priv *priv);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user