From 6d4d6d48db54de0ee2355de7e72f65f470ef5b84 Mon Sep 17 00:00:00 2001 From: sephe Date: Sun, 9 Sep 2007 09:14:38 +0000 Subject: [PATCH] - Make fwe(4) aware of IFF_POLLING setting in its if_init(). - Allow IFF_POLLING flag to be turned on even when the interface is not up yet, since after above fix, all drivers that support polling(4) will turn on/off interrupt in their if_init() based on IFF_POLLING. This fixes the bug reported by many people that enabling "polling" in rc.conf's ifconfig_ifaceX does not work. --- sys/dev/netif/fwe/if_fwe.c | 9 ++++++++- sys/kern/kern_poll.c | 14 +++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/sys/dev/netif/fwe/if_fwe.c b/sys/dev/netif/fwe/if_fwe.c index 8fa7a63f99..975aa97102 100644 --- a/sys/dev/netif/fwe/if_fwe.c +++ b/sys/dev/netif/fwe/if_fwe.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/if_fwe.c,v 1.27 2004/01/08 14:58:09 simokawa Exp $ - * $DragonFly: src/sys/dev/netif/fwe/if_fwe.c,v 1.28 2006/12/20 18:14:39 dillon Exp $ + * $DragonFly: src/sys/dev/netif/fwe/if_fwe.c,v 1.29 2007/09/09 09:14:38 sephe Exp $ */ #include "opt_inet.h" @@ -340,6 +340,13 @@ found: } else xferq = fc->ir[fwe->dma_ch]; +#ifdef DEVICE_POLLING + /* Disable interrupt, if polling(4) is enabled */ + if (ifp->if_flags & IFF_POLLING) + fc->set_intr(fc, 0); + else +#endif + fc->set_intr(fc, 1); /* start dma */ if ((xferq->flag & FWXFERQ_RUNNING) == 0) diff --git a/sys/kern/kern_poll.c b/sys/kern/kern_poll.c index 412c8960a2..daa8ad21e0 100644 --- a/sys/kern/kern_poll.c +++ b/sys/kern/kern_poll.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_poll.c,v 1.2.2.4 2002/06/27 23:26:33 luigi Exp $ - * $DragonFly: src/sys/kern/kern_poll.c,v 1.31 2007/09/09 05:11:28 sephe Exp $ + * $DragonFly: src/sys/kern/kern_poll.c,v 1.32 2007/09/09 09:14:38 sephe Exp $ */ #include "opt_polling.h" @@ -71,7 +71,7 @@ void init_device_poll(void); /* init routine */ * POLL_REGISTER: register and disable interrupts * * The first two commands are only issued if the interface is marked as - * 'IFF_UP, IFF_RUNNING and IFF_POLLING', the last one only if IFF_RUNNING + * 'IFF_UP, IFF_RUNNING and IFF_POLLING', the last two only if IFF_RUNNING * is set. * * The count limit specifies how much work the handler can do during the @@ -464,8 +464,6 @@ ether_poll_register(struct ifnet *ifp) if (polling_enabled == 0) /* polling disabled, cannot register */ return 0; - if ((ifp->if_flags & IFF_UP) == 0) /* must be up */ - return 0; if (ifp->if_flags & IFF_POLLING) /* already polling */ return 0; if (ifp->if_poll == NULL) /* no polling support */ @@ -477,7 +475,8 @@ ether_poll_register(struct ifnet *ifp) crit_enter(); /* XXX MP - not mp safe */ lwkt_serialize_enter(ifp->if_serializer); ifp->if_flags |= IFF_POLLING; - ifp->if_poll(ifp, POLL_REGISTER, 0); + if (ifp->if_flags & IFF_RUNNING) + ifp->if_poll(ifp, POLL_REGISTER, 0); lwkt_serialize_exit(ifp->if_serializer); if ((ifp->if_flags & IFF_POLLING) == 0) { crit_exit(); @@ -501,9 +500,10 @@ ether_poll_register(struct ifnet *ifp) "maybe a broken driver ?\n"); verbose--; } - ifp->if_flags &= ~IFF_POLLING; lwkt_serialize_enter(ifp->if_serializer); - ifp->if_poll(ifp, POLL_DEREGISTER, 0); + ifp->if_flags &= ~IFF_POLLING; + if (ifp->if_flags & IFF_RUNNING) + ifp->if_poll(ifp, POLL_DEREGISTER, 0); lwkt_serialize_exit(ifp->if_serializer); rc = 0; } else { -- 2.11.4.GIT