Linux Audio

Check our new training course

Loading...
v3.1
 
  1/*
  2 * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
  3 * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
  4 * Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License version 2 as
  8 * published by the Free Software Foundation.
  9 */
 10
 11#ifndef __MAC80211_HWSIM_H
 12#define __MAC80211_HWSIM_H
 13
 14/**
 15 * enum hwsim_tx_control_flags - flags to describe transmission info/status
 16 *
 17 * These flags are used to give the wmediumd extra information in order to
 18 * modify its behavior for each frame
 19 *
 20 * @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
 21 * @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack
 22 * @HWSIM_TX_STAT_ACK: Frame was acknowledged
 23 *
 24 */
 25enum hwsim_tx_control_flags {
 26	HWSIM_TX_CTL_REQ_TX_STATUS		= BIT(0),
 27	HWSIM_TX_CTL_NO_ACK			= BIT(1),
 28	HWSIM_TX_STAT_ACK			= BIT(2),
 29};
 30
 31/**
 32 * DOC: Frame transmission/registration support
 33 *
 34 * Frame transmission and registration support exists to allow userspace
 35 * entities such as wmediumd to receive and process all broadcasted
 36 * frames from a mac80211_hwsim radio device.
 37 *
 38 * This allow user space applications to decide if the frame should be
 39 * dropped or not and implement a wireless medium simulator at user space.
 40 *
 41 * Registration is done by sending a register message to the driver and
 42 * will be automatically unregistered if the user application doesn't
 43 * responds to sent frames.
 44 * Once registered the user application has to take responsibility of
 45 * broadcasting the frames to all listening mac80211_hwsim radio
 46 * interfaces.
 47 *
 48 * For more technical details, see the corresponding command descriptions
 49 * below.
 50 */
 51
 52/**
 53 * enum hwsim_commands - supported hwsim commands
 54 *
 55 * @HWSIM_CMD_UNSPEC: unspecified command to catch errors
 56 *
 57 * @HWSIM_CMD_REGISTER: request to register and received all broadcasted
 58 *	frames by any mac80211_hwsim radio device.
 59 * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
 60 * space, uses:
 61 *	%HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER,
 62 *	%HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE,
 63 *	%HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
 64 * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to
 65 * kernel, uses:
 66 *	%HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
 67 *	%HWSIM_ATTR_TX_INFO, %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
 
 
 
 
 
 
 
 
 
 
 
 
 68 * @__HWSIM_CMD_MAX: enum limit
 69 */
 70enum {
 71	HWSIM_CMD_UNSPEC,
 72	HWSIM_CMD_REGISTER,
 73	HWSIM_CMD_FRAME,
 74	HWSIM_CMD_TX_INFO_FRAME,
 
 
 
 75	__HWSIM_CMD_MAX,
 76};
 77#define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
 78
 
 
 
 79/**
 80 * enum hwsim_attrs - hwsim netlink attributes
 81 *
 82 * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
 83 *
 84 * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
 85 *	the frame is broadcasted to
 86 * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
 87 *	the frame was broadcasted from
 88 * @HWSIM_ATTR_FRAME: Data array
 89 * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
 90	properly the frame at user space
 91 * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
 92	space
 93 * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
 94	space
 95 * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
 96 * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 97 * @__HWSIM_ATTR_MAX: enum limit
 98 */
 99
