Skip to contentSkip to conversation

VIA Rhine ethernet driver bug (reprise...)

DISCUSSION Udo van den Heuvel 5 participants 9 messages Aug 22, 2005 – Oct 4, 2005 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

It appears that the VIA Rhine chipset has some sort of bug which shows up in both the standard Linux VIA-Rhine driver and the Rhinefet driver that VIA itself provides.

The difference is that the connection is dropped in case of the standard Linux driver for VIA Rhine but that the connection remains OK with the Rhinefet driver provided by VIA
(http://www.viaarena.com/downloads/Source/rhinefet.tgz and other places on viaarena.com...).
So VIA Rhinefet driver consumes more CPU but is also more stable.

I wrote about this issue before: http://lkml.org/lkml/2005/8/7/82 &
http://lkml.org/lkml/2005/1/15/47 etc.
I opened a bugzilla case: http://bugzilla.kernel.org/show_bug.cgi?id=5030

Who could find out why the standard Linux driver chokes and the Rhinefet driver doesn't? Who could fix this bug?

Kind regards,
Udo

#1 lore raw

[CCing maintaner]

Quoted 13 lines · Udo van den Heuvel

Hello,

It appears that the VIA Rhine chipset has some sort of bug which shows up in both the standard Linux VIA-Rhine driver and the Rhinefet driver that VIA itself provides.

The difference is that the connection is dropped in case of the standard Linux driver for VIA Rhine but that the connection remains OK with the Rhinefet driver provided by VIA
(http://www.viaarena.com/downloads/Source/rhinefet.tgz and other places on viaarena.com...).
So VIA Rhinefet driver consumes more CPU but is also more stable.

Quoted 6 lines

I wrote about this issue before: http://lkml.org/lkml/2005/8/7/82 &
http://lkml.org/lkml/2005/1/15/47 etc.
I opened a bugzilla case: http://bugzilla.kernel.org/show_bug.cgi?id=5030

Who could find out why the standard Linux driver chokes and the Rhinefet driver doesn't? Who could fix this bug?

My suggestion was, and still is:

Quoted 3 lines

Since it happens less than once a day, why not just add a code to reset the NIC completely in this case, like it is typically done in tx_timeout handlers of many NICs, and forget about it?

Do you see any problems in this approach?
--
vda

#2 lore raw
Quoted 8 lines · Denis Vlasenko

My suggestion was, and still is:

Quoted 3 lines

Since it happens less than once a day, why not just add a code to reset the NIC completely in this case, like it is typically done in tx_timeout handlers of many NICs, and forget about

it?

Do you see any problems in this approach?

Yes, hacks like that often causes a long non-preemptible section because code that was only intended to run on boot now gets hung off a timer and can run in the middle of real work.

I have an EPIA 6000 with a via Rhine and I've never seen this bug, so it must be something specific to your network. Better to find the bug and fix it rather than add stupid hacks.

Lee

#3 lore raw
Quoted 2 lines · Lee Revell
Quoted 1 line · Denis Vlasenko

My suggestion was, and still is:

Never mind, I misread the original post. This workaround is probably OK if you only do the reset when this error condition arises.

Lee

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 15 lines · Patrick Draper
Quoted 5 lines · Denis Vlasenko
Quoted 3 lines

Since it happens less than once a day, why not just add a code to reset the NIC completely in this case, like it is typically done in tx_timeout handlers of many NICs, and forget about it?

Do you see any problems in this approach?

I've refrained from posting here because my hardware is currently in the closet, so I can't help too much. I had problems with Rhine on my ME6000 (VIA Mini-ITX) board. I tried to reset the NIC by unloading kernel modules and reloading them, and reinitializing the network, and that didn't work for me. The problem was triggered by merely unplugging the ethernet cable. When it was plugged back in, the network was gone and only a reboot would bring it back.

Quoted 3 lines

Sorry I can't file a better bug report, but I won't be able to until November at the earliest. But I thought you should know that at least one person can't use the approach of resetting the NIC.

May be a known problem. A buglet in MII common code. Via-rhine maintainer knows about it, as does Jeff. --
vda

#6 lore raw
Quoted 2 lines · Denis Vlasenko

May be a known problem. A buglet in MII common code. Via-rhine maintainer knows about it, as does Jeff.

You don't speak for me, sir.

I know of no such problem. Please submit a report and/or patch.

Jeff

#7 lore raw
Quoted 7 lines · Jeff Garzik
Quoted 2 lines · Denis Vlasenko

May be a known problem. A buglet in MII common code. Via-rhine maintainer knows about it, as does Jeff.

You don't speak for me, sir.

I know of no such problem. Please submit a report and/or patch.

I believe vda may have been referring to this. I can send you the original thread if it's not in your mail archive.

Roger

------------------------------ cut here ------------------------------
From: Roger Luethi <[email protected]>
Subject: Re: via-rhine + link loss + autoneg off == trouble
To: Denis Vlasenko <[email protected]>, Jeff Garzik <[email protected]>
Cc: "David S. Miller" <[email protected]>, [email protected],
[email protected]
Date: Sat, 13 Aug 2005 20:34:21 +0200
User-Agent: Mutt/1.5.8i

Jeff, can you tune in for a moment?

First of all, many thanks to vda for tracking this down, and to everyone else who helped with it.

I had a look at my code and at 8139cp (which is one of only a handful of drivers that have been converted to use the generic MII stuff).

Turns out 8139cp doesn't seem to do anything to address the problem vda described, either, so it is equally affected. Is this something we should fix in mii.c, or is mii_check_media working as designed? Btw, I'd be thrilled if someone wrote a few lines per function in mii.c:
purpose, preconditions, side effects, something along these lines.

Roger
------------------------------ cut here ------------------------------

#8 lore raw

Ah, ok.

The central problem is that the 'forced_media' attribute is intended in all respects to force the media into the specified mode. Auto-negotiation is disabled, and link is always assumed to be up.

Jeff

#9 lore raw
In reply to Jeff Garzik
Quoted 7 lines · Jeff Garzik
Quoted 2 lines · Denis Vlasenko

May be a known problem. A buglet in MII common code. Via-rhine maintainer knows about it, as does Jeff.

You don't speak for me, sir.

I know of no such problem. Please submit a report and/or patch.

From: Denis Vlasenko <[email protected]>
To: [email protected],
"David S. Miller" <[email protected]>,
Jeff Garzik <[email protected]>
Subject: via-rhine + link loss + autoneg off == trouble
Date: Thu, 11 Aug 2005 13:50:42 +0300
Cc: [email protected],
[email protected]
Message-Id: <[email protected]>

I think I finally know what's going on.

Again, the recipe:
* have via-rhine NIC
* unplug network cable
* reboot box
* force HDX (I do in with ethtool -s if autoneg off duplex half)
* plug cable back
* kernel still thinks that carrier is off despite "ethtool if" saying that link is detected.

Why:

...
        if (intr_status & IntrLinkChange)
                rhine_check_media(dev, 0);
...

static void rhine_check_media(struct net_device *dev, unsigned int init_media) {
        struct rhine_private *rp = netdev_priv(dev);
        void __iomem *ioaddr = rp->base;

        mii_check_media(&rp->mii_if, debug, init_media);
...

unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print, unsigned int init_media) {
        unsigned int old_carrier, new_carrier; int advertise, lpa, media, duplex;
        int lpa2 = 0;

        /* if forced media, go no further */
        if (mii->force_media)   <============================ HERE return 0; /* duplex did not change */

        /* check current and old link status */ old_carrier = netif_carrier_ok(mii->dev) ? 1 : 0; new_carrier = (unsigned int) mii_link_ok(mii);

        /* if carrier state did not change, this is a "bounce",
         * just exit as everything is already set correctly */
        if ((!init_media) && (old_carrier == new_carrier)) return 0; /* duplex did not change */

        /* no carrier, nothing much to do */
        if (!new_carrier) {
                netif_carrier_off(mii->dev);
                if (ok_to_print)
                        printk(KERN_INFO "%s: link down\n", mii->dev->name); return 0; /* duplex did not change */
        }

        /*
         * we have carrier, see who's on the other end */
        netif_carrier_on(mii->dev);
...

We can never reach netif_carrier_on if mii->force_media == TRUE!

If I disable that "if(...) return 0;" it works.
Instrumented log:

17:54:20.07751 kern.info: qdisc_restart: start, q->dequeue=c03e86c6 <== noop_dequeue
17:54:21.07736 kern.info: qdisc_restart: start, q->dequeue=c03e86c6 17:54:23.14445 kern.info: rhine_check_media(init_media:0) 17:54:23.14454 kern.info: mii_check_media
17:54:23.14457 kern.info: mii_check_media: mii->force_media == TRUE, bailing DISABLED --vda
17:54:23.14462 kern.info: mii_check_media: old_carrier:0 new_carrier:1 17:54:23.14466 kern.info: mii_check_media: netif_carrier_on 17:54:23.14469 kern.info: if: link up, 10Mbps, half-duplex, lpa 0x0000 17:54:23.14474 kern.info: dev_activate(if);
17:54:23.14477 kern.info: dev_activate(): dev->qdisc = dev->qdisc_sleeping 17:54:24.64489 kern.info: pfifo_fast_enqueue returns 0 17:54:24.64496 kern.info: pfifo_fast_dequeue returns a skb 17:54:24.64499 kern.info: pfifo_fast_dequeue returns NULL 17:54:24.64584 kern.info: pfifo_fast_enqueue returns 0 17:54:24.64588 kern.info: qdisc_restart: start, q->dequeue=c03e87b6 <== pfifo_fast_dequeue
17:54:24.64597 kern.info: pfifo_fast_dequeue returns a skb 17:54:24.64601 kern.info: qdisc_restart: skb!=NULL
--
vda