xref: /freebsd/sys/dev/malo/if_maloioctl.h (revision 42249ef2)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
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  * $FreeBSD$
34  */
35 
36 /*
37  * Ioctl-related defintions for the Marvel Wireless LAN controller driver.
38  */
39 #ifndef _DEV_MALO_MVIOCTL_H
40 #define _DEV_MALO_MVIOCTL_H
41 
42 struct malo_stats {
43 	struct malo_hal_hwstats hw_stats;	/* XXX tied to h/w defs */
44 	uint32_t	mst_failure;	/* generic hardware failure */
45 	uint32_t	mst_rx_badtkipicv;
46 	uint32_t	mst_tx_discard;
47 	uint32_t	mst_tx_qstop;
48 	uint32_t	mst_tx_encap;
49 	uint32_t	mst_tx_mgmt;
50 	uint32_t	mst_rx_nombuf;
51 	uint32_t	mst_rx_busdma;
52 	uint32_t	mst_rx_tooshort;
53 	uint32_t	mst_tx_busdma;
54 	uint32_t	mst_tx_linear;
55 	uint32_t	mst_tx_nombuf;
56 	uint32_t	mst_tx_nodata;
57 	uint32_t	mst_tx_shortpre;
58 	uint32_t	mst_tx_retries;
59 	uint32_t	mst_tx_mretries;
60 	uint32_t	mst_tx_linkerror;
61 	uint32_t	mst_tx_xretries;
62 	uint32_t	mst_tx_aging;
63 	uint32_t	mst_watchdog;
64 	uint32_t	mst_tx_packets;
65 	uint32_t	mst_rx_packets;
66 	int8_t		mst_rx_rssi;
67 	int8_t		mst_rx_noise;
68 	uint8_t		mst_tx_rate;
69 	uint32_t	mst_ant_tx[4];
70 	uint32_t	mst_ant_rx[4];
71 };
72 
73 #define	SIOCGMVSTATS	_IOWR('i', 137, struct ifreq)
74 
75 /*
76  * Radio capture format.
77  */
78 #define MALO_RX_RADIOTAP_PRESENT (		\
79 	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
80 	(1 << IEEE80211_RADIOTAP_RATE)		| \
81 	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
82 	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
83 	(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)	| \
84 	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
85 	0)
86 
87 struct malo_rx_radiotap_header {
88 	struct ieee80211_radiotap_header wr_ihdr;
89 	u_int8_t	wr_flags;
90 	u_int8_t	wr_rate;
91 	u_int16_t	wr_chan_freq;
92 	u_int16_t	wr_chan_flags;
93 	int8_t		wr_antsignal;
94 	int8_t		wr_antnoise;
95 	u_int8_t	wr_antenna;
96 } __packed __aligned(8);
97 
98 #define MALO_TX_RADIOTAP_PRESENT (		\
99 	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
100 	(1 << IEEE80211_RADIOTAP_RATE)		| \
101 	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
102 	(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)	| \
103 	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
104 	0)
105 
106 struct malo_tx_radiotap_header {
107 	struct ieee80211_radiotap_header wt_ihdr;
108 	u_int8_t	wt_flags;
109 	u_int8_t	wt_rate;
110 	u_int16_t	wt_chan_freq;
111 	u_int16_t	wt_chan_flags;
112 	u_int8_t	wt_txpower;
113 	u_int8_t	wt_antenna;
114 } __packed;
115 
116 #endif /* _DEV_MALO_MVIOCTL_H */
117