if_athioctl.h revision 227327
1139823Simp/*-
254263Sshin * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
354263Sshin * All rights reserved.
454263Sshin *
554263Sshin * Redistribution and use in source and binary forms, with or without
654263Sshin * modification, are permitted provided that the following conditions
754263Sshin * are met:
854263Sshin * 1. Redistributions of source code must retain the above copyright
954263Sshin *    notice, this list of conditions and the following disclaimer,
1054263Sshin *    without modification.
1154263Sshin * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1254263Sshin *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
1354263Sshin *    redistribution must be conditioned upon including a substantially
1454263Sshin *    similar Disclaimer requirement for further binary redistribution.
1554263Sshin *
1654263Sshin * NO WARRANTY
1754263Sshin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1854263Sshin * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1954263Sshin * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
2054263Sshin * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
2154263Sshin * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
2254263Sshin * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2354263Sshin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2454263Sshin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
2554263Sshin * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2654263Sshin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2754263Sshin * THE POSSIBILITY OF SUCH DAMAGES.
28273087Sae *
29273087Sae * $FreeBSD: head/sys/dev/ath/if_athioctl.h 227327 2011-11-08 01:35:44Z adrian $
3054263Sshin */
3154263Sshin
32172467Ssilby/*
33172467Ssilby * Ioctl-related defintions for the Atheros Wireless LAN controller driver.
34172467Ssilby */
3562587Sitojun#ifndef _DEV_ATH_ATHIOCTL_H
3654263Sshin#define _DEV_ATH_ATHIOCTL_H
3754263Sshin
3854263Sshinstruct ath_tx_aggr_stats {
39273087Sae	u_int32_t	aggr_pkts[64];
40273087Sae	u_int32_t	aggr_single_pkt;
4154263Sshin	u_int32_t	aggr_nonbaw_pkt;
4254263Sshin	u_int32_t	aggr_aggr_pkt;
4354263Sshin	u_int32_t	aggr_baw_closed_single_pkt;
4454263Sshin	u_int32_t	aggr_low_hwq_single_pkt;
4554263Sshin	u_int32_t	aggr_sched_nopkt;
4654263Sshin};
4754263Sshin
48105293Sumestruct ath_stats {
4962587Sitojun	u_int32_t	ast_watchdog;	/* device reset by watchdog */
5062587Sitojun	u_int32_t	ast_hardware;	/* fatal hardware error interrupts */
5154263Sshin	u_int32_t	ast_bmiss;	/* beacon miss interrupts */
52257176Sglebius	u_int32_t	ast_bmiss_phantom;/* beacon miss interrupts */
5354263Sshin	u_int32_t	ast_bstuck;	/* beacon stuck interrupts */
54196019Srwatson	u_int32_t	ast_rxorn;	/* rx overrun interrupts */
5554263Sshin	u_int32_t	ast_rxeol;	/* rx eol interrupts */
5654263Sshin	u_int32_t	ast_txurn;	/* tx underrun interrupts */
5754263Sshin	u_int32_t	ast_mib;	/* mib interrupts */
5854263Sshin	u_int32_t	ast_intrcoal;	/* interrupts coalesced */
5954263Sshin	u_int32_t	ast_tx_packets;	/* packet sent on the interface */
6062587Sitojun	u_int32_t	ast_tx_mgmt;	/* management frames transmitted */
6162587Sitojun	u_int32_t	ast_tx_discard;	/* frames discarded prior to assoc */
6255009Sshin	u_int32_t	ast_tx_qstop;	/* output stopped 'cuz no buffer */
63291993Smelifaro	u_int32_t	ast_tx_encap;	/* tx encapsulation failed */
6462587Sitojun	u_int32_t	ast_tx_nonode;	/* tx failed 'cuz no node */
6554263Sshin	u_int32_t	ast_tx_nombuf;	/* tx failed 'cuz no mbuf */
6662587Sitojun	u_int32_t	ast_tx_nomcl;	/* tx failed 'cuz no cluster */
6754263Sshin	u_int32_t	ast_tx_linear;	/* tx linearized to cluster */
6854263Sshin	u_int32_t	ast_tx_nodata;	/* tx discarded empty frame */
69273087Sae	u_int32_t	ast_tx_busdma;	/* tx failed for dma resrcs */
7054263Sshin	u_int32_t	ast_tx_xretries;/* tx failed 'cuz too many retries */
71276148Sae	u_int32_t	ast_tx_fifoerr;	/* tx failed 'cuz FIFO underrun */
72105293Sume	u_int32_t	ast_tx_filtered;/* tx failed 'cuz xmit filtered */
73105293Sume	u_int32_t	ast_tx_shortretry;/* tx on-chip retries (short) */
74276148Sae	u_int32_t	ast_tx_longretry;/* tx on-chip retries (long) */
75152242Sru	u_int32_t	ast_tx_badrate;	/* tx failed 'cuz bogus xmit rate */
76152242Sru	u_int32_t	ast_tx_noack;	/* tx frames with no ack marked */
77152242Sru	u_int32_t	ast_tx_rts;	/* tx frames with rts enabled */
78152242Sru	u_int32_t	ast_tx_cts;	/* tx frames with cts enabled */
79152242Sru	u_int32_t	ast_tx_shortpre;/* tx frames with short preamble */
80270008Skevlo	u_int32_t	ast_tx_altrate;	/* tx frames with alternate rate */
81152242Sru	u_int32_t	ast_tx_protect;	/* tx frames with protection */
82152242Sru	u_int32_t	ast_tx_ctsburst;/* tx frames with cts and bursting */
83105293Sume	u_int32_t	ast_tx_ctsext;	/* tx frames with cts extension */
84105293Sume	u_int32_t	ast_rx_nombuf;	/* rx setup failed 'cuz no mbuf */
85276148Sae	u_int32_t	ast_rx_busdma;	/* rx setup failed for dma resrcs */
86276148Sae	u_int32_t	ast_rx_orn;	/* rx failed 'cuz of desc overrun */
87207369Sbz	u_int32_t	ast_rx_crcerr;	/* rx failed 'cuz of bad CRC */
88274225Sglebius	u_int32_t	ast_rx_fifoerr;	/* rx failed 'cuz of FIFO overrun */
89195699Srwatson	u_int32_t	ast_rx_badcrypt;/* rx failed 'cuz decryption */
9054263Sshin	u_int32_t	ast_rx_badmic;	/* rx failed 'cuz MIC failure */
9154263Sshin	u_int32_t	ast_rx_phyerr;	/* rx failed 'cuz of PHY err */
92273087Sae	u_int32_t	ast_rx_phy[64];	/* rx PHY error per-code counts */
9354263Sshin	u_int32_t	ast_rx_tooshort;/* rx discarded 'cuz frame too short */
94273087Sae	u_int32_t	ast_rx_toobig;	/* rx discarded 'cuz frame too large */
95147256Sbrooks	u_int32_t	ast_rx_packets;	/* packet recv on the interface */
96273087Sae	u_int32_t	ast_rx_mgt;	/* management frames received */
97273087Sae	u_int32_t	ast_rx_ctl;	/* rx discarded 'cuz ctl frame */
9854263Sshin	int8_t		ast_tx_rssi;	/* tx rssi of last ack */
9954263Sshin	int8_t		ast_rx_rssi;	/* rx rssi from histogram */
100189494Smarius	u_int8_t	ast_tx_rate;	/* IEEE rate of last unicast tx */
101189494Smarius	u_int32_t	ast_be_xmit;	/* beacons transmitted */
102273087Sae	u_int32_t	ast_be_nombuf;	/* beacon setup failed 'cuz no mbuf */
103189494Smarius	u_int32_t	ast_per_cal;	/* periodic calibration calls */
104189494Smarius	u_int32_t	ast_per_calfail;/* periodic calibration failed */
105243882Sglebius	u_int32_t	ast_per_rfgain;	/* periodic calibration rfgain reset */
106273087Sae	u_int32_t	ast_rate_calls;	/* rate control checks */
107273087Sae	u_int32_t	ast_rate_raise;	/* rate control raised xmit rate */
108189494Smarius	u_int32_t	ast_rate_drop;	/* rate control dropped xmit rate */
109273087Sae	u_int32_t	ast_ant_defswitch;/* rx/default antenna switches */
110189494Smarius	u_int32_t	ast_ant_txswitch;/* tx antenna switches */
111189494Smarius	u_int32_t	ast_ant_rx[8];	/* rx frames with antenna */
112189494Smarius	u_int32_t	ast_ant_tx[8];	/* tx frames with antenna */
113189494Smarius	u_int32_t	ast_cabq_xmit;	/* cabq frames transmitted */
114189494Smarius	u_int32_t	ast_cabq_busy;	/* cabq found busy */
115189494Smarius	u_int32_t	ast_tx_raw;	/* tx frames through raw api */
116189494Smarius	u_int32_t	ast_ff_txok;	/* fast frames tx'd successfully */
117273087Sae	u_int32_t	ast_ff_txerr;	/* fast frames tx'd w/ error */
118273087Sae	u_int32_t	ast_ff_rx;	/* fast frames rx'd */
119273087Sae	u_int32_t	ast_ff_flush;	/* fast frames flushed from staging q */
120273087Sae	u_int32_t	ast_tx_qfull;	/* tx dropped 'cuz of queue limit */
121273087Sae	int8_t		ast_rx_noise;	/* rx noise floor */
122273087Sae	u_int32_t	ast_tx_nobuf;	/* tx dropped 'cuz no ath buffer */
12354263Sshin	u_int32_t	ast_tdma_update;/* TDMA slot timing updates */
124273087Sae	u_int32_t	ast_tdma_timers;/* TDMA slot update set beacon timers */
125273087Sae	u_int32_t	ast_tdma_tsf;	/* TDMA slot update set TSF */
12654263Sshin	u_int16_t	ast_tdma_tsfadjp;/* TDMA slot adjust+ (usec, smoothed)*/
127273087Sae	u_int16_t	ast_tdma_tsfadjm;/* TDMA slot adjust- (usec, smoothed)*/
128273087Sae	u_int32_t	ast_tdma_ack;	/* TDMA tx failed 'cuz ACK required */
129273087Sae	u_int32_t	ast_tx_raw_fail;/* raw tx failed 'cuz h/w down */
130273087Sae	u_int32_t	ast_tx_nofrag;	/* tx dropped 'cuz no ath frag buffer */
131273087Sae	u_int32_t	ast_be_missed;	/* missed beacons */
13262587Sitojun	u_int32_t	ast_ani_cal;	/* ANI calibrations performed */
133273087Sae	u_int32_t	ast_rx_agg;	/* number of aggregate frames RX'ed */
13454263Sshin	u_int32_t	ast_rx_halfgi;	/* RX half-GI */
13554263Sshin	u_int32_t	ast_rx_2040;	/* RX 40mhz frame */
136276148Sae	u_int32_t	ast_rx_pre_crc_err;	/* RX pre-delimiter CRC error */
137269699Skevlo	u_int32_t	ast_rx_post_crc_err;	/* RX post-delimiter CRC error */
13854263Sshin	u_int32_t	ast_rx_decrypt_busy_err;	/* RX decrypt engine busy error */
139273087Sae	u_int32_t	ast_rx_hi_rx_chain;
140147503Sbz	u_int32_t	ast_tx_htprotect;	/* HT tx frames with protection */
141273087Sae	u_int32_t	ast_rx_hitqueueend;	/* RX hit descr queue end */
14254263Sshin	u_int32_t	ast_tx_timeout;		/* Global TX timeout */
143273087Sae	u_int32_t	ast_tx_cst;		/* Carrier sense timeout */
14454263Sshin	u_int32_t	ast_tx_xtxop;	/* tx exceeded TXOP */
145273087Sae	u_int32_t	ast_tx_timerexpired;	/* tx exceeded TX_TIMER */
146147503Sbz	u_int32_t	ast_tx_desccfgerr;	/* tx desc cfg error */
147147503Sbz	u_int32_t	ast_tx_swretries;	/* software TX retries */
148196039Srwatson	u_int32_t	ast_tx_swretrymax;	/* software TX retry max limit reach */
149269699Skevlo	u_int32_t	ast_tx_data_underrun;
150147503Sbz	u_int32_t	ast_tx_delim_underrun;
151147503Sbz	u_int32_t	ast_tx_aggrfail;		/* aggregate TX failed in its entirety */
152273087Sae	u_int32_t	ast_tx_getnobuf;
153273087Sae	u_int32_t	ast_tx_getbusybuf;
154273087Sae	u_int32_t	ast_tx_intr;
155273087Sae	u_int32_t	ast_rx_intr;
156273087Sae	u_int32_t	ast_pad[4];
157273087Sae};
15854263Sshin
159196039Srwatson#define	SIOCGATHSTATS	_IOWR('i', 137, struct ifreq)
16054263Sshin#define	SIOCZATHSTATS	_IOWR('i', 139, struct ifreq)
161269699Skevlo
16254263Sshinstruct ath_diag {
16362587Sitojun	char	ad_name[IFNAMSIZ];	/* if name, e.g. "ath0" */
16462587Sitojun	u_int16_t ad_id;
165286013Sae#define	ATH_DIAG_DYN	0x8000		/* allocate buffer in caller */
166286013Sae#define	ATH_DIAG_IN	0x4000		/* copy in parameters */
16762587Sitojun#define	ATH_DIAG_OUT	0x0000		/* copy out results (always) */
168286013Sae#define	ATH_DIAG_ID	0x0fff
169286013Sae	u_int16_t ad_in_size;		/* pack to fit, yech */
17062587Sitojun	caddr_t	ad_in_data;
171286013Sae	caddr_t	ad_out_data;
172286013Sae	u_int	ad_out_size;
173282965Sae
17462587Sitojun};
175286013Sae#define	SIOCGATHDIAG	_IOWR('i', 138, struct ath_diag)
176286013Sae#define	SIOCGATHPHYERR	_IOWR('i', 140, struct ath_diag)
177273087Sae
17862587Sitojun/*
17962587Sitojun * Radio capture format.
180286013Sae */
181282965Sae#define ATH_RX_RADIOTAP_PRESENT (		\
182273087Sae	(1 << IEEE80211_RADIOTAP_TSFT)		| \
183282965Sae	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
184282965Sae	(1 << IEEE80211_RADIOTAP_RATE)		| \
185282965Sae	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
186282965Sae	(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)	| \
187282965Sae	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
188282965Sae	(1 << IEEE80211_RADIOTAP_XCHANNEL)	| \
18962587Sitojun	0)
19062587Sitojun
191286013Saestruct ath_rx_radiotap_header {
192291993Smelifaro	struct ieee80211_radiotap_header wr_ihdr;
193291993Smelifaro	u_int64_t	wr_tsf;
19462587Sitojun	u_int8_t	wr_flags;
195291993Smelifaro	u_int8_t	wr_rate;
196291993Smelifaro	int8_t		wr_antsignal;
197291993Smelifaro	int8_t		wr_antnoise;
198273087Sae	u_int8_t	wr_antenna;
199291993Smelifaro	u_int8_t	wr_pad[3];
200291993Smelifaro	u_int32_t	wr_chan_flags;
201291993Smelifaro	u_int16_t	wr_chan_freq;
20262587Sitojun	u_int8_t	wr_chan_ieee;
203282965Sae	int8_t		wr_chan_maxpow;
20462587Sitojun} __packed;
205105293Sume
206105293Sume#define ATH_TX_RADIOTAP_PRESENT (		\
207169454Srwatson	(1 << IEEE80211_RADIOTAP_TSFT)		| \
208105293Sume	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
209273087Sae	(1 << IEEE80211_RADIOTAP_RATE)		| \
210273087Sae	(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)	| \
211273087Sae	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
212105293Sume	(1 << IEEE80211_RADIOTAP_XCHANNEL)	| \
213273087Sae	0)
214273087Sae
215273087Saestruct ath_tx_radiotap_header {
216105293Sume	struct ieee80211_radiotap_header wt_ihdr;
217	u_int64_t	wt_tsf;
218	u_int8_t	wt_flags;
219	u_int8_t	wt_rate;
220	u_int8_t	wt_txpower;
221	u_int8_t	wt_antenna;
222	u_int32_t	wt_chan_flags;
223	u_int16_t	wt_chan_freq;
224	u_int8_t	wt_chan_ieee;
225	int8_t		wt_chan_maxpow;
226} __packed;
227
228/*
229 * DFS ioctl commands
230 */
231
232#define	DFS_SET_THRESH		2
233#define	DFS_GET_THRESH		3
234#define	DFS_RADARDETECTS	6
235
236/*
237 * DFS ioctl parameter types
238 */
239#define DFS_PARAM_FIRPWR	1
240#define DFS_PARAM_RRSSI		2
241#define DFS_PARAM_HEIGHT	3
242#define DFS_PARAM_PRSSI		4
243#define DFS_PARAM_INBAND	5
244#define DFS_PARAM_NOL		6	/* XXX not used in FreeBSD */
245#define DFS_PARAM_RELSTEP_EN	7
246#define DFS_PARAM_RELSTEP	8
247#define DFS_PARAM_RELPWR_EN	9
248#define DFS_PARAM_RELPWR	10
249#define DFS_PARAM_MAXLEN	11
250#define DFS_PARAM_USEFIR128	12
251#define DFS_PARAM_BLOCKRADAR	13
252#define DFS_PARAM_MAXRSSI_EN	14
253
254/* FreeBSD-specific start at 32 */
255#define	DFS_PARAM_ENABLE	32
256#define	DFS_PARAM_EN_EXTCH	33
257
258#endif /* _DEV_ATH_ATHIOCTL_H */
259