From owner-freebsd-current@FreeBSD.ORG Wed Apr 8 02:48:09 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA7431065670 for ; Wed, 8 Apr 2009 02:48:09 +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 8DDFA8FC0A for ; Wed, 8 Apr 2009 02:48:09 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id l9so2926738rvb.43 for ; Tue, 07 Apr 2009 19:48:09 -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=xCnrrHGTAmVLBVtXKElSz3cJcX8Vap4Tp9ufXRvgep8=; b=omOasKOx/g7+KR5fDomCwCva/KC+n7i0v+3iy5pro33boKprOkS5slNIx+4ovGAm9L u9ELKclURmq7cdEnahKV5T4mdEp4qu7+nRoC0b7HdNp4Soxrcm29xbks/bH39BxZGnDB sgARM6Uc+NeqbCbkoLRKCLFwJOuWxXPELvj40= 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=L1hHjkJ+AjDmKnlWsY952dI1q9NVQw2mFHOkv1WWGO38UCbAwin/5HuIgGk0fMhICy h13Eeh4HcJd/zH+isbPN4CsoB1JWh41ZmJ6g4ttooYlG9lyamKYEPLmHv2IC+w/2ZrGv X2cugDenvQYk8fdqrUuUSiHR5OYrhB3NNKyPY= Received: by 10.141.96.19 with SMTP id y19mr285900rvl.116.1239158889121; Tue, 07 Apr 2009 19:48:09 -0700 (PDT) Received: from michelle.cdnetworks.co.kr ([114.111.62.249]) by mx.google.com with ESMTPS id c20sm23728588rvf.40.2009.04.07.19.48.06 (version=SSLv3 cipher=RC4-MD5); Tue, 07 Apr 2009 19:48:07 -0700 (PDT) Received: by michelle.cdnetworks.co.kr (sSMTP sendmail emulation); Wed, 8 Apr 2009 11:49:02 +0900 From: Pyun YongHyeon Date: Wed, 8 Apr 2009 11:49:02 +0900 To: Niki Denev Message-ID: <20090408024901.GC37714@michelle.cdnetworks.co.kr> References: <75656435-49E2-457A-9CFE-8706CD44916E@gmail.com> <20090328080924.GD99923@michelle.cdnetworks.co.kr> <2e77fc10903280259s5a761cacs398b88649a2367fe@mail.gmail.com> <20090328102735.GE99923@michelle.cdnetworks.co.kr> <2e77fc10903280942u7c934aa4w80176680e9dff6d7@mail.gmail.com> <2e77fc10903281539h7b713711w116a90fd2bfadbcf@mail.gmail.com> <20090330021648.GE7076@michelle.cdnetworks.co.kr> <20090330024748.GF7076@michelle.cdnetworks.co.kr> <2e77fc10904071315q66d725bl76229d9bffd92f35@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline In-Reply-To: <2e77fc10904071315q66d725bl76229d9bffd92f35@mail.gmail.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-current@freebsd.org Subject: Re: axe(4) (Belkin F5D5055) problems X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2009 02:48:10 -0000 --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Apr 07, 2009 at 11:15:47PM +0300, Niki Denev wrote: [...] I've read the datasheet but I still don't understand why dsp programming in truephy_reset is required. Anyway would you try attached patch? And show me dmesg output generated by truephy(4). > I have temporarily replaced the belkin USB ethernet interface with an > Apple USB ethernet, > which also uses the axe(4) driver, but is only 100Mbit/s. > As I suspected the negotiation problems do not exist with it, and > everything seemed ok, until > it started to stop working exactly like the previous adapter. > Pings start to return "buffer space not available" and replugging or > "usbconfig reset" the interface > returns it to normal status. > This sounds like different issue to me. Let's focus on the truephy(4) until axe(4) get a valid link report. > It looks like that the packet loss that I've experienced with the > Belkin gigabit adabter is one problem, > and the interface stopping to work another. > > P.S.: I don't know if it could be my USB hardware, because the machine > is a little bit "exotic", > an HP ex470 MediaSmartServer, which was supposedly designed to run > only embedded version of > Windows and has a nasty SiS chipset in it (with the unsupported sis191 > gigabit adapter) There had been a post for SiS191 driver. Check mailing list archives. Unfortunately I don't have SiS191 controller so I couldn't write a driver and commit the posted driver to tree. Even though the controller is not for high performance servers it would be enough to most desktop users. At least SiS controllers does not seem to require special workarounds for silicon bugs which are commonly found on RealTek/Marvell controllers. Alternatively you can use ndis(4) to use your SiS191 controller. I don't know whether ndis(4) works for this controller though. --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mii.ET1011C.patch3" Index: sys/dev/mii/truephy.c =================================================================== --- sys/dev/mii/truephy.c (revision 190834) +++ sys/dev/mii/truephy.c (working copy) @@ -66,6 +66,11 @@ static void truephy_reset(struct mii_softc *); static void truephy_status(struct mii_softc *); +struct truephy_softc { + struct mii_softc mii_sc; + int mii_model; +}; + static device_method_t truephy_methods[] = { /* device interface */ DEVMETHOD(device_probe, truephy_probe), @@ -76,6 +81,7 @@ }; static const struct mii_phydesc truephys[] = { + MII_PHY_DESC(AGERE, ET1011C_1), MII_PHY_DESC(AGERE, ET1011C), MII_PHY_END }; @@ -85,7 +91,7 @@ static driver_t truephy_driver = { "truephy", truephy_methods, - sizeof(struct mii_softc) + sizeof(struct truephy_softc) }; DRIVER_MODULE(truephy, miibus, truephy_driver, truephy_devclass, 0, 0); @@ -139,15 +145,15 @@ truephy_attach(device_t dev) { struct mii_softc *sc; + struct truephy_softc *tsc; struct mii_attach_args *ma; struct mii_data *mii; - sc = device_get_softc(dev); + tsc = device_get_softc(dev); + sc = &tsc->mii_sc; ma = device_get_ivars(dev); sc->mii_phy = ma->mii_phyno; - if (sc->mii_anegticks == 0) - sc->mii_anegticks = MII_ANEGTICKS; sc->mii_dev = device_get_parent(dev); mii = device_get_softc(sc->mii_dev); LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); @@ -161,13 +167,17 @@ mii->mii_instance++; + tsc->mii_model = MII_MODEL(ma->mii_id2); + truephy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) { sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - /* No 1000baseT half-duplex support */ - sc->mii_extcapabilities &= ~EXTSR_1000THDX; + if (tsc->mii_model == MII_MODEL_AGERE_ET1011C) { + /* No 1000baseT half-duplex support */ + sc->mii_extcapabilities &= ~EXTSR_1000THDX; + } } device_printf(dev, " "); @@ -185,6 +195,7 @@ static int truephy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { + struct truephy_softc *tsc = (struct truephy_softc *)sc; struct ifmedia_entry *ife = mii->mii_media.ifm_cur; int bmcr; @@ -214,22 +225,29 @@ if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) { - bmcr = PHY_READ(sc, MII_BMCR) & ~BMCR_AUTOEN; - PHY_WRITE(sc, MII_BMCR, bmcr); - PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_PDOWN); - } + switch (tsc->mii_model) { + case MII_MODEL_AGERE_ET1011C: + if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) { + bmcr = PHY_READ(sc, MII_BMCR) & ~BMCR_AUTOEN; + PHY_WRITE(sc, MII_BMCR, bmcr); + PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_PDOWN); + } - mii_phy_setmedia(sc); + mii_phy_setmedia(sc); - if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) { - bmcr = PHY_READ(sc, MII_BMCR) & ~BMCR_PDOWN; - PHY_WRITE(sc, MII_BMCR, bmcr); + if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) { + bmcr = PHY_READ(sc, MII_BMCR) & ~BMCR_PDOWN; + PHY_WRITE(sc, MII_BMCR, bmcr); - if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { - PHY_WRITE(sc, MII_BMCR, - bmcr | BMCR_AUTOEN | BMCR_STARTNEG); + if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { + PHY_WRITE(sc, MII_BMCR, + bmcr | BMCR_AUTOEN | BMCR_STARTNEG); + } } + break; + default: + mii_phy_setmedia(sc); + break; } break; @@ -256,8 +274,14 @@ static void truephy_reset(struct mii_softc *sc) { + struct truephy_softc *tsc; int i; + tsc = (struct truephy_softc *)sc; + if (tsc->mii_model != MII_MODEL_AGERE_ET1011C) { + mii_phy_reset(sc); + return; + } for (i = 0; i < 2; ++i) { PHY_READ(sc, MII_PHYIDR1); PHY_READ(sc, MII_PHYIDR2); @@ -325,6 +349,15 @@ if (bmsr & BMSR_LINK) mii->mii_media_status |= IFM_ACTIVE; + if (bmcr & BMCR_ISO) { + mii->mii_media_active |= IFM_NONE; + mii->mii_media_status = 0; + return; + } + + if (bmcr & BMCR_LOOP) + mii->mii_media_active |= IFM_LOOP; + if (bmcr & BMCR_AUTOEN) { if ((bmsr & BMSR_ACOMP) == 0) { mii->mii_media_active |= IFM_NONE; @@ -332,6 +365,12 @@ } } + if (sr & TRUEPHY_SR_SBY) { + /* PHY is in standby mode. */ + mii->mii_media_active |= IFM_NONE; + return; + } + switch (sr & TRUEPHY_SR_SPD_MASK) { case TRUEPHY_SR_SPD_1000T: mii->mii_media_active |= IFM_1000_T; Index: sys/dev/mii/truephyreg.h =================================================================== --- sys/dev/mii/truephyreg.h (revision 190834) +++ sys/dev/mii/truephyreg.h (working copy) @@ -55,6 +55,7 @@ #define TRUEPHY_CONF_TXFIFO_32 0x3000 #define TRUEPHY_SR 0x1a +#define TRUEPHY_SR_SBY 0x8000 #define TRUEPHY_SR_SPD_MASK 0x0300 #define TRUEPHY_SR_SPD_1000T 0x0200 #define TRUEPHY_SR_SPD_100TX 0x0100 Index: sys/dev/mii/miidevs =================================================================== --- sys/dev/mii/miidevs (revision 190834) +++ sys/dev/mii/miidevs (working copy) @@ -109,6 +109,7 @@ */ /* Agere Systems PHYs */ +model AGERE ET1011C_1 0x0001 ET1011C 10/100/1000baseT PHY model AGERE ET1011C 0x0004 ET1011C 10/100/1000baseT PHY /* Altima Communications PHYs */ --lrZ03NoBR/3+SXJZ--