Merge tag 'chrome-platform-for-linus-4.13' of git://git.kernel.org/pub/scm/linux...
[linux/fpc-iii.git] / drivers / net / wireless / mac80211_hwsim.h
blob3f5eda591dba7c24bb2848b4495febcca1922b87
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>
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 */
11 #ifndef __MAC80211_HWSIM_H
12 #define __MAC80211_HWSIM_H
14 /**
15 * enum hwsim_tx_control_flags - flags to describe transmission info/status
17 * These flags are used to give the wmediumd extra information in order to
18 * modify its behavior for each frame
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
25 enum 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),
31 /**
32 * DOC: Frame transmission/registration support
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.
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.
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.
48 * For more technical details, see the corresponding command descriptions
49 * below.
52 /**
53 * enum hwsim_commands - supported hwsim commands
55 * @HWSIM_CMD_UNSPEC: unspecified command to catch errors
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, %HWSIM_ATTR_FREQ (optional)
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_NEW_RADIO: create a new radio with the given parameters,
69 * returns the radio ID (>= 0) or negative on errors, if successful
70 * then multicast the result
71 * @HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted
72 * @HWSIM_CMD_GET_RADIO: fetch information about existing radios, uses:
73 * %HWSIM_ATTR_RADIO_ID
74 * @__HWSIM_CMD_MAX: enum limit
76 enum {
77 HWSIM_CMD_UNSPEC,
78 HWSIM_CMD_REGISTER,
79 HWSIM_CMD_FRAME,
80 HWSIM_CMD_TX_INFO_FRAME,
81 HWSIM_CMD_NEW_RADIO,
82 HWSIM_CMD_DEL_RADIO,
83 HWSIM_CMD_GET_RADIO,
84 __HWSIM_CMD_MAX,
86 #define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
88 #define HWSIM_CMD_CREATE_RADIO HWSIM_CMD_NEW_RADIO
89 #define HWSIM_CMD_DESTROY_RADIO HWSIM_CMD_DEL_RADIO
91 /**
92 * enum hwsim_attrs - hwsim netlink attributes
94 * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
96 * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
97 * the frame is broadcasted to
98 * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
99 * the frame was broadcasted from
100 * @HWSIM_ATTR_FRAME: Data array
101 * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
102 properly the frame at user space
103 * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
104 space
105 * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
106 space
107 * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
108 * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
109 * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_CREATE_RADIO
110 * command giving the number of channels supported by the new radio
111 * @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
112 * only to destroy a radio
113 * @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatoro driver hint
114 * (nla string, length 2)
115 * @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
116 * @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
117 * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
118 * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_CREATE_RADIO
119 * command to force use of channel contexts even when only a
120 * single channel is supported
121 * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_CREATE_RADIO
122 * command to force radio removal when process that created the radio dies
123 * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
124 * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio.
125 * @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
126 * @__HWSIM_ATTR_MAX: enum limit
130 enum {
131 HWSIM_ATTR_UNSPEC,
132 HWSIM_ATTR_ADDR_RECEIVER,
133 HWSIM_ATTR_ADDR_TRANSMITTER,
134 HWSIM_ATTR_FRAME,
135 HWSIM_ATTR_FLAGS,
136 HWSIM_ATTR_RX_RATE,
137 HWSIM_ATTR_SIGNAL,
138 HWSIM_ATTR_TX_INFO,
139 HWSIM_ATTR_COOKIE,
140 HWSIM_ATTR_CHANNELS,
141 HWSIM_ATTR_RADIO_ID,
142 HWSIM_ATTR_REG_HINT_ALPHA2,
143 HWSIM_ATTR_REG_CUSTOM_REG,
144 HWSIM_ATTR_REG_STRICT_REG,
145 HWSIM_ATTR_SUPPORT_P2P_DEVICE,
146 HWSIM_ATTR_USE_CHANCTX,
147 HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
148 HWSIM_ATTR_RADIO_NAME,
149 HWSIM_ATTR_NO_VIF,
150 HWSIM_ATTR_FREQ,
151 HWSIM_ATTR_PAD,
152 __HWSIM_ATTR_MAX,
154 #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
157 * struct hwsim_tx_rate - rate selection/status
159 * @idx: rate index to attempt to send with
160 * @count: number of tries in this rate before going to the next rate
162 * A value of -1 for @idx indicates an invalid rate and, if used
163 * in an array of retry rates, that no more rates should be tried.
165 * When used for transmit status reporting, the driver should
166 * always report the rate and number of retries used.
169 struct hwsim_tx_rate {
170 s8 idx;
171 u8 count;
172 } __packed;
174 #endif /* __MAC80211_HWSIM_H */