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