blob: bd0aee74645e52c2f1a37cdd812b309d15372a0d [file] [log] [blame]
developerb9b4cd12022-10-11 13:18:59 +08001/* Copyright (C) 2021-2022 Mediatek Inc. */
2#ifndef __ATENL_NL_H
3#define __ATENL_NL_H
4
5/* This is copied from mt76/testmode.h */
6
7/**
8 * enum mt76_testmode_attr - testmode attributes inside NL80211_ATTR_TESTDATA
9 *
10 * @MT76_TM_ATTR_UNSPEC: (invalid attribute)
11 *
12 * @MT76_TM_ATTR_RESET: reset parameters to default (flag)
13 * @MT76_TM_ATTR_STATE: test state (u32), see &enum mt76_testmode_state
14 *
15 * @MT76_TM_ATTR_MTD_PART: mtd partition used for eeprom data (string)
16 * @MT76_TM_ATTR_MTD_OFFSET: offset of eeprom data within the partition (u32)
developer13655da2023-01-10 19:53:25 +080017 * @MT76_TM_ATTR_BAND_IDX: band idx of the chip (u8)
developerb9b4cd12022-10-11 13:18:59 +080018 *
developerbd9fa1e2023-10-16 11:04:00 +080019 * @MT76_TM_ATTR_SKU_EN: config txpower sku is enabled or disabled in testmode (u8)
developerb9b4cd12022-10-11 13:18:59 +080020 * @MT76_TM_ATTR_TX_COUNT: configured number of frames to send when setting
21 * state to MT76_TM_STATE_TX_FRAMES (u32)
22 * @MT76_TM_ATTR_TX_PENDING: pending frames during MT76_TM_STATE_TX_FRAMES (u32)
developerb403ad02022-11-08 10:16:29 +080023 * @MT76_TM_ATTR_TX_LENGTH: packet tx mpdu length (u32)
developerb9b4cd12022-10-11 13:18:59 +080024 * @MT76_TM_ATTR_TX_RATE_MODE: packet tx mode (u8, see &enum mt76_testmode_tx_mode)
25 * @MT76_TM_ATTR_TX_RATE_NSS: packet tx number of spatial streams (u8)
26 * @MT76_TM_ATTR_TX_RATE_IDX: packet tx rate/MCS index (u8)
27 * @MT76_TM_ATTR_TX_RATE_SGI: packet tx use short guard interval (u8)
28 * @MT76_TM_ATTR_TX_RATE_LDPC: packet tx enable LDPC (u8)
29 * @MT76_TM_ATTR_TX_RATE_STBC: packet tx enable STBC (u8)
30 * @MT76_TM_ATTR_TX_LTF: packet tx LTF, set 0 to 2 for 1x, 2x, and 4x LTF (u8)
31 *
32 * @MT76_TM_ATTR_TX_ANTENNA: tx antenna mask (u8)
33 * @MT76_TM_ATTR_TX_POWER_CONTROL: enable tx power control (u8)
34 * @MT76_TM_ATTR_TX_POWER: per-antenna tx power array (nested, u8 attrs)
35 *
developer05f3b2b2024-08-19 19:17:34 +080036 * @MT76_TM_ATTR_TX_PKT_BW: per-packet data bandwidth (u8)
37 * @MT76_TM_ATTR_TX_PRI_SEL: primary channel selection index (u8)
38 *
developerb9b4cd12022-10-11 13:18:59 +080039 * @MT76_TM_ATTR_FREQ_OFFSET: RF frequency offset (u32)
40 *
41 * @MT76_TM_ATTR_STATS: statistics (nested, see &enum mt76_testmode_stats_attr)
42 *
43 * @MT76_TM_ATTR_PRECAL: Pre-cal data (u8)
developerb9b4cd12022-10-11 13:18:59 +080044 * @MT76_TM_ATTR_PRECAL_INFO: group size, dpd size, dpd_info, transmit size,
45 * eeprom cal indicator (u32),
46 * dpd_info = [dpd_per_chan_size, chan_num_2g,
47 * chan_num_5g, chan_num_6g]
48 * @MT76_TM_ATTR_TX_SPE_IDX: tx spatial extension index (u8)
49 *
50 * @MT76_TM_ATTR_TX_DUTY_CYCLE: packet tx duty cycle (u8)
51 * @MT76_TM_ATTR_TX_IPG: tx inter-packet gap, in unit of us (u32)
52 * @MT76_TM_ATTR_TX_TIME: packet transmission time, in unit of us (u32)
53 *
developerb403ad02022-11-08 10:16:29 +080054 * @MT76_TM_ATTR_DRV_DATA: driver specific netlink attrs (nested)
55 *
56 * @MT76_TM_ATTR_MAC_ADDRS: array of nested MAC addresses (nested)
57 *
58 * @MT76_TM_ATTR_EEPROM_ACTION: eeprom setting actions
59 * (u8, see &enum mt76_testmode_eeprom_action)
60 * @MT76_TM_ATTR_EEPROM_OFFSET: offset of eeprom data block for writing (u32)
61 * @MT76_TM_ATTR_EEPROM_VAL: values for writing into a 16-byte data block
62 * (nested, u8 attrs)
63 *
64 * @MT76_TM_ATTR_CFG: config testmode rf feature
65 * (nested, see &mt76_testmode_cfg)
66 * @MT76_TM_ATTR_TXBF_ACT: txbf setting actions (u8)
67 * @MT76_TM_ATTR_TXBF_PARAM: txbf parameters (nested)
68 *
69 * @MT76_TM_ATTR_OFF_CH_SCAN_CH: config the channel of background chain (ZWDFS)
70 * (u8)
71 * @MT76_TM_ATTR_OFF_CH_SCAN_CENTER_CH: config the center channel of
72 * background chain (ZWDFS) (u8)
73 * @MT76_TM_ATTR_OFF_CH_SCAN_BW: config the bandwidth of
74 * background chain (ZWDFS) (u8)
75 * @MT76_TM_ATTR_OFF_CH_SCAN_PATH: config the tx path of
76 * background chain (ZWDFS) (u8)
77 *
78 * @MT76_TM_ATTR_IPI_THRESHOLD: config the IPI index you want to read (u8)
79 * @MT76_TM_ATTR_IPI_PERIOD: config the time period for reading
80 * the histogram of specific IPI index (u8)
81 * @MT76_TM_ATTR_IPI_ANTENNA_INDEX: config the antenna index for reading
82 * the histogram of specific IPI index (u8)
83 *
developerb9b4cd12022-10-11 13:18:59 +080084 */
85enum mt76_testmode_attr {
86 MT76_TM_ATTR_UNSPEC,
87
88 MT76_TM_ATTR_RESET,
89 MT76_TM_ATTR_STATE,
90
91 MT76_TM_ATTR_MTD_PART,
92 MT76_TM_ATTR_MTD_OFFSET,
developer13655da2023-01-10 19:53:25 +080093 MT76_TM_ATTR_BAND_IDX,
developerb9b4cd12022-10-11 13:18:59 +080094
developerbd9fa1e2023-10-16 11:04:00 +080095 MT76_TM_ATTR_SKU_EN,
developerb9b4cd12022-10-11 13:18:59 +080096 MT76_TM_ATTR_TX_COUNT,
97 MT76_TM_ATTR_TX_LENGTH,
98 MT76_TM_ATTR_TX_RATE_MODE,
99 MT76_TM_ATTR_TX_RATE_NSS,
100 MT76_TM_ATTR_TX_RATE_IDX,
101 MT76_TM_ATTR_TX_RATE_SGI,
102 MT76_TM_ATTR_TX_RATE_LDPC,
103 MT76_TM_ATTR_TX_RATE_STBC,
104 MT76_TM_ATTR_TX_LTF,
105
106 MT76_TM_ATTR_TX_ANTENNA,
107 MT76_TM_ATTR_TX_POWER_CONTROL,
108 MT76_TM_ATTR_TX_POWER,
109
developer05f3b2b2024-08-19 19:17:34 +0800110 MT76_TM_ATTR_TX_PKT_BW,
111 MT76_TM_ATTR_TX_PRI_SEL,
112
developerb9b4cd12022-10-11 13:18:59 +0800113 MT76_TM_ATTR_FREQ_OFFSET,
114
115 MT76_TM_ATTR_STATS,
developerb9b4cd12022-10-11 13:18:59 +0800116 MT76_TM_ATTR_PRECAL,
117 MT76_TM_ATTR_PRECAL_INFO,
118
119 MT76_TM_ATTR_TX_SPE_IDX,
120
121 MT76_TM_ATTR_TX_DUTY_CYCLE,
122 MT76_TM_ATTR_TX_IPG,
123 MT76_TM_ATTR_TX_TIME,
124
125 MT76_TM_ATTR_DRV_DATA,
126
127 MT76_TM_ATTR_MAC_ADDRS,
128 MT76_TM_ATTR_AID,
129 MT76_TM_ATTR_RU_ALLOC,
130 MT76_TM_ATTR_RU_IDX,
131
132 MT76_TM_ATTR_EEPROM_ACTION,
133 MT76_TM_ATTR_EEPROM_OFFSET,
134 MT76_TM_ATTR_EEPROM_VAL,
135
136 MT76_TM_ATTR_CFG,
137 MT76_TM_ATTR_TXBF_ACT,
138 MT76_TM_ATTR_TXBF_PARAM,
139
140 MT76_TM_ATTR_OFF_CH_SCAN_CH,
141 MT76_TM_ATTR_OFF_CH_SCAN_CENTER_CH,
142 MT76_TM_ATTR_OFF_CH_SCAN_BW,
143 MT76_TM_ATTR_OFF_CH_SCAN_PATH,
144
developerb403ad02022-11-08 10:16:29 +0800145 MT76_TM_ATTR_IPI_THRESHOLD,
146 MT76_TM_ATTR_IPI_PERIOD,
147 MT76_TM_ATTR_IPI_ANTENNA_INDEX,
148
developerb9b4cd12022-10-11 13:18:59 +0800149 /* keep last */
150 NUM_MT76_TM_ATTRS,
151 MT76_TM_ATTR_MAX = NUM_MT76_TM_ATTRS - 1,
152};
153
154/**
155 * enum mt76_testmode_state - statistics attributes
156 *
157 * @MT76_TM_STATS_ATTR_TX_PENDING: pending tx frames (u32)
158 * @MT76_TM_STATS_ATTR_TX_QUEUED: queued tx frames (u32)
159 * @MT76_TM_STATS_ATTR_TX_QUEUED: completed tx frames (u32)
160 *
161 * @MT76_TM_STATS_ATTR_RX_PACKETS: number of rx packets (u64)
162 * @MT76_TM_STATS_ATTR_RX_FCS_ERROR: number of rx packets with FCS error (u64)
163 * @MT76_TM_STATS_ATTR_LAST_RX: information about the last received packet
164 * see &enum mt76_testmode_rx_attr
165 */
166enum mt76_testmode_stats_attr {
167 MT76_TM_STATS_ATTR_UNSPEC,
168 MT76_TM_STATS_ATTR_PAD,
169
170 MT76_TM_STATS_ATTR_TX_PENDING,
171 MT76_TM_STATS_ATTR_TX_QUEUED,
172 MT76_TM_STATS_ATTR_TX_DONE,
173
174 MT76_TM_STATS_ATTR_RX_PACKETS,
175 MT76_TM_STATS_ATTR_RX_FCS_ERROR,
176 MT76_TM_STATS_ATTR_LAST_RX,
177 MT76_TM_STATS_ATTR_RX_LEN_MISMATCH,
178
179 /* keep last */
180 NUM_MT76_TM_STATS_ATTRS,
181 MT76_TM_STATS_ATTR_MAX = NUM_MT76_TM_STATS_ATTRS - 1,
182};
183
184
185/**
186 * enum mt76_testmode_rx_attr - packet rx information
187 *
188 * @MT76_TM_RX_ATTR_FREQ_OFFSET: frequency offset (s32)
189 * @MT76_TM_RX_ATTR_RCPI: received channel power indicator (array, u8)
developerbd9fa1e2023-10-16 11:04:00 +0800190 * @MT76_TM_RX_ATTR_RSSI: received signal strength indicator (array, s8)
developerb9b4cd12022-10-11 13:18:59 +0800191 * @MT76_TM_RX_ATTR_IB_RSSI: internal inband RSSI (array, s8)
192 * @MT76_TM_RX_ATTR_WB_RSSI: internal wideband RSSI (array, s8)
193 * @MT76_TM_RX_ATTR_SNR: signal-to-noise ratio (u8)
194 */
195enum mt76_testmode_rx_attr {
196 MT76_TM_RX_ATTR_UNSPEC,
197
198 MT76_TM_RX_ATTR_FREQ_OFFSET,
199 MT76_TM_RX_ATTR_RCPI,
developerbd9fa1e2023-10-16 11:04:00 +0800200 MT76_TM_RX_ATTR_RSSI,
developerb9b4cd12022-10-11 13:18:59 +0800201 MT76_TM_RX_ATTR_IB_RSSI,
202 MT76_TM_RX_ATTR_WB_RSSI,
203 MT76_TM_RX_ATTR_SNR,
204
205 /* keep last */
206 NUM_MT76_TM_RX_ATTRS,
207 MT76_TM_RX_ATTR_MAX = NUM_MT76_TM_RX_ATTRS - 1,
208};
209
210/**
211 * enum mt76_testmode_state - phy test state
212 *
213 * @MT76_TM_STATE_OFF: test mode disabled (normal operation)
214 * @MT76_TM_STATE_IDLE: test mode enabled, but idle
215 * @MT76_TM_STATE_TX_FRAMES: send a fixed number of test frames
216 * @MT76_TM_STATE_RX_FRAMES: receive packets and keep statistics
217 * @MT76_TM_STATE_TX_CONT: waveform tx without time gap
218 * @MT76_TM_STATE_ON: test mode enabled used in offload firmware
219 */
220enum mt76_testmode_state {
221 MT76_TM_STATE_OFF,
222 MT76_TM_STATE_IDLE,
223 MT76_TM_STATE_TX_FRAMES,
224 MT76_TM_STATE_RX_FRAMES,
225 MT76_TM_STATE_TX_CONT,
226 MT76_TM_STATE_ON,
227
228 /* keep last */
229 NUM_MT76_TM_STATES,
230 MT76_TM_STATE_MAX = NUM_MT76_TM_STATES - 1,
231};
232
233/**
234 * enum mt76_testmode_tx_mode - packet tx phy mode
235 *
236 * @MT76_TM_TX_MODE_CCK: legacy CCK mode
237 * @MT76_TM_TX_MODE_OFDM: legacy OFDM mode
238 * @MT76_TM_TX_MODE_HT: 802.11n MCS
239 * @MT76_TM_TX_MODE_VHT: 802.11ac MCS
240 * @MT76_TM_TX_MODE_HE_SU: 802.11ax single-user MIMO
241 * @MT76_TM_TX_MODE_HE_EXT_SU: 802.11ax extended-range SU
242 * @MT76_TM_TX_MODE_HE_TB: 802.11ax trigger-based
243 * @MT76_TM_TX_MODE_HE_MU: 802.11ax multi-user MIMO
244 */
245enum mt76_testmode_tx_mode {
246 MT76_TM_TX_MODE_CCK,
247 MT76_TM_TX_MODE_OFDM,
248 MT76_TM_TX_MODE_HT,
249 MT76_TM_TX_MODE_VHT,
250 MT76_TM_TX_MODE_HE_SU,
251 MT76_TM_TX_MODE_HE_EXT_SU,
252 MT76_TM_TX_MODE_HE_TB,
253 MT76_TM_TX_MODE_HE_MU,
developer7af0f762023-05-22 15:16:16 +0800254 MT76_TM_TX_MODE_EHT_SU,
255 MT76_TM_TX_MODE_EHT_TRIG,
256 MT76_TM_TX_MODE_EHT_MU,
developerb9b4cd12022-10-11 13:18:59 +0800257
258 /* keep last */
259 NUM_MT76_TM_TX_MODES,
260 MT76_TM_TX_MODE_MAX = NUM_MT76_TM_TX_MODES - 1,
261};
262
263/**
264 * enum mt76_testmode_eeprom_action - eeprom setting actions
265 *
266 * @MT76_TM_EEPROM_ACTION_UPDATE_DATA: update rf values to specific
267 * eeprom data block
268 * @MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE: send updated eeprom data to fw
269 * @MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE: write eeprom data back to efuse
developerd0c89452024-10-11 16:53:27 +0800270 * @MT76_TM_EEPROM_ACTION_WRITE_TO_EXT_EEPROM: write eeprom data back to external eeprom
developerb9b4cd12022-10-11 13:18:59 +0800271 */
272enum mt76_testmode_eeprom_action {
273 MT76_TM_EEPROM_ACTION_UPDATE_DATA,
274 MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE,
275 MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE,
developerd0c89452024-10-11 16:53:27 +0800276 MT76_TM_EEPROM_ACTION_WRITE_TO_EXT_EEPROM,
developerb9b4cd12022-10-11 13:18:59 +0800277
278 /* keep last */
279 NUM_MT76_TM_EEPROM_ACTION,
280 MT76_TM_EEPROM_ACTION_MAX = NUM_MT76_TM_EEPROM_ACTION - 1,
281};
282
283enum mt76_testmode_txbf_act {
developerc5ce7502022-12-19 11:33:22 +0800284 MT76_TM_TXBF_ACT_GOLDEN_INIT,
developerb9b4cd12022-10-11 13:18:59 +0800285 MT76_TM_TXBF_ACT_INIT,
developerc5ce7502022-12-19 11:33:22 +0800286 MT76_TM_TX_EBF_ACT_GOLDEN_INIT,
287 MT76_TM_TX_EBF_ACT_INIT,
developerb9b4cd12022-10-11 13:18:59 +0800288 MT76_TM_TXBF_ACT_UPDATE_CH,
289 MT76_TM_TXBF_ACT_PHASE_COMP,
290 MT76_TM_TXBF_ACT_TX_PREP,
291 MT76_TM_TXBF_ACT_IBF_PROF_UPDATE,
292 MT76_TM_TXBF_ACT_EBF_PROF_UPDATE,
293 MT76_TM_TXBF_ACT_APPLY_TX,
294 MT76_TM_TXBF_ACT_PHASE_CAL,
295 MT76_TM_TXBF_ACT_PROF_UPDATE_ALL,
296 MT76_TM_TXBF_ACT_PROF_UPDATE_ALL_CMD,
297 MT76_TM_TXBF_ACT_E2P_UPDATE,
developerc5ce7502022-12-19 11:33:22 +0800298 MT76_TM_TXBF_ACT_TRIGGER_SOUNDING,
299 MT76_TM_TXBF_ACT_STOP_SOUNDING,
300 MT76_TM_TXBF_ACT_PROFILE_TAG_READ,
301 MT76_TM_TXBF_ACT_PROFILE_TAG_WRITE,
302 MT76_TM_TXBF_ACT_PROFILE_TAG_INVALID,
303 MT76_TM_TXBF_ACT_STA_REC_READ,
developerb9b4cd12022-10-11 13:18:59 +0800304
305 /* keep last */
306 NUM_MT76_TM_TXBF_ACT,
307 MT76_TM_TXBF_ACT_MAX = NUM_MT76_TM_TXBF_ACT - 1,
308};
309
310#endif