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