From owner-p4-projects@FreeBSD.ORG Sun Nov 12 03:26:18 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B3B9516A417; Sun, 12 Nov 2006 03:26:18 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7362716A415 for ; Sun, 12 Nov 2006 03:26:18 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 49C3743D53 for ; Sun, 12 Nov 2006 03:26:18 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kAC3QImo039728 for ; Sun, 12 Nov 2006 03:26:18 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kAC3QIZN039725 for perforce@freebsd.org; Sun, 12 Nov 2006 03:26:18 GMT (envelope-from sam@freebsd.org) Date: Sun, 12 Nov 2006 03:26:18 GMT Message-Id: <200611120326.kAC3QIZN039725@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 109768 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Nov 2006 03:26:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=109768 Change 109768 by sam@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 __FBSDID("$FreeBSD$"); +#ifdef HAVE_KERNEL_OPTION_HEADERS +#include "opt_device_polling.h" +#endif + #include #include #include @@ -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;