summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2008-09-18 20:56:35 +0000
committerthompsa <thompsa@FreeBSD.org>2008-09-18 20:56:35 +0000
commit3109451488e2081431c50ba50f152f4e0be10187 (patch)
tree47be30309cff70b3a3b3e2b8d4cc5fb0d35eae57 /sys/net
parent5345b5e53297261e83f3e42e57449fc0692fde03 (diff)
downloadFreeBSD-src-3109451488e2081431c50ba50f152f4e0be10187.zip
FreeBSD-src-3109451488e2081431c50ba50f152f4e0be10187.tar.gz
Move the protocol and port count checks to outside the loop, these conditions
can not change while we have the lock so no point retesting.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_lagg.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
index 5d04282..f3a586a 100644
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -1116,6 +1116,13 @@ lagg_start(struct ifnet *ifp)
int error = 0;
LAGG_RLOCK(sc);
+ /* We need a Tx algorithm and at least one port */
+ if (sc->sc_proto == LAGG_PROTO_NONE || sc->sc_count == 0) {
+ IF_DRAIN(&ifp->if_snd);
+ LAGG_RUNLOCK(sc);
+ return;
+ }
+
for (;; error = 0) {
IFQ_DEQUEUE(&ifp->if_snd, m);
if (m == NULL)
@@ -1123,20 +1130,13 @@ lagg_start(struct ifnet *ifp)
ETHER_BPF_MTAP(ifp, m);
- /* We need a Tx algorithm and at least one port */
- if (sc->sc_proto != LAGG_PROTO_NONE && sc->sc_count)
- error = (*sc->sc_start)(sc, m);
- else
- m_freem(m);
-
+ error = (*sc->sc_start)(sc, m);
if (error == 0)
ifp->if_opackets++;
else
ifp->if_oerrors++;
}
LAGG_RUNLOCK(sc);
-
- return;
}
static struct mbuf *
OpenPOWER on IntegriCloud