summaryrefslogtreecommitdiffstats
path: root/sys/net/if_lagg.h
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2007-05-15 07:41:46 +0000
committerthompsa <thompsa@FreeBSD.org>2007-05-15 07:41:46 +0000
commit1eb8d76bed26546baab610bdf8db03724e5e4b16 (patch)
tree9b46ae887a0094102a87bddd505c6bca8a08d5cf /sys/net/if_lagg.h
parentc7b3a722a96766bc84c8f96b03aa1cf5ce003d34 (diff)
downloadFreeBSD-src-1eb8d76bed26546baab610bdf8db03724e5e4b16.zip
FreeBSD-src-1eb8d76bed26546baab610bdf8db03724e5e4b16.tar.gz
Change from a mutex to a read/write lock. This allows the tx port to be
selected simultaneously by multiple senders and transmit/receive is not serialised between aggregated interfaces.
Diffstat (limited to 'sys/net/if_lagg.h')
-rw-r--r--sys/net/if_lagg.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/net/if_lagg.h b/sys/net/if_lagg.h
index e85fe68..db3146d 100644
--- a/sys/net/if_lagg.h
+++ b/sys/net/if_lagg.h
@@ -149,7 +149,7 @@ struct lagg_llq {
struct lagg_softc {
struct ifnet *sc_ifp; /* virtual interface */
- struct mtx sc_mtx;
+ struct rwlock sc_mtx;
int sc_proto; /* lagg protocol */
u_int sc_count; /* number of ports */
struct lagg_port *sc_primary; /* primary port */
@@ -199,13 +199,14 @@ struct lagg_port {
SLIST_ENTRY(lagg_port) lp_entries;
};
-#define LAGG_LOCK_INIT(_tr) mtx_init(&(_tr)->sc_mtx, "if_lagg", NULL, \
- MTX_DEF)
-#define LAGG_LOCK_DESTROY(_tr) mtx_destroy(&(_tr)->sc_mtx)
-#define LAGG_LOCK(_tr) mtx_lock(&(_tr)->sc_mtx)
-#define LAGG_UNLOCK(_tr) mtx_unlock(&(_tr)->sc_mtx)
-#define LAGG_LOCKED(_tr) mtx_owned(&(_tr)->sc_mtx)
-#define LAGG_LOCK_ASSERT(_tr) mtx_assert(&(_tr)->sc_mtx, MA_OWNED)
+#define LAGG_LOCK_INIT(_sc) rw_init(&(_sc)->sc_mtx, "if_lagg rwlock")
+#define LAGG_LOCK_DESTROY(_sc) rw_destroy(&(_sc)->sc_mtx)
+#define LAGG_RLOCK(_sc) rw_rlock(&(_sc)->sc_mtx)
+#define LAGG_WLOCK(_sc) rw_wlock(&(_sc)->sc_mtx)
+#define LAGG_RUNLOCK(_sc) rw_runlock(&(_sc)->sc_mtx)
+#define LAGG_WUNLOCK(_sc) rw_wunlock(&(_sc)->sc_mtx)
+#define LAGG_RLOCK_ASSERT(_sc) rw_assert(&(_sc)->sc_mtx, RA_RLOCKED)
+#define LAGG_WLOCK_ASSERT(_sc) rw_assert(&(_sc)->sc_mtx, RA_WLOCKED)
extern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *);
extern void (*lagg_linkstate_p)(struct ifnet *, int );
OpenPOWER on IntegriCloud