cdp_txrx_mon_struct.h 8.0 KB

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