summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_poll.c
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/kern/kern_poll.c
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/kern/kern_poll.c')
-rw-r--r--sys/kern/kern_poll.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_poll.c b/sys/kern/kern_poll.c
index 2fe1324..f1e7e41 100644
--- a/sys/kern/kern_poll.c
+++ b/sys/kern/kern_poll.c
@@ -66,7 +66,7 @@ void ether_poll(int); /* polling while in trap */
* POLL_DEREGISTER: deregister and return to interrupt mode.
*
* The first two commands are only issued if the interface is marked as
- * 'IFF_UP and IFF_RUNNING', the last one only if IFF_RUNNING is set.
+ * 'IFF_UP and IFF_DRV_RUNNING', the last one only if IFF_DRV_RUNNING is set.
*
* The count limit specifies how much work the handler can do during the
* call -- typically this is the number of packets to be received, or
@@ -251,8 +251,9 @@ ether_poll(int count)
if (count > poll_each_burst)
count = poll_each_burst;
for (i = 0 ; i < poll_handlers ; i++)
- if (pr[i].handler && (IFF_UP|IFF_RUNNING) ==
- (pr[i].ifp->if_flags & (IFF_UP|IFF_RUNNING)) )
+ if (pr[i].handler &&
+ (pr[i].ifp->if_flags & IFF_UP) &&
+ (pr[i].ifp->if_drv_flags & IFF_DRV_RUNNING))
pr[i].handler(pr[i].ifp, 0, count); /* quick check */
mtx_unlock(&Giant);
}
@@ -373,13 +374,14 @@ netisr_poll(void)
if (polling) {
for (i = 0 ; i < poll_handlers ; i++)
- if (pr[i].handler && (IFF_UP|IFF_RUNNING) ==
- (pr[i].ifp->if_flags & (IFF_UP|IFF_RUNNING)) )
+ if (pr[i].handler &&
+ (pr[i].ifp->if_flags & IFF_UP) &&
+ (pr[i].ifp->if_drv_flags & IFF_DRV_RUNNING))
pr[i].handler(pr[i].ifp, arg, cycles);
} else { /* unregister */
for (i = 0 ; i < poll_handlers ; i++) {
if (pr[i].handler &&
- pr[i].ifp->if_flags & IFF_RUNNING) {
+ pr[i].ifp->if_drv_flags & IFF_DRV_RUNNING) {
pr[i].ifp->if_flags &= ~IFF_POLLING;
pr[i].handler(pr[i].ifp, POLL_DEREGISTER, 1);
}
OpenPOWER on IntegriCloud