developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 1 | /* 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) |
developer | f90c9af | 2022-12-28 22:40:23 +0800 | [diff] [blame] | 17 | * @MT76_TM_ATTR_BAND_IDX: band idx of the chip (u8) |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 18 | * |
developer | 5083516 | 2023-09-19 13:29:11 +0800 | [diff] [blame] | 19 | * @MT76_TM_ATTR_SKU_EN: config txpower sku is enabled or disabled in testmode (u8) |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 20 | * @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) |
developer | 887da63 | 2022-10-28 09:35:38 +0800 | [diff] [blame] | 23 | * @MT76_TM_ATTR_TX_LENGTH: packet tx mpdu length (u32) |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 24 | * @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 | * |
developer | 071927d | 2022-08-31 20:39:29 +0800 | [diff] [blame] | 40 | * @MT76_TM_ATTR_PRECAL: Pre-cal data (u8) |
developer | 071927d | 2022-08-31 20:39:29 +0800 | [diff] [blame] | 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] |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 45 | * @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 | * |
developer | 887da63 | 2022-10-28 09:35:38 +0800 | [diff] [blame] | 51 | * @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 | * |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 81 | */ |
| 82 | enum 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, |
developer | f90c9af | 2022-12-28 22:40:23 +0800 | [diff] [blame] | 90 | MT76_TM_ATTR_BAND_IDX, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 91 | |
developer | 5083516 | 2023-09-19 13:29:11 +0800 | [diff] [blame] | 92 | MT76_TM_ATTR_SKU_EN, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 93 | 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, |
developer | 071927d | 2022-08-31 20:39:29 +0800 | [diff] [blame] | 110 | MT76_TM_ATTR_PRECAL, |
| 111 | MT76_TM_ATTR_PRECAL_INFO, |
| 112 | |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 113 | 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, |
developer | 5698c9c | 2022-05-30 16:40:23 +0800 | [diff] [blame] | 122 | MT76_TM_ATTR_AID, |
| 123 | MT76_TM_ATTR_RU_ALLOC, |
| 124 | MT76_TM_ATTR_RU_IDX, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 125 | |
| 126 | MT76_TM_ATTR_EEPROM_ACTION, |
| 127 | MT76_TM_ATTR_EEPROM_OFFSET, |
| 128 | MT76_TM_ATTR_EEPROM_VAL, |
| 129 | |
| 130 | MT76_TM_ATTR_CFG, |
developer | 5698c9c | 2022-05-30 16:40:23 +0800 | [diff] [blame] | 131 | MT76_TM_ATTR_TXBF_ACT, |
| 132 | MT76_TM_ATTR_TXBF_PARAM, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 133 | |
| 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 | |
developer | 887da63 | 2022-10-28 09:35:38 +0800 | [diff] [blame] | 139 | MT76_TM_ATTR_IPI_THRESHOLD, |
| 140 | MT76_TM_ATTR_IPI_PERIOD, |
| 141 | MT76_TM_ATTR_IPI_ANTENNA_INDEX, |
| 142 | |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 143 | /* 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 | */ |
| 160 | enum 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) |
developer | 5083516 | 2023-09-19 13:29:11 +0800 | [diff] [blame] | 184 | * @MT76_TM_RX_ATTR_RSSI: received signal strength indicator (array, s8) |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 185 | * @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 | */ |
| 189 | enum mt76_testmode_rx_attr { |
| 190 | MT76_TM_RX_ATTR_UNSPEC, |
| 191 | |
| 192 | MT76_TM_RX_ATTR_FREQ_OFFSET, |
| 193 | MT76_TM_RX_ATTR_RCPI, |
developer | 5083516 | 2023-09-19 13:29:11 +0800 | [diff] [blame] | 194 | MT76_TM_RX_ATTR_RSSI, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 195 | 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 | */ |
| 214 | enum 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 | */ |
| 239 | enum 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, |
developer | 7721564 | 2023-05-15 13:52:35 +0800 | [diff] [blame] | 248 | MT76_TM_TX_MODE_EHT_SU, |
| 249 | MT76_TM_TX_MODE_EHT_TRIG, |
| 250 | MT76_TM_TX_MODE_EHT_MU, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 251 | |
| 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 | */ |
| 265 | enum 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 | |
| 275 | enum mt76_testmode_txbf_act { |
developer | 1346ce5 | 2022-12-15 21:36:14 +0800 | [diff] [blame] | 276 | MT76_TM_TXBF_ACT_GOLDEN_INIT, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 277 | MT76_TM_TXBF_ACT_INIT, |
developer | 1346ce5 | 2022-12-15 21:36:14 +0800 | [diff] [blame] | 278 | MT76_TM_TX_EBF_ACT_GOLDEN_INIT, |
| 279 | MT76_TM_TX_EBF_ACT_INIT, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 280 | 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, |
developer | f9843e2 | 2022-09-13 10:57:15 +0800 | [diff] [blame] | 285 | MT76_TM_TXBF_ACT_APPLY_TX, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 286 | MT76_TM_TXBF_ACT_PHASE_CAL, |
| 287 | MT76_TM_TXBF_ACT_PROF_UPDATE_ALL, |
developer | f9843e2 | 2022-09-13 10:57:15 +0800 | [diff] [blame] | 288 | MT76_TM_TXBF_ACT_PROF_UPDATE_ALL_CMD, |
developer | 5698c9c | 2022-05-30 16:40:23 +0800 | [diff] [blame] | 289 | MT76_TM_TXBF_ACT_E2P_UPDATE, |
developer | 1346ce5 | 2022-12-15 21:36:14 +0800 | [diff] [blame] | 290 | 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, |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 296 | |
| 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 |