From owner-svn-src-head@FreeBSD.ORG Tue May 26 04:38:01 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E731133F; Tue, 26 May 2015 04:38:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8AABEEF; Tue, 26 May 2015 04:38:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4Q4c0bu089852; Tue, 26 May 2015 04:38:00 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4Q4c0eU089849; Tue, 26 May 2015 04:38:00 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201505260438.t4Q4c0eU089849@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 26 May 2015 04:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283556 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2015 04:38:01 -0000 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