Date: Sat, 25 Feb 2012 14:21:26 -0800 From: YongHyeon PYUN <pyunyh@gmail.com> To: Nugroho Atmotaruno <atmotaruno@gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: re(4) intermittent up/down Message-ID: <20120225222126.GB3718@michelle.cdnetworks.com> In-Reply-To: <CAETxY=rWAR4fnWJ%2BxM%2B_O2sA7Tg6OyL9uYPs-idmtmGoekLW=Q@mail.gmail.com> References: <CAETxY=o%2BxXREgSY2YaHWeToSJ8TFFkqLHxLLJnFU_KEkZKO=PA@mail.gmail.com> <20120224044000.GF13815@michelle.cdnetworks.com> <CAETxY=or4odiqAsXtF2T=jrBz3DcaeQ2zB8M-u-dTkGf9WE7-Q@mail.gmail.com> <CAETxY=r2Xwo9OPY6ESoDoaF6vdm2=O=bwuNxqcOq-tF_RhpCZg@mail.gmail.com> <CAETxY=rWAR4fnWJ%2BxM%2B_O2sA7Tg6OyL9uYPs-idmtmGoekLW=Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--dTy3Mrz/UPE2dbVg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 24, 2012 at 08:04:24PM +0700, Nugroho Atmotaruno wrote: > On Fri, Feb 24, 2012 at 10:56 AM, Nugroho Atmotaruno > <atmotaruno@gmail.com> wrote: > > > > Hi Pyun, > > > > I patched my machine last night, but the problem is still there. > > > > [nugroho@xtreme ~]$ uname -a > > FreeBSD xtreme.arc.itb.ac.id 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Thu > > Feb 23 21:44:02 WIT 2012 > > nugroho@xtreme.arc.itb.ac.id:/sys/amd64/compile/GENERIC ??amd64 > > > > [nugroho@xtreme ~]$ tail /var/log/messages > > Feb 24 10:42:49 xtreme kernel: re0: link state changed to DOWN > > Feb 24 10:42:52 xtreme kernel: re0: link state changed to UP > > Feb 24 10:42:53 xtreme kernel: re0: link state changed to DOWN > > Feb 24 10:42:55 xtreme kernel: re0: link state changed to UP > > Feb 24 10:42:56 xtreme kernel: re0: link state changed to DOWN > > Feb 24 10:43:02 xtreme kernel: re0: link state changed to UP > > Feb 24 10:43:03 xtreme kernel: re0: link state changed to DOWN > > Feb 24 10:43:06 xtreme kernel: re0: link state changed to UP > > Feb 24 10:49:16 xtreme kernel: re0: link state changed to DOWN > > Feb 24 10:49:19 xtreme kernel: re0: link state changed to UP > > > > After repatching, and recompiling my kernel, i got kernel panic. I > don't know why but I didn't get kernel crash dump. I took a screenshot > here[1]. > > [1] http://i.imgur.com/8NIwS.jpg Oops, back out previous patch and try this one. --dTy3Mrz/UPE2dbVg Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rgephy.re.diff2" Index: sys/dev/mii/rgephy.c =================================================================== --- sys/dev/mii/rgephy.c (revision 232144) +++ sys/dev/mii/rgephy.c (working copy) @@ -110,11 +110,16 @@ rgephy_attach(device_t dev) { struct mii_softc *sc; + struct mii_attach_args *ma; + u_int flags; sc = device_get_softc(dev); + ma = device_get_ivars(dev); + flags = 0; + if (strcmp(ma->mii_data->mii_ifp->if_dname, "re") == 0) + flags |= MIIF_PHYPRIV0; + mii_phy_dev_attach(dev, flags, &rgephy_funcs, 0); - mii_phy_dev_attach(dev, 0, &rgephy_funcs, 0); - /* RTL8169S do not report auto-sense; add manually. */ sc->mii_capabilities = (PHY_READ(sc, MII_BMSR) | BMSR_ANEG) & sc->mii_capmask; @@ -243,7 +248,8 @@ * Check to see if we have link. If we do, we don't * need to restart the autonegotiation process. */ - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && + sc->mii_mpd_rev >= 2) { /* RTL8211B(L) */ reg = PHY_READ(sc, RGEPHY_MII_SSR); if (reg & RGEPHY_SSR_LINK) { @@ -298,7 +304,7 @@ mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev >= 2) { ssr = PHY_READ(sc, RGEPHY_MII_SSR); if (ssr & RGEPHY_SSR_LINK) mii->mii_media_status |= IFM_ACTIVE; @@ -328,7 +334,7 @@ } } - if (sc->mii_mpd_rev >= 2) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev >= 2) { ssr = PHY_READ(sc, RGEPHY_MII_SSR); switch (ssr & RGEPHY_SSR_SPD_MASK) { case RGEPHY_SSR_S1000: @@ -484,7 +490,7 @@ { uint16_t ssr; - if (sc->mii_mpd_rev == 3) { + if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev == 3) { /* RTL8211C(L) */ ssr = PHY_READ(sc, RGEPHY_MII_SSR); if ((ssr & RGEPHY_SSR_ALDPS) != 0) { Index: sys/dev/re/if_re.c =================================================================== --- sys/dev/re/if_re.c (revision 232145) +++ sys/dev/re/if_re.c (working copy) @@ -1577,19 +1577,6 @@ re_gmii_writereg(dev, 1, 0x0e, 0); } -#define RE_PHYAD_INTERNAL 0 - - /* Do MII setup. */ - phy = RE_PHYAD_INTERNAL; - if (sc->rl_type == RL_8169) - phy = 1; - error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd, - re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE); - if (error != 0) { - device_printf(dev, "attaching PHYs failed\n"); - goto fail; - } - ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -1614,6 +1601,19 @@ TASK_INIT(&sc->rl_inttask, 0, re_int_task, sc); +#define RE_PHYAD_INTERNAL 0 + + /* Do MII setup. */ + phy = RE_PHYAD_INTERNAL; + if (sc->rl_type == RL_8169) + phy = 1; + error = mii_attach(dev, &sc->rl_miibus, ifp, re_ifmedia_upd, + re_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, MIIF_DOPAUSE); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + goto fail; + } + /* * Call MI attach routine. */ --dTy3Mrz/UPE2dbVg--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120225222126.GB3718>