linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: David Miller <davem@davemloft.net>
Cc: Jon Loeliger <jdl@jdl.com>,
	Kumar Gopalpet-B05799 <B05799@freescale.com>,
	netdev@vger.kernel.org, linuxppc-dev@ozlabs.org,
	Andy Fleming <afleming@freescale.com>,
	Stephen Hemminger <shemminger@vyatta.com>,
	Lennert Buytenhek <buytenh@wantstofly.org>
Subject: [PATCH 5/6] gianfar: Fix race between gfar_error() and gfar_start_xmit()
Date: Wed, 11 Nov 2009 03:11:08 +0300	[thread overview]
Message-ID: <20091111001108.GE8817@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20091111001036.GA28576@oksana.dev.rtsoft.ru>

gfar_error() can arrive at the middle of gfar_start_xmit() processing,
and so it can trigger transfers of BDs that we don't yet expect to
be transmitted.

Fix this by locking the tx queues in gfar_error().

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/net/gianfar.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index a5b0038..fde430a 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -2943,14 +2943,22 @@ static irqreturn_t gfar_error(int irq, void *grp_id)
 		if (events & IEVENT_CRL)
 			dev->stats.tx_aborted_errors++;
 		if (events & IEVENT_XFUN) {
+			unsigned long flags;
+
 			if (netif_msg_tx_err(priv))
 				printk(KERN_DEBUG "%s: TX FIFO underrun, "
 				       "packet dropped.\n", dev->name);
 			dev->stats.tx_dropped++;
 			priv->extra_stats.tx_underrun++;
 
+			local_irq_save(flags);
+			lock_tx_qs(priv);
+
 			/* Reactivate the Tx Queues */
 			gfar_write(&regs->tstat, gfargrp->tstat);
+
+			unlock_tx_qs(priv);
+			local_irq_restore(flags);
 		}
 		if (netif_msg_tx_err(priv))
 			printk(KERN_DEBUG "%s: Transmit Error\n", dev->name);
-- 
1.6.3.3

  parent reply	other threads:[~2009-11-11  0:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  0:10 [PATCH 0/6] gianfar: Some fixes Anton Vorontsov
2009-11-11  0:11 ` [PATCH 1/6] skbuff: Do not allow skb recycling with disabled IRQs Anton Vorontsov
2009-11-11  0:11 ` [PATCH 2/6] gianfar: Remove 'Interrupt problem!' warning Anton Vorontsov
2009-11-11  0:11 ` [PATCH 3/6] gianfar: Fix build with CONFIG_PM=y Anton Vorontsov
2009-11-11  4:27   ` Kumar Gopalpet-B05799
2009-11-11  0:11 ` [PATCH 4/6] gianfar: Fix thinko in gfar_set_rx_stash_index() Anton Vorontsov
2009-11-11  0:11 ` Anton Vorontsov [this message]
2009-11-11  0:11 ` [PATCH 6/6] gianfar: Revive SKB recycling Anton Vorontsov
2009-11-11  4:20   ` Kumar Gopalpet-B05799
2009-11-11 15:16 ` [PATCH 0/6] gianfar: Some fixes Kumar Gala
2009-11-12  3:04   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091111001108.GE8817@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=B05799@freescale.com \
    --cc=afleming@freescale.com \
    --cc=buytenh@wantstofly.org \
    --cc=davem@davemloft.net \
    --cc=jdl@jdl.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).