summaryrefslogtreecommitdiffstats
path: root/sys/dev/sn
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-08-09 10:20:02 +0000
committerrwatson <rwatson@FreeBSD.org>2005-08-09 10:20:02 +0000
commit5d770a09e85126b8b3e9fe302c36350a90210cbe (patch)
treebb70e59641e2310a3c26ec449af5ab0cb7420d9d /sys/dev/sn
parent74759aaa78777146f23aa05c856f574efdfb41d9 (diff)
downloadFreeBSD-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/sn')
-rw-r--r--sys/dev/sn/if_sn.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c
index ddfc099..6524eb0 100644
--- a/sys/dev/sn/if_sn.c
+++ b/sys/dev/sn/if_sn.c
@@ -231,7 +231,7 @@ sn_detach(device_t dev)
struct ifnet *ifp = sc->ifp;
snstop(sc);
- ifp->if_flags &= ~IFF_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
ether_ifdetach(ifp);
if_free(ifp);
sn_deactivate(dev);
@@ -337,8 +337,8 @@ sninit_locked(void *xsc)
/*
* Mark the interface running but not active.
*/
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
/*
* Attempt to push out any waiting packets.
@@ -373,7 +373,7 @@ snstart_locked(struct ifnet *ifp)
SN_ASSERT_LOCKED(sc);
- if (sc->ifp->if_flags & IFF_OACTIVE)
+ if (sc->ifp->if_drv_flags & IFF_DRV_OACTIVE)
return;
if (sc->pages_wanted != -1) {
if_printf(ifp, "snstart() while memory allocation pending\n");
@@ -461,7 +461,7 @@ startagain:
sc->intr_mask = mask;
sc->ifp->if_timer = 1;
- sc->ifp->if_flags |= IFF_OACTIVE;
+ sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
sc->pages_wanted = numPages;
return;
}
@@ -544,7 +544,7 @@ startagain:
CSR_WRITE_2(sc, MMU_CMD_REG_W, MMUCR_ENQUEUE);
- sc->ifp->if_flags |= IFF_OACTIVE;
+ sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
sc->ifp->if_timer = 1;
BPF_MTAP(ifp, top);
@@ -751,14 +751,14 @@ try_start:
/*
* Now pass control to snstart() to queue any additional packets
*/
- sc->ifp->if_flags &= ~IFF_OACTIVE;
+ sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
snstart(ifp);
/*
* We've sent something, so we're active. Set a watchdog in case the
* TX_EMPTY interrupt is lost.
*/
- sc->ifp->if_flags |= IFF_OACTIVE;
+ sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
sc->ifp->if_timer = 1;
return;
@@ -845,7 +845,7 @@ sn_intr(void *arg)
* Disable this interrupt.
*/
mask &= ~IM_ALLOC_INT;
- sc->ifp->if_flags &= ~IFF_OACTIVE;
+ sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
snresume(sc->ifp);
}
/*
@@ -912,7 +912,7 @@ sn_intr(void *arg)
/*
* Attempt to queue more transmits.
*/
- sc->ifp->if_flags &= ~IFF_OACTIVE;
+ sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
snstart_locked(sc->ifp);
}
/*
@@ -950,7 +950,7 @@ sn_intr(void *arg)
/*
* Attempt to enqueue some more stuff.
*/
- sc->ifp->if_flags &= ~IFF_OACTIVE;
+ sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
snstart_locked(sc->ifp);
}
/*
@@ -1131,8 +1131,9 @@ snioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
switch (cmd) {
case SIOCSIFFLAGS:
SN_LOCK(sc);
- if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
- ifp->if_flags &= ~IFF_RUNNING;
+ if ((ifp->if_flags & IFF_UP) == 0 &&
+ ifp->if_drv_flags & IFF_DRV_RUNNING) {
+ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
snstop(sc);
} else {
/* reinitialize card on any parameter change */
OpenPOWER on IntegriCloud