summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_ste.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2004-04-11 14:42:25 +0000
committerru <ru@FreeBSD.org>2004-04-11 14:42:25 +0000
commit7da0b60b1748a857455ed6d8209d898f2464f0aa (patch)
tree401874c99d1f6e3f6e8e7e8fdab5f237391833db /sys/pci/if_ste.c
parent05be2b63a657869c871134244003db01d576d4c0 (diff)
downloadFreeBSD-src-7da0b60b1748a857455ed6d8209d898f2464f0aa.zip
FreeBSD-src-7da0b60b1748a857455ed6d8209d898f2464f0aa.tar.gz
Implemented per-interface polling(4) control.
Diffstat (limited to 'sys/pci/if_ste.c')
-rw-r--r--sys/pci/if_ste.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c
index 9e419df..2d3f6dc 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -638,6 +638,10 @@ ste_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
struct ste_softc *sc = ifp->if_softc;
STE_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, STE_IMR, STE_INTRS);
goto done;
@@ -692,7 +696,8 @@ ste_intr(xsc)
#ifdef DEVICE_POLLING
if (ifp->if_flags & IFF_POLLING)
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);
ste_poll(ifp, 0, 1);
goto done;
@@ -1139,6 +1144,10 @@ ste_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->ste_irq, INTR_TYPE_NET,
@@ -1545,6 +1554,9 @@ ste_ioctl(ifp, command, data)
mii = device_get_softc(sc->ste_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;
OpenPOWER on IntegriCloud