15591b213SSam Leffler /*- 210ad9a77SSam Leffler * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 35591b213SSam Leffler * All rights reserved. 45591b213SSam Leffler * 55591b213SSam Leffler * Redistribution and use in source and binary forms, with or without 65591b213SSam Leffler * modification, are permitted provided that the following conditions 75591b213SSam Leffler * are met: 85591b213SSam Leffler * 1. Redistributions of source code must retain the above copyright 95591b213SSam Leffler * notice, this list of conditions and the following disclaimer, 105591b213SSam Leffler * without modification. 115591b213SSam Leffler * 2. Redistributions in binary form must reproduce at minimum a disclaimer 125591b213SSam Leffler * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 135591b213SSam Leffler * redistribution must be conditioned upon including a substantially 145591b213SSam Leffler * similar Disclaimer requirement for further binary redistribution. 155591b213SSam Leffler * 165591b213SSam Leffler * NO WARRANTY 175591b213SSam Leffler * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 185591b213SSam Leffler * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 195591b213SSam Leffler * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 205591b213SSam Leffler * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 215591b213SSam Leffler * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 225591b213SSam Leffler * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 235591b213SSam Leffler * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 245591b213SSam Leffler * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 255591b213SSam Leffler * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 265591b213SSam Leffler * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 275591b213SSam Leffler * THE POSSIBILITY OF SUCH DAMAGES. 285591b213SSam Leffler * 295591b213SSam Leffler * $FreeBSD$ 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; 46712a80b8SAdrian Chadd }; 47712a80b8SAdrian Chadd 485591b213SSam Leffler struct ath_stats { 495591b213SSam Leffler u_int32_t ast_watchdog; /* device reset by watchdog */ 505591b213SSam Leffler u_int32_t ast_hardware; /* fatal hardware error interrupts */ 515591b213SSam Leffler u_int32_t ast_bmiss; /* beacon miss interrupts */ 52d7736e13SSam Leffler u_int32_t ast_bmiss_phantom;/* beacon miss interrupts */ 53c42a7b7eSSam Leffler u_int32_t ast_bstuck; /* beacon stuck interrupts */ 545591b213SSam Leffler u_int32_t ast_rxorn; /* rx overrun interrupts */ 555591b213SSam Leffler u_int32_t ast_rxeol; /* rx eol interrupts */ 565591b213SSam Leffler u_int32_t ast_txurn; /* tx underrun interrupts */ 57c42a7b7eSSam Leffler u_int32_t ast_mib; /* mib interrupts */ 585591b213SSam Leffler u_int32_t ast_intrcoal; /* interrupts coalesced */ 59c42a7b7eSSam Leffler u_int32_t ast_tx_packets; /* packet sent on the interface */ 605591b213SSam Leffler u_int32_t ast_tx_mgmt; /* management frames transmitted */ 615591b213SSam Leffler u_int32_t ast_tx_discard; /* frames discarded prior to assoc */ 625591b213SSam Leffler u_int32_t ast_tx_qstop; /* output stopped 'cuz no buffer */ 635591b213SSam Leffler u_int32_t ast_tx_encap; /* tx encapsulation failed */ 645591b213SSam Leffler u_int32_t ast_tx_nonode; /* tx failed 'cuz no node */ 655591b213SSam Leffler u_int32_t ast_tx_nombuf; /* tx failed 'cuz no mbuf */ 665591b213SSam Leffler u_int32_t ast_tx_nomcl; /* tx failed 'cuz no cluster */ 675591b213SSam Leffler u_int32_t ast_tx_linear; /* tx linearized to cluster */ 685591b213SSam Leffler u_int32_t ast_tx_nodata; /* tx discarded empty frame */ 695591b213SSam Leffler u_int32_t ast_tx_busdma; /* tx failed for dma resrcs */ 705591b213SSam Leffler u_int32_t ast_tx_xretries;/* tx failed 'cuz too many retries */ 715591b213SSam Leffler u_int32_t ast_tx_fifoerr; /* tx failed 'cuz FIFO underrun */ 725591b213SSam Leffler u_int32_t ast_tx_filtered;/* tx failed 'cuz xmit filtered */ 735591b213SSam Leffler u_int32_t ast_tx_shortretry;/* tx on-chip retries (short) */ 745591b213SSam Leffler u_int32_t ast_tx_longretry;/* tx on-chip retries (long) */ 755591b213SSam Leffler u_int32_t ast_tx_badrate; /* tx failed 'cuz bogus xmit rate */ 765591b213SSam Leffler u_int32_t ast_tx_noack; /* tx frames with no ack marked */ 775591b213SSam Leffler u_int32_t ast_tx_rts; /* tx frames with rts enabled */ 785591b213SSam Leffler u_int32_t ast_tx_cts; /* tx frames with cts enabled */ 795591b213SSam Leffler u_int32_t ast_tx_shortpre;/* tx frames with short preamble */ 8059f32d6bSSam Leffler u_int32_t ast_tx_altrate; /* tx frames with alternate rate */ 8159f32d6bSSam Leffler u_int32_t ast_tx_protect; /* tx frames with protection */ 8268e8e04eSSam Leffler u_int32_t ast_tx_ctsburst;/* tx frames with cts and bursting */ 8368e8e04eSSam Leffler u_int32_t ast_tx_ctsext; /* tx frames with cts extension */ 845591b213SSam Leffler u_int32_t ast_rx_nombuf; /* rx setup failed 'cuz no mbuf */ 855591b213SSam Leffler u_int32_t ast_rx_busdma; /* rx setup failed for dma resrcs */ 865591b213SSam Leffler u_int32_t ast_rx_orn; /* rx failed 'cuz of desc overrun */ 875591b213SSam Leffler u_int32_t ast_rx_crcerr; /* rx failed 'cuz of bad CRC */ 885591b213SSam Leffler u_int32_t ast_rx_fifoerr; /* rx failed 'cuz of FIFO overrun */ 895591b213SSam Leffler u_int32_t ast_rx_badcrypt;/* rx failed 'cuz decryption */ 90c42a7b7eSSam Leffler u_int32_t ast_rx_badmic; /* rx failed 'cuz MIC failure */ 915591b213SSam Leffler u_int32_t ast_rx_phyerr; /* rx failed 'cuz of PHY err */ 92f9aa1d90SAdrian Chadd u_int32_t ast_rx_phy[64]; /* rx PHY error per-code counts */ 93d1d0cf62SSam Leffler u_int32_t ast_rx_tooshort;/* rx discarded 'cuz frame too short */ 9459f32d6bSSam Leffler u_int32_t ast_rx_toobig; /* rx discarded 'cuz frame too large */ 95c42a7b7eSSam Leffler u_int32_t ast_rx_packets; /* packet recv on the interface */ 96c42a7b7eSSam Leffler u_int32_t ast_rx_mgt; /* management frames received */ 97d1d0cf62SSam Leffler u_int32_t ast_rx_ctl; /* rx discarded 'cuz ctl frame */ 98c42a7b7eSSam Leffler int8_t ast_tx_rssi; /* tx rssi of last ack */ 99c42a7b7eSSam Leffler int8_t ast_rx_rssi; /* rx rssi from histogram */ 1006bf62dd1SSam Leffler u_int8_t ast_tx_rate; /* IEEE rate of last unicast tx */ 101c42a7b7eSSam Leffler u_int32_t ast_be_xmit; /* beacons transmitted */ 1025591b213SSam Leffler u_int32_t ast_be_nombuf; /* beacon setup failed 'cuz no mbuf */ 1035591b213SSam Leffler u_int32_t ast_per_cal; /* periodic calibration calls */ 1045591b213SSam Leffler u_int32_t ast_per_calfail;/* periodic calibration failed */ 1055591b213SSam Leffler u_int32_t ast_per_rfgain; /* periodic calibration rfgain reset */ 1065591b213SSam Leffler u_int32_t ast_rate_calls; /* rate control checks */ 1075591b213SSam Leffler u_int32_t ast_rate_raise; /* rate control raised xmit rate */ 1085591b213SSam Leffler u_int32_t ast_rate_drop; /* rate control dropped xmit rate */ 109c42a7b7eSSam Leffler u_int32_t ast_ant_defswitch;/* rx/default antenna switches */ 110c42a7b7eSSam Leffler u_int32_t ast_ant_txswitch;/* tx antenna switches */ 111c42a7b7eSSam Leffler u_int32_t ast_ant_rx[8]; /* rx frames with antenna */ 112c42a7b7eSSam Leffler u_int32_t ast_ant_tx[8]; /* tx frames with antenna */ 11330db812aSSam Leffler u_int32_t ast_cabq_xmit; /* cabq frames transmitted */ 11430db812aSSam Leffler u_int32_t ast_cabq_busy; /* cabq found busy */ 115664443d0SSam Leffler u_int32_t ast_tx_raw; /* tx frames through raw api */ 11668e8e04eSSam Leffler u_int32_t ast_ff_txok; /* fast frames tx'd successfully */ 11768e8e04eSSam Leffler u_int32_t ast_ff_txerr; /* fast frames tx'd w/ error */ 11868e8e04eSSam Leffler u_int32_t ast_ff_rx; /* fast frames rx'd */ 11968e8e04eSSam Leffler u_int32_t ast_ff_flush; /* fast frames flushed from staging q */ 12068e8e04eSSam Leffler u_int32_t ast_tx_qfull; /* tx dropped 'cuz of queue limit */ 12168e8e04eSSam Leffler int8_t ast_rx_noise; /* rx noise floor */ 12210ad9a77SSam Leffler u_int32_t ast_tx_nobuf; /* tx dropped 'cuz no ath buffer */ 12310ad9a77SSam Leffler u_int32_t ast_tdma_update;/* TDMA slot timing updates */ 12410ad9a77SSam Leffler u_int32_t ast_tdma_timers;/* TDMA slot update set beacon timers */ 12510ad9a77SSam Leffler u_int32_t ast_tdma_tsf; /* TDMA slot update set TSF */ 12610ad9a77SSam Leffler u_int16_t ast_tdma_tsfadjp;/* TDMA slot adjust+ (usec, smoothed)*/ 12710ad9a77SSam Leffler u_int16_t ast_tdma_tsfadjm;/* TDMA slot adjust- (usec, smoothed)*/ 1283267a60cSSam Leffler u_int32_t ast_tdma_ack; /* TDMA tx failed 'cuz ACK required */ 1293267a60cSSam Leffler u_int32_t ast_tx_raw_fail;/* raw tx failed 'cuz h/w down */ 13036c6be9aSSam Leffler u_int32_t ast_tx_nofrag; /* tx dropped 'cuz no ath frag buffer */ 1317ec4e6b8SAdrian Chadd u_int32_t ast_be_missed; /* missed beacons */ 132a108ab63SAdrian Chadd u_int32_t ast_ani_cal; /* ANI calibrations performed */ 133f673a810SAdrian Chadd u_int32_t ast_rx_agg; /* number of aggregate frames RX'ed */ 134e9d1191fSAdrian Chadd u_int32_t ast_rx_halfgi; /* RX half-GI */ 135e9d1191fSAdrian Chadd u_int32_t ast_rx_2040; /* RX 40mhz frame */ 136e9d1191fSAdrian Chadd u_int32_t ast_rx_pre_crc_err; /* RX pre-delimiter CRC error */ 137e9d1191fSAdrian Chadd u_int32_t ast_rx_post_crc_err; /* RX post-delimiter CRC error */ 138e9d1191fSAdrian Chadd u_int32_t ast_rx_decrypt_busy_err; /* RX decrypt engine busy error */ 139f9aa1d90SAdrian Chadd u_int32_t ast_rx_hi_rx_chain; 140d6efa330SAdrian Chadd u_int32_t ast_tx_htprotect; /* HT tx frames with protection */ 141e9d1191fSAdrian Chadd u_int32_t ast_rx_hitqueueend; /* RX hit descr queue end */ 1426ad02dbaSAdrian Chadd u_int32_t ast_tx_timeout; /* Global TX timeout */ 1435594f5c0SAdrian Chadd u_int32_t ast_tx_cst; /* Carrier sense timeout */ 144e9d1191fSAdrian Chadd u_int32_t ast_tx_xtxop; /* tx exceeded TXOP */ 145e9d1191fSAdrian Chadd u_int32_t ast_tx_timerexpired; /* tx exceeded TX_TIMER */ 146e9d1191fSAdrian Chadd u_int32_t ast_tx_desccfgerr; /* tx desc cfg error */ 147b390e40aSAdrian Chadd u_int32_t ast_tx_swretries; /* software TX retries */ 148b390e40aSAdrian Chadd u_int32_t ast_tx_swretrymax; /* software TX retry max limit reach */ 149b390e40aSAdrian Chadd u_int32_t ast_tx_data_underrun; 150b390e40aSAdrian Chadd u_int32_t ast_tx_delim_underrun; 1512d3d4776SAdrian Chadd u_int32_t ast_tx_aggr_failall; /* aggregate TX failed in its entirety */ 152b390e40aSAdrian Chadd u_int32_t ast_tx_getnobuf; 153b390e40aSAdrian Chadd u_int32_t ast_tx_getbusybuf; 154b390e40aSAdrian Chadd u_int32_t ast_tx_intr; 155b390e40aSAdrian Chadd u_int32_t ast_rx_intr; 1562d3d4776SAdrian Chadd u_int32_t ast_tx_aggr_ok; /* aggregate TX ok */ 1572d3d4776SAdrian Chadd u_int32_t ast_tx_aggr_fail; /* aggregate TX failed */ 158*9c85ff91SAdrian Chadd u_int32_t ast_tx_mcastq_overflow; /* multicast queue overflow */ 159*9c85ff91SAdrian Chadd u_int32_t ast_pad[1]; 1605591b213SSam Leffler }; 1615591b213SSam Leffler 1625591b213SSam Leffler #define SIOCGATHSTATS _IOWR('i', 137, struct ifreq) 1633fc21fedSSam Leffler #define SIOCZATHSTATS _IOWR('i', 139, struct ifreq) 1645591b213SSam Leffler 1658cec0ab9SSam Leffler struct ath_diag { 1668cec0ab9SSam Leffler char ad_name[IFNAMSIZ]; /* if name, e.g. "ath0" */ 167c42a7b7eSSam Leffler u_int16_t ad_id; 168c42a7b7eSSam Leffler #define ATH_DIAG_DYN 0x8000 /* allocate buffer in caller */ 169c42a7b7eSSam Leffler #define ATH_DIAG_IN 0x4000 /* copy in parameters */ 170c42a7b7eSSam Leffler #define ATH_DIAG_OUT 0x0000 /* copy out results (always) */ 171c42a7b7eSSam Leffler #define ATH_DIAG_ID 0x0fff 172c42a7b7eSSam Leffler u_int16_t ad_in_size; /* pack to fit, yech */ 173c42a7b7eSSam Leffler caddr_t ad_in_data; 174c42a7b7eSSam Leffler caddr_t ad_out_data; 175c42a7b7eSSam Leffler u_int ad_out_size; 1768cec0ab9SSam Leffler 1778cec0ab9SSam Leffler }; 1788cec0ab9SSam Leffler #define SIOCGATHDIAG _IOWR('i', 138, struct ath_diag) 179f51c84eaSAdrian Chadd #define SIOCGATHPHYERR _IOWR('i', 140, struct ath_diag) 1808cec0ab9SSam Leffler 18173454c73SSam Leffler /* 18273454c73SSam Leffler * Radio capture format. 18373454c73SSam Leffler */ 18473454c73SSam Leffler #define ATH_RX_RADIOTAP_PRESENT ( \ 1857b0c77ecSSam Leffler (1 << IEEE80211_RADIOTAP_TSFT) | \ 18673454c73SSam Leffler (1 << IEEE80211_RADIOTAP_FLAGS) | \ 18773454c73SSam Leffler (1 << IEEE80211_RADIOTAP_RATE) | \ 18873454c73SSam Leffler (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 1897b0c77ecSSam Leffler (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ 1907b0c77ecSSam Leffler (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ 19168e8e04eSSam Leffler (1 << IEEE80211_RADIOTAP_XCHANNEL) | \ 19273454c73SSam Leffler 0) 19373454c73SSam Leffler 19473454c73SSam Leffler struct ath_rx_radiotap_header { 19573454c73SSam Leffler struct ieee80211_radiotap_header wr_ihdr; 1967b0c77ecSSam Leffler u_int64_t wr_tsf; 1977b0c77ecSSam Leffler u_int8_t wr_flags; 19873454c73SSam Leffler u_int8_t wr_rate; 19968e8e04eSSam Leffler int8_t wr_antsignal; 20068e8e04eSSam Leffler int8_t wr_antnoise; 2017b0c77ecSSam Leffler u_int8_t wr_antenna; 20268e8e04eSSam Leffler u_int8_t wr_pad[3]; 20368e8e04eSSam Leffler u_int32_t wr_chan_flags; 20468e8e04eSSam Leffler u_int16_t wr_chan_freq; 20568e8e04eSSam Leffler u_int8_t wr_chan_ieee; 20668e8e04eSSam Leffler int8_t wr_chan_maxpow; 20768e8e04eSSam Leffler } __packed; 20873454c73SSam Leffler 20973454c73SSam Leffler #define ATH_TX_RADIOTAP_PRESENT ( \ 2107b0c77ecSSam Leffler (1 << IEEE80211_RADIOTAP_TSFT) | \ 21173454c73SSam Leffler (1 << IEEE80211_RADIOTAP_FLAGS) | \ 21273454c73SSam Leffler (1 << IEEE80211_RADIOTAP_RATE) | \ 213eb2cdcb1SSam Leffler (1 << IEEE80211_RADIOTAP_DBM_TX_POWER) | \ 214eb2cdcb1SSam Leffler (1 << IEEE80211_RADIOTAP_ANTENNA) | \ 21568e8e04eSSam Leffler (1 << IEEE80211_RADIOTAP_XCHANNEL) | \ 21673454c73SSam Leffler 0) 21773454c73SSam Leffler 21873454c73SSam Leffler struct ath_tx_radiotap_header { 21973454c73SSam Leffler struct ieee80211_radiotap_header wt_ihdr; 2207b0c77ecSSam Leffler u_int64_t wt_tsf; 2217b0c77ecSSam Leffler u_int8_t wt_flags; 22273454c73SSam Leffler u_int8_t wt_rate; 223eb2cdcb1SSam Leffler u_int8_t wt_txpower; 224eb2cdcb1SSam Leffler u_int8_t wt_antenna; 22568e8e04eSSam Leffler u_int32_t wt_chan_flags; 22668e8e04eSSam Leffler u_int16_t wt_chan_freq; 22768e8e04eSSam Leffler u_int8_t wt_chan_ieee; 22868e8e04eSSam Leffler int8_t wt_chan_maxpow; 22968e8e04eSSam Leffler } __packed; 23073454c73SSam Leffler 231f51c84eaSAdrian Chadd /* 232f51c84eaSAdrian Chadd * DFS ioctl commands 233f51c84eaSAdrian Chadd */ 234f51c84eaSAdrian Chadd 235f51c84eaSAdrian Chadd #define DFS_SET_THRESH 2 236f51c84eaSAdrian Chadd #define DFS_GET_THRESH 3 237f51c84eaSAdrian Chadd #define DFS_RADARDETECTS 6 238f51c84eaSAdrian Chadd 239f51c84eaSAdrian Chadd /* 240f51c84eaSAdrian Chadd * DFS ioctl parameter types 241f51c84eaSAdrian Chadd */ 242f51c84eaSAdrian Chadd #define DFS_PARAM_FIRPWR 1 243f51c84eaSAdrian Chadd #define DFS_PARAM_RRSSI 2 244f51c84eaSAdrian Chadd #define DFS_PARAM_HEIGHT 3 245f51c84eaSAdrian Chadd #define DFS_PARAM_PRSSI 4 246f51c84eaSAdrian Chadd #define DFS_PARAM_INBAND 5 247f51c84eaSAdrian Chadd #define DFS_PARAM_NOL 6 /* XXX not used in FreeBSD */ 248f51c84eaSAdrian Chadd #define DFS_PARAM_RELSTEP_EN 7 249f51c84eaSAdrian Chadd #define DFS_PARAM_RELSTEP 8 250f51c84eaSAdrian Chadd #define DFS_PARAM_RELPWR_EN 9 251f51c84eaSAdrian Chadd #define DFS_PARAM_RELPWR 10 252f51c84eaSAdrian Chadd #define DFS_PARAM_MAXLEN 11 253f51c84eaSAdrian Chadd #define DFS_PARAM_USEFIR128 12 254f51c84eaSAdrian Chadd #define DFS_PARAM_BLOCKRADAR 13 255f51c84eaSAdrian Chadd #define DFS_PARAM_MAXRSSI_EN 14 256f51c84eaSAdrian Chadd 257f51c84eaSAdrian Chadd /* FreeBSD-specific start at 32 */ 258f51c84eaSAdrian Chadd #define DFS_PARAM_ENABLE 32 259f51c84eaSAdrian Chadd #define DFS_PARAM_EN_EXTCH 33 260f51c84eaSAdrian Chadd 2615591b213SSam Leffler #endif /* _DEV_ATH_ATHIOCTL_H */ 262