[PATCH RFC] gianfar: Do not call skb recycling with disabled IRQs

Jon Loeliger jdl at jdl.com
Sat Nov 7 07:38:06 EST 2009


> 
> Here is the patch on top of the Linus' git tree, if you haven't
> already 'back-ported' the previous patch.

This back-ported patch has been running in my (2.6.31) kernel
for a couple days now without showing any sign of problem.

Maybe throw a

Tested-by: Jon Loeliger <jdl at jdl.com>

at it?

jdl



> diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
> index 5bf31f1..5dca99c 100644
> --- a/drivers/net/gianfar.c
> +++ b/drivers/net/gianfar.c
> @@ -1274,7 +1274,6 @@ static int gfar_start_xmit(struct sk_buff *skb, struct 
> net_device *dev)
>  	u32 lstatus;
>  	int i;
>  	u32 bufaddr;
> -	unsigned long flags;
>  	unsigned int nr_frags, length;
>  
>  	base = priv->tx_bd_base;
> @@ -1298,14 +1297,11 @@ static int gfar_start_xmit(struct sk_buff *skb, struc
> t net_device *dev)
>  	/* total number of fragments in the SKB */
>  	nr_frags = skb_shinfo(skb)->nr_frags;
>  
> -	spin_lock_irqsave(&priv->txlock, flags);
> -
>  	/* check if there is space to queue this packet */
>  	if ((nr_frags+1) > priv->num_txbdfree) {
>  		/* no space, stop the queue */
>  		netif_stop_queue(dev);
>  		dev->stats.tx_fifo_errors++;
> -		spin_unlock_irqrestore(&priv->txlock, flags);
>  		return NETDEV_TX_BUSY;
>  	}
>  
> @@ -1403,9 +1399,6 @@ static int gfar_start_xmit(struct sk_buff *skb, struct 
> net_device *dev)
>  	/* Tell the DMA to go go go */
>  	gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT);
>  
> -	/* Unlock priv */
> -	spin_unlock_irqrestore(&priv->txlock, flags);
> -
>  	return NETDEV_TX_OK;
>  }
>  
> @@ -1915,17 +1908,14 @@ static int gfar_poll(struct napi_struct *napi, int bu
> dget)
>  	struct net_device *dev = priv->ndev;
>  	int tx_cleaned = 0;
>  	int rx_cleaned = 0;
> -	unsigned long flags;
>  
>  	/* Clear IEVENT, so interrupts aren't called again
>  	 * because of the packets that have already arrived */
>  	gfar_write(&priv->regs->ievent, IEVENT_RTX_MASK);
>  
> -	/* If we fail to get the lock, don't bother with the TX BDs */
> -	if (spin_trylock_irqsave(&priv->txlock, flags)) {
> -		tx_cleaned = gfar_clean_tx_ring(dev);
> -		spin_unlock_irqrestore(&priv->txlock, flags);
> -	}
> +	netif_tx_lock_bh(priv->ndev);
> +	tx_cleaned = gfar_clean_tx_ring(dev);
> +	netif_tx_unlock_bh(priv->ndev);
>  
>  	rx_cleaned = gfar_clean_rx_ring(dev, budget);
>  
> 
> -- 
> Anton Vorontsov
> email: cbouatmailru at gmail.com
> irc://irc.freenode.net/bd2


More information about the Linuxppc-dev mailing list