Patchwork [v2] mlx4_en: Fix BQL reset TX queue call point

login
register
mail settings
Submitter Tom Herbert
Date Feb. 6, 2013, 5:58 p.m.
Message ID <alpine.DEB.2.00.1302060955490.26438@pokey.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/218707/
State Accepted
Delegated to: David Miller
Headers show

Comments

Tom Herbert - Feb. 6, 2013, 5:58 p.m.
Fix issue in Mellanox driver related to BQL.  netdev_tx_reset_queue
was not being called in certain situations where the device was
being start and stopped.  Moved netdev_tx_reset_queue from the reset
device path to mlx4_en_free_tx_buf which is where the rings are
cleaned in a reset (specifically from device being stopped).

Signed-off-by: Tom Herbert <therbert@google.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 3 ---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c     | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
David Miller - Feb. 6, 2013, 9:11 p.m.
From: Tom Herbert <therbert@google.com>
Date: Wed, 6 Feb 2013 09:58:41 -0800 (PST)

> Fix issue in Mellanox driver related to BQL.  netdev_tx_reset_queue
> was not being called in certain situations where the device was
> being start and stopped.  Moved netdev_tx_reset_queue from the reset
> device path to mlx4_en_free_tx_buf which is where the rings are
> cleaned in a reset (specifically from device being stopped).
> 
> Signed-off-by: Tom Herbert <therbert@google.com>

Mellanox folks, please review.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Amir Vadai - Feb. 7, 2013, 6:52 a.m.
On 06/02/2013 19:58, Tom Herbert wrote:
> Fix issue in Mellanox driver related to BQL.  netdev_tx_reset_queue
> was not being called in certain situations where the device was
> being start and stopped.  Moved netdev_tx_reset_queue from the reset
> device path to mlx4_en_free_tx_buf which is where the rings are
> cleaned in a reset (specifically from device being stopped).
> 
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 3 ---
>  drivers/net/ethernet/mellanox/mlx4/en_tx.c     | 2 ++
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> index ac1c14f..94042f6 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> @@ -1323,15 +1323,12 @@ static void mlx4_en_restart(struct work_struct *work)
>  						 watchdog_task);
>  	struct mlx4_en_dev *mdev = priv->mdev;
>  	struct net_device *dev = priv->dev;
> -	int i;
>  
>  	en_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, 1);
> -		for (i = 0; i < priv->tx_ring_num; i++)
> -			netdev_tx_reset_queue(priv->tx_ring[i].tx_queue);
>  		if (mlx4_en_start_port(dev))
>  			en_err(priv, "Failed restarting port %d\n", priv->port);
>  	}
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> index 30724d8..e06fce7 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> @@ -294,6 +294,8 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring)
>  		cnt++;
>  	}
>  
> +	netdev_tx_reset_queue(ring->tx_queue);
> +
>  	if (cnt)
>  		en_dbg(DRV, priv, "Freed %d uncompleted tx descriptors\n", cnt);
>  
> 

Acked-By: Amir Vadai <amirv@mellanox.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Feb. 8, 2013, 4:34 a.m.
From: Amir Vadai <amirv@mellanox.com>
Date: Thu, 7 Feb 2013 08:52:35 +0200

> On 06/02/2013 19:58, Tom Herbert wrote:
>> Fix issue in Mellanox driver related to BQL.  netdev_tx_reset_queue
>> was not being called in certain situations where the device was
>> being start and stopped.  Moved netdev_tx_reset_queue from the reset
>> device path to mlx4_en_free_tx_buf which is where the rings are
>> cleaned in a reset (specifically from device being stopped).
>> 
>> Signed-off-by: Tom Herbert <therbert@google.com>
...
> Acked-By: Amir Vadai <amirv@mellanox.com>

Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index ac1c14f..94042f6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1323,15 +1323,12 @@  static void mlx4_en_restart(struct work_struct *work)
 						 watchdog_task);
 	struct mlx4_en_dev *mdev = priv->mdev;
 	struct net_device *dev = priv->dev;
-	int i;
 
 	en_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, 1);
-		for (i = 0; i < priv->tx_ring_num; i++)
-			netdev_tx_reset_queue(priv->tx_ring[i].tx_queue);
 		if (mlx4_en_start_port(dev))
 			en_err(priv, "Failed restarting port %d\n", priv->port);
 	}
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 30724d8..e06fce7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -294,6 +294,8 @@  int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring)
 		cnt++;
 	}
 
+	netdev_tx_reset_queue(ring->tx_queue);
+
 	if (cnt)
 		en_dbg(DRV, priv, "Freed %d uncompleted tx descriptors\n", cnt);