Patchwork [net] gianfar : Do right check on num_txbdfree

login
register
mail settings
Submitter Rini van Zetten
Date Feb. 26, 2009, 8:56 a.m.
Message ID <49A6595A.9000405@arvoo.nl>
Download mbox | patch
Permalink /patch/23758/
State Superseded, archived
Delegated to: Kumar Gala
Headers show

Comments

Rini van Zetten - Feb. 26, 2009, 8:56 a.m.
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(-)
David Miller - Feb. 26, 2009, 10:03 a.m.
From: Rini van Zetten <rini@arvoo.nl>
Date: Thu, 26 Feb 2009 09:56:58 +0100

> 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

Please use rini@arvoo.nl in your signoffs, you cannot
hide on the inna-net.

> -	if (nr_frags > priv->num_txbdfree) {
> +	if ( (nr_frags+1) > priv->num_txbdfree) {

Please don't put a space between the parens there "( (", like
that.

Patch

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);
--