From owner-freebsd-net@FreeBSD.ORG Thu Apr 2 00:53:33 2009 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D3CF1065675 for ; Thu, 2 Apr 2009 00:53:33 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.232]) by mx1.freebsd.org (Postfix) with ESMTP id 0AEAB8FC16 for ; Thu, 2 Apr 2009 00:53:33 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id l9so288501rvb.43 for ; Wed, 01 Apr 2009 17:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=7+CuscxNlgV4iID8bcsqjhay2D8SzUQhVjH7wqA8B5k=; b=INaTQSQpdWrjYnyiqlzR3fHYvIGbL3UNBhPAnP0y94bssOGa8jRno5r87DdgOjZgOk KABj7GS1d9ggfKRyG6/uH0drR2/SFa+8qTneMWtOTzz0b1tx6SVaExKgo5OLiu6gvLUf vY5G3UUAlE14vzPvy52l15aJore1E0eHva2Lw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=HhoH2Pvdf6d/Ol8bnofYZSn9Yaaz5+5jdGttoRaED8OfuhtYkP3uuY9TZns1wLF+ke GpsW74G4/RrACcBcK0nEhBYVq2h9BuaQyl37cBKrjiCnlWTpXJazuZIG9jpOb2c0KmX2 Yebc46CYubeDC0vowCq+4FUVDfiYONcH5dUV8= Received: by 10.141.107.13 with SMTP id j13mr4255460rvm.251.1238633612769; Wed, 01 Apr 2009 17:53:32 -0700 (PDT) Received: from michelle.cdnetworks.co.kr ([114.111.62.249]) by mx.google.com with ESMTPS id f21sm1370608rvb.25.2009.04.01.17.53.31 (version=SSLv3 cipher=RC4-MD5); Wed, 01 Apr 2009 17:53:32 -0700 (PDT) Received: by michelle.cdnetworks.co.kr (sSMTP sendmail emulation); Thu, 2 Apr 2009 09:53:08 +0900 From: Pyun YongHyeon Date: Thu, 2 Apr 2009 09:53:08 +0900 To: "M. Warner Losh" Message-ID: <20090402005308.GA19091@michelle.cdnetworks.co.kr> References: <20090401.013246.-1253043078.imp@bsdimp.com> <20090401100939.GB12246@michelle.cdnetworks.co.kr> <20090401.093740.669301742.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090401.093740.669301742.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i Cc: net@freebsd.org Subject: Re: Small change to ukphy X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2009 00:53:33 -0000 On Wed, Apr 01, 2009 at 09:37:40AM -0600, M. Warner Losh wrote: > In message: <20090401100939.GB12246@michelle.cdnetworks.co.kr> > Pyun YongHyeon writes: > : On Wed, Apr 01, 2009 at 01:32:46AM -0600, M. Warner Losh wrote: > : > I've encountered a number of PHY chips that need auto negotiation > : > kicked off to come out of ISO state. This makes sense, because the > : > ukphy driver never seems to take the PHY out of isolation state > : > otherwise. > : > > : > Index: ukphy.c > : > =================================================================== > : > --- ukphy.c (revision 190463) > : > +++ ukphy.c (working copy) > : > @@ -146,6 +146,7 @@ > : > sc->mii_phy = ma->mii_phyno; > : > sc->mii_service = ukphy_service; > : > sc->mii_pdata = mii; > : > + sc->mii_flags |= MIIF_FORCEANEG; > : > > : > mii->mii_instance++; > : > > : > > : > This forces auto negotiation. The reason for this is that it takes it > : > out of ISO state (Isolate). Once out of that state, things work > : > : If the purpose is to take PHY out of isolated state couldn't this > : be handled in ifm_change_cb_t handler of parent interface? I guess > : the callback can reset the PHY and subsequent mii_mediachg() call > : may start auto-negotiation. > > This callback isn't called. The problem is that the PHY is in ISO Oops, you're right. > state. Since it is in ISO state with auto negotiation enabled, we > never kick off an explicit auto negotiation, so the state never > changes so we never get this callback... > > : > well. The question I have is will we properly go back into ISO state > : > for PHYs that should be isolated. > : > > : > : If the PHY requires special handing for ISO state in reset it may > : need separated PHY driver as ukphy(4) does not set MIIF_NOISOLATE. > : As you said it would be really great if we have a generic way to > : pass various MII flags or driver specific information to mii(4). > > This seems to be a common quirk. I'd hate to have a driver that's > just ukphy but with the one line added above and play what-a-mole with > all the odd-balls that are out there. Doesn't seem like a strategy > that will win the day. > > I think we have a way to do this... I could do the following in my > attach routine: > > mii = device_get_softc(sc->miibus); > LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { > miisc->mii_flags |= MIIF_FORCEANEG; > mii_phy_reset(miisc); > } > mii_mediachg(mii); > > which is similar to what fxp does in its change routine (it is what I > put in my status change routine). Also MIIF_NOISOLATE works as well. > > Is the above too insane? > That looks ok to me but marius's patch would be the right direction.