1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

Implemented per-interface polling(4) control.

This commit is contained in:
Ruslan Ermilov 2004-04-11 20:34:08 +00:00
parent d7bf7681f2
commit f4ab22c94a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128138
2 changed files with 23 additions and 2 deletions

View File

@ -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;

View File

@ -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;