From 26c6f2232fbf5e8d1c724e0b6eab7831184f292d Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 7 Sep 2010 09:00:23 -0700 Subject: [PATCH] wlan - Rip out all wlan locks part 1/2 * Rip out all the individiual wlan locks --- sys/netproto/802_11/ieee80211_ageq.h | 1 - sys/netproto/802_11/ieee80211_dragonfly.h | 134 ++++-------------- sys/netproto/802_11/ieee80211_mesh.h | 1 - sys/netproto/802_11/ieee80211_node.h | 2 - sys/netproto/802_11/ieee80211_power.h | 1 - sys/netproto/802_11/ieee80211_var.h | 1 - sys/netproto/802_11/wlan/ieee80211.c | 20 --- sys/netproto/802_11/wlan/ieee80211_adhoc.c | 2 - sys/netproto/802_11/wlan/ieee80211_ageq.c | 9 -- sys/netproto/802_11/wlan/ieee80211_ddb.c | 7 +- sys/netproto/802_11/wlan/ieee80211_dfs.c | 14 -- .../802_11/wlan/ieee80211_dragonfly.c | 81 +++++++++-- sys/netproto/802_11/wlan/ieee80211_hostap.c | 2 - sys/netproto/802_11/wlan/ieee80211_ht.c | 11 -- sys/netproto/802_11/wlan/ieee80211_input.c | 2 - sys/netproto/802_11/wlan/ieee80211_ioctl.c | 19 --- sys/netproto/802_11/wlan/ieee80211_mesh.c | 32 ----- sys/netproto/802_11/wlan/ieee80211_monitor.c | 2 - sys/netproto/802_11/wlan/ieee80211_node.c | 74 +--------- sys/netproto/802_11/wlan/ieee80211_output.c | 6 - sys/netproto/802_11/wlan/ieee80211_power.c | 15 -- sys/netproto/802_11/wlan/ieee80211_proto.c | 43 +----- .../802_11/wlan/ieee80211_regdomain.c | 5 - sys/netproto/802_11/wlan/ieee80211_scan.c | 54 +------ sys/netproto/802_11/wlan/ieee80211_scan_sta.c | 4 - sys/netproto/802_11/wlan/ieee80211_sta.c | 7 +- sys/netproto/802_11/wlan/ieee80211_superg.c | 10 -- sys/netproto/802_11/wlan/ieee80211_tdma.c | 2 - sys/netproto/802_11/wlan/ieee80211_wds.c | 6 +- sys/netproto/802_11/wlan_acl/ieee80211_acl.c | 13 -- 30 files changed, 111 insertions(+), 469 deletions(-) diff --git a/sys/netproto/802_11/ieee80211_ageq.h b/sys/netproto/802_11/ieee80211_ageq.h index 3d95e903d7..a1da05b1e8 100644 --- a/sys/netproto/802_11/ieee80211_ageq.h +++ b/sys/netproto/802_11/ieee80211_ageq.h @@ -32,7 +32,6 @@ struct ieee80211_node; struct mbuf; struct ieee80211_ageq { - ieee80211_ageq_lock_t aq_lock; int aq_len; /* # items on queue */ int aq_maxlen; /* max queue length */ int aq_drops; /* frames dropped */ diff --git a/sys/netproto/802_11/ieee80211_dragonfly.h b/sys/netproto/802_11/ieee80211_dragonfly.h index 04d6370e64..35f3dc7d13 100644 --- a/sys/netproto/802_11/ieee80211_dragonfly.h +++ b/sys/netproto/802_11/ieee80211_dragonfly.h @@ -29,101 +29,19 @@ #define _NET80211_IEEE80211_DRAGONFLY_H_ #ifdef _KERNEL + #include #include -#include -#include +#include #include +#include #include -#define IF_LOCK(_lock) /* */ -#define IF_UNLOCK(_lock) /* */ - -/* - * Common state locking definitions. - */ -typedef struct { - char name[16]; /* e.g. "ath0_com_lock" */ - struct lock lock; -} ieee80211_com_lock_t; -/* -#define IEEE80211_LOCK_INIT(_ic, _name) do { \ - ieee80211_com_lock_t *cl = &(_ic)->ic_comlock; \ - ksnprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name); \ - lockinit(&cl->lock, cl->name, 0, LK_CANRECURSE); \ -} while (0) -#define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock.lock) -#define IEEE80211_LOCK_DESTROY(_ic) lockuninit(IEEE80211_LOCK_OBJ(_ic)) -#define IEEE80211_LOCK(_ic) \ - lockmgr(IEEE80211_LOCK_OBJ(_ic), LK_EXCLUSIVE) -#define IEEE80211_UNLOCK(_ic) lockmgr(IEEE80211_LOCK_OBJ(_ic), LK_RELEASE) -#define IEEE80211_LOCK_ASSERT(_ic) \ - KKASSERT(lockstatus(IEEE80211_LOCK_OBJ(_ic), curthread) != 0) -*/ -#define IEEE80211_LOCK_INIT(_ic, _name) -#define IEEE80211_LOCK_OBJ(_ic) (NULL) -#define IEEE80211_LOCK_DESTROY(_ic) -#define IEEE80211_LOCK(_ic) lwkt_gettoken(&wlan_token) -#define IEEE80211_UNLOCK(_ic) lwkt_reltoken(&wlan_token) -#define IEEE80211_LOCK_ASSERT(_ic) ASSERT_LWKT_TOKEN_HELD(&wlan_token) - -/* - * Node locking definitions. - */ -typedef struct { - char name[16]; /* e.g. "ath0_node_lock" */ - struct lock lock; -} ieee80211_node_lock_t; -#define IEEE80211_NODE_LOCK_INIT(_nt, _name) do { \ - ieee80211_node_lock_t *nl = &(_nt)->nt_nodelock; \ - ksnprintf(nl->name, sizeof(nl->name), "%s_node_lock", _name); \ - lockinit(&nl->lock, nl->name, 0, LK_CANRECURSE); \ -} while (0) -#define IEEE80211_NODE_LOCK_OBJ(_nt) (&(_nt)->nt_nodelock.lock) -#define IEEE80211_NODE_LOCK_DESTROY(_nt) \ - lockuninit(IEEE80211_NODE_LOCK_OBJ(_nt)) -#define IEEE80211_NODE_LOCK(_nt) \ - lockmgr(IEEE80211_NODE_LOCK_OBJ(_nt), LK_EXCLUSIVE) -#define IEEE80211_NODE_IS_LOCKED(_nt) \ - (lockstatus(IEEE80211_NODE_LOCK_OBJ(_nt), curthread) == LK_EXCLUSIVE) -#define IEEE80211_NODE_UNLOCK(_nt) \ - lockmgr(IEEE80211_NODE_LOCK_OBJ(_nt), LK_RELEASE) -#define IEEE80211_NODE_LOCK_ASSERT(_nt) \ - KKASSERT(lockstatus(IEEE80211_NODE_LOCK_OBJ(_nt), curthread) != 0) - -/* - * Node table iteration locking definitions; this protects the - * scan generation # used to iterate over the station table - * while grabbing+releasing the node lock. - */ -typedef struct { - char name[16]; /* e.g. "ath0_scan_lock" */ - struct lock lock; -} ieee80211_scan_lock_t; -#define IEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do { \ - ieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock; \ - ksnprintf(sl->name, sizeof(sl->name), "%s_scan_lock", _name); \ - lockinit(&sl->lock, sl->name, 0, 0); \ -} while (0) -#define IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt) (&(_nt)->nt_scanlock.lock) -#define IEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \ - lockuninit(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) -#define IEEE80211_NODE_ITERATE_LOCK(_nt) \ - lockmgr(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt), LK_EXCLUSIVE) -#define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \ - lockmgr(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt), LK_RELEASE) - -/* - * Power-save queue definitions. - */ -typedef struct lock ieee80211_psq_lock_t; -#define IEEE80211_PSQ_INIT(_psq, _name) \ - lockinit(&(_psq)->psq_lock, __DECONST(char *, _name), 0, 0) -#define IEEE80211_PSQ_DESTROY(_psq) lockuninit(&(_psq)->psq_lock) -#define IEEE80211_PSQ_LOCK(_psq) lockmgr(&(_psq)->psq_lock, LK_EXCLUSIVE) -#define IEEE80211_PSQ_UNLOCK(_psq) lockmgr(&(_psq)->psq_lock, LK_RELEASE) +#include +#include #ifndef IF_PREPEND_LIST + #define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \ (mtail)->m_nextpkt = (ifq)->ifq_head; \ if ((ifq)->ifq_tail == NULL) \ @@ -131,34 +49,36 @@ typedef struct lock ieee80211_psq_lock_t; (ifq)->ifq_head = (mhead); \ (ifq)->ifq_len += (mcount); \ } while (0) + #define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do { \ - IF_LOCK(ifq); \ + wlan_assert_serialized(); \ _IF_PREPEND_LIST(ifq, mhead, mtail, mcount); \ - IF_UNLOCK(ifq); \ } while (0) + #endif /* IF_PREPEND_LIST */ - + /* - * Age queue definitions. + * Global serializer (operates like a non-reentrant lockmgr lock) */ -typedef struct lock ieee80211_ageq_lock_t; -#define IEEE80211_AGEQ_INIT(_aq, _name) \ - lockinit(&(_aq)->aq_lock, __DECONST(char *, _name), 0, 0) -#define IEEE80211_AGEQ_DESTROY(_aq) lockuninit(&(_aq)->aq_lock) -#define IEEE80211_AGEQ_LOCK(_aq) lockmgr(&(_aq)->aq_lock, LK_EXCLUSIVE) -#define IEEE80211_AGEQ_UNLOCK(_aq) lockmgr(&(_aq)->aq_lock, LK_RELEASE) +extern struct lwkt_serialize wlan_global_serializer; + +void wlan_serialize_enter(void); +void wlan_serialize_exit(void); +int wlan_serialize_sleep(void *ident, int flags, const char *wmesg, int timo); + +static __inline void +wlan_assert_serialized(void) +{ + ASSERT_SERIALIZED(&wlan_global_serializer); +} /* - * 802.1x MAC ACL database locking definitions. + * wlan condition variables. Assume the global serializer is held. */ -typedef struct lock acl_lock_t; -#define ACL_LOCK_INIT(_as, _name) \ - lockinit(&(_as)->as_lock, __DECONST(char *, _name), 0, 0) -#define ACL_LOCK_DESTROY(_as) lockuninit(&(_as)->as_lock) -#define ACL_LOCK(_as) lockmgr(&(_as)->as_lock, LK_EXCLUSIVE) -#define ACL_UNLOCK(_as) lockmgr(&(_as)->as_lock, LK_RELEASE) -#define ACL_LOCK_ASSERT(_as) \ - KKASSERT(lockstatus(&(_as)->as_lock, curthread) != 0) +void wlan_cv_init(struct cv *cv, const char *desc); +int wlan_cv_timedwait(struct cv *cv, int ticks); +void wlan_cv_wait(struct cv *cv); +void wlan_cv_signal(struct cv *cv, int broadcast); /* * Node reference counting definitions. diff --git a/sys/netproto/802_11/ieee80211_mesh.h b/sys/netproto/802_11/ieee80211_mesh.h index 2bcdbdbd66..01f2e8278d 100644 --- a/sys/netproto/802_11/ieee80211_mesh.h +++ b/sys/netproto/802_11/ieee80211_mesh.h @@ -429,7 +429,6 @@ struct ieee80211_mesh_state { #define IEEE80211_MESHFLAGS_PORTAL 0x02 /* mesh portal role */ #define IEEE80211_MESHFLAGS_FWD 0x04 /* forward packets */ uint8_t ms_flags; - struct lock ms_rt_lock; struct callout ms_cleantimer; TAILQ_HEAD(, ieee80211_mesh_route) ms_routes; struct ieee80211_mesh_proto_metric *ms_pmetric; diff --git a/sys/netproto/802_11/ieee80211_node.h b/sys/netproto/802_11/ieee80211_node.h index aa0ba13e9a..d788643d8e 100644 --- a/sys/netproto/802_11/ieee80211_node.h +++ b/sys/netproto/802_11/ieee80211_node.h @@ -343,13 +343,11 @@ void ieee80211_ies_expand(struct ieee80211_ies *); */ struct ieee80211_node_table { struct ieee80211com *nt_ic; /* back reference */ - ieee80211_node_lock_t nt_nodelock; /* on node table */ TAILQ_HEAD(, ieee80211_node) nt_node; /* information of all nodes */ LIST_HEAD(, ieee80211_node) nt_hash[IEEE80211_NODE_HASHSIZE]; struct ieee80211_node **nt_keyixmap; /* key ix -> node map */ int nt_keyixmax; /* keyixmap size */ const char *nt_name; /* table name for debug msgs */ - ieee80211_scan_lock_t nt_scanlock; /* on nt_scangen */ u_int nt_scangen; /* gen# for iterators */ int nt_inact_init; /* initial node inact setting */ }; diff --git a/sys/netproto/802_11/ieee80211_power.h b/sys/netproto/802_11/ieee80211_power.h index 3478e08ad5..1d123559a4 100644 --- a/sys/netproto/802_11/ieee80211_power.h +++ b/sys/netproto/802_11/ieee80211_power.h @@ -49,7 +49,6 @@ struct mbuf; * frames are required to handle them when they come back. */ struct ieee80211_psq { - ieee80211_psq_lock_t psq_lock; int psq_len; int psq_maxlen; int psq_drops; diff --git a/sys/netproto/802_11/ieee80211_var.h b/sys/netproto/802_11/ieee80211_var.h index c609cab62c..22e3207171 100644 --- a/sys/netproto/802_11/ieee80211_var.h +++ b/sys/netproto/802_11/ieee80211_var.h @@ -120,7 +120,6 @@ struct ieee80211_frame; struct ieee80211com { struct ifnet *ic_ifp; /* associated device */ - ieee80211_com_lock_t ic_comlock; /* state update lock */ TAILQ_HEAD(, ieee80211vap) ic_vaps; /* list of vap instances */ int ic_headroom; /* driver tx headroom needs */ enum ieee80211_phytype ic_phytype; /* XXX wrong for multi-mode */ diff --git a/sys/netproto/802_11/wlan/ieee80211.c b/sys/netproto/802_11/wlan/ieee80211.c index b36220c02b..f41838fe9a 100644 --- a/sys/netproto/802_11/wlan/ieee80211.c +++ b/sys/netproto/802_11/wlan/ieee80211.c @@ -267,7 +267,6 @@ ieee80211_ifattach(struct ieee80211com *ic, KASSERT(ifp->if_type == IFT_IEEE80211, ("if_type %d", ifp->if_type)); - IEEE80211_LOCK_INIT(ic, ifp->if_xname); TAILQ_INIT(&ic->ic_vaps); /* Create a taskqueue for all state changes */ @@ -356,7 +355,6 @@ ieee80211_ifdetach(struct ieee80211com *ic) ifmedia_removeall(&ic->ic_media); taskqueue_free(ic->ic_tq); - IEEE80211_LOCK_DESTROY(ic); } /* @@ -544,7 +542,6 @@ ieee80211_vap_attach(struct ieee80211vap *vap, } /* NB: if_mtu set by ether_ifattach to ETHERMTU */ - IEEE80211_LOCK(ic); TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next); ieee80211_syncflag_locked(ic, IEEE80211_F_WME); #ifdef IEEE80211_SUPPORT_SUPERG @@ -556,7 +553,6 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40); ieee80211_syncifflag_locked(ic, IFF_PROMISC); ieee80211_syncifflag_locked(ic, IFF_ALLMULTI); - IEEE80211_UNLOCK(ic); return 1; } @@ -593,7 +589,6 @@ ieee80211_vap_detach(struct ieee80211vap *vap) taskqueue_drain(taskqueue_swi, &ifp->if_linktask); #endif - IEEE80211_LOCK(ic); KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running")); TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next); ieee80211_syncflag_locked(ic, IEEE80211_F_WME); @@ -608,7 +603,6 @@ ieee80211_vap_detach(struct ieee80211vap *vap) ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF); ieee80211_syncifflag_locked(ic, IFF_PROMISC); ieee80211_syncifflag_locked(ic, IFF_ALLMULTI); - IEEE80211_UNLOCK(ic); ifmedia_removeall(&vap->iv_media); @@ -641,8 +635,6 @@ ieee80211_syncifflag_locked(struct ieee80211com *ic, int flag) struct ieee80211vap *vap; int bit, oflags; - IEEE80211_LOCK_ASSERT(ic); - bit = 0; TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) if (vap->iv_ifp->if_flags & flag) { @@ -686,8 +678,6 @@ ieee80211_syncflag_locked(struct ieee80211com *ic, int flag) struct ieee80211vap *vap; int bit; - IEEE80211_LOCK_ASSERT(ic); - bit = 0; TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) if (vap->iv_flags & flag) { @@ -705,14 +695,12 @@ ieee80211_syncflag(struct ieee80211vap *vap, int flag) { struct ieee80211com *ic = vap->iv_ic; - IEEE80211_LOCK(ic); if (flag < 0) { flag = -flag; vap->iv_flags &= ~flag; } else vap->iv_flags |= flag; ieee80211_syncflag_locked(ic, flag); - IEEE80211_UNLOCK(ic); } /* @@ -726,8 +714,6 @@ ieee80211_syncflag_ht_locked(struct ieee80211com *ic, int flag) struct ieee80211vap *vap; int bit; - IEEE80211_LOCK_ASSERT(ic); - bit = 0; TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) if (vap->iv_flags_ht & flag) { @@ -745,14 +731,12 @@ ieee80211_syncflag_ht(struct ieee80211vap *vap, int flag) { struct ieee80211com *ic = vap->iv_ic; - IEEE80211_LOCK(ic); if (flag < 0) { flag = -flag; vap->iv_flags_ht &= ~flag; } else vap->iv_flags_ht |= flag; ieee80211_syncflag_ht_locked(ic, flag); - IEEE80211_UNLOCK(ic); } /* @@ -766,8 +750,6 @@ ieee80211_syncflag_ext_locked(struct ieee80211com *ic, int flag) struct ieee80211vap *vap; int bit; - IEEE80211_LOCK_ASSERT(ic); - bit = 0; TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) if (vap->iv_flags_ext & flag) { @@ -785,14 +767,12 @@ ieee80211_syncflag_ext(struct ieee80211vap *vap, int flag) { struct ieee80211com *ic = vap->iv_ic; - IEEE80211_LOCK(ic); if (flag < 0) { flag = -flag; vap->iv_flags_ext &= ~flag; } else vap->iv_flags_ext |= flag; ieee80211_syncflag_ext_locked(ic, flag); - IEEE80211_UNLOCK(ic); } static __inline int diff --git a/sys/netproto/802_11/wlan/ieee80211_adhoc.c b/sys/netproto/802_11/wlan/ieee80211_adhoc.c index d3d7705280..c9764c8178 100644 --- a/sys/netproto/802_11/wlan/ieee80211_adhoc.c +++ b/sys/netproto/802_11/wlan/ieee80211_adhoc.c @@ -132,8 +132,6 @@ adhoc_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211_node *ni; enum ieee80211_state ostate; - IEEE80211_LOCK_ASSERT(vap->iv_ic); - ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", __func__, ieee80211_state_name[ostate], diff --git a/sys/netproto/802_11/wlan/ieee80211_ageq.c b/sys/netproto/802_11/wlan/ieee80211_ageq.c index 95f6057a47..c0dd34dba2 100644 --- a/sys/netproto/802_11/wlan/ieee80211_ageq.c +++ b/sys/netproto/802_11/wlan/ieee80211_ageq.c @@ -52,7 +52,6 @@ ieee80211_ageq_init(struct ieee80211_ageq *aq, int maxlen, const char *name) { memset(aq, 0, sizeof(aq)); aq->aq_maxlen = maxlen; - IEEE80211_AGEQ_INIT(aq, name); /* OS-dependent setup */ } /* @@ -63,7 +62,6 @@ void ieee80211_ageq_cleanup(struct ieee80211_ageq *aq) { KASSERT(aq->aq_len == 0, ("%d frames on ageq", aq->aq_len)); - IEEE80211_AGEQ_DESTROY(aq); /* OS-dependent cleanup */ } /* @@ -104,7 +102,6 @@ ieee80211_ageq_mfree(struct mbuf *m) int ieee80211_ageq_append(struct ieee80211_ageq *aq, struct mbuf *m, int age) { - IEEE80211_AGEQ_LOCK(aq); if (__predict_true(aq->aq_len < aq->aq_maxlen)) { if (aq->aq_tail == NULL) { aq->aq_head = m; @@ -117,14 +114,12 @@ ieee80211_ageq_append(struct ieee80211_ageq *aq, struct mbuf *m, int age) m->m_nextpkt = NULL; aq->aq_tail = m; aq->aq_len++; - IEEE80211_AGEQ_UNLOCK(aq); return 0; } else { /* * No space, drop and cleanup references. */ aq->aq_drops++; - IEEE80211_AGEQ_UNLOCK(aq); /* XXX tail drop? */ ageq_mfree(m); return ENOSPC; @@ -165,7 +160,6 @@ ieee80211_ageq_age(struct ieee80211_ageq *aq, int quanta) phead = &head; if (aq->aq_len != 0) { - IEEE80211_AGEQ_LOCK(aq); while ((m = aq->aq_head) != NULL && M_AGE_GET(m) < quanta) { if ((aq->aq_head = m->m_nextpkt) == NULL) aq->aq_tail = NULL; @@ -177,7 +171,6 @@ ieee80211_ageq_age(struct ieee80211_ageq *aq, int quanta) } if (m != NULL) M_AGE_SUB(m, quanta); - IEEE80211_AGEQ_UNLOCK(aq); } *phead = NULL; return head; @@ -195,7 +188,6 @@ ieee80211_ageq_remove(struct ieee80211_ageq *aq, struct mbuf *m, **prev, *ohead; struct mbuf *head, **phead; - IEEE80211_AGEQ_LOCK(aq); ohead = aq->aq_head; prev = &aq->aq_head; phead = &head; @@ -231,7 +223,6 @@ ieee80211_ageq_remove(struct ieee80211_ageq *aq, } if (head == ohead && aq->aq_head != NULL) /* correct age */ M_AGE_SET(aq->aq_head, M_AGE_GET(head)); - IEEE80211_AGEQ_UNLOCK(aq); *phead = NULL; return head; diff --git a/sys/netproto/802_11/wlan/ieee80211_ddb.c b/sys/netproto/802_11/wlan/ieee80211_ddb.c index bb7901da19..b0118e5005 100644 --- a/sys/netproto/802_11/wlan/ieee80211_ddb.c +++ b/sys/netproto/802_11/wlan/ieee80211_ddb.c @@ -508,7 +508,6 @@ _db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, int showp db_printf(" %s(%p)", vap->iv_ifp->if_xname, vap); db_printf("\n"); db_printf("\tifp %p(%s)", ic->ic_ifp, ic->ic_ifp->if_xname); - db_printf(" comlock %p", &ic->ic_comlock); db_printf("\n"); db_printf("\theadroom %d", ic->ic_headroom); db_printf(" phytype %d", ic->ic_phytype); @@ -674,9 +673,7 @@ _db_show_node_table(const char *tag, const struct ieee80211_node_table *nt) int i; db_printf("%s%s@%p:\n", tag, nt->nt_name, nt); - db_printf("%s nodelock %p", tag, &nt->nt_nodelock); db_printf(" inact_init %d", nt->nt_inact_init); - db_printf(" scanlock %p", &nt->nt_scanlock); db_printf(" scangen %u\n", nt->nt_scangen); db_printf("%s keyixmax %d keyixmap %p\n", tag, nt->nt_keyixmax, nt->nt_keyixmap); @@ -845,8 +842,8 @@ _db_show_ageq(const char *tag, const struct ieee80211_ageq *q) { const struct mbuf *m; - db_printf("%s lock %p len %d maxlen %d drops %d head %p tail %p\n", - tag, &q->aq_lock, q->aq_len, q->aq_maxlen, q->aq_drops, + db_printf("%s len %d maxlen %d drops %d head %p tail %p\n", + tag, q->aq_len, q->aq_maxlen, q->aq_drops, q->aq_head, q->aq_tail); for (m = q->aq_head; m != NULL; m = m->m_nextpkt) db_printf("%s %p (len %d, %b)\n", tag, m, m->m_len, diff --git a/sys/netproto/802_11/wlan/ieee80211_dfs.c b/sys/netproto/802_11/wlan/ieee80211_dfs.c index 74e795bded..00f366380f 100644 --- a/sys/netproto/802_11/wlan/ieee80211_dfs.c +++ b/sys/netproto/802_11/wlan/ieee80211_dfs.c @@ -101,8 +101,6 @@ cac_timeout(void *arg) struct ieee80211_dfs_state *dfs = &ic->ic_dfs; int i; - IEEE80211_LOCK(ic); - if (vap->iv_state != IEEE80211_S_CAC) /* NB: just in case */ return; /* @@ -142,8 +140,6 @@ cac_timeout(void *arg) IEEE80211_NOTIFY_CAC_EXPIRE); ieee80211_cac_completeswitch(vap); } - - IEEE80211_UNLOCK(ic); } /* @@ -157,8 +153,6 @@ ieee80211_dfs_cac_start(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; struct ieee80211_dfs_state *dfs = &ic->ic_dfs; - IEEE80211_LOCK_ASSERT(ic); - callout_reset(&dfs->cac_timer, CAC_TIMEOUT, cac_timeout, vap); if_printf(vap->iv_ifp, "start %d second CAC timer on channel %u (%u MHz)\n", ticks_to_secs(CAC_TIMEOUT), @@ -175,8 +169,6 @@ ieee80211_dfs_cac_stop(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; struct ieee80211_dfs_state *dfs = &ic->ic_dfs; - IEEE80211_LOCK_ASSERT(ic); - /* NB: racey but not important */ if (callout_pending(&dfs->cac_timer)) { if_printf(vap->iv_ifp, "stop CAC timer on channel %u (%u MHz)\n", @@ -208,8 +200,6 @@ dfs_timeout(void *arg) struct ieee80211_channel *c; int i, oldest, now; - IEEE80211_LOCK(ic); - now = oldest = ticks; for (i = 0; i < ic->ic_nchans; i++) { c = &ic->ic_channels[i]; @@ -239,8 +229,6 @@ dfs_timeout(void *arg) callout_reset(&dfs->nol_timer, oldest + NOL_TIMEOUT - now, dfs_timeout, ic); } - - IEEE80211_UNLOCK(ic); } static void @@ -271,8 +259,6 @@ ieee80211_dfs_notify_radar(struct ieee80211com *ic, struct ieee80211_channel *ch struct ieee80211_dfs_state *dfs = &ic->ic_dfs; int i, now; - IEEE80211_LOCK_ASSERT(ic); - /* * Mark all entries with this frequency. Notify user * space and arrange for notification when the radar diff --git a/sys/netproto/802_11/wlan/ieee80211_dragonfly.c b/sys/netproto/802_11/wlan/ieee80211_dragonfly.c index 4cc56d9be6..e232c51f0d 100644 --- a/sys/netproto/802_11/wlan/ieee80211_dragonfly.c +++ b/sys/netproto/802_11/wlan/ieee80211_dragonfly.c @@ -73,6 +73,7 @@ static struct if_clone wlan_cloner = IF_CLONE_INITIALIZER("wlan", wlan_clone_create, wlan_clone_destroy, 0, IF_MAXUNIT); +struct lwkt_serialize wlan_global_serializer = LWKT_SERIALIZE_INITIALIZER; /* * Allocate/free com structure in conjunction with ifnet; @@ -154,6 +155,72 @@ wlan_clone_destroy(struct ifnet *ifp) ic->ic_vap_delete(vap); } +/* + * These serializer functions are used by wlan and all drivers. + */ +void +wlan_serialize_enter(void) +{ + lwkt_serialize_enter(&wlan_global_serializer); +} + +void +wlan_serialize_exit(void) +{ + lwkt_serialize_exit(&wlan_global_serializer); +} + +int +wlan_serialize_sleep(void *ident, int flags, const char *wmesg, int timo) +{ + return(zsleep(ident, &wlan_global_serializer, flags, wmesg, timo)); +} + +/* + * condition-var functions which interlock the ic lock (which is now + * just wlan_global_serializer) + */ +void +wlan_cv_init(struct cv *cv, const char *desc) +{ + cv->cv_desc = desc; + cv->cv_waiters = 0; +} + +int +wlan_cv_timedwait(struct cv *cv, int ticks) +{ + int error; + + ++cv->cv_waiters; + error = wlan_serialize_sleep(cv, 0, cv->cv_desc, ticks); + return (error); +} + +void +wlan_cv_wait(struct cv *cv) +{ + ++cv->cv_waiters; + wlan_serialize_sleep(cv, 0, cv->cv_desc, 0); +} + +void +wlan_cv_signal(struct cv *cv, int broadcast) +{ + if (cv->cv_waiters) { + if (broadcast) { + cv->cv_waiters = 0; + wakeup(cv); + } else { + --cv->cv_waiters; + wakeup_one(cv); + } + } +} + +/* + * Misc + */ void ieee80211_vap_destroy(struct ieee80211vap *vap) { @@ -205,9 +272,7 @@ ieee80211_sysctl_radar(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &t, 0, req); if (error || !req->newptr) return error; - IEEE80211_LOCK(ic); ieee80211_dfs_notify_radar(ic, ic->ic_curchan); - IEEE80211_UNLOCK(ic); return 0; } @@ -324,6 +389,7 @@ ieee80211_drain_ifq(struct ifqueue *ifq) struct ieee80211_node *ni; struct mbuf *m; + wlan_assert_serialized(); for (;;) { IF_DEQUEUE(ifq, m); if (m == NULL) @@ -344,7 +410,7 @@ ieee80211_flush_ifq(struct ifqueue *ifq, struct ieee80211vap *vap) struct ieee80211_node *ni; struct mbuf *m, **mprev; - IF_LOCK(ifq); + wlan_assert_serialized(); mprev = &ifq->ifq_head; while ((m = *mprev) != NULL) { ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; @@ -362,7 +428,6 @@ ieee80211_flush_ifq(struct ifqueue *ifq, struct ieee80211vap *vap) for (; m != NULL && m->m_nextpkt != NULL; m = m->m_nextpkt) ; ifq->ifq_tail = m; - IF_UNLOCK(ifq); } /* @@ -865,7 +930,6 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp) if (ifp->if_type != IFT_IEEE80211 || ic == NULL) return; - IEEE80211_LOCK(ic); TAILQ_FOREACH_MUTABLE(vap, &ic->ic_vaps, iv_next, next) { /* * If the MAC address has changed on the parent and it was @@ -874,13 +938,12 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp) if (vap->iv_ic == ic && (vap->iv_flags_ext & IEEE80211_FEXT_UNIQMAC) == 0) { IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp)); - IEEE80211_UNLOCK(ic); + wlan_serialize_exit(); if_setlladdr(vap->iv_ifp, IF_LLADDR(ifp), - IEEE80211_ADDR_LEN); - IEEE80211_LOCK(ic); + IEEE80211_ADDR_LEN); + wlan_serialize_enter(); } } - IEEE80211_UNLOCK(ic); } /* diff --git a/sys/netproto/802_11/wlan/ieee80211_hostap.c b/sys/netproto/802_11/wlan/ieee80211_hostap.c index 7754262f04..571f8e3c53 100644 --- a/sys/netproto/802_11/wlan/ieee80211_hostap.c +++ b/sys/netproto/802_11/wlan/ieee80211_hostap.c @@ -157,8 +157,6 @@ hostap_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211com *ic = vap->iv_ic; enum ieee80211_state ostate; - IEEE80211_LOCK_ASSERT(ic); - ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", __func__, ieee80211_state_name[ostate], diff --git a/sys/netproto/802_11/wlan/ieee80211_ht.c b/sys/netproto/802_11/wlan/ieee80211_ht.c index 8903abda64..3b3c7de1c2 100644 --- a/sys/netproto/802_11/wlan/ieee80211_ht.c +++ b/sys/netproto/802_11/wlan/ieee80211_ht.c @@ -1044,8 +1044,6 @@ htinfo_notify(struct ieee80211com *ic) struct ieee80211vap *vap; int first = 1; - IEEE80211_LOCK_ASSERT(ic); - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { if (vap->iv_opmode != IEEE80211_M_HOSTAP) continue; @@ -1106,8 +1104,6 @@ ieee80211_ht_node_join(struct ieee80211_node *ni) { struct ieee80211com *ic = ni->ni_ic; - IEEE80211_LOCK_ASSERT(ic); - if (ni->ni_flags & IEEE80211_NODE_HT) { ic->ic_ht_sta_assoc++; if (ni->ni_chw == 40) @@ -1124,8 +1120,6 @@ ieee80211_ht_node_leave(struct ieee80211_node *ni) { struct ieee80211com *ic = ni->ni_ic; - IEEE80211_LOCK_ASSERT(ic); - if (ni->ni_flags & IEEE80211_NODE_HT) { ic->ic_ht_sta_assoc--; if (ni->ni_chw == 40) @@ -1150,8 +1144,6 @@ void ieee80211_htprot_update(struct ieee80211com *ic, int protmode) { #define OPMODE(x) SM(x, IEEE80211_HTINFO_OPMODE) - IEEE80211_LOCK(ic); - /* track non-HT station presence */ KASSERT(protmode & IEEE80211_HTINFO_NONHT_PRESENT, ("protmode 0x%x", protmode)); @@ -1165,7 +1157,6 @@ ieee80211_htprot_update(struct ieee80211com *ic, int protmode) ic->ic_curhtprotmode = protmode; htinfo_notify(ic); } - IEEE80211_UNLOCK(ic); #undef OPMODE } @@ -1180,8 +1171,6 @@ ieee80211_htprot_update(struct ieee80211com *ic, int protmode) void ieee80211_ht_timeout(struct ieee80211com *ic) { - IEEE80211_LOCK_ASSERT(ic); - if ((ic->ic_flags_ht & IEEE80211_FHT_NONHT_PR) && time_after(ticks, ic->ic_lastnonht + IEEE80211_NONHT_PRESENT_AGE)) { #if 0 diff --git a/sys/netproto/802_11/wlan/ieee80211_input.c b/sys/netproto/802_11/wlan/ieee80211_input.c index 1043159a75..03b33b2506 100644 --- a/sys/netproto/802_11/wlan/ieee80211_input.c +++ b/sys/netproto/802_11/wlan/ieee80211_input.c @@ -145,10 +145,8 @@ ieee80211_defrag(struct ieee80211_node *ni, struct mbuf *m, int hdrspace) m_freem(m); return NULL; } - IEEE80211_NODE_LOCK(ni->ni_table); mfrag = ni->ni_rxfrag[0]; ni->ni_rxfrag[0] = NULL; - IEEE80211_NODE_UNLOCK(ni->ni_table); /* * Validate new fragment is in order and diff --git a/sys/netproto/802_11/wlan/ieee80211_ioctl.c b/sys/netproto/802_11/wlan/ieee80211_ioctl.c index c5244a7496..365749b1cc 100644 --- a/sys/netproto/802_11/wlan/ieee80211_ioctl.c +++ b/sys/netproto/802_11/wlan/ieee80211_ioctl.c @@ -1324,14 +1324,12 @@ setmlme_dropsta(struct ieee80211vap *vap, /* NB: the broadcast address means do 'em all */ if (!IEEE80211_ADDR_EQ(mac, ic->ic_ifp->if_broadcastaddr)) { - IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_node_locked(nt, mac); if (ni != NULL) { domlme(mlmeop, ni); ieee80211_free_node(ni); } else error = ENOENT; - IEEE80211_NODE_UNLOCK(nt); } else { ieee80211_iterate_nodes(nt, domlme, mlmeop); } @@ -1395,7 +1393,6 @@ setmlme_common(struct ieee80211vap *vap, int op, error = EINVAL; break; } - IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_vap_node_locked(nt, vap, mac); if (ni != NULL) { mlmedebug(vap, mac, op, reason); @@ -1406,14 +1403,12 @@ setmlme_common(struct ieee80211vap *vap, int op, ieee80211_free_node(ni); } else error = ENOENT; - IEEE80211_NODE_UNLOCK(nt); break; case IEEE80211_MLME_AUTH: if (vap->iv_opmode != IEEE80211_M_HOSTAP) { error = EINVAL; break; } - IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_vap_node_locked(nt, vap, mac); if (ni != NULL) { mlmedebug(vap, mac, op, reason); @@ -1438,7 +1433,6 @@ setmlme_common(struct ieee80211vap *vap, int op, ieee80211_free_node(ni); } else error = ENOENT; - IEEE80211_NODE_UNLOCK(nt); break; default: error = EINVAL; @@ -2218,8 +2212,6 @@ ieee80211_ioctl_setappie_locked(struct ieee80211vap *vap, { int error; - IEEE80211_LOCK_ASSERT(vap->iv_ic); - switch (fc0 & IEEE80211_FC0_SUBTYPE_MASK) { case IEEE80211_FC0_SUBTYPE_BEACON: if (vap->iv_opmode != IEEE80211_M_HOSTAP && @@ -2303,9 +2295,7 @@ ieee80211_ioctl_setappie(struct ieee80211vap *vap, if ((fc0 & IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_MGT) return EINVAL; /* NB: could check iv_opmode and reject but hardly worth the effort */ - IEEE80211_LOCK(ic); error = ieee80211_ioctl_setappie_locked(vap, ireq, fc0); - IEEE80211_UNLOCK(ic); return error; } @@ -2330,14 +2320,12 @@ ieee80211_ioctl_chanswitch(struct ieee80211vap *vap, struct ieee80211req *ireq) csr.csa_chan.ic_freq, csr.csa_chan.ic_flags); if (c == NULL) return ENOENT; - IEEE80211_LOCK(ic); if ((ic->ic_flags & IEEE80211_F_CSAPENDING) == 0) ieee80211_csa_startswitch(ic, c, csr.csa_mode, csr.csa_count); else if (csr.csa_count == 0) ieee80211_csa_cancelswitch(ic); else error = EBUSY; - IEEE80211_UNLOCK(ic); return error; } @@ -2418,7 +2406,6 @@ ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq) * * Otherwise just invoke the scan machinery directly. */ - IEEE80211_LOCK(ic); if (vap->iv_state == IEEE80211_S_INIT) { /* NB: clobbers previous settings */ vap->iv_scanreq_flags = sr.sr_flags; @@ -2430,11 +2417,9 @@ ieee80211_ioctl_scanreq(struct ieee80211vap *vap, struct ieee80211req *ireq) sr.sr_ssid[i].len); } vap->iv_flags_ext |= IEEE80211_FEXT_SCANREQ; - IEEE80211_UNLOCK(ic); ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); } else { vap->iv_flags_ext &= ~IEEE80211_FEXT_SCANREQ; - IEEE80211_UNLOCK(ic); /* XXX neeed error return codes */ if (sr.sr_flags & IEEE80211_IOC_SCAN_CHECK) { (void) ieee80211_check_scan(vap, sr.sr_flags, @@ -3207,7 +3192,6 @@ ieee80211_ioctl_updatemulti(struct ieee80211com *ic) struct ieee80211vap *vap; void *ioctl; - IEEE80211_LOCK(ic); if_delallmulti(parent); ioctl = parent->if_ioctl; /* XXX WAR if_allmulti */ parent->if_ioctl = NULL; @@ -3223,7 +3207,6 @@ ieee80211_ioctl_updatemulti(struct ieee80211com *ic) } parent->if_ioctl = ioctl; ieee80211_runtask(ic, &ic->ic_mcast_task); - IEEE80211_UNLOCK(ic); } int @@ -3237,7 +3220,6 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *ucred switch (cmd) { case SIOCSIFFLAGS: - IEEE80211_LOCK(ic); ieee80211_syncifflag_locked(ic, IFF_PROMISC); ieee80211_syncifflag_locked(ic, IFF_ALLMULTI); if (ifp->if_flags & IFF_UP) { @@ -3256,7 +3238,6 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data, struct ucred *ucred */ ieee80211_stop_locked(vap); } - IEEE80211_UNLOCK(ic); /* Wait for parent ioctl handler if it was queued */ ieee80211_waitfor_parent(ic); break; diff --git a/sys/netproto/802_11/wlan/ieee80211_mesh.c b/sys/netproto/802_11/wlan/ieee80211_mesh.c index 8652950037..b967c8a28e 100644 --- a/sys/netproto/802_11/wlan/ieee80211_mesh.c +++ b/sys/netproto/802_11/wlan/ieee80211_mesh.c @@ -139,11 +139,6 @@ static const struct ieee80211_mesh_proto_metric mesh_metric_airtime = { static struct ieee80211_mesh_proto_path mesh_proto_paths[4]; static struct ieee80211_mesh_proto_metric mesh_proto_metrics[4]; -#define MESH_RT_LOCK(ms) lockmgr(&(ms)->ms_rt_lock, LK_EXCLUSIVE) -#define MESH_RT_LOCK_ASSERT(ms) \ - KKASSERT(lockstatus(&(ms)->ms_rt_lock, curthread) != 0) -#define MESH_RT_UNLOCK(ms) lockmgr(&(ms)->ms_rt_lock, LK_RELEASE) - MALLOC_DEFINE(M_80211_MESH_RT, "80211mesh", "802.11s routing table"); /* @@ -156,8 +151,6 @@ mesh_rt_find_locked(struct ieee80211_mesh_state *ms, { struct ieee80211_mesh_route *rt; - MESH_RT_LOCK_ASSERT(ms); - TAILQ_FOREACH(rt, &ms->ms_routes, rt_next) { if (IEEE80211_ADDR_EQ(dest, rt->rt_dest)) return rt; @@ -174,8 +167,6 @@ mesh_rt_add_locked(struct ieee80211_mesh_state *ms, KASSERT(!IEEE80211_ADDR_EQ(broadcastaddr, dest), ("%s: adding broadcast to the routing table", __func__)); - MESH_RT_LOCK_ASSERT(ms); - rt = kmalloc(ALIGN(sizeof(struct ieee80211_mesh_route)) + ms->ms_ppath->mpp_privlen, M_80211_MESH_RT, M_INTWAIT | M_ZERO); if (rt != NULL) { @@ -194,9 +185,7 @@ ieee80211_mesh_rt_find(struct ieee80211vap *vap, struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt; - MESH_RT_LOCK(ms); rt = mesh_rt_find_locked(ms, dest); - MESH_RT_UNLOCK(ms); return rt; } @@ -212,9 +201,7 @@ ieee80211_mesh_rt_add(struct ieee80211vap *vap, KASSERT(!IEEE80211_ADDR_EQ(vap->iv_myaddr, dest), ("%s: adding self to the routing table", __func__)); - MESH_RT_LOCK(ms); rt = mesh_rt_add_locked(ms, dest); - MESH_RT_UNLOCK(ms); return rt; } @@ -228,7 +215,6 @@ ieee80211_mesh_proxy_check(struct ieee80211vap *vap, struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt; - MESH_RT_LOCK(ms); rt = mesh_rt_find_locked(ms, dest); if (rt == NULL) { rt = mesh_rt_add_locked(ms, dest); @@ -262,7 +248,6 @@ ieee80211_mesh_proxy_check(struct ieee80211vap *vap, (void *)(uintptr_t) ieee80211_mac_hash(ic, dest)); /* XXX stat? */ } - MESH_RT_UNLOCK(ms); } static __inline void @@ -279,15 +264,12 @@ ieee80211_mesh_rt_del(struct ieee80211vap *vap, struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt, *next; - MESH_RT_LOCK(ms); TAILQ_FOREACH_MUTABLE(rt, &ms->ms_routes, rt_next, next) { if (IEEE80211_ADDR_EQ(rt->rt_dest, dest)) { mesh_rt_del(ms, rt); - MESH_RT_UNLOCK(ms); return; } } - MESH_RT_UNLOCK(ms); } void @@ -298,10 +280,8 @@ ieee80211_mesh_rt_flush(struct ieee80211vap *vap) if (ms == NULL) return; - MESH_RT_LOCK(ms); TAILQ_FOREACH_MUTABLE(rt, &ms->ms_routes, rt_next, next) mesh_rt_del(ms, rt); - MESH_RT_UNLOCK(ms); } void @@ -311,12 +291,10 @@ ieee80211_mesh_rt_flush_peer(struct ieee80211vap *vap, struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt, *next; - MESH_RT_LOCK(ms); TAILQ_FOREACH_MUTABLE(rt, &ms->ms_routes, rt_next, next) { if (IEEE80211_ADDR_EQ(rt->rt_nexthop, peer)) mesh_rt_del(ms, rt); } - MESH_RT_UNLOCK(ms); } /* @@ -331,13 +309,11 @@ mesh_rt_flush_invalid(struct ieee80211vap *vap) if (ms == NULL) return; - MESH_RT_LOCK(ms); TAILQ_FOREACH_MUTABLE(rt, &ms->ms_routes, rt_next, next) { if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 && ticks - rt->rt_crtime >= ms->ms_ppath->mpp_inact) mesh_rt_del(ms, rt); } - MESH_RT_UNLOCK(ms); } #define N(a) (sizeof(a) / sizeof(a[0])) @@ -507,7 +483,6 @@ mesh_vdetach(struct ieee80211vap *vap) ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, mesh_vdetach_peers, NULL); ieee80211_mesh_rt_flush(vap); - lockuninit(&ms->ms_rt_lock); ms->ms_ppath->mpp_vdetach(vap); kfree(vap->iv_mesh, M_80211_VAP); vap->iv_mesh = NULL; @@ -532,7 +507,6 @@ mesh_vattach(struct ieee80211vap *vap) ms->ms_flags = (IEEE80211_MESHFLAGS_AP | IEEE80211_MESHFLAGS_FWD); ms->ms_ttl = IEEE80211_MESH_DEFAULT_TTL; TAILQ_INIT(&ms->ms_routes); - lockinit(&ms->ms_rt_lock, "MBSS", 0, 0); callout_init_mp(&ms->ms_cleantimer); mesh_select_proto_metric(vap, "AIRTIME"); KASSERT(ms->ms_pmetric, ("ms_pmetric == NULL")); @@ -552,8 +526,6 @@ mesh_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211_node *ni; enum ieee80211_state ostate; - IEEE80211_LOCK_ASSERT(ic); - ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", __func__, ieee80211_state_name[ostate], @@ -2603,11 +2575,9 @@ mesh_ioctl_get80211(struct ieee80211vap *vap, struct ieee80211req *ireq) switch (ireq->i_val) { case IEEE80211_MESH_RTCMD_LIST: len = 0; - MESH_RT_LOCK(ms); TAILQ_FOREACH(rt, &ms->ms_routes, rt_next) { len += sizeof(*imr); } - MESH_RT_UNLOCK(ms); if (len > ireq->i_len || ireq->i_len < sizeof(*imr)) { ireq->i_len = len; return ENOMEM; @@ -2618,7 +2588,6 @@ mesh_ioctl_get80211(struct ieee80211vap *vap, struct ieee80211req *ireq) if (p == NULL) return ENOMEM; off = 0; - MESH_RT_LOCK(ms); TAILQ_FOREACH(rt, &ms->ms_routes, rt_next) { if (off >= len) break; @@ -2635,7 +2604,6 @@ mesh_ioctl_get80211(struct ieee80211vap *vap, struct ieee80211req *ireq) imr->imr_lastmseq = rt->rt_lastmseq; off += sizeof(*imr); } - MESH_RT_UNLOCK(ms); error = copyout(p, (uint8_t *)ireq->i_data, ireq->i_len); kfree(p, M_TEMP); diff --git a/sys/netproto/802_11/wlan/ieee80211_monitor.c b/sys/netproto/802_11/wlan/ieee80211_monitor.c index ca321ea977..7486f1b49a 100644 --- a/sys/netproto/802_11/wlan/ieee80211_monitor.c +++ b/sys/netproto/802_11/wlan/ieee80211_monitor.c @@ -94,8 +94,6 @@ monitor_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211com *ic = vap->iv_ic; enum ieee80211_state ostate; - IEEE80211_LOCK_ASSERT(ic); - ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", __func__, ieee80211_state_name[ostate], diff --git a/sys/netproto/802_11/wlan/ieee80211_node.c b/sys/netproto/802_11/wlan/ieee80211_node.c index 93398bbdac..f342c68e7e 100644 --- a/sys/netproto/802_11/wlan/ieee80211_node.c +++ b/sys/netproto/802_11/wlan/ieee80211_node.c @@ -648,10 +648,8 @@ ieee80211_sync_curchan(struct ieee80211com *ic) ic->ic_curchan = c; ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan); ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); - IEEE80211_UNLOCK(ic); ic->ic_set_channel(ic); ieee80211_radiotap_chan_change(ic); - IEEE80211_LOCK(ic); } } @@ -1049,8 +1047,6 @@ node_age(struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; - IEEE80211_NODE_LOCK_ASSERT(&vap->iv_ic->ic_sta); - /* * Age frames on the power save queue. */ @@ -1126,13 +1122,11 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt, if (vap->iv_opmode == IEEE80211_M_MBSS) ieee80211_mesh_node_init(vap, ni); #endif - IEEE80211_NODE_LOCK(nt); TAILQ_INSERT_TAIL(&nt->nt_node, ni, ni_list); LIST_INSERT_HEAD(&nt->nt_hash[hash], ni, ni_hash); ni->ni_table = nt; ni->ni_vap = vap; ni->ni_ic = ic; - IEEE80211_NODE_UNLOCK(nt); IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, "%s: inact_reload %u", __func__, ni->ni_inact_reload); @@ -1275,8 +1269,6 @@ ieee80211_find_node_locked(struct ieee80211_node_table *nt, struct ieee80211_node *ni; int hash; - IEEE80211_NODE_LOCK_ASSERT(nt); - hash = IEEE80211_NODE_HASH(nt->nt_ic, macaddr); LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) { if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) { @@ -1305,9 +1297,7 @@ ieee80211_find_node(struct ieee80211_node_table *nt, { struct ieee80211_node *ni; - IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_node_locked(nt, macaddr); - IEEE80211_NODE_UNLOCK(nt); return ni; } @@ -1325,8 +1315,6 @@ ieee80211_find_vap_node_locked(struct ieee80211_node_table *nt, struct ieee80211_node *ni; int hash; - IEEE80211_NODE_LOCK_ASSERT(nt); - hash = IEEE80211_NODE_HASH(nt->nt_ic, macaddr); LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) { if (ni->ni_vap == vap && @@ -1358,9 +1346,7 @@ ieee80211_find_vap_node(struct ieee80211_node_table *nt, { struct ieee80211_node *ni; - IEEE80211_NODE_LOCK(nt); ni = ieee80211_find_vap_node_locked(nt, vap, macaddr); - IEEE80211_NODE_UNLOCK(nt); return ni; } @@ -1513,9 +1499,7 @@ ieee80211_find_rxnode(struct ieee80211com *ic, struct ieee80211_node *ni; nt = &ic->ic_sta; - IEEE80211_NODE_LOCK(nt); ni = _find_rxnode(nt, wh); - IEEE80211_NODE_UNLOCK(nt); return ni; } @@ -1542,7 +1526,6 @@ ieee80211_find_rxnode_withkey(struct ieee80211com *ic, struct ieee80211_node *ni; nt = &ic->ic_sta; - IEEE80211_NODE_LOCK(nt); if (nt->nt_keyixmap != NULL && keyix < nt->nt_keyixmax) ni = nt->nt_keyixmap[keyix]; else @@ -1572,8 +1555,6 @@ ieee80211_find_rxnode_withkey(struct ieee80211com *ic, else ieee80211_ref_node(ni); } - IEEE80211_NODE_UNLOCK(nt); - return ni; } #undef IS_BCAST_PROBEREQ @@ -1603,14 +1584,12 @@ ieee80211_find_txnode(struct ieee80211vap *vap, * to the bss node. */ /* XXX can't hold lock across dup_bss 'cuz of recursive locking */ - IEEE80211_NODE_LOCK(nt); if (vap->iv_opmode == IEEE80211_M_STA || vap->iv_opmode == IEEE80211_M_WDS || IEEE80211_IS_MULTICAST(macaddr)) ni = ieee80211_ref_node(vap->iv_bss); else ni = ieee80211_find_node_locked(nt, macaddr); - IEEE80211_NODE_UNLOCK(nt); if (ni == NULL) { if (vap->iv_opmode == IEEE80211_M_IBSS || @@ -1677,7 +1656,6 @@ ieee80211_free_node(struct ieee80211_node *ni) ni->ni_macaddr, ":", ieee80211_node_refcnt(ni)-1); #endif if (nt != NULL) { - IEEE80211_NODE_LOCK(nt); if (ieee80211_node_dectestref(ni)) { /* * Last reference, reclaim state. @@ -1701,7 +1679,6 @@ ieee80211_free_node(struct ieee80211_node *ni) _ieee80211_free_node(ni); } } - IEEE80211_NODE_UNLOCK(nt); } else { if (ieee80211_node_dectestref(ni)) _ieee80211_free_node(ni); @@ -1718,7 +1695,7 @@ ieee80211_node_delucastkey(struct ieee80211_node *ni) struct ieee80211_node_table *nt = &ic->ic_sta; struct ieee80211_node *nikey; ieee80211_keyix keyix; - int isowned, status; + int status; /* * NB: We must beware of LOR here; deleting the key @@ -1732,9 +1709,6 @@ ieee80211_node_delucastkey(struct ieee80211_node *ni) * way to separate out this path so we must do this * conditionally. */ - isowned = IEEE80211_NODE_IS_LOCKED(nt); - if (!isowned) - IEEE80211_NODE_LOCK(nt); nikey = NULL; status = 1; /* NB: success */ if (ni->ni_ucastkey.wk_keyix != IEEE80211_KEYIX_NONE) { @@ -1745,8 +1719,6 @@ ieee80211_node_delucastkey(struct ieee80211_node *ni) nt->nt_keyixmap[keyix] = NULL; } } - if (!isowned) - IEEE80211_NODE_UNLOCK(nt); if (nikey != NULL) { KASSERT(nikey == ni, @@ -1770,8 +1742,6 @@ node_reclaim(struct ieee80211_node_table *nt, struct ieee80211_node *ni) { ieee80211_keyix keyix; - IEEE80211_NODE_LOCK_ASSERT(nt); - IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, "%s: remove %p<%6D> from %s table, refcnt %d\n", __func__, ni, ni->ni_macaddr, ":", @@ -1815,11 +1785,7 @@ ieee80211_node_table_init(struct ieee80211com *ic, struct ieee80211_node_table *nt, const char *name, int inact, int keyixmax) { - struct ifnet *ifp = ic->ic_ifp; - nt->nt_ic = ic; - IEEE80211_NODE_LOCK_INIT(nt, ifp->if_xname); - IEEE80211_NODE_ITERATE_LOCK_INIT(nt, ifp->if_xname); TAILQ_INIT(&nt->nt_node); nt->nt_name = name; nt->nt_scangen = 1; @@ -1843,7 +1809,6 @@ ieee80211_node_table_reset(struct ieee80211_node_table *nt, { struct ieee80211_node *ni, *next; - IEEE80211_NODE_LOCK(nt); TAILQ_FOREACH_MUTABLE(ni, &nt->nt_node, ni_list, next) { if (match != NULL && ni->ni_vap != match) continue; @@ -1871,7 +1836,6 @@ ieee80211_node_table_reset(struct ieee80211_node_table *nt, if (ni->ni_wdsvap == match) ni->ni_wdsvap = NULL; } - IEEE80211_NODE_UNLOCK(nt); } static void @@ -1890,8 +1854,6 @@ ieee80211_node_table_cleanup(struct ieee80211_node_table *nt) kfree(nt->nt_keyixmap, M_80211_NODE); nt->nt_keyixmap = NULL; } - IEEE80211_NODE_ITERATE_LOCK_DESTROY(nt); - IEEE80211_NODE_LOCK_DESTROY(nt); } /* @@ -1912,10 +1874,8 @@ ieee80211_timeout_stations(struct ieee80211com *ic) struct ieee80211_node *ni; int gen = 0; - IEEE80211_NODE_ITERATE_LOCK(nt); gen = ++nt->nt_scangen; restart: - IEEE80211_NODE_LOCK(nt); TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { if (ni->ni_scangen == gen) /* previously handled */ continue; @@ -2000,7 +1960,6 @@ restart: * ref for us as needed. */ ieee80211_ref_node(ni); - IEEE80211_NODE_UNLOCK(nt); ieee80211_send_nulldata(ni); /* XXX stat? */ goto restart; @@ -2028,7 +1987,6 @@ restart: * in a LOR between the node lock and the driver lock. */ ieee80211_ref_node(ni); - IEEE80211_NODE_UNLOCK(nt); if (ni->ni_associd != 0) { IEEE80211_SEND_MGMT(ni, IEEE80211_FC0_SUBTYPE_DEAUTH, @@ -2040,9 +1998,6 @@ restart: goto restart; } } - IEEE80211_NODE_UNLOCK(nt); - - IEEE80211_NODE_ITERATE_UNLOCK(nt); } /* @@ -2056,7 +2011,6 @@ ieee80211_drain(struct ieee80211com *ic) struct ieee80211vap *vap; struct ieee80211_node *ni; - IEEE80211_NODE_LOCK(nt); TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { /* * Ignore entries for which have yet to receive an @@ -2092,7 +2046,6 @@ ieee80211_drain(struct ieee80211com *ic) */ ic->ic_node_drain(ni); } - IEEE80211_NODE_UNLOCK(nt); } /* @@ -2117,10 +2070,8 @@ ieee80211_node_timeout(void *arg) ieee80211_timeout_stations(ic); ieee80211_ageq_age(&ic->ic_stageq, IEEE80211_INACT_WAIT); - IEEE80211_LOCK(ic); ieee80211_erp_timeout(ic); ieee80211_ht_timeout(ic); - IEEE80211_UNLOCK(ic); } callout_reset(&ic->ic_inact, IEEE80211_INACT_WAIT*hz, ieee80211_node_timeout, ic); @@ -2133,23 +2084,17 @@ ieee80211_iterate_nodes(struct ieee80211_node_table *nt, struct ieee80211_node *ni; u_int gen; - IEEE80211_NODE_ITERATE_LOCK(nt); gen = ++nt->nt_scangen; restart: - IEEE80211_NODE_LOCK(nt); TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { if (ni->ni_scangen != gen) { ni->ni_scangen = gen; (void) ieee80211_ref_node(ni); - IEEE80211_NODE_UNLOCK(nt); (*f)(arg, ni); ieee80211_free_node(ni); goto restart; } } - IEEE80211_NODE_UNLOCK(nt); - - IEEE80211_NODE_ITERATE_UNLOCK(nt); } void @@ -2194,8 +2139,6 @@ ieee80211_notify_erp_locked(struct ieee80211com *ic) { struct ieee80211vap *vap; - IEEE80211_LOCK_ASSERT(ic); - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) if (vap->iv_opmode == IEEE80211_M_HOSTAP) ieee80211_beacon_notify(vap, IEEE80211_BEACON_ERP); @@ -2204,9 +2147,7 @@ ieee80211_notify_erp_locked(struct ieee80211com *ic) void ieee80211_notify_erp(struct ieee80211com *ic) { - IEEE80211_LOCK(ic); ieee80211_notify_erp_locked(ic); - IEEE80211_UNLOCK(ic); } /* @@ -2217,8 +2158,6 @@ ieee80211_node_join_11g(struct ieee80211_node *ni) { struct ieee80211com *ic = ni->ni_ic; - IEEE80211_LOCK_ASSERT(ic); - /* * Station isn't capable of short slot time. Bump * the count of long slot time stations and disable @@ -2303,7 +2242,6 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp) } ni->ni_associd = aid | 0xc000; ni->ni_jointime = time_second; - IEEE80211_LOCK(ic); IEEE80211_AID_SET(vap, ni->ni_associd); vap->iv_sta_assoc++; ic->ic_sta_assoc++; @@ -2313,7 +2251,6 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp) if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && IEEE80211_IS_CHAN_FULL(ic->ic_bsschan)) ieee80211_node_join_11g(ni); - IEEE80211_UNLOCK(ic); newassoc = 1; } else @@ -2375,8 +2312,6 @@ ieee80211_node_leave_11g(struct ieee80211_node *ni) { struct ieee80211com *ic = ni->ni_ic; - IEEE80211_LOCK_ASSERT(ic); - KASSERT(IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan), ("not in 11g, bss %u:0x%x", ic->ic_bsschan->ic_freq, ic->ic_bsschan->ic_flags)); @@ -2437,9 +2372,6 @@ ieee80211_node_leave_11g(struct ieee80211_node *ni) static void ieee80211_erp_timeout(struct ieee80211com *ic) { - - IEEE80211_LOCK_ASSERT(ic); - if ((ic->ic_flags_ext & IEEE80211_FEXT_NONERP_PR) && time_after(ticks, ic->ic_lastnonerp + IEEE80211_NONERP_PRESENT_AGE)) { #if 0 @@ -2484,7 +2416,6 @@ ieee80211_node_leave(struct ieee80211_node *ni) if (vap->iv_auth->ia_node_leave != NULL) vap->iv_auth->ia_node_leave(ni); - IEEE80211_LOCK(ic); IEEE80211_AID_CLR(vap, ni->ni_associd); ni->ni_associd = 0; vap->iv_sta_assoc--; @@ -2495,7 +2426,6 @@ ieee80211_node_leave(struct ieee80211_node *ni) if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && IEEE80211_IS_CHAN_FULL(ic->ic_bsschan)) ieee80211_node_leave_11g(ni); - IEEE80211_UNLOCK(ic); /* * Cleanup station state. In particular clear various * state that might otherwise be reused if the node @@ -2511,9 +2441,7 @@ done: * for inactivity. */ if (nt != NULL) { - IEEE80211_NODE_LOCK(nt); node_reclaim(nt, ni); - IEEE80211_NODE_UNLOCK(nt); } else ieee80211_free_node(ni); } diff --git a/sys/netproto/802_11/wlan/ieee80211_output.c b/sys/netproto/802_11/wlan/ieee80211_output.c index c51ac33ebb..c17c5e6486 100644 --- a/sys/netproto/802_11/wlan/ieee80211_output.c +++ b/sys/netproto/802_11/wlan/ieee80211_output.c @@ -148,7 +148,6 @@ ieee80211_start(struct ifnet *ifp) * for CSA). */ if (vap->iv_state != IEEE80211_S_RUN) { - IEEE80211_LOCK(ic); /* re-check under the com lock to avoid races */ if (vap->iv_state != IEEE80211_S_RUN) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, @@ -156,10 +155,8 @@ ieee80211_start(struct ifnet *ifp) __func__, ieee80211_state_name[vap->iv_state]); vap->iv_stats.is_tx_badstate++; ifp->if_flags |= IFF_OACTIVE; - IEEE80211_UNLOCK(ic); return; } - IEEE80211_UNLOCK(ic); } for (;;) { m = ifq_dequeue(&ifp->if_snd, NULL); @@ -2789,7 +2786,6 @@ ieee80211_beacon_update(struct ieee80211_node *ni, int len_changed = 0; uint16_t capinfo; - IEEE80211_LOCK(ic); /* * Handle 11h channel change when we've reached the count. * We must recalculate the beacon frame contents to account @@ -2815,7 +2811,6 @@ ieee80211_beacon_update(struct ieee80211_node *ni, mtod(m, uint8_t*) + sizeof(struct ieee80211_frame), bo, ni); /* XXX do WME aggressive mode processing? */ - IEEE80211_UNLOCK(ic); return 1; /* just assume length changed */ } @@ -3042,7 +3037,6 @@ ieee80211_beacon_update(struct ieee80211_node *ni, frm = add_appie(frm, aie); clrbit(bo->bo_flags, IEEE80211_BEACON_APPIE); } - IEEE80211_UNLOCK(ic); return len_changed; } diff --git a/sys/netproto/802_11/wlan/ieee80211_power.c b/sys/netproto/802_11/wlan/ieee80211_power.c index a3b31e7e94..d465ae3599 100644 --- a/sys/netproto/802_11/wlan/ieee80211_power.c +++ b/sys/netproto/802_11/wlan/ieee80211_power.c @@ -105,7 +105,6 @@ ieee80211_psq_init(struct ieee80211_psq *psq, const char *name) { memset(psq, 0, sizeof(psq)); psq->psq_maxlen = IEEE80211_PS_MAX_QUEUE; - IEEE80211_PSQ_INIT(psq, name); /* OS-dependent setup */ } void @@ -116,7 +115,6 @@ ieee80211_psq_cleanup(struct ieee80211_psq *psq) #else KASSERT(psq->psq_len == 0, ("%d frames on ps q", psq->psq_len)); #endif - IEEE80211_PSQ_DESTROY(psq); /* OS-dependent cleanup */ } /* @@ -129,7 +127,6 @@ ieee80211_node_psq_dequeue(struct ieee80211_node *ni, int *qlen) struct ieee80211_psq_head *qhead; struct mbuf *m; - IEEE80211_PSQ_LOCK(psq); qhead = &psq->psq_head[0]; again: if ((m = qhead->head) != NULL) { @@ -148,7 +145,6 @@ again: } if (qlen != NULL) *qlen = psq->psq_len; - IEEE80211_PSQ_UNLOCK(psq); return m; } @@ -178,7 +174,6 @@ psq_drain(struct ieee80211_psq *psq) struct mbuf *m; int qlen; - IEEE80211_PSQ_LOCK(psq); qlen = psq->psq_len; qhead = &psq->psq_head[0]; again: @@ -193,7 +188,6 @@ again: goto again; } psq->psq_len = 0; - IEEE80211_PSQ_UNLOCK(psq); return qlen; } @@ -231,7 +225,6 @@ ieee80211_node_psq_age(struct ieee80211_node *ni) struct ieee80211_psq_head *qhead; struct mbuf *m; - IEEE80211_PSQ_LOCK(psq); qhead = &psq->psq_head[0]; again: while ((m = qhead->head) != NULL && @@ -253,7 +246,6 @@ ieee80211_node_psq_age(struct ieee80211_node *ni) } if (m != NULL) M_AGE_SUB(m, IEEE80211_INACT_WAIT); - IEEE80211_PSQ_UNLOCK(psq); IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, "discard %u frames for age", discard); @@ -294,7 +286,6 @@ ieee80211_set_tim(struct ieee80211_node *ni, int set) KASSERT(aid < vap->iv_max_aid, ("bogus aid %u, max %u", aid, vap->iv_max_aid)); - IEEE80211_LOCK(ic); changed = (set != (isset(vap->iv_tim_bitmap, aid) != 0)); if (changed) { if (set) { @@ -307,7 +298,6 @@ ieee80211_set_tim(struct ieee80211_node *ni, int set) /* NB: we know vap is in RUN state so no need to check */ vap->iv_update_beacon(vap, IEEE80211_BEACON_TIM); } - IEEE80211_UNLOCK(ic); return changed; } @@ -326,10 +316,8 @@ ieee80211_pwrsave(struct ieee80211_node *ni, struct mbuf *m) struct ieee80211_psq_head *qhead; int qlen, age; - IEEE80211_PSQ_LOCK(psq); if (psq->psq_len >= psq->psq_maxlen) { psq->psq_drops++; - IEEE80211_PSQ_UNLOCK(psq); IEEE80211_NOTE(vap, IEEE80211_MSG_ANY, ni, "pwr save q overflow, drops %d (size %d)", psq->psq_drops, psq->psq_len); @@ -392,7 +380,6 @@ ieee80211_pwrsave(struct ieee80211_node *ni, struct mbuf *m) qhead->tail = m; qhead->len++; qlen = ++(psq->psq_len); - IEEE80211_PSQ_UNLOCK(psq); IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, "save frame with age %d, %u now queued", age, qlen); @@ -420,7 +407,6 @@ pwrsave_flushq(struct ieee80211_node *ni) IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, "flush ps queue, %u packets queued", psq->psq_len); - IEEE80211_PSQ_LOCK(psq); qhead = &psq->psq_head[0]; /* 802.11 frames */ if (qhead->head != NULL) { /* XXX could dispatch through vap and check M_ENCAP */ @@ -446,7 +432,6 @@ pwrsave_flushq(struct ieee80211_node *ni) } else ifp = NULL; psq->psq_len = 0; - IEEE80211_PSQ_UNLOCK(psq); /* NB: do this outside the psq lock */ /* XXX packets might get reordered if parent is OACTIVE */ diff --git a/sys/netproto/802_11/wlan/ieee80211_proto.c b/sys/netproto/802_11/wlan/ieee80211_proto.c index 6e8d0f3948..b5f8398074 100644 --- a/sys/netproto/802_11/wlan/ieee80211_proto.c +++ b/sys/netproto/802_11/wlan/ieee80211_proto.c @@ -872,8 +872,6 @@ ieee80211_wme_initparams_locked(struct ieee80211vap *vap) enum ieee80211_phymode mode; int i; - IEEE80211_LOCK_ASSERT(ic); - if ((ic->ic_caps & IEEE80211_C_WME) == 0 || ic->ic_nrunning > 1) return; @@ -937,9 +935,7 @@ ieee80211_wme_initparams(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; ic = vap->iv_ic; - IEEE80211_LOCK(ic); ieee80211_wme_initparams_locked(vap); - IEEE80211_UNLOCK(ic); } /* @@ -1080,9 +1076,7 @@ ieee80211_wme_updateparams(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; if (ic->ic_caps & IEEE80211_C_WME) { - IEEE80211_LOCK(ic); ieee80211_wme_updateparams_locked(vap); - IEEE80211_UNLOCK(ic); } } @@ -1150,8 +1144,6 @@ ieee80211_start_locked(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; struct ifnet *parent = ic->ic_ifp; - IEEE80211_LOCK_ASSERT(ic); - IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, "start running, %d vaps running\n", ic->ic_nrunning); @@ -1234,9 +1226,7 @@ ieee80211_init(void *arg) IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, "%s\n", __func__); - IEEE80211_LOCK(vap->iv_ic); ieee80211_start_locked(vap); - IEEE80211_UNLOCK(vap->iv_ic); } /* @@ -1247,13 +1237,11 @@ ieee80211_start_all(struct ieee80211com *ic) { struct ieee80211vap *vap; - IEEE80211_LOCK(ic); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { struct ifnet *ifp = vap->iv_ifp; if (IFNET_IS_UP_RUNNING(ifp)) /* NB: avoid recursion */ ieee80211_start_locked(vap); } - IEEE80211_UNLOCK(ic); } /* @@ -1270,8 +1258,6 @@ ieee80211_stop_locked(struct ieee80211vap *vap) struct ifnet *ifp = vap->iv_ifp; struct ifnet *parent = ic->ic_ifp; - IEEE80211_LOCK_ASSERT(ic); - IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, "stop running, %d vaps running\n", ic->ic_nrunning); @@ -1295,9 +1281,7 @@ ieee80211_stop(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; ic = vap->iv_ic; - IEEE80211_LOCK(ic); ieee80211_stop_locked(vap); - IEEE80211_UNLOCK(ic); } /* @@ -1308,13 +1292,11 @@ ieee80211_stop_all(struct ieee80211com *ic) { struct ieee80211vap *vap; - IEEE80211_LOCK(ic); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { struct ifnet *ifp = vap->iv_ifp; if (IFNET_IS_UP_RUNNING(ifp)) /* NB: avoid recursion */ ieee80211_stop_locked(vap); } - IEEE80211_UNLOCK(ic); ieee80211_waitfor_parent(ic); } @@ -1328,7 +1310,6 @@ ieee80211_suspend_all(struct ieee80211com *ic) { struct ieee80211vap *vap; - IEEE80211_LOCK(ic); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { struct ifnet *ifp = vap->iv_ifp; if (IFNET_IS_UP_RUNNING(ifp)) { /* NB: avoid recursion */ @@ -1336,7 +1317,6 @@ ieee80211_suspend_all(struct ieee80211com *ic) ieee80211_stop_locked(vap); } } - IEEE80211_UNLOCK(ic); ieee80211_waitfor_parent(ic); } @@ -1349,7 +1329,6 @@ ieee80211_resume_all(struct ieee80211com *ic) { struct ieee80211vap *vap; - IEEE80211_LOCK(ic); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { struct ifnet *ifp = vap->iv_ifp; if (!IFNET_IS_UP_RUNNING(ifp) && @@ -1358,18 +1337,15 @@ ieee80211_resume_all(struct ieee80211com *ic) ieee80211_start_locked(vap); } } - IEEE80211_UNLOCK(ic); } void ieee80211_beacon_miss(struct ieee80211com *ic) { - IEEE80211_LOCK(ic); if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) { /* Process in a taskq, the handler may reenter the driver */ ieee80211_runtask(ic, &ic->ic_bmiss_task); } - IEEE80211_UNLOCK(ic); } static void @@ -1460,8 +1436,6 @@ ieee80211_csa_startswitch(struct ieee80211com *ic, { struct ieee80211vap *vap; - IEEE80211_LOCK_ASSERT(ic); - ic->ic_csa_newchan = c; ic->ic_csa_mode = mode; ic->ic_csa_count = count; @@ -1499,8 +1473,6 @@ csa_completeswitch(struct ieee80211com *ic) void ieee80211_csa_completeswitch(struct ieee80211com *ic) { - IEEE80211_LOCK_ASSERT(ic); - KASSERT(ic->ic_flags & IEEE80211_F_CSAPENDING, ("csa not pending")); ieee80211_setcurchan(ic, ic->ic_csa_newchan); @@ -1515,8 +1487,6 @@ ieee80211_csa_completeswitch(struct ieee80211com *ic) void ieee80211_csa_cancelswitch(struct ieee80211com *ic) { - IEEE80211_LOCK_ASSERT(ic); - csa_completeswitch(ic); } @@ -1530,7 +1500,6 @@ ieee80211_cac_completeswitch(struct ieee80211vap *vap0) struct ieee80211com *ic = vap0->iv_ic; struct ieee80211vap *vap; - IEEE80211_LOCK(ic); /* * Complete CAC state change for lead vap first; then * clock all the other vap's waiting. @@ -1542,7 +1511,6 @@ ieee80211_cac_completeswitch(struct ieee80211vap *vap0) TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) if (vap->iv_state == IEEE80211_S_CAC) ieee80211_new_state_locked(vap, IEEE80211_S_RUN, 0); - IEEE80211_UNLOCK(ic); } /* @@ -1557,8 +1525,6 @@ markwaiting(struct ieee80211vap *vap0) struct ieee80211com *ic = vap0->iv_ic; struct ieee80211vap *vap; - IEEE80211_LOCK_ASSERT(ic); - /* * A vap list entry can not disappear since we are running on the * taskqueue and a vap destroy will queue and drain another state @@ -1587,8 +1553,6 @@ wakeupwaiting(struct ieee80211vap *vap0) struct ieee80211com *ic = vap0->iv_ic; struct ieee80211vap *vap; - IEEE80211_LOCK_ASSERT(ic); - /* * A vap list entry can not disappear since we are running on the * taskqueue and a vap destroy will queue and drain another state @@ -1619,7 +1583,6 @@ ieee80211_newstate_cb(void *xvap, int npending) enum ieee80211_state nstate, ostate; int arg, rc; - IEEE80211_LOCK(ic); nstate = vap->iv_nstate; arg = vap->iv_nstate_arg; @@ -1697,7 +1660,7 @@ ieee80211_newstate_cb(void *xvap, int npending) ieee80211_flush_ifq((struct ifqueue *)&ic->ic_ifp->if_snd, vap); } done: - IEEE80211_UNLOCK(ic); + ; } /* @@ -1736,8 +1699,6 @@ ieee80211_new_state_locked(struct ieee80211vap *vap, enum ieee80211_state ostate; int nrunning, nscanning; - IEEE80211_LOCK_ASSERT(ic); - if (vap->iv_flags_ext & IEEE80211_FEXT_STATEWAIT) { if (vap->iv_nstate == IEEE80211_S_INIT) { /* @@ -1884,8 +1845,6 @@ ieee80211_new_state(struct ieee80211vap *vap, int rc; ic = vap->iv_ic; - IEEE80211_LOCK(ic); rc = ieee80211_new_state_locked(vap, nstate, arg); - IEEE80211_UNLOCK(ic); return rc; } diff --git a/sys/netproto/802_11/wlan/ieee80211_regdomain.c b/sys/netproto/802_11/wlan/ieee80211_regdomain.c index 4305419f24..c7138e9a5a 100644 --- a/sys/netproto/802_11/wlan/ieee80211_regdomain.c +++ b/sys/netproto/802_11/wlan/ieee80211_regdomain.c @@ -323,7 +323,6 @@ allvapsdown(struct ieee80211com *ic) { struct ieee80211vap *vap; - IEEE80211_LOCK_ASSERT(ic); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) if (vap->iv_state != IEEE80211_S_INIT) return 0; @@ -385,10 +384,8 @@ ieee80211_setregdomain(struct ieee80211vap *vap, if (c->ic_maxpower == 0) c->ic_maxpower = 2*c->ic_maxregpower; } - IEEE80211_LOCK(ic); /* XXX bandaid; a running vap will likely crash */ if (!allvapsdown(ic)) { - IEEE80211_UNLOCK(ic); IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, "%s: reject: vaps are running\n", __func__); return EBUSY; @@ -396,7 +393,6 @@ ieee80211_setregdomain(struct ieee80211vap *vap, error = ic->ic_setregdomain(ic, ®->rd, reg->chaninfo.ic_nchans, reg->chaninfo.ic_chans); if (error != 0) { - IEEE80211_UNLOCK(ic); IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, "%s: driver rejected request, error %u\n", __func__, error); return error; @@ -443,7 +439,6 @@ ieee80211_setregdomain(struct ieee80211vap *vap, /* NB: may be NULL if not present in new channel list */ vap->iv_des_chan = (c != NULL) ? c : IEEE80211_CHAN_ANYC; } - IEEE80211_UNLOCK(ic); return 0; } diff --git a/sys/netproto/802_11/wlan/ieee80211_scan.c b/sys/netproto/802_11/wlan/ieee80211_scan.c index 43b7b75f20..1b5f8c4087 100644 --- a/sys/netproto/802_11/wlan/ieee80211_scan.c +++ b/sys/netproto/802_11/wlan/ieee80211_scan.c @@ -111,7 +111,7 @@ ieee80211_scan_attach(struct ieee80211com *ic) ic->ic_scan = NULL; return; } - cv_init(&ss->ss_scan_cv, "scan"); + wlan_cv_init(&ss->ss_scan_cv, "scan"); callout_init(&ss->ss_scan_timer); TASK_INIT(&ss->ss_scan_task, 0, scan_task, ss); ic->ic_scan = &ss->base; @@ -127,10 +127,8 @@ ieee80211_scan_detach(struct ieee80211com *ic) struct ieee80211_scan_state *ss = ic->ic_scan; if (ss != NULL) { - IEEE80211_LOCK(ic); SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_ABORT; scan_signal(ss); - IEEE80211_UNLOCK(ic); ieee80211_draintask(ic, &SCAN_PRIVATE(ss)->ss_scan_task); callout_stop(&SCAN_PRIVATE(ss)->ss_scan_timer); KASSERT((ic->ic_flags & IEEE80211_F_SCAN) == 0, @@ -184,7 +182,6 @@ ieee80211_scan_vdetach(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_state *ss; - IEEE80211_LOCK(ic); ss = ic->ic_scan; if (ss != NULL && ss->ss_vap == vap) { if (ic->ic_flags & IEEE80211_F_SCAN) { @@ -197,7 +194,6 @@ ieee80211_scan_vdetach(struct ieee80211vap *vap) } ss->ss_vap = NULL; } - IEEE80211_UNLOCK(ic); } /* @@ -268,8 +264,6 @@ scan_update_locked(struct ieee80211vap *vap, struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_state *ss = ic->ic_scan; - IEEE80211_LOCK_ASSERT(ic); - #ifdef IEEE80211_DEBUG if (ss->ss_vap != vap || ss->ss_ops != scan) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, @@ -384,8 +378,6 @@ start_scan_locked(const struct ieee80211_scanner *scan, struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_state *ss = ic->ic_scan; - IEEE80211_LOCK_ASSERT(ic); - if (ic->ic_flags & IEEE80211_F_CSAPENDING) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: scan inhibited by pending channel change\n", __func__); @@ -463,10 +455,8 @@ ieee80211_start_scan(struct ieee80211vap *vap, int flags, return 0; } - IEEE80211_LOCK(ic); result = start_scan_locked(scan, vap, flags, duration, mindwell, maxdwell, nssid, ssids); - IEEE80211_UNLOCK(ic); return result; } @@ -499,7 +489,6 @@ ieee80211_check_scan(struct ieee80211vap *vap, int flags, * XXX want more than the ap we're currently associated with */ - IEEE80211_LOCK(ic); IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: %s scan, %s%s%s%s%s\n" , __func__ @@ -548,14 +537,12 @@ ieee80211_check_scan(struct ieee80211vap *vap, int flags, SCAN_PRIVATE(ss)->ss_iflags &= ~ISCAN_DISCARD; if (result) { ieee80211_notify_scan_done(vap); - IEEE80211_UNLOCK(ic); return 1; } } } result = start_scan_locked(scan, vap, flags, duration, mindwell, maxdwell, nssid, ssids); - IEEE80211_UNLOCK(ic); return result; } @@ -593,7 +580,6 @@ ieee80211_bg_scan(struct ieee80211vap *vap, int flags) return 0; } - IEEE80211_LOCK(ic); if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) { u_int duration; /* @@ -667,7 +653,6 @@ ieee80211_bg_scan(struct ieee80211vap *vap, int flags) "%s: %s scan already in progress\n", __func__, ss->ss_flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive"); } - IEEE80211_UNLOCK(ic); /* NB: racey, does it matter? */ return (ic->ic_flags & IEEE80211_F_SCAN); @@ -682,7 +667,6 @@ ieee80211_cancel_scan(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_state *ss = ic->ic_scan; - IEEE80211_LOCK(ic); if ((ic->ic_flags & IEEE80211_F_SCAN) && ss->ss_vap == vap && (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) == 0) { @@ -697,7 +681,6 @@ ieee80211_cancel_scan(struct ieee80211vap *vap) /* wake up the scan task */ scan_signal(ss); } - IEEE80211_UNLOCK(ic); } /* @@ -709,7 +692,6 @@ ieee80211_cancel_anyscan(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_state *ss = ic->ic_scan; - IEEE80211_LOCK(ic); if ((ic->ic_flags & IEEE80211_F_SCAN) && (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) == 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, @@ -723,7 +705,6 @@ ieee80211_cancel_anyscan(struct ieee80211vap *vap) /* wake up the scan task */ scan_signal(ss); } - IEEE80211_UNLOCK(ic); } /* @@ -737,9 +718,7 @@ ieee80211_scan_next(struct ieee80211vap *vap) struct ieee80211_scan_state *ss = ic->ic_scan; /* wake up the scan task */ - IEEE80211_LOCK(ic); scan_signal(ss); - IEEE80211_UNLOCK(ic); } /* @@ -752,11 +731,9 @@ ieee80211_scan_done(struct ieee80211vap *vap) struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_state *ss; - IEEE80211_LOCK(ic); ss = ic->ic_scan; ss->ss_next = ss->ss_last; /* all channels are complete */ scan_signal(ss); - IEEE80211_UNLOCK(ic); } /* @@ -805,12 +782,10 @@ scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell) { struct ieee80211vap *vap = ss->ss_vap; - IEEE80211_LOCK(vap->iv_ic); if (ss->ss_flags & IEEE80211_SCAN_ACTIVE) ieee80211_probe_curchan(vap, 0); callout_reset(&SCAN_PRIVATE(ss)->ss_scan_timer, maxdwell, scan_signal, ss); - IEEE80211_UNLOCK(vap->iv_ic); } static void @@ -818,9 +793,7 @@ scan_signal(void *arg) { struct ieee80211_scan_state *ss = (struct ieee80211_scan_state *) arg; - IEEE80211_LOCK(ss->ss_ic); - cv_signal(&SCAN_PRIVATE(ss)->ss_scan_cv); - IEEE80211_UNLOCK(ss->ss_ic); + wlan_cv_signal(&SCAN_PRIVATE(ss)->ss_scan_cv, 0); } /* @@ -833,9 +806,7 @@ scan_mindwell(struct ieee80211_scan_state *ss) struct ieee80211com *ic = ss->ss_ic; ic = ss->ss_ic; - IEEE80211_LOCK(ic); scan_signal(ss); - IEEE80211_UNLOCK(ic); } static void @@ -849,7 +820,6 @@ scan_task(void *arg, int pending) unsigned long maxdwell, scanend; int scandone = 0; - IEEE80211_LOCK(ic); if (vap == NULL || (ic->ic_flags & IEEE80211_F_SCAN) == 0 || (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_ABORT)) { /* Cancelled before we started */ @@ -869,20 +839,18 @@ scan_task(void *arg, int pending) ieee80211_sta_pwrsave(vap, 1); /* * Use an 1ms delay so the null data frame has a chance - * to go out. + * to go out. Minimum one tick. * XXX Should use M_TXCB mechanism to eliminate this. */ - cv_timedwait(&SCAN_PRIVATE(ss)->ss_scan_cv, - IEEE80211_LOCK_OBJ(ic), hz / 1000); + wlan_cv_timedwait(&SCAN_PRIVATE(ss)->ss_scan_cv, + hz / 1000 + 1); if (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_ABORT) goto done; } } scanend = ticks + SCAN_PRIVATE(ss)->ss_duration; - IEEE80211_UNLOCK(ic); ic->ic_scan_start(ic); /* notify driver */ - IEEE80211_LOCK(ic); for (;;) { scandone = (ss->ss_next >= ss->ss_last) || @@ -918,7 +886,6 @@ scan_task(void *arg, int pending) */ ic->ic_curchan = chan; ic->ic_rt = ieee80211_get_ratetable(chan); - IEEE80211_UNLOCK(ic); /* * Perform the channel change and scan unlocked so the driver * may sleep. Once set_channel returns the hardware has @@ -940,7 +907,6 @@ scan_task(void *arg, int pending) * and allows it to be signalled for abort. */ ic->ic_scan_curchan(ss, maxdwell); - IEEE80211_LOCK(ic); SCAN_PRIVATE(ss)->ss_chanmindwell = ticks + ss->ss_mindwell; /* clear mindwell lock and initial channel change flush */ @@ -950,14 +916,12 @@ scan_task(void *arg, int pending) continue; /* Wait to be signalled to scan the next channel */ - cv_wait(&SCAN_PRIVATE(ss)->ss_scan_cv, IEEE80211_LOCK_OBJ(ic)); + wlan_cv_wait(&SCAN_PRIVATE(ss)->ss_scan_cv); } if (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_ABORT) goto done; - IEEE80211_UNLOCK(ic); ic->ic_scan_end(ic); /* notify driver */ - IEEE80211_LOCK(ic); /* * Record scan complete time. Note that we also do @@ -970,10 +934,8 @@ scan_task(void *arg, int pending) if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && ic->ic_curchan != ic->ic_bsschan) { ieee80211_setupcurchan(ic, ic->ic_bsschan); - IEEE80211_UNLOCK(ic); ic->ic_set_channel(ic); ieee80211_radiotap_chan_change(ic); - IEEE80211_LOCK(ic); } /* clear internal flags and any indication of a pick */ SCAN_PRIVATE(ss)->ss_iflags &= ~ISCAN_REP; @@ -1003,7 +965,6 @@ scan_task(void *arg, int pending) ss->ss_ops->scan_restart(ss, vap); /* XXX? */ ieee80211_runtask(ic, &SCAN_PRIVATE(ss)->ss_scan_task); - IEEE80211_UNLOCK(ic); return; } @@ -1042,7 +1003,6 @@ done: } SCAN_PRIVATE(ss)->ss_iflags &= ~(ISCAN_CANCEL|ISCAN_ABORT); ss->ss_flags &= ~(IEEE80211_SCAN_ONCE | IEEE80211_SCAN_PICK1ST); - IEEE80211_UNLOCK(ic); #undef ISCAN_REP } @@ -1225,8 +1185,6 @@ ieee80211_scan_pickchannel(struct ieee80211com *ic, int flags) { struct ieee80211_scan_state *ss = ic->ic_scan; - IEEE80211_LOCK_ASSERT(ic); - if (ss == NULL || ss->ss_ops == NULL || ss->ss_vap == NULL) { /* XXX printf? */ return NULL; diff --git a/sys/netproto/802_11/wlan/ieee80211_scan_sta.c b/sys/netproto/802_11/wlan/ieee80211_scan_sta.c index c8c4c28b55..9117fd7c92 100644 --- a/sys/netproto/802_11/wlan/ieee80211_scan_sta.c +++ b/sys/netproto/802_11/wlan/ieee80211_scan_sta.c @@ -1678,19 +1678,15 @@ ap_force_promisc(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; - IEEE80211_LOCK(ic); /* set interface into promiscuous mode */ ifp->if_flags |= IFF_PROMISC; ieee80211_runtask(ic, &ic->ic_promisc_task); - IEEE80211_UNLOCK(ic); } static void ap_reset_promisc(struct ieee80211com *ic) { - IEEE80211_LOCK(ic); ieee80211_syncifflag_locked(ic, IFF_PROMISC); - IEEE80211_UNLOCK(ic); } static int diff --git a/sys/netproto/802_11/wlan/ieee80211_sta.c b/sys/netproto/802_11/wlan/ieee80211_sta.c index 210718fb85..61a5ec9974 100644 --- a/sys/netproto/802_11/wlan/ieee80211_sta.c +++ b/sys/netproto/802_11/wlan/ieee80211_sta.c @@ -207,8 +207,6 @@ sta_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) struct ieee80211_node *ni; enum ieee80211_state ostate; - IEEE80211_LOCK_ASSERT(ic); - ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", __func__, ieee80211_state_name[ostate], @@ -1118,7 +1116,6 @@ ieee80211_parse_csaparams(struct ieee80211vap *vap, uint8_t *frm, wh, "CSA", "invalid mode %u", csa->csa_mode); return; } - IEEE80211_LOCK(ic); if ((ic->ic_flags & IEEE80211_F_CSAPENDING) == 0) { /* * Convert the channel number to a channel reference. We @@ -1198,7 +1195,7 @@ ieee80211_parse_csaparams(struct ieee80211vap *vap, uint8_t *frm, } } done: - IEEE80211_UNLOCK(ic); + ; } /* @@ -1377,9 +1374,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, * stuck in CSA state. If the AP really is * moving we'll get a beacon miss and scan. */ - IEEE80211_LOCK(ic); ieee80211_csa_cancelswitch(ic); - IEEE80211_UNLOCK(ic); } /* * If scanning, pass the info to the scan module. diff --git a/sys/netproto/802_11/wlan/ieee80211_superg.c b/sys/netproto/802_11/wlan/ieee80211_superg.c index 1c7e725889..c02cc99ff2 100644 --- a/sys/netproto/802_11/wlan/ieee80211_superg.c +++ b/sys/netproto/802_11/wlan/ieee80211_superg.c @@ -560,7 +560,6 @@ ieee80211_ff_age(struct ieee80211com *ic, struct ieee80211_stageq *sq, KASSERT(sq->head != NULL, ("stageq empty")); - IEEE80211_LOCK(ic); head = sq->head; while ((m = sq->head) != NULL && M_AGE_GET(m) < quanta) { /* clear tap ref to frame */ @@ -577,7 +576,6 @@ ieee80211_ff_age(struct ieee80211com *ic, struct ieee80211_stageq *sq, sq->tail = NULL; else M_AGE_SUB(m, quanta); - IEEE80211_UNLOCK(ic); ff_flush(head, m); } @@ -670,7 +668,6 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) * Do 802.1x EAPOL frames proceed in the clear? Then they couldn't * be aggregated with other types of frames when encryption is on? */ - IEEE80211_LOCK(ic); tap = &ni->ni_tx_ampdu[pri]; mstaged = tap->txa_private; /* NB: we reuse AMPDU state */ ieee80211_txampdu_count_packet(tap); @@ -683,7 +680,6 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) if (vap->iv_opmode != IEEE80211_M_STA && ETHER_IS_MULTICAST(mtod(m, struct ether_header *)->ether_dhost)) { /* XXX flush staged frame? */ - IEEE80211_UNLOCK(ic); return m; } /* @@ -692,7 +688,6 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) */ if (mstaged == NULL && ieee80211_txampdu_getpps(tap) < ieee80211_ffppsmin) { - IEEE80211_UNLOCK(ic); return m; } sq = &sg->ff_stageq[pri]; @@ -715,7 +710,6 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) tap->txa_private = NULL; if (mstaged != NULL) stageq_remove(sq, mstaged); - IEEE80211_UNLOCK(ic); if (mstaged != NULL) { IEEE80211_NOTE(vap, IEEE80211_MSG_SUPERG, ni, @@ -735,7 +729,6 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) if (mstaged != NULL) { tap->txa_private = NULL; stageq_remove(sq, mstaged); - IEEE80211_UNLOCK(ic); IEEE80211_NOTE(vap, IEEE80211_MSG_SUPERG, ni, "%s: aggregate fast-frame", __func__); @@ -757,7 +750,6 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) stageq_add(sq, m); sg->ff_stageqdepth++; - IEEE80211_UNLOCK(ic); IEEE80211_NOTE(vap, IEEE80211_MSG_SUPERG, ni, "%s: stage frame, %u queued", __func__, sq->depth); @@ -786,7 +778,6 @@ ieee80211_ff_node_cleanup(struct ieee80211_node *ni) struct mbuf *m, *head; int ac; - IEEE80211_LOCK(ic); head = NULL; for (ac = 0; ac < WME_NUM_AC; ac++) { tap = &ni->ni_tx_ampdu[ac]; @@ -798,7 +789,6 @@ ieee80211_ff_node_cleanup(struct ieee80211_node *ni) head = m; } } - IEEE80211_UNLOCK(ic); for (m = head; m != NULL; m = m->m_nextpkt) { m_freem(m); diff --git a/sys/netproto/802_11/wlan/ieee80211_tdma.c b/sys/netproto/802_11/wlan/ieee80211_tdma.c index f40e944e6c..d3b5b12336 100644 --- a/sys/netproto/802_11/wlan/ieee80211_tdma.c +++ b/sys/netproto/802_11/wlan/ieee80211_tdma.c @@ -223,8 +223,6 @@ tdma_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) enum ieee80211_state ostate; int status; - IEEE80211_LOCK_ASSERT(ic); - ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s (%d)\n", __func__, ieee80211_state_name[ostate], diff --git a/sys/netproto/802_11/wlan/ieee80211_wds.c b/sys/netproto/802_11/wlan/ieee80211_wds.c index 8439987da8..b5d4d16e6f 100644 --- a/sys/netproto/802_11/wlan/ieee80211_wds.c +++ b/sys/netproto/802_11/wlan/ieee80211_wds.c @@ -122,7 +122,7 @@ static int ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_node_table *nt = &ic->ic_sta; +/* struct ieee80211_node_table *nt = &ic->ic_sta;*/ struct ieee80211_node *ni, *obss; IEEE80211_DPRINTF(vap, IEEE80211_MSG_WDS, @@ -143,7 +143,6 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) * be dispatched upward (e.g. to a bridge) as though * they arrived on the WDS vap. */ - IEEE80211_NODE_LOCK(nt); obss = NULL; ni = ieee80211_find_node_locked(&ic->ic_sta, vap->iv_des_bssid); if (ni == NULL) { @@ -178,7 +177,6 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) vap->iv_bss = ni; ni->ni_wdsvap = vap; } - IEEE80211_NODE_UNLOCK(nt); if (obss != NULL) { /* NB: deferred to avoid recursive lock */ ieee80211_free_node(obss); @@ -343,8 +341,6 @@ wds_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) enum ieee80211_state ostate; int error; - IEEE80211_LOCK_ASSERT(ic); - ostate = vap->iv_state; IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s -> %s\n", __func__, ieee80211_state_name[ostate], ieee80211_state_name[nstate]); diff --git a/sys/netproto/802_11/wlan_acl/ieee80211_acl.c b/sys/netproto/802_11/wlan_acl/ieee80211_acl.c index d40abf4704..3c9bd85efb 100644 --- a/sys/netproto/802_11/wlan_acl/ieee80211_acl.c +++ b/sys/netproto/802_11/wlan_acl/ieee80211_acl.c @@ -75,7 +75,6 @@ struct acl { uint8_t acl_macaddr[IEEE80211_ADDR_LEN]; }; struct aclstate { - acl_lock_t as_lock; int as_policy; int as_nacls; TAILQ_HEAD(, acl) as_list; /* list of all ACL's */ @@ -103,7 +102,6 @@ acl_attach(struct ieee80211vap *vap) M_80211_ACL, M_INTWAIT | M_ZERO); if (as == NULL) return 0; - ACL_LOCK_INIT(as, "acl"); TAILQ_INIT(&as->as_list); as->as_policy = ACL_POLICY_OPEN; as->as_vap = vap; @@ -122,7 +120,6 @@ acl_detach(struct ieee80211vap *vap) acl_free_all(vap); vap->iv_as = NULL; - ACL_LOCK_DESTROY(as); kfree(as, M_80211_ACL); } @@ -143,7 +140,6 @@ _find_acl(struct aclstate *as, const uint8_t *macaddr) static void _acl_free(struct aclstate *as, struct acl *acl) { - ACL_LOCK_ASSERT(as); TAILQ_REMOVE(&as->as_list, acl, acl_list); LIST_REMOVE(acl, acl_hash); @@ -183,11 +179,9 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) return ENOMEM; } - ACL_LOCK(as); hash = ACL_HASH(mac); LIST_FOREACH(acl, &as->as_hash[hash], acl_hash) { if (IEEE80211_ADDR_EQ(acl->acl_macaddr, mac)) { - ACL_UNLOCK(as); kfree(new, M_80211_ACL); IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, "ACL: add %6D failed, already present\n", @@ -199,7 +193,6 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) TAILQ_INSERT_TAIL(&as->as_list, new, acl_list); LIST_INSERT_HEAD(&as->as_hash[hash], new, acl_hash); as->as_nacls++; - ACL_UNLOCK(as); IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, "ACL: add %6D\n", mac, ":"); @@ -212,11 +205,9 @@ acl_remove(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) struct aclstate *as = vap->iv_as; struct acl *acl; - ACL_LOCK(as); acl = _find_acl(as, mac); if (acl != NULL) _acl_free(as, acl); - ACL_UNLOCK(as); IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, "ACL: remove %6D%s\n", mac, ":", @@ -233,10 +224,8 @@ acl_free_all(struct ieee80211vap *vap) IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, "ACL: %s\n", "free all"); - ACL_LOCK(as); while ((acl = TAILQ_FIRST(&as->as_list)) != NULL) _acl_free(as, acl); - ACL_UNLOCK(as); return 0; } @@ -306,12 +295,10 @@ acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq) if (ap == NULL) return ENOMEM; i = 0; - ACL_LOCK(as); TAILQ_FOREACH(acl, &as->as_list, acl_list) { IEEE80211_ADDR_COPY(ap[i].ml_macaddr, acl->acl_macaddr); i++; } - ACL_UNLOCK(as); if (ireq->i_len >= space) { error = copyout(ap, ireq->i_data, space); ireq->i_len = space; -- 2.41.0