net/mlx5e: Update netdev txq on completions during closure
authorMoshe Shemesh <moshe@mellanox.com>
Tue, 7 Apr 2020 14:38:28 +0000 (17:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jun 2020 06:16:29 +0000 (08:16 +0200)
[ Upstream commit 5e911e2c06bd8c17df29147a5e2d4b17fafda024 ]

On sq closure when we free its descriptors, we should also update netdev
txq on completions which would not arrive. Otherwise if we reopen sqs
and attach them back, for example on fw fatal recovery flow, we may get
tx timeout.

Fixes: 29429f3300a3 ("net/mlx5e: Timeout if SQ doesn't flush during close")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

index 574311018e6f56ae399259e86e22628d818638ea..f0a6b72497da97892c9bedc9cb44084261607b74 100644 (file)
@@ -499,8 +499,9 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
 static void mlx5e_free_txq_sq_descs(struct mlx5e_sq *sq)
 {
        struct mlx5e_tx_wqe_info *wi;
+       u32 nbytes = 0;
+       u16 ci, npkts = 0;
        struct sk_buff *skb;
-       u16 ci;
        int i;
 
        while (sq->cc != sq->pc) {
@@ -521,8 +522,11 @@ static void mlx5e_free_txq_sq_descs(struct mlx5e_sq *sq)
                }
 
                dev_kfree_skb_any(skb);
+               npkts++;
+               nbytes += wi->num_bytes;
                sq->cc += wi->num_wqebbs;
        }
+       netdev_tx_completed_queue(sq->txq, npkts, nbytes);
 }
 
 static void mlx5e_free_xdp_sq_descs(struct mlx5e_sq *sq)