Date: Tue, 22 Oct 2002 18:01:46 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Mike Silbersack <silby@silby.com> Cc: freebsd-net@FreeBSD.ORG, <jlemon@FreeBSD.ORG>, Harti Brandt <brandt@fokus.gmd.de> Subject: Re: MII problem, need more eyes Message-ID: <20021022174319.V13842-100000@gamplex.bde.org> In-Reply-To: <20021022013605.D1194-100000@patrocles.silby.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 22 Oct 2002, Mike Silbersack wrote: > In trying to figure out why if_xl's mii_tick is such a pig, I think I've > stumbled upon a bug in -current's MII routines which I'd like confirmation > on before I go ahead and fix. > ... > In the original version (which is still present in -stable), the MII_TICK > case aborts out of the function due to a bunch of circumstances which > indicate that no autonegotiation is necessary. mii_phy_tick does the > same. HOWEVER, mii_phy_tick returns 0, which indicates to the new > MII_TICK logic that autonegotiation _is_ necessary, thereby > reautonegotiating _every second_. > > I believe that the correct fix would be: > > if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) > - return (0); > + return (EJUSTRETURN); This return of 0 is apparently intentional. The comment before this says: /* * If we're not doing autonegotiation, we don't need to do * any extra work here. However, we need to check the link * status so we can generate an announcement if the status * changes. */ Here the "However" clause is not in RELENG_4. Returning 0 gets the status updated. I think this is just too expensive to do every second. Autonegotiation is only retried every 17 seconds (every 5 seconds in RELENG_4). > > /* Read the status register twice; BMSR_LINK is latch-low. */ > reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); > if (reg & BMSR_LINK) { > /* > * See above. > */ > - return (0); > + return (EJUSTRETURN); > } I think the "However" clause applies to this return too. The status update code does lots more than the above to determine the exact state. > Doing this results in much quicker mii_ticks, dropping the time taken for > the normal case from 11ms to 3ms, without any of Harti Brandt's > optimizations. Also, I believe that this change makes it operate more > correctly. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021022174319.V13842-100000>