From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MwJLr-000406-9E for qemu-devel@nongnu.org; Fri, 09 Oct 2009 13:33:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MwJLm-0003sI-Hv for qemu-devel@nongnu.org; Fri, 09 Oct 2009 13:33:58 -0400 Received: from [199.232.76.173] (port=32942 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MwJLm-0003s5-8z for qemu-devel@nongnu.org; Fri, 09 Oct 2009 13:33:54 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:53407) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MwJLl-0006M0-N2 for qemu-devel@nongnu.org; Fri, 09 Oct 2009 13:33:54 -0400 Message-ID: <4ACF73EE.5050303@weilnetz.de> Date: Fri, 09 Oct 2009 19:33:34 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 00/16] Add a -netdev option References: <1255028312-28180-1-git-send-email-markmc@redhat.com> <4ACE4B99.2010606@mail.berlios.de> <4ACE5BA5.8020600@codemonkey.ws> <20091009062322.GA2776@laped.iglesias.mooo.com> In-Reply-To: <20091009062322.GA2776@laped.iglesias.mooo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E. Iglesias" , qemu-devel@nongnu.org, Mark McLoughlin Edgar E. Iglesias schrieb: > On Thu, Oct 08, 2009 at 04:37:41PM -0500, Anthony Liguori wrote: > >> Stefan Weil wrote: >> >>> Hi Mark, >>> >>> today, qemu's ethernet devices are a fixed combination of >>> MAC (Media Access Controller) and PHY (Physical Layer). >>> >>> Real hardware is different: the controllers provide a MAC, >>> and many provide a PHY, too, but all controllers allow >>> one or even several external PHY(s). >>> >>> Most (or all?) controllers use the same standard interface >>> to address their PHY (internal or external), something >>> which is completely missing today in qemu. >>> >>> A better solution would use separate code for MAC and >>> PHY, so the controllers could share common code for the >>> PHY. >>> >>> Configuration of a different PHY should be possible, >>> so users can run a system emulation of different >>> MAC-PHY combinations. >>> >>> In addition to the PHY type, a PHY needs attributes >>> (link speed and link status). >>> >>> >> But PHY doesn't really exist in the context of QEMU because virtualizing >> at the ethernet level. >> > > I think PHY's exist, at least with pure emulation. > > Regarding the MII path I think you are right. But many if not most ethernet > controllers expose a way for software to directly communicate with PHY's > over MDIO. And software drivers usually read/write PHY registers to > check/change PHY related settings (speed, link status, duplex settings etc). > > etraxfs_eth.c has a small dummy model of a PHY at the MDIO level. Enough to > fool software to think that's there is a one. Off-tree I've got at least 2 > more controllers with emulated PHY's that are needed to please guest > software. > > Cheers All other controllers do it the same way as etraxfs_eth.c. And yes, most operating systems do read/write PHY registers. PHY emulation needs code for the device model, and for configuration (PHY type, link status (online / offline), link speed (10, 100, 1000 Mbps), link type (half duplex, full duplex). There is a 1:n relationship between MAC and PHY. Maybe the link status is needed for the core packet handling, too. Cheers, Stefan