Subject: [PATCH 15/18] spidernet: minor RX optimization

From: [email-masked] (Linas Vepstas)
Date: Thu, 7 Jun 2007 14:55:08 -0500

A minor optimization on the RX side is that the hardware does 
not need to be kicked if space did not open up in the RX ring.

Signed-off-by: Linas Vepstas <[email-masked]>

----
 drivers/net/spider_net.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6.22-rc1/drivers/net/spider_net.c
===================================================================
--- linux-2.6.22-rc1.orig/drivers/net/spider_net.c	2007-06-07 11:56:10.000000000 -0500
+++ linux-2.6.22-rc1/drivers/net/spider_net.c	2007-06-07 11:56:23.000000000 -0500
@@ -525,6 +525,7 @@ spider_net_refill_rx_chain(struct spider
 {
 	struct spider_net_descr_chain *chain = &card->rx_chain;
 	unsigned long flags;
+	int cnt = 0;
 
 	/* one context doing the refill (and a second context seeing that
 	 * and omitting it) is ok. If called by NAPI, we'll be called again
@@ -538,9 +539,13 @@ spider_net_refill_rx_chain(struct spider
 		if (spider_net_prepare_rx_descr(card, chain->head))
 			break;
 		chain->head = chain->head->next;
+		cnt ++;
 	}
 
 	spin_unlock_irqrestore(&chain->lock, flags);
+
+	if (cnt)
+		spider_net_enable_rxdmac(card);
 }
 
 /**
@@ -573,7 +578,6 @@ spider_net_alloc_rx_skbs(struct spider_n
 	/* This will allocate the rest of the rx buffers;
 	 * if not, it's business as usual later on. */
 	spider_net_refill_rx_chain(card);
-	spider_net_enable_rxdmac(card);
 	return 0;
 
 error:
@@ -1305,7 +1309,6 @@ spider_net_poll(struct net_device *netde
 	netdev->quota -= packets_done;
 	*budget -= packets_done;
 	spider_net_refill_rx_chain(card);
-	spider_net_enable_rxdmac(card);
 
 	spider_net_cleanup_tx_ring(card);
 
@@ -1590,7 +1593,6 @@ spider_net_handle_error_irq(struct spide
 			card->ignore_rx_ramfull = 1;
 			spider_net_resync_head_ptr(card);
 			spider_net_refill_rx_chain(card);
-			spider_net_enable_rxdmac(card);
 			card->num_rx_ints ++;
 			netif_rx_schedule(card->netdev);
 		}
@@ -1611,7 +1613,6 @@ spider_net_handle_error_irq(struct spide
 		/* Could happen when rx chain is full */
 		spider_net_resync_head_ptr(card);
 		spider_net_refill_rx_chain(card);
-		spider_net_enable_rxdmac(card);
 		card->num_rx_ints ++;
 		netif_rx_schedule(card->netdev);
 		show_error = 0;
@@ -1625,7 +1626,6 @@ spider_net_handle_error_irq(struct spide
 		/* Could happen when rx chain is full */
 		spider_net_resync_head_ptr(card);
 		spider_net_refill_rx_chain(card);
-		spider_net_enable_rxdmac(card);
 		card->num_rx_ints ++;
 		netif_rx_schedule(card->netdev);
 		show_error = 0;