Date: Mon, 14 Dec 2009 20:17:53 +0000 (UTC) From: Pyun YongHyeon <yongari@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r200538 - head/sys/dev/vge Message-ID: <200912142017.nBEKHrRE037144@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: yongari Date: Mon Dec 14 20:17:53 2009 New Revision: 200538 URL: http://svn.freebsd.org/changeset/base/200538 Log: Introduce vge_flags member in softc. The vge_flags member will record device specific bits. Remove vge_link and use vge_flags. While here, move clearing link state before mii_mediachg() as mii_mediachg() may affect link state. Modified: head/sys/dev/vge/if_vge.c head/sys/dev/vge/if_vgevar.h Modified: head/sys/dev/vge/if_vge.c ============================================================================== --- head/sys/dev/vge/if_vge.c Mon Dec 14 20:12:51 2009 (r200537) +++ head/sys/dev/vge/if_vge.c Mon Dec 14 20:17:53 2009 (r200538) @@ -1577,16 +1577,16 @@ vge_tick(void *xsc) mii = device_get_softc(sc->vge_miibus); mii_tick(mii); - if (sc->vge_link) { + if ((sc->vge_flags & VGE_FLAG_LINK) != 0) { if (!(mii->mii_media_status & IFM_ACTIVE)) { - sc->vge_link = 0; + sc->vge_flags &= ~VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_DOWN); } } else { if (mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - sc->vge_link = 1; + sc->vge_flags |= VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_UP); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -1868,7 +1868,7 @@ vge_start_locked(struct ifnet *ifp) VGE_LOCK_ASSERT(sc); - if (sc->vge_link == 0 || + if ((sc->vge_flags & VGE_FLAG_LINK) == 0 || (ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; @@ -2107,13 +2107,12 @@ vge_init_locked(struct vge_softc *sc) CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); } + sc->vge_flags &= ~VGE_FLAG_LINK; mii_mediachg(mii); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; callout_reset(&sc->vge_watchdog, hz, vge_watchdog, sc); - - sc->vge_link = 0; } /* Modified: head/sys/dev/vge/if_vgevar.h ============================================================================== --- head/sys/dev/vge/if_vgevar.h Mon Dec 14 20:12:51 2009 (r200537) +++ head/sys/dev/vge/if_vgevar.h Mon Dec 14 20:17:53 2009 (r200538) @@ -141,7 +141,8 @@ struct vge_softc { device_t vge_miibus; uint8_t vge_type; int vge_if_flags; - int vge_link; + int vge_flags; +#define VGE_FLAG_LINK 0x8000 int vge_camidx; struct mtx vge_mtx; struct callout vge_watchdog;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912142017.nBEKHrRE037144>