From owner-freebsd-current Wed May 1 10:11:47 2002 Delivered-To: freebsd-current@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by hub.freebsd.org (Postfix) with ESMTP id 59E6C37B416 for ; Wed, 1 May 2002 10:11:36 -0700 (PDT) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.2/8.12.2) with ESMTP id g41HBBqE066685; Wed, 1 May 2002 19:11:12 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: Peter Wemm Cc: current@FreeBSD.ORG Subject: Re: PHY patch, please test. In-Reply-To: Your message of "Wed, 01 May 2002 04:07:53 PDT." <20020501110753.929EC38CC@overcee.wemm.org> Date: Wed, 01 May 2002 19:11:11 +0200 Message-ID: <66684.1020273071@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <20020501110753.929EC38CC@overcee.wemm.org>, Peter Wemm writes: >Poul-Henning Kamp wrote: >> >> This patch simplifies the auto-negotiation in the MII/PHY code, but >> I don't have enough weird ethernet cards to test it out. >> >> Please test and if it doesn't work send me dmesg -v output and info >> on what netcard it breaks. >> >> http://phk.freebsd.dk/patch/phy00.patch >> >> I hope to commit it this weekend. > >So, in a nutshell, you removed the ability for the card driver to request >the phy driver to wait for negotiation to complete, and removed the >interlock that prevents duplicate negotiation requests when the negotiation >took longer than the allotted time? yes and yes. The wait for negotiation to complete does not make sense, and in particular the 500ms worth of DELAY() calls is totally bogus. If a driver wants to wait 500msec and see if it got link, it should wait 500msec for and query status or better yet: just react to the events coming back up to it about like and state changes. There is no such thing as duplicate autoneg requests, if you send a new one (like we do after the 5 or 10 sec timeout) the negotiation starts over. The 5 seconds for 10/100 is probably a couple of seconds too short but we don't notice because 10/100 negotiation is very fast (sub second). The 10 seconds for gigE _is_ too short, since cisco switches may hold carrier down for several seconds, and it may take a couple of tries of a couple (of a couple of seconds each) to get the line equalization right. (I'm still experimenting with this bit.) In general, I think we need a much more capable state engine for the autoneg stuff. Right now we start our timeout when we start autonegotiation, but carrier from the remote end may not appear for another N seconds, so our timeout must be long enough for that AND the basic negotiation timeout. We should probably have a short timeout (maybe 5 seconds) when we receive no carrier, from we see carrier we until we abort 10/100 autoneg should probably be a 10 sec delay and for gigE autoneg more like 30 seconds. Things are compounded by driver mistakes like the if_nge driver calling mii_tick() for every MII/PHY interrupt in addition to every second, this makes any timeout shorter by about 3 seconds in practice since the PHY typically sends 3 interrupts per autonegotiation. And as you said yourself: there is additional NEWBUS'ing to be done in this area. I've sent email to a couple of strategig NetBSD'ers, but received no replies. I don't have time to go all the way through this area, but I have a need to get NetGear622 solid and working and I'll do what it takes to get that done at least. Volounteers welcome. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message