100
101enum {
102	HWSIM_ATTR_UNSPEC,
103	HWSIM_ATTR_ADDR_RECEIVER,
104	HWSIM_ATTR_ADDR_TRANSMITTER,
105	HWSIM_ATTR_FRAME,
106	HWSIM_ATTR_FLAGS,
107	HWSIM_ATTR_RX_RATE,
108	HWSIM_ATTR_SIGNAL,
109	HWSIM_ATTR_TX_INFO,
110	HWSIM_ATTR_COOKIE,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111	__HWSIM_ATTR_MAX,
112};
113#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
114
115/**
116 * struct hwsim_tx_rate - rate selection/status
117 *
118 * @idx: rate index to attempt to send with
119 * @count: number of tries in this rate before going to the next rate
120 *
121 * A value of -1 for @idx indicates an invalid rate and, if used
122 * in an array of retry rates, that no more rates should be tried.
123 *
124 * When used for transmit status reporting, the driver should
125 * always report the rate and number of retries used.
126 *
127 */
128struct hwsim_tx_rate {
129	s8 idx;
130	u8 count;
131} __packed;
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133#endif /* __MAC80211_HWSIM_H */
v5.4
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
  4 * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
  5 * Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
 
 
 
 
  6 */
  7
  8#ifndef __MAC80211_HWSIM_H
  9#define __MAC80211_HWSIM_H
 10
 11/**
 12 * enum hwsim_tx_control_flags - flags to describe transmission info/status
 13 *
 14 * These flags are used to give the wmediumd extra information in order to
 15 * modify its behavior for each frame
 16 *
 17 * @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
 18 * @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack
 19 * @HWSIM_TX_STAT_ACK: Frame was acknowledged
 20 *
 21 */
 22enum hwsim_tx_control_flags {
 23	HWSIM_TX_CTL_REQ_TX_STATUS		= BIT(0),
 24	HWSIM_TX_CTL_NO_ACK			= BIT(1),
 25	HWSIM_TX_STAT_ACK			= BIT(2),
 26};
 27
 28/**
 29 * DOC: Frame transmission/registration support
 30 *
 31 * Frame transmission and registration support exists to allow userspace
 32 * entities such as wmediumd to receive and process all broadcasted
 33 * frames from a mac80211_hwsim radio device.
 34 *
 35 * This allow user space applications to decide if the frame should be
 36 * dropped or not and implement a wireless medium simulator at user space.
 37 *
 38 * Registration is done by sending a register message to the driver and
 39 * will be automatically unregistered if the user application doesn't
 40 * responds to sent frames.
 41 * Once registered the user application has to take responsibility of
 42 * broadcasting the frames to all listening mac80211_hwsim radio
 43 * interfaces.
 44 *
 45 * For more technical details, see the corresponding command descriptions
 46 * below.
 47 */
 48
 49/**
 50 * enum hwsim_commands - supported hwsim commands
 51 *
 52 * @HWSIM_CMD_UNSPEC: unspecified command to catch errors
 53 *
 54 * @HWSIM_CMD_REGISTER: request to register and received all broadcasted
 55 *	frames by any mac80211_hwsim radio device.
 56 * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
 57 *	space, uses:
 58 *	%HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER,
 59 *	%HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE,
 60 *	%HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE, %HWSIM_ATTR_FREQ (optional)
 61 * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to
 62 *	kernel, uses:
 63 *	%HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
 64 *	%HWSIM_ATTR_TX_INFO, %WSIM_ATTR_TX_INFO_FLAGS,
 65 *	%HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
 66 * @HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters,
 67 *	returns the radio ID (>= 0) or negative on errors, if successful
 68 *	then multicast the result, uses optional parameter:
 69 *	%HWSIM_ATTR_REG_STRICT_REG, %HWSIM_ATTR_SUPPORT_P2P_DEVICE,
 70 *	%HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, %HWSIM_ATTR_CHANNELS,
 71 *	%HWSIM_ATTR_NO_VIF, %HWSIM_ATTR_RADIO_NAME, %HWSIM_ATTR_USE_CHANCTX,
 72 *	%HWSIM_ATTR_REG_HINT_ALPHA2, %HWSIM_ATTR_REG_CUSTOM_REG,
 73 *	%HWSIM_ATTR_PERM_ADDR
 74 * @HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted
 75 * @HWSIM_CMD_GET_RADIO: fetch information about existing radios, uses:
 76 *	%HWSIM_ATTR_RADIO_ID
 77 * @__HWSIM_CMD_MAX: enum limit
 78 */
 79enum {
 80	HWSIM_CMD_UNSPEC,
 81	HWSIM_CMD_REGISTER,
 82	HWSIM_CMD_FRAME,
 83	HWSIM_CMD_TX_INFO_FRAME,
 84	HWSIM_CMD_NEW_RADIO,
 85	HWSIM_CMD_DEL_RADIO,
 86	HWSIM_CMD_GET_RADIO,
 87	__HWSIM_CMD_MAX,
 88};
 89#define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
 90
 91#define HWSIM_CMD_CREATE_RADIO   HWSIM_CMD_NEW_RADIO
 92#define HWSIM_CMD_DESTROY_RADIO  HWSIM_CMD_DEL_RADIO
 93
 94/**
 95 * enum hwsim_attrs - hwsim netlink attributes
 96 *
 97 * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
 98 *
 99 * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
100 *	the frame is broadcasted to
101 * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
102 *	the frame was broadcasted from
103 * @HWSIM_ATTR_FRAME: Data array
104 * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
105	properly the frame at user space
106 * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
107	space
108 * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
109	space
110 * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
111 * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
112 * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_CREATE_RADIO
113 *	command giving the number of channels supported by the new radio
114 * @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
115 *	only to destroy a radio
116 * @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatoro driver hint
117 *	(nla string, length 2)
118 * @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
119 * @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
120 * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
121 * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_CREATE_RADIO
122 *	command to force use of channel contexts even when only a
123 *	single channel is supported
124 * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_CREATE_RADIO
125 *	command to force radio removal when process that created the radio dies
126 * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
127 * @HWSIM_ATTR_NO_VIF:  Do not create vif (wlanX) when creating radio.
128 * @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
129 * @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
130 *	rates of %HWSIM_ATTR_TX_INFO
131 * @HWSIM_ATTR_PERM_ADDR: permanent mac address of new radio
132 * @HWSIM_ATTR_IFTYPE_SUPPORT: u32 attribute of supported interface types bits
133 * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
134 * @__HWSIM_ATTR_MAX: enum limit
135 */
136
137
138enum {
139	HWSIM_ATTR_UNSPEC,
140	HWSIM_ATTR_ADDR_RECEIVER,
141	HWSIM_ATTR_ADDR_TRANSMITTER,
142	HWSIM_ATTR_FRAME,
143	HWSIM_ATTR_FLAGS,
144	HWSIM_ATTR_RX_RATE,
145	HWSIM_ATTR_SIGNAL,
146	HWSIM_ATTR_TX_INFO,
147	HWSIM_ATTR_COOKIE,
148	HWSIM_ATTR_CHANNELS,
149	HWSIM_ATTR_RADIO_ID,
150	HWSIM_ATTR_REG_HINT_ALPHA2,
151	HWSIM_ATTR_REG_CUSTOM_REG,
152	HWSIM_ATTR_REG_STRICT_REG,
153	HWSIM_ATTR_SUPPORT_P2P_DEVICE,
154	HWSIM_ATTR_USE_CHANCTX,
155	HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
156	HWSIM_ATTR_RADIO_NAME,
157	HWSIM_ATTR_NO_VIF,
158	HWSIM_ATTR_FREQ,
159	HWSIM_ATTR_PAD,
160	HWSIM_ATTR_TX_INFO_FLAGS,
161	HWSIM_ATTR_PERM_ADDR,
162	HWSIM_ATTR_IFTYPE_SUPPORT,
163	HWSIM_ATTR_CIPHER_SUPPORT,
164	__HWSIM_ATTR_MAX,
165};
166#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
167
168/**
169 * struct hwsim_tx_rate - rate selection/status
170 *
171 * @idx: rate index to attempt to send with
172 * @count: number of tries in this rate before going to the next rate
173 *
174 * A value of -1 for @idx indicates an invalid rate and, if used
175 * in an array of retry rates, that no more rates should be tried.
176 *
177 * When used for transmit status reporting, the driver should
178 * always report the rate and number of retries used.
179 *
180 */
181struct hwsim_tx_rate {
182	s8 idx;
183	u8 count;
184} __packed;
185
186/**
187 * enum hwsim_tx_rate_flags - per-rate flags set by the rate control algorithm.
188 *	Inspired by structure mac80211_rate_control_flags. New flags may be
189 *	appended, but old flags not deleted, to keep compatibility for
190 *	userspace.
191 *
192 * These flags are set by the Rate control algorithm for each rate during tx,
193 * in the @flags member of struct ieee80211_tx_rate.
194 *
195 * @MAC80211_HWSIM_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
196 * @MAC80211_HWSIM_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
197 *	This is set if the current BSS requires ERP protection.
198 * @MAC80211_HWSIM_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
199 * @MAC80211_HWSIM_TX_RC_MCS: HT rate.
200 * @MAC80211_HWSIM_TX_RC_VHT_MCS: VHT MCS rate, in this case the idx field is
201 *	split into a higher 4 bits (Nss) and lower 4 bits (MCS number)
202 * @MAC80211_HWSIM_TX_RC_GREEN_FIELD: Indicates whether this rate should be used
203 *	in Greenfield mode.
204 * @MAC80211_HWSIM_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be
205 *	40 MHz.
206 * @MAC80211_HWSIM_TX_RC_80_MHZ_WIDTH: Indicates 80 MHz transmission
207 * @MAC80211_HWSIM_TX_RC_160_MHZ_WIDTH: Indicates 160 MHz transmission
208 *	(80+80 isn't supported yet)
209 * @MAC80211_HWSIM_TX_RC_DUP_DATA: The frame should be transmitted on both of
210 *	the adjacent 20 MHz channels, if the current channel type is
211 *	NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
212 * @MAC80211_HWSIM_TX_RC_SHORT_GI: Short Guard interval should be used for this
213 *	rate.
214 */
215enum hwsim_tx_rate_flags {
216	MAC80211_HWSIM_TX_RC_USE_RTS_CTS		= BIT(0),
217	MAC80211_HWSIM_TX_RC_USE_CTS_PROTECT		= BIT(1),
218	MAC80211_HWSIM_TX_RC_USE_SHORT_PREAMBLE	= BIT(2),
219
220	/* rate index is an HT/VHT MCS instead of an index */
221	MAC80211_HWSIM_TX_RC_MCS			= BIT(3),
222	MAC80211_HWSIM_TX_RC_GREEN_FIELD		= BIT(4),
223	MAC80211_HWSIM_TX_RC_40_MHZ_WIDTH		= BIT(5),
224	MAC80211_HWSIM_TX_RC_DUP_DATA		= BIT(6),
225	MAC80211_HWSIM_TX_RC_SHORT_GI		= BIT(7),
226	MAC80211_HWSIM_TX_RC_VHT_MCS			= BIT(8),
227	MAC80211_HWSIM_TX_RC_80_MHZ_WIDTH		= BIT(9),
228	MAC80211_HWSIM_TX_RC_160_MHZ_WIDTH		= BIT(10),
229};
230
231/**
232 * struct hwsim_tx_rate - rate selection/status
233 *
234 * @idx: rate index to attempt to send with
235 * @count: number of tries in this rate before going to the next rate
236 *
237 * A value of -1 for @idx indicates an invalid rate and, if used
238 * in an array of retry rates, that no more rates should be tried.
239 *
240 * When used for transmit status reporting, the driver should
241 * always report the rate and number of retries used.
242 *
243 */
244struct hwsim_tx_rate_flag {
245	s8 idx;
246	u16 flags;
247} __packed;
248#endif /* __MAC80211_HWSIM_H */