15591b213SSam Leffler /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3718cf2ccSPedro F. Giffuni * 410ad9a77SSam Leffler * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 55591b213SSam Leffler * All rights reserved. 65591b213SSam Leffler * 75591b213SSam Leffler * Redistribution and use in source and binary forms, with or without 85591b213SSam Leffler * modification, are permitted provided that the following conditions 95591b213SSam Leffler * are met: 105591b213SSam Leffler * 1. Redistributions of source code must retain the above copyright 115591b213SSam Leffler * notice, this list of conditions and the following disclaimer, 125591b213SSam Leffler * without modification. 135591b213SSam Leffler * 2. Redistributions in binary form must reproduce at minimum a disclaimer 145591b213SSam Leffler * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 155591b213SSam Leffler * redistribution must be conditioned upon including a substantially 165591b213SSam Leffler * similar Disclaimer requirement for further binary redistribution. 175591b213SSam Leffler * 185591b213SSam Leffler * NO WARRANTY 195591b213SSam Leffler * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 205591b213SSam Leffler * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 215591b213SSam Leffler * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 225591b213SSam Leffler * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 235591b213SSam Leffler * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 245591b213SSam Leffler * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 255591b213SSam Leffler * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 265591b213SSam Leffler * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 275591b213SSam Leffler * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 285591b213SSam Leffler * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 295591b213SSam Leffler * THE POSSIBILITY OF SUCH DAMAGES. 305591b213SSam Leffler */ 315591b213SSam Leffler 325591b213SSam Leffler /* 335591b213SSam Leffler * Ioctl-related defintions for the Atheros Wireless LAN controller driver. 345591b213SSam Leffler */ 355591b213SSam Leffler #ifndef _DEV_ATH_ATHIOCTL_H 365591b213SSam Leffler #define _DEV_ATH_ATHIOCTL_H 375591b213SSam Leffler 38712a80b8SAdrian Chadd struct ath_tx_aggr_stats { 39712a80b8SAdrian Chadd u_int32_t aggr_pkts[64]; 40712a80b8SAdrian Chadd u_int32_t aggr_single_pkt; 41712a80b8SAdrian Chadd u_int32_t aggr_nonbaw_pkt; 42712a80b8SAdrian Chadd u_int32_t aggr_aggr_pkt; 43712a80b8SAdrian Chadd u_int32_t aggr_baw_closed_single_pkt; 44712a80b8SAdrian Chadd u_int32_t aggr_low_hwq_single_pkt; 45712a80b8SAdrian Chadd u_int32_t aggr_sched_nopkt; 46e2e4a2c2SAdrian Chadd u_int32_t aggr_rts_aggr_limited; 47712a80b8SAdrian Chadd }; 48712a80b8SAdrian Chadd 492511069aSAdrian Chadd #define ATH_IOCTL_INTR_NUM_SYNC_INTR 32 509467e3f3SAdrian Chadd struct ath_intr_stats { 512511069aSAdrian Chadd u_int32_t sync_intr[ATH_IOCTL_INTR_NUM_SYNC_INTR]; 529467e3f3SAdrian Chadd }; 539467e3f3SAdrian Chadd 542511069aSAdrian Chadd #define ATH_IOCTL_STATS_NUM_RX_PHYERR 64 552511069aSAdrian Chadd #define ATH_IOCTL_STATS_NUM_TX_ANTENNA 8 562511069aSAdrian Chadd #define ATH_IOCTL_STATS_NUM_RX_ANTENNA 8 575591b213SSam Leffler struct ath_stats { 585591b213SSam Leffler u_int32_t ast_watchdog; /* device reset by watchdog */ 595591b213SSam Leffler u_int32_t ast_hardware; /* fatal hardware error interrupts */ 605591b213SSam Leffler u_int32_t ast_bmiss; /* beacon miss interrupts */ 61d7736e13SSam Leffler u_int32_t ast_bmiss_phantom;/* beacon miss interrupts */ 62c42a7b7eSSam Leffler u_int32_t ast_bstuck; /* beacon stuck interrupts */ 635591b213SSam Leffler u_int32_t ast_rxorn; /* rx overrun interrupts */ 645591b213SSam Leffler u_int32_t ast_rxeol; /* rx eol interrupts */ 655591b213SSam Leffler u_int32_t ast_txurn; /* tx underrun interrupts */ 66c42a7b7eSSam Leffler u_int32_t ast_mib; /* mib interrupts */ 675591b213SSam Leffler u_int32_t ast_intrcoal; /* interrupts coalesced */ 68c42a7b7eSSam Leffler u_int32_t ast_tx_packets; /* packet sent on the interface */ 695591b213SSam Leffler u_int32_t ast_tx_mgmt; /* management frames transmitted */ 705591b213SSam Leffler u_int32_t ast_tx_discard; /* frames discarded prior to assoc */ 715591b213SSam Leffler u_int32_t ast_tx_qstop; /* output stopped 'cuz no buffer */ 725591b213SSam Leffler u_int32_t ast_tx_encap; /* tx encapsulation failed */ 735591b213SSam Leffler u_int32_t ast_tx_nonode; /* tx failed 'cuz no node */ 745591b213SSam Leffler u_int32_t ast_tx_nombuf; /* tx failed 'cuz no mbuf */ 755591b213SSam Leffler u_int32_t ast_tx_nomcl; /* tx failed 'cuz no cluster */ 765591b213SSam Leffler u_int32_t ast_tx_linear; /* tx linearized to cluster */ 775591b213SSam Leffler u_int32_t ast_tx_nodata; /* tx discarded empty frame */ 785591b213SSam Leffler u_int32_t ast_tx_busdma; /* tx failed for dma resrcs */ 795591b213SSam Leffler u_int32_t ast_tx_xretries;/* tx failed 'cuz too many retries */ 805591b213SSam Leffler u_int32_t ast_tx_fifoerr; /* tx failed 'cuz FIFO underrun */ 815591b213SSam Leffler u_int32_t ast_tx_filtered;/* tx failed 'cuz xmit filtered */ 825591b213SSam Leffler u_int32_t ast_tx_shortretry;/* tx on-chip retries (short) */ 835591b213SSam Leffler u_int32_t ast_tx_longretry;/* tx on-chip retries (long) */ 845591b213SSam Leffler u_int32_t ast_tx_badrate; /* tx failed 'cuz bogus xmit rate */ 855591b213SSam Leffler u_int32_t ast_tx_noack; /* tx frames with no ack marked */ 865591b213SSam Leffler u_int32_t ast_tx_rts; /* tx frames with rts enabled */ 875591b213SSam Leffler u_int32_t ast_tx_cts; /* tx frames with cts enabled */ 885591b213SSam Leffler u_int32_t ast_tx_shortpre;/* tx frames with short preamble */ 8959f32d6bSSam Leffler u_int32_t ast_tx_altrate; /* tx frames with alternate rate */ 9059f32d6bSSam Leffler u_int32_t ast_tx_protect; /* tx frames with protection */ 9168e8e04eSSam Leffler u_int32_t ast_tx_ctsburst;/* tx frames with cts and bursting */ 9268e8e04eSSam Leffler u_int32_t ast_tx_ctsext; /* tx frames with cts extension */ 935591b213SSam Leffler u_int32_t ast_rx_nombuf; /* rx setup failed 'cuz no mbuf */ 945591b213SSam Leffler u_int32_t ast_rx_busdma; /* rx setup failed for dma resrcs */ 955591b213SSam Leffler u_int32_t ast_rx_orn; /* rx failed 'cuz of desc overrun */ 965591b213SSam Leffler u_int32_t ast_rx_crcerr; /* rx failed 'cuz of bad CRC */ 975591b213SSam Leffler u_int32_t ast_rx_fifoerr; /* rx failed 'cuz of FIFO overrun */ 985591b213SSam Leffler u_int32_t ast_rx_badcrypt;/* rx failed 'cuz decryption */ 99c42a7b7eSSam Leffler u_int32_t ast_rx_badmic; /* rx failed 'cuz MIC failure */ 1005591b213SSam Leffler u_int32_t ast_rx_phyerr; /* rx failed 'cuz of PHY err */ 1012511069aSAdrian Chadd u_int32_t ast_rx_phy[ATH_IOCTL_STATS_NUM_RX_PHYERR]; 1022511069aSAdrian Chadd /* rx PHY error per-code counts */ 103d1d0cf62SSam Leffler u_int32_t ast_rx_tooshort;/* rx discarded 'cuz frame too short */ 10459f32d6bSSam Leffler u_int32_t ast_rx_toobig; /* rx discarded 'cuz frame too large */ 105c42a7b7eSSam Leffler u_int32_t ast_rx_packets; /* packet recv on the interface */ 106c42a7b7eSSam Leffler u_int32_t ast_rx_mgt; /* management frames received */ 107d1d0cf62SSam Leffler u_int32_t ast_rx_ctl; /* rx discarded 'cuz ctl frame */ 108c42a7b7eSSam Leffler int8_t ast_tx_rssi; /* tx rssi of last ack */ 109c42a7b7eSSam Leffler int8_t ast_rx_rssi; /* rx rssi from histogram */ 1106bf62dd1SSam Leffler u_int8_t ast_tx_rate; /* IEEE rate of last unicast tx */ 111c42a7b7eSSam Leffler u_int32_t ast_be_xmit; /* beacons transmitted */ 1125591b213SSam Leffler u_int32_t ast_be_nombuf; /* beacon setup failed 'cuz no mbuf */ 1135591b213SSam Leffler u_int32_t ast_per_cal; /* periodic calibration calls */ 1145591b213SSam Leffler u_int32_t ast_per_calfail;/* periodic calibration failed */ 1155591b213SSam Leffler u_int32_t ast_per_rfgain; /* periodic calibration rfgain reset */ 1165591b213SSam Leffler u_int32_t ast_rate_calls; /* rate control checks */ 1175591b213SSam Leffler u_int32_t ast_rate_raise; /* rate control raised xmit rate */ 1185591b213SSam Leffler u_int32_t ast_rate_drop; /* rate control dropped xmit rate */ 119c42a7b7eSSam Leffler u_int32_t ast_ant_defswitch;/* rx/default antenna switches */ 120c42a7b7eSSam Leffler u_int32_t ast_ant_txswitch;/* tx antenna switches */ 1212511069aSAdrian Chadd u_int32_t ast_ant_rx[ATH_IOCTL_STATS_NUM_RX_ANTENNA]; 1222511069aSAdrian Chadd /* rx frames with antenna */ 1232511069aSAdrian Chadd u_int32_t ast_ant_tx[ATH_IOCTL_STATS_NUM_TX_ANTENNA]; 1242511069aSAdrian Chadd /* tx frames with antenna */ 12530db812aSSam Leffler u_int32_t ast_cabq_xmit; /* cabq frames transmitted */ 12630db812aSSam Leffler u_int32_t ast_cabq_busy; /* cabq found busy */ 127664443d0SSam Leffler u_int32_t ast_tx_raw; /* tx frames through raw api */ 12868e8e04eSSam Leffler u_int32_t ast_ff_txok; /* fast frames tx'd successfully */ 12968e8e04eSSam Leffler u_int32_t ast_ff_txerr; /* fast frames tx'd w/ error */ 13068e8e04eSSam Leffler u_int32_t ast_ff_rx; /* fast frames rx'd */ 13168e8e04eSSam Leffler u_int32_t ast_ff_flush; /* fast frames flushed from staging q */ 13268e8e04eSSam Leffler u_int32_t ast_tx_qfull; /* tx dropped 'cuz of queue limit */ 13368e8e04eSSam Leffler int8_t ast_rx_noise; /* rx noise floor */ 13410ad9a77SSam Leffler u_int32_t ast_tx_nobuf; /* tx dropped 'cuz no ath buffer */ 13510ad9a77SSam Leffler u_int32_t ast_tdma_update;/* TDMA slot timing updates */ 13610ad9a77SSam Leffler u_int32_t ast_tdma_timers;/* TDMA slot update set beacon timers */ 13710ad9a77SSam Leffler u_int32_t ast_tdma_tsf; /* TDMA slot update set TSF */ 13810ad9a77SSam Leffler u_int16_t ast_tdma_tsfadjp;/* TDMA slot adjust+ (usec, smoothed)*/ 13910ad9a77SSam Leffler u_int16_t ast_tdma_tsfadjm;/* TDMA slot adjust- (usec, smoothed)*/ 1403267a60cSSam Leffler u_int32_t ast_tdma_ack; /* TDMA tx failed 'cuz ACK required */ 1413267a60cSSam Leffler u_int32_t ast_tx_raw_fail;/* raw tx failed 'cuz h/w down */ 14236c6be9aSSam Leffler u_int32_t ast_tx_nofrag; /* tx dropped 'cuz no ath frag buffer */ 1437ec4e6b8SAdrian Chadd u_int32_t ast_be_missed; /* missed beacons */ 144a108ab63SAdrian Chadd u_int32_t ast_ani_cal; /* ANI calibrations performed */ 145f673a810SAdrian Chadd u_int32_t ast_rx_agg; /* number of aggregate frames RX'ed */ 146e9d1191fSAdrian Chadd u_int32_t ast_rx_halfgi; /* RX half-GI */ 147e9d1191fSAdrian Chadd u_int32_t ast_rx_2040; /* RX 40mhz frame */ 148e9d1191fSAdrian Chadd u_int32_t ast_rx_pre_crc_err; /* RX pre-delimiter CRC error */ 149e9d1191fSAdrian Chadd u_int32_t ast_rx_post_crc_err; /* RX post-delimiter CRC error */ 150e9d1191fSAdrian Chadd u_int32_t ast_rx_decrypt_busy_err; /* RX decrypt engine busy error */ 151f9aa1d90SAdrian Chadd u_int32_t ast_rx_hi_rx_chain; 152d6efa330SAdrian Chadd u_int32_t ast_tx_htprotect; /* HT tx frames with protection */ 153e9d1191fSAdrian Chadd u_int32_t ast_rx_hitqueueend; /* RX hit descr queue end */ 1546ad02dbaSAdrian Chadd u_int32_t ast_tx_timeout; /* Global TX timeout */ 1555594f5c0SAdrian Chadd u_int32_t ast_tx_cst; /* Carrier sense timeout */ 156e9d1191fSAdrian Chadd u_int32_t ast_tx_xtxop; /* tx exceeded TXOP */ 157e9d1191fSAdrian Chadd u_int32_t ast_tx_timerexpired; /* tx exceeded TX_TIMER */ 158e9d1191fSAdrian Chadd u_int32_t ast_tx_desccfgerr; /* tx desc cfg error */ 159b390e40aSAdrian Chadd u_int32_t ast_tx_swretries; /* software TX retries */ 160b390e40aSAdrian Chadd u_int32_t ast_tx_swretrymax; /* software TX retry max limit reach */ 161b390e40aSAdrian Chadd u_int32_t ast_tx_data_underrun; 162b390e40aSAdrian Chadd u_int32_t ast_tx_delim_underrun; 1632d3d4776SAdrian Chadd u_int32_t ast_tx_aggr_failall; /* aggregate TX failed in its entirety */ 164b390e40aSAdrian Chadd u_int32_t ast_tx_getnobuf; 165b390e40aSAdrian Chadd u_int32_t ast_tx_getbusybuf; 166b390e40aSAdrian Chadd u_int32_t ast_tx_intr; 167b390e40aSAdrian Chadd u_int32_t ast_rx_intr; 1682d3d4776SAdrian Chadd u_int32_t ast_tx_aggr_ok; /* aggregate TX ok */ 1692d3d4776SAdrian Chadd u_int32_t ast_tx_aggr_fail; /* aggregate TX failed */ 1709c85ff91SAdrian Chadd u_int32_t ast_tx_mcastq_overflow; /* multicast queue overflow */ 171c7f5bb7aSAdrian Chadd u_int32_t ast_rx_keymiss; 172f1bc738eSAdrian Chadd u_int32_t ast_tx_swfiltered; 17322a3aee6SAdrian Chadd u_int32_t ast_tx_node_psq_overflow; 1742c47932cSAdrian Chadd u_int32_t ast_rx_stbc; /* RX STBC frame */ 1757dcb2beaSAdrian Chadd u_int32_t ast_tx_nodeq_overflow; /* node sw queue overflow */ 1763c6b488bSAdrian Chadd u_int32_t ast_tx_ldpc; /* TX LDPC frame */ 1773c6b488bSAdrian Chadd u_int32_t ast_tx_stbc; /* TX STBC frame */ 178fb3edd4fSAdrian Chadd u_int32_t ast_tsfoor; /* TSFOOR interrupts */ 1793c6b488bSAdrian Chadd u_int32_t ast_pad[10]; 1805591b213SSam Leffler }; 1815591b213SSam Leffler 1825591b213SSam Leffler #define SIOCGATHSTATS _IOWR('i', 137, struct ifreq) 1833fc21fedSSam Leffler #define SIOCZATHSTATS _IOWR('i', 139, struct ifreq) 18494fe37d2SAdrian Chadd #define SIOCGATHAGSTATS _IOWR('i', 141, struct ifreq) 1855591b213SSam Leffler 1868cec0ab9SSam Leffler struct ath_diag { 1878cec0ab9SSam Leffler char ad_name[IFNAMSIZ]; /* if name, e.g. "ath0" */ 188c42a7b7eSSam Leffler u_int16_t ad_id; 189c42a7b7eSSam Leffler #define ATH_DIAG_DYN 0x8000 /* allocate buffer in caller */ 190c42a7b7eSSam Leffler #define ATH_DIAG_IN 0x4000 /* copy in parameters */ 191c42a7b7eSSam Leffler #define ATH_DIAG_OUT 0x0000 /* copy out results (always) */ 192c42a7b7eSSam Leffler #define ATH_DIAG_ID 0x0fff 193c42a7b7eSSam Leffler u_int16_t ad_in_size; /* pack to fit, yech */ 194c42a7b7eSSam Leffler caddr_t ad_in_data; 195c42a7b7eSSam Leffler caddr_t ad_out_data; 196c42a7b7eSSam Leffler u_int ad_out_size; 1978cec0ab9SSam Leffler 1988cec0ab9SSam Leffler }; 1998cec0ab9SSam Leffler #define SIOCGATHDIAG _IOWR('i', 138, struct ath_diag) 200f51c84eaSAdrian Chadd #define SIOCGATHPHYERR _IOWR('i', 140, struct ath_diag) 2018cec0ab9SSam Leffler 2029e38f708SAdrian Chadd /* 2039e38f708SAdrian Chadd * The rate control ioctl has to support multiple potential rate 2049e38f708SAdrian Chadd * control classes. For now, instead of trying to support an 2059e38f708SAdrian Chadd * abstraction for this in the API, let's just use a TLV 2069e38f708SAdrian Chadd * representation for the payload and let userspace sort it out. 2079e38f708SAdrian Chadd */ 2089e38f708SAdrian Chadd struct ath_rateioctl_tlv { 2099e38f708SAdrian Chadd uint16_t tlv_id; 2109e38f708SAdrian Chadd uint16_t tlv_len; /* length excluding TLV header */ 2119e38f708SAdrian Chadd }; 2129e38f708SAdrian Chadd 2139e38f708SAdrian Chadd /* 2149e38f708SAdrian Chadd * This is purely the six byte MAC address. 2159e38f708SAdrian Chadd */ 2169e38f708SAdrian Chadd #define ATH_RATE_TLV_MACADDR 0xaab0 2179e38f708SAdrian Chadd 2189e38f708SAdrian Chadd /* 219be4f96a6SAdrian Chadd * The rate control modules may decide to push a mapping table 220be4f96a6SAdrian Chadd * of rix -> net80211 ratecode as part of the update. 221be4f96a6SAdrian Chadd */ 222be4f96a6SAdrian Chadd #define ATH_RATE_TLV_RATETABLE_NENTRIES 64 223be4f96a6SAdrian Chadd struct ath_rateioctl_rt { 224be4f96a6SAdrian Chadd uint16_t nentries; 225be4f96a6SAdrian Chadd uint16_t pad[1]; 226be4f96a6SAdrian Chadd uint8_t ratecode[ATH_RATE_TLV_RATETABLE_NENTRIES]; 227be4f96a6SAdrian Chadd }; 228be4f96a6SAdrian Chadd #define ATH_RATE_TLV_RATETABLE 0xaab1 229be4f96a6SAdrian Chadd 230be4f96a6SAdrian Chadd /* 2319e38f708SAdrian Chadd * This is the sample node statistics structure. 2329e38f708SAdrian Chadd * More in ath_rate/sample/sample.h. 2339e38f708SAdrian Chadd */ 2349e38f708SAdrian Chadd #define ATH_RATE_TLV_SAMPLENODE 0xaab2 2359e38f708SAdrian Chadd 2369e38f708SAdrian Chadd struct ath_rateioctl { 2379e38f708SAdrian Chadd char if_name[IFNAMSIZ]; /* if name */ 2389e38f708SAdrian Chadd union { 2399e38f708SAdrian Chadd uint8_t macaddr[IEEE80211_ADDR_LEN]; 2409e38f708SAdrian Chadd uint64_t pad; 2419e38f708SAdrian Chadd } is_u; 2429e38f708SAdrian Chadd uint32_t len; 2439e38f708SAdrian Chadd caddr_t buf; 2449e38f708SAdrian Chadd }; 2459e38f708SAdrian Chadd #define SIOCGATHNODERATESTATS _IOWR('i', 149, struct ath_rateioctl) 2463ba90526SAdrian Chadd #define SIOCGATHRATESTATS _IOWR('i', 150, struct ath_rateioctl) 2479e38f708SAdrian Chadd 24873454c73SSam Leffler /* 24973454c73SSam Leffler * Radio capture format. 25073454c73SSam Leffler */ 251e1b5ab97SAdrian Chadd #define ATH_RX_RADIOTAP_PRESENT_BASE ( \ 2527b0c77ecSSam Leffler (1 << IEEE80211_RADIOTAP_TSFT) | \ 25373454c73SSam Leffler (1 << IEEE80211_RADIOTAP_FLAGS) | \ 25473454c73SSam Leffler (1 << IEEE80211_RADIOTAP_RATE) | \ 25573454c73SSam Leffler (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 2567b0c77ecSSam Leffler (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 2577b0c77ecSSam Leffler (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ 25868e8e04eSSam Leffler (1 << IEEE80211_RADIOTAP_XCHANNEL) | \ 25973454c73SSam Leffler 0) 26073454c73SSam Leffler 261e1b5ab97SAdrian Chadd #ifdef ATH_ENABLE_RADIOTAP_VENDOR_EXT 262e1b5ab97SAdrian Chadd #define ATH_RX_RADIOTAP_PRESENT \ 263e1b5ab97SAdrian Chadd (ATH_RX_RADIOTAP_PRESENT_BASE | \ 264e1b5ab97SAdrian Chadd (1 << IEEE80211_RADIOTAP_VENDOREXT) | \ 265e1b5ab97SAdrian Chadd (1 << IEEE80211_RADIOTAP_EXT) | \ 266e1b5ab97SAdrian Chadd 0) 267e1b5ab97SAdrian Chadd #else 268e1b5ab97SAdrian Chadd #define ATH_RX_RADIOTAP_PRESENT ATH_RX_RADIOTAP_PRESENT_BASE 269e1b5ab97SAdrian Chadd #endif /* ATH_ENABLE_RADIOTAP_PRESENT */ 270e1b5ab97SAdrian Chadd 271e1b5ab97SAdrian Chadd #ifdef ATH_ENABLE_RADIOTAP_VENDOR_EXT 272e1b5ab97SAdrian Chadd /* 273e1b5ab97SAdrian Chadd * This is higher than the vendor bitmap used inside 274e1b5ab97SAdrian Chadd * the Atheros reference codebase. 275e1b5ab97SAdrian Chadd */ 276e1b5ab97SAdrian Chadd 277e1b5ab97SAdrian Chadd /* Bit 8 */ 278e1b5ab97SAdrian Chadd #define ATH_RADIOTAP_VENDOR_HEADER 8 279e1b5ab97SAdrian Chadd 280e1b5ab97SAdrian Chadd /* 281e1b5ab97SAdrian Chadd * Using four chains makes all the fields in the 282e1b5ab97SAdrian Chadd * per-chain info header be 4-byte aligned. 283e1b5ab97SAdrian Chadd */ 284e1b5ab97SAdrian Chadd #define ATH_RADIOTAP_MAX_CHAINS 4 285e1b5ab97SAdrian Chadd 286e1b5ab97SAdrian Chadd /* 2876b3ba411SAdrian Chadd * AR9380 and later chips are 3x3, which requires 2886b3ba411SAdrian Chadd * 5 EVM DWORDs in HT40 mode. 2896b3ba411SAdrian Chadd */ 2906b3ba411SAdrian Chadd #define ATH_RADIOTAP_MAX_EVM 5 2916b3ba411SAdrian Chadd 2926b3ba411SAdrian Chadd /* 293e1b5ab97SAdrian Chadd * The vendor radiotap header data needs to be: 294e1b5ab97SAdrian Chadd * 295e1b5ab97SAdrian Chadd * + Aligned to a 4 byte address 296e1b5ab97SAdrian Chadd * + .. so all internal fields are 4 bytes aligned; 297e1b5ab97SAdrian Chadd * + .. and no 64 bit fields are allowed. 298e1b5ab97SAdrian Chadd * 299e1b5ab97SAdrian Chadd * So padding is required to ensure this is the case. 300e1b5ab97SAdrian Chadd * 301e1b5ab97SAdrian Chadd * Note that because of the lack of alignment with the 302e1b5ab97SAdrian Chadd * vendor header (6 bytes), the first field must be 303e1b5ab97SAdrian Chadd * two bytes so it can be accessed by alignment-strict 304e1b5ab97SAdrian Chadd * platform (eg MIPS.) 305e1b5ab97SAdrian Chadd */ 306e1b5ab97SAdrian Chadd struct ath_radiotap_vendor_hdr { /* 30 bytes */ 307e1b5ab97SAdrian Chadd uint8_t vh_version; /* 1 */ 308e1b5ab97SAdrian Chadd uint8_t vh_rx_chainmask; /* 1 */ 309e1b5ab97SAdrian Chadd 310e1b5ab97SAdrian Chadd /* At this point it should be 4 byte aligned */ 3116b3ba411SAdrian Chadd uint32_t evm[ATH_RADIOTAP_MAX_EVM]; /* 5 * 4 = 20 */ 312e1b5ab97SAdrian Chadd 31352fe68b8SAdrian Chadd uint8_t rssi_ctl[ATH_RADIOTAP_MAX_CHAINS]; /* 4 * 4 = 16 */ 31452fe68b8SAdrian Chadd uint8_t rssi_ext[ATH_RADIOTAP_MAX_CHAINS]; /* 4 * 4 = 16 */ 315e1b5ab97SAdrian Chadd 316e1b5ab97SAdrian Chadd uint8_t vh_phyerr_code; /* Phy error code, or 0xff */ 317e1b5ab97SAdrian Chadd uint8_t vh_rs_status; /* RX status */ 318e1b5ab97SAdrian Chadd uint8_t vh_rssi; /* Raw RSSI */ 3190e168bb8SAdrian Chadd uint8_t vh_flags; /* General flags */ 3200e168bb8SAdrian Chadd #define ATH_VENDOR_PKT_RX 0x01 3210e168bb8SAdrian Chadd #define ATH_VENDOR_PKT_TX 0x02 3220e168bb8SAdrian Chadd #define ATH_VENDOR_PKT_RXPHYERR 0x04 3230e168bb8SAdrian Chadd #define ATH_VENDOR_PKT_ISAGGR 0x08 3240e168bb8SAdrian Chadd #define ATH_VENDOR_PKT_MOREAGGR 0x10 3250e168bb8SAdrian Chadd 3260e168bb8SAdrian Chadd uint8_t vh_rx_hwrate; /* hardware RX ratecode */ 3270e168bb8SAdrian Chadd uint8_t vh_rs_flags; /* RX HAL flags */ 3280e168bb8SAdrian Chadd uint8_t vh_pad[2]; /* pad to DWORD boundary */ 329e1b5ab97SAdrian Chadd } __packed; 330e1b5ab97SAdrian Chadd #endif /* ATH_ENABLE_RADIOTAP_VENDOR_EXT */ 331e1b5ab97SAdrian Chadd 33273454c73SSam Leffler struct ath_rx_radiotap_header { 33373454c73SSam Leffler struct ieee80211_radiotap_header wr_ihdr; 334e1b5ab97SAdrian Chadd 335e1b5ab97SAdrian Chadd #ifdef ATH_ENABLE_RADIOTAP_VENDOR_EXT 336e1b5ab97SAdrian Chadd /* Vendor extension header bitmap */ 337e1b5ab97SAdrian Chadd uint32_t wr_ext_bitmap; /* 4 */ 338e1b5ab97SAdrian Chadd 339e1b5ab97SAdrian Chadd /* 340e1b5ab97SAdrian Chadd * This padding is needed because: 341e1b5ab97SAdrian Chadd * + the radiotap header is 8 bytes; 342e1b5ab97SAdrian Chadd * + the extension bitmap is 4 bytes; 343e1b5ab97SAdrian Chadd * + the tsf is 8 bytes, so it must start on an 8 byte 344e1b5ab97SAdrian Chadd * boundary. 345e1b5ab97SAdrian Chadd */ 346e1b5ab97SAdrian Chadd uint32_t wr_pad1; 347e1b5ab97SAdrian Chadd #endif /* ATH_ENABLE_RADIOTAP_VENDOR_EXT */ 348e1b5ab97SAdrian Chadd 349e1b5ab97SAdrian Chadd /* Normal radiotap fields */ 3507b0c77ecSSam Leffler u_int64_t wr_tsf; 3517b0c77ecSSam Leffler u_int8_t wr_flags; 35273454c73SSam Leffler u_int8_t wr_rate; 35368e8e04eSSam Leffler int8_t wr_antsignal; 35468e8e04eSSam Leffler int8_t wr_antnoise; 3557b0c77ecSSam Leffler u_int8_t wr_antenna; 35668e8e04eSSam Leffler u_int8_t wr_pad[3]; 35768e8e04eSSam Leffler u_int32_t wr_chan_flags; 35868e8e04eSSam Leffler u_int16_t wr_chan_freq; 35968e8e04eSSam Leffler u_int8_t wr_chan_ieee; 36068e8e04eSSam Leffler int8_t wr_chan_maxpow; 361e1b5ab97SAdrian Chadd 362e1b5ab97SAdrian Chadd #ifdef ATH_ENABLE_RADIOTAP_VENDOR_EXT 363e1b5ab97SAdrian Chadd /* 364e1b5ab97SAdrian Chadd * Vendor header section, as required by the 365e1b5ab97SAdrian Chadd * presence of the vendor extension bit and bitmap 366e1b5ab97SAdrian Chadd * entry. 367e1b5ab97SAdrian Chadd * 368e1b5ab97SAdrian Chadd * XXX This must be aligned to a 4 byte address? 369e1b5ab97SAdrian Chadd * XXX or 8 byte address? 370e1b5ab97SAdrian Chadd */ 371e1b5ab97SAdrian Chadd struct ieee80211_radiotap_vendor_header wr_vh; /* 6 bytes */ 372e1b5ab97SAdrian Chadd 373e1b5ab97SAdrian Chadd /* 374e1b5ab97SAdrian Chadd * Because of the lack of alignment enforced by the above 375e1b5ab97SAdrian Chadd * header, this vendor section won't be aligned in any 376e1b5ab97SAdrian Chadd * useful way. So, this will include a two-byte version 377e1b5ab97SAdrian Chadd * value which will force the structure to be 4-byte aligned. 378e1b5ab97SAdrian Chadd */ 379e1b5ab97SAdrian Chadd struct ath_radiotap_vendor_hdr wr_v; 380e1b5ab97SAdrian Chadd #endif /* ATH_ENABLE_RADIOTAP_VENDOR_EXT */ 381786ac703SAndriy Voskoboinyk } __packed __aligned(8); 38273454c73SSam Leffler 38373454c73SSam Leffler #define ATH_TX_RADIOTAP_PRESENT ( \ 38473454c73SSam Leffler (1 << IEEE80211_RADIOTAP_FLAGS) | \ 38573454c73SSam Leffler (1 << IEEE80211_RADIOTAP_RATE) | \ 386eb2cdcb1SSam Leffler (1 << IEEE80211_RADIOTAP_DBM_TX_POWER) | \ 387eb2cdcb1SSam Leffler (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 38868e8e04eSSam Leffler (1 << IEEE80211_RADIOTAP_XCHANNEL) | \ 38973454c73SSam Leffler 0) 39073454c73SSam Leffler 39173454c73SSam Leffler struct ath_tx_radiotap_header { 39273454c73SSam Leffler struct ieee80211_radiotap_header wt_ihdr; 3937b0c77ecSSam Leffler u_int8_t wt_flags; 39473454c73SSam Leffler u_int8_t wt_rate; 395eb2cdcb1SSam Leffler u_int8_t wt_txpower; 396eb2cdcb1SSam Leffler u_int8_t wt_antenna; 39768e8e04eSSam Leffler u_int32_t wt_chan_flags; 39868e8e04eSSam Leffler u_int16_t wt_chan_freq; 39968e8e04eSSam Leffler u_int8_t wt_chan_ieee; 40068e8e04eSSam Leffler int8_t wt_chan_maxpow; 40168e8e04eSSam Leffler } __packed; 40273454c73SSam Leffler 403f51c84eaSAdrian Chadd /* 404f51c84eaSAdrian Chadd * DFS ioctl commands 405f51c84eaSAdrian Chadd */ 406f51c84eaSAdrian Chadd 407f51c84eaSAdrian Chadd #define DFS_SET_THRESH 2 408f51c84eaSAdrian Chadd #define DFS_GET_THRESH 3 409f51c84eaSAdrian Chadd #define DFS_RADARDETECTS 6 410f51c84eaSAdrian Chadd 411f51c84eaSAdrian Chadd /* 412f51c84eaSAdrian Chadd * DFS ioctl parameter types 413f51c84eaSAdrian Chadd */ 414f51c84eaSAdrian Chadd #define DFS_PARAM_FIRPWR 1 415f51c84eaSAdrian Chadd #define DFS_PARAM_RRSSI 2 416f51c84eaSAdrian Chadd #define DFS_PARAM_HEIGHT 3 417f51c84eaSAdrian Chadd #define DFS_PARAM_PRSSI 4 418f51c84eaSAdrian Chadd #define DFS_PARAM_INBAND 5 419f51c84eaSAdrian Chadd #define DFS_PARAM_NOL 6 /* XXX not used in FreeBSD */ 420f51c84eaSAdrian Chadd #define DFS_PARAM_RELSTEP_EN 7 421f51c84eaSAdrian Chadd #define DFS_PARAM_RELSTEP 8 422f51c84eaSAdrian Chadd #define DFS_PARAM_RELPWR_EN 9 423f51c84eaSAdrian Chadd #define DFS_PARAM_RELPWR 10 424f51c84eaSAdrian Chadd #define DFS_PARAM_MAXLEN 11 425f51c84eaSAdrian Chadd #define DFS_PARAM_USEFIR128 12 426f51c84eaSAdrian Chadd #define DFS_PARAM_BLOCKRADAR 13 427f51c84eaSAdrian Chadd #define DFS_PARAM_MAXRSSI_EN 14 428f51c84eaSAdrian Chadd 429f51c84eaSAdrian Chadd /* FreeBSD-specific start at 32 */ 430f51c84eaSAdrian Chadd #define DFS_PARAM_ENABLE 32 431f51c84eaSAdrian Chadd #define DFS_PARAM_EN_EXTCH 33 432f51c84eaSAdrian Chadd 4339af351f9SAdrian Chadd /* 4349af351f9SAdrian Chadd * Spectral ioctl parameter types 4359af351f9SAdrian Chadd */ 4369af351f9SAdrian Chadd #define SPECTRAL_PARAM_FFT_PERIOD 1 4379af351f9SAdrian Chadd #define SPECTRAL_PARAM_SS_PERIOD 2 4389af351f9SAdrian Chadd #define SPECTRAL_PARAM_SS_COUNT 3 4399af351f9SAdrian Chadd #define SPECTRAL_PARAM_SS_SHORT_RPT 4 4409af351f9SAdrian Chadd #define SPECTRAL_PARAM_ENABLED 5 4419af351f9SAdrian Chadd #define SPECTRAL_PARAM_ACTIVE 6 44238fbe19bSAdrian Chadd #define SPECTRAL_PARAM_SS_SPECTRAL_PRI 7 4439af351f9SAdrian Chadd 4449af351f9SAdrian Chadd /* 4459af351f9SAdrian Chadd * Spectral control parameters 4469af351f9SAdrian Chadd */ 4479af351f9SAdrian Chadd #define SIOCGATHSPECTRAL _IOWR('i', 151, struct ath_diag) 4489af351f9SAdrian Chadd 4499af351f9SAdrian Chadd #define SPECTRAL_CONTROL_ENABLE 2 4509af351f9SAdrian Chadd #define SPECTRAL_CONTROL_DISABLE 3 4519af351f9SAdrian Chadd #define SPECTRAL_CONTROL_START 4 4529af351f9SAdrian Chadd #define SPECTRAL_CONTROL_STOP 5 4539af351f9SAdrian Chadd #define SPECTRAL_CONTROL_GET_PARAMS 6 4549af351f9SAdrian Chadd #define SPECTRAL_CONTROL_SET_PARAMS 7 455e1c562d8SAdrian Chadd #define SPECTRAL_CONTROL_ENABLE_AT_RESET 8 456e1c562d8SAdrian Chadd #define SPECTRAL_CONTROL_DISABLE_AT_RESET 9 4579af351f9SAdrian Chadd 4585566fb10SAdrian Chadd /* 4595566fb10SAdrian Chadd * Bluetooth coexistence control parameters 4605566fb10SAdrian Chadd */ 4615566fb10SAdrian Chadd #define SIOCGATHBTCOEX _IOWR('i', 152, struct ath_diag) 4625566fb10SAdrian Chadd 4635591b213SSam Leffler #endif /* _DEV_ATH_ATHIOCTL_H */ 464