From owner-freebsd-net@FreeBSD.ORG Wed Apr 2 02:08:11 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26CF4E3A; Wed, 2 Apr 2014 02:08:11 +0000 (UTC) Received: from mail-pd0-x22d.google.com (mail-pd0-x22d.google.com [IPv6:2607:f8b0:400e:c02::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA0498D8; Wed, 2 Apr 2014 02:08:10 +0000 (UTC) Received: by mail-pd0-f173.google.com with SMTP id z10so10382381pdj.18 for ; Tue, 01 Apr 2014 19:08:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=SBBU8Rj+fg116gL3X+AuGs9c6HAsTyPqAjaepIgPkfc=; b=R97ELOilBRIOX4ZpAOjA/0o6ECRcMLawmmkaxY6LYs6WK7IrqLkX8GoBVQyDh6SAtN w0UMxe6ELDs9sR2D1mrnUbvf3Q3cQ2iK1TojLQe+Mh7tqK4RFMD92yLbffzvrIaRph6i NSCqVMSmeMDqzul2hau9W4Hi8/8ldFKAirH5TDaiiVo/aW4mRfzGYMv7vJ3gEx5eYBxL VhaLwWKxH/EsJfdILkcYniSwuR81BpbyeRtqWD3LZzvNOBmu376e+uzdKFF60bgNCCAZ l5zZt7PWKFq4MOIokWLna+OkzGZPvycUd/Syyc/r/2vLz7VEU59donNW1pDuZQf8WN67 ypmQ== X-Received: by 10.68.211.164 with SMTP id nd4mr34549976pbc.44.1396404490451; Tue, 01 Apr 2014 19:08:10 -0700 (PDT) Received: from pyunyh@gmail.com (lpe4.p59-icn.cdngp.net. [114.111.62.249]) by mx.google.com with ESMTPSA id yw3sm700596pbc.69.2014.04.01.19.08.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 01 Apr 2014 19:08:09 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Wed, 02 Apr 2014 11:08:03 +0900 From: Yonghyeon PYUN Date: Wed, 2 Apr 2014 11:08:03 +0900 To: Chris H Subject: Re: miibus0: mii_mediachg: can't handle non-zero PHY instance 31 Message-ID: <20140402020803.GB2938@michelle.cdnetworks.com> References: <2598eeb4c68e23df0789e5e3e8f46d76.authenticated@ultimatedns.net> <20140331050002.GC1359@michelle.cdnetworks.com> <20140401065842.GA1364@michelle.cdnetworks.com> <1396384167.81853.210.camel@revolution.hippie.lan> <41917a9e67d0f4519df4b55f3aa6ebe3.authenticated@ultimatedns.net> <20140402003912.GA2938@michelle.cdnetworks.com> <3f97f5646629043fed5e34a77c9c2f3d.authenticated@ultimatedns.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline In-Reply-To: <3f97f5646629043fed5e34a77c9c2f3d.authenticated@ultimatedns.net> User-Agent: Mutt/1.4.2.3i Cc: freebsd-net , freebsd-stable , Ian Lepore X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 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: Wed, 02 Apr 2014 02:08:11 -0000 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Apr 01, 2014 at 05:53:51PM -0700, Chris H wrote: > > On Tue, Apr 01, 2014 at 01:40:58PM -0700, Chris H wrote: > >> > On Tue, 2014-04-01 at 13:19 -0700, Chris H wrote: > >> >> [...] > >> >> miibus0: on nfe0 > >> >> rlphy0: PHY 0 on miibus0 > >> >> rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto, auto-flow > >> >> rlphy1: PHY 1 on miibus0 > >> > [...]---big-snip--8<--- > >> >> miibus0: mii_mediachg: can't handle non-zero PHY instance 1 > >> >> > >> >> As you can see, it looks much the same. I have no idea what > >> >> I should do to better inform the driver/kernel how to better > >> >> handle it. Or is it the driver, itself? > >> >> > >> >> Thank you again, for your thoughtful response. > >> >> > >> >> --Chris > >> >> > >> > > >> > I think the way to fix a phy that responds at all addresses is to set a > >> > hint in loader.conf masking out the ones that aren't real, like so: > >> > > >> > hint.miibus.0.phymask="1" > >> > > >> > You might be able to set ="0x00000001" to make it more clear it's a > >> > bitmask, but I'm not sure of that. > >> > >> Thank you very much for the hint. I'll give it a shot. > >> Any idea why this is happening? I have 4 other MB's using the Nvidia > >> chipset, and the nfe(4) driver. But they don't respond this way. > >> > > > > If some nfe(4) variants badly behave in probing stage, this should > > be handled by driver. We already have too many hints and tunables > > and I don't think most users know that. In addition, adding > > additional NIC may change miibus instance number. > > > > Could you show me the output of 'kenv | grep smbios'? > Yes, of course. > > Here it is: > > smbios.bios.reldate="11/22/2010" > smbios.bios.vendor="American Megatrends Inc." > smbios.bios.version="V2.7" > smbios.chassis.maker="MSI" > smbios.chassis.serial="To Be Filled By O.E.M." > smbios.chassis.tag="To Be Filled By O.E.M." > smbios.chassis.version="2.0" > smbios.memory.enabled="2097152" > smbios.planar.maker="MSI" > smbios.planar.product="K9N6PGM2-V2 (MS-7309)" > smbios.planar.serial="To be filled by O.E.M." > smbios.planar.version="2.0" > smbios.socket.enabled="1" > smbios.socket.populated="1" > smbios.system.maker="MSI" > smbios.system.product="MS-7309" > smbios.system.serial="To Be Filled By O.E.M." > smbios.system.uuid="00000000-0000-0000-0000-406186cd4497" > smbios.system.version="2.0" > smbios.version="2.6" > > Hope this helps, and thank you for all your time, and trouble. > Thanks for the info. Try attached patch and let me know how it works. Make sure to remove the hint(hint.miibus.0.phymask="1") set in loader.conf before testing it. > --Chris > > > > --azLHFNyN32YCQGCU Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="nfe.msi.diff" Index: sys/dev/nfe/if_nfe.c =================================================================== --- sys/dev/nfe/if_nfe.c (revision 264031) +++ sys/dev/nfe/if_nfe.c (working copy) @@ -79,6 +79,7 @@ static int nfe_suspend(device_t); static int nfe_resume(device_t); static int nfe_shutdown(device_t); static int nfe_can_use_msix(struct nfe_softc *); +static int nfe_detect_msik9(struct nfe_softc *); static void nfe_power(struct nfe_softc *); static int nfe_miibus_readreg(device_t, int, int); static int nfe_miibus_writereg(device_t, int, int, int); @@ -334,13 +335,38 @@ nfe_alloc_msix(struct nfe_softc *sc, int count) } } + static int +nfe_detect_msik9(struct nfe_softc *sc) +{ + static char *maker = "MSI"; + static char *product = "K9N6PGM2-V2 (MS-7309)"; + char *m, *p; + int found; + + found = 0; + m = getenv("smbios.planar.maker"); + p = getenv("smbios.planar.product"); + if (m != NULL && p != NULL) { + if (strcmp(m, maker) == 0 && strcmp(p, product) == 0) + found = 1; + } + if (m != NULL) + freeenv(m); + if (p != NULL) + freeenv(p); + + return (found); +} + + +static int nfe_attach(device_t dev) { struct nfe_softc *sc; struct ifnet *ifp; bus_addr_t dma_addr_max; - int error = 0, i, msic, reg, rid; + int error = 0, i, msic, phyloc, reg, rid; sc = device_get_softc(dev); sc->nfe_dev = dev; @@ -608,8 +634,13 @@ nfe_attach(device_t dev) #endif /* Do MII setup */ + phyloc = MII_PHY_ANY; + if (sc->nfe_devid == PCI_PRODUCT_NVIDIA_MCP61_LAN1) { + if (nfe_detect_msik9(sc) != 0) + phyloc = 0; + } error = mii_attach(dev, &sc->nfe_miibus, ifp, nfe_ifmedia_upd, - nfe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + nfe_ifmedia_sts, BMSR_DEFCAPMASK, phyloc, MII_OFFSET_ANY, MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); --azLHFNyN32YCQGCU--