1b032f27cSSam Leffler /*- 24d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3fe267a55SPedro F. Giffuni * 410ad9a77SSam Leffler * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting 5b032f27cSSam Leffler * All rights reserved. 6b032f27cSSam Leffler * 7b032f27cSSam Leffler * Redistribution and use in source and binary forms, with or without 8b032f27cSSam Leffler * modification, are permitted provided that the following conditions 9b032f27cSSam Leffler * are met: 10b032f27cSSam Leffler * 1. Redistributions of source code must retain the above copyright 11b032f27cSSam Leffler * notice, this list of conditions and the following disclaimer. 12b032f27cSSam Leffler * 2. Redistributions in binary form must reproduce the above copyright 13b032f27cSSam Leffler * notice, this list of conditions and the following disclaimer in the 14b032f27cSSam Leffler * documentation and/or other materials provided with the distribution. 15b032f27cSSam Leffler * 16b032f27cSSam Leffler * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17b032f27cSSam Leffler * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18b032f27cSSam Leffler * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19b032f27cSSam Leffler * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20b032f27cSSam Leffler * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21b032f27cSSam Leffler * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22b032f27cSSam Leffler * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23b032f27cSSam Leffler * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24b032f27cSSam Leffler * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25b032f27cSSam Leffler * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26b032f27cSSam Leffler */ 27b032f27cSSam Leffler 28b032f27cSSam Leffler #include <sys/cdefs.h> 29b032f27cSSam Leffler #include "opt_ddb.h" 30b032f27cSSam Leffler #include "opt_wlan.h" 31b032f27cSSam Leffler 32b032f27cSSam Leffler #ifdef DDB 33b032f27cSSam Leffler /* 34b032f27cSSam Leffler * IEEE 802.11 DDB support 35b032f27cSSam Leffler */ 36b032f27cSSam Leffler #include <sys/param.h> 37b032f27cSSam Leffler #include <sys/systm.h> 38b032f27cSSam Leffler #include <sys/kernel.h> 398ec07310SGleb Smirnoff #include <sys/malloc.h> 40b032f27cSSam Leffler #include <sys/socket.h> 41b032f27cSSam Leffler 42b032f27cSSam Leffler #include <net/if.h> 4376039bc8SGleb Smirnoff #include <net/if_var.h> 44b032f27cSSam Leffler #include <net/if_dl.h> 45b032f27cSSam Leffler #include <net/if_media.h> 46b032f27cSSam Leffler #include <net/if_types.h> 47b032f27cSSam Leffler #include <net/ethernet.h> 484b79449eSBjoern A. Zeeb #include <net/vnet.h> 49b032f27cSSam Leffler 50b032f27cSSam Leffler #include <net80211/ieee80211_var.h> 514ed35b7dSBjoern A. Zeeb #include <net80211/ieee80211_ratectl.h> 527f6a5468SSam Leffler #ifdef IEEE80211_SUPPORT_TDMA 537f6a5468SSam Leffler #include <net80211/ieee80211_tdma.h> 547f6a5468SSam Leffler #endif 5559aa14a9SRui Paulo #ifdef IEEE80211_SUPPORT_MESH 5659aa14a9SRui Paulo #include <net80211/ieee80211_mesh.h> 5759aa14a9SRui Paulo #endif 58b032f27cSSam Leffler 59b032f27cSSam Leffler #include <ddb/ddb.h> 604ea21980SAndrew Thompson #include <ddb/db_sym.h> 61b032f27cSSam Leffler 627f6a5468SSam Leffler #define DB_PRINTSYM(prefix, name, addr) do { \ 637f6a5468SSam Leffler db_printf("%s%-25s : ", prefix, name); \ 644ea21980SAndrew Thompson db_printsym((db_addr_t) addr, DB_STGY_ANY); \ 657f6a5468SSam Leffler db_printf("\n"); \ 667f6a5468SSam Leffler } while (0) 674ea21980SAndrew Thompson 68b032f27cSSam Leffler static void _db_show_sta(const struct ieee80211_node *); 6962f07485SMonthadar Al Jaberi static void _db_show_vap(const struct ieee80211vap *, int, int); 70b032f27cSSam Leffler static void _db_show_com(const struct ieee80211com *, 7133396ec2SBjoern A. Zeeb int showvaps, int showsta, int showmesh, int showprocs, int); 72b032f27cSSam Leffler 737cde0202SAndriy Voskoboinyk static void _db_show_all_vaps(void *, struct ieee80211com *); 747cde0202SAndriy Voskoboinyk 7530a4e068SSam Leffler static void _db_show_node_table(const char *tag, 7630a4e068SSam Leffler const struct ieee80211_node_table *); 77b032f27cSSam Leffler static void _db_show_channel(const char *tag, const struct ieee80211_channel *); 78b032f27cSSam Leffler static void _db_show_ssid(const char *tag, int ix, int len, const uint8_t *); 79b032f27cSSam Leffler static void _db_show_appie(const char *tag, const struct ieee80211_appie *); 80b032f27cSSam Leffler static void _db_show_key(const char *tag, int ix, const struct ieee80211_key *); 81b032f27cSSam Leffler static void _db_show_roamparams(const char *tag, const void *arg, 82b032f27cSSam Leffler const struct ieee80211_roamparam *rp); 83b032f27cSSam Leffler static void _db_show_txparams(const char *tag, const void *arg, 84b032f27cSSam Leffler const struct ieee80211_txparam *tp); 8559aa14a9SRui Paulo static void _db_show_ageq(const char *tag, const struct ieee80211_ageq *q); 86b032f27cSSam Leffler static void _db_show_stats(const struct ieee80211_stats *); 8759aa14a9SRui Paulo #ifdef IEEE80211_SUPPORT_MESH 8859aa14a9SRui Paulo static void _db_show_mesh(const struct ieee80211_mesh_state *); 8959aa14a9SRui Paulo #endif 90b032f27cSSam Leffler 91b032f27cSSam Leffler DB_SHOW_COMMAND(sta, db_show_sta) 92b032f27cSSam Leffler { 93b032f27cSSam Leffler if (!have_addr) { 94b032f27cSSam Leffler db_printf("usage: show sta <addr>\n"); 95b032f27cSSam Leffler return; 96b032f27cSSam Leffler } 97b032f27cSSam Leffler _db_show_sta((const struct ieee80211_node *) addr); 98b032f27cSSam Leffler } 99b032f27cSSam Leffler 10030a4e068SSam Leffler DB_SHOW_COMMAND(statab, db_show_statab) 10130a4e068SSam Leffler { 10230a4e068SSam Leffler if (!have_addr) { 10330a4e068SSam Leffler db_printf("usage: show statab <addr>\n"); 10430a4e068SSam Leffler return; 10530a4e068SSam Leffler } 10630a4e068SSam Leffler _db_show_node_table("", (const struct ieee80211_node_table *) addr); 10730a4e068SSam Leffler } 10830a4e068SSam Leffler 109b032f27cSSam Leffler DB_SHOW_COMMAND(vap, db_show_vap) 110b032f27cSSam Leffler { 11162f07485SMonthadar Al Jaberi int i, showmesh = 0, showprocs = 0; 112b032f27cSSam Leffler 113b032f27cSSam Leffler if (!have_addr) { 114b032f27cSSam Leffler db_printf("usage: show vap <addr>\n"); 115b032f27cSSam Leffler return; 116b032f27cSSam Leffler } 117b032f27cSSam Leffler for (i = 0; modif[i] != '\0'; i++) 118b032f27cSSam Leffler switch (modif[i]) { 119b032f27cSSam Leffler case 'a': 120b032f27cSSam Leffler showprocs = 1; 12162f07485SMonthadar Al Jaberi showmesh = 1; 12262f07485SMonthadar Al Jaberi break; 12362f07485SMonthadar Al Jaberi case 'm': 12462f07485SMonthadar Al Jaberi showmesh = 1; 125b032f27cSSam Leffler break; 126b032f27cSSam Leffler case 'p': 127b032f27cSSam Leffler showprocs = 1; 128b032f27cSSam Leffler break; 129b032f27cSSam Leffler } 13062f07485SMonthadar Al Jaberi _db_show_vap((const struct ieee80211vap *) addr, showmesh, showprocs); 131b032f27cSSam Leffler } 132b032f27cSSam Leffler 133b032f27cSSam Leffler DB_SHOW_COMMAND(com, db_show_com) 134b032f27cSSam Leffler { 135b032f27cSSam Leffler const struct ieee80211com *ic; 13633396ec2SBjoern A. Zeeb int i, showprocs = 0, showvaps = 0, showsta = 0, showmesh = 0, showscan = 0; 137b032f27cSSam Leffler 138b032f27cSSam Leffler if (!have_addr) { 139b032f27cSSam Leffler db_printf("usage: show com <addr>\n"); 140b032f27cSSam Leffler return; 141b032f27cSSam Leffler } 142b032f27cSSam Leffler for (i = 0; modif[i] != '\0'; i++) 143b032f27cSSam Leffler switch (modif[i]) { 144b032f27cSSam Leffler case 'a': 14533396ec2SBjoern A. Zeeb showsta = showmesh = showvaps = showprocs = showscan = 1; 14633396ec2SBjoern A. Zeeb break; 14733396ec2SBjoern A. Zeeb case 'S': 14833396ec2SBjoern A. Zeeb showscan = 1; 149b032f27cSSam Leffler break; 150b032f27cSSam Leffler case 's': 151b032f27cSSam Leffler showsta = 1; 152b032f27cSSam Leffler break; 15362f07485SMonthadar Al Jaberi case 'm': 15462f07485SMonthadar Al Jaberi showmesh = 1; 15562f07485SMonthadar Al Jaberi break; 156b032f27cSSam Leffler case 'v': 157b032f27cSSam Leffler showvaps = 1; 158b032f27cSSam Leffler break; 159b032f27cSSam Leffler case 'p': 160b032f27cSSam Leffler showprocs = 1; 161b032f27cSSam Leffler break; 162b032f27cSSam Leffler } 163b032f27cSSam Leffler 164b032f27cSSam Leffler ic = (const struct ieee80211com *) addr; 16533396ec2SBjoern A. Zeeb _db_show_com(ic, showvaps, showsta, showmesh, showprocs, showscan); 166b032f27cSSam Leffler } 167b032f27cSSam Leffler 168b032f27cSSam Leffler DB_SHOW_ALL_COMMAND(vaps, db_show_all_vaps) 169b032f27cSSam Leffler { 170b032f27cSSam Leffler int i, showall = 0; 171b032f27cSSam Leffler 172b032f27cSSam Leffler for (i = 0; modif[i] != '\0'; i++) 173b032f27cSSam Leffler switch (modif[i]) { 174b032f27cSSam Leffler case 'a': 175b032f27cSSam Leffler showall = 1; 176b032f27cSSam Leffler break; 177b032f27cSSam Leffler } 178b032f27cSSam Leffler 1797cde0202SAndriy Voskoboinyk ieee80211_iterate_coms(_db_show_all_vaps, &showall); 1808b615593SMarko Zec } 181b032f27cSSam Leffler 18259aa14a9SRui Paulo #ifdef IEEE80211_SUPPORT_MESH 18359aa14a9SRui Paulo DB_SHOW_ALL_COMMAND(mesh, db_show_mesh) 18459aa14a9SRui Paulo { 18559aa14a9SRui Paulo const struct ieee80211_mesh_state *ms; 18659aa14a9SRui Paulo 18759aa14a9SRui Paulo if (!have_addr) { 18859aa14a9SRui Paulo db_printf("usage: show mesh <addr>\n"); 18959aa14a9SRui Paulo return; 19059aa14a9SRui Paulo } 19159aa14a9SRui Paulo ms = (const struct ieee80211_mesh_state *) addr; 19259aa14a9SRui Paulo _db_show_mesh(ms); 19359aa14a9SRui Paulo } 19459aa14a9SRui Paulo #endif /* IEEE80211_SUPPORT_MESH */ 19559aa14a9SRui Paulo 196b032f27cSSam Leffler static void 197b032f27cSSam Leffler _db_show_txampdu(const char *sep, int ix, const struct ieee80211_tx_ampdu *tap) 198b032f27cSSam Leffler { 19986629111SSam Leffler db_printf("%stxampdu[%d]: %p flags %b %s\n", 2007f6a5468SSam Leffler sep, ix, tap, tap->txa_flags, IEEE80211_AGGR_BITS, 2012aa563dfSAdrian Chadd ieee80211_wme_acnames[TID_TO_WME_AC(tap->txa_tid)]); 2027f6a5468SSam Leffler db_printf("%s token %u lastsample %d pkts %d avgpps %d qbytes %d qframes %d\n", 2037f6a5468SSam Leffler sep, tap->txa_token, tap->txa_lastsample, tap->txa_pkts, 2047f6a5468SSam Leffler tap->txa_avgpps, tap->txa_qbytes, tap->txa_qframes); 2057f6a5468SSam Leffler db_printf("%s start %u seqpending %u wnd %u attempts %d nextrequest %d\n", 2067f6a5468SSam Leffler sep, tap->txa_start, tap->txa_seqpending, tap->txa_wnd, 2077f6a5468SSam Leffler tap->txa_attempts, tap->txa_nextrequest); 2087f6a5468SSam Leffler /* XXX timer */ 209b032f27cSSam Leffler } 210b032f27cSSam Leffler 211b032f27cSSam Leffler static void 212b032f27cSSam Leffler _db_show_rxampdu(const char *sep, int ix, const struct ieee80211_rx_ampdu *rap) 213b032f27cSSam Leffler { 2141209ded2SAdrian Chadd struct mbuf *m; 2157f6a5468SSam Leffler int i; 2167f6a5468SSam Leffler 217b032f27cSSam Leffler db_printf("%srxampdu[%d]: %p flags 0x%x tid %u\n", 218b032f27cSSam Leffler sep, ix, rap, rap->rxa_flags, ix /*XXX */); 219b032f27cSSam Leffler db_printf("%s qbytes %d qframes %d seqstart %u start %u wnd %u\n", 220b032f27cSSam Leffler sep, rap->rxa_qbytes, rap->rxa_qframes, 221b032f27cSSam Leffler rap->rxa_seqstart, rap->rxa_start, rap->rxa_wnd); 2227f6a5468SSam Leffler db_printf("%s age %d nframes %d\n", sep, 2237f6a5468SSam Leffler rap->rxa_age, rap->rxa_nframes); 2247f6a5468SSam Leffler for (i = 0; i < IEEE80211_AGGR_BAWMAX; i++) 2258cb9b68fSJohn Baldwin if (!mbufq_empty(&rap->rxa_mq[i])) { 2261209ded2SAdrian Chadd db_printf("%s m[%2u:%4u] ", sep, i, 2271209ded2SAdrian Chadd IEEE80211_SEQ_ADD(rap->rxa_start, i)); 2281209ded2SAdrian Chadd STAILQ_FOREACH(m, &rap->rxa_mq[i].mq_head, 2291209ded2SAdrian Chadd m_stailqpkt) { 2301209ded2SAdrian Chadd db_printf(" %p", m); 2311209ded2SAdrian Chadd } 2321209ded2SAdrian Chadd db_printf("\n"); 2331209ded2SAdrian Chadd } 234b032f27cSSam Leffler } 235b032f27cSSam Leffler 236b032f27cSSam Leffler static void 237b032f27cSSam Leffler _db_show_sta(const struct ieee80211_node *ni) 238b032f27cSSam Leffler { 239b032f27cSSam Leffler int i; 240b032f27cSSam Leffler 2415c9f9929SBjoern A. Zeeb db_printf("STA: %p: mac %s refcnt %d\n", ni, 242b032f27cSSam Leffler ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)); 243b032f27cSSam Leffler db_printf("\tvap %p wdsvap %p ic %p table %p\n", 244b032f27cSSam Leffler ni->ni_vap, ni->ni_wdsvap, ni->ni_ic, ni->ni_table); 245b032f27cSSam Leffler db_printf("\tflags=%b\n", ni->ni_flags, IEEE80211_NODE_BITS); 24603475bd0SAdrian Chadd db_printf("\tauthmode %u ath_flags 0x%x ath_defkeyix %u\n", 24703475bd0SAdrian Chadd ni->ni_authmode, ni->ni_ath_flags, ni->ni_ath_defkeyix); 248b032f27cSSam Leffler db_printf("\tassocid 0x%x txpower %u vlan %u\n", 249b032f27cSSam Leffler ni->ni_associd, ni->ni_txpower, ni->ni_vlan); 250b032f27cSSam Leffler db_printf("\tjointime %d (%lu secs) challenge %p\n", 251b032f27cSSam Leffler ni->ni_jointime, (unsigned long)(time_uptime - ni->ni_jointime), 252b032f27cSSam Leffler ni->ni_challenge); 253b032f27cSSam Leffler db_printf("\ties: data %p len %d\n", ni->ni_ies.data, ni->ni_ies.len); 254b032f27cSSam Leffler db_printf("\t[wpa_ie %p rsn_ie %p wme_ie %p ath_ie %p\n", 255b032f27cSSam Leffler ni->ni_ies.wpa_ie, ni->ni_ies.rsn_ie, ni->ni_ies.wme_ie, 256b032f27cSSam Leffler ni->ni_ies.ath_ie); 257b032f27cSSam Leffler db_printf("\t htcap_ie %p htinfo_ie %p]\n", 258b032f27cSSam Leffler ni->ni_ies.htcap_ie, ni->ni_ies.htinfo_ie); 2595c9f9929SBjoern A. Zeeb db_printf("\t vhtcap_ie %p vhtopmode_ie %p vhtpwrenv_ie %p]\n", 2605c9f9929SBjoern A. Zeeb ni->ni_ies.vhtcap_ie, ni->ni_ies.vhtopmode_ie, 2615c9f9929SBjoern A. Zeeb ni->ni_ies.vhtpwrenv_ie); 26243049c48SSam Leffler if (ni->ni_flags & IEEE80211_NODE_QOS) { 26343049c48SSam Leffler for (i = 0; i < WME_NUM_TID; i++) { 26443049c48SSam Leffler if (ni->ni_txseqs[i] || ni->ni_rxseqs[i]) 26543049c48SSam Leffler db_printf("\t[%u] txseq %u rxseq %u fragno %u\n", 26643049c48SSam Leffler i, ni->ni_txseqs[i], 26743049c48SSam Leffler ni->ni_rxseqs[i] >> IEEE80211_SEQ_SEQ_SHIFT, 26843049c48SSam Leffler ni->ni_rxseqs[i] & IEEE80211_SEQ_FRAG_MASK); 26943049c48SSam Leffler } 27043049c48SSam Leffler } 2715c9f9929SBjoern A. Zeeb 272b032f27cSSam Leffler db_printf("\ttxseq %u rxseq %u fragno %u rxfragstamp %u\n", 273b032f27cSSam Leffler ni->ni_txseqs[IEEE80211_NONQOS_TID], 274b032f27cSSam Leffler ni->ni_rxseqs[IEEE80211_NONQOS_TID] >> IEEE80211_SEQ_SEQ_SHIFT, 275b032f27cSSam Leffler ni->ni_rxseqs[IEEE80211_NONQOS_TID] & IEEE80211_SEQ_FRAG_MASK, 276b032f27cSSam Leffler ni->ni_rxfragstamp); 277b032f27cSSam Leffler db_printf("\trxfrag[0] %p rxfrag[1] %p rxfrag[2] %p\n", 278b032f27cSSam Leffler ni->ni_rxfrag[0], ni->ni_rxfrag[1], ni->ni_rxfrag[2]); 279f2ce0f51SSam Leffler _db_show_key("\tucastkey", 0, &ni->ni_ucastkey); 2805463c4a4SSam Leffler db_printf("\tavgrssi 0x%x (rssi %d) noise %d\n", 2815463c4a4SSam Leffler ni->ni_avgrssi, IEEE80211_RSSI_GET(ni->ni_avgrssi), 2825463c4a4SSam Leffler ni->ni_noise); 283b032f27cSSam Leffler db_printf("\tintval %u capinfo %b\n", 284b032f27cSSam Leffler ni->ni_intval, ni->ni_capinfo, IEEE80211_CAPINFO_BITS); 285b032f27cSSam Leffler db_printf("\tbssid %s", ether_sprintf(ni->ni_bssid)); 286b032f27cSSam Leffler _db_show_ssid(" essid ", 0, ni->ni_esslen, ni->ni_essid); 287b032f27cSSam Leffler db_printf("\n"); 288b032f27cSSam Leffler _db_show_channel("\tchannel", ni->ni_chan); 289b032f27cSSam Leffler db_printf("\n"); 290b032f27cSSam Leffler db_printf("\terp %b dtim_period %u dtim_count %u\n", 291b032f27cSSam Leffler ni->ni_erp, IEEE80211_ERP_BITS, 292b032f27cSSam Leffler ni->ni_dtim_period, ni->ni_dtim_count); 293b032f27cSSam Leffler 294b032f27cSSam Leffler db_printf("\thtcap %b htparam 0x%x htctlchan %u ht2ndchan %u\n", 295b032f27cSSam Leffler ni->ni_htcap, IEEE80211_HTCAP_BITS, 296b032f27cSSam Leffler ni->ni_htparam, ni->ni_htctlchan, ni->ni_ht2ndchan); 297*2c8b0d62SBjoern A. Zeeb db_printf("\thtopmode 0x%x htstbc 0x%x chw %d (%s)\n", 298ca389486SBjoern A. Zeeb ni->ni_htopmode, ni->ni_htstbc, 299*2c8b0d62SBjoern A. Zeeb ni->ni_chw, ieee80211_ni_chw_to_str(ni->ni_chw)); 300b032f27cSSam Leffler 301b032f27cSSam Leffler /* XXX ampdu state */ 3022aa563dfSAdrian Chadd for (i = 0; i < WME_NUM_TID; i++) 303b032f27cSSam Leffler if (ni->ni_tx_ampdu[i].txa_flags & IEEE80211_AGGR_SETUP) 304b032f27cSSam Leffler _db_show_txampdu("\t", i, &ni->ni_tx_ampdu[i]); 305b032f27cSSam Leffler for (i = 0; i < WME_NUM_TID; i++) 30643049c48SSam Leffler if (ni->ni_rx_ampdu[i].rxa_flags) 307b032f27cSSam Leffler _db_show_rxampdu("\t", i, &ni->ni_rx_ampdu[i]); 308b032f27cSSam Leffler 309b032f27cSSam Leffler db_printf("\tinact %u inact_reload %u txrate %u\n", 310b032f27cSSam Leffler ni->ni_inact, ni->ni_inact_reload, ni->ni_txrate); 31159aa14a9SRui Paulo #ifdef IEEE80211_SUPPORT_MESH 31259aa14a9SRui Paulo _db_show_ssid("\tmeshid ", 0, ni->ni_meshidlen, ni->ni_meshid); 31359aa14a9SRui Paulo db_printf(" mlstate %b mllid 0x%x mlpid 0x%x mlrcnt %u mltval %u\n", 31459aa14a9SRui Paulo ni->ni_mlstate, IEEE80211_MESH_MLSTATE_BITS, 31559aa14a9SRui Paulo ni->ni_mllid, ni->ni_mlpid, ni->ni_mlrcnt, ni->ni_mltval); 31659aa14a9SRui Paulo #endif 3175c9f9929SBjoern A. Zeeb 3185c9f9929SBjoern A. Zeeb /* VHT state */ 3195c9f9929SBjoern A. Zeeb db_printf("\tvhtcap %b vht_basicmcs %#06x vht_pad2 %#06x\n", 3205c9f9929SBjoern A. Zeeb ni->ni_vhtcap, IEEE80211_VHTCAP_BITS, 3215c9f9929SBjoern A. Zeeb ni->ni_vht_basicmcs, ni->ni_vht_pad2); 3225c9f9929SBjoern A. Zeeb db_printf("\tvht_mcsinfo: { rx_mcs_map %#06x rx_highest %#06x " 3235c9f9929SBjoern A. Zeeb "tx_mcs_map %#06x tx_highest %#06x }\n", 3245c9f9929SBjoern A. Zeeb ni->ni_vht_mcsinfo.rx_mcs_map, ni->ni_vht_mcsinfo.rx_highest, 3255c9f9929SBjoern A. Zeeb ni->ni_vht_mcsinfo.tx_mcs_map, ni->ni_vht_mcsinfo.tx_highest); 3265c9f9929SBjoern A. Zeeb db_printf("\tvht_chan1/chan2 %u/%u vht_chanwidth %#04x\n", 3275c9f9929SBjoern A. Zeeb ni->ni_vht_chan1, ni->ni_vht_chan2, ni->ni_vht_chanwidth); 3285c9f9929SBjoern A. Zeeb db_printf("\tvht_pad1 %#04x vht_spare { %#x %#x %#x %#x %#x %#x %#x %#x }\n", 3295c9f9929SBjoern A. Zeeb ni->ni_vht_pad1, ni->ni_vht_spare[0], ni->ni_vht_spare[1], 3305c9f9929SBjoern A. Zeeb ni->ni_vht_spare[2], ni->ni_vht_spare[3], ni->ni_vht_spare[4], 3315c9f9929SBjoern A. Zeeb ni->ni_vht_spare[5], ni->ni_vht_spare[6], ni->ni_vht_spare[7]); 3324ed35b7dSBjoern A. Zeeb 3334ed35b7dSBjoern A. Zeeb db_printf("\tni_tx_superg[] = {"); 3344ed35b7dSBjoern A. Zeeb for (i = 0; i < WME_NUM_TID; i++) 3354ed35b7dSBjoern A. Zeeb db_printf(" %p%s", ni->ni_tx_superg[i], (i == 0) ? "" : ","); 3364ed35b7dSBjoern A. Zeeb db_printf(" }\n"); 3374ed35b7dSBjoern A. Zeeb 3384ed35b7dSBjoern A. Zeeb db_printf("\tni_rctls = %p", ni->ni_rctls); 3394ed35b7dSBjoern A. Zeeb db_printf("\tni_drv_data = %p", ni->ni_drv_data); 3404ed35b7dSBjoern A. Zeeb db_printf("\n"); 3414ed35b7dSBjoern A. Zeeb 3424ed35b7dSBjoern A. Zeeb db_printf("\tni_spare[3] = { %#jx %#jx %#jx }", 3434ed35b7dSBjoern A. Zeeb ni->ni_spare[0], ni->ni_spare[1], ni->ni_spare[2]); 3444ed35b7dSBjoern A. Zeeb db_printf("\n"); 3454ed35b7dSBjoern A. Zeeb 3464ed35b7dSBjoern A. Zeeb #ifdef __notyet__ 3474ed35b7dSBjoern A. Zeeb struct ieee80211_psq ni_psq; /* power save queue */ 3484ed35b7dSBjoern A. Zeeb struct ieee80211_nodestats ni_stats; /* per-node statistics */ 3494ed35b7dSBjoern A. Zeeb 3504ed35b7dSBjoern A. Zeeb /* quiet time IE state for the given node */ 3514ed35b7dSBjoern A. Zeeb uint32_t ni_quiet_ie_set; /* Quiet time IE was seen */ 3524ed35b7dSBjoern A. Zeeb struct ieee80211_quiet_ie ni_quiet_ie; /* last seen quiet IE */ 3534ed35b7dSBjoern A. Zeeb 3544ed35b7dSBjoern A. Zeeb /* U-APSD */ 3554ed35b7dSBjoern A. Zeeb uint8_t ni_uapsd; /* U-APSD per-node flags matching WMM STA QoS Info field */ 3564ed35b7dSBjoern A. Zeeb #endif 357b032f27cSSam Leffler } 358b032f27cSSam Leffler 3597f6a5468SSam Leffler #ifdef IEEE80211_SUPPORT_TDMA 3607f6a5468SSam Leffler static void 3617f6a5468SSam Leffler _db_show_tdma(const char *sep, const struct ieee80211_tdma_state *ts, int showprocs) 3627f6a5468SSam Leffler { 3637f6a5468SSam Leffler db_printf("%stdma %p:\n", sep, ts); 364ce7fa847SSam Leffler db_printf("%s version %u slot %u bintval %u peer %p\n", sep, 365ce7fa847SSam Leffler ts->tdma_version, ts->tdma_slot, ts->tdma_bintval, ts->tdma_peer); 366ce7fa847SSam Leffler db_printf("%s slotlen %u slotcnt %u", sep, 3677f6a5468SSam Leffler ts->tdma_slotlen, ts->tdma_slotcnt); 368ce7fa847SSam Leffler db_printf(" inuse 0x%x active 0x%x count %d\n", 3697f6a5468SSam Leffler ts->tdma_inuse[0], ts->tdma_active[0], ts->tdma_count); 3707f6a5468SSam Leffler if (showprocs) { 3717f6a5468SSam Leffler DB_PRINTSYM(sep, " tdma_newstate", ts->tdma_newstate); 3727f6a5468SSam Leffler DB_PRINTSYM(sep, " tdma_recv_mgmt", ts->tdma_recv_mgmt); 3737f6a5468SSam Leffler DB_PRINTSYM(sep, " tdma_opdetach", ts->tdma_opdetach); 3747f6a5468SSam Leffler } 3757f6a5468SSam Leffler } 3767f6a5468SSam Leffler #endif /* IEEE80211_SUPPORT_TDMA */ 3777f6a5468SSam Leffler 378b032f27cSSam Leffler static void 37933396ec2SBjoern A. Zeeb _db_show_scan(const struct ieee80211_scan_state *ss, int showprocs) 38033396ec2SBjoern A. Zeeb { 38133396ec2SBjoern A. Zeeb int i; 38233396ec2SBjoern A. Zeeb const struct ieee80211_scanner *ss_ops; 38333396ec2SBjoern A. Zeeb 38433396ec2SBjoern A. Zeeb db_printf("SCAN %p:", ss); 38533396ec2SBjoern A. Zeeb db_printf(" vap %p ic %p", ss->ss_vap, ss->ss_ic); 38633396ec2SBjoern A. Zeeb db_printf("\n"); 38733396ec2SBjoern A. Zeeb 38833396ec2SBjoern A. Zeeb db_printf("\tss_ops %p (%s) ss_priv %p", 38933396ec2SBjoern A. Zeeb ss->ss_ops, ss->ss_ops->scan_name, ss->ss_priv); 39033396ec2SBjoern A. Zeeb db_printf("\n"); 39133396ec2SBjoern A. Zeeb if (showprocs) { 39233396ec2SBjoern A. Zeeb ss_ops = ss->ss_ops; 39333396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_attach", ss_ops->scan_attach); 39433396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_detach", ss_ops->scan_detach); 39533396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_start", ss_ops->scan_start); 39633396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_restart", ss_ops->scan_restart); 39733396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_cancel", ss_ops->scan_cancel); 39833396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_end", ss_ops->scan_end); 39933396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_flush", ss_ops->scan_flush); 40033396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_pickchan", ss_ops->scan_pickchan); 40133396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_add", ss_ops->scan_add); 40233396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_age", ss_ops->scan_age); 40333396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_assoc_fail", ss_ops->scan_assoc_fail); 40433396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_assoc_success", ss_ops->scan_assoc_success); 40533396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_iterate", ss_ops->scan_iterate); 40633396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_spare0", ss_ops->scan_spare0); 40733396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_spare1", ss_ops->scan_spare1); 40833396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_spare2", ss_ops->scan_spare2); 40933396ec2SBjoern A. Zeeb DB_PRINTSYM("\t", "scan_spare3", ss_ops->scan_spare3); 41033396ec2SBjoern A. Zeeb } 41133396ec2SBjoern A. Zeeb 41233396ec2SBjoern A. Zeeb db_printf("\tss_flags %b", ss->ss_flags, IEEE80211_SS_FLAGS_BITS); 41333396ec2SBjoern A. Zeeb db_printf("\n"); 41433396ec2SBjoern A. Zeeb 41533396ec2SBjoern A. Zeeb db_printf("\tss_nssid %u", ss->ss_nssid); 41633396ec2SBjoern A. Zeeb for (i = 0; i < ss->ss_nssid && i < IEEE80211_SCAN_MAX_SSID; i++) 41733396ec2SBjoern A. Zeeb _db_show_ssid(" ss_nssid[%d]", i, 41833396ec2SBjoern A. Zeeb ss->ss_ssid[i].len, ss->ss_ssid[i].ssid); 41933396ec2SBjoern A. Zeeb db_printf("\n"); 42033396ec2SBjoern A. Zeeb 42133396ec2SBjoern A. Zeeb db_printf("\tss_chans:\n"); 42233396ec2SBjoern A. Zeeb for (i = 0; i < ss->ss_last && i < IEEE80211_SCAN_MAX; i++) { 42333396ec2SBjoern A. Zeeb db_printf("\t%-3d", i); 42433396ec2SBjoern A. Zeeb _db_show_channel(" ", ss->ss_chans[i]); 42533396ec2SBjoern A. Zeeb db_printf("\n"); 42633396ec2SBjoern A. Zeeb } 42733396ec2SBjoern A. Zeeb 42833396ec2SBjoern A. Zeeb db_printf("\tss_next %u ss_last %u ss_mindwell %lu ss_maxdwell %lu", 42933396ec2SBjoern A. Zeeb ss->ss_next, ss->ss_last, ss->ss_mindwell, ss->ss_maxdwell); 43033396ec2SBjoern A. Zeeb db_printf("\n"); 43133396ec2SBjoern A. Zeeb } 43233396ec2SBjoern A. Zeeb 43333396ec2SBjoern A. Zeeb static void 4344ed35b7dSBjoern A. Zeeb _db_show_rate(const struct ieee80211_ratectl *rate, const void *rs, 4354ed35b7dSBjoern A. Zeeb const int showprocs) 4364ed35b7dSBjoern A. Zeeb { 4374ed35b7dSBjoern A. Zeeb 4384ed35b7dSBjoern A. Zeeb db_printf("\tiv_rate %p", rate); 4394ed35b7dSBjoern A. Zeeb db_printf(" iv_rs %p", rs); 4404ed35b7dSBjoern A. Zeeb db_printf("\n"); 4414ed35b7dSBjoern A. Zeeb if (showprocs) { 4424ed35b7dSBjoern A. Zeeb db_printf("\t ir_name %s", rate->ir_name); 4434ed35b7dSBjoern A. Zeeb db_printf("\n"); 4444ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_attach", rate->ir_attach); 4454ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_detach", rate->ir_detach); 4464ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_init", rate->ir_init); 4474ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_deinit", rate->ir_deinit); 4484ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_node_init", rate->ir_node_init); 4494ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_node_deinit", rate->ir_node_deinit); 4504ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_rate", rate->ir_rate); 4514ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_tx_complete", rate->ir_tx_complete); 4524ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_tx_update", rate->ir_tx_update); 4534ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_setinterval", rate->ir_setinterval); 4544ed35b7dSBjoern A. Zeeb DB_PRINTSYM("\t ", "ir_node_stats", rate->ir_node_stats); 4554ed35b7dSBjoern A. Zeeb } 4564ed35b7dSBjoern A. Zeeb } 4574ed35b7dSBjoern A. Zeeb 4584ed35b7dSBjoern A. Zeeb static void 45962f07485SMonthadar Al Jaberi _db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs) 460b032f27cSSam Leffler { 461b032f27cSSam Leffler const struct ieee80211com *ic = vap->iv_ic; 462b032f27cSSam Leffler int i; 463b032f27cSSam Leffler 4645c9f9929SBjoern A. Zeeb db_printf("VAP %p:", vap); 465b032f27cSSam Leffler db_printf(" bss %p", vap->iv_bss); 466b032f27cSSam Leffler db_printf(" myaddr %s", ether_sprintf(vap->iv_myaddr)); 467b032f27cSSam Leffler db_printf("\n"); 468b032f27cSSam Leffler 469b032f27cSSam Leffler db_printf("\topmode %s", ieee80211_opmode_name[vap->iv_opmode]); 47062f07485SMonthadar Al Jaberi #ifdef IEEE80211_SUPPORT_MESH 47162f07485SMonthadar Al Jaberi if (vap->iv_opmode == IEEE80211_M_MBSS) 47262f07485SMonthadar Al Jaberi db_printf("(%p)", vap->iv_mesh); 47362f07485SMonthadar Al Jaberi #endif 474713db49dSBjoern A. Zeeb db_printf(" state %#x %s", vap->iv_state, 475713db49dSBjoern A. Zeeb ieee80211_state_name[vap->iv_state]); 4763d0d5b21SJustin Hibbits db_printf(" ifp %p(%s)", vap->iv_ifp, if_name(vap->iv_ifp)); 477b032f27cSSam Leffler db_printf("\n"); 478b032f27cSSam Leffler 479b032f27cSSam Leffler db_printf("\tic %p", vap->iv_ic); 480b032f27cSSam Leffler db_printf(" media %p", &vap->iv_media); 481b032f27cSSam Leffler db_printf(" bpf_if %p", vap->iv_rawbpf); 482b032f27cSSam Leffler db_printf(" mgtsend %p", &vap->iv_mgtsend); 483b032f27cSSam Leffler #if 0 484b032f27cSSam Leffler struct sysctllog *iv_sysctl; /* dynamic sysctl context */ 485b032f27cSSam Leffler #endif 486b032f27cSSam Leffler db_printf("\n"); 487713db49dSBjoern A. Zeeb 488713db49dSBjoern A. Zeeb db_printf("\tiv_nstate %#x %s iv_nstate_b %d iv_nstate_n %d\n", 489713db49dSBjoern A. Zeeb vap->iv_nstate, ieee80211_state_name[vap->iv_nstate], /* historic */ 490713db49dSBjoern A. Zeeb vap->iv_nstate_b, vap->iv_nstate_n); 491713db49dSBjoern A. Zeeb for (i = 0; i < NET80211_IV_NSTATE_NUM; i++) { 492713db49dSBjoern A. Zeeb db_printf("\t [%d] iv_nstates %#x %s _task %p _args %d\n", i, 493713db49dSBjoern A. Zeeb vap->iv_nstates[i], ieee80211_state_name[vap->iv_nstates[i]], 494713db49dSBjoern A. Zeeb &vap->iv_nstate_task[i], vap->iv_nstate_args[i]); 495713db49dSBjoern A. Zeeb } 496713db49dSBjoern A. Zeeb 497b032f27cSSam Leffler db_printf("\tdebug=%b\n", vap->iv_debug, IEEE80211_MSG_BITS); 498b032f27cSSam Leffler 499b032f27cSSam Leffler db_printf("\tflags=%b\n", vap->iv_flags, IEEE80211_F_BITS); 500b032f27cSSam Leffler db_printf("\tflags_ext=%b\n", vap->iv_flags_ext, IEEE80211_FEXT_BITS); 501ee5cf106SSam Leffler db_printf("\tflags_ht=%b\n", vap->iv_flags_ht, IEEE80211_FHT_BITS); 502b032f27cSSam Leffler db_printf("\tflags_ven=%b\n", vap->iv_flags_ven, IEEE80211_FVEN_BITS); 503b032f27cSSam Leffler db_printf("\tcaps=%b\n", vap->iv_caps, IEEE80211_C_BITS); 504b032f27cSSam Leffler db_printf("\thtcaps=%b\n", vap->iv_htcaps, IEEE80211_C_HTCAP_BITS); 505fbba0d6bSBjoern A. Zeeb db_printf("\tvhtcap=%b\n", vap->iv_vht_cap.vht_cap_info, IEEE80211_VHTCAP_BITS); 506b032f27cSSam Leffler 507b032f27cSSam Leffler _db_show_stats(&vap->iv_stats); 508b032f27cSSam Leffler 509b032f27cSSam Leffler db_printf("\tinact_init %d", vap->iv_inact_init); 510b032f27cSSam Leffler db_printf(" inact_auth %d", vap->iv_inact_auth); 511b032f27cSSam Leffler db_printf(" inact_run %d", vap->iv_inact_run); 512b032f27cSSam Leffler db_printf(" inact_probe %d", vap->iv_inact_probe); 513b032f27cSSam Leffler db_printf("\n"); 514b032f27cSSam Leffler 515b032f27cSSam Leffler db_printf("\tdes_nssid %d", vap->iv_des_nssid); 516b032f27cSSam Leffler if (vap->iv_des_nssid) 517b032f27cSSam Leffler _db_show_ssid(" des_ssid[%u] ", 0, 518b032f27cSSam Leffler vap->iv_des_ssid[0].len, vap->iv_des_ssid[0].ssid); 519b032f27cSSam Leffler db_printf(" des_bssid %s", ether_sprintf(vap->iv_des_bssid)); 520b032f27cSSam Leffler db_printf("\n"); 521b032f27cSSam Leffler db_printf("\tdes_mode %d", vap->iv_des_mode); 522b032f27cSSam Leffler _db_show_channel(" des_chan", vap->iv_des_chan); 523b032f27cSSam Leffler db_printf("\n"); 524b032f27cSSam Leffler #if 0 525b032f27cSSam Leffler int iv_nicknamelen; /* XXX junk */ 526b032f27cSSam Leffler uint8_t iv_nickname[IEEE80211_NWID_LEN]; 527b032f27cSSam Leffler #endif 528b032f27cSSam Leffler db_printf("\tbgscanidle %u", vap->iv_bgscanidle); 529b032f27cSSam Leffler db_printf(" bgscanintvl %u", vap->iv_bgscanintvl); 530b032f27cSSam Leffler db_printf(" scanvalid %u", vap->iv_scanvalid); 531b032f27cSSam Leffler db_printf("\n"); 532b032f27cSSam Leffler db_printf("\tscanreq_duration %u", vap->iv_scanreq_duration); 533b032f27cSSam Leffler db_printf(" scanreq_mindwell %u", vap->iv_scanreq_mindwell); 534b032f27cSSam Leffler db_printf(" scanreq_maxdwell %u", vap->iv_scanreq_maxdwell); 535b032f27cSSam Leffler db_printf("\n"); 5367f6a5468SSam Leffler db_printf("\tscanreq_flags 0x%x", vap->iv_scanreq_flags); 5377f6a5468SSam Leffler db_printf(" scanreq_nssid %d", vap->iv_scanreq_nssid); 538b032f27cSSam Leffler for (i = 0; i < vap->iv_scanreq_nssid; i++) 539b032f27cSSam Leffler _db_show_ssid(" scanreq_ssid[%u]", i, 540b032f27cSSam Leffler vap->iv_scanreq_ssid[i].len, vap->iv_scanreq_ssid[i].ssid); 541b032f27cSSam Leffler db_printf(" roaming %d", vap->iv_roaming); 542b032f27cSSam Leffler db_printf("\n"); 543b032f27cSSam Leffler for (i = IEEE80211_MODE_11A; i < IEEE80211_MODE_MAX; i++) 544b032f27cSSam Leffler if (isset(ic->ic_modecaps, i)) { 545b032f27cSSam Leffler _db_show_roamparams("\troamparms[%s]", 546b032f27cSSam Leffler ieee80211_phymode_name[i], &vap->iv_roamparms[i]); 547b032f27cSSam Leffler db_printf("\n"); 548b032f27cSSam Leffler } 549b032f27cSSam Leffler 550b032f27cSSam Leffler db_printf("\tbmissthreshold %u", vap->iv_bmissthreshold); 551b032f27cSSam Leffler db_printf(" bmiss_max %u", vap->iv_bmiss_count); 552b032f27cSSam Leffler db_printf(" bmiss_max %d", vap->iv_bmiss_max); 553b032f27cSSam Leffler db_printf("\n"); 554b032f27cSSam Leffler db_printf("\tswbmiss_count %u", vap->iv_swbmiss_count); 555b032f27cSSam Leffler db_printf(" swbmiss_period %u", vap->iv_swbmiss_period); 556b032f27cSSam Leffler db_printf(" swbmiss %p", &vap->iv_swbmiss); 557b032f27cSSam Leffler db_printf("\n"); 558b032f27cSSam Leffler 559b032f27cSSam Leffler db_printf("\tampdu_rxmax %d", vap->iv_ampdu_rxmax); 560b032f27cSSam Leffler db_printf(" ampdu_density %d", vap->iv_ampdu_density); 561b032f27cSSam Leffler db_printf(" ampdu_limit %d", vap->iv_ampdu_limit); 562b032f27cSSam Leffler db_printf(" amsdu_limit %d", vap->iv_amsdu_limit); 563b032f27cSSam Leffler db_printf("\n"); 564b032f27cSSam Leffler 565b032f27cSSam Leffler db_printf("\tmax_aid %u", vap->iv_max_aid); 566b032f27cSSam Leffler db_printf(" aid_bitmap %p", vap->iv_aid_bitmap); 567b032f27cSSam Leffler db_printf("\n"); 568b032f27cSSam Leffler db_printf("\tsta_assoc %u", vap->iv_sta_assoc); 569b032f27cSSam Leffler db_printf(" ps_sta %u", vap->iv_ps_sta); 570b032f27cSSam Leffler db_printf(" ps_pending %u", vap->iv_ps_pending); 571b032f27cSSam Leffler db_printf(" tim_len %u", vap->iv_tim_len); 572b032f27cSSam Leffler db_printf(" tim_bitmap %p", vap->iv_tim_bitmap); 573b032f27cSSam Leffler db_printf("\n"); 574b032f27cSSam Leffler db_printf("\tdtim_period %u", vap->iv_dtim_period); 575b032f27cSSam Leffler db_printf(" dtim_count %u", vap->iv_dtim_count); 576b032f27cSSam Leffler db_printf(" set_tim %p", vap->iv_set_tim); 577b032f27cSSam Leffler db_printf(" csa_count %d", vap->iv_csa_count); 578b032f27cSSam Leffler db_printf("\n"); 579b032f27cSSam Leffler 580b032f27cSSam Leffler db_printf("\trtsthreshold %u", vap->iv_rtsthreshold); 581b032f27cSSam Leffler db_printf(" fragthreshold %u", vap->iv_fragthreshold); 582b032f27cSSam Leffler db_printf(" inact_timer %d", vap->iv_inact_timer); 583b032f27cSSam Leffler db_printf("\n"); 584b032f27cSSam Leffler for (i = IEEE80211_MODE_11A; i < IEEE80211_MODE_MAX; i++) 585b032f27cSSam Leffler if (isset(ic->ic_modecaps, i)) { 586b032f27cSSam Leffler _db_show_txparams("\ttxparms[%s]", 587b032f27cSSam Leffler ieee80211_phymode_name[i], &vap->iv_txparms[i]); 588b032f27cSSam Leffler db_printf("\n"); 589b032f27cSSam Leffler } 590b032f27cSSam Leffler 591b032f27cSSam Leffler /* application-specified IE's to attach to mgt frames */ 592b032f27cSSam Leffler _db_show_appie("\tappie_beacon", vap->iv_appie_beacon); 593b032f27cSSam Leffler _db_show_appie("\tappie_probereq", vap->iv_appie_probereq); 594b032f27cSSam Leffler _db_show_appie("\tappie_proberesp", vap->iv_appie_proberesp); 595b032f27cSSam Leffler _db_show_appie("\tappie_assocreq", vap->iv_appie_assocreq); 596b032f27cSSam Leffler _db_show_appie("\tappie_asscoresp", vap->iv_appie_assocresp); 597b032f27cSSam Leffler _db_show_appie("\tappie_wpa", vap->iv_appie_wpa); 598b032f27cSSam Leffler if (vap->iv_wpa_ie != NULL || vap->iv_rsn_ie != NULL) { 599b032f27cSSam Leffler if (vap->iv_wpa_ie != NULL) 600b032f27cSSam Leffler db_printf("\twpa_ie %p", vap->iv_wpa_ie); 601b032f27cSSam Leffler if (vap->iv_rsn_ie != NULL) 602b032f27cSSam Leffler db_printf("\trsn_ie %p", vap->iv_rsn_ie); 603b032f27cSSam Leffler db_printf("\n"); 604b032f27cSSam Leffler } 605b032f27cSSam Leffler db_printf("\tmax_keyix %u", vap->iv_max_keyix); 606b032f27cSSam Leffler db_printf(" def_txkey %d", vap->iv_def_txkey); 607b032f27cSSam Leffler db_printf("\n"); 608b032f27cSSam Leffler for (i = 0; i < IEEE80211_WEP_NKID; i++) 609b032f27cSSam Leffler _db_show_key("\tnw_keys[%u]", i, &vap->iv_nw_keys[i]); 610b032f27cSSam Leffler 6117f6a5468SSam Leffler db_printf("\tauth %p(%s)", vap->iv_auth, vap->iv_auth->ia_name); 612b032f27cSSam Leffler db_printf(" ec %p", vap->iv_ec); 613b032f27cSSam Leffler 614b032f27cSSam Leffler db_printf(" acl %p", vap->iv_acl); 615b032f27cSSam Leffler db_printf(" as %p", vap->iv_as); 616b032f27cSSam Leffler db_printf("\n"); 61762f07485SMonthadar Al Jaberi #ifdef IEEE80211_SUPPORT_MESH 61862f07485SMonthadar Al Jaberi if (showmesh && vap->iv_mesh != NULL) 61962f07485SMonthadar Al Jaberi _db_show_mesh(vap->iv_mesh); 62062f07485SMonthadar Al Jaberi #endif 6217f6a5468SSam Leffler #ifdef IEEE80211_SUPPORT_TDMA 6227f6a5468SSam Leffler if (vap->iv_tdma != NULL) 6237f6a5468SSam Leffler _db_show_tdma("\t", vap->iv_tdma, showprocs); 6247f6a5468SSam Leffler #endif /* IEEE80211_SUPPORT_TDMA */ 625f1481c8dSAdrian Chadd 626f1481c8dSAdrian Chadd db_printf("\tsta_assoc %u", vap->iv_sta_assoc); 627f1481c8dSAdrian Chadd db_printf(" ht_sta_assoc %u", vap->iv_ht_sta_assoc); 628f1481c8dSAdrian Chadd db_printf(" ht40_sta_assoc %u", vap->iv_ht40_sta_assoc); 629f1481c8dSAdrian Chadd db_printf("\n"); 630c45d05b7SBjoern A. Zeeb db_printf("\tnonerpsta %u", vap->iv_nonerpsta); 631f1481c8dSAdrian Chadd db_printf(" longslotsta %u", vap->iv_longslotsta); 632f1481c8dSAdrian Chadd db_printf(" lastnonerp %d", vap->iv_lastnonerp); 633f1481c8dSAdrian Chadd db_printf(" lastnonht %d", vap->iv_lastnonht); 634f1481c8dSAdrian Chadd db_printf("\n"); 6354ed35b7dSBjoern A. Zeeb if (vap->iv_rate != NULL) 6364ed35b7dSBjoern A. Zeeb _db_show_rate(vap->iv_rate, vap->iv_rs, showprocs); 637f1481c8dSAdrian Chadd 638b032f27cSSam Leffler if (showprocs) { 6397f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_key_alloc", vap->iv_key_alloc); 6407f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_key_delete", vap->iv_key_delete); 6417f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_key_set", vap->iv_key_set); 6427f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_key_update_begin", vap->iv_key_update_begin); 6437f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_key_update_end", vap->iv_key_update_end); 6447f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_opdetach", vap->iv_opdetach); 6457f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_input", vap->iv_input); 6467f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_recv_mgmt", vap->iv_recv_mgmt); 6477f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_deliver_data", vap->iv_deliver_data); 6487f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_bmiss", vap->iv_bmiss); 6497f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_reset", vap->iv_reset); 6507f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_update_beacon", vap->iv_update_beacon); 6517f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_newstate", vap->iv_newstate); 6527f6a5468SSam Leffler DB_PRINTSYM("\t", "iv_output", vap->iv_output); 653b032f27cSSam Leffler } 654b032f27cSSam Leffler } 655b032f27cSSam Leffler 656b032f27cSSam Leffler static void 65762f07485SMonthadar Al Jaberi _db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, 65833396ec2SBjoern A. Zeeb int showmesh, int showprocs, int showscan) 659b032f27cSSam Leffler { 660b032f27cSSam Leffler struct ieee80211vap *vap; 661b032f27cSSam Leffler 6625c9f9929SBjoern A. Zeeb db_printf("COM: %p:", ic); 663b032f27cSSam Leffler TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) 6643d0d5b21SJustin Hibbits db_printf(" %s(%p)", if_name(vap->iv_ifp), vap); 665b032f27cSSam Leffler db_printf("\n"); 6667a79cebfSGleb Smirnoff db_printf("\tsoftc %p", ic->ic_softc); 667c8f5794eSGleb Smirnoff db_printf("\tname %s", ic->ic_name); 668b032f27cSSam Leffler db_printf(" comlock %p", &ic->ic_comlock); 669cdc0cf21SAndriy Voskoboinyk db_printf(" txlock %p", &ic->ic_txlock); 670cdc0cf21SAndriy Voskoboinyk db_printf(" fflock %p", &ic->ic_fflock); 671b032f27cSSam Leffler db_printf("\n"); 672b032f27cSSam Leffler db_printf("\theadroom %d", ic->ic_headroom); 673b032f27cSSam Leffler db_printf(" phytype %d", ic->ic_phytype); 674b032f27cSSam Leffler db_printf(" opmode %s", ieee80211_opmode_name[ic->ic_opmode]); 675b032f27cSSam Leffler db_printf("\n"); 676c45d05b7SBjoern A. Zeeb db_printf("\tinact %p", &ic->ic_inact); 677b032f27cSSam Leffler db_printf("\n"); 678b032f27cSSam Leffler 679b032f27cSSam Leffler db_printf("\tflags=%b\n", ic->ic_flags, IEEE80211_F_BITS); 680b032f27cSSam Leffler db_printf("\tflags_ext=%b\n", ic->ic_flags_ext, IEEE80211_FEXT_BITS); 681ee5cf106SSam Leffler db_printf("\tflags_ht=%b\n", ic->ic_flags_ht, IEEE80211_FHT_BITS); 682b032f27cSSam Leffler db_printf("\tflags_ven=%b\n", ic->ic_flags_ven, IEEE80211_FVEN_BITS); 683b032f27cSSam Leffler db_printf("\tcaps=%b\n", ic->ic_caps, IEEE80211_C_BITS); 684b032f27cSSam Leffler db_printf("\tcryptocaps=%b\n", 6853d13a955SSam Leffler ic->ic_cryptocaps, IEEE80211_CRYPTO_BITS); 686b032f27cSSam Leffler db_printf("\thtcaps=%b\n", ic->ic_htcaps, IEEE80211_HTCAP_BITS); 687562adbe1SBjoern A. Zeeb db_printf("\tvhtcaps=%b\n", ic->ic_vht_cap.vht_cap_info, IEEE80211_VHTCAP_BITS); 688b032f27cSSam Leffler 689b032f27cSSam Leffler #if 0 690b032f27cSSam Leffler uint8_t ic_modecaps[2]; /* set of mode capabilities */ 691b032f27cSSam Leffler #endif 692b032f27cSSam Leffler db_printf("\tcurmode %u", ic->ic_curmode); 693b032f27cSSam Leffler db_printf(" promisc %u", ic->ic_promisc); 694b032f27cSSam Leffler db_printf(" allmulti %u", ic->ic_allmulti); 695b032f27cSSam Leffler db_printf(" nrunning %u", ic->ic_nrunning); 696b032f27cSSam Leffler db_printf("\n"); 697b032f27cSSam Leffler db_printf("\tbintval %u", ic->ic_bintval); 698b032f27cSSam Leffler db_printf(" lintval %u", ic->ic_lintval); 699b032f27cSSam Leffler db_printf(" holdover %u", ic->ic_holdover); 700b032f27cSSam Leffler db_printf(" txpowlimit %u", ic->ic_txpowlimit); 701b032f27cSSam Leffler db_printf("\n"); 702b032f27cSSam Leffler #if 0 703b032f27cSSam Leffler struct ieee80211_rateset ic_sup_rates[IEEE80211_MODE_MAX]; 704b032f27cSSam Leffler #endif 705b032f27cSSam Leffler /* 706b032f27cSSam Leffler * Channel state: 707b032f27cSSam Leffler * 708b032f27cSSam Leffler * ic_channels is the set of available channels for the device; 709b032f27cSSam Leffler * it is setup by the driver 710b032f27cSSam Leffler * ic_nchans is the number of valid entries in ic_channels 711b032f27cSSam Leffler * ic_chan_avail is a bit vector of these channels used to check 712b032f27cSSam Leffler * whether a channel is available w/o searching the channel table. 713b032f27cSSam Leffler * ic_chan_active is a (potentially) constrained subset of 714b032f27cSSam Leffler * ic_chan_avail that reflects any mode setting or user-specified 715b032f27cSSam Leffler * limit on the set of channels to use/scan 716b032f27cSSam Leffler * ic_curchan is the current channel the device is set to; it may 717b032f27cSSam Leffler * be different from ic_bsschan when we are off-channel scanning 718b032f27cSSam Leffler * or otherwise doing background work 719b032f27cSSam Leffler * ic_bsschan is the channel selected for operation; it may 720b032f27cSSam Leffler * be undefined (IEEE80211_CHAN_ANYC) 721b032f27cSSam Leffler * ic_prevchan is a cached ``previous channel'' used to optimize 722b032f27cSSam Leffler * lookups when switching back+forth between two channels 723b032f27cSSam Leffler * (e.g. for dynamic turbo) 724b032f27cSSam Leffler */ 725b032f27cSSam Leffler db_printf("\tnchans %d", ic->ic_nchans); 726b032f27cSSam Leffler #if 0 72731378b1cSSam Leffler struct ieee80211_channel ic_channels[IEEE80211_CHAN_MAX]; 728b032f27cSSam Leffler uint8_t ic_chan_avail[IEEE80211_CHAN_BYTES]; 729b032f27cSSam Leffler uint8_t ic_chan_active[IEEE80211_CHAN_BYTES]; 730b032f27cSSam Leffler uint8_t ic_chan_scan[IEEE80211_CHAN_BYTES]; 731b032f27cSSam Leffler #endif 732b032f27cSSam Leffler db_printf("\n"); 733b032f27cSSam Leffler _db_show_channel("\tcurchan", ic->ic_curchan); 734b032f27cSSam Leffler db_printf("\n"); 735b032f27cSSam Leffler _db_show_channel("\tbsschan", ic->ic_bsschan); 736b032f27cSSam Leffler db_printf("\n"); 737b032f27cSSam Leffler _db_show_channel("\tprevchan", ic->ic_prevchan); 738b032f27cSSam Leffler db_printf("\n"); 739b032f27cSSam Leffler db_printf("\tregdomain %p", &ic->ic_regdomain); 740b032f27cSSam Leffler db_printf("\n"); 741b032f27cSSam Leffler 742b032f27cSSam Leffler _db_show_channel("\tcsa_newchan", ic->ic_csa_newchan); 743b032f27cSSam Leffler db_printf(" csa_count %d", ic->ic_csa_count); 744b032f27cSSam Leffler db_printf( "dfs %p", &ic->ic_dfs); 745b032f27cSSam Leffler db_printf("\n"); 746b032f27cSSam Leffler 747b032f27cSSam Leffler db_printf("\tscan %p", ic->ic_scan); 748b032f27cSSam Leffler db_printf(" lastdata %d", ic->ic_lastdata); 749b032f27cSSam Leffler db_printf(" lastscan %d", ic->ic_lastscan); 750b032f27cSSam Leffler db_printf("\n"); 751b032f27cSSam Leffler 752b032f27cSSam Leffler db_printf("\tmax_keyix %d", ic->ic_max_keyix); 75359aa14a9SRui Paulo db_printf(" hash_key 0x%x", ic->ic_hash_key); 754b032f27cSSam Leffler db_printf(" wme %p", &ic->ic_wme); 75530a4e068SSam Leffler if (!showsta) 75630a4e068SSam Leffler db_printf(" sta %p", &ic->ic_sta); 757b032f27cSSam Leffler db_printf("\n"); 75859aa14a9SRui Paulo db_printf("\tstageq@%p:\n", &ic->ic_stageq); 75959aa14a9SRui Paulo _db_show_ageq("\t", &ic->ic_stageq); 76030a4e068SSam Leffler if (showsta) 76130a4e068SSam Leffler _db_show_node_table("\t", &ic->ic_sta); 762b032f27cSSam Leffler 763b032f27cSSam Leffler db_printf("\tprotmode %d", ic->ic_protmode); 764b032f27cSSam Leffler db_printf("\tcurhtprotmode 0x%x", ic->ic_curhtprotmode); 765b032f27cSSam Leffler db_printf(" htprotmode %d", ic->ic_htprotmode); 766b032f27cSSam Leffler db_printf("\n"); 767b032f27cSSam Leffler 768e1cfcbcbSSam Leffler db_printf("\tsuperg %p\n", ic->ic_superg); 769e1cfcbcbSSam Leffler 770e1cfcbcbSSam Leffler db_printf("\tmontaps %d th %p txchan %p rh %p rxchan %p\n", 771e1cfcbcbSSam Leffler ic->ic_montaps, ic->ic_th, ic->ic_txchan, ic->ic_rh, ic->ic_rxchan); 772e1cfcbcbSSam Leffler 773b032f27cSSam Leffler if (showprocs) { 7747f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_vap_create", ic->ic_vap_create); 7757f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_vap_delete", ic->ic_vap_delete); 776b032f27cSSam Leffler #if 0 777b032f27cSSam Leffler /* operating mode attachment */ 778b032f27cSSam Leffler ieee80211vap_attach ic_vattach[IEEE80211_OPMODE_MAX]; 779b032f27cSSam Leffler #endif 7807f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_newassoc", ic->ic_newassoc); 7817f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_getradiocaps", ic->ic_getradiocaps); 7827f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_setregdomain", ic->ic_setregdomain); 7837f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_send_mgmt", ic->ic_send_mgmt); 7847f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_raw_xmit", ic->ic_raw_xmit); 7857f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_updateslot", ic->ic_updateslot); 7867f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_update_mcast", ic->ic_update_mcast); 7877f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_update_promisc", ic->ic_update_promisc); 7887f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_node_alloc", ic->ic_node_alloc); 7897f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_node_free", ic->ic_node_free); 7907f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_node_cleanup", ic->ic_node_cleanup); 7917f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_node_getrssi", ic->ic_node_getrssi); 7927f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_node_getsignal", ic->ic_node_getsignal); 7937f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_node_getmimoinfo", ic->ic_node_getmimoinfo); 7947f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_scan_start", ic->ic_scan_start); 7957f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_scan_end", ic->ic_scan_end); 7967f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_set_channel", ic->ic_set_channel); 7977f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_scan_curchan", ic->ic_scan_curchan); 7987f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_scan_mindwell", ic->ic_scan_mindwell); 7997f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_recv_action", ic->ic_recv_action); 8007f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_send_action", ic->ic_send_action); 8017f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_addba_request", ic->ic_addba_request); 8027f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_addba_response", ic->ic_addba_response); 8037f6a5468SSam Leffler DB_PRINTSYM("\t", "ic_addba_stop", ic->ic_addba_stop); 804b032f27cSSam Leffler } 80533396ec2SBjoern A. Zeeb if (showscan) { 80633396ec2SBjoern A. Zeeb db_printf("\n"); 80733396ec2SBjoern A. Zeeb _db_show_scan(ic->ic_scan, showprocs); 80833396ec2SBjoern A. Zeeb } 809b032f27cSSam Leffler if (showvaps && !TAILQ_EMPTY(&ic->ic_vaps)) { 810b032f27cSSam Leffler db_printf("\n"); 811b032f27cSSam Leffler TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) 81262f07485SMonthadar Al Jaberi _db_show_vap(vap, showmesh, showprocs); 813b032f27cSSam Leffler } 814b032f27cSSam Leffler if (showsta && !TAILQ_EMPTY(&ic->ic_sta.nt_node)) { 815b032f27cSSam Leffler const struct ieee80211_node_table *nt = &ic->ic_sta; 816b032f27cSSam Leffler const struct ieee80211_node *ni; 817b032f27cSSam Leffler 818b032f27cSSam Leffler TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { 819b032f27cSSam Leffler db_printf("\n"); 820b032f27cSSam Leffler _db_show_sta(ni); 821b032f27cSSam Leffler } 822b032f27cSSam Leffler } 823b032f27cSSam Leffler } 824b032f27cSSam Leffler 825b032f27cSSam Leffler static void 8267cde0202SAndriy Voskoboinyk _db_show_all_vaps(void *arg, struct ieee80211com *ic) 8277cde0202SAndriy Voskoboinyk { 8287cde0202SAndriy Voskoboinyk int showall = *(int *)arg; 8297cde0202SAndriy Voskoboinyk 8307cde0202SAndriy Voskoboinyk if (!showall) { 8317cde0202SAndriy Voskoboinyk const struct ieee80211vap *vap; 8327cde0202SAndriy Voskoboinyk db_printf("%s: com %p vaps:", ic->ic_name, ic); 8337cde0202SAndriy Voskoboinyk TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) 8343d0d5b21SJustin Hibbits db_printf(" %s(%p)", if_name(vap->iv_ifp), vap); 8357cde0202SAndriy Voskoboinyk db_printf("\n"); 8367cde0202SAndriy Voskoboinyk } else 83733396ec2SBjoern A. Zeeb _db_show_com(ic, 1, 1, 1, 1, 1); 8387cde0202SAndriy Voskoboinyk } 8397cde0202SAndriy Voskoboinyk 8407cde0202SAndriy Voskoboinyk static void 84130a4e068SSam Leffler _db_show_node_table(const char *tag, const struct ieee80211_node_table *nt) 84230a4e068SSam Leffler { 84330a4e068SSam Leffler int i; 84430a4e068SSam Leffler 84530a4e068SSam Leffler db_printf("%s%s@%p:\n", tag, nt->nt_name, nt); 84630a4e068SSam Leffler db_printf("%s nodelock %p", tag, &nt->nt_nodelock); 84730a4e068SSam Leffler db_printf(" inact_init %d", nt->nt_inact_init); 84830a4e068SSam Leffler db_printf("%s keyixmax %d keyixmap %p\n", 84930a4e068SSam Leffler tag, nt->nt_keyixmax, nt->nt_keyixmap); 85030a4e068SSam Leffler for (i = 0; i < nt->nt_keyixmax; i++) { 85130a4e068SSam Leffler const struct ieee80211_node *ni = nt->nt_keyixmap[i]; 85230a4e068SSam Leffler if (ni != NULL) 85330a4e068SSam Leffler db_printf("%s [%3u] %p %s\n", tag, i, ni, 85430a4e068SSam Leffler ether_sprintf(ni->ni_macaddr)); 85530a4e068SSam Leffler } 85630a4e068SSam Leffler } 85730a4e068SSam Leffler 85830a4e068SSam Leffler static void 859b032f27cSSam Leffler _db_show_channel(const char *tag, const struct ieee80211_channel *c) 860b032f27cSSam Leffler { 861b032f27cSSam Leffler db_printf("%s ", tag); 862b032f27cSSam Leffler if (c == NULL) 863b032f27cSSam Leffler db_printf("<NULL>"); 864b032f27cSSam Leffler else if (c == IEEE80211_CHAN_ANYC) 865b032f27cSSam Leffler db_printf("<ANY>"); 866b032f27cSSam Leffler else 86730a4e068SSam Leffler db_printf("[%u (%u) flags=%b maxreg %d maxpow %d minpow %d state 0x%x extieee %u]", 868b032f27cSSam Leffler c->ic_freq, c->ic_ieee, 869b032f27cSSam Leffler c->ic_flags, IEEE80211_CHAN_BITS, 870b032f27cSSam Leffler c->ic_maxregpower, c->ic_maxpower, c->ic_minpower, 871b032f27cSSam Leffler c->ic_state, c->ic_extieee); 872b032f27cSSam Leffler } 873b032f27cSSam Leffler 874b032f27cSSam Leffler static void 875b032f27cSSam Leffler _db_show_ssid(const char *tag, int ix, int len, const uint8_t *ssid) 876b032f27cSSam Leffler { 877b032f27cSSam Leffler const uint8_t *p; 878b032f27cSSam Leffler int i; 879b032f27cSSam Leffler 880b032f27cSSam Leffler db_printf(tag, ix); 881b032f27cSSam Leffler 882b032f27cSSam Leffler if (len > IEEE80211_NWID_LEN) 883b032f27cSSam Leffler len = IEEE80211_NWID_LEN; 884b032f27cSSam Leffler /* determine printable or not */ 885b032f27cSSam Leffler for (i = 0, p = ssid; i < len; i++, p++) { 886b032f27cSSam Leffler if (*p < ' ' || *p > 0x7e) 887b032f27cSSam Leffler break; 888b032f27cSSam Leffler } 889b032f27cSSam Leffler if (i == len) { 890b032f27cSSam Leffler db_printf("\""); 891b032f27cSSam Leffler for (i = 0, p = ssid; i < len; i++, p++) 892b032f27cSSam Leffler db_printf("%c", *p); 893b032f27cSSam Leffler db_printf("\""); 894b032f27cSSam Leffler } else { 895b032f27cSSam Leffler db_printf("0x"); 896b032f27cSSam Leffler for (i = 0, p = ssid; i < len; i++, p++) 897b032f27cSSam Leffler db_printf("%02x", *p); 898b032f27cSSam Leffler } 899b032f27cSSam Leffler } 900b032f27cSSam Leffler 901b032f27cSSam Leffler static void 902b032f27cSSam Leffler _db_show_appie(const char *tag, const struct ieee80211_appie *ie) 903b032f27cSSam Leffler { 904b032f27cSSam Leffler const uint8_t *p; 905b032f27cSSam Leffler int i; 906b032f27cSSam Leffler 907b032f27cSSam Leffler if (ie == NULL) 908b032f27cSSam Leffler return; 909b032f27cSSam Leffler db_printf("%s [0x", tag); 910b032f27cSSam Leffler for (i = 0, p = ie->ie_data; i < ie->ie_len; i++, p++) 911b032f27cSSam Leffler db_printf("%02x", *p); 912b032f27cSSam Leffler db_printf("]\n"); 913b032f27cSSam Leffler } 914b032f27cSSam Leffler 915b032f27cSSam Leffler static void 916b032f27cSSam Leffler _db_show_key(const char *tag, int ix, const struct ieee80211_key *wk) 917b032f27cSSam Leffler { 918b032f27cSSam Leffler static const uint8_t zerodata[IEEE80211_KEYBUF_SIZE]; 919b032f27cSSam Leffler const struct ieee80211_cipher *cip = wk->wk_cipher; 920b032f27cSSam Leffler int keylen = wk->wk_keylen; 921b032f27cSSam Leffler 922b032f27cSSam Leffler db_printf(tag, ix); 923b032f27cSSam Leffler switch (cip->ic_cipher) { 924b032f27cSSam Leffler case IEEE80211_CIPHER_WEP: 925b032f27cSSam Leffler /* compatibility */ 9269d365d36SSam Leffler db_printf(" wepkey %u:%s", wk->wk_keyix, 927b032f27cSSam Leffler keylen <= 5 ? "40-bit" : 928b032f27cSSam Leffler keylen <= 13 ? "104-bit" : "128-bit"); 929b032f27cSSam Leffler break; 930b032f27cSSam Leffler case IEEE80211_CIPHER_TKIP: 931b032f27cSSam Leffler if (keylen > 128/8) 932b032f27cSSam Leffler keylen -= 128/8; /* ignore MIC for now */ 9339d365d36SSam Leffler db_printf(" TKIP %u:%u-bit", wk->wk_keyix, 8*keylen); 934b032f27cSSam Leffler break; 935b032f27cSSam Leffler case IEEE80211_CIPHER_AES_OCB: 9369d365d36SSam Leffler db_printf(" AES-OCB %u:%u-bit", wk->wk_keyix, 8*keylen); 937b032f27cSSam Leffler break; 938b032f27cSSam Leffler case IEEE80211_CIPHER_AES_CCM: 9399d365d36SSam Leffler db_printf(" AES-CCM %u:%u-bit", wk->wk_keyix, 8*keylen); 940b032f27cSSam Leffler break; 941b032f27cSSam Leffler case IEEE80211_CIPHER_CKIP: 9429d365d36SSam Leffler db_printf(" CKIP %u:%u-bit", wk->wk_keyix, 8*keylen); 943b032f27cSSam Leffler break; 944b032f27cSSam Leffler case IEEE80211_CIPHER_NONE: 9459d365d36SSam Leffler db_printf(" NULL %u:%u-bit", wk->wk_keyix, 8*keylen); 946b032f27cSSam Leffler break; 947b032f27cSSam Leffler default: 948b032f27cSSam Leffler db_printf(" UNKNOWN (0x%x) %u:%u-bit", 9499d365d36SSam Leffler cip->ic_cipher, wk->wk_keyix, 8*keylen); 950b032f27cSSam Leffler break; 951b032f27cSSam Leffler } 952f2ce0f51SSam Leffler if (wk->wk_rxkeyix != wk->wk_keyix) 953f2ce0f51SSam Leffler db_printf(" rxkeyix %u", wk->wk_rxkeyix); 954b032f27cSSam Leffler if (memcmp(wk->wk_key, zerodata, keylen) != 0) { 955b032f27cSSam Leffler int i; 956b032f27cSSam Leffler 957b032f27cSSam Leffler db_printf(" <"); 958b032f27cSSam Leffler for (i = 0; i < keylen; i++) 959b032f27cSSam Leffler db_printf("%02x", wk->wk_key[i]); 960b032f27cSSam Leffler db_printf(">"); 961b032f27cSSam Leffler if (cip->ic_cipher != IEEE80211_CIPHER_WEP && 962b032f27cSSam Leffler wk->wk_keyrsc[IEEE80211_NONQOS_TID] != 0) 963b032f27cSSam Leffler db_printf(" rsc %ju", (uintmax_t)wk->wk_keyrsc[IEEE80211_NONQOS_TID]); 964b032f27cSSam Leffler if (cip->ic_cipher != IEEE80211_CIPHER_WEP && 965b032f27cSSam Leffler wk->wk_keytsc != 0) 966b032f27cSSam Leffler db_printf(" tsc %ju", (uintmax_t)wk->wk_keytsc); 967f2ce0f51SSam Leffler db_printf(" flags=%b", wk->wk_flags, IEEE80211_KEY_BITS); 968b032f27cSSam Leffler } 969b032f27cSSam Leffler db_printf("\n"); 970b032f27cSSam Leffler } 971b032f27cSSam Leffler 972b032f27cSSam Leffler static void 973b032f27cSSam Leffler printrate(const char *tag, int v) 974b032f27cSSam Leffler { 975b032f27cSSam Leffler if (v == IEEE80211_FIXED_RATE_NONE) 976b032f27cSSam Leffler db_printf(" %s <none>", tag); 977b032f27cSSam Leffler else if (v == 11) 978b032f27cSSam Leffler db_printf(" %s 5.5", tag); 979b032f27cSSam Leffler else if (v & IEEE80211_RATE_MCS) 980b032f27cSSam Leffler db_printf(" %s MCS%d", tag, v &~ IEEE80211_RATE_MCS); 981b032f27cSSam Leffler else 982b032f27cSSam Leffler db_printf(" %s %d", tag, v/2); 983b032f27cSSam Leffler } 984b032f27cSSam Leffler 985b032f27cSSam Leffler static void 986b032f27cSSam Leffler _db_show_roamparams(const char *tag, const void *arg, 987b032f27cSSam Leffler const struct ieee80211_roamparam *rp) 988b032f27cSSam Leffler { 989b032f27cSSam Leffler 990b032f27cSSam Leffler db_printf(tag, arg); 991b032f27cSSam Leffler if (rp->rssi & 1) 992b032f27cSSam Leffler db_printf(" rssi %u.5", rp->rssi/2); 993b032f27cSSam Leffler else 994b032f27cSSam Leffler db_printf(" rssi %u", rp->rssi/2); 995b032f27cSSam Leffler printrate("rate", rp->rate); 996b032f27cSSam Leffler } 997b032f27cSSam Leffler 998b032f27cSSam Leffler static void 999b032f27cSSam Leffler _db_show_txparams(const char *tag, const void *arg, 1000b032f27cSSam Leffler const struct ieee80211_txparam *tp) 1001b032f27cSSam Leffler { 1002b032f27cSSam Leffler 1003b032f27cSSam Leffler db_printf(tag, arg); 1004b032f27cSSam Leffler printrate("ucastrate", tp->ucastrate); 1005b032f27cSSam Leffler printrate("mcastrate", tp->mcastrate); 1006b032f27cSSam Leffler printrate("mgmtrate", tp->mgmtrate); 1007b032f27cSSam Leffler db_printf(" maxretry %d", tp->maxretry); 1008b032f27cSSam Leffler } 1009b032f27cSSam Leffler 1010b032f27cSSam Leffler static void 101159aa14a9SRui Paulo _db_show_ageq(const char *tag, const struct ieee80211_ageq *q) 101259aa14a9SRui Paulo { 101359aa14a9SRui Paulo const struct mbuf *m; 101459aa14a9SRui Paulo 101559aa14a9SRui Paulo db_printf("%s lock %p len %d maxlen %d drops %d head %p tail %p\n", 101659aa14a9SRui Paulo tag, &q->aq_lock, q->aq_len, q->aq_maxlen, q->aq_drops, 101759aa14a9SRui Paulo q->aq_head, q->aq_tail); 101859aa14a9SRui Paulo for (m = q->aq_head; m != NULL; m = m->m_nextpkt) 101959aa14a9SRui Paulo db_printf("%s %p (len %d, %b)\n", tag, m, m->m_len, 102059aa14a9SRui Paulo /* XXX could be either TX or RX but is mostly TX */ 102159aa14a9SRui Paulo m->m_flags, IEEE80211_MBUF_TX_FLAG_BITS); 102259aa14a9SRui Paulo } 102359aa14a9SRui Paulo 102459aa14a9SRui Paulo static void 1025b032f27cSSam Leffler _db_show_stats(const struct ieee80211_stats *is) 1026b032f27cSSam Leffler { 1027b032f27cSSam Leffler } 102859aa14a9SRui Paulo 102959aa14a9SRui Paulo #ifdef IEEE80211_SUPPORT_MESH 103059aa14a9SRui Paulo static void 103159aa14a9SRui Paulo _db_show_mesh(const struct ieee80211_mesh_state *ms) 103259aa14a9SRui Paulo { 103359aa14a9SRui Paulo struct ieee80211_mesh_route *rt; 103459aa14a9SRui Paulo int i; 103559aa14a9SRui Paulo 103659aa14a9SRui Paulo _db_show_ssid(" meshid ", 0, ms->ms_idlen, ms->ms_id); 103759aa14a9SRui Paulo db_printf("nextseq %u ttl %u flags 0x%x\n", ms->ms_seq, 103859aa14a9SRui Paulo ms->ms_ttl, ms->ms_flags); 103959aa14a9SRui Paulo db_printf("routing table:\n"); 104059aa14a9SRui Paulo i = 0; 104159aa14a9SRui Paulo TAILQ_FOREACH(rt, &ms->ms_routes, rt_next) { 104259aa14a9SRui Paulo db_printf("entry %d:\tdest: %6D nexthop: %6D metric: %u", i, 104359aa14a9SRui Paulo rt->rt_dest, ":", rt->rt_nexthop, ":", rt->rt_metric); 1044b5df85a6SMonthadar Al Jaberi 104559aa14a9SRui Paulo db_printf("\tlifetime: %u lastseq: %u priv: %p\n", 1046b5df85a6SMonthadar Al Jaberi ieee80211_mesh_rt_update(rt, 0), 1047b5df85a6SMonthadar Al Jaberi rt->rt_lastmseq, rt->rt_priv); 104859aa14a9SRui Paulo i++; 104959aa14a9SRui Paulo } 105059aa14a9SRui Paulo } 105159aa14a9SRui Paulo #endif /* IEEE80211_SUPPORT_MESH */ 1052b032f27cSSam Leffler #endif /* DDB */ 1053