blob: 7d9b20dccca2699280d552439be0573223fdc125 [file] [log] [blame]
developer3abe1ad2022-01-24 11:13:32 +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)
developerf90c9af2022-12-28 22:40:23 +080017 * @MT76_TM_ATTR_BAND_IDX: band idx of the chip (u8)
developer3abe1ad2022-01-24 11:13:32 +080018 *
developer50835162023-09-19 13:29:11 +080019 * @MT76_TM_ATTR_SKU_EN: config txpower sku is enabled or disabled in testmode (u8)
developer3abe1ad2022-01-24 11:13:32 +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)
developer887da632022-10-28 09:35:38 +080023 * @MT76_TM_ATTR_TX_LENGTH: packet tx mpdu length (u32)
developer3abe1ad2022-01-24 11:13:32 +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 *
36 * @MT76_TM_ATTR_FREQ_OFFSET: RF frequency offset (u32)
37 *
38 * @MT76_TM_ATTR_STATS: statistics (nested, see &enum mt76_testmode_stats_attr)
39 *
developer071927d2022-08-31 20:39:29 +080040 * @MT76_TM_ATTR_PRECAL: Pre-cal data (u8)
developer071927d2022-08-31 20:39:29 +080041 * @MT76_TM_ATTR_PRECAL_INFO: group size, dpd size, dpd_info, transmit size,
42 * eeprom cal indicator (u32),
43 * dpd_info = [dpd_per_chan_size, chan_num_2g,
44 * chan_num_5g, chan_num_6g]
developer3abe1ad2022-01-24 11:13:32 +080045 * @MT76_TM_ATTR_TX_SPE_IDX: tx spatial extension index (u8)
46 *
47 * @MT76_TM_ATTR_TX_DUTY_CYCLE: packet tx duty cycle (u8)
48 * @MT76_TM_ATTR_TX_IPG: tx inter-packet gap, in unit of us (u32)
49 * @MT76_TM_ATTR_TX_TIME: packet transmission time, in unit of us (u32)
50 *
developer887da632022-10-28 09:35:38 +080051 * @MT76_TM_ATTR_DRV_DATA: driver specific netlink attrs (nested)
52 *
53 * @MT76_TM_ATTR_MAC_ADDRS: array of nested MAC addresses (nested)
54 *
55 * @MT76_TM_ATTR_EEPROM_ACTION: eeprom setting actions
56 * (u8, see &enum mt76_testmode_eeprom_action)
57 * @MT76_TM_ATTR_EEPROM_OFFSET: offset of eeprom data block for writing (u32)
58 * @MT76_TM_ATTR_EEPROM_VAL: values for writing into a 16-byte data block
59 * (nested, u8 attrs)
60 *
61 * @MT76_TM_ATTR_CFG: config testmode rf feature
62 * (nested, see &mt76_testmode_cfg)
63 * @MT76_TM_ATTR_TXBF_ACT: txbf setting actions (u8)
64 * @MT76_TM_ATTR_TXBF_PARAM: txbf parameters (nested)
65 *
66 * @MT76_TM_ATTR_OFF_CH_SCAN_CH: config the channel of background chain (ZWDFS)
67 * (u8)
68 * @MT76_TM_ATTR_OFF_CH_SCAN_CENTER_CH: config the center channel of
69 * background chain (ZWDFS) (u8)
70 * @MT76_TM_ATTR_OFF_CH_SCAN_BW: config the bandwidth of
71 * background chain (ZWDFS) (u8)
72 * @MT76_TM_ATTR_OFF_CH_SCAN_PATH: config the tx path of
73 * background chain (ZWDFS) (u8)
74 *
75 * @MT76_TM_ATTR_IPI_THRESHOLD: config the IPI index you want to read (u8)
76 * @MT76_TM_ATTR_IPI_PERIOD: config the time period for reading
77 * the histogram of specific IPI index (u8)
78 * @MT76_TM_ATTR_IPI_ANTENNA_INDEX: config the antenna index for reading
79 * the histogram of specific IPI index (u8)
80 *
developer3abe1ad2022-01-24 11:13:32 +080081 */
82enum mt76_testmode_attr {
83 MT76_TM_ATTR_UNSPEC,
84
85 MT76_TM_ATTR_RESET,
86 MT76_TM_ATTR_STATE,
87
88 MT76_TM_ATTR_MTD_PART,
89 MT76_TM_ATTR_MTD_OFFSET,
developerf90c9af2022-12-28 22:40:23 +080090 MT76_TM_ATTR_BAND_IDX,
developer3abe1ad2022-01-24 11:13:32 +080091
developer50835162023-09-19 13:29:11 +080092 MT76_TM_ATTR_SKU_EN,
developer3abe1ad2022-01-24 11:13:32 +080093 MT76_TM_ATTR_TX_COUNT,
94 MT76_TM_ATTR_TX_LENGTH,
95 MT76_TM_ATTR_TX_RATE_MODE,
96 MT76_TM_ATTR_TX_RATE_NSS,
97 MT76_TM_ATTR_TX_RATE_IDX,
98 MT76_TM_ATTR_TX_RATE_SGI,
99 MT76_TM_ATTR_TX_RATE_LDPC,
100 MT76_TM_ATTR_TX_RATE_STBC,
101 MT76_TM_ATTR_TX_LTF,
102
103 MT76_TM_ATTR_TX_ANTENNA,
104 MT76_TM_ATTR_TX_POWER_CONTROL,
105 MT76_TM_ATTR_TX_POWER,
106
107 MT76_TM_ATTR_FREQ_OFFSET,
108
109 MT76_TM_ATTR_STATS,
developer071927d2022-08-31 20:39:29 +0800110 MT76_TM_ATTR_PRECAL,
111 MT76_TM_ATTR_PRECAL_INFO,
112
developer3abe1ad2022-01-24 11:13:32 +0800113 MT76_TM_ATTR_TX_SPE_IDX,
114
115 MT76_TM_ATTR_TX_DUTY_CYCLE,
116 MT76_TM_ATTR_TX_IPG,
117 MT76_TM_ATTR_TX_TIME,
118
119 MT76_TM_ATTR_DRV_DATA,
120
121 MT76_TM_ATTR_MAC_ADDRS,
developer5698c9c2022-05-30 16:40:23 +0800122 MT76_TM_ATTR_AID,
123 MT76_TM_ATTR_RU_ALLOC,
124 MT76_TM_ATTR_RU_IDX,
developer3abe1ad2022-01-24 11:13:32 +0800125
126 MT76_TM_ATTR_EEPROM_ACTION,
127 MT76_TM_ATTR_EEPROM_OFFSET,
128 MT76_TM_ATTR_EEPROM_VAL,
129
130 MT76_TM_ATTR_CFG,
developer5698c9c2022-05-30 16:40:23 +0800131 MT76_TM_ATTR_TXBF_ACT,
132 MT76_TM_ATTR_TXBF_PARAM,
developer3abe1ad2022-01-24 11:13:32 +0800133
134 MT76_TM_ATTR_OFF_CH_SCAN_CH,
135 MT76_TM_ATTR_OFF_CH_SCAN_CENTER_CH,
136 MT76_TM_ATTR_OFF_CH_SCAN_BW,
137 MT76_TM_ATTR_OFF_CH_SCAN_PATH,
138
developer887da632022-10-28 09:35:38 +0800139 MT76_TM_ATTR_IPI_THRESHOLD,
140 MT76_TM_ATTR_IPI_PERIOD,
141 MT76_TM_ATTR_IPI_ANTENNA_INDEX,
142
developer3abe1ad2022-01-24 11:13:32 +0800143 /* keep last */
144 NUM_MT76_TM_ATTRS,
145 MT76_TM_ATTR_MAX = NUM_MT76_TM_ATTRS - 1,
146};
147
148/**
149 * enum mt76_testmode_state - statistics attributes
150 *
151 * @MT76_TM_STATS_ATTR_TX_PENDING: pending tx frames (u32)
152 * @MT76_TM_STATS_ATTR_TX_QUEUED: queued tx frames (u32)
153 * @MT76_TM_STATS_ATTR_TX_QUEUED: completed tx frames (u32)
154 *
155 * @MT76_TM_STATS_ATTR_RX_PACKETS: number of rx packets (u64)
156 * @MT76_TM_STATS_ATTR_RX_FCS_ERROR: number of rx packets with FCS error (u64)
157 * @MT76_TM_STATS_ATTR_LAST_RX: information about the last received packet
158 * see &enum mt76_testmode_rx_attr
159 */
160enum mt76_testmode_stats_attr {
161 MT76_TM_STATS_ATTR_UNSPEC,
162 MT76_TM_STATS_ATTR_PAD,
163
164 MT76_TM_STATS_ATTR_TX_PENDING,
165 MT76_TM_STATS_ATTR_TX_QUEUED,
166 MT76_TM_STATS_ATTR_TX_DONE,
167
168 MT76_TM_STATS_ATTR_RX_PACKETS,
169 MT76_TM_STATS_ATTR_RX_FCS_ERROR,
170 MT76_TM_STATS_ATTR_LAST_RX,
171 MT76_TM_STATS_ATTR_RX_LEN_MISMATCH,
172
173 /* keep last */
174 NUM_MT76_TM_STATS_ATTRS,
175 MT76_TM_STATS_ATTR_MAX = NUM_MT76_TM_STATS_ATTRS - 1,
176};
177
178
179/**
180 * enum mt76_testmode_rx_attr - packet rx information
181 *
182 * @MT76_TM_RX_ATTR_FREQ_OFFSET: frequency offset (s32)
183 * @MT76_TM_RX_ATTR_RCPI: received channel power indicator (array, u8)
developer50835162023-09-19 13:29:11 +0800184 * @MT76_TM_RX_ATTR_RSSI: received signal strength indicator (array, s8)
developer3abe1ad2022-01-24 11:13:32 +0800185 * @MT76_TM_RX_ATTR_IB_RSSI: internal inband RSSI (array, s8)
186 * @MT76_TM_RX_ATTR_WB_RSSI: internal wideband RSSI (array, s8)
187 * @MT76_TM_RX_ATTR_SNR: signal-to-noise ratio (u8)
188 */
189enum mt76_testmode_rx_attr {
190 MT76_TM_RX_ATTR_UNSPEC,
191
192 MT76_TM_RX_ATTR_FREQ_OFFSET,
193 MT76_TM_RX_ATTR_RCPI,
developer50835162023-09-19 13:29:11 +0800194 MT76_TM_RX_ATTR_RSSI,
developer3abe1ad2022-01-24 11:13:32 +0800195 MT76_TM_RX_ATTR_IB_RSSI,
196 MT76_TM_RX_ATTR_WB_RSSI,
197 MT76_TM_RX_ATTR_SNR,
198
199 /* keep last */
200 NUM_MT76_TM_RX_ATTRS,
201 MT76_TM_RX_ATTR_MAX = NUM_MT76_TM_RX_ATTRS - 1,
202};
203
204/**
205 * enum mt76_testmode_state - phy test state
206 *
207 * @MT76_TM_STATE_OFF: test mode disabled (normal operation)
208 * @MT76_TM_STATE_IDLE: test mode enabled, but idle
209 * @MT76_TM_STATE_TX_FRAMES: send a fixed number of test frames
210 * @MT76_TM_STATE_RX_FRAMES: receive packets and keep statistics
211 * @MT76_TM_STATE_TX_CONT: waveform tx without time gap
212 * @MT76_TM_STATE_ON: test mode enabled used in offload firmware
213 */
214enum mt76_testmode_state {
215 MT76_TM_STATE_OFF,
216 MT76_TM_STATE_IDLE,
217 MT76_TM_STATE_TX_FRAMES,
218 MT76_TM_STATE_RX_FRAMES,
219 MT76_TM_STATE_TX_CONT,
220 MT76_TM_STATE_ON,
221
222 /* keep last */
223 NUM_MT76_TM_STATES,
224 MT76_TM_STATE_MAX = NUM_MT76_TM_STATES - 1,
225};
226
227/**
228 * enum mt76_testmode_tx_mode - packet tx phy mode
229 *
230 * @MT76_TM_TX_MODE_CCK: legacy CCK mode
231 * @MT76_TM_TX_MODE_OFDM: legacy OFDM mode
232 * @MT76_TM_TX_MODE_HT: 802.11n MCS
233 * @MT76_TM_TX_MODE_VHT: 802.11ac MCS
234 * @MT76_TM_TX_MODE_HE_SU: 802.11ax single-user MIMO
235 * @MT76_TM_TX_MODE_HE_EXT_SU: 802.11ax extended-range SU
236 * @MT76_TM_TX_MODE_HE_TB: 802.11ax trigger-based
237 * @MT76_TM_TX_MODE_HE_MU: 802.11ax multi-user MIMO
238 */
239enum mt76_testmode_tx_mode {
240 MT76_TM_TX_MODE_CCK,
241 MT76_TM_TX_MODE_OFDM,
242 MT76_TM_TX_MODE_HT,
243 MT76_TM_TX_MODE_VHT,
244 MT76_TM_TX_MODE_HE_SU,
245 MT76_TM_TX_MODE_HE_EXT_SU,
246 MT76_TM_TX_MODE_HE_TB,
247 MT76_TM_TX_MODE_HE_MU,
developer77215642023-05-15 13:52:35 +0800248 MT76_TM_TX_MODE_EHT_SU,
249 MT76_TM_TX_MODE_EHT_TRIG,
250 MT76_TM_TX_MODE_EHT_MU,
developer3abe1ad2022-01-24 11:13:32 +0800251
252 /* keep last */
253 NUM_MT76_TM_TX_MODES,
254 MT76_TM_TX_MODE_MAX = NUM_MT76_TM_TX_MODES - 1,
255};
256
257/**
258 * enum mt76_testmode_eeprom_action - eeprom setting actions
259 *
260 * @MT76_TM_EEPROM_ACTION_UPDATE_DATA: update rf values to specific
261 * eeprom data block
262 * @MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE: send updated eeprom data to fw
263 * @MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE: write eeprom data back to efuse
264 */
265enum mt76_testmode_eeprom_action {
266 MT76_TM_EEPROM_ACTION_UPDATE_DATA,
267 MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE,
268 MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE,
269
270 /* keep last */
271 NUM_MT76_TM_EEPROM_ACTION,
272 MT76_TM_EEPROM_ACTION_MAX = NUM_MT76_TM_EEPROM_ACTION - 1,
273};
274
275enum mt76_testmode_txbf_act {
developer1346ce52022-12-15 21:36:14 +0800276 MT76_TM_TXBF_ACT_GOLDEN_INIT,
developer3abe1ad2022-01-24 11:13:32 +0800277 MT76_TM_TXBF_ACT_INIT,
developer1346ce52022-12-15 21:36:14 +0800278 MT76_TM_TX_EBF_ACT_GOLDEN_INIT,
279 MT76_TM_TX_EBF_ACT_INIT,
developer3abe1ad2022-01-24 11:13:32 +0800280 MT76_TM_TXBF_ACT_UPDATE_CH,
281 MT76_TM_TXBF_ACT_PHASE_COMP,
282 MT76_TM_TXBF_ACT_TX_PREP,
283 MT76_TM_TXBF_ACT_IBF_PROF_UPDATE,
284 MT76_TM_TXBF_ACT_EBF_PROF_UPDATE,
developerf9843e22022-09-13 10:57:15 +0800285 MT76_TM_TXBF_ACT_APPLY_TX,
developer3abe1ad2022-01-24 11:13:32 +0800286 MT76_TM_TXBF_ACT_PHASE_CAL,
287 MT76_TM_TXBF_ACT_PROF_UPDATE_ALL,
developerf9843e22022-09-13 10:57:15 +0800288 MT76_TM_TXBF_ACT_PROF_UPDATE_ALL_CMD,
developer5698c9c2022-05-30 16:40:23 +0800289 MT76_TM_TXBF_ACT_E2P_UPDATE,
developer1346ce52022-12-15 21:36:14 +0800290 MT76_TM_TXBF_ACT_TRIGGER_SOUNDING,
291 MT76_TM_TXBF_ACT_STOP_SOUNDING,
292 MT76_TM_TXBF_ACT_PROFILE_TAG_READ,
293 MT76_TM_TXBF_ACT_PROFILE_TAG_WRITE,
294 MT76_TM_TXBF_ACT_PROFILE_TAG_INVALID,
295 MT76_TM_TXBF_ACT_STA_REC_READ,
developer3abe1ad2022-01-24 11:13:32 +0800296
297 /* keep last */
298 NUM_MT76_TM_TXBF_ACT,
299 MT76_TM_TXBF_ACT_MAX = NUM_MT76_TM_TXBF_ACT - 1,
300};
301
302#endif