From patchwork Thu Feb 26 10:25:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rini van Zetten X-Patchwork-Id: 23767 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 085D8DE16B for ; Thu, 26 Feb 2009 21:26:36 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from smtp3.euronet.nl (smtp3.euronet.nl [194.134.35.173]) by ozlabs.org (Postfix) with ESMTP id 34FF3DDDF3 for ; Thu, 26 Feb 2009 21:25:58 +1100 (EST) Received: from arv-010 (mf-22dc1.mxs.adsl.euronet.nl [81.70.75.193]) by smtp3.euronet.nl (Postfix) with ESMTP id 38FF23A093; Thu, 26 Feb 2009 11:25:55 +0100 (MET) Received: from arv-010 (localhost [127.0.0.1]) by arv-010 (Postfix) with ESMTP id EDCE4714FB; Thu, 26 Feb 2009 11:25:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=arvoo.nl; h=message-id :date:from:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; s=arv-010; bh=VfKqR1fJo FW1tnVWBqOOIK1ErAo=; b=ZRcP8eSMgLk7/EsDu8LqTxP274D5tMz+6zUNs8Ro3 aihUnP8pIVUWr/swLEgYBWHQDF9uIBT9bVPtzmgmP9IiNopRLtNT6qL5K4XVlCHB du6syNbRVghnopzXUEzA65CRGj920fwdYOWk0KuhV7dwCFOt5+l0rD1oLpkeXbYI 84= Received: from arv-002.arvoo.nl (unknown [192.168.0.2]) by arv-010 (Postfix) with ESMTP id 9E7E7714FB; Thu, 26 Feb 2009 11:25:49 +0100 (CET) Received: from [192.168.0.72] (unknown [192.168.0.72]) by arv-002.arvoo.nl (Postfix) with ESMTP id 81A5C18027D84; Thu, 26 Feb 2009 11:25:49 +0100 (CET) Message-ID: <49A66E2D.3060204@arvoo.nl> Date: Thu, 26 Feb 2009 11:25:49 +0100 From: Rini van Zetten User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: David Miller Subject: [PATCH v2 net] gianfar : Do right check on num_txbdfree References: <49A6595A.9000405@arvoo.nl> <20090226.020318.50178027.davem@davemloft.net> In-Reply-To: <20090226.020318.50178027.davem@davemloft.net> X-ARVOO-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 9E7E7714FB.60E2B X-ARVOO-MailScanner: Found to be clean X-ARVOO-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-5.8, required 5, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -4.00) X-ARVOO-MailScanner-From: rini@arvoo.nl X-Spam-Status: No Cc: Linuxppc-dev@ozlabs.org, afleming@freescale.com, netdev@vger.kernel.org X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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. Changes from first version : - removed a space between parens (David Millers comment) - full email address in signed off line Signed-off-by: Rini van Zetten Acked-by: Andy Fleming --- 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); --