Migrate the scan iterator lock typedefs out into ieee80211_freebsd.h.

This removes the final piece of freebsd-specific locking that snuck
into the tree - it's now all inside ieee80211_freebsd.h.
This commit is contained in:
Adrian Chadd 2015-05-26 04:37:59 +00:00
parent 71f9dd120b
commit b6b2fb599b
2 changed files with 12 additions and 5 deletions

View File

@ -183,6 +183,13 @@ typedef struct mtx ieee80211_scan_table_lock_t;
#define IEEE80211_SCAN_TABLE_LOCK(_st) mtx_lock(&(_st)->st_lock)
#define IEEE80211_SCAN_TABLE_UNLOCK(_st) mtx_unlock(&(_st)->st_lock)
typedef struct mtx ieee80211_scan_iter_lock_t;
#define IEEE80211_SCAN_ITER_LOCK_INIT(_st, _name) \
mtx_init(&(_st)->st_scanlock, _name, "802.11 scangen", MTX_DEF)
#define IEEE80211_SCAN_ITER_LOCK_DESTROY(_st) mtx_destroy(&(_st)->st_scanlock)
#define IEEE80211_SCAN_ITER_LOCK(_st) mtx_lock(&(_st)->st_scanlock)
#define IEEE80211_SCAN_ITER_UNLOCK(_st) mtx_unlock(&(_st)->st_scanlock)
/*
* Mesh node/routing definitions.
*/

View File

@ -102,7 +102,7 @@ struct sta_table {
ieee80211_scan_table_lock_t st_lock; /* on scan table */
TAILQ_HEAD(, sta_entry) st_entry; /* all entries */
LIST_HEAD(, sta_entry) st_hash[STA_HASHSIZE];
struct mtx st_scanlock; /* on st_scaniter */
ieee80211_scan_iter_lock_t st_scanlock; /* on st_scaniter */
u_int st_scaniter; /* gen# for iterator */
u_int st_scangen; /* scan generation # */
int st_newscan;
@ -165,7 +165,7 @@ sta_attach(struct ieee80211_scan_state *ss)
if (st == NULL)
return 0;
IEEE80211_SCAN_TABLE_LOCK_INIT(st, "scantable");
mtx_init(&st->st_scanlock, "scangen", "802.11 scangen", MTX_DEF);
IEEE80211_SCAN_ITER_LOCK_INIT(st, "scangen");
TAILQ_INIT(&st->st_entry);
ss->ss_priv = st;
nrefs++; /* NB: we assume caller locking */
@ -183,7 +183,7 @@ sta_detach(struct ieee80211_scan_state *ss)
if (st != NULL) {
sta_flush_table(st);
IEEE80211_SCAN_TABLE_LOCK_DESTROY(st);
mtx_destroy(&st->st_scanlock);
IEEE80211_SCAN_ITER_LOCK_DESTROY(st);
IEEE80211_FREE(st, M_80211_SCAN);
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */
@ -1403,7 +1403,7 @@ sta_iterate(struct ieee80211_scan_state *ss,
struct sta_entry *se;
u_int gen;
mtx_lock(&st->st_scanlock);
IEEE80211_SCAN_ITER_LOCK(st);
gen = st->st_scaniter++;
restart:
IEEE80211_SCAN_TABLE_LOCK(st);
@ -1419,7 +1419,7 @@ sta_iterate(struct ieee80211_scan_state *ss,
}
IEEE80211_SCAN_TABLE_UNLOCK(st);
mtx_unlock(&st->st_scanlock);
IEEE80211_SCAN_ITER_UNLOCK(st);
}
static void