diff options
author | attilio <attilio@FreeBSD.org> | 2009-05-30 15:14:44 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2009-05-30 15:14:44 +0000 |
commit | b523608331b881784ac18a7dfcb65c7a679130b0 (patch) | |
tree | 073ce0f089e7f642e36b12a238c6d66778db53f5 /sys/dev/mge/if_mge.c | |
parent | d03ca3acc6b07da900f12523e3d2560f84b538c4 (diff) | |
download | FreeBSD-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/dev/mge/if_mge.c')
-rw-r--r-- | sys/dev/mge/if_mge.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/mge/if_mge.c b/sys/dev/mge/if_mge.c index 43a7a18..2373f0c 100644 --- a/sys/dev/mge/if_mge.c +++ b/sys/dev/mge/if_mge.c @@ -106,7 +106,7 @@ static void mge_ver_params(struct mge_softc *sc); static void mge_intrs_ctrl(struct mge_softc *sc, int enable); static void mge_intr_rx(void *arg); -static void mge_intr_rx_locked(struct mge_softc *sc, int count); +static int mge_intr_rx_locked(struct mge_softc *sc, int count); static void mge_intr_tx(void *arg); static void mge_intr_tx_locked(struct mge_softc *sc); static void mge_intr_misc(void *arg); @@ -569,17 +569,18 @@ mge_reinit_rx(struct mge_softc *sc) #ifdef DEVICE_POLLING static poll_handler_t mge_poll; -static void +static int mge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { struct mge_softc *sc = ifp->if_softc; uint32_t int_cause, int_cause_ext; + int rx_npkts = 0; MGE_GLOBAL_LOCK(sc); if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { MGE_GLOBAL_UNLOCK(sc); - return; + return (rx_npkts); } if (cmd == POLL_AND_CHECK_STATUS) { @@ -597,9 +598,10 @@ mge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) } mge_intr_tx_locked(sc); - mge_intr_rx_locked(sc, count); + rx_npkts = mge_intr_rx_locked(sc, count); MGE_GLOBAL_UNLOCK(sc); + return (rx_npkts); } #endif /* DEVICE_POLLING */ @@ -1013,7 +1015,7 @@ mge_intr_rx(void *arg) { } -static void +static int mge_intr_rx_locked(struct mge_softc *sc, int count) { struct ifnet *ifp = sc->ifp; @@ -1021,6 +1023,7 @@ mge_intr_rx_locked(struct mge_softc *sc, int count) uint16_t bufsize; struct mge_desc_wrapper* dw; struct mbuf *mb; + int rx_npkts = 0; MGE_RECEIVE_LOCK_ASSERT(sc); @@ -1059,6 +1062,7 @@ mge_intr_rx_locked(struct mge_softc *sc, int count) MGE_RECEIVE_UNLOCK(sc); (*ifp->if_input)(ifp, mb); MGE_RECEIVE_LOCK(sc); + rx_npkts++; } dw->mge_desc->byte_count = 0; @@ -1071,7 +1075,7 @@ mge_intr_rx_locked(struct mge_softc *sc, int count) count -= 1; } - return; + return (rx_npkts); } static void |