cdp_txrx_mon_struct.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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. enum cdp_punctured_modes {
  131. NO_PUNCTURE,
  132. #ifdef WLAN_FEATURE_11BE
  133. PUNCTURED_20MHZ,
  134. PUNCTURED_40MHZ,
  135. PUNCTURED_80MHZ,
  136. PUNCTURED_120MHZ,
  137. #endif
  138. PUNCTURED_MODE_CNT,
  139. };
  140. struct cdp_mon_status {
  141. /* bss color value 1-63 used for update on ppdu_desc bsscolor */
  142. uint8_t bsscolor;
  143. int rs_numchains;
  144. int rs_flags;
  145. #define IEEE80211_RX_FCS_ERROR 0x01
  146. #define IEEE80211_RX_MIC_ERROR 0x02
  147. #define IEEE80211_RX_DECRYPT_ERROR 0x04
  148. /* holes in flags here between, ATH_RX_XXXX to IEEE80211_RX_XXX */
  149. #define IEEE80211_RX_KEYMISS 0x200
  150. #define IEEE80211_RX_PN_ERROR 0x400
  151. int rs_rssi; /* RSSI (noise floor ajusted) */
  152. int rs_abs_rssi; /* absolute RSSI */
  153. int rs_datarate; /* data rate received */
  154. int rs_rateieee;
  155. int rs_ratephy1;
  156. int rs_ratephy2;
  157. int rs_ratephy3;
  158. /* Keep the same as ATH_MAX_ANTENNA */
  159. #define IEEE80211_MAX_ANTENNA 3
  160. /* RSSI (noise floor ajusted) */
  161. u_int8_t rs_rssictl[IEEE80211_MAX_ANTENNA];
  162. /* RSSI (noise floor ajusted) */
  163. u_int8_t rs_rssiextn[IEEE80211_MAX_ANTENNA];
  164. /* rs_rssi is valid or not */
  165. u_int8_t rs_isvalidrssi;
  166. enum cdp_mon_phymode rs_phymode;
  167. int rs_freq;
  168. union {
  169. u_int8_t data[8];
  170. u_int64_t tsf;
  171. } rs_tstamp;
  172. /*
  173. * Detail channel structure of recv frame.
  174. * It could be NULL if not available
  175. */
  176. #ifdef ATH_SUPPORT_AOW
  177. u_int16_t rs_rxseq; /* WLAN Sequence number */
  178. #endif
  179. #ifdef ATH_VOW_EXT_STATS
  180. /* Lower 16 bits holds the udp checksum offset in the data pkt */
  181. u_int32_t vow_extstats_offset;
  182. /* Higher 16 bits contains offset in the data pkt at which vow
  183. * ext stats are embedded
  184. */
  185. #endif
  186. u_int8_t rs_isaggr;
  187. u_int8_t rs_isapsd;
  188. int16_t rs_noisefloor;
  189. u_int16_t rs_channel;
  190. #ifdef ATH_SUPPORT_TxBF
  191. u_int32_t rs_rpttstamp; /* txbf report time stamp*/
  192. #endif
  193. /* The following counts are meant to assist in stats calculation.
  194. * These variables are incremented only in specific situations, and
  195. * should not be relied upon for any purpose other than the original
  196. * stats related purpose they have been introduced for.
  197. */
  198. u_int16_t rs_cryptodecapcount; /* Crypto bytes decapped/demic'ed. */
  199. u_int8_t rs_padspace; /* No. of padding bytes present after
  200. header in wbuf. */
  201. u_int8_t rs_qosdecapcount; /* QoS/HTC bytes decapped. */
  202. /* End of stats calculation related counts. */
  203. /*
  204. * uint8_t rs_lsig[IEEE80211_LSIG_LEN];
  205. * uint8_t rs_htsig[IEEE80211_HTSIG_LEN];
  206. * uint8_t rs_servicebytes[IEEE80211_SB_LEN];
  207. * uint8_t rs_fcs_error;
  208. */
  209. /* cdp convergence monitor mode status */
  210. union {
  211. u_int8_t cdp_data[8];
  212. u_int64_t cdp_tsf;
  213. } cdp_rs_tstamp;
  214. uint8_t cdp_rs_pream_type;
  215. uint32_t cdp_rs_user_rssi;
  216. uint8_t cdp_rs_stbc;
  217. uint8_t cdp_rs_sgi;
  218. uint32_t cdf_rs_rate_mcs;
  219. uint32_t cdp_rs_reception_type;
  220. uint32_t cdp_rs_bw;
  221. uint32_t cdp_rs_nss;
  222. uint8_t cdp_rs_fcs_err;
  223. bool cdp_rs_rxdma_err;
  224. };
  225. enum {
  226. CDP_MON_PPDU_START = 0,
  227. CDP_MON_PPDU_END,
  228. };
  229. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  230. /**
  231. * enum cdp_mon_phyrx_abort_reason_code: Phy err code to store the reason
  232. * why PHY generated an abort request.
  233. */
  234. enum cdp_mon_phyrx_abort_reason_code {
  235. CDP_PHYRX_ERR_PHY_OFF = 0,
  236. CDP_PHYRX_ERR_SYNTH_OFF,
  237. CDP_PHYRX_ERR_OFDMA_TIMING,
  238. CDP_PHYRX_ERR_OFDMA_SIGNAL_PARITY,
  239. CDP_PHYRX_ERR_OFDMA_RATE_ILLEGAL,
  240. CDP_PHYRX_ERR_OFDMA_LENGTH_ILLEGAL,
  241. CDP_PHYRX_ERR_OFDMA_RESTART,
  242. CDP_PHYRX_ERR_OFDMA_SERVICE,
  243. CDP_PHYRX_ERR_PPDU_OFDMA_POWER_DROP,
  244. CDP_PHYRX_ERR_CCK_BLOKKER,
  245. CDP_PHYRX_ERR_CCK_TIMING = 10,
  246. CDP_PHYRX_ERR_CCK_HEADER_CRC,
  247. CDP_PHYRX_ERR_CCK_RATE_ILLEGAL,
  248. CDP_PHYRX_ERR_CCK_LENGTH_ILLEGAL,
  249. CDP_PHYRX_ERR_CCK_RESTART,
  250. CDP_PHYRX_ERR_CCK_SERVICE,
  251. CDP_PHYRX_ERR_CCK_POWER_DROP,
  252. CDP_PHYRX_ERR_HT_CRC_ERR,
  253. CDP_PHYRX_ERR_HT_LENGTH_ILLEGAL,
  254. CDP_PHYRX_ERR_HT_RATE_ILLEGAL,
  255. CDP_PHYRX_ERR_HT_ZLF = 20,
  256. CDP_PHYRX_ERR_FALSE_RADAR_EXT,
  257. CDP_PHYRX_ERR_GREEN_FIELD,
  258. CDP_PHYRX_ERR_BW_GT_DYN_BW,
  259. CDP_PHYRX_ERR_HT_LSIG_RATE_MISMATCH,
  260. CDP_PHYRX_ERR_VHT_CRC_ERROR,
  261. CDP_PHYRX_ERR_VHT_SIGA_UNSUPPORTED,
  262. CDP_PHYRX_ERR_VHT_LSIG_LEN_INVALID,
  263. CDP_PHYRX_ERR_VHT_NDP_OR_ZLF,
  264. CDP_PHYRX_ERR_VHT_NSYM_LT_ZERO,
  265. CDP_PHYRX_ERR_VHT_RX_EXTRA_SYMBOL_MISMATCH = 30,
  266. CDP_PHYRX_ERR_VHT_RX_SKIP_GROUP_ID0,
  267. CDP_PHYRX_ERR_VHT_RX_SKIP_GROUP_ID1TO62,
  268. CDP_PHYRX_ERR_VHT_RX_SKIP_GROUP_ID63,
  269. CDP_PHYRX_ERR_OFDM_LDPC_DECODER_DISABLED,
  270. CDP_PHYRX_ERR_DEFER_NAP,
  271. CDP_PHYRX_ERR_FDOMAIN_TIMEOUT,
  272. CDP_PHYRX_ERR_LSIG_REL_CHECK,
  273. CDP_PHYRX_ERR_BT_COLLISION,
  274. CDP_PHYRX_ERR_UNSUPPORTED_MU_FEEDBACK,
  275. CDP_PHYRX_ERR_PPDU_TX_INTERRUPT_RX = 40,
  276. CDP_PHYRX_ERR_UNSUPPORTED_CBF,
  277. CDP_PHYRX_ERR_OTHER,
  278. CDP_PHYRX_ERR_HE_SIGA_UNSUPPORTED,
  279. CDP_PHYRX_ERR_HE_SIGA_CRC_ERROR,
  280. CDP_PHYRX_ERR_HE_SIGB_UNSUPPORTED,
  281. CDP_PHYRX_ERR_HE_SIGB_CRC_ERROR,
  282. CDP_PHYRX_ERR_HE_MU_MODE_UNSUPPORTED,
  283. CDP_PHYRX_ERR_HE_NDP_OR_ZLF,
  284. CDP_PHYRX_ERR_HE_NSYM_LT_ZERO,
  285. CDP_PHYRX_ERR_HE_RU_PARAMS_UNSUPPORTED = 50,
  286. CDP_PHYRX_ERR_HE_NUM_USERS_UNSUPPORTED,
  287. CDP_PHYRX_ERR_HE_SOUNDING_PARAMS_UNSUPPORTED,
  288. CDP_PHYRX_ERR_HE_EXT_SU_UNSUPPORTED,
  289. CDP_PHYRX_ERR_HE_TRIG_UNSUPPORTED,
  290. CDP_PHYRX_ERR_HE_LSIG_LEN_INVALID = 55,
  291. CDP_PHYRX_ERR_HE_LSIG_RATE_MISMATCH,
  292. CDP_PHYRX_ERR_OFDMA_SIGNAL_RELIABILITY,
  293. CDP_PHYRX_ERR_HT_NSYM_LT_ZERO,
  294. CDP_PHYRX_ERR_VHT_LSIG_RATE_MISMATCH,
  295. CDP_PHYRX_ERR_VHT_PAID_GID_MISMATCH = 60,
  296. CDP_PHYRX_ERR_VHT_UNSUPPORTED_BW,
  297. CDP_PHYRX_ERR_VHT_GI_DISAM_MISMATCH,
  298. CDP_PHYRX_ERR_RX_WDG_TIMEOUT = 63,
  299. CDP_PHYRX_ERR_MAX
  300. };
  301. #endif
  302. #define MAX_PPDU_ID_HIST 128
  303. /**
  304. * struct cdp_pdev_mon_stats
  305. * @status_ppdu_state: state on PPDU start and end
  306. * @status_ppdu_start: status ring PPDU start TLV count
  307. * @status_ppdu_end: status ring PPDU end TLV count
  308. * @status_ppdu_compl: status ring matching start and end count on PPDU
  309. * @status_ppdu_start_mis: status ring missing start TLV count on PPDU
  310. * @status_ppdu_end_mis: status ring missing end TLV count on PPDU
  311. * @status_ppdu_done: status ring PPDU done TLV count
  312. * @dest_ppdu_done: destination ring PPDU count
  313. * @dest_mpdu_done: destination ring MPDU count
  314. * @dup_mon_linkdesc_cnt: duplicate link descriptor indications from HW
  315. * @dup_mon_buf_cnt: duplicate buffer indications from HW
  316. * @tlv_tag_status_err: status not correct in the tlv tag
  317. * @status_buf_done_war: Number of status ring buffers for which DMA not done
  318. * WAR is applied.
  319. * @mon_rx_bufs_replenished_dest: Rx buffers replenish count
  320. * @mon_rx_bufs_reaped_dest: Rx buffer reap count
  321. * @ppdu_id_mismatch: counter to track ppdu id mismatch in
  322. * mointor status and monitor destination ring
  323. * @ppdu_id_match: counter to track ppdu id match in
  324. * mointor status and monitor destination ring
  325. * @status_ppdu_drop: Number of ppdu dropped from monitor status ring
  326. * @dest_ppdu_drop: Number of ppdu dropped from monitor destination ring
  327. * @mon_link_desc_invalid: msdu link desc invalid count
  328. * @mon_rx_desc_invalid: rx_desc invalid count
  329. * @rx_undecoded_count: Received undecoded frame count
  330. * @rx_undecoded_error: Rx undecoded errors
  331. */
  332. struct cdp_pdev_mon_stats {
  333. #ifndef REMOVE_MON_DBG_STATS
  334. uint32_t status_ppdu_state;
  335. uint32_t status_ppdu_start;
  336. uint32_t status_ppdu_end;
  337. uint32_t status_ppdu_compl;
  338. uint32_t status_ppdu_start_mis;
  339. uint32_t status_ppdu_end_mis;
  340. #endif
  341. uint32_t status_ppdu_done;
  342. uint32_t dest_ppdu_done;
  343. uint32_t dest_mpdu_done;
  344. uint32_t dest_mpdu_drop;
  345. uint32_t dup_mon_linkdesc_cnt;
  346. uint32_t dup_mon_buf_cnt;
  347. uint32_t stat_ring_ppdu_id_hist[MAX_PPDU_ID_HIST];
  348. uint32_t dest_ring_ppdu_id_hist[MAX_PPDU_ID_HIST];
  349. uint32_t ppdu_id_hist_idx;
  350. uint32_t mon_rx_dest_stuck;
  351. uint32_t tlv_tag_status_err;
  352. uint32_t status_buf_done_war;
  353. uint32_t mon_rx_bufs_replenished_dest;
  354. uint32_t mon_rx_bufs_reaped_dest;
  355. uint32_t ppdu_id_mismatch;
  356. uint32_t ppdu_id_match;
  357. uint32_t status_ppdu_drop;
  358. uint32_t dest_ppdu_drop;
  359. uint32_t mon_link_desc_invalid;
  360. uint32_t mon_rx_desc_invalid;
  361. uint32_t mon_nbuf_sanity_err;
  362. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  363. uint32_t rx_undecoded_count;
  364. uint32_t rx_undecoded_error[CDP_PHYRX_ERR_MAX];
  365. #endif
  366. };
  367. #ifdef QCA_SUPPORT_LITE_MONITOR
  368. /**
  369. * cdp_lite_mon_filter_config - lite mon set/get filter config
  370. * @direction: direction tx/rx
  371. * @disable: disables lite mon
  372. * @level: MSDU/MPDU/PPDU levels
  373. * @metadata: meta information to be added
  374. * @mgmt_filter: mgmt filter for modes fp,md,mo
  375. * @ctrl_filter: ctrl filter for modes fp,md,mo
  376. * @data_filter: data filter for modes fp,md,mo
  377. * @len: mgmt/ctrl/data frame lens
  378. * @debug: debug options
  379. * @vdev_id: output vdev id
  380. */
  381. struct cdp_lite_mon_filter_config {
  382. uint8_t direction;
  383. uint8_t disable;
  384. uint8_t level;
  385. uint8_t metadata;
  386. uint16_t mgmt_filter[CDP_LITE_MON_MODE_MAX];
  387. uint16_t ctrl_filter[CDP_LITE_MON_MODE_MAX];
  388. uint16_t data_filter[CDP_LITE_MON_MODE_MAX];
  389. uint16_t len[CDP_LITE_MON_FRM_TYPE_MAX];
  390. uint8_t debug;
  391. uint8_t vdev_id;
  392. };
  393. /**
  394. * cdp_lite_mon_peer_config - lite mon set peer config
  395. * @direction: direction tx/rx
  396. * @action: add/del
  397. * @type: assoc/non-assoc
  398. * @vdev_id: peer vdev id
  399. * @mac: peer mac
  400. */
  401. struct cdp_lite_mon_peer_config {
  402. uint8_t direction;
  403. uint8_t action;
  404. uint8_t type;
  405. uint8_t vdev_id;
  406. uint8_t mac[QDF_MAC_ADDR_SIZE];
  407. };
  408. /**
  409. * cdp_lite_mon_peer_info - lite mon get peer config
  410. * @direction: direction tx/rx
  411. * @type: assoc/non-assoc
  412. * @count: no of peers
  413. * @mac: peer macs
  414. */
  415. struct cdp_lite_mon_peer_info {
  416. uint8_t direction;
  417. uint8_t type;
  418. uint8_t count;
  419. uint8_t mac[CDP_LITE_MON_PEER_MAX][QDF_MAC_ADDR_SIZE];
  420. };
  421. #endif
  422. #endif