summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorgallatin <gallatin@FreeBSD.org>2006-06-14 19:32:00 +0000
committergallatin <gallatin@FreeBSD.org>2006-06-14 19:32:00 +0000
commitebcd7ccc917c7e972076cd52cc61abd2c35119b1 (patch)
tree62538552265cb52312dd1d28994cc705c32039b9 /sys/dev
parentf49b3e3c23a8822cd9c3e43f774fbe3a57343563 (diff)
downloadFreeBSD-src-ebcd7ccc917c7e972076cd52cc61abd2c35119b1.zip
FreeBSD-src-ebcd7ccc917c7e972076cd52cc61abd2c35119b1.tar.gz
Much to my surprise, IFQ_DRV_DEQUEUE() can return a null mbuf even if
!IFQ_DRV_IS_EMPTY(). Taking this into account, I re-structured the transmit routine so as to avoid adding another if/then in the critical path. Thanks to brueffer for showing my how to test with altq/pf.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mxge/if_mxge.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/sys/dev/mxge/if_mxge.c b/sys/dev/mxge/if_mxge.c
index d0458f2..eb5f89a 100644
--- a/sys/dev/mxge/if_mxge.c
+++ b/sys/dev/mxge/if_mxge.c
@@ -1277,32 +1277,30 @@ drop:
}
-static void
+
+
+static inline void
mxge_start_locked(mxge_softc_t *sc)
{
- int avail;
struct mbuf *m;
struct ifnet *ifp;
-
ifp = sc->ifp;
- while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
- /* dequeue the packet */
+ while ((sc->tx.mask - (sc->tx.req - sc->tx.done))
+ > MXGE_MAX_SEND_DESC) {
+
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
-
+ if (m == NULL) {
+ return;
+ }
/* let BPF see it */
BPF_MTAP(ifp, m);
/* give it to the nic */
mxge_encap(sc, m);
-
- /* leave an extra slot keep the ring from wrapping */
- avail = sc->tx.mask - (sc->tx.req - sc->tx.done);
- if (avail < MXGE_MAX_SEND_DESC) {
- sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
- return;
- }
}
+ /* ran out of transmit slots */
+ sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
}
static void
OpenPOWER on IntegriCloud