Implemented per-interface polling(4) control.

This commit is contained in:
ru 2004-04-11 19:25:56 +00:00
parent 1c8cf63506
commit 307bad2c7f

View File

@ -948,6 +948,9 @@ nge_attach(dev)
ifp->if_snd.ifq_maxlen = NGE_TX_LIST_CNT - 1;
ifp->if_hwassist = NGE_CSUM_FEATURES;
ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING;
#ifdef DEVICE_POLLING
ifp->if_capabilities |= IFCAP_POLLING;
#endif
ifp->if_capenable = ifp->if_capabilities;
/*
@ -1523,6 +1526,10 @@ nge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
{
struct nge_softc *sc = ifp->if_softc;
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, NGE_IER, 1);
return;
@ -1575,7 +1582,8 @@ nge_intr(arg)
#ifdef DEVICE_POLLING
if (ifp->if_flags & IFF_POLLING)
return;
if (ether_poll_register(nge_poll, ifp)) { /* ok, disable interrupts */
if ((ifp->if_capenable & IFCAP_POLLING) &&
ether_poll_register(nge_poll, ifp)) { /* ok, disable interrupts */
CSR_WRITE_4(sc, NGE_IER, 0);
nge_poll(ifp, 0, 1);
return;
@ -2156,6 +2164,9 @@ nge_ioctl(ifp, command, data)
command);
}
break;
case SIOCSIFCAP:
ifp->if_capenable = ifr->ifr_reqcap;
break;
default:
error = ether_ioctl(ifp, command, data);
break;