cdp_txrx_mon_struct.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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. #ifdef QCA_SUPPORT_LITE_MONITOR
  27. #define CDP_LITE_MON_MODE_MAX 3
  28. #define CDP_LITE_MON_FRM_TYPE_MAX 3
  29. #define CDP_LITE_MON_PEER_MAX 16
  30. /* lite mon peer action */
  31. enum cdp_lite_mon_peer_action {
  32. CDP_LITE_MON_PEER_ADD = 0,
  33. CDP_LITE_MON_PEER_REMOVE = 1,
  34. };
  35. /* lite mon peer types */
  36. enum cdp_lite_mon_peer_type {
  37. CDP_LITE_MON_PEER_TYPE_ASSOCIATED = 0,
  38. CDP_LITE_MON_PEER_TYPE_NON_ASSOCIATED = 1,
  39. CDP_LITE_MON_PEER_TYPE_MAX = 2,
  40. };
  41. /* lite mon config direction */
  42. enum cdp_lite_mon_direction {
  43. CDP_LITE_MON_DIRECTION_RX = 1,
  44. CDP_LITE_MON_DIRECTION_TX = 2,
  45. };
  46. /* This should align with nac mac type enumerations in ieee80211_ioctl.h */
  47. #define CDP_LITE_MON_PEER_MAC_TYPE_CLIENT 2
  48. #endif
  49. /* XXX not really a mode; there are really multiple PHY's */
  50. enum cdp_mon_phymode {
  51. /* autoselect */
  52. CDP_IEEE80211_MODE_AUTO = 0,
  53. /* 5GHz, OFDM */
  54. CDP_IEEE80211_MODE_11A = 1,
  55. /* 2GHz, CCK */
  56. CDP_IEEE80211_MODE_11B = 2,
  57. /* 2GHz, OFDM */
  58. CDP_IEEE80211_MODE_11G = 3,
  59. /* 2GHz, GFSK */
  60. CDP_IEEE80211_MODE_FH = 4,
  61. /* 5GHz, OFDM, 2x clock dynamic turbo */
  62. CDP_IEEE80211_MODE_TURBO_A = 5,
  63. /* 2GHz, OFDM, 2x clock dynamic turbo */
  64. CDP_IEEE80211_MODE_TURBO_G = 6,
  65. /* 5Ghz, HT20 */
  66. CDP_IEEE80211_MODE_11NA_HT20 = 7,
  67. /* 2Ghz, HT20 */
  68. CDP_IEEE80211_MODE_11NG_HT20 = 8,
  69. /* 5Ghz, HT40 (ext ch +1) */
  70. CDP_IEEE80211_MODE_11NA_HT40PLUS = 9,
  71. /* 5Ghz, HT40 (ext ch -1) */
  72. CDP_IEEE80211_MODE_11NA_HT40MINUS = 10,
  73. /* 2Ghz, HT40 (ext ch +1) */
  74. CDP_IEEE80211_MODE_11NG_HT40PLUS = 11,
  75. /* 2Ghz, HT40 (ext ch -1) */
  76. CDP_IEEE80211_MODE_11NG_HT40MINUS = 12,
  77. /* 2Ghz, Auto HT40 */
  78. CDP_IEEE80211_MODE_11NG_HT40 = 13,
  79. /* 5Ghz, Auto HT40 */
  80. CDP_IEEE80211_MODE_11NA_HT40 = 14,
  81. /* 5Ghz, VHT20 */
  82. CDP_IEEE80211_MODE_11AC_VHT20 = 15,
  83. /* 5Ghz, VHT40 (Ext ch +1) */
  84. CDP_IEEE80211_MODE_11AC_VHT40PLUS = 16,
  85. /* 5Ghz VHT40 (Ext ch -1) */
  86. CDP_IEEE80211_MODE_11AC_VHT40MINUS = 17,
  87. /* 5Ghz, VHT40 */
  88. CDP_IEEE80211_MODE_11AC_VHT40 = 18,
  89. /* 5Ghz, VHT80 */
  90. CDP_IEEE80211_MODE_11AC_VHT80 = 19,
  91. /* 5Ghz, VHT160 */
  92. CDP_IEEE80211_MODE_11AC_VHT160 = 20,
  93. /* 5Ghz, VHT80_80 */
  94. CDP_IEEE80211_MODE_11AC_VHT80_80 = 21,
  95. };
  96. enum {
  97. CDP_PKT_TYPE_OFDM = 0,
  98. CDP_PKT_TYPE_CCK,
  99. CDP_PKT_TYPE_HT,
  100. CDP_PKT_TYPE_VHT,
  101. CDP_PKT_TYPE_HE,
  102. };
  103. enum {
  104. CDP_SGI_0_8_US = 0,
  105. CDP_SGI_0_4_US,
  106. CDP_SGI_1_6_US,
  107. CDP_SGI_3_2_US,
  108. };
  109. enum {
  110. CDP_RX_TYPE_SU = 0,
  111. CDP_RX_TYPE_MU_MIMO,
  112. CDP_RX_TYPE_MU_OFDMA,
  113. CDP_RX_TYPE_MU_OFDMA_MIMO,
  114. };
  115. /*
  116. *Band Width Types
  117. */
  118. enum CMN_BW_TYPES {
  119. CMN_BW_20MHZ,
  120. CMN_BW_40MHZ,
  121. CMN_BW_80MHZ,
  122. CMN_BW_160MHZ,
  123. CMN_BW_80_80MHZ,
  124. #ifdef WLAN_FEATURE_11BE
  125. CMN_BW_320MHZ,
  126. #endif
  127. CMN_BW_CNT,
  128. CMN_BW_IDLE = 0xFF, /*default BW state */
  129. };
  130. struct cdp_mon_status {
  131. /* bss color value 1-63 used for update on ppdu_desc bsscolor */
  132. uint8_t bsscolor;
  133. int rs_numchains;
  134. int rs_flags;
  135. #define IEEE80211_RX_FCS_ERROR 0x01
  136. #define IEEE80211_RX_MIC_ERROR 0x02
  137. #define IEEE80211_RX_DECRYPT_ERROR 0x04
  138. /* holes in flags here between, ATH_RX_XXXX to IEEE80211_RX_XXX */
  139. #define IEEE80211_RX_KEYMISS 0x200
  140. #define IEEE80211_RX_PN_ERROR 0x400
  141. int rs_rssi; /* RSSI (noise floor ajusted) */
  142. int rs_abs_rssi; /* absolute RSSI */
  143. int rs_datarate; /* data rate received */
  144. int rs_rateieee;
  145. int rs_ratephy1;
  146. int rs_ratephy2;
  147. int rs_ratephy3;
  148. /* Keep the same as ATH_MAX_ANTENNA */
  149. #define IEEE80211_MAX_ANTENNA 3
  150. /* RSSI (noise floor ajusted) */
  151. u_int8_t rs_rssictl[IEEE80211_MAX_ANTENNA];
  152. /* RSSI (noise floor ajusted) */
  153. u_int8_t rs_rssiextn[IEEE80211_MAX_ANTENNA];
  154. /* rs_rssi is valid or not */
  155. u_int8_t rs_isvalidrssi;
  156. enum cdp_mon_phymode rs_phymode;
  157. int rs_freq;
  158. union {
  159. u_int8_t data[8];
  160. u_int64_t tsf;
  161. } rs_tstamp;
  162. /*
  163. * Detail channel structure of recv frame.
  164. * It could be NULL if not available
  165. */
  166. #ifdef ATH_SUPPORT_AOW
  167. u_int16_t rs_rxseq; /* WLAN Sequence number */
  168. #endif
  169. #ifdef ATH_VOW_EXT_STATS
  170. /* Lower 16 bits holds the udp checksum offset in the data pkt */
  171. u_int32_t vow_extstats_offset;
  172. /* Higher 16 bits contains offset in the data pkt at which vow
  173. * ext stats are embedded
  174. */
  175. #endif
  176. u_int8_t rs_isaggr;
  177. u_int8_t rs_isapsd;
  178. int16_t rs_noisefloor;
  179. u_int16_t rs_channel;
  180. #ifdef ATH_SUPPORT_TxBF
  181. u_int32_t rs_rpttstamp; /* txbf report time stamp*/
  182. #endif
  183. /* The following counts are meant to assist in stats calculation.
  184. * These variables are incremented only in specific situations, and
  185. * should not be relied upon for any purpose other than the original
  186. * stats related purpose they have been introduced for.
  187. */
  188. u_int16_t rs_cryptodecapcount; /* Crypto bytes decapped/demic'ed. */
  189. u_int8_t rs_padspace; /* No. of padding bytes present after
  190. header in wbuf. */
  191. u_int8_t rs_qosdecapcount; /* QoS/HTC bytes decapped. */
  192. /* End of stats calculation related counts. */
  193. /*
  194. * uint8_t rs_lsig[IEEE80211_LSIG_LEN];
  195. * uint8_t rs_htsig[IEEE80211_HTSIG_LEN];
  196. * uint8_t rs_servicebytes[IEEE80211_SB_LEN];
  197. * uint8_t rs_fcs_error;
  198. */
  199. /* cdp convergence monitor mode status */
  200. union {
  201. u_int8_t cdp_data[8];
  202. u_int64_t cdp_tsf;
  203. } cdp_rs_tstamp;
  204. uint8_t cdp_rs_pream_type;
  205. uint32_t cdp_rs_user_rssi;
  206. uint8_t cdp_rs_stbc;
  207. uint8_t cdp_rs_sgi;
  208. uint32_t cdf_rs_rate_mcs;
  209. uint32_t cdp_rs_reception_type;
  210. uint32_t cdp_rs_bw;
  211. uint32_t cdp_rs_nss;
  212. uint8_t cdp_rs_fcs_err;
  213. bool cdp_rs_rxdma_err;
  214. };
  215. enum {
  216. CDP_MON_PPDU_START = 0,
  217. CDP_MON_PPDU_END,
  218. };
  219. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  220. /**
  221. * enum cdp_mon_phyrx_abort_reason_code: Phy err code to store the reason
  222. * why PHY generated an abort request.
  223. */
  224. enum cdp_mon_phyrx_abort_reason_code {
  225. CDP_PHYRX_ERR_PHY_OFF = 0,
  226. CDP_PHYRX_ERR_SYNTH_OFF,
  227. CDP_PHYRX_ERR_OFDMA_TIMING,
  228. CDP_PHYRX_ERR_OFDMA_SIGNAL_PARITY,
  229. CDP_PHYRX_ERR_OFDMA_RATE_ILLEGAL,
  230. CDP_PHYRX_ERR_OFDMA_LENGTH_ILLEGAL,
  231. CDP_PHYRX_ERR_OFDMA_RESTART,
  232. CDP_PHYRX_ERR_OFDMA_SERVICE,
  233. CDP_PHYRX_ERR_PPDU_OFDMA_POWER_DROP,
  234. CDP_PHYRX_ERR_CCK_BLOKKER,
  235. CDP_PHYRX_ERR_CCK_TIMING = 10,
  236. CDP_PHYRX_ERR_CCK_HEADER_CRC,
  237. CDP_PHYRX_ERR_CCK_RATE_ILLEGAL,
  238. CDP_PHYRX_ERR_CCK_LENGTH_ILLEGAL,
  239. CDP_PHYRX_ERR_CCK_RESTART,
  240. CDP_PHYRX_ERR_CCK_SERVICE,
  241. CDP_PHYRX_ERR_CCK_POWER_DROP,
  242. CDP_PHYRX_ERR_HT_CRC_ERR,
  243. CDP_PHYRX_ERR_HT_LENGTH_ILLEGAL,
  244. CDP_PHYRX_ERR_HT_RATE_ILLEGAL,
  245. CDP_PHYRX_ERR_HT_ZLF = 20,
  246. CDP_PHYRX_ERR_FALSE_RADAR_EXT,
  247. CDP_PHYRX_ERR_GREEN_FIELD,
  248. CDP_PHYRX_ERR_BW_GT_DYN_BW,
  249. CDP_PHYRX_ERR_HT_LSIG_RATE_MISMATCH,
  250. CDP_PHYRX_ERR_VHT_CRC_ERROR,
  251. CDP_PHYRX_ERR_VHT_SIGA_UNSUPPORTED,
  252. CDP_PHYRX_ERR_VHT_LSIG_LEN_INVALID,
  253. CDP_PHYRX_ERR_VHT_NDP_OR_ZLF,
  254. CDP_PHYRX_ERR_VHT_NSYM_LT_ZERO,
  255. CDP_PHYRX_ERR_VHT_RX_EXTRA_SYMBOL_MISMATCH = 30,
  256. CDP_PHYRX_ERR_VHT_RX_SKIP_GROUP_ID0,
  257. CDP_PHYRX_ERR_VHT_RX_SKIP_GROUP_ID1TO62,
  258. CDP_PHYRX_ERR_VHT_RX_SKIP_GROUP_ID63,
  259. CDP_PHYRX_ERR_OFDM_LDPC_DECODER_DISABLED,
  260. CDP_PHYRX_ERR_DEFER_NAP,
  261. CDP_PHYRX_ERR_FDOMAIN_TIMEOUT,
  262. CDP_PHYRX_ERR_LSIG_REL_CHECK,
  263. CDP_PHYRX_ERR_BT_COLLISION,
  264. CDP_PHYRX_ERR_UNSUPPORTED_MU_FEEDBACK,
  265. CDP_PHYRX_ERR_PPDU_TX_INTERRUPT_RX = 40,
  266. CDP_PHYRX_ERR_UNSUPPORTED_CBF,
  267. CDP_PHYRX_ERR_OTHER,
  268. CDP_PHYRX_ERR_HE_SIGA_UNSUPPORTED,
  269. CDP_PHYRX_ERR_HE_SIGA_CRC_ERROR,
  270. CDP_PHYRX_ERR_HE_SIGB_UNSUPPORTED,
  271. CDP_PHYRX_ERR_HE_SIGB_CRC_ERROR,
  272. CDP_PHYRX_ERR_HE_MU_MODE_UNSUPPORTED,
  273. CDP_PHYRX_ERR_HE_NDP_OR_ZLF,
  274. CDP_PHYRX_ERR_HE_NSYM_LT_ZERO,
  275. CDP_PHYRX_ERR_HE_RU_PARAMS_UNSUPPORTED = 50,
  276. CDP_PHYRX_ERR_HE_NUM_USERS_UNSUPPORTED,
  277. CDP_PHYRX_ERR_HE_SOUNDING_PARAMS_UNSUPPORTED,
  278. CDP_PHYRX_ERR_HE_EXT_SU_UNSUPPORTED,
  279. CDP_PHYRX_ERR_HE_TRIG_UNSUPPORTED,
  280. CDP_PHYRX_ERR_HE_LSIG_LEN_INVALID = 55,
  281. CDP_PHYRX_ERR_HE_LSIG_RATE_MISMATCH,
  282. CDP_PHYRX_ERR_OFDMA_SIGNAL_RELIABILITY,
  283. CDP_PHYRX_ERR_HT_NSYM_LT_ZERO,
  284. CDP_PHYRX_ERR_VHT_LSIG_RATE_MISMATCH,
  285. CDP_PHYRX_ERR_VHT_PAID_GID_MISMATCH = 60,
  286. CDP_PHYRX_ERR_VHT_UNSUPPORTED_BW,
  287. CDP_PHYRX_ERR_VHT_GI_DISAM_MISMATCH,
  288. CDP_PHYRX_ERR_RX_WDG_TIMEOUT = 63,
  289. CDP_PHYRX_ERR_MAX
  290. };
  291. #endif
  292. #define MAX_PPDU_ID_HIST 128
  293. /**
  294. * struct cdp_pdev_mon_stats
  295. * @status_ppdu_state: state on PPDU start and end
  296. * @status_ppdu_start: status ring PPDU start TLV count
  297. * @status_ppdu_end: status ring PPDU end TLV count
  298. * @status_ppdu_compl: status ring matching start and end count on PPDU
  299. * @status_ppdu_start_mis: status ring missing start TLV count on PPDU
  300. * @status_ppdu_end_mis: status ring missing end TLV count on PPDU
  301. * @status_ppdu_done: status ring PPDU done TLV count
  302. * @dest_ppdu_done: destination ring PPDU count
  303. * @dest_mpdu_done: destination ring MPDU count
  304. * @dup_mon_linkdesc_cnt: duplicate link descriptor indications from HW
  305. * @dup_mon_buf_cnt: duplicate buffer indications from HW
  306. * @tlv_tag_status_err: status not correct in the tlv tag
  307. * @status_buf_done_war: Number of status ring buffers for which DMA not done
  308. * WAR is applied.
  309. * @mon_rx_bufs_replenished_dest: Rx buffers replenish count
  310. * @mon_rx_bufs_reaped_dest: Rx buffer reap count
  311. * @ppdu_id_mismatch: counter to track ppdu id mismatch in
  312. * mointor status and monitor destination ring
  313. * @ppdu_id_match: counter to track ppdu id match in
  314. * mointor status and monitor destination ring
  315. * @status_ppdu_drop: Number of ppdu dropped from monitor status ring
  316. * @dest_ppdu_drop: Number of ppdu dropped from monitor destination ring
  317. * @mon_link_desc_invalid: msdu link desc invalid count
  318. * @mon_rx_desc_invalid: rx_desc invalid count
  319. * @rx_undecoded_count: Received undecoded frame count
  320. * @rx_undecoded_error: Rx undecoded errors
  321. */
  322. struct cdp_pdev_mon_stats {
  323. #ifndef REMOVE_MON_DBG_STATS
  324. uint32_t status_ppdu_state;
  325. uint32_t status_ppdu_start;
  326. uint32_t status_ppdu_end;
  327. uint32_t status_ppdu_compl;
  328. uint32_t status_ppdu_start_mis;
  329. uint32_t status_ppdu_end_mis;
  330. #endif
  331. uint32_t status_ppdu_done;
  332. uint32_t dest_ppdu_done;
  333. uint32_t dest_mpdu_done;
  334. uint32_t dest_mpdu_drop;
  335. uint32_t dup_mon_linkdesc_cnt;
  336. uint32_t dup_mon_buf_cnt;
  337. uint32_t stat_ring_ppdu_id_hist[MAX_PPDU_ID_HIST];
  338. uint32_t dest_ring_ppdu_id_hist[MAX_PPDU_ID_HIST];
  339. uint32_t ppdu_id_hist_idx;
  340. uint32_t mon_rx_dest_stuck;
  341. uint32_t tlv_tag_status_err;
  342. uint32_t status_buf_done_war;
  343. uint32_t mon_rx_bufs_replenished_dest;
  344. uint32_t mon_rx_bufs_reaped_dest;
  345. uint32_t ppdu_id_mismatch;
  346. uint32_t ppdu_id_match;
  347. uint32_t status_ppdu_drop;
  348. uint32_t dest_ppdu_drop;
  349. uint32_t mon_link_desc_invalid;
  350. uint32_t mon_rx_desc_invalid;
  351. uint32_t mon_nbuf_sanity_err;
  352. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  353. uint32_t rx_undecoded_count;
  354. uint32_t rx_undecoded_error[CDP_PHYRX_ERR_MAX];
  355. #endif
  356. };
  357. #ifdef QCA_SUPPORT_LITE_MONITOR
  358. /**
  359. * cdp_lite_mon_filter_config - lite mon set/get filter config
  360. * @direction: direction tx/rx
  361. * @disable: disables lite mon
  362. * @level: MSDU/MPDU/PPDU levels
  363. * @metadata: meta information to be added
  364. * @mgmt_filter: mgmt filter for modes fp,md,mo
  365. * @ctrl_filter: ctrl filter for modes fp,md,mo
  366. * @data_filter: data filter for modes fp,md,mo
  367. * @len: mgmt/ctrl/data frame lens
  368. * @debug: debug options
  369. * @vdev_id: output vdev id
  370. */
  371. struct cdp_lite_mon_filter_config {
  372. uint8_t direction;
  373. uint8_t disable;
  374. uint8_t level;
  375. uint8_t metadata;
  376. uint16_t mgmt_filter[CDP_LITE_MON_MODE_MAX];
  377. uint16_t ctrl_filter[CDP_LITE_MON_MODE_MAX];
  378. uint16_t data_filter[CDP_LITE_MON_MODE_MAX];
  379. uint16_t len[CDP_LITE_MON_FRM_TYPE_MAX];
  380. uint8_t debug;
  381. uint8_t vdev_id;
  382. };
  383. /**
  384. * cdp_lite_mon_peer_config - lite mon set peer config
  385. * @direction: direction tx/rx
  386. * @action: add/del
  387. * @type: assoc/non-assoc
  388. * @vdev_id: peer vdev id
  389. * @mac: peer mac
  390. */
  391. struct cdp_lite_mon_peer_config {
  392. uint8_t direction;
  393. uint8_t action;
  394. uint8_t type;
  395. uint8_t vdev_id;
  396. uint8_t mac[QDF_MAC_ADDR_SIZE];
  397. };
  398. /**
  399. * cdp_lite_mon_peer_info - lite mon get peer config
  400. * @direction: direction tx/rx
  401. * @type: assoc/non-assoc
  402. * @count: no of peers
  403. * @mac: peer macs
  404. */
  405. struct cdp_lite_mon_peer_info {
  406. uint8_t direction;
  407. uint8_t type;
  408. uint8_t count;
  409. uint8_t mac[CDP_LITE_MON_PEER_MAX][QDF_MAC_ADDR_SIZE];
  410. };
  411. #endif
  412. #endif