diff options
author | rwatson <rwatson@FreeBSD.org> | 2005-08-09 10:20:02 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2005-08-09 10:20:02 +0000 |
commit | 5d770a09e85126b8b3e9fe302c36350a90210cbe (patch) | |
tree | bb70e59641e2310a3c26ec449af5ab0cb7420d9d /sys/dev/nve | |
parent | 74759aaa78777146f23aa05c856f574efdfb41d9 (diff) | |
download | FreeBSD-src-5d770a09e85126b8b3e9fe302c36350a90210cbe.zip FreeBSD-src-5d770a09e85126b8b3e9fe302c36350a90210cbe.tar.gz |
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
Diffstat (limited to 'sys/dev/nve')
-rw-r--r-- | sys/dev/nve/if_nve.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/dev/nve/if_nve.c b/sys/dev/nve/if_nve.c index d0f2872..a04d8fc 100644 --- a/sys/dev/nve/if_nve.c +++ b/sys/dev/nve/if_nve.c @@ -621,7 +621,7 @@ nve_init(void *xsc) ifp = sc->ifp; /* Do nothing if already running */ - if (ifp->if_flags & IFF_RUNNING) + if (ifp->if_drv_flags & IFF_DRV_RUNNING) goto fail; nve_stop(sc); @@ -650,8 +650,8 @@ nve_init(void *xsc) nve_ifmedia_upd(ifp); /* Update interface parameters */ - ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->stat_ch = timeout(nve_tick, sc, hz); @@ -692,7 +692,7 @@ nve_stop(struct nve_softc *sc) sc->cur_rx = 0; sc->pending_rxs = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); DEBUGOUT(NVE_DEBUG_RUNNING, "nve: nve_stop - exit\n"); @@ -840,7 +840,7 @@ nve_ifstart(struct ifnet *ifp) DEBUGOUT(NVE_DEBUG_RUNNING, "nve: nve_ifstart - entry\n"); /* If link is down/busy or queue is empty do nothing */ - if (ifp->if_flags & IFF_OACTIVE || ifp->if_snd.ifq_head == NULL) + if (ifp->if_drv_flags & IFF_DRV_OACTIVE || ifp->if_snd.ifq_head == NULL) return; /* Transmit queued packets until sent or TX ring is full */ @@ -915,7 +915,7 @@ nve_ifstart(struct ifnet *ifp) /* The API TX queue is full - requeue the packet */ device_printf(sc->dev, "nve_ifstart: transmit queue is full\n"); - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; bus_dmamap_unload(sc->mtag, buf->map); IF_PREPEND(&ifp->if_snd, buf->mbuf); buf->mbuf = NULL; @@ -936,7 +936,7 @@ nve_ifstart(struct ifnet *ifp) /* Copy packet to BPF tap */ BPF_MTAP(ifp, m0); } - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; DEBUGOUT(NVE_DEBUG_RUNNING, "nve: nve_ifstart - exit\n"); } @@ -970,12 +970,12 @@ nve_ioctl(struct ifnet *ifp, u_long command, caddr_t data) case SIOCSIFFLAGS: /* Setup interface flags */ if (ifp->if_flags & IFF_UP) { - if ((ifp->if_flags & IFF_RUNNING) == 0) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { nve_init(sc); break; } } else { - if (ifp->if_flags & IFF_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { nve_stop(sc); break; } @@ -987,7 +987,7 @@ nve_ioctl(struct ifnet *ifp, u_long command, caddr_t data) case SIOCADDMULTI: case SIOCDELMULTI: /* Setup multicast filter */ - if (ifp->if_flags & IFF_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { nve_setmulti(sc); } break; @@ -1249,7 +1249,7 @@ nve_watchdog(struct ifnet *ifp) sc->tx_errors++; nve_stop(sc); - ifp->if_flags &= ~IFF_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; nve_init(sc); if (ifp->if_snd.ifq_head != NULL) @@ -1490,7 +1490,7 @@ nve_ospackettx(PNV_VOID ctx, PNV_VOID id, NV_UINT32 success) /* Send more packets if we have them */ if (sc->pending_txs < TX_RING_SIZE) - sc->ifp->if_flags &= ~IFF_OACTIVE; + sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (ifp->if_snd.ifq_head != NULL && sc->pending_txs < TX_RING_SIZE) nve_ifstart(ifp); |