xref: /freebsd/sys/dev/mwl/if_mwlioctl.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting
5  * Copyright (c) 2007-2009 Marvell Semiconductor, Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer,
13  *    without modification.
14  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
15  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
16  *    redistribution must be conditioned upon including a substantially
17  *    similar Disclaimer requirement for further binary redistribution.
18  *
19  * NO WARRANTY
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
23  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
24  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
25  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
28  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30  * THE POSSIBILITY OF SUCH DAMAGES.
31  */
32 
33 /*
34  * Ioctl-related defintions for the Marvel Wireless LAN controller driver.
35  */
36 #ifndef _DEV_MWL_MVIOCTL_H
37 #define _DEV_MWL_MVIOCTL_H
38 
39 struct mwl_stats {
40 	struct mwl_hal_hwstats hw_stats;	/* XXX tied to h/w defs */
41 	uint32_t	mst_failure;	/* generic hardware failure */
42 	uint32_t	mst_rx_badtkipicv;
43 	uint32_t	mst_tx_discard;
44 	uint32_t	mst_tx_qstop;
45 	uint32_t	mst_tx_encap;
46 	uint32_t	mst_tx_mgmt;
47 	uint32_t	mst_rx_nombuf;
48 	uint32_t	mst_rx_busdma;
49 	uint32_t	mst_rx_tooshort;
50 	uint32_t	mst_tx_busdma;
51 	uint32_t	mst_tx_linear;
52 	uint32_t	mst_tx_nombuf;
53 	uint32_t	mst_tx_nodata;
54 	uint32_t	mst_tx_shortpre;
55 	uint32_t	mst_tx_retries;
56 	uint32_t	mst_tx_mretries;
57 	uint32_t	mst_tx_linkerror;
58 	uint32_t	mst_tx_xretries;
59 	uint32_t	mst_tx_aging;
60  	uint32_t	mst_tx_qdrop;
61 	uint32_t	mst_ff_txerr;
62 	uint32_t	mst_watchdog;
63 	uint32_t	mst_tx_packets;
64 	uint32_t	mst_rx_packets;
65 	int8_t		mst_rx_rssi;
66 	int8_t		mst_rx_noise;
67 	uint8_t		mst_tx_rate;
68 	uint32_t	mst_ant_tx[4];
69 	uint32_t	mst_ant_rx[4];
70 	uint32_t	mst_tx_tso;
71 	uint32_t	mst_tso_badeth;
72 	uint32_t	mst_tso_nohdr;
73 	uint32_t	mst_tso_badsplit;
74 	uint32_t	mst_rx_crypto;
75 	uint32_t	mst_rx_tkipmic;
76 	uint32_t	mst_rx_nodmabuf;
77 	uint32_t	mst_tx_noheadroom;
78 	uint32_t	mst_tx_badframetype;
79 	uint32_t	mst_ampdu_nostream;
80 	uint32_t	mst_ampdu_reject;
81 	uint32_t	mst_addba_nostream;
82 	uint32_t	mst_bacreate_failed;
83 	uint32_t	mst_bawatchdog;
84 	uint32_t	mst_radardetect;
85 	uint32_t	mst_rx_dmabufmissing;
86 	uint32_t	mst_bawatchdog_notfound;
87 	uint32_t	mst_bawatchdog_empty;
88 	uint32_t	mst_bawatchdog_failed;
89 	uint32_t	mst_rxbuf_failed;
90 	uint32_t	mst_pad[31];
91 };
92 
93 #define	SIOCGMVSTATS	_IOWR('i', 137, struct ifreq)
94 
95 /*
96  * Radio capture format.
97  */
98 #define MWL_RX_RADIOTAP_PRESENT (		\
99 	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
100 	(1 << IEEE80211_RADIOTAP_RATE)		| \
101 	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
102 	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
103 	(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)	| \
104 	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
105 	0)
106 
107 struct mwl_rx_radiotap_header {
108 	struct ieee80211_radiotap_header wr_ihdr;
109 	u_int8_t	wr_flags;
110 	u_int8_t	wr_rate;
111 	u_int16_t	wr_chan_freq;
112 	u_int16_t	wr_chan_flags;
113 	int8_t		wr_antsignal;
114 	int8_t		wr_antnoise;
115 	u_int8_t	wr_antenna;
116 } __packed __aligned(8);
117 
118 #define MWL_TX_RADIOTAP_PRESENT (		\
119 	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
120 	(1 << IEEE80211_RADIOTAP_RATE)		| \
121 	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
122 	(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)	| \
123 	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
124 	0)
125 
126 struct mwl_tx_radiotap_header {
127 	struct ieee80211_radiotap_header wt_ihdr;
128 	u_int8_t	wt_flags;
129 	u_int8_t	wt_rate;
130 	u_int16_t	wt_chan_freq;
131 	u_int16_t	wt_chan_flags;
132 	u_int8_t	wt_txpower;
133 	u_int8_t	wt_antenna;
134 } __packed;
135 
136 #endif /* _DEV_MWL_MVIOCTL_H */
137