summaryrefslogtreecommitdiffstats
path: root/sys/dev/dc
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2004-04-11 13:47:15 +0000
committerru <ru@FreeBSD.org>2004-04-11 13:47:15 +0000
commitba67628e611944011a4d6b7a81fda89d7dd093de (patch)
tree1ad84e70561baa2ccdd6ddd250540d535bf3ab14 /sys/dev/dc
parent04fb5a0de8cdf2f792408dc2d15249387718961c (diff)
downloadFreeBSD-src-ba67628e611944011a4d6b7a81fda89d7dd093de.zip
FreeBSD-src-ba67628e611944011a4d6b7a81fda89d7dd093de.tar.gz
First driver with user-configurable polling(4).
Diffstat (limited to 'sys/dev/dc')
-rw-r--r--sys/dev/dc/if_dc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index b614db9..01ac05a 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -2320,6 +2320,10 @@ dc_attach(device_t 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;
callout_init(&sc->dc_stat_ch, IS_MPSAFE ? CALLOUT_MPSAFE : 0);
@@ -3083,6 +3087,10 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
{
struct dc_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 */
/* Re-enable interrupts. */
CSR_WRITE_4(sc, DC_IMR, DC_INTRS);
@@ -3153,7 +3161,8 @@ dc_intr(void *arg)
#ifdef DEVICE_POLLING
if (ifp->if_flags & IFF_POLLING)
goto done;
- if (ether_poll_register(dc_poll, ifp)) { /* ok, disable interrupts */
+ if ((ifp->if_capenable & IFCAP_POLLING) &&
+ ether_poll_register(dc_poll, ifp)) { /* ok, disable interrupts */
CSR_WRITE_4(sc, DC_IMR, 0x00000000);
goto done;
}
@@ -3698,6 +3707,9 @@ dc_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
sc->dc_srm_media = 0;
#endif
break;
+ case SIOCSIFCAP:
+ ifp->if_capenable = ifr->ifr_reqcap;
+ break;
default:
error = ether_ioctl(ifp, command, data);
break;
OpenPOWER on IntegriCloud