diff options
author | ru <ru@FreeBSD.org> | 2004-04-11 20:34:08 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2004-04-11 20:34:08 +0000 |
commit | bade226899d2aefb0457b71c69422415c5da1210 (patch) | |
tree | 3de5efd3063c7afe5cf1b31d806f6640a725d147 | |
parent | ef96ba541f4f9372814d2c11b13e6a42eca6ea0a (diff) | |
download | FreeBSD-src-bade226899d2aefb0457b71c69422415c5da1210.zip FreeBSD-src-bade226899d2aefb0457b71c69422415c5da1210.tar.gz |
Implemented per-interface polling(4) control.
-rw-r--r-- | sys/dev/re/if_re.c | 10 | ||||
-rw-r--r-- | sys/pci/if_sis.c | 15 |
2 files changed, 23 insertions, 2 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 4459ff2..19f4004 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -1256,6 +1256,9 @@ re_attach(dev) ifp->if_start = re_start; ifp->if_hwassist = RE_CSUM_FEATURES; ifp->if_capabilities |= IFCAP_HWCSUM|IFCAP_VLAN_HWTAGGING; +#ifdef DEVICE_POLLING + ifp->if_capabilities |= IFCAP_POLLING; +#endif ifp->if_watchdog = re_watchdog; ifp->if_init = re_init; if (sc->rl_type == RL_8169) @@ -1766,6 +1769,10 @@ re_poll (struct ifnet *ifp, enum poll_cmd cmd, int count) struct rl_softc *sc = ifp->if_softc; RL_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, RL_IMR, RL_INTRS_CPLUS); goto done; @@ -1826,7 +1833,8 @@ re_intr(arg) #ifdef DEVICE_POLLING if (ifp->if_flags & IFF_POLLING) goto done; - if (ether_poll_register(re_poll, ifp)) { /* ok, disable interrupts */ + if ((ifp->if_capenable & IFCAP_POLLING) && + ether_poll_register(re_poll, ifp)) { /* ok, disable interrupts */ CSR_WRITE_2(sc, RL_IMR, 0x0000); re_poll(ifp, 0, 1); goto done; diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c index 3ede4cc..8aef8db 100644 --- a/sys/pci/if_sis.c +++ b/sys/pci/if_sis.c @@ -1391,6 +1391,11 @@ sis_attach(dev) ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_VLAN_MTU; +#ifdef DEVICE_POLLING + ifp->if_capabilities |= IFCAP_POLLING; +#endif + ifp->if_capenable = ifp->if_capabilities; + /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->sis_irq, INTR_TYPE_NET | INTR_MPSAFE, sis_intr, sc, &sc->sis_intrhand); @@ -1773,6 +1778,10 @@ sis_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) struct sis_softc *sc = ifp->if_softc; SIS_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_4(sc, SIS_IER, 1); goto done; @@ -1829,7 +1838,8 @@ sis_intr(arg) #ifdef DEVICE_POLLING if (ifp->if_flags & IFF_POLLING) goto done; - if (ether_poll_register(sis_poll, ifp)) { /* ok, disable interrupts */ + if ((ifp->if_capenable & IFCAP_POLLING) && + ether_poll_register(sis_poll, ifp)) { /* ok, disable interrupts */ CSR_WRITE_4(sc, SIS_IER, 0); goto done; } @@ -2329,6 +2339,9 @@ sis_ioctl(ifp, command, data) error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); SIS_UNLOCK(sc); break; + case SIOCSIFCAP: + ifp->if_capenable = ifr->ifr_reqcap; + break; default: error = ether_ioctl(ifp, command, data); break; |