[PATCH net] gianfar : Do right check on num_txbdfree

Rini van Zetten rini at arvoo.nl
Thu Feb 26 19:56:58 EST 2009


This patch fixes a wrong check on num_txbdfree. It could lead to num_txbdfree become nagative.
Result was that the gianfar stops sending data.


Signed-off-by: Rini van Zetten <rini at arvoo dot nl>
---
  drivers/net/gianfar.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 7ef1ffd..2dc3bd3 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1284,9 +1284,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
  	spin_lock_irqsave(&priv->txlock, flags);

  	/* check if there is space to queue this packet */
-	if (nr_frags > priv->num_txbdfree) {
+	if ( (nr_frags+1) > priv->num_txbdfree) {
  		/* no space, stop the queue */
  		netif_stop_queue(dev);
  		dev->stats.tx_fifo_errors++;
  		spin_unlock_irqrestore(&priv->txlock, flags);
-- 





More information about the Linuxppc-dev mailing list