xref: /freebsd/sys/dev/ath/if_athioctl.h (revision 30db812aa94e36caa0755dad1e52e058ce3883c5)
15591b213SSam Leffler /*-
21f1d7810SSam Leffler  * Copyright (c) 2002-2005 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  * 3. Neither the names of the above-listed copyright holders nor the names
165591b213SSam Leffler  *    of any contributors may be used to endorse or promote products derived
175591b213SSam Leffler  *    from this software without specific prior written permission.
185591b213SSam Leffler  *
195591b213SSam Leffler  * Alternatively, this software may be distributed under the terms of the
205591b213SSam Leffler  * GNU General Public License ("GPL") version 2 as published by the Free
215591b213SSam Leffler  * Software Foundation.
225591b213SSam Leffler  *
235591b213SSam Leffler  * NO WARRANTY
245591b213SSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
255591b213SSam Leffler  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
265591b213SSam Leffler  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
275591b213SSam Leffler  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
285591b213SSam Leffler  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
295591b213SSam Leffler  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
305591b213SSam Leffler  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
315591b213SSam Leffler  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
325591b213SSam Leffler  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
335591b213SSam Leffler  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
345591b213SSam Leffler  * THE POSSIBILITY OF SUCH DAMAGES.
355591b213SSam Leffler  *
365591b213SSam Leffler  * $FreeBSD$
375591b213SSam Leffler  */
385591b213SSam Leffler 
395591b213SSam Leffler /*
405591b213SSam Leffler  * Ioctl-related defintions for the Atheros Wireless LAN controller driver.
415591b213SSam Leffler  */
425591b213SSam Leffler #ifndef _DEV_ATH_ATHIOCTL_H
435591b213SSam Leffler #define _DEV_ATH_ATHIOCTL_H
445591b213SSam Leffler 
455591b213SSam Leffler struct ath_stats {
465591b213SSam Leffler 	u_int32_t	ast_watchdog;	/* device reset by watchdog */
475591b213SSam Leffler 	u_int32_t	ast_hardware;	/* fatal hardware error interrupts */
485591b213SSam Leffler 	u_int32_t	ast_bmiss;	/* beacon miss interrupts */
49d7736e13SSam Leffler 	u_int32_t	ast_bmiss_phantom;/* beacon miss interrupts */
50c42a7b7eSSam Leffler 	u_int32_t	ast_bstuck;	/* beacon stuck interrupts */
515591b213SSam Leffler 	u_int32_t	ast_rxorn;	/* rx overrun interrupts */
525591b213SSam Leffler 	u_int32_t	ast_rxeol;	/* rx eol interrupts */
535591b213SSam Leffler 	u_int32_t	ast_txurn;	/* tx underrun interrupts */
54c42a7b7eSSam Leffler 	u_int32_t	ast_mib;	/* mib interrupts */
555591b213SSam Leffler 	u_int32_t	ast_intrcoal;	/* interrupts coalesced */
56c42a7b7eSSam Leffler 	u_int32_t	ast_tx_packets;	/* packet sent on the interface */
575591b213SSam Leffler 	u_int32_t	ast_tx_mgmt;	/* management frames transmitted */
585591b213SSam Leffler 	u_int32_t	ast_tx_discard;	/* frames discarded prior to assoc */
595591b213SSam Leffler 	u_int32_t	ast_tx_qstop;	/* output stopped 'cuz no buffer */
605591b213SSam Leffler 	u_int32_t	ast_tx_encap;	/* tx encapsulation failed */
615591b213SSam Leffler 	u_int32_t	ast_tx_nonode;	/* tx failed 'cuz no node */
625591b213SSam Leffler 	u_int32_t	ast_tx_nombuf;	/* tx failed 'cuz no mbuf */
635591b213SSam Leffler 	u_int32_t	ast_tx_nomcl;	/* tx failed 'cuz no cluster */
645591b213SSam Leffler 	u_int32_t	ast_tx_linear;	/* tx linearized to cluster */
655591b213SSam Leffler 	u_int32_t	ast_tx_nodata;	/* tx discarded empty frame */
665591b213SSam Leffler 	u_int32_t	ast_tx_busdma;	/* tx failed for dma resrcs */
675591b213SSam Leffler 	u_int32_t	ast_tx_xretries;/* tx failed 'cuz too many retries */
685591b213SSam Leffler 	u_int32_t	ast_tx_fifoerr;	/* tx failed 'cuz FIFO underrun */
695591b213SSam Leffler 	u_int32_t	ast_tx_filtered;/* tx failed 'cuz xmit filtered */
705591b213SSam Leffler 	u_int32_t	ast_tx_shortretry;/* tx on-chip retries (short) */
715591b213SSam Leffler 	u_int32_t	ast_tx_longretry;/* tx on-chip retries (long) */
725591b213SSam Leffler 	u_int32_t	ast_tx_badrate;	/* tx failed 'cuz bogus xmit rate */
735591b213SSam Leffler 	u_int32_t	ast_tx_noack;	/* tx frames with no ack marked */
745591b213SSam Leffler 	u_int32_t	ast_tx_rts;	/* tx frames with rts enabled */
755591b213SSam Leffler 	u_int32_t	ast_tx_cts;	/* tx frames with cts enabled */
765591b213SSam Leffler 	u_int32_t	ast_tx_shortpre;/* tx frames with short preamble */
7759f32d6bSSam Leffler 	u_int32_t	ast_tx_altrate;	/* tx frames with alternate rate */
7859f32d6bSSam Leffler 	u_int32_t	ast_tx_protect;	/* tx frames with protection */
79de66ac44SSam Leffler 	u_int32_t	ast_unused1;
80de66ac44SSam Leffler 	u_int32_t	ast_unused2;
815591b213SSam Leffler 	u_int32_t	ast_rx_nombuf;	/* rx setup failed 'cuz no mbuf */
825591b213SSam Leffler 	u_int32_t	ast_rx_busdma;	/* rx setup failed for dma resrcs */
835591b213SSam Leffler 	u_int32_t	ast_rx_orn;	/* rx failed 'cuz of desc overrun */
845591b213SSam Leffler 	u_int32_t	ast_rx_crcerr;	/* rx failed 'cuz of bad CRC */
855591b213SSam Leffler 	u_int32_t	ast_rx_fifoerr;	/* rx failed 'cuz of FIFO overrun */
865591b213SSam Leffler 	u_int32_t	ast_rx_badcrypt;/* rx failed 'cuz decryption */
87c42a7b7eSSam Leffler 	u_int32_t	ast_rx_badmic;	/* rx failed 'cuz MIC failure */
885591b213SSam Leffler 	u_int32_t	ast_rx_phyerr;	/* rx failed 'cuz of PHY err */
895591b213SSam Leffler 	u_int32_t	ast_rx_phy[32];	/* rx PHY error per-code counts */
90d1d0cf62SSam Leffler 	u_int32_t	ast_rx_tooshort;/* rx discarded 'cuz frame too short */
9159f32d6bSSam Leffler 	u_int32_t	ast_rx_toobig;	/* rx discarded 'cuz frame too large */
92c42a7b7eSSam Leffler 	u_int32_t	ast_rx_packets;	/* packet recv on the interface */
93c42a7b7eSSam Leffler 	u_int32_t	ast_rx_mgt;	/* management frames received */
94d1d0cf62SSam Leffler 	u_int32_t	ast_rx_ctl;	/* rx discarded 'cuz ctl frame */
95c42a7b7eSSam Leffler 	int8_t		ast_tx_rssi;	/* tx rssi of last ack */
96c42a7b7eSSam Leffler 	int8_t		ast_rx_rssi;	/* rx rssi from histogram */
97c42a7b7eSSam Leffler 	u_int32_t	ast_be_xmit;	/* beacons transmitted */
985591b213SSam Leffler 	u_int32_t	ast_be_nombuf;	/* beacon setup failed 'cuz no mbuf */
995591b213SSam Leffler 	u_int32_t	ast_per_cal;	/* periodic calibration calls */
1005591b213SSam Leffler 	u_int32_t	ast_per_calfail;/* periodic calibration failed */
1015591b213SSam Leffler 	u_int32_t	ast_per_rfgain;	/* periodic calibration rfgain reset */
1025591b213SSam Leffler 	u_int32_t	ast_rate_calls;	/* rate control checks */
1035591b213SSam Leffler 	u_int32_t	ast_rate_raise;	/* rate control raised xmit rate */
1045591b213SSam Leffler 	u_int32_t	ast_rate_drop;	/* rate control dropped xmit rate */
105c42a7b7eSSam Leffler 	u_int32_t	ast_ant_defswitch;/* rx/default antenna switches */
106c42a7b7eSSam Leffler 	u_int32_t	ast_ant_txswitch;/* tx antenna switches */
107c42a7b7eSSam Leffler 	u_int32_t	ast_ant_rx[8];	/* rx frames with antenna */
108c42a7b7eSSam Leffler 	u_int32_t	ast_ant_tx[8];	/* tx frames with antenna */
10930db812aSSam Leffler 	u_int32_t	ast_cabq_xmit;	/* cabq frames transmitted */
11030db812aSSam Leffler 	u_int32_t	ast_cabq_busy;	/* cabq found busy */
11130db812aSSam Leffler 	u_int32_t	ast_pad[30];
1125591b213SSam Leffler };
1135591b213SSam Leffler 
1145591b213SSam Leffler #define	SIOCGATHSTATS	_IOWR('i', 137, struct ifreq)
1155591b213SSam Leffler 
1168cec0ab9SSam Leffler struct ath_diag {
1178cec0ab9SSam Leffler 	char	ad_name[IFNAMSIZ];	/* if name, e.g. "ath0" */
118c42a7b7eSSam Leffler 	u_int16_t ad_id;
119c42a7b7eSSam Leffler #define	ATH_DIAG_DYN	0x8000		/* allocate buffer in caller */
120c42a7b7eSSam Leffler #define	ATH_DIAG_IN	0x4000		/* copy in parameters */
121c42a7b7eSSam Leffler #define	ATH_DIAG_OUT	0x0000		/* copy out results (always) */
122c42a7b7eSSam Leffler #define	ATH_DIAG_ID	0x0fff
123c42a7b7eSSam Leffler 	u_int16_t ad_in_size;		/* pack to fit, yech */
124c42a7b7eSSam Leffler 	caddr_t	ad_in_data;
125c42a7b7eSSam Leffler 	caddr_t	ad_out_data;
126c42a7b7eSSam Leffler 	u_int	ad_out_size;
1278cec0ab9SSam Leffler 
1288cec0ab9SSam Leffler };
1298cec0ab9SSam Leffler #define	SIOCGATHDIAG	_IOWR('i', 138, struct ath_diag)
1308cec0ab9SSam Leffler 
13173454c73SSam Leffler /*
13273454c73SSam Leffler  * Radio capture format.
13373454c73SSam Leffler  */
13473454c73SSam Leffler #define ATH_RX_RADIOTAP_PRESENT (		\
1357b0c77ecSSam Leffler 	(1 << IEEE80211_RADIOTAP_TSFT)		| \
13673454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
13773454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_RATE)		| \
13873454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
13973454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
1407b0c77ecSSam Leffler 	(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)	| \
1417b0c77ecSSam Leffler 	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
14273454c73SSam Leffler 	0)
14373454c73SSam Leffler 
14473454c73SSam Leffler struct ath_rx_radiotap_header {
14573454c73SSam Leffler 	struct ieee80211_radiotap_header wr_ihdr;
1467b0c77ecSSam Leffler 	u_int64_t	wr_tsf;
1477b0c77ecSSam Leffler 	u_int8_t	wr_flags;
14873454c73SSam Leffler 	u_int8_t	wr_rate;
14973454c73SSam Leffler 	u_int16_t	wr_chan_freq;
15073454c73SSam Leffler 	u_int16_t	wr_chan_flags;
151eb2cdcb1SSam Leffler 	u_int8_t	wr_antsignal;
1527b0c77ecSSam Leffler 	u_int8_t	wr_antnoise;
1537b0c77ecSSam Leffler 	u_int8_t	wr_antenna;
15473454c73SSam Leffler };
15573454c73SSam Leffler 
15673454c73SSam Leffler #define ATH_TX_RADIOTAP_PRESENT (		\
1577b0c77ecSSam Leffler 	(1 << IEEE80211_RADIOTAP_TSFT)		| \
15873454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
15973454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_RATE)		| \
16073454c73SSam Leffler 	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
161eb2cdcb1SSam Leffler 	(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)	| \
162eb2cdcb1SSam Leffler 	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
16373454c73SSam Leffler 	0)
16473454c73SSam Leffler 
16573454c73SSam Leffler struct ath_tx_radiotap_header {
16673454c73SSam Leffler 	struct ieee80211_radiotap_header wt_ihdr;
1677b0c77ecSSam Leffler 	u_int64_t	wt_tsf;
1687b0c77ecSSam Leffler 	u_int8_t	wt_flags;
16973454c73SSam Leffler 	u_int8_t	wt_rate;
17073454c73SSam Leffler 	u_int16_t	wt_chan_freq;
17173454c73SSam Leffler 	u_int16_t	wt_chan_flags;
172eb2cdcb1SSam Leffler 	u_int8_t	wt_txpower;
173eb2cdcb1SSam Leffler 	u_int8_t	wt_antenna;
17473454c73SSam Leffler };
17573454c73SSam Leffler 
1765591b213SSam Leffler #endif /* _DEV_ATH_ATHIOCTL_H */
177