xref: /freebsd/sys/dev/ath/if_athioctl.h (revision f9aa1d90b5fcc8a09dc563b93a782c770aa43523)
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 
385591b213SSam Leffler struct ath_stats {
395591b213SSam Leffler 	u_int32_t	ast_watchdog;	/* device reset by watchdog */
405591b213SSam Leffler 	u_int32_t	ast_hardware;	/* fatal hardware error interrupts */
415591b213SSam Leffler 	u_int32_t	ast_bmiss;	/* beacon miss interrupts */
42d7736e13SSam Leffler 	u_int32_t	ast_bmiss_phantom;/* beacon miss interrupts */
43c42a7b7eSSam Leffler 	u_int32_t	ast_bstuck;	/* beacon stuck interrupts */
445591b213SSam Leffler 	u_int32_t	ast_rxorn;	/* rx overrun interrupts */
455591b213SSam Leffler 	u_int32_t	ast_rxeol;	/* rx eol interrupts */
465591b213SSam Leffler 	u_int32_t	ast_txurn;	/* tx underrun interrupts */
47c42a7b7eSSam Leffler 	u_int32_t	ast_mib;	/* mib interrupts */
485591b213SSam Leffler 	u_int32_t	ast_intrcoal;	/* interrupts coalesced */
49c42a7b7eSSam Leffler 	u_int32_t	ast_tx_packets;	/* packet sent on the interface */
505591b213SSam Leffler 	u_int32_t	ast_tx_mgmt;	/* management frames transmitted */
515591b213SSam Leffler 	u_int32_t	ast_tx_discard;	/* frames discarded prior to assoc */
525591b213SSam Leffler 	u_int32_t	ast_tx_qstop;	/* output stopped 'cuz no buffer */
535591b213SSam Leffler 	u_int32_t	ast_tx_encap;	/* tx encapsulation failed */
545591b213SSam Leffler 	u_int32_t	ast_tx_nonode;	/* tx failed 'cuz no node */
555591b213SSam Leffler 	u_int32_t	ast_tx_nombuf;	/* tx failed 'cuz no mbuf */
565591b213SSam Leffler 	u_int32_t	ast_tx_nomcl;	/* tx failed 'cuz no cluster */
575591b213SSam Leffler 	u_int32_t	ast_tx_linear;	/* tx linearized to cluster */
585591b213SSam Leffler 	u_int32_t	ast_tx_nodata;	/* tx discarded empty frame */
595591b213SSam Leffler 	u_int32_t	ast_tx_busdma;	/* tx failed for dma resrcs */
605591b213SSam Leffler 	u_int32_t	ast_tx_xretries;/* tx failed 'cuz too many retries */
615591b213SSam Leffler 	u_int32_t	ast_tx_fifoerr;	/* tx failed 'cuz FIFO underrun */
625591b213SSam Leffler 	u_int32_t	ast_tx_filtered;/* tx failed 'cuz xmit filtered */
635591b213SSam Leffler 	u_int32_t	ast_tx_shortretry;/* tx on-chip retries (short) */
645591b213SSam Leffler 	u_int32_t	ast_tx_longretry;/* tx on-chip retries (long) */
655591b213SSam Leffler 	u_int32_t	ast_tx_badrate;	/* tx failed 'cuz bogus xmit rate */
665591b213SSam Leffler 	u_int32_t	ast_tx_noack;	/* tx frames with no ack marked */
675591b213SSam Leffler 	u_int32_t	ast_tx_rts;	/* tx frames with rts enabled */
685591b213SSam Leffler 	u_int32_t	ast_tx_cts;	/* tx frames with cts enabled */
695591b213SSam Leffler 	u_int32_t	ast_tx_shortpre;/* tx frames with short preamble */
7059f32d6bSSam Leffler 	u_int32_t	ast_tx_altrate;	/* tx frames with alternate rate */
7159f32d6bSSam Leffler 	u_int32_t	ast_tx_protect;	/* tx frames with protection */
7268e8e04eSSam Leffler 	u_int32_t	ast_tx_ctsburst;/* tx frames with cts and bursting */
7368e8e04eSSam Leffler 	u_int32_t	ast_tx_ctsext;	/* tx frames with cts extension */
745591b213SSam Leffler 	u_int32_t	ast_rx_nombuf;	/* rx setup failed 'cuz no mbuf */
755591b213SSam Leffler 	u_int32_t	ast_rx_busdma;	/* rx setup failed for dma resrcs */
765591b213SSam Leffler 	u_int32_t	ast_rx_orn;	/* rx failed 'cuz of desc overrun */
775591b213SSam Leffler 	u_int32_t	ast_rx_crcerr;	/* rx failed 'cuz of bad CRC */
785591b213SSam Leffler 	u_int32_t	ast_rx_fifoerr;	/* rx failed 'cuz of FIFO overrun */
795591b213SSam Leffler 	u_int32_t	ast_rx_badcrypt;/* rx failed 'cuz decryption */
80c42a7b7eSSam Leffler 	u_int32_t	ast_rx_badmic;	/* rx failed 'cuz MIC failure */
815591b213SSam Leffler 	u_int32_t	ast_rx_phyerr;	/* rx failed 'cuz of PHY err */
82*f9aa1d90SAdrian Chadd 	u_int32_t	ast_rx_phy[64];	/* rx PHY error per-code counts */
83d1d0cf62SSam Leffler 	u_int32_t	ast_rx_tooshort;/* rx discarded 'cuz frame too short */
8459f32d6bSSam Leffler 	u_int32_t	ast_rx_toobig;	/* rx discarded 'cuz frame too large */
85c42a7b7eSSam Leffler 	u_int32_t	ast_rx_packets;	/* packet recv on the interface */
86c42a7b7eSSam Leffler 	u_int32_t	ast_rx_mgt;	/* management frames received */
87d1d0cf62SSam Leffler 	u_int32_t	ast_rx_ctl;	/* rx discarded 'cuz ctl frame */
88c42a7b7eSSam Leffler 	int8_t		ast_tx_rssi;	/* tx rssi of last ack */
89c42a7b7eSSam Leffler 	int8_t		ast_rx_rssi;	/* rx rssi from histogram */
906bf62dd1SSam Leffler 	u_int8_t	ast_tx_rate;	/* IEEE rate of last unicast tx */
91c42a7b7eSSam Leffler 	u_int32_t	ast_be_xmit;	/* beacons transmitted */
925591b213SSam Leffler 	u_int32_t	ast_be_nombuf;	/* beacon setup failed 'cuz no mbuf */
935591b213SSam Leffler 	u_int32_t	ast_per_cal;	/* periodic calibration calls */
945591b213SSam Leffler 	u_int32_t	ast_per_calfail;/* periodic calibration failed */
955591b213SSam Leffler 	u_int32_t	ast_per_rfgain;	/* periodic calibration rfgain reset */
965591b213SSam Leffler 	u_int32_t	ast_rate_calls;	/* rate control checks */
975591b213SSam Leffler 	u_int32_t	ast_rate_raise;	/* rate control raised xmit rate */
985591b213SSam Leffler 	u_int32_t	ast_rate_drop;	/* rate control dropped xmit rate */
99c42a7b7eSSam Leffler 	u_int32_t	ast_ant_defswitch;/* rx/default antenna switches */
100c42a7b7eSSam Leffler 	u_int32_t	ast_ant_txswitch;/* tx antenna switches */
101c42a7b7eSSam Leffler 	u_int32_t	ast_ant_rx[8];	/* rx frames with antenna */
102c42a7b7eSSam Leffler 	u_int32_t	ast_ant_tx[8];	/* tx frames with antenna */
10330db812aSSam Leffler 	u_int32_t	ast_cabq_xmit;	/* cabq frames transmitted */
10430db812aSSam Leffler 	u_int32_t	ast_cabq_busy;	/* cabq found busy */
105664443d0SSam Leffler 	u_int32_t	ast_tx_raw;	/* tx frames through raw api */
10668e8e04eSSam Leffler 	u_int32_t	ast_ff_txok;	/* fast frames tx'd successfully */
10768e8e04eSSam Leffler 	u_int32_t	ast_ff_txerr;	/* fast frames tx'd w/ error */
10868e8e04eSSam Leffler 	u_int32_t	ast_ff_rx;	/* fast frames rx'd */
10968e8e04eSSam Leffler 	u_int32_t	ast_ff_flush;	/* fast frames flushed from staging q */
11068e8e04eSSam Leffler 	u_int32_t	ast_tx_qfull;	/* tx dropped 'cuz of queue limit */
11168e8e04eSSam Leffler 	int8_t		ast_rx_noise;	/* rx noise floor */
11210ad9a77SSam Leffler 	u_int32_t	ast_tx_nobuf;	/* tx dropped 'cuz no ath buffer */
11310ad9a77SSam Leffler 	u_int32_t	ast_tdma_update;/* TDMA slot timing updates */
11410ad9a77SSam Leffler 	u_int32_t	ast_tdma_timers;/* TDMA slot update set beacon timers */
11510ad9a77SSam Leffler 	u_int32_t	ast_tdma_tsf;	/* TDMA slot update set TSF */
11610ad9a77SSam Leffler 	u_int16_t	ast_tdma_tsfadjp;/* TDMA slot adjust+ (usec, smoothed)*/
11710ad9a77SSam Leffler 	u_int16_t	ast_tdma_tsfadjm;/* TDMA slot adjust- (usec, smoothed)*/
1183267a60cSSam Leffler 	u_int32_t	ast_tdma_ack;	/* TDMA tx failed 'cuz ACK required */
1193267a60cSSam Leffler 	u_int32_t	ast_tx_raw_fail;/* raw tx failed 'cuz h/w down */
12036c6be9aSSam Leffler 	u_int32_t	ast_tx_nofrag;	/* tx dropped 'cuz no ath frag buffer */
1217ec4e6b8SAdrian Chadd 	u_int32_t	ast_be_missed;	/* missed beacons */
122a108ab63SAdrian Chadd 	u_int32_t	ast_ani_cal;	/* ANI calibrations performed */
123f673a810SAdrian Chadd 	u_int32_t	ast_rx_agg;	/* number of aggregate frames RX'ed */
124*f9aa1d90SAdrian Chadd 	u_int32_t	ast_rx_halfgi;
125*f9aa1d90SAdrian Chadd 	u_int32_t	ast_rx_2040;
126*f9aa1d90SAdrian Chadd 	u_int32_t	ast_rx_pre_crc_err;
127*f9aa1d90SAdrian Chadd 	u_int32_t	ast_rx_post_crc_err;
128*f9aa1d90SAdrian Chadd 	u_int32_t	ast_rx_decrypt_busy_err;
129*f9aa1d90SAdrian Chadd 	u_int32_t	ast_rx_hi_rx_chain;
130*f9aa1d90SAdrian Chadd 	u_int32_t	ast_pad[4];
1315591b213SSam Leffler };
1325591b213SSam Leffler 
1335591b213SSam Leffler #define	SIOCGATHSTATS	_IOWR('i', 137, struct ifreq)
1343fc21fedSSam Leffler #define	SIOCZATHSTATS	_IOWR('i', 139, struct ifreq)
1355591b213SSam Leffler 
1368cec0ab9SSam Leffler struct ath_diag {
1378cec0ab9SSam Leffler 	char	ad_name[IFNAMSIZ];	/* if name, e.g. "ath0" */
138c42a7b7eSSam Leffler 	u_int16_t ad_id;
139c42a7b7eSSam Leffler #define	ATH_DIAG_DYN	0x8000		/* allocate buffer in caller */
140c42a7b7eSSam Leffler #define	ATH_DIAG_IN	0x4000		/* copy in parameters */
141c42a7b7eSSam Leffler #define	ATH_DIAG_OUT	0x0000		/* copy out results (always) */
142c42a7b7eSSam Leffler #define	ATH_DIAG_ID	0x0fff
143c42a7b7eSSam Leffler 	u_int16_t ad_in_size;		/* pack to fit, yech */
144c42a7b7eSSam Leffler 	caddr_t	ad_in_data;
145c42a7b7eSSam Leffler 	caddr_t	ad_out_data;
146c42a7b7eSSam Leffler 	u_int	ad_out_size;
1478cec0ab9SSam Leffler 
1488cec0ab9SSam Leffler };
1498cec0ab9SSam Leffler #define	SIOCGATHDIAG	_IOWR('i', 138, struct ath_diag)
1508cec0ab9SSam Leffler 
15173454c73SSam Leffler /*
15273454c73SSam Leffler  * Radio capture format.
15373454c73SSam Leffler  */
15473454c73SSam Leffler #define ATH_RX_RADIOTAP_PRESENT (		\
1557b0c77ecSSam Leffler 	(1 << IEEE80211_RADIOTAP_TSFT)		| \
15673454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
15773454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_RATE)		| \
15873454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
1597b0c77ecSSam Leffler 	(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)	| \
1607b0c77ecSSam Leffler 	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
16168e8e04eSSam Leffler 	(1 << IEEE80211_RADIOTAP_XCHANNEL)	| \
16273454c73SSam Leffler 	0)
16373454c73SSam Leffler 
16473454c73SSam Leffler struct ath_rx_radiotap_header {
16573454c73SSam Leffler 	struct ieee80211_radiotap_header wr_ihdr;
1667b0c77ecSSam Leffler 	u_int64_t	wr_tsf;
1677b0c77ecSSam Leffler 	u_int8_t	wr_flags;
16873454c73SSam Leffler 	u_int8_t	wr_rate;
16968e8e04eSSam Leffler 	int8_t		wr_antsignal;
17068e8e04eSSam Leffler 	int8_t		wr_antnoise;
1717b0c77ecSSam Leffler 	u_int8_t	wr_antenna;
17268e8e04eSSam Leffler 	u_int8_t	wr_pad[3];
17368e8e04eSSam Leffler 	u_int32_t	wr_chan_flags;
17468e8e04eSSam Leffler 	u_int16_t	wr_chan_freq;
17568e8e04eSSam Leffler 	u_int8_t	wr_chan_ieee;
17668e8e04eSSam Leffler 	int8_t		wr_chan_maxpow;
17768e8e04eSSam Leffler } __packed;
17873454c73SSam Leffler 
17973454c73SSam Leffler #define ATH_TX_RADIOTAP_PRESENT (		\
1807b0c77ecSSam Leffler 	(1 << IEEE80211_RADIOTAP_TSFT)		| \
18173454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
18273454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_RATE)		| \
183eb2cdcb1SSam Leffler 	(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)	| \
184eb2cdcb1SSam Leffler 	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
18568e8e04eSSam Leffler 	(1 << IEEE80211_RADIOTAP_XCHANNEL)	| \
18673454c73SSam Leffler 	0)
18773454c73SSam Leffler 
18873454c73SSam Leffler struct ath_tx_radiotap_header {
18973454c73SSam Leffler 	struct ieee80211_radiotap_header wt_ihdr;
1907b0c77ecSSam Leffler 	u_int64_t	wt_tsf;
1917b0c77ecSSam Leffler 	u_int8_t	wt_flags;
19273454c73SSam Leffler 	u_int8_t	wt_rate;
193eb2cdcb1SSam Leffler 	u_int8_t	wt_txpower;
194eb2cdcb1SSam Leffler 	u_int8_t	wt_antenna;
19568e8e04eSSam Leffler 	u_int32_t	wt_chan_flags;
19668e8e04eSSam Leffler 	u_int16_t	wt_chan_freq;
19768e8e04eSSam Leffler 	u_int8_t	wt_chan_ieee;
19868e8e04eSSam Leffler 	int8_t		wt_chan_maxpow;
19968e8e04eSSam Leffler } __packed;
20073454c73SSam Leffler 
2015591b213SSam Leffler #endif /* _DEV_ATH_ATHIOCTL_H */
202