cdp_txrx_mon_struct.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. /*
  2. * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * @file cdp_txrx_mon_struct.h
  20. * @brief Define the monitor mode API structure
  21. * shared by data path and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_MON_STRUCT_H_
  24. #define _CDP_TXRX_MON_STRUCT_H_
  25. /* XXX not really a mode; there are really multiple PHY's */
  26. enum cdp_mon_phymode {
  27. /* autoselect */
  28. CDP_IEEE80211_MODE_AUTO = 0,
  29. /* 5GHz, OFDM */
  30. CDP_IEEE80211_MODE_11A = 1,
  31. /* 2GHz, CCK */
  32. CDP_IEEE80211_MODE_11B = 2,
  33. /* 2GHz, OFDM */
  34. CDP_IEEE80211_MODE_11G = 3,
  35. /* 2GHz, GFSK */
  36. CDP_IEEE80211_MODE_FH = 4,
  37. /* 5GHz, OFDM, 2x clock dynamic turbo */
  38. CDP_IEEE80211_MODE_TURBO_A = 5,
  39. /* 2GHz, OFDM, 2x clock dynamic turbo */
  40. CDP_IEEE80211_MODE_TURBO_G = 6,
  41. /* 5Ghz, HT20 */
  42. CDP_IEEE80211_MODE_11NA_HT20 = 7,
  43. /* 2Ghz, HT20 */
  44. CDP_IEEE80211_MODE_11NG_HT20 = 8,
  45. /* 5Ghz, HT40 (ext ch +1) */
  46. CDP_IEEE80211_MODE_11NA_HT40PLUS = 9,
  47. /* 5Ghz, HT40 (ext ch -1) */
  48. CDP_IEEE80211_MODE_11NA_HT40MINUS = 10,
  49. /* 2Ghz, HT40 (ext ch +1) */
  50. CDP_IEEE80211_MODE_11NG_HT40PLUS = 11,
  51. /* 2Ghz, HT40 (ext ch -1) */
  52. CDP_IEEE80211_MODE_11NG_HT40MINUS = 12,
  53. /* 2Ghz, Auto HT40 */
  54. CDP_IEEE80211_MODE_11NG_HT40 = 13,
  55. /* 5Ghz, Auto HT40 */
  56. CDP_IEEE80211_MODE_11NA_HT40 = 14,
  57. /* 5Ghz, VHT20 */
  58. CDP_IEEE80211_MODE_11AC_VHT20 = 15,
  59. /* 5Ghz, VHT40 (Ext ch +1) */
  60. CDP_IEEE80211_MODE_11AC_VHT40PLUS = 16,
  61. /* 5Ghz VHT40 (Ext ch -1) */
  62. CDP_IEEE80211_MODE_11AC_VHT40MINUS = 17,
  63. /* 5Ghz, VHT40 */
  64. CDP_IEEE80211_MODE_11AC_VHT40 = 18,
  65. /* 5Ghz, VHT80 */
  66. CDP_IEEE80211_MODE_11AC_VHT80 = 19,
  67. /* 5Ghz, VHT160 */
  68. CDP_IEEE80211_MODE_11AC_VHT160 = 20,
  69. /* 5Ghz, VHT80_80 */
  70. CDP_IEEE80211_MODE_11AC_VHT80_80 = 21,
  71. };
  72. enum {
  73. CDP_PKT_TYPE_OFDM = 0,
  74. CDP_PKT_TYPE_CCK,
  75. CDP_PKT_TYPE_HT,
  76. CDP_PKT_TYPE_VHT,
  77. CDP_PKT_TYPE_HE,
  78. };
  79. enum {
  80. CDP_SGI_0_8_US = 0,
  81. CDP_SGI_0_4_US,
  82. CDP_SGI_1_6_US,
  83. CDP_SGI_3_2_US,
  84. };
  85. enum {
  86. CDP_RX_TYPE_SU = 0,
  87. CDP_RX_TYPE_MU_MIMO,
  88. CDP_RX_TYPE_MU_OFDMA,
  89. CDP_RX_TYPE_MU_OFDMA_MIMO,
  90. };
  91. enum {
  92. CDP_FULL_RX_BW_20 = 0,
  93. CDP_FULL_RX_BW_40,
  94. CDP_FULL_RX_BW_80,
  95. CDP_FULL_RX_BW_160,
  96. };
  97. struct cdp_mon_status {
  98. /* bss color value 1-63 used for update on ppdu_desc bsscolor */
  99. uint8_t bsscolor;
  100. int rs_numchains;
  101. int rs_flags;
  102. #define IEEE80211_RX_FCS_ERROR 0x01
  103. #define IEEE80211_RX_MIC_ERROR 0x02
  104. #define IEEE80211_RX_DECRYPT_ERROR 0x04
  105. /* holes in flags here between, ATH_RX_XXXX to IEEE80211_RX_XXX */
  106. #define IEEE80211_RX_KEYMISS 0x200
  107. int rs_rssi; /* RSSI (noise floor ajusted) */
  108. int rs_abs_rssi; /* absolute RSSI */
  109. int rs_datarate; /* data rate received */
  110. int rs_rateieee;
  111. int rs_ratephy1;
  112. int rs_ratephy2;
  113. int rs_ratephy3;
  114. /* Keep the same as ATH_MAX_ANTENNA */
  115. #define IEEE80211_MAX_ANTENNA 3
  116. /* RSSI (noise floor ajusted) */
  117. u_int8_t rs_rssictl[IEEE80211_MAX_ANTENNA];
  118. /* RSSI (noise floor ajusted) */
  119. u_int8_t rs_rssiextn[IEEE80211_MAX_ANTENNA];
  120. /* rs_rssi is valid or not */
  121. u_int8_t rs_isvalidrssi;
  122. enum cdp_mon_phymode rs_phymode;
  123. int rs_freq;
  124. union {
  125. u_int8_t data[8];
  126. u_int64_t tsf;
  127. } rs_tstamp;
  128. /*
  129. * Detail channel structure of recv frame.
  130. * It could be NULL if not available
  131. */
  132. #ifdef ATH_SUPPORT_AOW
  133. u_int16_t rs_rxseq; /* WLAN Sequence number */
  134. #endif
  135. #ifdef ATH_VOW_EXT_STATS
  136. /* Lower 16 bits holds the udp checksum offset in the data pkt */
  137. u_int32_t vow_extstats_offset;
  138. /* Higher 16 bits contains offset in the data pkt at which vow
  139. * ext stats are embedded
  140. */
  141. #endif
  142. u_int8_t rs_isaggr;
  143. u_int8_t rs_isapsd;
  144. int16_t rs_noisefloor;
  145. u_int16_t rs_channel;
  146. #ifdef ATH_SUPPORT_TxBF
  147. u_int32_t rs_rpttstamp; /* txbf report time stamp*/
  148. #endif
  149. /* The following counts are meant to assist in stats calculation.
  150. * These variables are incremented only in specific situations, and
  151. * should not be relied upon for any purpose other than the original
  152. * stats related purpose they have been introduced for.
  153. */
  154. u_int16_t rs_cryptodecapcount; /* Crypto bytes decapped/demic'ed. */
  155. u_int8_t rs_padspace; /* No. of padding bytes present after
  156. header in wbuf. */
  157. u_int8_t rs_qosdecapcount; /* QoS/HTC bytes decapped. */
  158. /* End of stats calculation related counts. */
  159. /*
  160. * uint8_t rs_lsig[IEEE80211_LSIG_LEN];
  161. * uint8_t rs_htsig[IEEE80211_HTSIG_LEN];
  162. * uint8_t rs_servicebytes[IEEE80211_SB_LEN];
  163. * uint8_t rs_fcs_error;
  164. */
  165. /* cdp convergence monitor mode status */
  166. union {
  167. u_int8_t cdp_data[8];
  168. u_int64_t cdp_tsf;
  169. } cdp_rs_tstamp;
  170. uint8_t cdp_rs_pream_type;
  171. uint32_t cdp_rs_user_rssi;
  172. uint8_t cdp_rs_stbc;
  173. uint8_t cdp_rs_sgi;
  174. uint32_t cdf_rs_rate_mcs;
  175. uint32_t cdp_rs_reception_type;
  176. uint32_t cdp_rs_bw;
  177. uint32_t cdp_rs_nss;
  178. uint8_t cdp_rs_fcs_err;
  179. bool cdp_rs_rxdma_err;
  180. };
  181. enum {
  182. CDP_MON_PPDU_START = 0,
  183. CDP_MON_PPDU_END,
  184. };
  185. #define MAX_PPDU_ID_HIST 128
  186. /**
  187. * struct cdp_pdev_mon_stats
  188. * @status_ppdu_state: state on PPDU start and end
  189. * @status_ppdu_start: status ring PPDU start TLV count
  190. * @status_ppdu_end: status ring PPDU end TLV count
  191. * @status_ppdu_compl: status ring matching start and end count on PPDU
  192. * @status_ppdu_start_mis: status ring missing start TLV count on PPDU
  193. * @status_ppdu_end_mis: status ring missing end TLV count on PPDU
  194. * @status_ppdu_done: status ring PPDU done TLV count
  195. * @dest_ppdu_done: destination ring PPDU count
  196. * @dest_mpdu_done: destination ring MPDU count
  197. * @dup_mon_linkdesc_cnt: duplicate link descriptor indications from HW
  198. * @dup_mon_buf_cnt: duplicate buffer indications from HW
  199. * @tlv_tag_status_err: status not correct in the tlv tag
  200. * @status_buf_done_war: Number of status ring buffers for which DMA not done
  201. * WAR is applied.
  202. * @mon_rx_bufs_replenished_dest: Rx buffers replenish count
  203. * @mon_rx_bufs_reaped_dest: Rx buffer reap count
  204. * @ppdu_id_mismatch: counter to track ppdu id mismatch in
  205. * mointor status and monitor destination ring
  206. * @ppdu_id_match: counter to track ppdu id match in
  207. * mointor status and monitor destination ring
  208. * @status_ppdu_drop: Number of ppdu dropped from monitor status ring
  209. * @dest_ppdu_drop: Number of ppdu dropped from monitor destination ring
  210. * @mon_link_desc_invalid: msdu link desc invalid count
  211. * @mon_rx_desc_invalid: rx_desc invalid count
  212. */
  213. struct cdp_pdev_mon_stats {
  214. #ifndef REMOVE_MON_DBG_STATS
  215. uint32_t status_ppdu_state;
  216. uint32_t status_ppdu_start;
  217. uint32_t status_ppdu_end;
  218. uint32_t status_ppdu_compl;
  219. uint32_t status_ppdu_start_mis;
  220. uint32_t status_ppdu_end_mis;
  221. #endif
  222. uint32_t status_ppdu_done;
  223. uint32_t dest_ppdu_done;
  224. uint32_t dest_mpdu_done;
  225. uint32_t dest_mpdu_drop;
  226. uint32_t dup_mon_linkdesc_cnt;
  227. uint32_t dup_mon_buf_cnt;
  228. uint32_t stat_ring_ppdu_id_hist[MAX_PPDU_ID_HIST];
  229. uint32_t dest_ring_ppdu_id_hist[MAX_PPDU_ID_HIST];
  230. uint32_t ppdu_id_hist_idx;
  231. uint32_t mon_rx_dest_stuck;
  232. uint32_t tlv_tag_status_err;
  233. uint32_t status_buf_done_war;
  234. uint32_t mon_rx_bufs_replenished_dest;
  235. uint32_t mon_rx_bufs_reaped_dest;
  236. uint32_t ppdu_id_mismatch;
  237. uint32_t ppdu_id_match;
  238. uint32_t status_ppdu_drop;
  239. uint32_t dest_ppdu_drop;
  240. uint32_t mon_link_desc_invalid;
  241. uint32_t mon_rx_desc_invalid;
  242. uint32_t mon_nbuf_sanity_err;
  243. };
  244. #endif