From owner-freebsd-net@FreeBSD.ORG Tue Dec 13 18:54:52 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91F1D106566B; Tue, 13 Dec 2011 18:54:52 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4ABFB8FC16; Tue, 13 Dec 2011 18:54:51 +0000 (UTC) Received: by iakl21 with SMTP id l21so7711898iak.13 for ; Tue, 13 Dec 2011 10:54:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; 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; bh=W0mqVNLeVECWDrfd6mxgLEORTh/u3yPmBYMn4j+Z9jk=; b=ptAqqAkubasUADe3UA94h+9YeTopqkl0jyj5QPlaJcEDNZv73NYQVXDX7XXhsDSGZX wz95T91ihn+GodYawc3BCMOYDDWZdxvazxWpylDKD5VVEnxLReHgJd3nOa/z9uLVTf2d 7ePVwaLgW35EU2xXKZugJWrd8qanXsL9O18Yk= Received: by 10.42.135.69 with SMTP id o5mr17633755ict.34.1323802491554; Tue, 13 Dec 2011 10:54:51 -0800 (PST) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id d19sm66824495ibh.8.2011.12.13.10.54.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Dec 2011 10:54:50 -0800 (PST) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Tue, 13 Dec 2011 10:53:48 -0800 From: YongHyeon PYUN Date: Tue, 13 Dec 2011 10:53:48 -0800 To: Stefan Bethke Message-ID: <20111213185348.GA7546@michelle.cdnetworks.com> References: <600A8C6C-DAB4-4E22-A034-38224017166B@lassitu.de> <20111213025041.GF3705@michelle.cdnetworks.com> <45B0B859-207C-4F02-A28F-7E34B775A273@lassitu.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45B0B859-207C-4F02-A28F-7E34B775A273@lassitu.de> User-Agent: Mutt/1.4.2.3i Cc: FreeBSD Net , marius@FreeBSD.org Subject: Re: "ifconfig media off"? 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: Tue, 13 Dec 2011 18:54:52 -0000 On Tue, Dec 13, 2011 at 11:04:51AM +0100, Stefan Bethke wrote: > Am 13.12.2011 um 03:50 schrieb YongHyeon PYUN: > > > On Tue, Dec 13, 2011 at 12:56:22AM +0100, Stefan Bethke wrote: > >> I'm currently writing a driver to configure an ethernet switch chip (see TL-WR1043ND on -embedded). > >> > >> I noticed that there doesn't seem to be a way to power down a phy right now through the ifconfig media command. > >> > >> Would there be objections to extend the media subtype definitions to include an "off", "poweroff" or "down" media subtype, and add code to the relevant phy drivers to power down the phy for this media subtype? > >> > >> The difference between media subtype "none" and this new one would be that there will be no link, even if there is a physical connection. With media subtype "none", a 10 MBit/s half-duplex connection is established, potentially confusing the remote end about the availability of this link. On the local side, the link is down, so no packets are exchanged. > >> > > > > I think "none" means "isolated" so should have no established link > > and probably you can also power down the PHY. > > I vaguely guess the PHY of switch chip does not correctly support > > isolated mode so you may have wanted to power down. > > > After looking at the code a bit more, I think the common code just doesn't set the BMCR_PDOWN (but clears it when bringing up the PHY). > Yes, and most PHYs could be powered down when BMCR_ISO is chosen. I'm not sure whether this could be applied to hardwares that support multiple PHYs(i.e. internal and external transceivers) though. Marius may have some opinions on this(CCed). However powering down PHY with BMCR_ISO looks natural to me. > Index: sys/dev/mii/mii_physubr.c > =================================================================== > --- sys/dev/mii/mii_physubr.c (revision 228402) > +++ sys/dev/mii/mii_physubr.c (working copy) > @@ -58,7 +58,7 @@ > */ > static const struct mii_media mii_media_table[MII_NMEDIA] = { > /* None */ > - { BMCR_ISO, ANAR_CSMA, > + { BMCR_ISO | BMCR_PDOWN, ANAR_CSMA, > 0, }, > > /* 10baseT */ > > I've opened kern/163240. > http://www.freebsd.org/cgi/query-pr.cgi?pr=163240 > > > Stefan > > -- > Stefan Bethke Fon +49 151 14070811