public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Tim Hockin <thockin@sun.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	jgarzik@mandrakesoft.com
Subject: Re: [PATCH] try #2 even bigger natsemi patch
Date: Sat, 20 Oct 2001 15:17:58 +0200	[thread overview]
Message-ID: <3BD17986.177A92D0@colorfullife.com> (raw)
In-Reply-To: <3BD0CDED.3850B31D@sun.com>

Tim Hockin wrote:
> 
>  static void netdev_timer(unsigned long data)
>  {
>         struct net_device *dev = (struct net_device *)data;
>         struct netdev_private *np = dev->priv;
> -       int next_tick = 60*HZ;
> +       int next_tick = 5*HZ;
> +       long ioaddr = dev->base_addr;
> +       u16 dspcfg;
> 
>         if (debug > 3) {
>                 /* DO NOT read the IntrStatus register,
> @@ -933,10 +1107,27 @@
>                            dev->name);
>         }
>         spin_lock_irq(&np->lock);
> -       check_link(dev);
> +
> +       /* check for a nasty random phy-reset - use dspcfg as a flag */
> +       writew(1, ioaddr+PGSEL);
> +       dspcfg = readw(ioaddr+DSPCFG);
> +       writew(0, ioaddr+PGSEL);
> +       if (dspcfg != DSPCFG_VAL) {
> +               if (!netif_queue_stopped(dev)) {
> +                       printk(KERN_INFO
> +                               "%s: possible phy reset: re-initializing\n",
> +                               dev->name);
> +                       init_registers(dev);
That's not SMP safe:
The interrupt handler acquires np->lock only for packet tx and errors,
not for packet rx.
Thus an rx interrupt could be running during init_registers - and
init_registers modifies the rx ring.
I think you must first check for the phy reset, and if you find a reset
then lock rx interrupts out with disable_irq.

	disable_irq(dev->irq);
	spin_lock_irq(&np->lock);

Calling disable_irq() always is probably too slow.

--
	Manfred

      parent reply	other threads:[~2001-10-20 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-20  1:05 [PATCH] try #2 even bigger natsemi patch Tim Hockin
2001-10-20  1:12 ` Tim Hockin
2001-10-20 13:17 ` Manfred Spraul [this message]

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=3BD17986.177A92D0@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thockin@sun.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