diff options
author | ru <ru@FreeBSD.org> | 2004-04-11 15:18:09 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2004-04-11 15:18:09 +0000 |
commit | 2ffc7fc1472a816ac5d68e7fb3b1df1ee3133988 (patch) | |
tree | 93ee7e97d8686843a5694d5b97df44d8a1e7c1b6 | |
parent | 7da0b60b1748a857455ed6d8209d898f2464f0aa (diff) | |
download | FreeBSD-src-2ffc7fc1472a816ac5d68e7fb3b1df1ee3133988.zip FreeBSD-src-2ffc7fc1472a816ac5d68e7fb3b1df1ee3133988.tar.gz |
Implemented per-interface polling(4) control.
-rw-r--r-- | sys/dev/vr/if_vr.c | 14 | ||||
-rw-r--r-- | sys/pci/if_vr.c | 14 |
2 files changed, 26 insertions, 2 deletions
diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index 33a583a..66372be 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -849,6 +849,10 @@ vr_attach(dev) ifp->if_init = vr_init; ifp->if_baudrate = 10000000; ifp->if_snd.ifq_maxlen = VR_TX_LIST_CNT - 1; +#ifdef DEVICE_POLLING + ifp->if_capabilities |= IFCAP_POLLING; +#endif + ifp->if_capenable = ifp->if_capabilities; /* * Do MII setup. @@ -1265,6 +1269,10 @@ vr_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) struct vr_softc *sc = ifp->if_softc; VR_LOCK(sc); + if (!(ifp->if_capenable & IFCAP_POLLING)) { + ether_poll_deregister(ifp); + cmd = POLL_DEREGISTER; + } if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */ CSR_WRITE_2(sc, VR_IMR, VR_INTRS); goto done; @@ -1343,7 +1351,8 @@ vr_intr(arg) #ifdef DEVICE_POLLING if (ifp->if_flags & IFF_POLLING) goto done; - if (ether_poll_register(vr_poll, ifp)) { /* ok, disable interrupts */ + if ((ifp->if_capenable & IFCAP_POLLING) && + ether_poll_register(vr_poll, ifp)) { /* ok, disable interrupts */ CSR_WRITE_2(sc, VR_IMR, 0x0000); vr_poll(ifp, 0, 1); goto done; @@ -1721,6 +1730,9 @@ vr_ioctl(ifp, command, data) mii = device_get_softc(sc->vr_miibus); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + case SIOCSIFCAP: + ifp->if_capenable = ifr->ifr_reqcap; + break; default: error = ether_ioctl(ifp, command, data); break; diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c index 33a583a..66372be 100644 --- a/sys/pci/if_vr.c +++ b/sys/pci/if_vr.c @@ -849,6 +849,10 @@ vr_attach(dev) ifp->if_init = vr_init; ifp->if_baudrate = 10000000; ifp->if_snd.ifq_maxlen = VR_TX_LIST_CNT - 1; +#ifdef DEVICE_POLLING + ifp->if_capabilities |= IFCAP_POLLING; +#endif + ifp->if_capenable = ifp->if_capabilities; /* * Do MII setup. @@ -1265,6 +1269,10 @@ vr_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) struct vr_softc *sc = ifp->if_softc; VR_LOCK(sc); + if (!(ifp->if_capenable & IFCAP_POLLING)) { + ether_poll_deregister(ifp); + cmd = POLL_DEREGISTER; + } if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */ CSR_WRITE_2(sc, VR_IMR, VR_INTRS); goto done; @@ -1343,7 +1351,8 @@ vr_intr(arg) #ifdef DEVICE_POLLING if (ifp->if_flags & IFF_POLLING) goto done; - if (ether_poll_register(vr_poll, ifp)) { /* ok, disable interrupts */ + if ((ifp->if_capenable & IFCAP_POLLING) && + ether_poll_register(vr_poll, ifp)) { /* ok, disable interrupts */ CSR_WRITE_2(sc, VR_IMR, 0x0000); vr_poll(ifp, 0, 1); goto done; @@ -1721,6 +1730,9 @@ vr_ioctl(ifp, command, data) mii = device_get_softc(sc->vr_miibus); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + case SIOCSIFCAP: + ifp->if_capenable = ifr->ifr_reqcap; + break; default: error = ether_ioctl(ifp, command, data); break; |