if_athioctl.h revision 161187
1167465Smp/*-
259243Sobrien * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
359243Sobrien * All rights reserved.
459243Sobrien *
559243Sobrien * Redistribution and use in source and binary forms, with or without
659243Sobrien * modification, are permitted provided that the following conditions
759243Sobrien * are met:
859243Sobrien * 1. Redistributions of source code must retain the above copyright
959243Sobrien *    notice, this list of conditions and the following disclaimer,
1059243Sobrien *    without modification.
1159243Sobrien * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1259243Sobrien *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
1359243Sobrien *    redistribution must be conditioned upon including a substantially
1459243Sobrien *    similar Disclaimer requirement for further binary redistribution.
1559243Sobrien * 3. Neither the names of the above-listed copyright holders nor the names
1659243Sobrien *    of any contributors may be used to endorse or promote products derived
17100616Smp *    from this software without specific prior written permission.
1859243Sobrien *
1959243Sobrien * Alternatively, this software may be distributed under the terms of the
2059243Sobrien * GNU General Public License ("GPL") version 2 as published by the Free
2159243Sobrien * Software Foundation.
2259243Sobrien *
2359243Sobrien * NO WARRANTY
2459243Sobrien * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2559243Sobrien * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2659243Sobrien * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
2759243Sobrien * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
2859243Sobrien * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
2959243Sobrien * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3059243Sobrien * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3159243Sobrien * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
3259243Sobrien * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3359243Sobrien * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3459243Sobrien * THE POSSIBILITY OF SUCH DAMAGES.
35167465Smp *
3659243Sobrien * $FreeBSD: head/sys/dev/ath/if_athioctl.h 161187 2006-08-10 16:31:37Z sam $
3759243Sobrien */
3859243Sobrien
3959243Sobrien/*
4059243Sobrien * Ioctl-related defintions for the Atheros Wireless LAN controller driver.
4159243Sobrien */
4259243Sobrien#ifndef _DEV_ATH_ATHIOCTL_H
4359243Sobrien#define _DEV_ATH_ATHIOCTL_H
4459243Sobrien
4559243Sobrienstruct ath_stats {
4659243Sobrien	u_int32_t	ast_watchdog;	/* device reset by watchdog */
4759243Sobrien	u_int32_t	ast_hardware;	/* fatal hardware error interrupts */
4859243Sobrien	u_int32_t	ast_bmiss;	/* beacon miss interrupts */
4959243Sobrien	u_int32_t	ast_bmiss_phantom;/* beacon miss interrupts */
5059243Sobrien	u_int32_t	ast_bstuck;	/* beacon stuck interrupts */
5159243Sobrien	u_int32_t	ast_rxorn;	/* rx overrun interrupts */
5259243Sobrien	u_int32_t	ast_rxeol;	/* rx eol interrupts */
5359243Sobrien	u_int32_t	ast_txurn;	/* tx underrun interrupts */
5459243Sobrien	u_int32_t	ast_mib;	/* mib interrupts */
5559243Sobrien	u_int32_t	ast_intrcoal;	/* interrupts coalesced */
5659243Sobrien	u_int32_t	ast_tx_packets;	/* packet sent on the interface */
5759243Sobrien	u_int32_t	ast_tx_mgmt;	/* management frames transmitted */
5859243Sobrien	u_int32_t	ast_tx_discard;	/* frames discarded prior to assoc */
5959243Sobrien	u_int32_t	ast_tx_qstop;	/* output stopped 'cuz no buffer */
6059243Sobrien	u_int32_t	ast_tx_encap;	/* tx encapsulation failed */
6159243Sobrien	u_int32_t	ast_tx_nonode;	/* tx failed 'cuz no node */
6259243Sobrien	u_int32_t	ast_tx_nombuf;	/* tx failed 'cuz no mbuf */
6359243Sobrien	u_int32_t	ast_tx_nomcl;	/* tx failed 'cuz no cluster */
6459243Sobrien	u_int32_t	ast_tx_linear;	/* tx linearized to cluster */
6559243Sobrien	u_int32_t	ast_tx_nodata;	/* tx discarded empty frame */
6659243Sobrien	u_int32_t	ast_tx_busdma;	/* tx failed for dma resrcs */
6759243Sobrien	u_int32_t	ast_tx_xretries;/* tx failed 'cuz too many retries */
6859243Sobrien	u_int32_t	ast_tx_fifoerr;	/* tx failed 'cuz FIFO underrun */
6959243Sobrien	u_int32_t	ast_tx_filtered;/* tx failed 'cuz xmit filtered */
7059243Sobrien	u_int32_t	ast_tx_shortretry;/* tx on-chip retries (short) */
7159243Sobrien	u_int32_t	ast_tx_longretry;/* tx on-chip retries (long) */
7259243Sobrien	u_int32_t	ast_tx_badrate;	/* tx failed 'cuz bogus xmit rate */
7359243Sobrien	u_int32_t	ast_tx_noack;	/* tx frames with no ack marked */
7459243Sobrien	u_int32_t	ast_tx_rts;	/* tx frames with rts enabled */
7559243Sobrien	u_int32_t	ast_tx_cts;	/* tx frames with cts enabled */
7659243Sobrien	u_int32_t	ast_tx_shortpre;/* tx frames with short preamble */
7759243Sobrien	u_int32_t	ast_tx_altrate;	/* tx frames with alternate rate */
7859243Sobrien	u_int32_t	ast_tx_protect;	/* tx frames with protection */
7959243Sobrien	u_int32_t	ast_unused1;
8059243Sobrien	u_int32_t	ast_unused2;
81167465Smp	u_int32_t	ast_rx_nombuf;	/* rx setup failed 'cuz no mbuf */
8259243Sobrien	u_int32_t	ast_rx_busdma;	/* rx setup failed for dma resrcs */
8359243Sobrien	u_int32_t	ast_rx_orn;	/* rx failed 'cuz of desc overrun */
8459243Sobrien	u_int32_t	ast_rx_crcerr;	/* rx failed 'cuz of bad CRC */
8559243Sobrien	u_int32_t	ast_rx_fifoerr;	/* rx failed 'cuz of FIFO overrun */
8659243Sobrien	u_int32_t	ast_rx_badcrypt;/* rx failed 'cuz decryption */
8759243Sobrien	u_int32_t	ast_rx_badmic;	/* rx failed 'cuz MIC failure */
8859243Sobrien	u_int32_t	ast_rx_phyerr;	/* rx failed 'cuz of PHY err */
8959243Sobrien	u_int32_t	ast_rx_phy[32];	/* rx PHY error per-code counts */
90167465Smp	u_int32_t	ast_rx_tooshort;/* rx discarded 'cuz frame too short */
91167465Smp	u_int32_t	ast_rx_toobig;	/* rx discarded 'cuz frame too large */
9259243Sobrien	u_int32_t	ast_rx_packets;	/* packet recv on the interface */
9359243Sobrien	u_int32_t	ast_rx_mgt;	/* management frames received */
9459243Sobrien	u_int32_t	ast_rx_ctl;	/* rx discarded 'cuz ctl frame */
9559243Sobrien	int8_t		ast_tx_rssi;	/* tx rssi of last ack */
9659243Sobrien	int8_t		ast_rx_rssi;	/* rx rssi from histogram */
9759243Sobrien	int8_t		ast_rx_noise;	/* rx noise floor */
9859243Sobrien	u_int8_t	ast_tx_rate;	/* IEEE rate of last unicast tx */
9959243Sobrien	u_int32_t	ast_be_xmit;	/* beacons transmitted */
10059243Sobrien	u_int32_t	ast_be_nombuf;	/* beacon setup failed 'cuz no mbuf */
10159243Sobrien	u_int32_t	ast_per_cal;	/* periodic calibration calls */
10259243Sobrien	u_int32_t	ast_per_calfail;/* periodic calibration failed */
10359243Sobrien	u_int32_t	ast_per_rfgain;	/* periodic calibration rfgain reset */
10459243Sobrien	u_int32_t	ast_rate_calls;	/* rate control checks */
10559243Sobrien	u_int32_t	ast_rate_raise;	/* rate control raised xmit rate */
10659243Sobrien	u_int32_t	ast_rate_drop;	/* rate control dropped xmit rate */
10759243Sobrien	u_int32_t	ast_ant_defswitch;/* rx/default antenna switches */
10859243Sobrien	u_int32_t	ast_ant_txswitch;/* tx antenna switches */
10959243Sobrien	u_int32_t	ast_ant_rx[8];	/* rx frames with antenna */
11059243Sobrien	u_int32_t	ast_ant_tx[8];	/* tx frames with antenna */
11159243Sobrien	u_int32_t	ast_cabq_xmit;	/* cabq frames transmitted */
11259243Sobrien	u_int32_t	ast_cabq_busy;	/* cabq found busy */
11359243Sobrien	u_int32_t	ast_tx_raw;	/* tx frames through raw api */
11459243Sobrien	u_int32_t	ast_pad[29];
11559243Sobrien};
11659243Sobrien
11759243Sobrien#define	SIOCGATHSTATS	_IOWR('i', 137, struct ifreq)
11859243Sobrien
11959243Sobrienstruct ath_diag {
12059243Sobrien	char	ad_name[IFNAMSIZ];	/* if name, e.g. "ath0" */
12159243Sobrien	u_int16_t ad_id;
122167465Smp#define	ATH_DIAG_DYN	0x8000		/* allocate buffer in caller */
123167465Smp#define	ATH_DIAG_IN	0x4000		/* copy in parameters */
124167465Smp#define	ATH_DIAG_OUT	0x0000		/* copy out results (always) */
125167465Smp#define	ATH_DIAG_ID	0x0fff
126167465Smp	u_int16_t ad_in_size;		/* pack to fit, yech */
127167465Smp	caddr_t	ad_in_data;
12859243Sobrien	caddr_t	ad_out_data;
12959243Sobrien	u_int	ad_out_size;
13059243Sobrien
13159243Sobrien};
13259243Sobrien#define	SIOCGATHDIAG	_IOWR('i', 138, struct ath_diag)
13359243Sobrien
134167465Smp/*
135167465Smp * Radio capture format.
13659243Sobrien */
13759243Sobrien#define ATH_RX_RADIOTAP_PRESENT (		\
13859243Sobrien	(1 << IEEE80211_RADIOTAP_TSFT)		| \
13959243Sobrien	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
14059243Sobrien	(1 << IEEE80211_RADIOTAP_RATE)		| \
14159243Sobrien	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
14259243Sobrien	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
143167465Smp	(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)	| \
14459243Sobrien	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
14559243Sobrien	0)
14659243Sobrien
147167465Smpstruct ath_rx_radiotap_header {
14859243Sobrien	struct ieee80211_radiotap_header wr_ihdr;
14959243Sobrien	u_int64_t	wr_tsf;
15059243Sobrien	u_int8_t	wr_flags;
15159243Sobrien	u_int8_t	wr_rate;
15259243Sobrien	u_int16_t	wr_chan_freq;
15359243Sobrien	u_int16_t	wr_chan_flags;
15459243Sobrien	u_int8_t	wr_antsignal;
155167465Smp	u_int8_t	wr_antnoise;
156167465Smp	u_int8_t	wr_antenna;
15759243Sobrien};
158167465Smp
15959243Sobrien#define ATH_TX_RADIOTAP_PRESENT (		\
16059243Sobrien	(1 << IEEE80211_RADIOTAP_TSFT)		| \
161167465Smp	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
162167465Smp	(1 << IEEE80211_RADIOTAP_RATE)		| \
16359243Sobrien	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
16459243Sobrien	(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)	| \
165167465Smp	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
16659243Sobrien	0)
16759243Sobrien
16859243Sobrienstruct ath_tx_radiotap_header {
16959243Sobrien	struct ieee80211_radiotap_header wt_ihdr;
17059243Sobrien	u_int64_t	wt_tsf;
17159243Sobrien	u_int8_t	wt_flags;
17259243Sobrien	u_int8_t	wt_rate;
17359243Sobrien	u_int16_t	wt_chan_freq;
17459243Sobrien	u_int16_t	wt_chan_flags;
17559243Sobrien	u_int8_t	wt_txpower;
17659243Sobrien	u_int8_t	wt_antenna;
17759243Sobrien};
178167465Smp
17959243Sobrien#endif /* _DEV_ATH_ATHIOCTL_H */
180167465Smp