From 3109451488e2081431c50ba50f152f4e0be10187 Mon Sep 17 00:00:00 2001 From: thompsa Date: Thu, 18 Sep 2008 20:56:35 +0000 Subject: 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. --- sys/net/if_lagg.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sys/net') 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 * -- cgit v1.1