1/*-
2 * Copyright (c) 2007 Marvell Semiconductor, Inc.
3 * Copyright (c) 2007 Sam Leffler, Errno Consulting
4 * Copyright (c) 2008 Weongyo Jeong <weongyo@freebsd.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer,
12 *    without modification.
13 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14 *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
15 *    redistribution must be conditioned upon including a substantially
16 *    similar Disclaimer requirement for further binary redistribution.
17 *
18 * NO WARRANTY
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
24 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
27 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 * THE POSSIBILITY OF SUCH DAMAGES.
30 *
31 * $FreeBSD: stable/11/sys/dev/malo/if_maloioctl.h 345636 2019-03-28 09:50:25Z avos $
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
40struct 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
85struct 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
104struct 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