diff mbox

[10/10] sfc: Support for byte queue limits

Message ID 1322657043.2403.18.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Nov. 30, 2011, 12:44 p.m. UTC
Le lundi 28 novembre 2011 à 18:33 -0800, Tom Herbert a écrit :
> Changes to sfc to use byte queue limits.
> 
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---

>  void efx_fini_tx_queue(struct efx_tx_queue *tx_queue)
> @@ -1163,6 +1176,8 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue,
>  	/* Pass off to hardware */
>  	efx_nic_push_buffers(tx_queue);
>  
> +	netdev_tx_sent_queue(tx_queue->core_txq, skb->len);
> +
>  	tx_queue->tso_bursts++;
>  	return NETDEV_TX_OK;
>  

Small fix here :

[PATCH net-next] sfc: fix race in efx_enqueue_skb_tso()

As soon as skb is pushed to hardware, it can be completed and freed, so
we should not dereference skb anymore.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Tom Herbert <therbert@google.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/ethernet/sfc/tx.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



--
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

Comments

David Miller Nov. 30, 2011, 10:12 p.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 30 Nov 2011 13:44:03 +0100

> [PATCH net-next] sfc: fix race in efx_enqueue_skb_tso()
> 
> As soon as skb is pushed to hardware, it can be completed and freed, so
> we should not dereference skb anymore.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks Eric.
--
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
Ben Hutchings Nov. 30, 2011, 10:51 p.m. UTC | #2
On Wed, 2011-11-30 at 17:12 -0500, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 30 Nov 2011 13:44:03 +0100
> 
> > [PATCH net-next] sfc: fix race in efx_enqueue_skb_tso()
> > 
> > As soon as skb is pushed to hardware, it can be completed and freed, so
> > we should not dereference skb anymore.
> > 
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> Applied, thanks Eric.

Thanks to all.

Ben.
diff mbox

Patch

diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index ab4c635..e0e00b3 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -1173,11 +1173,11 @@  static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue,
 			goto mem_err;
 	}
 
+	netdev_tx_sent_queue(tx_queue->core_txq, skb->len);
+
 	/* Pass off to hardware */
 	efx_nic_push_buffers(tx_queue);
 
-	netdev_tx_sent_queue(tx_queue->core_txq, skb->len);
-
 	tx_queue->tso_bursts++;
 	return NETDEV_TX_OK;