From owner-svn-src-all@freebsd.org Tue May 17 16:38:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BEB6B3F60D; Tue, 17 May 2016 16:38:20 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 ED0B92F3E; Tue, 17 May 2016 16:38:19 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4HGcJUl003395; Tue, 17 May 2016 16:38:19 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4HGcIor003392; Tue, 17 May 2016 16:38:18 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605171638.u4HGcIor003392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 17 May 2016 16:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300063 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2016 16:38:20 -0000 Author: avos Date: Tue May 17 16:38:18 2016 New Revision: 300063 URL: https://svnweb.freebsd.org/changeset/base/300063 Log: net80211: unbreak 'show all vaps(/a)' ddb command Replace ifnet list lookup (which is broken since r287197, because IFT_IEEE80211 type is not used anymore) with iteration on ieee80211com list. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D6419 Modified: head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_ddb.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Tue May 17 15:36:40 2016 (r300062) +++ head/sys/net80211/ieee80211.c Tue May 17 16:38:18 2016 (r300063) @@ -406,6 +406,17 @@ ieee80211_find_com(const char *name) return (ic); } +void +ieee80211_iterate_coms(ieee80211_com_iter_func *f, void *arg) +{ + struct ieee80211com *ic; + + mtx_lock(&ic_list_mtx); + LIST_FOREACH(ic, &ic_head, ic_next) + (*f)(arg, ic); + mtx_unlock(&ic_list_mtx); +} + /* * Default reset method for use with the ioctl support. This * method is invoked after any state change in the 802.11 Modified: head/sys/net80211/ieee80211_ddb.c ============================================================================== --- head/sys/net80211/ieee80211_ddb.c Tue May 17 15:36:40 2016 (r300062) +++ head/sys/net80211/ieee80211_ddb.c Tue May 17 16:38:18 2016 (r300063) @@ -69,6 +69,8 @@ static void _db_show_vap(const struct ie static void _db_show_com(const struct ieee80211com *, int showvaps, int showsta, int showmesh, int showprocs); +static void _db_show_all_vaps(void *, struct ieee80211com *); + static void _db_show_node_table(const char *tag, const struct ieee80211_node_table *); static void _db_show_channel(const char *tag, const struct ieee80211_channel *); @@ -161,8 +163,6 @@ DB_SHOW_COMMAND(com, db_show_com) DB_SHOW_ALL_COMMAND(vaps, db_show_all_vaps) { - VNET_ITERATOR_DECL(vnet_iter); - const struct ifnet *ifp; int i, showall = 0; for (i = 0; modif[i] != '\0'; i++) @@ -172,24 +172,7 @@ DB_SHOW_ALL_COMMAND(vaps, db_show_all_va break; } - VNET_FOREACH(vnet_iter) { - TAILQ_FOREACH(ifp, &V_ifnet, if_list) - if (ifp->if_type == IFT_IEEE80211) { - const struct ieee80211com *ic = ifp->if_l2com; - - if (!showall) { - const struct ieee80211vap *vap; - db_printf("%s: com %p vaps:", - ifp->if_xname, ic); - TAILQ_FOREACH(vap, &ic->ic_vaps, - iv_next) - db_printf(" %s(%p)", - vap->iv_ifp->if_xname, vap); - db_printf("\n"); - } else - _db_show_com(ic, 1, 1, 1, 1); - } - } + ieee80211_iterate_coms(_db_show_all_vaps, &showall); } #ifdef IEEE80211_SUPPORT_MESH @@ -683,6 +666,21 @@ _db_show_com(const struct ieee80211com * } static void +_db_show_all_vaps(void *arg, struct ieee80211com *ic) +{ + int showall = *(int *)arg; + + if (!showall) { + const struct ieee80211vap *vap; + db_printf("%s: com %p vaps:", ic->ic_name, ic); + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + db_printf(" %s(%p)", vap->iv_ifp->if_xname, vap); + db_printf("\n"); + } else + _db_show_com(ic, 1, 1, 1, 1); +} + +static void _db_show_node_table(const char *tag, const struct ieee80211_node_table *nt) { int i; Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue May 17 15:36:40 2016 (r300062) +++ head/sys/net80211/ieee80211_var.h Tue May 17 16:38:18 2016 (r300063) @@ -714,6 +714,8 @@ void ieee80211_drain(struct ieee80211com void ieee80211_chan_init(struct ieee80211com *); struct ieee80211com *ieee80211_find_vap(const uint8_t mac[IEEE80211_ADDR_LEN]); struct ieee80211com *ieee80211_find_com(const char *name); +typedef void ieee80211_com_iter_func(void *, struct ieee80211com *); +void ieee80211_iterate_coms(ieee80211_com_iter_func *, void *); int ieee80211_media_change(struct ifnet *); void ieee80211_media_status(struct ifnet *, struct ifmediareq *); int ieee80211_ioctl(struct ifnet *, u_long, caddr_t);