blob: 0f215789f22015bbd8cea6b481d772956cb5e615 [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,
developer5698c9c2022-05-30 16:40:23 +080081 MT76_TM_ATTR_AID,
82 MT76_TM_ATTR_RU_ALLOC,
83 MT76_TM_ATTR_RU_IDX,
developer3abe1ad2022-01-24 11:13:32 +080084
85 MT76_TM_ATTR_EEPROM_ACTION,
86 MT76_TM_ATTR_EEPROM_OFFSET,
87 MT76_TM_ATTR_EEPROM_VAL,
88
89 MT76_TM_ATTR_CFG,
developer5698c9c2022-05-30 16:40:23 +080090 MT76_TM_ATTR_TXBF_ACT,
91 MT76_TM_ATTR_TXBF_PARAM,
developer3abe1ad2022-01-24 11:13:32 +080092
93 MT76_TM_ATTR_OFF_CH_SCAN_CH,
94 MT76_TM_ATTR_OFF_CH_SCAN_CENTER_CH,
95 MT76_TM_ATTR_OFF_CH_SCAN_BW,
96 MT76_TM_ATTR_OFF_CH_SCAN_PATH,
97
developer3abe1ad2022-01-24 11:13:32 +080098 /* keep last */
99 NUM_MT76_TM_ATTRS,
100 MT76_TM_ATTR_MAX = NUM_MT76_TM_ATTRS - 1,
101};
102
103/**
104 * enum mt76_testmode_state - statistics attributes
105 *
106 * @MT76_TM_STATS_ATTR_TX_PENDING: pending tx frames (u32)
107 * @MT76_TM_STATS_ATTR_TX_QUEUED: queued tx frames (u32)
108 * @MT76_TM_STATS_ATTR_TX_QUEUED: completed tx frames (u32)
109 *
110 * @MT76_TM_STATS_ATTR_RX_PACKETS: number of rx packets (u64)
111 * @MT76_TM_STATS_ATTR_RX_FCS_ERROR: number of rx packets with FCS error (u64)
112 * @MT76_TM_STATS_ATTR_LAST_RX: information about the last received packet
113 * see &enum mt76_testmode_rx_attr
114 */
115enum mt76_testmode_stats_attr {
116 MT76_TM_STATS_ATTR_UNSPEC,
117 MT76_TM_STATS_ATTR_PAD,
118
119 MT76_TM_STATS_ATTR_TX_PENDING,
120 MT76_TM_STATS_ATTR_TX_QUEUED,
121 MT76_TM_STATS_ATTR_TX_DONE,
122
123 MT76_TM_STATS_ATTR_RX_PACKETS,
124 MT76_TM_STATS_ATTR_RX_FCS_ERROR,
125 MT76_TM_STATS_ATTR_LAST_RX,
126 MT76_TM_STATS_ATTR_RX_LEN_MISMATCH,
127
128 /* keep last */
129 NUM_MT76_TM_STATS_ATTRS,
130 MT76_TM_STATS_ATTR_MAX = NUM_MT76_TM_STATS_ATTRS - 1,
131};
132
133
134/**
135 * enum mt76_testmode_rx_attr - packet rx information
136 *
137 * @MT76_TM_RX_ATTR_FREQ_OFFSET: frequency offset (s32)
138 * @MT76_TM_RX_ATTR_RCPI: received channel power indicator (array, u8)
139 * @MT76_TM_RX_ATTR_IB_RSSI: internal inband RSSI (array, s8)
140 * @MT76_TM_RX_ATTR_WB_RSSI: internal wideband RSSI (array, s8)
141 * @MT76_TM_RX_ATTR_SNR: signal-to-noise ratio (u8)
142 */
143enum mt76_testmode_rx_attr {
144 MT76_TM_RX_ATTR_UNSPEC,
145
146 MT76_TM_RX_ATTR_FREQ_OFFSET,
147 MT76_TM_RX_ATTR_RCPI,
148 MT76_TM_RX_ATTR_IB_RSSI,
149 MT76_TM_RX_ATTR_WB_RSSI,
150 MT76_TM_RX_ATTR_SNR,
151
152 /* keep last */
153 NUM_MT76_TM_RX_ATTRS,
154 MT76_TM_RX_ATTR_MAX = NUM_MT76_TM_RX_ATTRS - 1,
155};
156
157/**
158 * enum mt76_testmode_state - phy test state
159 *
160 * @MT76_TM_STATE_OFF: test mode disabled (normal operation)
161 * @MT76_TM_STATE_IDLE: test mode enabled, but idle
162 * @MT76_TM_STATE_TX_FRAMES: send a fixed number of test frames
163 * @MT76_TM_STATE_RX_FRAMES: receive packets and keep statistics
164 * @MT76_TM_STATE_TX_CONT: waveform tx without time gap
165 * @MT76_TM_STATE_ON: test mode enabled used in offload firmware
166 */
167enum mt76_testmode_state {
168 MT76_TM_STATE_OFF,
169 MT76_TM_STATE_IDLE,
170 MT76_TM_STATE_TX_FRAMES,
171 MT76_TM_STATE_RX_FRAMES,
172 MT76_TM_STATE_TX_CONT,
173 MT76_TM_STATE_ON,
174
175 /* keep last */
176 NUM_MT76_TM_STATES,
177 MT76_TM_STATE_MAX = NUM_MT76_TM_STATES - 1,
178};
179
180/**
181 * enum mt76_testmode_tx_mode - packet tx phy mode
182 *
183 * @MT76_TM_TX_MODE_CCK: legacy CCK mode
184 * @MT76_TM_TX_MODE_OFDM: legacy OFDM mode
185 * @MT76_TM_TX_MODE_HT: 802.11n MCS
186 * @MT76_TM_TX_MODE_VHT: 802.11ac MCS
187 * @MT76_TM_TX_MODE_HE_SU: 802.11ax single-user MIMO
188 * @MT76_TM_TX_MODE_HE_EXT_SU: 802.11ax extended-range SU
189 * @MT76_TM_TX_MODE_HE_TB: 802.11ax trigger-based
190 * @MT76_TM_TX_MODE_HE_MU: 802.11ax multi-user MIMO
191 */
192enum mt76_testmode_tx_mode {
193 MT76_TM_TX_MODE_CCK,
194 MT76_TM_TX_MODE_OFDM,
195 MT76_TM_TX_MODE_HT,
196 MT76_TM_TX_MODE_VHT,
197 MT76_TM_TX_MODE_HE_SU,
198 MT76_TM_TX_MODE_HE_EXT_SU,
199 MT76_TM_TX_MODE_HE_TB,
200 MT76_TM_TX_MODE_HE_MU,
201
202 /* keep last */
203 NUM_MT76_TM_TX_MODES,
204 MT76_TM_TX_MODE_MAX = NUM_MT76_TM_TX_MODES - 1,
205};
206
207/**
208 * enum mt76_testmode_eeprom_action - eeprom setting actions
209 *
210 * @MT76_TM_EEPROM_ACTION_UPDATE_DATA: update rf values to specific
211 * eeprom data block
212 * @MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE: send updated eeprom data to fw
213 * @MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE: write eeprom data back to efuse
214 */
215enum mt76_testmode_eeprom_action {
216 MT76_TM_EEPROM_ACTION_UPDATE_DATA,
217 MT76_TM_EEPROM_ACTION_UPDATE_BUFFER_MODE,
218 MT76_TM_EEPROM_ACTION_WRITE_TO_EFUSE,
219
220 /* keep last */
221 NUM_MT76_TM_EEPROM_ACTION,
222 MT76_TM_EEPROM_ACTION_MAX = NUM_MT76_TM_EEPROM_ACTION - 1,
223};
224
225enum mt76_testmode_txbf_act {
226 MT76_TM_TXBF_ACT_INIT,
227 MT76_TM_TXBF_ACT_UPDATE_CH,
228 MT76_TM_TXBF_ACT_PHASE_COMP,
229 MT76_TM_TXBF_ACT_TX_PREP,
230 MT76_TM_TXBF_ACT_IBF_PROF_UPDATE,
231 MT76_TM_TXBF_ACT_EBF_PROF_UPDATE,
232 MT76_TM_TXBF_ACT_PHASE_CAL,
233 MT76_TM_TXBF_ACT_PROF_UPDATE_ALL,
developer5698c9c2022-05-30 16:40:23 +0800234 MT76_TM_TXBF_ACT_E2P_UPDATE,
developer3abe1ad2022-01-24 11:13:32 +0800235
236 /* keep last */
237 NUM_MT76_TM_TXBF_ACT,
238 MT76_TM_TXBF_ACT_MAX = NUM_MT76_TM_TXBF_ACT - 1,
239};
240
241#endif