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/sis | |
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/sis')
-rw-r--r-- | sys/dev/sis/if_sis.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/sis/if_sis.c b/sys/dev/sis/if_sis.c index 78b6149..38a3e73 100644 --- a/sys/dev/sis/if_sis.c +++ b/sys/dev/sis/if_sis.c @@ -1394,13 +1394,13 @@ sis_newbuf(struct sis_softc *sc, struct sis_desc *c, struct mbuf *m) * A frame has been uploaded: pass the resulting mbuf chain up to * the higher level protocols. */ -static void +static int sis_rxeof(struct sis_softc *sc) { struct mbuf *m, *m0; struct ifnet *ifp; struct sis_desc *cur_rx; - int total_len = 0; + int total_len = 0, rx_npkts = 0; u_int32_t rxstat; SIS_LOCK_ASSERT(sc); @@ -1476,9 +1476,11 @@ sis_rxeof(struct sis_softc *sc) SIS_UNLOCK(sc); (*ifp->if_input)(ifp, m); SIS_LOCK(sc); + rx_npkts++; } sc->sis_rx_pdsc = cur_rx; + return (rx_npkts); } static void @@ -1580,15 +1582,16 @@ sis_tick(void *xsc) #ifdef DEVICE_POLLING static poll_handler_t sis_poll; -static void +static int sis_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { struct sis_softc *sc = ifp->if_softc; + int rx_npkts = 0; SIS_LOCK(sc); if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { SIS_UNLOCK(sc); - return; + return (rx_npkts); } /* @@ -1599,7 +1602,7 @@ sis_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) * and then call the interrupt routine */ sc->rxcycles = count; - sis_rxeof(sc); + rx_npkts = sis_rxeof(sc); sis_txeof(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) sis_startl(ifp); @@ -1623,6 +1626,7 @@ sis_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) } SIS_UNLOCK(sc); + return (rx_npkts); } #endif /* DEVICE_POLLING */ |