From owner-freebsd-net Fri Aug 16 15:17:44 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8DDDA37B400 for ; Fri, 16 Aug 2002 15:17:39 -0700 (PDT) Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47A7243E4A for ; Fri, 16 Aug 2002 15:17:38 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.11.3/8.11.3) with ESMTP id g7GMHSf75706; Fri, 16 Aug 2002 15:17:28 -0700 (PDT) (envelope-from jdp@vashon.polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.12.4/8.12.4/Submit) id g7GMHSei074716; Fri, 16 Aug 2002 15:17:28 -0700 (PDT) (envelope-from jdp) Date: Fri, 16 Aug 2002 15:17:28 -0700 (PDT) Message-Id: <200208162217.g7GMHSei074716@vashon.polstra.com> To: net@freebsd.org From: John Polstra Cc: ambrisko@ambrisko.com Subject: Re: cvs commit: src/sys/dev/mii mii.c In-Reply-To: <200208162027.g7GKRjE95057@ambrisko.com> References: <200208162027.g7GKRjE95057@ambrisko.com> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org In article <200208162027.g7GKRjE95057@ambrisko.com>, Doug Ambrisko wrote: > John Polstra writes: > | In article <200208072218.g77MIXPA082326@freefall.freebsd.org>, > | Doug Ambrisko wrote: > | > ambrisko 2002/08/07 15:18:33 PDT > | > > | > Modified files: > | > sys/dev/mii mii.c > | > Log: > | > Only attach one PHY device to a controller. NetBSD has similar code. > | > The D-Link DFE-580 card will otherwise show 2 miibuses for each controller > | > and therefore 2 ukphy's. > | > | [cc to -net] > | > | This change seems wrong to me. Since the MII bus is a bus and since > | phys have addresses on the bus, I've always assumed that the intent > | was to be able to have more than one phy on an MII bus. While I don't > | know of any NICs that actually use that feature, I hate to see it get > | disabled without careful consideration. > > Although I don't disagree that you have a potential solution. I question > whether there isn't a technical issue if you have multiple PHY's > attached to a NIC. In the current stuff how would you ifconfig the > other PHYs? If you can't access the other PHYs then why attach them. I think Matthew Dodd's answer is right, that the code assumes only one of the PHYs supports any given media type. Just about all of the MII code (e.g., mii_mediachg()) communicates with every PHY when a significant event happens. If the media is changed to something that the currently active PHY can't handle, it should disable itself appropriately so it stays out of the way. I don't know for sure whether this actually works in the current code, but it was clearly the intent. See for example mii.c revision 1.2, whose log message reads, "Handle buses with multiple PHYs correctly." > Did you look at the NetBSD code? When I read it they avoid probing > more then one PHY in the MII code. Since we got this code from them > shouldn't we follow suit? Did I mis-understand their code? I haven't studied NetBSD's code, but in our code all of the data structures and functions are clearly set up with the idea of supporting multiple PHYs per MII bus. Maybe NetBSD simply punted on that. BTW, I also noticed that your change leaks memory by not freeing the list of devices that device_get_children() returns. John -- John Polstra John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message