From patchwork Sun Dec 12 22:06:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Krzysztof Halasa X-Patchwork-Id: 75272 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 16804B7082 for ; Mon, 13 Dec 2010 09:15:23 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751997Ab0LLWPR (ORCPT ); Sun, 12 Dec 2010 17:15:17 -0500 Received: from inx.pm.waw.pl ([195.116.170.130]:44025 "EHLO inx.pm.waw.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351Ab0LLWPQ convert rfc822-to-8bit (ORCPT ); Sun, 12 Dec 2010 17:15:16 -0500 X-Greylist: delayed 506 seconds by postgrey-1.27 at vger.kernel.org; Sun, 12 Dec 2010 17:15:16 EST Received: by inx.pm.waw.pl (Postfix, from userid 2530) id 09576B5FA; Sun, 12 Dec 2010 23:03:51 +0100 (CET) From: Krzysztof Halasa To: David Miller Cc: Subject: [PATCH] WAN: Fix a TX IRQ causing BUG() in PC300 and PCI200SYN drivers. Date: Sun, 12 Dec 2010 23:06:47 +0100 Message-ID: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We must not wake the TX queue without free TX descriptors. sca_xmit() expects at least one free descriptor and BUGs otherwise. Problem reported and fix tested by Bernie Innocenti and Ward Vandewege. Signed-off-by: Krzysztof HaƂasa --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/net/wan/hd64572.c +++ b/drivers/net/wan/hd64572.c @@ -293,6 +293,7 @@ static inline void sca_tx_done(port_t *port) struct net_device *dev = port->netdev; card_t* card = port->card; u8 stat; + unsigned count = 0; spin_lock(&port->lock); @@ -316,10 +317,12 @@ static inline void sca_tx_done(port_t *port) dev->stats.tx_bytes += readw(&desc->len); } writeb(0, &desc->stat); /* Free descriptor */ + count++; port->txlast = (port->txlast + 1) % card->tx_ring_buffers; } - netif_wake_queue(dev); + if (count) + netif_wake_queue(dev); spin_unlock(&port->lock); }