aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/gem
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2005-08-09 10:20:02 +0000
committerRobert Watson <rwatson@FreeBSD.org>2005-08-09 10:20:02 +0000
commit13f4c340aeeeb104844712bb36899d1adef50579 (patch)
treebb70e59641e2310a3c26ec449af5ab0cb7420d9d /sys/dev/gem
parent292ee7be1c404a624dda68ddff1bd988a1851e5a (diff)
downloadsrc-13f4c340aeeeb104844712bb36899d1adef50579.tar.gz
src-13f4c340aeeeb104844712bb36899d1adef50579.zip
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
Notes
Notes: svn path=/head/; revision=148887
Diffstat (limited to 'sys/dev/gem')
-rw-r--r--sys/dev/gem/if_gem.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/dev/gem/if_gem.c b/sys/dev/gem/if_gem.c
index 900af18eac57..a1347c0e19f9 100644
--- a/sys/dev/gem/if_gem.c
+++ b/sys/dev/gem/if_gem.c
@@ -638,7 +638,7 @@ gem_stop(ifp, disable)
/*
* Mark the interface down and cancel the watchdog timer.
*/
- ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
ifp->if_timer = 0;
}
@@ -972,8 +972,8 @@ gem_init_locked(sc)
/* Start the one second timer. */
callout_reset(&sc->sc_tick_ch, hz, gem_tick, sc);
- ifp->if_flags |= IFF_RUNNING;
- ifp->if_flags &= ~IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_RUNNING;
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
ifp->if_timer = 0;
sc->sc_ifflags = ifp->if_flags;
}
@@ -1139,7 +1139,8 @@ gem_start_locked(ifp)
struct mbuf *m0 = NULL;
int firsttx, ntx = 0, ofree, txmfail;
- if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+ if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+ IFF_DRV_RUNNING)
return;
/*
@@ -1198,7 +1199,7 @@ gem_start_locked(ifp)
if (txmfail == -1 || sc->sc_txfree == 0) {
/* No more slots left; notify upper layer. */
- ifp->if_flags |= IFF_OACTIVE;
+ ifp->if_drv_flags |= IFF_DRV_OACTIVE;
}
if (ntx > 0) {
@@ -1338,8 +1339,8 @@ gem_tint(sc)
if (sc->sc_txfree == GEM_NTXDESC - 1)
sc->sc_txwin = 0;
- /* Freed some descriptors, so reset IFF_OACTIVE and restart. */
- ifp->if_flags &= ~IFF_OACTIVE;
+ /* Freed some descriptors, so reset IFF_DRV_OACTIVE and restart. */
+ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
gem_start_locked(ifp);
if (STAILQ_EMPTY(&sc->sc_txdirtyq))
@@ -1873,7 +1874,7 @@ gem_ioctl(ifp, cmd, data)
else
gem_init_locked(sc);
} else {
- if (ifp->if_flags & IFF_RUNNING)
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
gem_stop(ifp, 0);
}
sc->sc_ifflags = ifp->if_flags;