Implemented per-interface polling(4) control.

This commit is contained in:
Ruslan Ermilov 2004-04-11 14:42:25 +00:00
parent 0fad79e6fc
commit 054b4ce6e5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128117

View file

@ -638,6 +638,10 @@ ste_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
struct ste_softc *sc = ifp->if_softc; struct ste_softc *sc = ifp->if_softc;
STE_LOCK(sc); STE_LOCK(sc);
if (!(ifp->if_capenable & IFCAP_POLLING)) {
ether_poll_deregister(ifp);
cmd = POLL_DEREGISTER;
}
if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */ if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */
CSR_WRITE_2(sc, STE_IMR, STE_INTRS); CSR_WRITE_2(sc, STE_IMR, STE_INTRS);
goto done; goto done;
@ -692,7 +696,8 @@ ste_intr(xsc)
#ifdef DEVICE_POLLING #ifdef DEVICE_POLLING
if (ifp->if_flags & IFF_POLLING) if (ifp->if_flags & IFF_POLLING)
goto done; goto done;
if (ether_poll_register(ste_poll, ifp)) { /* ok, disable interrupts */ if ((ifp->if_capenable & IFCAP_POLLING) &&
ether_poll_register(ste_poll, ifp)) { /* ok, disable interrupts */
CSR_WRITE_2(sc, STE_IMR, 0); CSR_WRITE_2(sc, STE_IMR, 0);
ste_poll(ifp, 0, 1); ste_poll(ifp, 0, 1);
goto done; goto done;
@ -1139,6 +1144,10 @@ ste_attach(dev)
*/ */
ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
ifp->if_capabilities |= IFCAP_VLAN_MTU; 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 */ /* Hook interrupt last to avoid having to lock softc */
error = bus_setup_intr(dev, sc->ste_irq, INTR_TYPE_NET, error = bus_setup_intr(dev, sc->ste_irq, INTR_TYPE_NET,
@ -1545,6 +1554,9 @@ ste_ioctl(ifp, command, data)
mii = device_get_softc(sc->ste_miibus); mii = device_get_softc(sc->ste_miibus);
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
break; break;
case SIOCSIFCAP:
ifp->if_capenable = ifr->ifr_reqcap;
break;
default: default:
error = ether_ioctl(ifp, command, data); error = ether_ioctl(ifp, command, data);
break; break;