Author: adrian
Date: Tue May 26 04:37:59 2015
New Revision: 283556
URL: https://svnweb.freebsd.org/changeset/base/283556

Log:
  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.

Modified:
  head/sys/net80211/ieee80211_freebsd.h
  head/sys/net80211/ieee80211_scan_sta.c

Modified: head/sys/net80211/ieee80211_freebsd.h
==============================================================================
--- head/sys/net80211/ieee80211_freebsd.h       Tue May 26 04:25:11 2015        
(r283555)
+++ head/sys/net80211/ieee80211_freebsd.h       Tue May 26 04:37:59 2015        
(r283556)
@@ -183,6 +183,13 @@ typedef struct mtx ieee80211_scan_table_
 #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.
  */

Modified: head/sys/net80211/ieee80211_scan_sta.c
==============================================================================
--- head/sys/net80211/ieee80211_scan_sta.c      Tue May 26 04:25:11 2015        
(r283555)
+++ head/sys/net80211/ieee80211_scan_sta.c      Tue May 26 04:37:59 2015        
(r283556)
@@ -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 *
        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 *
        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 
        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 @@ restart:
        }
        IEEE80211_SCAN_TABLE_UNLOCK(st);
 
-       mtx_unlock(&st->st_scanlock);
+       IEEE80211_SCAN_ITER_UNLOCK(st);
 }
 
 static void
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to