testmode.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /* SPDX-License-Identifier: ISC */
  2. /*
  3. * Copyright (C) 2020 Felix Fietkau <nbd@nbd.name>
  4. */
  5. #ifndef __MT76_TESTMODE_H
  6. #define __MT76_TESTMODE_H
  7. #define MT76_TM_TIMEOUT 10
  8. /**
  9. * enum mt76_testmode_attr - testmode attributes inside NL80211_ATTR_TESTDATA
  10. *
  11. * @MT76_TM_ATTR_UNSPEC: (invalid attribute)
  12. *
  13. * @MT76_TM_ATTR_RESET: reset parameters to default (flag)
  14. * @MT76_TM_ATTR_STATE: test state (u32), see &enum mt76_testmode_state
  15. *
  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)
  18. *
  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. *
  39. * @MT76_TM_ATTR_TX_SPE_IDX: tx spatial extension index (u8)
  40. *
  41. * @MT76_TM_ATTR_TX_DUTY_CYCLE: packet tx duty cycle (u8)
  42. * @MT76_TM_ATTR_TX_IPG: tx inter-packet gap, in unit of us (u32)
  43. * @MT76_TM_ATTR_TX_TIME: packet transmission time, in unit of us (u32)
  44. *
  45. */
  46. enum mt76_testmode_attr {
  47. MT76_TM_ATTR_UNSPEC,
  48. MT76_TM_ATTR_RESET,
  49. MT76_TM_ATTR_STATE,
  50. MT76_TM_ATTR_MTD_PART,
  51. MT76_TM_ATTR_MTD_OFFSET,
  52. MT76_TM_ATTR_TX_COUNT,
  53. MT76_TM_ATTR_TX_LENGTH,
  54. MT76_TM_ATTR_TX_RATE_MODE,
  55. MT76_TM_ATTR_TX_RATE_NSS,
  56. MT76_TM_ATTR_TX_RATE_IDX,
  57. MT76_TM_ATTR_TX_RATE_SGI,
  58. MT76_TM_ATTR_TX_RATE_LDPC,
  59. MT76_TM_ATTR_TX_RATE_STBC,
  60. MT76_TM_ATTR_TX_LTF,
  61. MT76_TM_ATTR_TX_ANTENNA,
  62. MT76_TM_ATTR_TX_POWER_CONTROL,
  63. MT76_TM_ATTR_TX_POWER,
  64. MT76_TM_ATTR_FREQ_OFFSET,
  65. MT76_TM_ATTR_STATS,
  66. MT76_TM_ATTR_TX_SPE_IDX,
  67. MT76_TM_ATTR_TX_DUTY_CYCLE,
  68. MT76_TM_ATTR_TX_IPG,
  69. MT76_TM_ATTR_TX_TIME,
  70. /* keep last */
  71. NUM_MT76_TM_ATTRS,
  72. MT76_TM_ATTR_MAX = NUM_MT76_TM_ATTRS - 1,
  73. };
  74. /**
  75. * enum mt76_testmode_state - statistics attributes
  76. *
  77. * @MT76_TM_STATS_ATTR_TX_PENDING: pending tx frames (u32)
  78. * @MT76_TM_STATS_ATTR_TX_QUEUED: queued tx frames (u32)
  79. * @MT76_TM_STATS_ATTR_TX_QUEUED: completed tx frames (u32)
  80. *
  81. * @MT76_TM_STATS_ATTR_RX_PACKETS: number of rx packets (u64)
  82. * @MT76_TM_STATS_ATTR_RX_FCS_ERROR: number of rx packets with FCS error (u64)
  83. * @MT76_TM_STATS_ATTR_LAST_RX: information about the last received packet
  84. * see &enum mt76_testmode_rx_attr
  85. */
  86. enum mt76_testmode_stats_attr {
  87. MT76_TM_STATS_ATTR_UNSPEC,
  88. MT76_TM_STATS_ATTR_PAD,
  89. MT76_TM_STATS_ATTR_TX_PENDING,
  90. MT76_TM_STATS_ATTR_TX_QUEUED,
  91. MT76_TM_STATS_ATTR_TX_DONE,
  92. MT76_TM_STATS_ATTR_RX_PACKETS,
  93. MT76_TM_STATS_ATTR_RX_FCS_ERROR,
  94. MT76_TM_STATS_ATTR_LAST_RX,
  95. /* keep last */
  96. NUM_MT76_TM_STATS_ATTRS,
  97. MT76_TM_STATS_ATTR_MAX = NUM_MT76_TM_STATS_ATTRS - 1,
  98. };
  99. /**
  100. * enum mt76_testmode_rx_attr - packet rx information
  101. *
  102. * @MT76_TM_RX_ATTR_FREQ_OFFSET: frequency offset (s32)
  103. * @MT76_TM_RX_ATTR_RCPI: received channel power indicator (array, u8)
  104. * @MT76_TM_RX_ATTR_IB_RSSI: internal inband RSSI (array, s8)
  105. * @MT76_TM_RX_ATTR_WB_RSSI: internal wideband RSSI (array, s8)
  106. * @MT76_TM_RX_ATTR_SNR: signal-to-noise ratio (u8)
  107. */
  108. enum mt76_testmode_rx_attr {
  109. MT76_TM_RX_ATTR_UNSPEC,
  110. MT76_TM_RX_ATTR_FREQ_OFFSET,
  111. MT76_TM_RX_ATTR_RCPI,
  112. MT76_TM_RX_ATTR_IB_RSSI,
  113. MT76_TM_RX_ATTR_WB_RSSI,
  114. MT76_TM_RX_ATTR_SNR,
  115. /* keep last */
  116. NUM_MT76_TM_RX_ATTRS,
  117. MT76_TM_RX_ATTR_MAX = NUM_MT76_TM_RX_ATTRS - 1,
  118. };
  119. /**
  120. * enum mt76_testmode_state - phy test state
  121. *
  122. * @MT76_TM_STATE_OFF: test mode disabled (normal operation)
  123. * @MT76_TM_STATE_IDLE: test mode enabled, but idle
  124. * @MT76_TM_STATE_TX_FRAMES: send a fixed number of test frames
  125. * @MT76_TM_STATE_RX_FRAMES: receive packets and keep statistics
  126. * @MT76_TM_STATE_TX_CONT: waveform tx without time gap
  127. */
  128. enum mt76_testmode_state {
  129. MT76_TM_STATE_OFF,
  130. MT76_TM_STATE_IDLE,
  131. MT76_TM_STATE_TX_FRAMES,
  132. MT76_TM_STATE_RX_FRAMES,
  133. MT76_TM_STATE_TX_CONT,
  134. /* keep last */
  135. NUM_MT76_TM_STATES,
  136. MT76_TM_STATE_MAX = NUM_MT76_TM_STATES - 1,
  137. };
  138. /**
  139. * enum mt76_testmode_tx_mode - packet tx phy mode
  140. *
  141. * @MT76_TM_TX_MODE_CCK: legacy CCK mode
  142. * @MT76_TM_TX_MODE_OFDM: legacy OFDM mode
  143. * @MT76_TM_TX_MODE_HT: 802.11n MCS
  144. * @MT76_TM_TX_MODE_VHT: 802.11ac MCS
  145. * @MT76_TM_TX_MODE_HE_SU: 802.11ax single-user MIMO
  146. * @MT76_TM_TX_MODE_HE_EXT_SU: 802.11ax extended-range SU
  147. * @MT76_TM_TX_MODE_HE_TB: 802.11ax trigger-based
  148. * @MT76_TM_TX_MODE_HE_MU: 802.11ax multi-user MIMO
  149. */
  150. enum mt76_testmode_tx_mode {
  151. MT76_TM_TX_MODE_CCK,
  152. MT76_TM_TX_MODE_OFDM,
  153. MT76_TM_TX_MODE_HT,
  154. MT76_TM_TX_MODE_VHT,
  155. MT76_TM_TX_MODE_HE_SU,
  156. MT76_TM_TX_MODE_HE_EXT_SU,
  157. MT76_TM_TX_MODE_HE_TB,
  158. MT76_TM_TX_MODE_HE_MU,
  159. /* keep last */
  160. NUM_MT76_TM_TX_MODES,
  161. MT76_TM_TX_MODE_MAX = NUM_MT76_TM_TX_MODES - 1,
  162. };
  163. #endif