Subject: Re: [PATCH] sky2: safer transmit ring cleaning (v4)

From: Stephen Hemminger <[email-masked]>
Date: Thu, 14 Jan 2010 09:51:20 -0800

On Thu, 14 Jan 2010 22:19:39 +0900
Mike McCormack <[email-masked]> wrote:

>  /* Number of list elements available for next tx */
>  static inline int tx_avail(const struct sky2_port *sky2)
>  {
> +	if (unlikely(!sky2->tx_ring))
> +		return 0;
>  	return sky2->tx_pending - tx_inuse(sky2);
>  }
>

Breaks in detach case

> @@ -1925,7 +1929,9 @@ static int sky2_down(struct net_device *dev)
>  	sky2_read32(hw, B0_IMSK);
>  
>  	synchronize_irq(hw->pdev->irq);
> -	napi_synchronize(&hw->napi);
> +	netif_tx_lock_bh(dev);
> +	napi_disable(&hw->napi);
> +	netif_stop_queue(dev);
>  
>  	spin_lock_bh(&sky2->phy_lock);
>  	sky2_phy_power_down(hw, port);
> @@ -1939,6 +1945,8 @@ static int sky2_down(struct net_device *dev)
>  	sky2_rx_clean(sky2);
>  
>  	sky2_free_buffers(sky2);
> +	napi_enable(&hw->napi);
> +	netif_tx_unlock_bh(dev);
>  
>  	return 0;

Breaks on dual ported boards