PERFORCE change 109768 for review
Sam Leffler
sam at FreeBSD.org
Sun Nov 12 03:26:19 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=109768
Change 109768 by sam at sam_ebb on 2006/11/12 03:25:33
device polling; not quite right due to shared tx done q;
also stopped right now by 100hz clock
Affected files ...
.. //depot/projects/arm/src/sys/arm/xscale/ixp425/if_npe.c#21 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/xscale/ixp425/if_npe.c#21 (text+ko) ====
@@ -25,6 +25,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#ifdef HAVE_KERNEL_OPTION_HEADERS
+#include "opt_device_polling.h"
+#endif
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -299,13 +303,16 @@
ifp->if_ioctl = npeioctl;
ifp->if_watchdog = npewatchdog;
ifp->if_init = npeinit;
- IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
+ IFQ_SET_MAXLEN(&ifp->if_snd, sc->txdma.nbuf - 1);
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
IFQ_SET_READY(&ifp->if_snd);
ifp->if_timer = 0;
ifp->if_linkmib = &sc->mibdata;
ifp->if_linkmiblen = sizeof(sc->mibdata);
sc->mibdata.dot3Compliance = DOT3COMPLIANCE_STATS;
+#ifdef DEVICE_POLLING
+ ifp->if_capabilities |= IFCAP_POLLING;
+#endif
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "debug",
CTLFLAG_RW, &sc->sc_debug, 0, "control debugging printfs");
@@ -327,6 +334,10 @@
struct npe_softc *sc = device_get_softc(dev);
struct ifnet *ifp = sc->sc_ifp;
+#ifdef DEVICE_POLLING
+ if (ifp->if_capenable & IFCAP_POLLING)
+ ether_poll_deregister(ifp);
+#endif
npestop(sc);
if (ifp != NULL) {
ether_ifdetach(ifp);
@@ -949,6 +960,19 @@
#undef P2V
}
+#ifdef DEVICE_POLLING
+static void
+npe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
+{
+ struct npe_softc *sc = ifp->if_softc;
+
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+ npe_rxdone(sc->rx_qid, sc);
+ npe_txdone(sc->tx_doneqid, sc); /* XXX polls both NPE's */
+ }
+}
+#endif /* DEVICE_POLLING */
+
static void
npe_startxmit(struct npe_softc *sc)
{
@@ -1340,6 +1364,9 @@
struct mii_data *mii;
struct ifreq *ifr = (struct ifreq *)data;
int error = 0;
+#ifdef DEVICE_POLLING
+ int mask;
+#endif
switch (cmd) {
case SIOCSIFFLAGS:
@@ -1369,6 +1396,36 @@
mii = device_get_softc(sc->sc_mii);
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd);
break;
+
+#ifdef DEVICE_POLLING
+ case SIOCSIFCAP:
+ mask = ifp->if_capenable ^ ifr->ifr_reqcap;
+ if (mask & IFCAP_POLLING) {
+ if (ifr->ifr_reqcap & IFCAP_POLLING) {
+ error = ether_poll_register(npe_poll, ifp);
+ if (error)
+ return error;
+ NPE_LOCK(sc);
+ /* disable callbacks XXX txdone is shared */
+ ixpqmgr_notify_disable(sc->rx_qid);
+ ixpqmgr_notify_disable(sc->tx_doneqid);
+ ifp->if_capenable |= IFCAP_POLLING;
+ NPE_UNLOCK(sc);
+ } else {
+ error = ether_poll_deregister(ifp);
+ /* NB: always enable qmgr callbacks */
+ NPE_LOCK(sc);
+ /* enable qmgr callbacks */
+ ixpqmgr_notify_enable(sc->rx_qid,
+ IX_QMGR_Q_SOURCE_ID_NOT_E);
+ ixpqmgr_notify_enable(sc->tx_doneqid,
+ IX_QMGR_Q_SOURCE_ID_NOT_E);
+ ifp->if_capenable &= ~IFCAP_POLLING;
+ NPE_UNLOCK(sc);
+ }
+ }
+ break;
+#endif
default:
error = ether_ioctl(ifp, cmd, data);
break;
More information about the p4-projects
mailing list