Implemented per-interface polling(4) control.
This commit is contained in:
parent
4880b26184
commit
2ea4f0effc
@ -1096,6 +1096,9 @@ rl_attach(dev)
|
||||
ifp->if_init = rl_init;
|
||||
ifp->if_baudrate = 10000000;
|
||||
ifp->if_capabilities = IFCAP_VLAN_MTU;
|
||||
#ifdef DEVICE_POLLING
|
||||
ifp->if_capabilities |= IFCAP_POLLING;
|
||||
#endif
|
||||
ifp->if_capenable = ifp->if_capabilities;
|
||||
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
|
||||
|
||||
@ -1430,6 +1433,10 @@ rl_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);
|
||||
goto done;
|
||||
@ -1484,7 +1491,8 @@ rl_intr(arg)
|
||||
#ifdef DEVICE_POLLING
|
||||
if (ifp->if_flags & IFF_POLLING)
|
||||
goto done;
|
||||
if (ether_poll_register(rl_poll, ifp)) { /* ok, disable interrupts */
|
||||
if ((ifp->if_capenable & IFCAP_POLLING) &&
|
||||
ether_poll_register(rl_poll, ifp)) { /* ok, disable interrupts */
|
||||
CSR_WRITE_2(sc, RL_IMR, 0x0000);
|
||||
rl_poll(ifp, 0, 1);
|
||||
goto done;
|
||||
@ -1821,6 +1829,9 @@ rl_ioctl(ifp, command, data)
|
||||
mii = device_get_softc(sc->rl_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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user