cdp_txrx_mon_struct.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. enum {
  93. CDP_FULL_RX_BW_20 = 0,
  94. CDP_FULL_RX_BW_40,
  95. CDP_FULL_RX_BW_80,
  96. CDP_FULL_RX_BW_160,
  97. };
  98. struct cdp_mon_status {
  99. /* bss color value 1-63 used for update on ppdu_desc bsscolor */
  100. uint8_t bsscolor;
  101. int rs_numchains;
  102. int rs_flags;
  103. #define IEEE80211_RX_FCS_ERROR 0x01
  104. #define IEEE80211_RX_MIC_ERROR 0x02
  105. #define IEEE80211_RX_DECRYPT_ERROR 0x04
  106. /* holes in flags here between, ATH_RX_XXXX to IEEE80211_RX_XXX */
  107. #define IEEE80211_RX_KEYMISS 0x200
  108. #define IEEE80211_RX_PN_ERROR 0x400
  109. int rs_rssi; /* RSSI (noise floor ajusted) */
  110. int rs_abs_rssi; /* absolute RSSI */
  111. int rs_datarate; /* data rate received */
  112. int rs_rateieee;
  113. int rs_ratephy1;
  114. int rs_ratephy2;
  115. int rs_ratephy3;
  116. /* Keep the same as ATH_MAX_ANTENNA */
  117. #define IEEE80211_MAX_ANTENNA 3
  118. /* RSSI (noise floor ajusted) */
  119. u_int8_t rs_rssictl[IEEE80211_MAX_ANTENNA];
  120. /* RSSI (noise floor ajusted) */
  121. u_int8_t rs_rssiextn[IEEE80211_MAX_ANTENNA];
  122. /* rs_rssi is valid or not */
  123. u_int8_t rs_isvalidrssi;
  124. enum cdp_mon_phymode rs_phymode;
  125. int rs_freq;
  126. union {
  127. u_int8_t data[8];
  128. u_int64_t tsf;
  129. } rs_tstamp;
  130. /*
  131. * Detail channel structure of recv frame.
  132. * It could be NULL if not available
  133. */
  134. #ifdef ATH_SUPPORT_AOW
  135. u_int16_t rs_rxseq; /* WLAN Sequence number */
  136. #endif
  137. #ifdef ATH_VOW_EXT_STATS
  138. /* Lower 16 bits holds the udp checksum offset in the data pkt */
  139. u_int32_t vow_extstats_offset;
  140. /* Higher 16 bits contains offset in the data pkt at which vow
  141. * ext stats are embedded
  142. */
  143. #endif
  144. u_int8_t rs_isaggr;
  145. u_int8_t rs_isapsd;
  146. int16_t rs_noisefloor;
  147. u_int16_t rs_channel;
  148. #ifdef ATH_SUPPORT_TxBF
  149. u_int32_t rs_rpttstamp; /* txbf report time stamp*/
  150. #endif
  151. /* The following counts are meant to assist in stats calculation.
  152. * These variables are incremented only in specific situations, and
  153. * should not be relied upon for any purpose other than the original
  154. * stats related purpose they have been introduced for.
  155. */
  156. u_int16_t rs_cryptodecapcount; /* Crypto bytes decapped/demic'ed. */
  157. u_int8_t rs_padspace; /* No. of padding bytes present after
  158. header in wbuf. */
  159. u_int8_t rs_qosdecapcount; /* QoS/HTC bytes decapped. */
  160. /* End of stats calculation related counts. */
  161. /*
  162. * uint8_t rs_lsig[IEEE80211_LSIG_LEN];
  163. * uint8_t rs_htsig[IEEE80211_HTSIG_LEN];
  164. * uint8_t rs_servicebytes[IEEE80211_SB_LEN];
  165. * uint8_t rs_fcs_error;
  166. */
  167. /* cdp convergence monitor mode status */
  168. union {
  169. u_int8_t cdp_data[8];
  170. u_int64_t cdp_tsf;
  171. } cdp_rs_tstamp;
  172. uint8_t cdp_rs_pream_type;
  173. uint32_t cdp_rs_user_rssi;
  174. uint8_t cdp_rs_stbc;
  175. uint8_t cdp_rs_sgi;
  176. uint32_t cdf_rs_rate_mcs;
  177. uint32_t cdp_rs_reception_type;
  178. uint32_t cdp_rs_bw;
  179. uint32_t cdp_rs_nss;
  180. uint8_t cdp_rs_fcs_err;
  181. bool cdp_rs_rxdma_err;
  182. };
  183. enum {
  184. CDP_MON_PPDU_START = 0,
  185. CDP_MON_PPDU_END,
  186. };
  187. #define MAX_PPDU_ID_HIST 128
  188. /**
  189. * struct cdp_pdev_mon_stats
  190. * @status_ppdu_state: state on PPDU start and end
  191. * @status_ppdu_start: status ring PPDU start TLV count
  192. * @status_ppdu_end: status ring PPDU end TLV count
  193. * @status_ppdu_compl: status ring matching start and end count on PPDU
  194. * @status_ppdu_start_mis: status ring missing start TLV count on PPDU
  195. * @status_ppdu_end_mis: status ring missing end TLV count on PPDU
  196. * @status_ppdu_done: status ring PPDU done TLV count
  197. * @dest_ppdu_done: destination ring PPDU count
  198. * @dest_mpdu_done: destination ring MPDU count
  199. * @dup_mon_linkdesc_cnt: duplicate link descriptor indications from HW
  200. * @dup_mon_buf_cnt: duplicate buffer indications from HW
  201. * @tlv_tag_status_err: status not correct in the tlv tag
  202. * @status_buf_done_war: Number of status ring buffers for which DMA not done
  203. * WAR is applied.
  204. * @mon_rx_bufs_replenished_dest: Rx buffers replenish count
  205. * @mon_rx_bufs_reaped_dest: Rx buffer reap count
  206. * @ppdu_id_mismatch: counter to track ppdu id mismatch in
  207. * mointor status and monitor destination ring
  208. * @ppdu_id_match: counter to track ppdu id match in
  209. * mointor status and monitor destination ring
  210. * @status_ppdu_drop: Number of ppdu dropped from monitor status ring
  211. * @dest_ppdu_drop: Number of ppdu dropped from monitor destination ring
  212. * @mon_link_desc_invalid: msdu link desc invalid count
  213. * @mon_rx_desc_invalid: rx_desc invalid count
  214. */
  215. struct cdp_pdev_mon_stats {
  216. #ifndef REMOVE_MON_DBG_STATS
  217. uint32_t status_ppdu_state;
  218. uint32_t status_ppdu_start;
  219. uint32_t status_ppdu_end;
  220. uint32_t status_ppdu_compl;
  221. uint32_t status_ppdu_start_mis;
  222. uint32_t status_ppdu_end_mis;
  223. #endif
  224. uint32_t status_ppdu_done;
  225. uint32_t dest_ppdu_done;
  226. uint32_t dest_mpdu_done;
  227. uint32_t dest_mpdu_drop;
  228. uint32_t dup_mon_linkdesc_cnt;
  229. uint32_t dup_mon_buf_cnt;
  230. uint32_t stat_ring_ppdu_id_hist[MAX_PPDU_ID_HIST];
  231. uint32_t dest_ring_ppdu_id_hist[MAX_PPDU_ID_HIST];
  232. uint32_t ppdu_id_hist_idx;
  233. uint32_t mon_rx_dest_stuck;
  234. uint32_t tlv_tag_status_err;
  235. uint32_t status_buf_done_war;
  236. uint32_t mon_rx_bufs_replenished_dest;
  237. uint32_t mon_rx_bufs_reaped_dest;
  238. uint32_t ppdu_id_mismatch;
  239. uint32_t ppdu_id_match;
  240. uint32_t status_ppdu_drop;
  241. uint32_t dest_ppdu_drop;
  242. uint32_t mon_link_desc_invalid;
  243. uint32_t mon_rx_desc_invalid;
  244. uint32_t mon_nbuf_sanity_err;
  245. };
  246. #endif