From 5d770a09e85126b8b3e9fe302c36350a90210cbe Mon Sep 17 00:00:00 2001 From: rwatson Date: Tue, 9 Aug 2005 10:20:02 +0000 Subject: Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days --- sys/dev/patm/if_patm.c | 6 +++--- sys/dev/patm/if_patm_intr.c | 2 +- sys/dev/patm/if_patm_ioctl.c | 14 +++++++------- sys/dev/patm/if_patm_tx.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'sys/dev/patm') diff --git a/sys/dev/patm/if_patm.c b/sys/dev/patm/if_patm.c index 0c8cf46..279afde 100644 --- a/sys/dev/patm/if_patm.c +++ b/sys/dev/patm/if_patm.c @@ -204,7 +204,7 @@ patm_initialize(struct patm_softc *sc) patm_debug(sc, ATTACH, "go..."); sc->utopia.flags &= ~UTP_FL_POLL_CARRIER; - sc->ifp->if_flags |= IFF_RUNNING; + sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; /* enable interrupts, Tx and Rx paths */ cfg |= IDT_CFG_RXPTH | IDT_CFG_RXIIMM | IDT_CFG_RAWIE | IDT_CFG_RQFIE | @@ -245,7 +245,7 @@ patm_stop(struct patm_softc *sc) struct patm_txmap *map; struct patm_scd *scd; - sc->ifp->if_flags &= ~IFF_RUNNING; + sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sc->utopia.flags |= UTP_FL_POLL_CARRIER; patm_reset(sc); @@ -265,7 +265,7 @@ patm_stop(struct patm_softc *sc) /* * Give any waiters on closing a VCC a chance. They will stop - * to wait if they see that IFF_RUNNING disappeared. + * to wait if they see that IFF_DRV_RUNNING disappeared. */ cv_broadcast(&sc->vcc_cv); diff --git a/sys/dev/patm/if_patm_intr.c b/sys/dev/patm/if_patm_intr.c index b19dfc0..9f44d58 100644 --- a/sys/dev/patm/if_patm_intr.c +++ b/sys/dev/patm/if_patm_intr.c @@ -119,7 +119,7 @@ patm_intr(void *p) stat = patm_nor_read(sc, IDT_NOR_STAT); patm_nor_write(sc, IDT_NOR_STAT, stat & (ints | fbqa)); - if (!(sc->ifp->if_flags & IFF_RUNNING)) { + if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { /* if we are stopped ack all interrupts and handle PHYI */ if (stat & IDT_STAT_PHYI) { patm_debug(sc, INTR, "PHYI (stopped)"); diff --git a/sys/dev/patm/if_patm_ioctl.c b/sys/dev/patm/if_patm_ioctl.c index 651bed6..2ed466d 100644 --- a/sys/dev/patm/if_patm_ioctl.c +++ b/sys/dev/patm/if_patm_ioctl.c @@ -107,7 +107,7 @@ patm_open_vcc(struct patm_softc *sc, struct atmio_openvcc *arg) return (ENOMEM); mtx_lock(&sc->mtx); - if (!(sc->ifp->if_flags & IFF_RUNNING)) { + if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { /* stopped while we have analyzed the arguments */ error = EIO; goto done; @@ -224,7 +224,7 @@ patm_close_vcc(struct patm_softc *sc, struct atmio_closevcc *arg) cid = PATM_CID(sc, arg->vpi, arg->vci); mtx_lock(&sc->mtx); - if (!(sc->ifp->if_flags & IFF_RUNNING)) { + if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { /* stopped while we have analyzed the arguments */ error = EIO; goto done; @@ -246,7 +246,7 @@ patm_close_vcc(struct patm_softc *sc, struct atmio_closevcc *arg) while (vcc->vflags & (PATM_VCC_TX_CLOSING | PATM_VCC_RX_CLOSING)) { cv_wait(&sc->vcc_cv, &sc->mtx); - if (!(sc->ifp->if_flags & IFF_RUNNING)) { + if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { /* ups, has been stopped */ error = EIO; goto done; @@ -299,7 +299,7 @@ patm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFADDR: mtx_lock(&sc->mtx); ifp->if_flags |= IFF_UP; - if (!(ifp->if_flags & IFF_RUNNING)) + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) patm_initialize(sc); switch (ifa->ifa_addr->sa_family) { @@ -318,11 +318,11 @@ patm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFFLAGS: mtx_lock(&sc->mtx); if (ifp->if_flags & IFF_UP) { - if (!(ifp->if_flags & IFF_RUNNING)) { + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { patm_initialize(sc); } } else { - if (ifp->if_flags & IFF_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { patm_stop(sc); } } @@ -339,7 +339,7 @@ patm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) * null cells of it gets the timing wrong. */ mtx_lock(&sc->mtx); - if (ifp->if_flags & IFF_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { if (sc->utopia.state & UTP_ST_UNASS) { if (!(sc->flags & PATM_UNASS)) { cfg = patm_nor_read(sc, IDT_NOR_CFG); diff --git a/sys/dev/patm/if_patm_tx.c b/sys/dev/patm/if_patm_tx.c index 887e2d5..cb40aa5 100644 --- a/sys/dev/patm/if_patm_tx.c +++ b/sys/dev/patm/if_patm_tx.c @@ -289,7 +289,7 @@ patm_start(struct ifnet *ifp) struct patm_vcc *vcc; mtx_lock(&sc->mtx); - if (!(ifp->if_flags & IFF_RUNNING)) { + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { mtx_unlock(&sc->mtx); return; } -- cgit v1.1