summaryrefslogtreecommitdiffstats
path: root/sys/arm/xscale/ixp425/if_npe.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2009-05-30 15:14:44 +0000
committerattilio <attilio@FreeBSD.org>2009-05-30 15:14:44 +0000
commitb523608331b881784ac18a7dfcb65c7a679130b0 (patch)
tree073ce0f089e7f642e36b12a238c6d66778db53f5 /sys/arm/xscale/ixp425/if_npe.c
parentd03ca3acc6b07da900f12523e3d2560f84b538c4 (diff)
downloadFreeBSD-src-b523608331b881784ac18a7dfcb65c7a679130b0.zip
FreeBSD-src-b523608331b881784ac18a7dfcb65c7a679130b0.tar.gz
When user_frac in the polling subsystem is low it is going to busy the
CPU for too long period than necessary. Additively, interfaces are kept polled (in the tick) even if no more packets are available. In order to avoid such situations a new generic mechanism can be implemented in proactive way, keeping track of the time spent on any packet and fragmenting the time for any tick, stopping the processing as soon as possible. In order to implement such mechanism, the polling handler needs to change, returning the number of packets processed. While the intended logic is not part of this patch, the polling KPI is broken by this commit, adding an int return value and the new flag IFCAP_POLLING_NOCOUNT (which will signal that the return value is meaningless for the installed handler and checking should be skipped). Bump __FreeBSD_version in order to signal such situation. Reviewed by: emaste Sponsored by: Sandvine Incorporated
Diffstat (limited to 'sys/arm/xscale/ixp425/if_npe.c')
-rw-r--r--sys/arm/xscale/ixp425/if_npe.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/arm/xscale/ixp425/if_npe.c b/sys/arm/xscale/ixp425/if_npe.c
index f50a868..3d174e7 100644
--- a/sys/arm/xscale/ixp425/if_npe.c
+++ b/sys/arm/xscale/ixp425/if_npe.c
@@ -229,7 +229,7 @@ static void npe_getmac(struct npe_softc *sc, u_char *eaddr);
static void npe_txdone(int qid, void *arg);
static int npe_rxbuf_init(struct npe_softc *, struct npebuf *,
struct mbuf *);
-static void npe_rxdone(int qid, void *arg);
+static int npe_rxdone(int qid, void *arg);
static void npeinit(void *);
static void npestart_locked(struct ifnet *);
static void npestart(struct ifnet *);
@@ -777,7 +777,7 @@ npe_activate(device_t dev)
*/
sc->rx_qid = npeconfig[sc->sc_npeid].rx_qid;
ixpqmgr_qconfig(sc->rx_qid, npe_rxbuf, 0, 1,
- IX_QMGR_Q_SOURCE_ID_NOT_E, npe_rxdone, sc);
+ IX_QMGR_Q_SOURCE_ID_NOT_E, (qconfig_hand_t *)npe_rxdone, sc);
sc->rx_freeqid = npeconfig[sc->sc_npeid].rx_freeqid;
ixpqmgr_qconfig(sc->rx_freeqid, npe_rxbuf, 0, npe_rxbuf/2, 0, NULL, sc);
/*
@@ -1091,7 +1091,7 @@ npe_rxbuf_init(struct npe_softc *sc, struct npebuf *npe, struct mbuf *m)
* from the hardware queue and pass the frames up the
* stack. Pass the rx buffers to the free list.
*/
-static void
+static int
npe_rxdone(int qid, void *arg)
{
#define P2V(a, dma) \
@@ -1099,6 +1099,7 @@ npe_rxdone(int qid, void *arg)
struct npe_softc *sc = arg;
struct npedma *dma = &sc->rxdma;
uint32_t entry;
+ int rx_npkts = 0;
while (ixpqmgr_qread(qid, &entry) == 0) {
struct npebuf *npe = P2V(NPE_QM_Q_ADDR(entry), dma);
@@ -1132,6 +1133,7 @@ npe_rxdone(int qid, void *arg)
ifp->if_ipackets++;
ifp->if_input(ifp, mrx);
+ rx_npkts++;
} else {
/* discard frame and re-use mbuf */
m = npe->ix_m;
@@ -1143,19 +1145,22 @@ npe_rxdone(int qid, void *arg)
/* XXX should not happen */
}
}
+ return (rx_npkts);
#undef P2V
}
#ifdef DEVICE_POLLING
-static void
+static int
npe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
{
struct npe_softc *sc = ifp->if_softc;
+ int rx_npkts = 0;
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
- npe_rxdone(sc->rx_qid, sc);
+ rx_npkts = npe_rxdone(sc->rx_qid, sc);
npe_txdone(sc->tx_doneqid, sc); /* XXX polls both NPE's */
}
+ return (rx_npkts);
}
#endif /* DEVICE_POLLING */
OpenPOWER on IntegriCloud