From: Eric Dumazet <eric.dumazet@gmail.com>
To: Amir Vadai <amirv@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
Yevgeny Petrilin <yevgenyp@mellanox.com>,
Eugenia Emantayev <eugenia@mellanox.com>
Subject: Re: [PATCH net-next V1 5/6] net/mlx4_en: Fix a race when closing TX queue
Date: Thu, 17 Jan 2013 06:22:18 -0800 [thread overview]
Message-ID: <1358432538.29723.8.camel@edumazet-glaptop> (raw)
In-Reply-To: <1358423241-2452-6-git-send-email-amirv@mellanox.com>
On Thu, 2013-01-17 at 13:47 +0200, Amir Vadai wrote:
> There is a possible race where the TX completion handler can clean the
> entire TX queue between the decision that the queue is full and actually
> closing it. To avoid this situation, check again if the queue is really
> full, if not, reopen the transmit and continue with sending the packet.
>
> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.com>
> Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
> Signed-off-by: Amir Vadai <amirv@mellanox.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/en_tx.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> index 2b799f4..1d17f5f 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> @@ -592,7 +592,14 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
> netif_tx_stop_queue(ring->tx_queue);
> priv->port_stats.queue_stopped++;
>
> - return NETDEV_TX_BUSY;
> + /* Check again whether the queue was cleaned */
> + if (unlikely(((int)(ring->prod - ring->cons)) <=
> + ring->size - HEADROOM - MAX_DESC_TXBBS)) {
> + netif_tx_wake_queue(ring->tx_queue);
> + priv->port_stats.wake_queue++;
> + } else {
> + return NETDEV_TX_BUSY;
> + }
> }
>
> /* Track current inflight packets for performance analysis */
This looks racy to me. You probably want explicit memory barriers ?
next prev parent reply other threads:[~2013-01-17 14:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-17 11:47 [PATCH net-next V1 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
2013-01-17 11:47 ` [PATCH net-next V1 1/6] net/mlx4_en: Issue the dump eth statistics command under lock Amir Vadai
2013-01-17 11:47 ` [PATCH net-next V1 2/6] net/mlx4_en: Fix traffic loss under promiscuous mode Amir Vadai
2013-01-17 11:47 ` [PATCH net-next V1 3/6] net/mlx4_en: Use the correct netif lock on ndo_set_rx_mode Amir Vadai
2013-01-17 11:47 ` [PATCH net-next V1 4/6] net/mlx4_core: Return proper error code when __mlx4_add_one fails Amir Vadai
2013-01-17 11:47 ` [PATCH net-next V1 5/6] net/mlx4_en: Fix a race when closing TX queue Amir Vadai
2013-01-17 14:22 ` Eric Dumazet [this message]
2013-01-17 15:26 ` [PATCH net-next] net/mlx4_en: remove redundant code Eric Dumazet
2013-01-17 16:22 ` Amir Vadai
2013-01-20 14:48 ` Amir Vadai
2013-01-21 4:11 ` David Miller
2013-01-17 20:44 ` [PATCH net-next V1 5/6] net/mlx4_en: Fix a race when closing TX queue David Miller
2013-01-17 11:47 ` [PATCH net-next V1 6/6] net/mlx4_en: Initialize RFS filters lock and list in init_netdev Amir Vadai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358432538.29723.8.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=amirv@mellanox.com \
--cc=davem@davemloft.net \
--cc=eugenia@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=yevgenyp@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox