1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Implemented per-interface polling(4) control.

This commit is contained in:
Ruslan Ermilov 2004-04-11 15:35:49 +00:00
parent 43de1cf4be
commit fb9172265b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128119

View File

@ -804,6 +804,12 @@ fxp_attach(device_t dev)
ifp->if_capenable = ifp->if_capabilities; ifp->if_capenable = ifp->if_capabilities;
} }
#ifdef DEVICE_POLLING
/* Inform the world we support polling. */
ifp->if_capabilities |= IFCAP_POLLING;
ifp->if_capenable |= IFCAP_POLLING;
#endif
/* /*
* Attach the interface. * Attach the interface.
*/ */
@ -1512,6 +1518,10 @@ fxp_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
u_int8_t statack; u_int8_t statack;
FXP_LOCK(sc); FXP_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_1(sc, FXP_CSR_SCB_INTRCNTL, 0); CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, 0);
FXP_UNLOCK(sc); FXP_UNLOCK(sc);
@ -1559,7 +1569,8 @@ fxp_intr(void *xsc)
FXP_UNLOCK(sc); FXP_UNLOCK(sc);
return; return;
} }
if (ether_poll_register(fxp_poll, ifp)) { if ((ifp->if_capenable & IFCAP_POLLING) &&
ether_poll_register(fxp_poll, ifp)) {
/* disable interrupts */ /* disable interrupts */
CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);
FXP_UNLOCK(sc); FXP_UNLOCK(sc);
@ -2480,6 +2491,10 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
} }
break; break;
case SIOCSIFCAP:
ifp->if_capenable = ifr->ifr_reqcap;
break;
default: default:
/* /*
* ether_ioctl() will eventually call fxp_start() which * ether_ioctl() will eventually call fxp_start() which