summaryrefslogtreecommitdiffstats
path: root/sys/dev/ste/if_ste.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/dev/ste/if_ste.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/dev/ste/if_ste.c')
-rw-r--r--sys/dev/ste/if_ste.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/ste/if_ste.c b/sys/dev/ste/if_ste.c
index 0e06d7b..5411d08 100644
--- a/sys/dev/ste/if_ste.c
+++ b/sys/dev/ste/if_ste.c
@@ -98,7 +98,7 @@ static void ste_init(void *);
static void ste_init_locked(struct ste_softc *);
static void ste_intr(void *);
static void ste_rxeoc(struct ste_softc *);
-static void ste_rxeof(struct ste_softc *);
+static int ste_rxeof(struct ste_softc *);
static void ste_txeoc(struct ste_softc *);
static void ste_txeof(struct ste_softc *);
static void ste_stats_update(void *);
@@ -620,28 +620,31 @@ ste_setmulti(sc)
#ifdef DEVICE_POLLING
static poll_handler_t ste_poll, ste_poll_locked;
-static void
+static int
ste_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
{
struct ste_softc *sc = ifp->if_softc;
+ int rx_npkts = 0;
STE_LOCK(sc);
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
- ste_poll_locked(ifp, cmd, count);
+ rx_npkts = ste_poll_locked(ifp, cmd, count);
STE_UNLOCK(sc);
+ return (rx_npkts);
}
-static void
+static int
ste_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count)
{
struct ste_softc *sc = ifp->if_softc;
+ int rx_npkts;
STE_LOCK_ASSERT(sc);
sc->rxcycles = count;
if (cmd == POLL_AND_CHECK_STATUS)
ste_rxeoc(sc);
- ste_rxeof(sc);
+ rx_npkts = ste_rxeof(sc);
ste_txeof(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
ste_start_locked(ifp);
@@ -667,6 +670,7 @@ ste_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count)
ste_init_locked(sc);
}
}
+ return (rx_npkts);
}
#endif /* DEVICE_POLLING */
@@ -765,14 +769,14 @@ ste_rxeoc(struct ste_softc *sc)
* A frame has been uploaded: pass the resulting mbuf chain up to
* the higher level protocols.
*/
-static void
+static int
ste_rxeof(sc)
struct ste_softc *sc;
{
struct mbuf *m;
struct ifnet *ifp;
struct ste_chain_onefrag *cur_rx;
- int total_len = 0, count=0;
+ int total_len = 0, count=0, rx_npkts = 0;
u_int32_t rxstat;
STE_LOCK_ASSERT(sc);
@@ -847,9 +851,10 @@ ste_rxeof(sc)
cur_rx->ste_ptr->ste_status = 0;
count++;
+ rx_npkts++;
}
- return;
+ return (rx_npkts);
}
static void
OpenPOWER on IntegriCloud