Subject: Re: [RESEND] [PATCH v2] [1/5] pasemi_mac: minor bugfixes

From: Jeff Garzik <[email-masked]>
Date: Sat, 28 Apr 2007 11:20:17 -0400

Olof Johansson wrote:
> Ethernet bugfixes:
> 
> * Move the was_full/wake_queue logic from tx_intr to clean_tx
> * Fix polarity in checks in pasemi_mac_close
> 
> 
> Signed-off-by: Olof Johansson <[email-masked]>
> 
> 
> Index: linux-2.6/drivers/net/pasemi_mac.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/pasemi_mac.c
> +++ linux-2.6/drivers/net/pasemi_mac.c
> @@ -451,9 +451,12 @@ static int pasemi_mac_clean_tx(struct pa
>  	struct pas_dma_xct_descr *dp;
>  	int start, count;
>  	int flags;
> +	int was_full;
>  
>  	spin_lock_irqsave(&mac->tx->lock, flags);
>  
> +	was_full = mac->tx->next_to_clean - mac->tx->next_to_use == TX_RING_SIZE;
> +
>  	start = mac->tx->next_to_clean;
>  	count = 0;
>  
> @@ -478,6 +481,9 @@ static int pasemi_mac_clean_tx(struct pa
>  	mac->tx->next_to_clean += count;
>  	spin_unlock_irqrestore(&mac->tx->lock, flags);
>  
> +	if (was_full)
> +		netif_wake_queue(mac->netdev);
> +

Isn't this was_full check redundant?  Using standard test-and-clear 
atomic logic, netif_wake_queue() will not issue spurious wakeups.  Take 
a look at its implementation in include/linux/netdevice.h.

	Jeff