blob: 27336bd61fff61a9a651314383d09b74e88ad7d3 [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)
developer071927d2022-08-31 20:39:29 +080017 * @MT76_TM_ATTR_IS_MAIN_PHY: Is current phy index the main phy or the ext phy (u8)
developer3abe1ad2022-01-24 11:13:32 +080018 *
19 * @MT76_TM_ATTR_TX_COUNT: configured number of frames to send when setting
20 * state to MT76_TM_STATE_TX_FRAMES (u32)
21 * @MT76_TM_ATTR_TX_PENDING: pending frames during MT76_TM_STATE_TX_FRAMES (u32)
22 * @MT76_TM_ATTR_TX_LENGTH: packet tx msdu length (u32)
23 * @MT76_TM_ATTR_TX_RATE_MODE: packet tx mode (u8, see &enum mt76_testmode_tx_mode)
24 * @MT76_TM_ATTR_TX_RATE_NSS: packet tx number of spatial streams (u8)
25 * @MT76_TM_ATTR_TX_RATE_IDX: packet tx rate/MCS index (u8)
26 * @MT76_TM_ATTR_TX_RATE_SGI: packet tx use short guard interval (u8)
27 * @MT76_TM_ATTR_TX_RATE_LDPC: packet tx enable LDPC (u8)
28 * @MT76_TM_ATTR_TX_RATE_STBC: packet tx enable STBC (u8)
29 * @MT76_TM_ATTR_TX_LTF: packet tx LTF, set 0 to 2 for 1x, 2x, and 4x LTF (u8)
30 *
31 * @MT76_TM_ATTR_TX_ANTENNA: tx antenna mask (u8)
32 * @MT76_TM_ATTR_TX_POWER_CONTROL: enable tx power control (u8)
33 * @MT76_TM_ATTR_TX_POWER: per-antenna tx power array (nested, u8 attrs)
34 *
35 * @MT76_TM_ATTR_FREQ_OFFSET: RF frequency offset (u32)
36 *
37 * @MT76_TM_ATTR_STATS: statistics (nested, see &enum mt76_testmode_stats_attr)
38 *
developer071927d2022-08-31 20:39:29 +080039 * @MT76_TM_ATTR_PRECAL: Pre-cal data (u8)
40 * @MT76_TM_ATTR_PRECAL: Pre-cal data (u8)
41 * @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 *
51 */
52enum mt76_testmode_attr {
53 MT76_TM_ATTR_UNSPEC,
54
55 MT76_TM_ATTR_RESET,
56 MT76_TM_ATTR_STATE,
57
58 MT76_TM_ATTR_MTD_PART,
59 MT76_TM_ATTR_MTD_OFFSET,
developer071927d2022-08-31 20:39:29 +080060 MT76_TM_ATTR_IS_MAIN_PHY,
developer3abe1ad2022-01-24 11:13:32 +080061
62 MT76_TM_ATTR_TX_COUNT,
63 MT76_TM_ATTR_TX_LENGTH,
64 MT76_TM_ATTR_TX_RATE_MODE,
65 MT76_TM_ATTR_TX_RATE_NSS,
66 MT76_TM_ATTR_TX_RATE_IDX,
67 MT76_TM_ATTR_TX_RATE_SGI,
68 MT76_TM_ATTR_TX_RATE_LDPC,
69 MT76_TM_ATTR_TX_RATE_STBC,
70 MT76_TM_ATTR_TX_LTF,
71
72 MT76_TM_ATTR_TX_ANTENNA,
73 MT76_TM_ATTR_TX_POWER_CONTROL,
74 MT76_TM_ATTR_TX_POWER,
75
76 MT76_TM_ATTR_FREQ_OFFSET,
77
78 MT76_TM_ATTR_STATS,
79
developer071927d2022-08-31 20:39:29 +080080 MT76_TM_ATTR_PRECAL,
81 MT76_TM_ATTR_PRECAL_INFO,
82
developer3abe1ad2022-01-24 11:13:32 +080083 MT76_TM_ATTR_TX_SPE_IDX,
84
85 MT76_TM_ATTR_TX_DUTY_CYCLE,
86 MT76_TM_ATTR_TX_IPG,
87 MT76_TM_ATTR_TX_TIME,
88
89 MT76_TM_ATTR_DRV_DATA,
90
91 MT76_TM_ATTR_MAC_ADDRS,
developer5698c9c2022-05-30 16:40:23 +080092 MT76_TM_ATTR_AID,
93 MT76_TM_ATTR_RU_ALLOC,
94 MT76_TM_ATTR_RU_IDX,
developer3abe1ad2022-01-24 11:13:32 +080095
96 MT76_TM_ATTR_EEPROM_ACTION,
97 MT76_TM_ATTR_EEPROM_OFFSET,
98 MT76_TM_ATTR_EEPROM_VAL,
99
100 MT76_TM_ATTR_CFG,
developer5698c9c2022-05-30 16:40:23 +0800101 MT76_TM_ATTR_TXBF_ACT,
102 MT76_TM_ATTR_TXBF_PARAM,
developer3abe1ad2022-01-24 11:13:32 +0800103
104 MT76_TM_ATTR_OFF_CH_SCAN_CH,
105 MT76_TM_ATTR_OFF_CH_SCAN_CENTER_CH,
106 MT76_TM_ATTR_OFF_CH_SCAN_BW,
107 MT76_TM_ATTR_OFF_CH_SCAN_PATH,
108
developer3abe1ad2022-01-24 11:13:32 +0800109 /* keep last */
110 NUM_MT76_TM_ATTRS,
111 MT76_TM_ATTR_MAX = NUM_MT76_TM_ATTRS - 1,
112};
113
114/**
115 * enum mt76_testmode_state - statistics attributes
116 *
117 * @MT76_TM_STATS_ATTR_TX_PENDING: pending tx frames (u32)
118 * @MT76_TM_STATS_ATTR_TX_QUEUED: queued tx frames (u32)
119 * @MT76_TM_STATS_ATTR_TX_QUEUED: completed tx frames (u32)
120 *
121 * @MT76_TM_STATS_ATTR_RX_PACKETS: number of rx packets (u64)
122 * @MT76_TM_STATS_ATTR_RX_FCS_ERROR: number of rx packets with FCS error (u64)
123 * @MT76_TM_STATS_ATTR_LAST_RX: information about the last received packet
124 * see &enum mt76_testmode_rx_attr
125 */
126enum mt76_testmode_stats_attr {
127 MT76_TM_STATS_ATTR_UNSPEC,
128 MT76_TM_STATS_ATTR_PAD,
129
130 MT76_TM_STATS_ATTR_TX_PENDING,
131 MT76_TM_STATS_ATTR_TX_QUEUED,
132 MT76_TM_STATS_ATTR_TX_DONE,
133
134 MT76_TM_STATS_ATTR_RX_PACKETS,
135 MT76_TM_STATS_ATTR_RX_FCS_ERROR,
136 MT76_TM_STATS_ATTR_LAST_RX,
137 MT76_TM_STATS_ATTR_RX_LEN_MISMATCH,
138
139 /* keep last */
140 NUM_MT76_TM_STATS_ATTRS,
141 MT76_TM_STATS_ATTR_MAX = NUM_MT76_TM_STATS_ATTRS - 1,
142};
143
144
145/**
146 * enum mt76_testmode_rx_attr - packet rx information
147 *
148 * @MT76_TM_RX_ATTR_FREQ_OFFSET: frequency offset (s32)
149 * @MT76_TM_RX_ATTR_RCPI: received channel power indicator (array, u8)
150 * @MT76_TM_RX_ATTR_IB_RSSI: internal inband RSSI (array, s8)
151 * @MT76_TM_RX_ATTR_WB_RSSI: internal wideband RSSI (array, s8)
152 * @MT76_TM_RX_ATTR_SNR: signal-to-noise ratio (u8)
153 */
154enum mt76_testmode_rx_attr {
155 MT76_TM_RX_ATTR_UNSPEC,
156
157 MT76_TM_RX_ATTR_FREQ_OFFSET,
158 MT76_TM_RX_ATTR_RCPI,
159 MT76_TM_RX_ATTR_IB_RSSI,
160 MT76_TM_RX_ATTR_WB_RSSI,
161 MT76_TM_RX_ATTR_SNR,
162
163 /* keep last */
164 NUM_MT76_TM_RX_ATTRS,
165 MT76_TM_RX_ATTR_MAX = NUM_MT76_TM_RX_ATTRS - 1,
166};
167
168/**
169 * enum mt76_testmode_state - phy test state
170 *
171 * @MT76_TM_STATE_OFF: test mode disabled (normal operation)
172 * @MT76_TM_STATE_IDLE: test mode enabled, but idle
173 * @MT76_TM_STATE_TX_FRAMES: send a fixed number of test frames
174 * @MT76_TM_STATE_RX_FRAMES: receive packets and keep statistics
175 * @MT76_TM_STATE_TX_CONT: waveform tx without time gap
176 * @MT76_TM_STATE_ON: test mode enabled used in offload firmware
177 */
178enum mt76_testmode_state {
179 MT76_TM_STATE_OFF,
180 MT76_TM_STATE_IDLE,
181 MT76_TM_STATE_TX_FRAMES,
182 MT76_TM_STATE_RX_FRAMES,
183 MT76_TM_STATE_TX_CONT,
184 MT76_TM_STATE_ON,
185
186 /* keep last */
187 NUM_MT76_TM_STATES,
188 MT76_TM_STATE_MAX = NUM_MT76_TM_STATES - 1,
189};
190
191/**
192 * enum mt76_testmode_tx_mode - packet tx phy mode
193 *
194 * @MT76_TM_TX_MODE_CCK: legacy CCK mode
195 * @MT76_TM_TX_MODE_OFDM: legacy OFDM mode
196 * @MT76_TM_TX_MODE_HT: 802.11n MCS
197 * @MT76_TM_TX_MODE_VHT: 802.11ac MCS
198 * @MT76_TM_TX_MODE_HE_SU: 802.11ax single-user MIMO
199 * @MT76_TM_TX_MODE_HE_EXT_SU: 802.11ax extended-range SU
200 * @MT76_TM_TX_MODE_HE_TB: 802.11ax trigger-based
201 * @MT76_TM_TX_MODE_HE_MU: 802.11ax multi-user MIMO
202 */
203enum mt76_testmode_tx_mode {
204 MT76_TM_TX_MODE_CCK,
205 MT76_TM_TX_MODE_OFDM,
206 MT76_TM_TX_MODE_HT,
207 MT76_TM_TX_MODE_VHT,
208 MT76_TM_TX_MODE_HE_SU,
209 MT76_TM_TX_MODE_HE_EXT_SU,
210 MT76_TM_TX_MODE_HE_TB,
211 MT76_TM_TX_MODE_HE_MU,
212
213 /* keep last */
214 NUM_MT76_TM_TX_MODES,
215 MT76_TM_TX_MODE_MAX = NUM_MT76_TM_TX_MODES - 1,
216};
217
218/**
219 * enum mt76_testmode_eeprom_action - eeprom setting actions
220 *
221 * @MT76_TM_EEPROM_ACTION_UPDATE_DATA: update rf values to specific
222 * eeprom data block
223 * @MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE: send updated eeprom data to fw
224 * @MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE: write eeprom data back to efuse
225 */
226enum mt76_testmode_eeprom_action {
227 MT76_TM_EEPROM_ACTION_UPDATE_DATA,
228 MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE,
229 MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE,
230
231 /* keep last */
232 NUM_MT76_TM_EEPROM_ACTION,
233 MT76_TM_EEPROM_ACTION_MAX = NUM_MT76_TM_EEPROM_ACTION - 1,
234};
235
236enum mt76_testmode_txbf_act {
237 MT76_TM_TXBF_ACT_INIT,
238 MT76_TM_TXBF_ACT_UPDATE_CH,
239 MT76_TM_TXBF_ACT_PHASE_COMP,
240 MT76_TM_TXBF_ACT_TX_PREP,
241 MT76_TM_TXBF_ACT_IBF_PROF_UPDATE,
242 MT76_TM_TXBF_ACT_EBF_PROF_UPDATE,
developerf9843e22022-09-13 10:57:15 +0800243 MT76_TM_TXBF_ACT_APPLY_TX,
developer3abe1ad2022-01-24 11:13:32 +0800244 MT76_TM_TXBF_ACT_PHASE_CAL,
245 MT76_TM_TXBF_ACT_PROF_UPDATE_ALL,
developerf9843e22022-09-13 10:57:15 +0800246 MT76_TM_TXBF_ACT_PROF_UPDATE_ALL_CMD,
developer5698c9c2022-05-30 16:40:23 +0800247 MT76_TM_TXBF_ACT_E2P_UPDATE,
developer3abe1ad2022-01-24 11:13:32 +0800248
249 /* keep last */
250 NUM_MT76_TM_TXBF_ACT,
251 MT76_TM_TXBF_ACT_MAX = NUM_MT76_TM_TXBF_ACT - 1,
252};
253
254#endif