aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/spider_net.c
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2006-10-10 17:04:00 -0400
committerJeff Garzik <jeff@garzik.org>2006-10-11 04:04:25 -0400
commit313ef4b76c96ef427a7613d89df550aa5d02bf21 (patch)
tree18f8b861654c5f43af67da3b1b646269197677e2 /drivers/net/spider_net.c
parentded8028a0b61075d841c33a412da5c869140d7aa (diff)
[PATCH] Spidernet stop queue when queue is full.
This patch adds a call to netif_stop_queue() when there is no more room for more packets on the transmit queue. 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.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 2f54cddf75a..05bdd0be739 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -823,39 +823,25 @@ spider_net_xmit(struct sk_buff *skb, struct net_device *netdev)
823 struct spider_net_descr_chain *chain = &card->tx_chain; 823 struct spider_net_descr_chain *chain = &card->tx_chain;
824 struct spider_net_descr *descr = chain->head; 824 struct spider_net_descr *descr = chain->head;
825 unsigned long flags; 825 unsigned long flags;
826 int result;
827 826
828 spin_lock_irqsave(&chain->lock, flags); 827 spin_lock_irqsave(&chain->lock, flags);
829 828
830 spider_net_release_tx_chain(card, 0); 829 spider_net_release_tx_chain(card, 0);
831 830
832 if (chain->head->next == chain->tail->prev) { 831 if ((chain->head->next == chain->tail->prev) ||
833 card->netdev_stats.tx_dropped++; 832 (spider_net_get_descr_status(descr) != SPIDER_NET_DESCR_NOT_IN_USE) ||
834 result = NETDEV_TX_LOCKED; 833 (spider_net_prepare_tx_descr(card, skb) != 0)) {
835 goto out;
836 }
837 834
838 if (spider_net_get_descr_status(descr) != SPIDER_NET_DESCR_NOT_IN_USE) {
839 card->netdev_stats.tx_dropped++; 835 card->netdev_stats.tx_dropped++;
840 result = NETDEV_TX_LOCKED; 836 spin_unlock_irqrestore(&chain->lock, flags);
841 goto out; 837 netif_stop_queue(netdev);
838 return NETDEV_TX_BUSY;
842 } 839 }
843 840
844 if (spider_net_prepare_tx_descr(card, skb) != 0) {
845 card->netdev_stats.tx_dropped++;
846 result = NETDEV_TX_BUSY;
847 goto out;
848 }
849
850 result = NETDEV_TX_OK;
851
852 spider_net_kick_tx_dma(card); 841 spider_net_kick_tx_dma(card);
853 card->tx_chain.head = card->tx_chain.head->next; 842 card->tx_chain.head = card->tx_chain.head->next;
854
855out:
856 spin_unlock_irqrestore(&chain->lock, flags); 843 spin_unlock_irqrestore(&chain->lock, flags);
857 netif_wake_queue(netdev); 844 return NETDEV_TX_OK;
858 return result;
859} 845}
860 846
861/** 847/**
@@ -874,9 +860,10 @@ spider_net_cleanup_tx_ring(struct spider_net_card *card)
874 spin_lock_irqsave(&card->tx_chain.lock, flags); 860 spin_lock_irqsave(&card->tx_chain.lock, flags);
875 861
876 if ((spider_net_release_tx_chain(card, 0) != 0) && 862 if ((spider_net_release_tx_chain(card, 0) != 0) &&
877 (card->netdev->flags & IFF_UP)) 863 (card->netdev->flags & IFF_UP)) {
878 spider_net_kick_tx_dma(card); 864 spider_net_kick_tx_dma(card);
879 865 netif_wake_queue(card->netdev);
866 }
880 spin_unlock_irqrestore(&card->tx_chain.lock, flags); 867 spin_unlock_irqrestore(&card->tx_chain.lock, flags);
881} 868}
882 869