if_athioctl.h revision 218924
1117395Skan/*-
2169689Skan * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
390075Sobrien * All rights reserved.
490075Sobrien *
590075Sobrien * Redistribution and use in source and binary forms, with or without
690075Sobrien * modification, are permitted provided that the following conditions
790075Sobrien * are met:
890075Sobrien * 1. Redistributions of source code must retain the above copyright
990075Sobrien *    notice, this list of conditions and the following disclaimer,
1090075Sobrien *    without modification.
1190075Sobrien * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1290075Sobrien *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13117395Skan *    redistribution must be conditioned upon including a substantially
14117395Skan *    similar Disclaimer requirement for further binary redistribution.
1590075Sobrien *
1690075Sobrien * NO WARRANTY
1790075Sobrien * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1890075Sobrien * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1990075Sobrien * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
2090075Sobrien * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
2190075Sobrien * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
2290075Sobrien * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2390075Sobrien * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24107590Sobrien * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25107590Sobrien * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2696263Sobrien * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2796263Sobrien * THE POSSIBILITY OF SUCH DAMAGES.
2890075Sobrien *
2990075Sobrien * $FreeBSD: head/sys/dev/ath/if_athioctl.h 218924 2011-02-21 19:19:05Z adrian $
3090075Sobrien */
3190075Sobrien
32132718Skan/*
33132718Skan * Ioctl-related defintions for the Atheros Wireless LAN controller driver.
34132718Skan */
35132718Skan#ifndef _DEV_ATH_ATHIOCTL_H
36117395Skan#define _DEV_ATH_ATHIOCTL_H
3790075Sobrien
3890075Sobrienstruct ath_stats {
39122180Skan	u_int32_t	ast_watchdog;	/* device reset by watchdog */
40122180Skan	u_int32_t	ast_hardware;	/* fatal hardware error interrupts */
41122180Skan	u_int32_t	ast_bmiss;	/* beacon miss interrupts */
42132718Skan	u_int32_t	ast_bmiss_phantom;/* beacon miss interrupts */
43132718Skan	u_int32_t	ast_bstuck;	/* beacon stuck interrupts */
44132718Skan	u_int32_t	ast_rxorn;	/* rx overrun interrupts */
45132718Skan	u_int32_t	ast_rxeol;	/* rx eol interrupts */
4690075Sobrien	u_int32_t	ast_txurn;	/* tx underrun interrupts */
4790075Sobrien	u_int32_t	ast_mib;	/* mib interrupts */
4890075Sobrien	u_int32_t	ast_intrcoal;	/* interrupts coalesced */
49107590Sobrien	u_int32_t	ast_tx_packets;	/* packet sent on the interface */
50107590Sobrien	u_int32_t	ast_tx_mgmt;	/* management frames transmitted */
51107590Sobrien	u_int32_t	ast_tx_discard;	/* frames discarded prior to assoc */
52107590Sobrien	u_int32_t	ast_tx_qstop;	/* output stopped 'cuz no buffer */
53107590Sobrien	u_int32_t	ast_tx_encap;	/* tx encapsulation failed */
54107590Sobrien	u_int32_t	ast_tx_nonode;	/* tx failed 'cuz no node */
55117395Skan	u_int32_t	ast_tx_nombuf;	/* tx failed 'cuz no mbuf */
56107590Sobrien	u_int32_t	ast_tx_nomcl;	/* tx failed 'cuz no cluster */
57107590Sobrien	u_int32_t	ast_tx_linear;	/* tx linearized to cluster */
58132718Skan	u_int32_t	ast_tx_nodata;	/* tx discarded empty frame */
59117395Skan	u_int32_t	ast_tx_busdma;	/* tx failed for dma resrcs */
60117395Skan	u_int32_t	ast_tx_xretries;/* tx failed 'cuz too many retries */
61117395Skan	u_int32_t	ast_tx_fifoerr;	/* tx failed 'cuz FIFO underrun */
62132718Skan	u_int32_t	ast_tx_filtered;/* tx failed 'cuz xmit filtered */
63117395Skan	u_int32_t	ast_tx_shortretry;/* tx on-chip retries (short) */
64117395Skan	u_int32_t	ast_tx_longretry;/* tx on-chip retries (long) */
65107590Sobrien	u_int32_t	ast_tx_badrate;	/* tx failed 'cuz bogus xmit rate */
66107590Sobrien	u_int32_t	ast_tx_noack;	/* tx frames with no ack marked */
67107590Sobrien	u_int32_t	ast_tx_rts;	/* tx frames with rts enabled */
68169689Skan	u_int32_t	ast_tx_cts;	/* tx frames with cts enabled */
69169689Skan	u_int32_t	ast_tx_shortpre;/* tx frames with short preamble */
70169689Skan	u_int32_t	ast_tx_altrate;	/* tx frames with alternate rate */
71169689Skan	u_int32_t	ast_tx_protect;	/* tx frames with protection */
72107590Sobrien	u_int32_t	ast_tx_ctsburst;/* tx frames with cts and bursting */
73107590Sobrien	u_int32_t	ast_tx_ctsext;	/* tx frames with cts extension */
74107590Sobrien	u_int32_t	ast_rx_nombuf;	/* rx setup failed 'cuz no mbuf */
75107590Sobrien	u_int32_t	ast_rx_busdma;	/* rx setup failed for dma resrcs */
76169689Skan	u_int32_t	ast_rx_orn;	/* rx failed 'cuz of desc overrun */
77169689Skan	u_int32_t	ast_rx_crcerr;	/* rx failed 'cuz of bad CRC */
78169689Skan	u_int32_t	ast_rx_fifoerr;	/* rx failed 'cuz of FIFO overrun */
79117395Skan	u_int32_t	ast_rx_badcrypt;/* rx failed 'cuz decryption */
80117395Skan	u_int32_t	ast_rx_badmic;	/* rx failed 'cuz MIC failure */
81117395Skan	u_int32_t	ast_rx_phyerr;	/* rx failed 'cuz of PHY err */
82107590Sobrien	u_int32_t	ast_rx_phy[64];	/* rx PHY error per-code counts */
83107590Sobrien	u_int32_t	ast_rx_tooshort;/* rx discarded 'cuz frame too short */
84107590Sobrien	u_int32_t	ast_rx_toobig;	/* rx discarded 'cuz frame too large */
85107590Sobrien	u_int32_t	ast_rx_packets;	/* packet recv on the interface */
86102780Skan	u_int32_t	ast_rx_mgt;	/* management frames received */
87102780Skan	u_int32_t	ast_rx_ctl;	/* rx discarded 'cuz ctl frame */
8890075Sobrien	int8_t		ast_tx_rssi;	/* tx rssi of last ack */
8990075Sobrien	int8_t		ast_rx_rssi;	/* rx rssi from histogram */
90169689Skan	u_int8_t	ast_tx_rate;	/* IEEE rate of last unicast tx */
91169689Skan	u_int32_t	ast_be_xmit;	/* beacons transmitted */
92169689Skan	u_int32_t	ast_be_nombuf;	/* beacon setup failed 'cuz no mbuf */
93169689Skan	u_int32_t	ast_per_cal;	/* periodic calibration calls */
94117395Skan	u_int32_t	ast_per_calfail;/* periodic calibration failed */
95117395Skan	u_int32_t	ast_per_rfgain;	/* periodic calibration rfgain reset */
96117395Skan	u_int32_t	ast_rate_calls;	/* rate control checks */
9790075Sobrien	u_int32_t	ast_rate_raise;	/* rate control raised xmit rate */
98132718Skan	u_int32_t	ast_rate_drop;	/* rate control dropped xmit rate */
99107590Sobrien	u_int32_t	ast_ant_defswitch;/* rx/default antenna switches */
100107590Sobrien	u_int32_t	ast_ant_txswitch;/* tx antenna switches */
101169689Skan	u_int32_t	ast_ant_rx[8];	/* rx frames with antenna */
10290075Sobrien	u_int32_t	ast_ant_tx[8];	/* tx frames with antenna */
10390075Sobrien	u_int32_t	ast_cabq_xmit;	/* cabq frames transmitted */
10490075Sobrien	u_int32_t	ast_cabq_busy;	/* cabq found busy */
10590075Sobrien	u_int32_t	ast_tx_raw;	/* tx frames through raw api */
10690075Sobrien	u_int32_t	ast_ff_txok;	/* fast frames tx'd successfully */
10790075Sobrien	u_int32_t	ast_ff_txerr;	/* fast frames tx'd w/ error */
10890075Sobrien	u_int32_t	ast_ff_rx;	/* fast frames rx'd */
10990075Sobrien	u_int32_t	ast_ff_flush;	/* fast frames flushed from staging q */
11090075Sobrien	u_int32_t	ast_tx_qfull;	/* tx dropped 'cuz of queue limit */
11190075Sobrien	int8_t		ast_rx_noise;	/* rx noise floor */
11290075Sobrien	u_int32_t	ast_tx_nobuf;	/* tx dropped 'cuz no ath buffer */
113169689Skan	u_int32_t	ast_tdma_update;/* TDMA slot timing updates */
114169689Skan	u_int32_t	ast_tdma_timers;/* TDMA slot update set beacon timers */
115169689Skan	u_int32_t	ast_tdma_tsf;	/* TDMA slot update set TSF */
11690075Sobrien	u_int16_t	ast_tdma_tsfadjp;/* TDMA slot adjust+ (usec, smoothed)*/
11790075Sobrien	u_int16_t	ast_tdma_tsfadjm;/* TDMA slot adjust- (usec, smoothed)*/
11890075Sobrien	u_int32_t	ast_tdma_ack;	/* TDMA tx failed 'cuz ACK required */
11990075Sobrien	u_int32_t	ast_tx_raw_fail;/* raw tx failed 'cuz h/w down */
12090075Sobrien	u_int32_t	ast_tx_nofrag;	/* tx dropped 'cuz no ath frag buffer */
12190075Sobrien	u_int32_t	ast_be_missed;	/* missed beacons */
12290075Sobrien	u_int32_t	ast_ani_cal;	/* ANI calibrations performed */
12390075Sobrien	u_int32_t	ast_rx_agg;	/* number of aggregate frames RX'ed */
12490075Sobrien	u_int32_t	ast_rx_halfgi;
125169689Skan	u_int32_t	ast_rx_2040;
126107590Sobrien	u_int32_t	ast_rx_pre_crc_err;
127107590Sobrien	u_int32_t	ast_rx_post_crc_err;
12890075Sobrien	u_int32_t	ast_rx_decrypt_busy_err;
12990075Sobrien	u_int32_t	ast_rx_hi_rx_chain;
13090075Sobrien	u_int32_t	ast_tx_htprotect;	/* HT tx frames with protection */
131169689Skan	u_int32_t	ast_pad[3];
13290075Sobrien};
13390075Sobrien
134107590Sobrien#define	SIOCGATHSTATS	_IOWR('i', 137, struct ifreq)
13596263Sobrien#define	SIOCZATHSTATS	_IOWR('i', 139, struct ifreq)
13696263Sobrien
137107590Sobrienstruct ath_diag {
138132718Skan	char	ad_name[IFNAMSIZ];	/* if name, e.g. "ath0" */
139132718Skan	u_int16_t ad_id;
140107590Sobrien#define	ATH_DIAG_DYN	0x8000		/* allocate buffer in caller */
141107590Sobrien#define	ATH_DIAG_IN	0x4000		/* copy in parameters */
14290075Sobrien#define	ATH_DIAG_OUT	0x0000		/* copy out results (always) */
14390075Sobrien#define	ATH_DIAG_ID	0x0fff
14490075Sobrien	u_int16_t ad_in_size;		/* pack to fit, yech */
14590075Sobrien	caddr_t	ad_in_data;
146117395Skan	caddr_t	ad_out_data;
147117395Skan	u_int	ad_out_size;
148117395Skan
149117395Skan};
150107590Sobrien#define	SIOCGATHDIAG	_IOWR('i', 138, struct ath_diag)
15190075Sobrien
15290075Sobrien/*
153169689Skan * Radio capture format.
154107590Sobrien */
155107590Sobrien#define ATH_RX_RADIOTAP_PRESENT (		\
156107590Sobrien	(1 << IEEE80211_RADIOTAP_TSFT)		| \
157107590Sobrien	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
158107590Sobrien	(1 << IEEE80211_RADIOTAP_RATE)		| \
15996263Sobrien	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
16090075Sobrien	(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)	| \
16190075Sobrien	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
162107590Sobrien	(1 << IEEE80211_RADIOTAP_XCHANNEL)	| \
163107590Sobrien	0)
164107590Sobrien
16590075Sobrienstruct ath_rx_radiotap_header {
16690075Sobrien	struct ieee80211_radiotap_header wr_ihdr;
16790075Sobrien	u_int64_t	wr_tsf;
168132718Skan	u_int8_t	wr_flags;
169107590Sobrien	u_int8_t	wr_rate;
17090075Sobrien	int8_t		wr_antsignal;
17190075Sobrien	int8_t		wr_antnoise;
172107590Sobrien	u_int8_t	wr_antenna;
173107590Sobrien	u_int8_t	wr_pad[3];
174107590Sobrien	u_int32_t	wr_chan_flags;
175107590Sobrien	u_int16_t	wr_chan_freq;
176107590Sobrien	u_int8_t	wr_chan_ieee;
177107590Sobrien	int8_t		wr_chan_maxpow;
178107590Sobrien} __packed;
179132718Skan
180132718Skan#define ATH_TX_RADIOTAP_PRESENT (		\
181132718Skan	(1 << IEEE80211_RADIOTAP_TSFT)		| \
182132718Skan	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
18390075Sobrien	(1 << IEEE80211_RADIOTAP_RATE)		| \
18490075Sobrien	(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)	| \
18590075Sobrien	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
18690075Sobrien	(1 << IEEE80211_RADIOTAP_XCHANNEL)	| \
18790075Sobrien	0)
18890075Sobrien
18990075Sobrienstruct ath_tx_radiotap_header {
19090075Sobrien	struct ieee80211_radiotap_header wt_ihdr;
19190075Sobrien	u_int64_t	wt_tsf;
19290075Sobrien	u_int8_t	wt_flags;
19390075Sobrien	u_int8_t	wt_rate;
19490075Sobrien	u_int8_t	wt_txpower;
19590075Sobrien	u_int8_t	wt_antenna;
196132718Skan	u_int32_t	wt_chan_flags;
197132718Skan	u_int16_t	wt_chan_freq;
198132718Skan	u_int8_t	wt_chan_ieee;
199132718Skan	int8_t		wt_chan_maxpow;
20090075Sobrien} __packed;
20190075Sobrien
20290075Sobrien#endif /* _DEV_ATH_ATHIOCTL_H */
20390075Sobrien