1 /* SPDX-License-Identifier: ISC */
3 * Copyright (C) 2020 Felix Fietkau <nbd@nbd.name>
5 #ifndef __MT76_TESTMODE_H
6 #define __MT76_TESTMODE_H
9 * enum mt76_testmode_attr - testmode attributes inside NL80211_ATTR_TESTDATA
11 * @MT76_TM_ATTR_UNSPEC: (invalid attribute)
13 * @MT76_TM_ATTR_RESET: reset parameters to default (flag)
14 * @MT76_TM_ATTR_STATE: test state (u32), see &enum mt76_testmode_state
16 * @MT76_TM_ATTR_MTD_PART: mtd partition used for eeprom data (string)
17 * @MT76_TM_ATTR_MTD_OFFSET: offset of eeprom data within the partition (u32)
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)
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)
35 * @MT76_TM_ATTR_FREQ_OFFSET: RF frequency offset (u32)
37 * @MT76_TM_ATTR_STATS: statistics (nested, see &enum mt76_testmode_stats_attr)
39 enum mt76_testmode_attr
{
45 MT76_TM_ATTR_MTD_PART
,
46 MT76_TM_ATTR_MTD_OFFSET
,
48 MT76_TM_ATTR_TX_COUNT
,
49 MT76_TM_ATTR_TX_LENGTH
,
50 MT76_TM_ATTR_TX_RATE_MODE
,
51 MT76_TM_ATTR_TX_RATE_NSS
,
52 MT76_TM_ATTR_TX_RATE_IDX
,
53 MT76_TM_ATTR_TX_RATE_SGI
,
54 MT76_TM_ATTR_TX_RATE_LDPC
,
55 MT76_TM_ATTR_TX_RATE_STBC
,
58 MT76_TM_ATTR_TX_ANTENNA
,
59 MT76_TM_ATTR_TX_POWER_CONTROL
,
60 MT76_TM_ATTR_TX_POWER
,
62 MT76_TM_ATTR_FREQ_OFFSET
,
68 MT76_TM_ATTR_MAX
= NUM_MT76_TM_ATTRS
- 1,
72 * enum mt76_testmode_state - statistics attributes
74 * @MT76_TM_STATS_ATTR_TX_PENDING: pending tx frames (u32)
75 * @MT76_TM_STATS_ATTR_TX_QUEUED: queued tx frames (u32)
76 * @MT76_TM_STATS_ATTR_TX_QUEUED: completed tx frames (u32)
78 * @MT76_TM_STATS_ATTR_RX_PACKETS: number of rx packets (u64)
79 * @MT76_TM_STATS_ATTR_RX_FCS_ERROR: number of rx packets with FCS error (u64)
80 * @MT76_TM_STATS_ATTR_LAST_RX: information about the last received packet
81 * see &enum mt76_testmode_rx_attr
83 enum mt76_testmode_stats_attr
{
84 MT76_TM_STATS_ATTR_UNSPEC
,
85 MT76_TM_STATS_ATTR_PAD
,
87 MT76_TM_STATS_ATTR_TX_PENDING
,
88 MT76_TM_STATS_ATTR_TX_QUEUED
,
89 MT76_TM_STATS_ATTR_TX_DONE
,
91 MT76_TM_STATS_ATTR_RX_PACKETS
,
92 MT76_TM_STATS_ATTR_RX_FCS_ERROR
,
93 MT76_TM_STATS_ATTR_LAST_RX
,
96 NUM_MT76_TM_STATS_ATTRS
,
97 MT76_TM_STATS_ATTR_MAX
= NUM_MT76_TM_STATS_ATTRS
- 1,
102 * enum mt76_testmode_rx_attr - packet rx information
104 * @MT76_TM_RX_ATTR_FREQ_OFFSET: frequency offset (s32)
105 * @MT76_TM_RX_ATTR_RCPI: received channel power indicator (array, u8)
106 * @MT76_TM_RX_ATTR_IB_RSSI: internal inband RSSI (array, s8)
107 * @MT76_TM_RX_ATTR_WB_RSSI: internal wideband RSSI (array, s8)
108 * @MT76_TM_RX_ATTR_SNR: signal-to-noise ratio (u8)
110 enum mt76_testmode_rx_attr
{
111 MT76_TM_RX_ATTR_UNSPEC
,
113 MT76_TM_RX_ATTR_FREQ_OFFSET
,
114 MT76_TM_RX_ATTR_RCPI
,
115 MT76_TM_RX_ATTR_IB_RSSI
,
116 MT76_TM_RX_ATTR_WB_RSSI
,
120 NUM_MT76_TM_RX_ATTRS
,
121 MT76_TM_RX_ATTR_MAX
= NUM_MT76_TM_RX_ATTRS
- 1,
125 * enum mt76_testmode_state - phy test state
127 * @MT76_TM_STATE_OFF: test mode disabled (normal operation)
128 * @MT76_TM_STATE_IDLE: test mode enabled, but idle
129 * @MT76_TM_STATE_TX_FRAMES: send a fixed number of test frames
130 * @MT76_TM_STATE_RX_FRAMES: receive packets and keep statistics
132 enum mt76_testmode_state
{
135 MT76_TM_STATE_TX_FRAMES
,
136 MT76_TM_STATE_RX_FRAMES
,
140 MT76_TM_STATE_MAX
= NUM_MT76_TM_STATES
- 1,
144 * enum mt76_testmode_tx_mode - packet tx phy mode
146 * @MT76_TM_TX_MODE_CCK: legacy CCK mode
147 * @MT76_TM_TX_MODE_OFDM: legacy OFDM mode
148 * @MT76_TM_TX_MODE_HT: 802.11n MCS
149 * @MT76_TM_TX_MODE_VHT: 802.11ac MCS
150 * @MT76_TM_TX_MODE_HE_SU: 802.11ax single-user MIMO
151 * @MT76_TM_TX_MODE_HE_EXT_SU: 802.11ax extended-range SU
152 * @MT76_TM_TX_MODE_HE_TB: 802.11ax trigger-based
153 * @MT76_TM_TX_MODE_HE_MU: 802.11ax multi-user MIMO
155 enum mt76_testmode_tx_mode
{
157 MT76_TM_TX_MODE_OFDM
,
160 MT76_TM_TX_MODE_HE_SU
,
161 MT76_TM_TX_MODE_HE_EXT_SU
,
162 MT76_TM_TX_MODE_HE_TB
,
163 MT76_TM_TX_MODE_HE_MU
,
166 NUM_MT76_TM_TX_MODES
,
167 MT76_TM_TX_MODE_MAX
= NUM_MT76_TM_TX_MODES
- 1,