1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
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 * $FreeBSD: releng/12.0/sys/dev/mwl/if_mwlioctl.h 326255 2017-11-27 14:52:40Z pfg $
33 */
34
35/*
36 * Ioctl-related defintions for the Marvel Wireless LAN controller driver.
37 */
38#ifndef _DEV_MWL_MVIOCTL_H
39#define _DEV_MWL_MVIOCTL_H
40
41struct mwl_stats {
42	struct mwl_hal_hwstats hw_stats;	/* XXX tied to h/w defs */
43	uint32_t	mst_failure;	/* generic hardware failure */
44	uint32_t	mst_rx_badtkipicv;
45	uint32_t	mst_tx_discard;
46	uint32_t	mst_tx_qstop;
47	uint32_t	mst_tx_encap;
48	uint32_t	mst_tx_mgmt;
49	uint32_t	mst_rx_nombuf;
50	uint32_t	mst_rx_busdma;
51	uint32_t	mst_rx_tooshort;
52	uint32_t	mst_tx_busdma;
53	uint32_t	mst_tx_linear;
54	uint32_t	mst_tx_nombuf;
55	uint32_t	mst_tx_nodata;
56	uint32_t	mst_tx_shortpre;
57	uint32_t	mst_tx_retries;
58	uint32_t	mst_tx_mretries;
59	uint32_t	mst_tx_linkerror;
60	uint32_t	mst_tx_xretries;
61	uint32_t	mst_tx_aging;
62 	uint32_t	mst_tx_qdrop;
63	uint32_t	mst_ff_txerr;
64	uint32_t	mst_watchdog;
65	uint32_t	mst_tx_packets;
66	uint32_t	mst_rx_packets;
67	int8_t		mst_rx_rssi;
68	int8_t		mst_rx_noise;
69	uint8_t		mst_tx_rate;
70	uint32_t	mst_ant_tx[4];
71	uint32_t	mst_ant_rx[4];
72	uint32_t	mst_tx_tso;
73	uint32_t	mst_tso_badeth;
74	uint32_t	mst_tso_nohdr;
75	uint32_t	mst_tso_badsplit;
76	uint32_t	mst_rx_crypto;
77	uint32_t	mst_rx_tkipmic;
78	uint32_t	mst_rx_nodmabuf;
79	uint32_t	mst_tx_noheadroom;
80	uint32_t	mst_tx_badframetype;
81	uint32_t	mst_ampdu_nostream;
82	uint32_t	mst_ampdu_reject;
83	uint32_t	mst_addba_nostream;
84	uint32_t	mst_bacreate_failed;
85	uint32_t	mst_bawatchdog;
86	uint32_t	mst_radardetect;
87	uint32_t	mst_rx_dmabufmissing;
88	uint32_t	mst_bawatchdog_notfound;
89	uint32_t	mst_bawatchdog_empty;
90	uint32_t	mst_bawatchdog_failed;
91	uint32_t	mst_rxbuf_failed;
92	uint32_t	mst_pad[31];
93};
94
95#define	SIOCGMVSTATS	_IOWR('i', 137, struct ifreq)
96
97/*
98 * Radio capture format.
99 */
100#define MWL_RX_RADIOTAP_PRESENT (		\
101	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
102	(1 << IEEE80211_RADIOTAP_RATE)		| \
103	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
104	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
105	(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL)	| \
106	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
107	0)
108
109struct mwl_rx_radiotap_header {
110	struct ieee80211_radiotap_header wr_ihdr;
111	u_int8_t	wr_flags;
112	u_int8_t	wr_rate;
113	u_int16_t	wr_chan_freq;
114	u_int16_t	wr_chan_flags;
115	int8_t		wr_antsignal;
116	int8_t		wr_antnoise;
117	u_int8_t	wr_antenna;
118} __packed __aligned(8);
119
120#define MWL_TX_RADIOTAP_PRESENT (		\
121	(1 << IEEE80211_RADIOTAP_FLAGS)		| \
122	(1 << IEEE80211_RADIOTAP_RATE)		| \
123	(1 << IEEE80211_RADIOTAP_CHANNEL)	| \
124	(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)	| \
125	(1 << IEEE80211_RADIOTAP_ANTENNA)	| \
126	0)
127
128struct mwl_tx_radiotap_header {
129	struct ieee80211_radiotap_header wt_ihdr;
130	u_int8_t	wt_flags;
131	u_int8_t	wt_rate;
132	u_int16_t	wt_chan_freq;
133	u_int16_t	wt_chan_flags;
134	u_int8_t	wt_txpower;
135	u_int8_t	wt_antenna;
136} __packed;
137
138#endif /* _DEV_MWL_MVIOCTL_H */
139