Implemented per-interface polling(4) control.
This commit is contained in:
parent
ef96ba541f
commit
bade226899
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user