[PATCH 1/4]: Spidernet stop queue when queue is full

2006-10-03 Thread Linas Vepstas

Subject: [PATCH 1/4]: 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 [EMAIL PROTECTED]
Cc: James K Lewis [EMAIL PROTECTED]
Cc: Arnd Bergmann [EMAIL PROTECTED]


 drivers/net/spider_net.c |   19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

Index: linux-2.6.18-mm2/drivers/net/spider_net.c
===
--- linux-2.6.18-mm2.orig/drivers/net/spider_net.c  2006-10-02 
12:12:56.0 -0500
+++ linux-2.6.18-mm2/drivers/net/spider_net.c   2006-10-02 18:59:43.0 
-0500
@@ -686,6 +686,7 @@ spider_net_prepare_tx_descr(struct spide
/* Chain the bus address, so that the DMA engine finds this descr. */
descr-prev-next_descr_addr = descr-bus_addr;
 
+   card-netdev-trans_start = jiffies;
return 0;
 }
 
@@ -857,29 +858,23 @@ spider_net_xmit(struct sk_buff *skb, str
 
spider_net_release_tx_chain(card, 0);
 
-   if (chain-head-next == chain-tail-prev) {
-   card-netdev_stats.tx_dropped++;
-   result = NETDEV_TX_LOCKED;
-   goto out;
-   }
-
-   if (spider_net_get_descr_status(descr) != SPIDER_NET_DESCR_NOT_IN_USE) {
-   card-netdev_stats.tx_dropped++;
+   if ((chain-head-next == chain-tail-prev) ||
+  (spider_net_get_descr_status(descr) != SPIDER_NET_DESCR_NOT_IN_USE)) 
{
result = NETDEV_TX_LOCKED;
goto out;
}
 
if (spider_net_prepare_tx_descr(card, skb) != 0) {
-   card-netdev_stats.tx_dropped++;
result = NETDEV_TX_BUSY;
goto out;
}
 
-   result = NETDEV_TX_OK;
spider_net_kick_tx_dma(card);
+   return NETDEV_TX_OK;
 
 out:
-   netif_wake_queue(netdev);
+   card-netdev_stats.tx_dropped++;
+   netif_stop_queue(netdev);
return result;
 }
 
@@ -898,6 +893,8 @@ spider_net_cleanup_tx_ring(struct spider
if ((spider_net_release_tx_chain(card, 0) != 0) 
(card-netdev-flags  IFF_UP))
spider_net_kick_tx_dma(card);
+
+   netif_wake_queue(card-netdev);
 }
 
 /**
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4]: Spidernet stop queue when queue is full

2006-10-03 Thread Arnd Bergmann
On Tuesday 03 October 2006 22:57, Linas Vepstas wrote:
 +   if ((chain-head-next == chain-tail-prev) ||
 +      (spider_net_get_descr_status(descr) != 
 SPIDER_NET_DESCR_NOT_IN_USE)) {
 result = NETDEV_TX_LOCKED;
 goto out;
 }

...

  out:
 -   netif_wake_queue(netdev);
 +   card-netdev_stats.tx_dropped++;
 +   netif_stop_queue(netdev);
 return result;
  }

Hmm, this looks a little strange to me. I would assume that we should not
stop the queue when the device is locked, but only when it is busy.

I would assume though that the fix is to return NETDEV_TX_BUSY instead
of NETDEV_TX_LOCKED in the case above, while the netif_stop_queue()
is correct here.

Arnd 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html