summaryrefslogtreecommitdiffstats
path: root/sys/dev/fxp
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2004-04-11 15:35:49 +0000
committerru <ru@FreeBSD.org>2004-04-11 15:35:49 +0000
commit57c71790666de11b3929096425a3c151890adccc (patch)
treec4267468c8cdc50efc1477ba3af33b21a207ba53 /sys/dev/fxp
parent2ffc7fc1472a816ac5d68e7fb3b1df1ee3133988 (diff)
downloadFreeBSD-src-57c71790666de11b3929096425a3c151890adccc.zip
FreeBSD-src-57c71790666de11b3929096425a3c151890adccc.tar.gz
Implemented per-interface polling(4) control.
Diffstat (limited to 'sys/dev/fxp')
-rw-r--r--sys/dev/fxp/if_fxp.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index fbc655d..67fc301 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -804,6 +804,12 @@ fxp_attach(device_t dev)
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.
*/
@@ -1512,6 +1518,10 @@ fxp_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
u_int8_t statack;
FXP_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_1(sc, FXP_CSR_SCB_INTRCNTL, 0);
FXP_UNLOCK(sc);
@@ -1559,7 +1569,8 @@ fxp_intr(void *xsc)
FXP_UNLOCK(sc);
return;
}
- if (ether_poll_register(fxp_poll, ifp)) {
+ if ((ifp->if_capenable & IFCAP_POLLING) &&
+ ether_poll_register(fxp_poll, ifp)) {
/* disable interrupts */
CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);
FXP_UNLOCK(sc);
@@ -2480,6 +2491,10 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
break;
+ case SIOCSIFCAP:
+ ifp->if_capenable = ifr->ifr_reqcap;
+ break;
+
default:
/*
* ether_ioctl() will eventually call fxp_start() which
OpenPOWER on IntegriCloud