aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/spider_net.c
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2006-10-10 17:18:18 -0400
committerJeff Garzik <jeff@garzik.org>2006-10-11 04:04:26 -0400
commita664ccf430547696951bf3949f5a2de5079ece5a (patch)
tree53fc9fdba563fe8f70c9a3de51b78c52de84fe23 /drivers/net/spider_net.c
parent499eea18722e43f0ee15e11ac16ffcbd10b70b24 (diff)
[PATCH] powerpc/cell spidernet reduce DMA kicking
The current code attempts to start the TX dma every time a packet is queued. This is too conservative, and wastes CPU time. This patch changes behaviour to call the kick-dma function less often, only when the tx queue is at risk of emptying. This reduces cpu usage, improves performance. Signed-off-by: Linas Vepstas <linas@austin.ibm.com> Cc: James K Lewis <jklewis@us.ibm.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r--drivers/net/spider_net.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 6bb8f1f9437c..caa11c6f21b9 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -698,7 +698,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card,
698 return 0; 698 return 0;
699} 699}
700 700
701static void 701static int
702spider_net_set_low_watermark(struct spider_net_card *card) 702spider_net_set_low_watermark(struct spider_net_card *card)
703{ 703{
704 unsigned long flags; 704 unsigned long flags;
@@ -719,7 +719,7 @@ spider_net_set_low_watermark(struct spider_net_card *card)
719 719
720 /* If TX queue is short, don't even bother with interrupts */ 720 /* If TX queue is short, don't even bother with interrupts */
721 if (cnt < card->tx_desc/4) 721 if (cnt < card->tx_desc/4)
722 return; 722 return cnt;
723 723
724 /* Set low-watermark 3/4th's of the way into the queue. */ 724 /* Set low-watermark 3/4th's of the way into the queue. */
725 descr = card->tx_chain.tail; 725 descr = card->tx_chain.tail;
@@ -735,6 +735,7 @@ spider_net_set_low_watermark(struct spider_net_card *card)
735 card->low_watermark->dmac_cmd_status & ~SPIDER_NET_DESCR_TXDESFLG; 735 card->low_watermark->dmac_cmd_status & ~SPIDER_NET_DESCR_TXDESFLG;
736 card->low_watermark = descr; 736 card->low_watermark = descr;
737 spin_unlock_irqrestore(&card->tx_chain.lock, flags); 737 spin_unlock_irqrestore(&card->tx_chain.lock, flags);
738 return cnt;
738} 739}
739 740
740/** 741/**
@@ -819,8 +820,12 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
819 * @card: card structure 820 * @card: card structure
820 * @descr: descriptor address to enable TX processing at 821 * @descr: descriptor address to enable TX processing at
821 * 822 *
822 * spider_net_kick_tx_dma writes the current tx chain head as start address 823 * This routine will start the transmit DMA running if
823 * of the tx descriptor chain and enables the transmission DMA engine 824 * it is not already running. This routine ned only be
825 * called when queueing a new packet to an empty tx queue.
826 * Writes the current tx chain head as start address
827 * of the tx descriptor chain and enables the transmission
828 * DMA engine.
824 */ 829 */
825static inline void 830static inline void
826spider_net_kick_tx_dma(struct spider_net_card *card) 831spider_net_kick_tx_dma(struct spider_net_card *card)
@@ -860,6 +865,7 @@ out:
860static int 865static int
861spider_net_xmit(struct sk_buff *skb, struct net_device *netdev) 866spider_net_xmit(struct sk_buff *skb, struct net_device *netdev)
862{ 867{
868 int cnt;
863 struct spider_net_card *card = netdev_priv(netdev); 869 struct spider_net_card *card = netdev_priv(netdev);
864 struct spider_net_descr_chain *chain = &card->tx_chain; 870 struct spider_net_descr_chain *chain = &card->tx_chain;
865 871
@@ -873,8 +879,9 @@ spider_net_xmit(struct sk_buff *skb, struct net_device *netdev)
873 return NETDEV_TX_BUSY; 879 return NETDEV_TX_BUSY;
874 } 880 }
875 881
876 spider_net_set_low_watermark(card); 882 cnt = spider_net_set_low_watermark(card);
877 spider_net_kick_tx_dma(card); 883 if (cnt < 5)
884 spider_net_kick_tx_dma(card);
878 return NETDEV_TX_OK; 885 return NETDEV_TX_OK;
879} 886}
880 887