cdp_txrx_stats_struct.h 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. /*
  2. * Copyright (c) 2016-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_stats_struct.h
  20. * @brief Define the host data path stats API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_STATS_STRUCT_H_
  24. #define _CDP_TXRX_STATS_STRUCT_H_
  25. #include <qdf_types.h>
  26. #include <cdp_txrx_hist_struct.h>
  27. #define TXRX_STATS_LEVEL_OFF 0
  28. #define TXRX_STATS_LEVEL_BASIC 1
  29. #define TXRX_STATS_LEVEL_FULL 2
  30. #define BSS_CHAN_INFO_READ 1
  31. #define BSS_CHAN_INFO_READ_AND_CLEAR 2
  32. #define TX_FRAME_TYPE_DATA 0
  33. #define TX_FRAME_TYPE_MGMT 1
  34. #define TX_FRAME_TYPE_BEACON 2
  35. #ifndef TXRX_STATS_LEVEL
  36. #define TXRX_STATS_LEVEL TXRX_STATS_LEVEL_BASIC
  37. #endif
  38. /* 1 additional MCS is for invalid values */
  39. #define MAX_MCS (12 + 1)
  40. #define MAX_MCS_11A 8
  41. #define MAX_MCS_11B 7
  42. #define MAX_MCS_11AC 12
  43. /* 1 additional GI is for invalid values */
  44. #define MAX_GI (4 + 1)
  45. #define SS_COUNT 8
  46. #define MAX_BW 7
  47. #define MAX_RECEPTION_TYPES 4
  48. #define MAX_TRANSMIT_TYPES 9
  49. #define MAX_USER_POS 8
  50. #define MAX_MU_GROUP_ID 64
  51. #define MAX_RU_LOCATIONS 6
  52. #define RU_26 1
  53. #define RU_52 2
  54. #define RU_106 4
  55. #define RU_242 9
  56. #define RU_484 18
  57. #define RU_996 37
  58. /* WME stream classes */
  59. #define WME_AC_BE 0 /* best effort */
  60. #define WME_AC_BK 1 /* background */
  61. #define WME_AC_VI 2 /* video */
  62. #define WME_AC_VO 3 /* voice */
  63. #define WME_AC_MAX 4 /* MAX AC Value */
  64. #define CDP_MAX_RX_RINGS 4 /* max rx rings */
  65. #define CDP_MAX_TX_COMP_RINGS 3 /* max tx completion rings */
  66. #define CDP_MAX_TX_TQM_STATUS 9 /* max tx tqm completion status */
  67. #define CDP_MAX_TX_HTT_STATUS 7 /* max tx htt completion status */
  68. /*
  69. * Max of TxRx context
  70. */
  71. #define CDP_MAX_TXRX_CTX CDP_MAX_RX_RINGS
  72. /* TID level VoW stats macros
  73. * to add and get stats
  74. */
  75. #define PFLOW_TXRX_TIDQ_STATS_ADD(_peer, _tid, _var, _val) \
  76. (((_peer)->tidq_stats[_tid]).stats[_var]) += _val
  77. #define PFLOW_TXRX_TIDQ_STATS_GET(_peer, _tid, _var, _val) \
  78. ((_peer)->tidq_stats[_tid].stats[_var])
  79. /*
  80. * Video only stats
  81. */
  82. #define PFLOW_CTRL_PDEV_VIDEO_STATS_SET(_pdev, _var, _val) \
  83. (((_pdev)->vow.vistats[_var]).value) = _val
  84. #define PFLOW_CTRL_PDEV_VIDEO_STATS_GET(_pdev, _var) \
  85. ((_pdev)->vow.vistats[_var].value)
  86. #define PFLOW_CTRL_PDEV_VIDEO_STATS_ADD(_pdev, _var, _val) \
  87. (((_pdev)->vow.vistats[_var]).value) += _val
  88. /*
  89. * video delay stats
  90. */
  91. #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_SET(_pdev, _var, _val) \
  92. (((_pdev)->vow.delaystats[_var]).value) = _val
  93. #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_GET(_pdev, _var) \
  94. ((_pdev)->vow.delaystats[_var].value)
  95. #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_ADD(_pdev, _var, _val) \
  96. (((_pdev)->vow.delaystats[_var]).value) += _val
  97. /*
  98. * Number of TLVs sent by FW. Needs to reflect
  99. * HTT_PPDU_STATS_MAX_TAG declared in FW
  100. */
  101. #define CDP_PPDU_STATS_MAX_TAG 14
  102. #define CDP_MAX_DATA_TIDS 9
  103. #define CDP_WDI_NUM_EVENTS WDI_NUM_EVENTS
  104. #define CDP_FCTL_RETRY 0x0800
  105. #define CDP_FC_IS_RETRY_SET(_fc) \
  106. ((_fc) & qdf_cpu_to_le16(CDP_FCTL_RETRY))
  107. #define INVALID_RSSI 255
  108. #define CDP_RSSI_MULTIPLIER BIT(8)
  109. #define CDP_RSSI_MUL(x, mul) ((x) * (mul))
  110. #define CDP_RSSI_RND(x, mul) ((((x) % (mul)) >= ((mul) / 2)) ?\
  111. ((x) + ((mul) - 1)) / (mul) : (x) / (mul))
  112. #define CDP_RSSI_OUT(x) (CDP_RSSI_RND((x), CDP_RSSI_MULTIPLIER))
  113. #define CDP_RSSI_IN(x) (CDP_RSSI_MUL((x), CDP_RSSI_MULTIPLIER))
  114. #define CDP_RSSI_AVG(x, y) ((((x) << 2) + (y) - (x)) >> 2)
  115. #define CDP_RSSI_UPDATE_AVG(x, y) x = CDP_RSSI_AVG((x), CDP_RSSI_IN((y)))
  116. /*Max SU EVM count */
  117. #define DP_RX_MAX_SU_EVM_COUNT 32
  118. #define WDI_EVENT_BASE 0x100
  119. #define CDP_TXRX_RATECODE_MCS_MASK 0xF
  120. #define CDP_TXRX_RATECODE_NSS_MASK 0x3
  121. #define CDP_TXRX_RATECODE_NSS_LSB 4
  122. #define CDP_TXRX_RATECODE_PREM_MASK 0x3
  123. #define CDP_TXRX_RATECODE_PREM_LSB 6
  124. /* Below BW_GAIN should be added to the SNR value of every ppdu based on the
  125. * bandwidth. This table is obtained from HALPHY.
  126. * BW BW_Gain
  127. * 20 0
  128. * 40 3dBm
  129. * 80 6dBm
  130. * 160/80P80 9dBm
  131. */
  132. #define PKT_BW_GAIN_20MHZ 0
  133. #define PKT_BW_GAIN_40MHZ 3
  134. #define PKT_BW_GAIN_80MHZ 6
  135. #define PKT_BW_GAIN_160MHZ 9
  136. /*
  137. * cdp_tx_transmit_type: Transmit type index
  138. * SU: SU Transmit type index
  139. * MU_MIMO: MU_MIMO Transmit type index
  140. * MU_OFDMA: MU_OFDMA Transmit type index
  141. * MU_MIMO_OFDMA: MU MIMO OFDMA Transmit type index
  142. */
  143. enum cdp_tx_transmit_type {
  144. SU = 0,
  145. MU_MIMO,
  146. MU_OFDMA,
  147. MU_MIMO_OFDMA,
  148. };
  149. /*
  150. * cdp_ru_index: Different RU index
  151. *
  152. * RU_26_INDEX : 26-tone Resource Unit index
  153. * RU_52_INDEX : 52-tone Resource Unit index
  154. * RU_106_INDEX: 106-tone Resource Unit index
  155. * RU_242_INDEX: 242-tone Resource Unit index
  156. * RU_484_INDEX: 484-tone Resource Unit index
  157. * RU_996_INDEX: 996-tone Resource Unit index
  158. */
  159. enum cdp_ru_index {
  160. RU_26_INDEX = 0,
  161. RU_52_INDEX,
  162. RU_106_INDEX,
  163. RU_242_INDEX,
  164. RU_484_INDEX,
  165. RU_996_INDEX,
  166. };
  167. #ifdef FEATURE_TSO_STATS
  168. /* Number of TSO Packet Statistics captured */
  169. #define CDP_MAX_TSO_PACKETS 5
  170. /* Information for Number of Segments for a TSO Packet captured */
  171. #define CDP_MAX_TSO_SEGMENTS 2
  172. /* Information for Number of Fragments for a TSO Segment captured */
  173. #define CDP_MAX_TSO_FRAGMENTS 6
  174. #endif /* FEATURE_TSO_STATS */
  175. /* Different Packet Types */
  176. enum cdp_packet_type {
  177. DOT11_A = 0,
  178. DOT11_B = 1,
  179. DOT11_N = 2,
  180. DOT11_AC = 3,
  181. DOT11_AX = 4,
  182. DOT11_MAX = 5,
  183. };
  184. /*
  185. * cdp_mu_packet_type: MU Rx type index
  186. * RX_TYPE_MU_MIMO: MU MIMO Rx type index
  187. * RX_TYPE_MU_OFDMA: MU OFDMA Rx type index
  188. * MU_MIMO_OFDMA: MU Rx MAX type index
  189. */
  190. enum cdp_mu_packet_type {
  191. RX_TYPE_MU_MIMO = 0,
  192. RX_TYPE_MU_OFDMA = 1,
  193. RX_TYPE_MU_MAX = 2,
  194. };
  195. enum WDI_EVENT {
  196. WDI_EVENT_TX_STATUS = WDI_EVENT_BASE,
  197. WDI_EVENT_OFFLOAD_ALL,
  198. WDI_EVENT_RX_DESC_REMOTE,
  199. WDI_EVENT_RX_PEER_INVALID,
  200. WDI_EVENT_DBG_PRINT, /* NEED to integrate pktlog changes*/
  201. WDI_EVENT_RX_CBF_REMOTE,
  202. WDI_EVENT_RATE_FIND,
  203. WDI_EVENT_RATE_UPDATE,
  204. WDI_EVENT_SW_EVENT,
  205. WDI_EVENT_RX_DESC,
  206. WDI_EVENT_LITE_T2H,
  207. WDI_EVENT_LITE_RX,
  208. WDI_EVENT_RX_PPDU_DESC,
  209. WDI_EVENT_TX_PPDU_DESC,
  210. WDI_EVENT_TX_MSDU_DESC,
  211. WDI_EVENT_TX_DATA,
  212. WDI_EVENT_RX_DATA,
  213. WDI_EVENT_TX_MGMT_CTRL,
  214. WDI_EVENT_HTT_STATS,
  215. WDI_EVENT_TX_BEACON,
  216. WDI_EVENT_PEER_STATS,
  217. WDI_EVENT_TX_SOJOURN_STAT,
  218. WDI_EVENT_UPDATE_DP_STATS,
  219. WDI_EVENT_RX_MGMT_CTRL,
  220. WDI_EVENT_PEER_CREATE,
  221. WDI_EVENT_PEER_DESTROY,
  222. WDI_EVENT_PEER_FLUSH_RATE_STATS,
  223. WDI_EVENT_FLUSH_RATE_STATS_REQ,
  224. WDI_EVENT_RX_MPDU,
  225. WDI_EVENT_HMWDS_AST_ADD_STATUS,
  226. /* End of new event items */
  227. WDI_EVENT_LAST
  228. };
  229. #define WDI_NUM_EVENTS WDI_EVENT_LAST - WDI_EVENT_BASE
  230. struct cdp_stats_extd {
  231. };
  232. /* TID level Tx/Rx stats
  233. *
  234. */
  235. enum cdp_txrx_tidq_stats {
  236. /* Tx Counters */
  237. TX_MSDU_TOTAL_LINUX_SUBSYSTEM,
  238. TX_MSDU_TOTAL_FROM_OSIF,
  239. TX_MSDU_TX_COMP_PKT_CNT,
  240. /* Rx Counters */
  241. RX_MSDU_TOTAL_FROM_FW,
  242. RX_MSDU_MCAST_FROM_FW,
  243. RX_TID_MISMATCH_FROM_FW,
  244. RX_MSDU_MISC_PKTS,
  245. RX_MSDU_IS_ARP,
  246. RX_MSDU_IS_EAP,
  247. RX_MSDU_IS_DHCP,
  248. RX_AGGREGATE_10,
  249. RX_AGGREGATE_20,
  250. RX_AGGREGATE_30,
  251. RX_AGGREGATE_40,
  252. RX_AGGREGATE_50,
  253. RX_AGGREGATE_60,
  254. RX_AGGREGATE_MORE,
  255. RX_AMSDU_1,
  256. RX_AMSDU_2,
  257. RX_AMSDU_3,
  258. RX_AMSDU_4,
  259. RX_AMSDU_MORE,
  260. RX_MSDU_CHAINED_FROM_FW,
  261. RX_MSDU_REORDER_FAILED_FROM_FW,
  262. RX_MSDU_REORDER_FLUSHED_FROM_FW,
  263. RX_MSDU_DISCARD_FROM_FW,
  264. RX_MSDU_DUPLICATE_FROM_FW,
  265. RX_MSDU_DELIVERED_TO_STACK,
  266. TIDQ_STATS_MAX,
  267. };
  268. struct cdp_tidq_stats {
  269. uint32_t stats[TIDQ_STATS_MAX];
  270. };
  271. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  272. /**
  273. * struct cdp_rx_ppdu_cfr_info - struct for storing ppdu info extracted from HW
  274. * TLVs, this will be used for CFR correlation
  275. *
  276. * @bb_captured_channel : Set by RXPCU when MACRX_FREEZE_CAPTURE_CHANNEL TLV is
  277. * sent to PHY, SW checks it to correlate current PPDU TLVs with uploaded
  278. * channel information.
  279. *
  280. * @bb_captured_timeout : Set by RxPCU to indicate channel capture condition is
  281. * met, but MACRX_FREEZE_CAPTURE_CHANNEL is not sent to PHY due to AST delay,
  282. * which means the rx_frame_falling edge to FREEZE TLV ready time exceeds
  283. * the threshold time defined by RXPCU register FREEZE_TLV_DELAY_CNT_THRESH.
  284. * Bb_captured_reason is still valid in this case.
  285. *
  286. * @bb_captured_reason : Copy capture_reason of MACRX_FREEZE_CAPTURE_CHANNEL
  287. * TLV to here for FW usage. Valid when bb_captured_channel or
  288. * bb_captured_timeout is set.
  289. * <enum 0 freeze_reason_TM>
  290. * <enum 1 freeze_reason_FTM>
  291. * <enum 2 freeze_reason_ACK_resp_to_TM_FTM>
  292. * <enum 3 freeze_reason_TA_RA_TYPE_FILTER>
  293. * <enum 4 freeze_reason_NDPA_NDP>
  294. * <enum 5 freeze_reason_ALL_PACKET>
  295. * <legal 0-5>
  296. *
  297. * @rx_location_info_valid: Indicates whether CFR DMA address in the PPDU TLV
  298. * is valid
  299. * <enum 0 rx_location_info_is_not_valid>
  300. * <enum 1 rx_location_info_is_valid>
  301. * <legal all>
  302. *
  303. * @chan_capture_status : capture status reported by ucode
  304. * a. CAPTURE_IDLE: FW has disabled "REPETITIVE_CHE_CAPTURE_CTRL"
  305. * b. CAPTURE_BUSY: previous PPDU’s channel capture upload DMA ongoing. (Note
  306. * that this upload is triggered after receiving freeze_channel_capture TLV
  307. * after last PPDU is rx)
  308. * c. CAPTURE_ACTIVE: channel capture is enabled and no previous channel
  309. * capture ongoing
  310. * d. CAPTURE_NO_BUFFER: next buffer in IPC ring not available
  311. *
  312. * @rtt_che_buffer_pointer_high8 : The high 8 bits of the 40 bits pointer to
  313. * external RTT channel information buffer
  314. *
  315. * @rtt_che_buffer_pointer_low32 : The low 32 bits of the 40 bits pointer to
  316. * external RTT channel information buffer
  317. *
  318. */
  319. struct cdp_rx_ppdu_cfr_info {
  320. bool bb_captured_channel;
  321. bool bb_captured_timeout;
  322. uint8_t bb_captured_reason;
  323. bool rx_location_info_valid;
  324. uint8_t chan_capture_status;
  325. uint8_t rtt_che_buffer_pointer_high8;
  326. uint32_t rtt_che_buffer_pointer_low32;
  327. };
  328. #endif
  329. /*
  330. * struct cdp_rx_su_evm_info: Rx evm info
  331. * @number_of_symbols: number of symbols
  332. * @nss_count: number of spatial streams
  333. * @pilot_count: number of pilot count
  334. */
  335. struct cdp_rx_su_evm_info {
  336. uint16_t number_of_symbols;
  337. uint8_t nss_count;
  338. uint8_t pilot_count;
  339. uint32_t pilot_evm[DP_RX_MAX_SU_EVM_COUNT];
  340. };
  341. /*
  342. * cdp_delay_stats_mode: Different types of delay statistics
  343. *
  344. * @CDP_DELAY_STATS_SW_ENQ: Stack to hw enqueue delay
  345. * @CDP_DELAY_STATS_TX_INTERFRAME: Interframe delay at radio entry point
  346. * @CDP_DELAY_STATS_FW_HW_TRANSMIT: Hw enqueue to tx completion delay
  347. * @CDP_DELAY_STATS_REAP_STACK: Delay in ring reap to indicating network stack
  348. * @CDP_DELAY_STATS_RX_INTERFRAME: Rx inteframe delay
  349. * @CDP_DELAY_STATS_MODE_MAX: Maximum delay mode
  350. */
  351. enum cdp_delay_stats_mode {
  352. CDP_DELAY_STATS_SW_ENQ,
  353. CDP_DELAY_STATS_TX_INTERFRAME,
  354. CDP_DELAY_STATS_FW_HW_TRANSMIT,
  355. CDP_DELAY_STATS_REAP_STACK,
  356. CDP_DELAY_STATS_RX_INTERFRAME,
  357. CDP_DELAY_STATS_MODE_MAX,
  358. };
  359. /*
  360. * cdp_delay_bucket_index
  361. * Index to be used for all delay stats
  362. */
  363. enum cdp_delay_bucket_index {
  364. CDP_DELAY_BUCKET_0,
  365. CDP_DELAY_BUCKET_1,
  366. CDP_DELAY_BUCKET_2,
  367. CDP_DELAY_BUCKET_3,
  368. CDP_DELAY_BUCKET_4,
  369. CDP_DELAY_BUCKET_5,
  370. CDP_DELAY_BUCKET_6,
  371. CDP_DELAY_BUCKET_7,
  372. CDP_DELAY_BUCKET_8,
  373. CDP_DELAY_BUCKET_9,
  374. CDP_DELAY_BUCKET_10,
  375. CDP_DELAY_BUCKET_11,
  376. CDP_DELAY_BUCKET_12,
  377. CDP_DELAY_BUCKET_MAX,
  378. };
  379. /*
  380. * struct cdp_tx_host_drop - packet drop due to following reasons.
  381. */
  382. enum cdp_tx_sw_drop {
  383. TX_DESC_ERR,
  384. TX_HAL_RING_ACCESS_ERR,
  385. TX_DMA_MAP_ERR,
  386. TX_HW_ENQUEUE,
  387. TX_SW_ENQUEUE,
  388. TX_MAX_DROP,
  389. };
  390. /*
  391. * struct cdp_rx_host_drop - packet drop due to following reasons.
  392. */
  393. enum cdp_rx_sw_drop {
  394. INTRABSS_DROP,
  395. MSDU_DONE_FAILURE,
  396. INVALID_PEER_VDEV,
  397. POLICY_CHECK_DROP,
  398. MEC_DROP,
  399. NAWDS_MCAST_DROP,
  400. MESH_FILTER_DROP,
  401. ENQUEUE_DROP,
  402. RX_MAX_DROP,
  403. };
  404. /*
  405. * struct cdp_delay_stats
  406. * @delay_bucket: division of buckets as per latency
  407. * @min_delay: minimum delay
  408. * @max_delay: maximum delay
  409. * @avg_delay: average delay
  410. */
  411. struct cdp_delay_stats {
  412. uint64_t delay_bucket[CDP_DELAY_BUCKET_MAX];
  413. uint32_t min_delay;
  414. uint32_t max_delay;
  415. uint32_t avg_delay;
  416. };
  417. /*
  418. * struct cdp_tid_tx_stats
  419. * @swq_delay: delay between wifi driver entry point and enqueue to HW in tx
  420. * @hwtx_delay: delay between wifi driver exit (enqueue to HW) and tx completion
  421. * @intfrm_delay: interframe delay
  422. * @success_cnt: total successful transmit count
  423. * @comp_fail_cnt: firmware drop found in tx completion path
  424. * @swdrop_cnt: software drop in tx path
  425. * @tqm_status_cnt: TQM completion status count
  426. * @htt_status_cnt: HTT completion status count
  427. */
  428. struct cdp_tid_tx_stats {
  429. struct cdp_delay_stats swq_delay;
  430. struct cdp_delay_stats hwtx_delay;
  431. struct cdp_delay_stats intfrm_delay;
  432. uint64_t success_cnt;
  433. uint64_t comp_fail_cnt;
  434. uint64_t swdrop_cnt[TX_MAX_DROP];
  435. uint64_t tqm_status_cnt[CDP_MAX_TX_TQM_STATUS];
  436. uint64_t htt_status_cnt[CDP_MAX_TX_HTT_STATUS];
  437. };
  438. /*
  439. * struct cdp_tid_tx_stats
  440. * @to_stack_delay: Time taken between ring reap to indication to network stack
  441. * @intfrm_delay: Interframe rx delay
  442. * @delivered_cnt: Total packets indicated to stack
  443. * @intrabss_cnt: Rx total intraBSS frames
  444. * @msdu_cnt: number of msdu received from HW
  445. * @mcast_msdu_cnt: Num Mcast Msdus received from HW in Rx
  446. * @bcast_msdu_cnt: Num Bcast Msdus received from HW in Rx
  447. * @fail_cnt: Rx deliver drop counters
  448. */
  449. struct cdp_tid_rx_stats {
  450. struct cdp_delay_stats to_stack_delay;
  451. struct cdp_delay_stats intfrm_delay;
  452. uint64_t delivered_to_stack;
  453. uint64_t intrabss_cnt;
  454. uint64_t msdu_cnt;
  455. uint64_t mcast_msdu_cnt;
  456. uint64_t bcast_msdu_cnt;
  457. uint64_t fail_cnt[RX_MAX_DROP];
  458. };
  459. /*
  460. * struct cdp_tid_stats
  461. * @ingress_stack: Total packets received from linux stack
  462. * @osif_drop: drops in osif layer
  463. * @tid_tx_stats: transmit counters per tid
  464. * @tid_rx_stats: receive counters per tid
  465. */
  466. struct cdp_tid_stats {
  467. uint64_t ingress_stack;
  468. uint64_t osif_drop;
  469. struct cdp_tid_tx_stats tid_tx_stats[CDP_MAX_TX_COMP_RINGS]
  470. [CDP_MAX_DATA_TIDS];
  471. struct cdp_tid_rx_stats tid_rx_stats[CDP_MAX_RX_RINGS]
  472. [CDP_MAX_DATA_TIDS];
  473. };
  474. /*
  475. * struct cdp_delay_tx_stats: Tx delay stats
  476. * @tx_swq_delay: software enqueue delay
  477. * @hwtx_delay: HW enque to completion delay
  478. */
  479. struct cdp_delay_tx_stats {
  480. struct cdp_hist_stats tx_swq_delay;
  481. struct cdp_hist_stats hwtx_delay;
  482. };
  483. /*
  484. * struct cdp_delay_rx_stats: Rx delay stats
  485. * @to_stack_delay: To stack delay
  486. */
  487. struct cdp_delay_rx_stats {
  488. struct cdp_hist_stats to_stack_delay;
  489. };
  490. /*
  491. * struct cdp_delay_tid_stats: Delay tid stats
  492. * @tx_delay: Tx delay related stats
  493. * @rx_delay: Rx delay related stats
  494. */
  495. struct cdp_delay_tid_stats {
  496. struct cdp_delay_tx_stats tx_delay;
  497. struct cdp_delay_rx_stats rx_delay;
  498. };
  499. /*
  500. * cdp_peer_ext_stats: Peer extended stats
  501. * @delay_stats: Per TID delay stats
  502. */
  503. struct cdp_peer_ext_stats {
  504. struct cdp_delay_tid_stats delay_stats[CDP_MAX_DATA_TIDS]
  505. [CDP_MAX_TXRX_CTX];
  506. /*Customer can add MSDU level Tx/Rx stats */
  507. };
  508. /* struct cdp_pkt_info - packet info
  509. * @num: no of packets
  510. * @bytes: total no of bytes
  511. */
  512. struct cdp_pkt_info {
  513. uint32_t num;
  514. uint64_t bytes;
  515. };
  516. /* struct cdp_pkt_type - packet type
  517. * @mcs_count: Counter array for each MCS index
  518. */
  519. struct cdp_pkt_type {
  520. uint32_t mcs_count[MAX_MCS];
  521. };
  522. /*
  523. * struct cdp_rx_mu - Rx MU Stats
  524. * @ppdu_nss[SS_COUNT]: Packet Count in spatial streams
  525. * @mpdu_cnt_fcs_ok: Rx success mpdu count
  526. * @mpdu_cnt_fcs_err: Rx fail mpdu count
  527. * @cdp_pkt_type: counter array for each MCS index
  528. */
  529. struct cdp_rx_mu {
  530. uint32_t ppdu_nss[SS_COUNT];
  531. uint32_t mpdu_cnt_fcs_ok;
  532. uint32_t mpdu_cnt_fcs_err;
  533. struct cdp_pkt_type ppdu;
  534. };
  535. /* struct cdp_tx_pkt_info - tx packet info
  536. * num_msdu - successful msdu
  537. * num_mpdu - successful mpdu from compltn common
  538. * mpdu_tried - mpdu tried
  539. *
  540. * tx packet info counter field for mpdu success/tried and msdu
  541. */
  542. struct cdp_tx_pkt_info {
  543. uint32_t num_msdu;
  544. uint32_t num_mpdu;
  545. uint32_t mpdu_tried;
  546. };
  547. #ifdef FEATURE_TSO_STATS
  548. /**
  549. * struct cdp_tso_seg_histogram - Segment histogram for TCP Packets
  550. * @segs_1: packets with single segments
  551. * @segs_2_5: packets with 2-5 segments
  552. * @segs_6_10: packets with 6-10 segments
  553. * @segs_11_15: packets with 11-15 segments
  554. * @segs_16_20: packets with 16-20 segments
  555. * @segs_20_plus: packets with 20 plus segments
  556. */
  557. struct cdp_tso_seg_histogram {
  558. uint64_t segs_1;
  559. uint64_t segs_2_5;
  560. uint64_t segs_6_10;
  561. uint64_t segs_11_15;
  562. uint64_t segs_16_20;
  563. uint64_t segs_20_plus;
  564. };
  565. /**
  566. * struct cdp_tso_packet_info - Stats for TSO segments within a TSO packet
  567. * @tso_seg: TSO Segment information
  568. * @num_seg: Number of segments
  569. * @tso_packet_len: Size of the tso packet
  570. * @tso_seg_idx: segment number
  571. */
  572. struct cdp_tso_packet_info {
  573. struct qdf_tso_seg_t tso_seg[CDP_MAX_TSO_SEGMENTS];
  574. uint8_t num_seg;
  575. size_t tso_packet_len;
  576. uint32_t tso_seg_idx;
  577. };
  578. /**
  579. * struct cdp_tso_info - stats for tso packets
  580. * @tso_packet_info: TSO packet information
  581. */
  582. struct cdp_tso_info {
  583. struct cdp_tso_packet_info tso_packet_info[CDP_MAX_TSO_PACKETS];
  584. };
  585. #endif /* FEATURE_TSO_STATS */
  586. /**
  587. * struct cdp_tso_stats - TSO stats information
  588. * @num_tso_pkts: Total number of TSO Packets
  589. * @tso_comp: Total tso packet completions
  590. * @dropped_host: TSO packets dropped by host
  591. * @tso_no_mem_dropped: TSO packets dropped by host due to descriptor
  592. unavailablity
  593. * @dropped_target: TSO packets_dropped by target
  594. * @tso_info: Per TSO packet counters
  595. * @seg_histogram: TSO histogram stats
  596. */
  597. struct cdp_tso_stats {
  598. struct cdp_pkt_info num_tso_pkts;
  599. uint32_t tso_comp;
  600. struct cdp_pkt_info dropped_host;
  601. struct cdp_pkt_info tso_no_mem_dropped;
  602. uint32_t dropped_target;
  603. #ifdef FEATURE_TSO_STATS
  604. struct cdp_tso_info tso_info;
  605. struct cdp_tso_seg_histogram seg_histogram;
  606. #endif /* FEATURE_TSO_STATS */
  607. };
  608. #define CDP_PEER_STATS_START 0
  609. enum cdp_peer_stats_type {
  610. cdp_peer_stats_min = CDP_PEER_STATS_START,
  611. /* Tx types */
  612. cdp_peer_tx_ucast = cdp_peer_stats_min,
  613. cdp_peer_tx_mcast,
  614. cdp_peer_tx_rate,
  615. cdp_peer_tx_last_tx_rate,
  616. cdp_peer_tx_inactive_time,
  617. cdp_peer_tx_ratecode,
  618. cdp_peer_tx_flags,
  619. cdp_peer_tx_power,
  620. /* Rx types */
  621. cdp_peer_rx_rate,
  622. cdp_peer_rx_last_rx_rate,
  623. cdp_peer_rx_ratecode,
  624. cdp_peer_rx_ucast,
  625. cdp_peer_rx_flags,
  626. cdp_peer_rx_avg_rssi,
  627. cdp_peer_stats_max,
  628. };
  629. /*
  630. * The max size of cdp_peer_stats_param_t is limited to 16 bytes.
  631. * If the buffer size is exceeding this size limit,
  632. * dp_txrx_get_peer_stats is to be used instead.
  633. */
  634. typedef union cdp_peer_stats_buf {
  635. /* Tx types */
  636. struct cdp_pkt_info tx_ucast;
  637. struct cdp_pkt_info tx_mcast;
  638. uint32_t tx_rate;
  639. uint32_t last_tx_rate;
  640. uint32_t tx_inactive_time;
  641. uint32_t tx_flags;
  642. uint32_t tx_power;
  643. uint16_t tx_ratecode;
  644. /* Rx types */
  645. struct cdp_pkt_info rx_ucast;
  646. uint32_t rx_rate;
  647. uint32_t last_rx_rate;
  648. uint32_t rx_ratecode;
  649. uint32_t rx_flags;
  650. uint32_t rx_avg_rssi;
  651. } cdp_peer_stats_param_t; /* Max union size 16 bytes */
  652. /**
  653. * enum cdp_protocol_trace - Protocols supported by per-peer protocol trace
  654. * @CDP_TRACE_ICMP: ICMP packets
  655. * @CDP_TRACE_EAP: EAPOL packets
  656. * @CDP_TRACE_ARP: ARP packets
  657. *
  658. * Enumeration of all protocols supported by per-peer protocol trace feature
  659. */
  660. enum cdp_protocol_trace {
  661. CDP_TRACE_ICMP,
  662. CDP_TRACE_EAP,
  663. CDP_TRACE_ARP,
  664. CDP_TRACE_MAX
  665. };
  666. /**
  667. * struct protocol_trace_count - type of count on per-peer protocol trace
  668. * @egress_cnt: how many packets go out of host driver
  669. * @ingress_cnt: how many packets come into the host driver
  670. *
  671. * Type of count on per-peer protocol trace
  672. */
  673. struct protocol_trace_count {
  674. uint16_t egress_cnt;
  675. uint16_t ingress_cnt;
  676. };
  677. /* struct cdp_tx_stats - tx stats
  678. * @cdp_pkt_info comp_pkt: Pkt Info for which completions were received
  679. * @cdp_pkt_info ucast: Unicast Packet Count
  680. * @cdp_pkt_info mcast: Multicast Packet Count
  681. * @cdp_pkt_info bcast: Broadcast Packet Count
  682. * @cdp_pkt_info nawds_mcast: NAWDS Multicast Packet Count
  683. * @cdp_pkt_info tx_success: Successful Tx Packets
  684. * @nawds_mcast_drop: NAWDS Multicast Drop Count
  685. * @protocol_trace_cnt: per-peer protocol counter
  686. * @tx_failed: Total Tx failure
  687. * @ofdma: Total Packets as ofdma
  688. * @stbc: Packets in STBC
  689. * @ldpc: Packets in LDPC
  690. * @retries: Packet retries
  691. * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation
  692. * @amsdu_cnt: Number of MSDUs part of AMSDU
  693. * @tx_rate: Tx Rate
  694. * @last_tx_rate: Last tx rate for unicast packets
  695. * @last_tx_rate_mcs: Tx rate mcs for unicast packets
  696. * @mcast_last_tx_rate: Last tx rate for multicast packets
  697. * @mcast_last_tx_rate_mcs: Last tx rate mcs for multicast
  698. * @last_per: Tx Per
  699. * @rnd_avg_tx_rate: Rounded average tx rate
  700. * @avg_tx_rate: Average TX rate
  701. * @last_ack_rssi: RSSI of last acked packet
  702. * @tx_bytes_success_last: last Tx success bytes
  703. * @tx_data_success_last: last Tx success data
  704. * @tx_byte_rate: Bytes Trasmitted in last one sec
  705. * @tx_data_rate: Data Transmitted in last one sec
  706. * @sgi_count[MAX_GI]: SGI count
  707. * @nss[SS_COUNT]: Packet count for different num_spatial_stream values
  708. * @bw[MAX_BW]: Packet Count for different bandwidths
  709. * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count
  710. * @excess_retries_per_ac[WME_AC_MAX]: Wireless Multimedia type Count
  711. * @dot11_tx_pkts: dot11 tx packets
  712. * @fw_rem: Discarded by firmware
  713. * @fw_rem_notx: firmware_discard_untransmitted
  714. * @fw_rem_tx: firmware_discard_transmitted
  715. * @age_out: aged out in mpdu/msdu queues
  716. * @fw_reason1: discarded by firmware reason 1
  717. * @fw_reason2: discarded by firmware reason 2
  718. * @fw_reason3: discarded by firmware reason 3
  719. * @mcs_count: MCS Count
  720. * @an_tx_cnt: ald tx count
  721. * @an_tx_rates_used: ald rx rate used
  722. * @an_tx_bytes: ald tx bytes
  723. * @ald_txcount: ald tx count
  724. * @ald_lastper: ald last PER
  725. * @ald_max4msframelen: ald max frame len
  726. * @an_tx_ratecount: ald tx ratecount
  727. * @ald_retries: ald retries
  728. * @ald_ac_nobufs: #buffer overflows per node per AC
  729. * @ald_ac_excretries: #pkts dropped after excessive retries per node per AC
  730. * @rssi_chain: rssi chain
  731. * @inactive_time: inactive time in secs
  732. * @tx_flags: tx flags
  733. * @tx_power: Tx power latest
  734. * @is_tx_no_ack: no ack received
  735. * @tx_ratecode: Tx rate code of last frame
  736. * @is_tx_nodefkey: tx failed 'cuz no defkey
  737. * @is_tx_noheadroom: tx failed 'cuz no space
  738. * @is_crypto_enmicfail:
  739. * @is_tx_nonode: tx failed for no node
  740. * @is_tx_unknownmgt: tx of unknown mgt frame
  741. * @is_tx_badcipher: tx failed 'cuz key type
  742. * @ampdu_cnt: completion of aggregation
  743. * @non_ampdu_cnt: tx completion not aggregated
  744. * @failed_retry_count: packets failed due to retry above 802.11 retry limit
  745. * @retry_count: packets successfully send after one or more retry
  746. * @multiple_retry_count: packets successfully sent after more than one retry
  747. * @transmit_type: pkt info for tx transmit type
  748. * @mu_group_id: mumimo mu group id
  749. * @ru_start: RU start index
  750. * @ru_tones: RU tones size
  751. * @ru_loc: pkt info for RU location 26/ 52/ 106/ 242/ 484 counter
  752. * @num_ppdu_cookie_valid : Number of comp received with valid ppdu cookie
  753. * @tx_success_twt: Successful Tx Packets in TWT session
  754. */
  755. struct cdp_tx_stats {
  756. struct cdp_pkt_info comp_pkt;
  757. struct cdp_pkt_info ucast;
  758. struct cdp_pkt_info mcast;
  759. struct cdp_pkt_info bcast;
  760. struct cdp_pkt_info nawds_mcast;
  761. #ifdef VDEV_PEER_PROTOCOL_COUNT
  762. struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX];
  763. #endif
  764. struct cdp_pkt_info tx_success;
  765. uint32_t nawds_mcast_drop;
  766. uint32_t tx_failed;
  767. uint32_t ofdma;
  768. uint32_t stbc;
  769. uint32_t ldpc;
  770. uint32_t retries;
  771. uint32_t non_amsdu_cnt;
  772. uint32_t amsdu_cnt;
  773. uint32_t tx_rate;
  774. uint32_t last_tx_rate;
  775. uint32_t last_tx_rate_mcs;
  776. uint32_t mcast_last_tx_rate;
  777. uint32_t mcast_last_tx_rate_mcs;
  778. uint32_t last_per;
  779. uint64_t rnd_avg_tx_rate;
  780. uint64_t avg_tx_rate;
  781. uint32_t last_ack_rssi;
  782. uint32_t tx_bytes_success_last;
  783. uint32_t tx_data_success_last;
  784. uint32_t tx_byte_rate;
  785. uint32_t tx_data_rate;
  786. uint32_t tx_data_ucast_last;
  787. uint32_t tx_data_ucast_rate;
  788. struct cdp_pkt_type pkt_type[DOT11_MAX];
  789. uint32_t sgi_count[MAX_GI];
  790. uint32_t nss[SS_COUNT];
  791. uint32_t bw[MAX_BW];
  792. uint32_t wme_ac_type[WME_AC_MAX];
  793. uint32_t excess_retries_per_ac[WME_AC_MAX];
  794. struct cdp_pkt_info dot11_tx_pkts;
  795. struct {
  796. struct cdp_pkt_info fw_rem;
  797. uint32_t fw_rem_notx;
  798. uint32_t fw_rem_tx;
  799. uint32_t age_out;
  800. uint32_t fw_reason1;
  801. uint32_t fw_reason2;
  802. uint32_t fw_reason3;
  803. } dropped;
  804. uint32_t fw_tx_cnt;
  805. uint32_t fw_tx_bytes;
  806. uint32_t fw_txcount;
  807. uint32_t fw_max4msframelen;
  808. uint32_t fw_ratecount;
  809. uint32_t ac_nobufs[WME_AC_MAX];
  810. uint32_t rssi_chain[WME_AC_MAX];
  811. uint32_t inactive_time;
  812. uint32_t tx_flags;
  813. uint32_t tx_power;
  814. /* MSDUs which the target sent but couldn't get an ack for */
  815. struct cdp_pkt_info is_tx_no_ack;
  816. uint16_t tx_ratecode;
  817. /*add for peer and upadted from ppdu*/
  818. uint32_t ampdu_cnt;
  819. uint32_t non_ampdu_cnt;
  820. uint32_t failed_retry_count;
  821. uint32_t retry_count;
  822. uint32_t multiple_retry_count;
  823. uint32_t last_tx_rate_used;
  824. struct cdp_tx_pkt_info transmit_type[MAX_TRANSMIT_TYPES];
  825. uint32_t mu_group_id[MAX_MU_GROUP_ID];
  826. uint32_t ru_start;
  827. uint32_t ru_tones;
  828. struct cdp_tx_pkt_info ru_loc[MAX_RU_LOCATIONS];
  829. uint32_t num_ppdu_cookie_valid;
  830. uint32_t no_ack_count[QDF_PROTO_SUBTYPE_MAX];
  831. struct cdp_pkt_info tx_success_twt;
  832. };
  833. /* struct cdp_rx_stats - rx Level Stats
  834. * @to_stack: Total packets sent up the stack
  835. * @rcvd_reo[CDP_MAX_RX_RINGS]: Packets received on the reo ring
  836. * @unicast: Total unicast packets
  837. * @multicast: Total multicast packets
  838. * @bcast: Broadcast Packet Count
  839. * @raw: Raw Pakets received
  840. * @nawds_mcast_drop: Total multicast packets
  841. * @mec_drop: Total MEC packets dropped
  842. * @pkts: Intra BSS packets received
  843. * @fail: Intra BSS packets failed
  844. * @mdns_no_fwd: Intra BSS MDNS packets not forwarded
  845. * @protocol_trace_cnt: per-peer protocol counters
  846. * @mic_err: Rx MIC errors CCMP
  847. * @decrypt_err: Rx Decryption Errors CRC
  848. * @fcserr: rx MIC check failed (CCMP)
  849. * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count
  850. * @reception_type[MAX_RECEPTION_TYPES]: Reception type os packets
  851. * @mcs_count[MAX_MCS]: mcs count
  852. * @sgi_count[MAX_GI]: sgi count
  853. * @nss[SS_COUNT]: packet count in spatiel Streams
  854. * @ppdu_nss[SS_COUNT]: PPDU packet count in spatial streams
  855. * @mpdu_cnt_fcs_ok: SU Rx success mpdu count
  856. * @mpdu_cnt_fcs_err: SU Rx fail mpdu count
  857. * @su_ax_ppdu_cnt: SU Rx packet count
  858. * @ppdu_cnt[MAX_RECEPTION_TYPES]: PPDU packet count in reception type
  859. * @rx_mu[RX_TYPE_MU_MAX]: Rx MU stats
  860. * @bw[MAX_BW]: Packet Count in different bandwidths
  861. * @non_ampdu_cnt: Number of MSDUs with no MPDU level aggregation
  862. * @ampdu_cnt: Number of MSDUs part of AMSPU
  863. * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation
  864. * @amsdu_cnt: Number of MSDUs part of AMSDU
  865. * @bar_recv_cnt: Number of bar received
  866. * @avg_rssi: Average rssi
  867. * @rx_rate: Rx rate
  868. * @last_rx_rate: Previous rx rate
  869. * @rnd_avg_rx_rate: Rounded average rx rate
  870. * @avg_rx_rate: Average Rx rate
  871. * @dot11_rx_pkts: dot11 rx packets
  872. * @rx_bytes_last: last Rx success bytes
  873. * @rx_data_last: last rx success data
  874. * @rx_byte_rate: bytes received in last one sec
  875. * @rx_data_rate: data received in last one sec
  876. * @rx_retries: retries of packet in rx
  877. * @rx_mpdus: mpdu in rx
  878. * @rx_ppdus: ppdu in rx
  879. * @is_rx_tooshort: tooshort
  880. * @is_rx_decap: rx decap
  881. * @rx_ccmpmic: rx MIC check failed (CCMP)
  882. * @rx_tkipmic: rx MIC check failed (TKIP)
  883. * @rx_tkipicv: rx ICV check failed (TKIP)
  884. * @rx_wpimic: rx MIC check failed (WPI)
  885. * @rx_wepfail: rx wep processing failed
  886. * @rx_aggr: aggregation on rx
  887. * @rx_discard: packets discard in rx
  888. * @rx_ratecode: Rx rate code of last frame
  889. * @rx_flags: rx flags
  890. * @rx_rssi_measured_time: Time at which rssi is measured
  891. * @rssi: RSSI of received signal
  892. * @last_rssi: Previous rssi
  893. * @multipass_rx_pkt_drop: Dropped multipass rx pkt
  894. * @rx_mpdu_cnt: rx mpdu count per MCS rate
  895. * @to_stack_twt: Total packets sent up the stack in TWT session
  896. */
  897. struct cdp_rx_stats {
  898. struct cdp_pkt_info to_stack;
  899. struct cdp_pkt_info rcvd_reo[CDP_MAX_RX_RINGS];
  900. struct cdp_pkt_info unicast;
  901. struct cdp_pkt_info multicast;
  902. struct cdp_pkt_info bcast;
  903. struct cdp_pkt_info raw;
  904. uint32_t nawds_mcast_drop;
  905. struct cdp_pkt_info mec_drop;
  906. struct {
  907. struct cdp_pkt_info pkts;
  908. struct cdp_pkt_info fail;
  909. uint32_t mdns_no_fwd;
  910. } intra_bss;
  911. #ifdef VDEV_PEER_PROTOCOL_COUNT
  912. struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX];
  913. #endif
  914. struct {
  915. uint32_t mic_err;
  916. uint32_t decrypt_err;
  917. uint32_t fcserr;
  918. } err;
  919. uint32_t wme_ac_type[WME_AC_MAX];
  920. uint32_t reception_type[MAX_RECEPTION_TYPES];
  921. struct cdp_pkt_type pkt_type[DOT11_MAX];
  922. uint32_t sgi_count[MAX_GI];
  923. uint32_t nss[SS_COUNT];
  924. uint32_t ppdu_nss[SS_COUNT];
  925. uint32_t mpdu_cnt_fcs_ok;
  926. uint32_t mpdu_cnt_fcs_err;
  927. struct cdp_pkt_type su_ax_ppdu_cnt;
  928. uint32_t ppdu_cnt[MAX_RECEPTION_TYPES];
  929. struct cdp_rx_mu rx_mu[RX_TYPE_MU_MAX];
  930. uint32_t bw[MAX_BW];
  931. uint32_t non_ampdu_cnt;
  932. uint32_t ampdu_cnt;
  933. uint32_t non_amsdu_cnt;
  934. uint32_t amsdu_cnt;
  935. uint32_t bar_recv_cnt;
  936. uint32_t avg_rssi;
  937. uint32_t rx_rate;
  938. uint32_t last_rx_rate;
  939. uint32_t rnd_avg_rx_rate;
  940. uint32_t avg_rx_rate;
  941. struct cdp_pkt_info dot11_rx_pkts;
  942. uint32_t rx_bytes_success_last;
  943. uint32_t rx_data_success_last;
  944. uint32_t rx_byte_rate;
  945. uint32_t rx_data_rate;
  946. uint32_t rx_retries;
  947. uint32_t rx_mpdus;
  948. uint32_t rx_ppdus;
  949. /*add for peer updated for ppdu*/
  950. uint32_t rx_aggr;
  951. uint32_t rx_discard;
  952. uint32_t rx_ratecode;
  953. uint32_t rx_flags;
  954. uint32_t rx_rssi_measured_time;
  955. uint8_t rssi;
  956. uint8_t last_rssi;
  957. uint32_t multipass_rx_pkt_drop;
  958. uint32_t rx_mpdu_cnt[MAX_MCS];
  959. struct cdp_pkt_info to_stack_twt;
  960. };
  961. /* struct cdp_tx_ingress_stats - Tx ingress Stats
  962. * @rcvd: Total packets received for transmission
  963. * @processed: Tx packets processed
  964. * @inspect_pkts: Total packets passed to inspect handler
  965. * @nawds_mcast: NAWDS Multicast Packet Count
  966. * @bcast: Number of broadcast packets
  967. * @raw_pkt: Total Raw packets
  968. * @dma_map_error: DMA map error
  969. * @num_seg: No of segments in TSO packets
  970. * @tso_pkt:total no of TSO packets
  971. * @non_tso_pkts: non - TSO packets
  972. * @dropped_host: TSO packets dropped by host
  973. * @dropped_target:TSO packets dropped by target
  974. * @sg_pkt: Total scatter gather packets
  975. * @non_sg_pkts: non SG packets
  976. * @dropped_host: SG packets dropped by host
  977. * @dropped_target: SG packets dropped by target
  978. * @dma_map_error: Dma map error
  979. * @mcast_pkt: total no of multicast conversion packets
  980. * @dropped_map_error: packets dropped due to map error
  981. * @dropped_self_mac: packets dropped due to self Mac address
  982. * @dropped_send_fail: Packets dropped due to send fail
  983. * @ucast: total unicast packets transmitted
  984. * @fail_seg_alloc: Segment allocation failure
  985. * @clone_fail: NBUF clone failure
  986. * @dropped_pkt: Total scatter gather packets
  987. * @desc_na: Desc Not Available
  988. * @exc_desc_na: Exception desc Not Available
  989. * @ring_full: ring full
  990. * @enqueue_fail: hw enqueue fail
  991. * @dma_error: dma fail
  992. * @res_full: Resource Full: Congestion Control
  993. * @exception_fw: packets sent to fw
  994. * @completion_fw: packets completions received from fw
  995. * @cce_classified:Number of packets classified by CCE
  996. * @cce_classified_raw:Number of raw packets classified by CCE
  997. * @sniffer_rcvd: Number of packets received with ppdu cookie
  998. */
  999. struct cdp_tx_ingress_stats {
  1000. struct cdp_pkt_info rcvd;
  1001. struct cdp_pkt_info processed;
  1002. struct cdp_pkt_info reinject_pkts;
  1003. struct cdp_pkt_info inspect_pkts;
  1004. struct cdp_pkt_info nawds_mcast;
  1005. struct cdp_pkt_info bcast;
  1006. struct {
  1007. struct cdp_pkt_info raw_pkt;
  1008. uint32_t dma_map_error;
  1009. uint32_t invalid_raw_pkt_datatype;
  1010. } raw;
  1011. /* Scatter Gather packet info */
  1012. struct {
  1013. struct cdp_pkt_info sg_pkt;
  1014. struct cdp_pkt_info non_sg_pkts;
  1015. struct cdp_pkt_info dropped_host;
  1016. uint32_t dropped_target;
  1017. uint32_t dma_map_error;
  1018. } sg;
  1019. /* Multicast Enhancement packets info */
  1020. struct {
  1021. struct cdp_pkt_info mcast_pkt;
  1022. uint32_t dropped_map_error;
  1023. uint32_t dropped_self_mac;
  1024. uint32_t dropped_send_fail;
  1025. uint32_t ucast;
  1026. uint32_t fail_seg_alloc;
  1027. uint32_t clone_fail;
  1028. } mcast_en;
  1029. /* Packets dropped on the Tx side */
  1030. struct {
  1031. struct cdp_pkt_info dropped_pkt;
  1032. struct cdp_pkt_info desc_na;
  1033. struct cdp_pkt_info exc_desc_na;
  1034. uint32_t ring_full;
  1035. uint32_t enqueue_fail;
  1036. uint32_t dma_error;
  1037. uint32_t res_full;
  1038. /* headroom insufficient */
  1039. uint32_t headroom_insufficient;
  1040. } dropped;
  1041. /* Mesh packets info */
  1042. struct {
  1043. uint32_t exception_fw;
  1044. uint32_t completion_fw;
  1045. } mesh;
  1046. uint32_t cce_classified;
  1047. uint32_t cce_classified_raw;
  1048. struct cdp_pkt_info sniffer_rcvd;
  1049. struct cdp_tso_stats tso_stats;
  1050. };
  1051. /* struct cdp_vdev_stats - vdev stats structure
  1052. * @tx_i: ingress tx stats
  1053. * @tx: cdp tx stats
  1054. * @rx: cdp rx stats
  1055. * @tso_stats: tso stats
  1056. */
  1057. struct cdp_vdev_stats {
  1058. struct cdp_tx_ingress_stats tx_i;
  1059. struct cdp_tx_stats tx;
  1060. struct cdp_rx_stats rx;
  1061. struct cdp_tso_stats tso_stats;
  1062. };
  1063. /* struct cdp_peer_stats - peer stats structure
  1064. * @tx: cdp tx stats
  1065. * @rx: cdp rx stats
  1066. */
  1067. struct cdp_peer_stats {
  1068. /* CDP Tx Stats */
  1069. struct cdp_tx_stats tx;
  1070. /* CDP Rx Stats */
  1071. struct cdp_rx_stats rx;
  1072. };
  1073. /* struct cdp_interface_peer_stats - interface structure for txrx peer stats
  1074. * @peer_mac: peer mac address
  1075. * @vdev_id : vdev_id for the peer
  1076. * @last_peer_tx_rate: peer tx rate for last transmission
  1077. * @peer_tx_rate: tx rate for current transmission
  1078. * @peer_rssi: current rssi value of peer
  1079. * @tx_packet_count: tx packet count
  1080. * @rx_packet_count: rx packet count
  1081. * @tx_byte_count: tx byte count
  1082. * @rx_byte_count: rx byte count
  1083. * @per: per error rate
  1084. * @ack_rssi: RSSI of the last ack received
  1085. * @rssi_changed: denotes rssi is changed
  1086. */
  1087. struct cdp_interface_peer_stats {
  1088. uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
  1089. uint8_t vdev_id;
  1090. uint8_t rssi_changed;
  1091. uint32_t last_peer_tx_rate;
  1092. uint32_t peer_tx_rate;
  1093. uint32_t peer_rssi;
  1094. uint32_t tx_packet_count;
  1095. uint32_t rx_packet_count;
  1096. uint32_t tx_byte_count;
  1097. uint32_t rx_byte_count;
  1098. uint32_t per;
  1099. uint32_t ack_rssi;
  1100. };
  1101. /* Tx completions per interrupt */
  1102. struct cdp_hist_tx_comp {
  1103. uint32_t pkts_1;
  1104. uint32_t pkts_2_20;
  1105. uint32_t pkts_21_40;
  1106. uint32_t pkts_41_60;
  1107. uint32_t pkts_61_80;
  1108. uint32_t pkts_81_100;
  1109. uint32_t pkts_101_200;
  1110. uint32_t pkts_201_plus;
  1111. };
  1112. /* Rx ring descriptors reaped per interrupt */
  1113. struct cdp_hist_rx_ind {
  1114. uint32_t pkts_1;
  1115. uint32_t pkts_2_20;
  1116. uint32_t pkts_21_40;
  1117. uint32_t pkts_41_60;
  1118. uint32_t pkts_61_80;
  1119. uint32_t pkts_81_100;
  1120. uint32_t pkts_101_200;
  1121. uint32_t pkts_201_plus;
  1122. };
  1123. struct cdp_htt_tlv_hdr {
  1124. /* BIT [11 : 0] :- tag
  1125. * BIT [23 : 12] :- length
  1126. * BIT [31 : 24] :- reserved
  1127. */
  1128. uint32_t tag__length;
  1129. };
  1130. #define HTT_STATS_SUBTYPE_MAX 16
  1131. struct cdp_htt_rx_pdev_fw_stats_tlv {
  1132. struct cdp_htt_tlv_hdr tlv_hdr;
  1133. /* BIT [ 7 : 0] :- mac_id
  1134. * BIT [31 : 8] :- reserved
  1135. */
  1136. uint32_t mac_id__word;
  1137. /* Num PPDU status processed from HW */
  1138. uint32_t ppdu_recvd;
  1139. /* Num MPDU across PPDUs with FCS ok */
  1140. uint32_t mpdu_cnt_fcs_ok;
  1141. /* Num MPDU across PPDUs with FCS err */
  1142. uint32_t mpdu_cnt_fcs_err;
  1143. /* Num MSDU across PPDUs */
  1144. uint32_t tcp_msdu_cnt;
  1145. /* Num MSDU across PPDUs */
  1146. uint32_t tcp_ack_msdu_cnt;
  1147. /* Num MSDU across PPDUs */
  1148. uint32_t udp_msdu_cnt;
  1149. /* Num MSDU across PPDUs */
  1150. uint32_t other_msdu_cnt;
  1151. /* Num MPDU on FW ring indicated */
  1152. uint32_t fw_ring_mpdu_ind;
  1153. /* Num MGMT MPDU given to protocol */
  1154. uint32_t fw_ring_mgmt_subtype[HTT_STATS_SUBTYPE_MAX];
  1155. /* Num ctrl MPDU given to protocol */
  1156. uint32_t fw_ring_ctrl_subtype[HTT_STATS_SUBTYPE_MAX];
  1157. /* Num mcast data packet received */
  1158. uint32_t fw_ring_mcast_data_msdu;
  1159. /* Num broadcast data packet received */
  1160. uint32_t fw_ring_bcast_data_msdu;
  1161. /* Num unicat data packet received */
  1162. uint32_t fw_ring_ucast_data_msdu;
  1163. /* Num null data packet received */
  1164. uint32_t fw_ring_null_data_msdu;
  1165. /* Num MPDU on FW ring dropped */
  1166. uint32_t fw_ring_mpdu_drop;
  1167. /* Num buf indication to offload */
  1168. uint32_t ofld_local_data_ind_cnt;
  1169. /* Num buf recycle from offload */
  1170. uint32_t ofld_local_data_buf_recycle_cnt;
  1171. /* Num buf indication to data_rx */
  1172. uint32_t drx_local_data_ind_cnt;
  1173. /* Num buf recycle from data_rx */
  1174. uint32_t drx_local_data_buf_recycle_cnt;
  1175. /* Num buf indication to protocol */
  1176. uint32_t local_nondata_ind_cnt;
  1177. /* Num buf recycle from protocol */
  1178. uint32_t local_nondata_buf_recycle_cnt;
  1179. /* Num buf fed */
  1180. uint32_t fw_status_buf_ring_refill_cnt;
  1181. /* Num ring empty encountered */
  1182. uint32_t fw_status_buf_ring_empty_cnt;
  1183. /* Num buf fed */
  1184. uint32_t fw_pkt_buf_ring_refill_cnt;
  1185. /* Num ring empty encountered */
  1186. uint32_t fw_pkt_buf_ring_empty_cnt;
  1187. /* Num buf fed */
  1188. uint32_t fw_link_buf_ring_refill_cnt;
  1189. /* Num ring empty encountered */
  1190. uint32_t fw_link_buf_ring_empty_cnt;
  1191. /* Num buf fed */
  1192. uint32_t host_pkt_buf_ring_refill_cnt;
  1193. /* Num ring empty encountered */
  1194. uint32_t host_pkt_buf_ring_empty_cnt;
  1195. /* Num buf fed */
  1196. uint32_t mon_pkt_buf_ring_refill_cnt;
  1197. /* Num ring empty encountered */
  1198. uint32_t mon_pkt_buf_ring_empty_cnt;
  1199. /* Num buf fed */
  1200. uint32_t mon_status_buf_ring_refill_cnt;
  1201. /* Num ring empty encountered */
  1202. uint32_t mon_status_buf_ring_empty_cnt;
  1203. /* Num buf fed */
  1204. uint32_t mon_desc_buf_ring_refill_cnt;
  1205. /* Num ring empty encountered */
  1206. uint32_t mon_desc_buf_ring_empty_cnt;
  1207. /* Num buf fed */
  1208. uint32_t mon_dest_ring_update_cnt;
  1209. /* Num ring full encountered */
  1210. uint32_t mon_dest_ring_full_cnt;
  1211. /* Num rx suspend is attempted */
  1212. uint32_t rx_suspend_cnt;
  1213. /* Num rx suspend failed */
  1214. uint32_t rx_suspend_fail_cnt;
  1215. /* Num rx resume attempted */
  1216. uint32_t rx_resume_cnt;
  1217. /* Num rx resume failed */
  1218. uint32_t rx_resume_fail_cnt;
  1219. /* Num rx ring switch */
  1220. uint32_t rx_ring_switch_cnt;
  1221. /* Num rx ring restore */
  1222. uint32_t rx_ring_restore_cnt;
  1223. /* Num rx flush issued */
  1224. uint32_t rx_flush_cnt;
  1225. };
  1226. /* == TX PDEV STATS == */
  1227. struct cdp_htt_tx_pdev_stats_cmn_tlv {
  1228. struct cdp_htt_tlv_hdr tlv_hdr;
  1229. /* BIT [ 7 : 0] :- mac_id
  1230. * BIT [31 : 8] :- reserved
  1231. */
  1232. uint32_t mac_id__word;
  1233. /* Num queued to HW */
  1234. uint32_t hw_queued;
  1235. /* Num PPDU reaped from HW */
  1236. uint32_t hw_reaped;
  1237. /* Num underruns */
  1238. uint32_t underrun;
  1239. /* Num HW Paused counter. */
  1240. uint32_t hw_paused;
  1241. /* Num HW flush counter. */
  1242. uint32_t hw_flush;
  1243. /* Num HW filtered counter. */
  1244. uint32_t hw_filt;
  1245. /* Num PPDUs cleaned up in TX abort */
  1246. uint32_t tx_abort;
  1247. /* Num MPDUs requed by SW */
  1248. uint32_t mpdu_requed;
  1249. /* excessive retries */
  1250. uint32_t tx_xretry;
  1251. /* Last used data hw rate code */
  1252. uint32_t data_rc;
  1253. /* frames dropped due to excessive sw retries */
  1254. uint32_t mpdu_dropped_xretry;
  1255. /* illegal rate phy errors */
  1256. uint32_t illgl_rate_phy_err;
  1257. /* wal pdev continuous xretry */
  1258. uint32_t cont_xretry;
  1259. /* wal pdev continuous xretry */
  1260. uint32_t tx_timeout;
  1261. /* wal pdev resets */
  1262. uint32_t pdev_resets;
  1263. /* PhY/BB underrun */
  1264. uint32_t phy_underrun;
  1265. /* MPDU is more than txop limit */
  1266. uint32_t txop_ovf;
  1267. /* Number of Sequences posted */
  1268. uint32_t seq_posted;
  1269. /* Number of Sequences failed queueing */
  1270. uint32_t seq_failed_queueing;
  1271. /* Number of Sequences completed */
  1272. uint32_t seq_completed;
  1273. /* Number of Sequences restarted */
  1274. uint32_t seq_restarted;
  1275. /* Number of MU Sequences posted */
  1276. uint32_t mu_seq_posted;
  1277. /* Number of time HW ring is paused between seq switch within ISR */
  1278. uint32_t seq_switch_hw_paused;
  1279. /* Number of times seq continuation in DSR */
  1280. uint32_t next_seq_posted_dsr;
  1281. /* Number of times seq continuation in ISR */
  1282. uint32_t seq_posted_isr;
  1283. /* Number of seq_ctrl cached. */
  1284. uint32_t seq_ctrl_cached;
  1285. /* Number of MPDUs successfully transmitted */
  1286. uint32_t mpdu_count_tqm;
  1287. /* Number of MSDUs successfully transmitted */
  1288. uint32_t msdu_count_tqm;
  1289. /* Number of MPDUs dropped */
  1290. uint32_t mpdu_removed_tqm;
  1291. /* Number of MSDUs dropped */
  1292. uint32_t msdu_removed_tqm;
  1293. /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
  1294. uint32_t mpdus_sw_flush;
  1295. /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
  1296. uint32_t mpdus_hw_filter;
  1297. /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
  1298. uint32_t mpdus_truncated;
  1299. /* Num MPDUs that was tried but didn't receive ACK or BA */
  1300. uint32_t mpdus_ack_failed;
  1301. /* Num MPDUs that was dropped due to expiry (MSDU TTL). */
  1302. uint32_t mpdus_expired;
  1303. /* Num MPDUs that was retried within seq_ctrl (MGMT/LEGACY) */
  1304. uint32_t mpdus_seq_hw_retry;
  1305. /* Num of TQM acked cmds processed */
  1306. uint32_t ack_tlv_proc;
  1307. /* coex_abort_mpdu_cnt valid. */
  1308. uint32_t coex_abort_mpdu_cnt_valid;
  1309. /* coex_abort_mpdu_cnt from TX FES stats. */
  1310. uint32_t coex_abort_mpdu_cnt;
  1311. /* Number of total PPDUs(DATA, MGMT, excludes selfgen) tried over the air (OTA) */
  1312. uint32_t num_total_ppdus_tried_ota;
  1313. /* Number of data PPDUs tried over the air (OTA) */
  1314. uint32_t num_data_ppdus_tried_ota;
  1315. /* Num Local control/mgmt frames (MSDUs) queued */
  1316. uint32_t local_ctrl_mgmt_enqued;
  1317. /* local_ctrl_mgmt_freed:
  1318. * Num Local control/mgmt frames (MSDUs) done
  1319. * It includes all local ctrl/mgmt completions
  1320. * (acked, no ack, flush, TTL, etc)
  1321. */
  1322. uint32_t local_ctrl_mgmt_freed;
  1323. /* Num Local data frames (MSDUs) queued */
  1324. uint32_t local_data_enqued;
  1325. /* local_data_freed:
  1326. * Num Local data frames (MSDUs) done
  1327. * It includes all local data completions
  1328. * (acked, no ack, flush, TTL, etc)
  1329. */
  1330. uint32_t local_data_freed;
  1331. /* Num MPDUs tried by SW */
  1332. uint32_t mpdu_tried;
  1333. /* Num of waiting seq posted in isr completion handler */
  1334. uint32_t isr_wait_seq_posted;
  1335. uint32_t tx_active_dur_us_low;
  1336. uint32_t tx_active_dur_us_high;
  1337. };
  1338. struct cdp_htt_tx_pdev_stats_urrn_tlv_v {
  1339. struct cdp_htt_tlv_hdr tlv_hdr;
  1340. uint32_t urrn_stats[1]; /* HTT_TX_PDEV_MAX_URRN_STATS */
  1341. };
  1342. /* NOTE: Variable length TLV, use length spec to infer array size */
  1343. struct cdp_htt_tx_pdev_stats_flush_tlv_v {
  1344. struct cdp_htt_tlv_hdr tlv_hdr;
  1345. uint32_t flush_errs[1]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */
  1346. };
  1347. /* NOTE: Variable length TLV, use length spec to infer array size */
  1348. struct cdp_htt_tx_pdev_stats_sifs_tlv_v {
  1349. struct cdp_htt_tlv_hdr tlv_hdr;
  1350. uint32_t sifs_status[1]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */
  1351. };
  1352. /* NOTE: Variable length TLV, use length spec to infer array size */
  1353. struct cdp_htt_tx_pdev_stats_phy_err_tlv_v {
  1354. struct cdp_htt_tlv_hdr tlv_hdr;
  1355. uint32_t phy_errs[1]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */
  1356. };
  1357. /* == RX PDEV/SOC STATS == */
  1358. /* HTT_STATS_RX_SOC_FW_STATS_TAG */
  1359. struct cdp_htt_rx_soc_fw_stats_tlv {
  1360. struct cdp_htt_tlv_hdr tlv_hdr;
  1361. /* Num Packets received on REO FW ring */
  1362. uint32_t fw_reo_ring_data_msdu;
  1363. /* Num bc/mc packets indicated from fw to host */
  1364. uint32_t fw_to_host_data_msdu_bcmc;
  1365. /* Num unicast packets indicated from fw to host */
  1366. uint32_t fw_to_host_data_msdu_uc;
  1367. /* Num remote buf recycle from offload */
  1368. uint32_t ofld_remote_data_buf_recycle_cnt;
  1369. /* Num remote free buf given to offload */
  1370. uint32_t ofld_remote_free_buf_indication_cnt;
  1371. };
  1372. struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v {
  1373. struct cdp_htt_tlv_hdr tlv_hdr;
  1374. /* Num total buf refilled from refill ring */
  1375. uint32_t refill_ring_num_refill[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
  1376. };
  1377. struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v {
  1378. struct cdp_htt_tlv_hdr tlv_hdr;
  1379. /* Num error MPDU for each RxDMA error type */
  1380. uint32_t fw_ring_mpdu_err[1]; /* HTT_RX_STATS_RXDMA_MAX_ERR */
  1381. };
  1382. struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v {
  1383. struct cdp_htt_tlv_hdr tlv_hdr;
  1384. /* Num MPDU dropped */
  1385. uint32_t fw_mpdu_drop[1]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */
  1386. };
  1387. #define HTT_STATS_PHY_ERR_MAX 43
  1388. struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv {
  1389. struct cdp_htt_tlv_hdr tlv_hdr;
  1390. /* BIT [ 7 : 0] :- mac_id
  1391. * BIT [31 : 8] :- reserved
  1392. */
  1393. uint32_t mac_id__word;
  1394. /* Num of phy err */
  1395. uint32_t total_phy_err_cnt;
  1396. /* Counts of different types of phy errs
  1397. * The mapping of PHY error types to phy_err array elements is HW dependent.
  1398. * The only currently-supported mapping is shown below:
  1399. *
  1400. * 0 phyrx_err_phy_off Reception aborted due to receiving a PHY_OFF TLV
  1401. * 1 phyrx_err_synth_off
  1402. * 2 phyrx_err_ofdma_timing
  1403. * 3 phyrx_err_ofdma_signal_parity
  1404. * 4 phyrx_err_ofdma_rate_illegal
  1405. * 5 phyrx_err_ofdma_length_illegal
  1406. * 6 phyrx_err_ofdma_restart
  1407. * 7 phyrx_err_ofdma_service
  1408. * 8 phyrx_err_ppdu_ofdma_power_drop
  1409. * 9 phyrx_err_cck_blokker
  1410. * 10 phyrx_err_cck_timing
  1411. * 11 phyrx_err_cck_header_crc
  1412. * 12 phyrx_err_cck_rate_illegal
  1413. * 13 phyrx_err_cck_length_illegal
  1414. * 14 phyrx_err_cck_restart
  1415. * 15 phyrx_err_cck_service
  1416. * 16 phyrx_err_cck_power_drop
  1417. * 17 phyrx_err_ht_crc_err
  1418. * 18 phyrx_err_ht_length_illegal
  1419. * 19 phyrx_err_ht_rate_illegal
  1420. * 20 phyrx_err_ht_zlf
  1421. * 21 phyrx_err_false_radar_ext
  1422. * 22 phyrx_err_green_field
  1423. * 23 phyrx_err_bw_gt_dyn_bw
  1424. * 24 phyrx_err_leg_ht_mismatch
  1425. * 25 phyrx_err_vht_crc_error
  1426. * 26 phyrx_err_vht_siga_unsupported
  1427. * 27 phyrx_err_vht_lsig_len_invalid
  1428. * 28 phyrx_err_vht_ndp_or_zlf
  1429. * 29 phyrx_err_vht_nsym_lt_zero
  1430. * 30 phyrx_err_vht_rx_extra_symbol_mismatch
  1431. * 31 phyrx_err_vht_rx_skip_group_id0
  1432. * 32 phyrx_err_vht_rx_skip_group_id1to62
  1433. * 33 phyrx_err_vht_rx_skip_group_id63
  1434. * 34 phyrx_err_ofdm_ldpc_decoder_disabled
  1435. * 35 phyrx_err_defer_nap
  1436. * 36 phyrx_err_fdomain_timeout
  1437. * 37 phyrx_err_lsig_rel_check
  1438. * 38 phyrx_err_bt_collision
  1439. * 39 phyrx_err_unsupported_mu_feedback
  1440. * 40 phyrx_err_ppdu_tx_interrupt_rx
  1441. * 41 phyrx_err_unsupported_cbf
  1442. * 42 phyrx_err_other
  1443. */
  1444. uint32_t phy_err[HTT_STATS_PHY_ERR_MAX];
  1445. };
  1446. struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v {
  1447. struct cdp_htt_tlv_hdr tlv_hdr;
  1448. /* Num ring empty encountered */
  1449. uint32_t refill_ring_empty_cnt[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
  1450. };
  1451. struct cdp_htt_tx_pdev_stats {
  1452. struct cdp_htt_tx_pdev_stats_cmn_tlv cmn_tlv;
  1453. struct cdp_htt_tx_pdev_stats_urrn_tlv_v underrun_tlv;
  1454. struct cdp_htt_tx_pdev_stats_sifs_tlv_v sifs_tlv;
  1455. struct cdp_htt_tx_pdev_stats_flush_tlv_v flush_tlv;
  1456. struct cdp_htt_tx_pdev_stats_phy_err_tlv_v phy_err_tlv;
  1457. };
  1458. struct cdp_htt_rx_soc_stats_t {
  1459. struct cdp_htt_rx_soc_fw_stats_tlv fw_tlv;
  1460. struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v fw_refill_ring_empty_tlv;
  1461. struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v fw_refill_ring_num_refill_tlv;
  1462. };
  1463. struct cdp_htt_rx_pdev_stats {
  1464. struct cdp_htt_rx_soc_stats_t soc_stats;
  1465. struct cdp_htt_rx_pdev_fw_stats_tlv fw_stats_tlv;
  1466. struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v fw_ring_mpdu_err_tlv;
  1467. struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v fw_ring_mpdu_drop;
  1468. struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv fw_stats_phy_err_tlv;
  1469. };
  1470. #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
  1471. /* Since protocol type enumeration value is passed as CCE metadata
  1472. * to firmware, add a constant offset before passing it to firmware
  1473. */
  1474. #define RX_PROTOCOL_TAG_START_OFFSET 128
  1475. /* This should align with packet type enumerations in ieee80211_ioctl.h
  1476. * and wmi_unified_param.h files
  1477. */
  1478. #define RX_PROTOCOL_TAG_MAX 24
  1479. /* Macro that should be used to dump the statistics counter for all
  1480. * protocol types
  1481. */
  1482. #define RX_PROTOCOL_TAG_ALL 0xff
  1483. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
  1484. #define OFDMA_NUM_RU_SIZE 7
  1485. #define OFDMA_NUM_USERS 37
  1486. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  1487. /*
  1488. * mac_freeze_capture_reason - capture reason counters
  1489. * @FREEZE_REASON_TM: When m_directed_ftm is enabled, this CFR data is
  1490. * captured for a Timing Measurement (TM) frame.
  1491. * @FREEZE_REASON_FTM: When m_directed_ftm is enabled, this CFR data is
  1492. * captured for a Fine Timing Measurement (FTM) frame.
  1493. * @FREEZE_REASON_ACK_RESP_TO_TM_FTM: When m_all_ftm_ack is enabled, this CFR
  1494. * data is captured for an ACK received for the FTM/TM frame sent to a station.
  1495. * @FREEZE_REASON_TA_RA_TYPE_FILTER: When m_ta_ra_filter is enabled, this CFR
  1496. * data is captured for a PPDU received,since the CFR TA_RA filter is met.
  1497. * @FREEZE_REASON_NDPA_NDP: When m_ndpa_ndp_directed(or)m_ndpa_ndp_all is
  1498. * enabled, this CFR data is captured for an NDP frame received.
  1499. * @FREEZE_REASON_ALL_PACKET: When m_all_packet is enabled, this CFR data is
  1500. * captured for an incoming PPDU.
  1501. */
  1502. enum mac_freeze_capture_reason {
  1503. FREEZE_REASON_TM = 0,
  1504. FREEZE_REASON_FTM,
  1505. FREEZE_REASON_ACK_RESP_TO_TM_FTM,
  1506. FREEZE_REASON_TA_RA_TYPE_FILTER,
  1507. FREEZE_REASON_NDPA_NDP,
  1508. FREEZE_REASON_ALL_PACKET,
  1509. FREEZE_REASON_MAX,
  1510. };
  1511. /*
  1512. * chan_capture_status: capture status counters
  1513. * @CAPTURE_IDLE: CFR data is not captured, since VCSR setting for CFR/RCC is
  1514. * not enabled.
  1515. * @CAPTURE_BUSY: CFR data is not available, since previous channel
  1516. * upload is in progress
  1517. * @CAPTURE_ACTIVE: CFR data is captured in HW registers
  1518. * @CAPTURE_NO_BUFFER: CFR data is not captured, since no buffer is available
  1519. * in IPC ring to DMA CFR data
  1520. */
  1521. enum chan_capture_status {
  1522. CAPTURE_IDLE = 0,
  1523. CAPTURE_BUSY,
  1524. CAPTURE_ACTIVE,
  1525. CAPTURE_NO_BUFFER,
  1526. CAPTURE_MAX,
  1527. };
  1528. /* struct cdp_cfr_rcc_stats - CFR RCC debug statistics
  1529. * @bb_captured_channel_cnt: No. of PPDUs for which MAC sent Freeze TLV to PHY
  1530. * @bb_captured_timeout_cnt: No. of PPDUs for which CFR filter criteria matched
  1531. * but MAC did not send Freeze TLV to PHY as time exceeded freeze tlv delay
  1532. * count threshold
  1533. * @rx_loc_info_valid_cnt: No. of PPDUs for which PHY could find a valid buffer
  1534. * in ucode IPC ring
  1535. * @chan_capture_status[]: capture status counters
  1536. * [0] - No. of PPDUs with capture status CAPTURE_IDLE
  1537. * [1] - No. of PPDUs with capture status CAPTURE_BUSY
  1538. * [2] - No. of PPDUs with capture status CAPTURE_ACTIVE
  1539. * [3] - No. of PPDUs with capture status CAPTURE_NO_BUFFER
  1540. * @reason_cnt[]: capture reason counters
  1541. * [0] - No. PPDUs filtered due to freeze_reason_TM
  1542. * [1] - No. PPDUs filtered due to freeze_reason_FTM
  1543. * [2] - No. PPDUs filtered due to freeze_reason_ACK_resp_to_TM_FTM
  1544. * [3] - No. PPDUs filtered due to freeze_reason_TA_RA_TYPE_FILTER
  1545. * [4] - No. PPDUs filtered due to freeze_reason_NDPA_NDP
  1546. * [5] - No. PPDUs filtered due to freeze_reason_ALL_PACKET
  1547. */
  1548. struct cdp_cfr_rcc_stats {
  1549. uint64_t bb_captured_channel_cnt;
  1550. uint64_t bb_captured_timeout_cnt;
  1551. uint64_t rx_loc_info_valid_cnt;
  1552. uint64_t chan_capture_status[CAPTURE_MAX];
  1553. uint64_t reason_cnt[FREEZE_REASON_MAX];
  1554. };
  1555. #else
  1556. struct cdp_cfr_rcc_stats {
  1557. };
  1558. #endif
  1559. /* struct cdp_pdev_stats - pdev stats
  1560. * @msdu_not_done: packets dropped because msdu done bit not set
  1561. * @mec:Multicast Echo check
  1562. * @mesh_filter: Mesh Filtered packets
  1563. * @mon_rx_drop: packets dropped on monitor vap
  1564. * @wifi_parse: rxdma errors due to wifi parse error
  1565. * @mon_radiotap_update_err: not enough space to update radiotap
  1566. * @pkts: total packets replenished
  1567. * @rxdma_err: rxdma errors for replenished
  1568. * @nbuf_alloc_fail: nbuf alloc failed
  1569. * @map_err: Mapping failure
  1570. * @x86_fail: x86 failures
  1571. * @low_thresh_intrs: low threshold interrupts
  1572. * @rx_raw_pkts: Rx Raw Packets
  1573. * @mesh_mem_alloc: Mesh Rx Stats Alloc fail
  1574. * @tso_desc_cnt: TSO descriptors
  1575. * @sg_desc_cnt: SG Descriptors
  1576. * @vlan_tag_stp_cnt: Vlan tagged Stp packets in wifi parse error
  1577. * @desc_alloc_fail: desc alloc failed errors
  1578. * @ip_csum_err: ip checksum errors
  1579. * @tcp_udp_csum_err: tcp/udp checksum errors
  1580. * @buf_freelist: buffers added back in freelist
  1581. * @tx_i: Tx Ingress stats
  1582. * @tx:CDP Tx Stats
  1583. * @rx: CDP Rx Stats
  1584. * @tx_comp_histogram: Number of Tx completions per interrupt
  1585. * @rx_ind_histogram: Number of Rx ring descriptors reaped per interrupt
  1586. * @ppdu_stats_counter: ppdu stats counter
  1587. * @cdp_delayed_ba_not_recev: counter for delayed ba not received
  1588. * @htt_tx_pdev_stats: htt pdev stats for tx
  1589. * @htt_rx_pdev_stats: htt pdev stats for rx
  1590. * @data_rx_ru_size: UL ofdma data ru size counter array
  1591. * @nondata_rx_ru_size: UL ofdma non data ru size counter array
  1592. * @data_rx_ppdu: data rx ppdu counter
  1593. * @data_user: data user counter array
  1594. * @tx_ppdu_proc: stats counter for tx ppdu processed
  1595. * @ack_ba_comes_twice: stats counter for ack_ba_comes twice
  1596. * @ppdu_drop: stats counter for ppdu_desc drop once threshold reached
  1597. * @ppdu_wrap_drop: stats counter for ppdu desc drop on wrap around
  1598. */
  1599. struct cdp_pdev_stats {
  1600. struct {
  1601. uint32_t msdu_not_done;
  1602. uint32_t mec;
  1603. uint32_t mesh_filter;
  1604. uint32_t wifi_parse;
  1605. /* Monitor mode related */
  1606. uint32_t mon_rx_drop;
  1607. uint32_t mon_radiotap_update_err;
  1608. } dropped;
  1609. struct {
  1610. struct cdp_pkt_info pkts;
  1611. uint32_t rxdma_err;
  1612. uint32_t nbuf_alloc_fail;
  1613. uint32_t map_err;
  1614. uint32_t x86_fail;
  1615. uint32_t low_thresh_intrs;
  1616. } replenish;
  1617. uint32_t rx_raw_pkts;
  1618. uint32_t mesh_mem_alloc;
  1619. uint32_t tso_desc_cnt;
  1620. uint32_t sg_desc_cnt;
  1621. uint32_t vlan_tag_stp_cnt;
  1622. /* Rx errors */
  1623. struct {
  1624. uint32_t desc_alloc_fail;
  1625. uint32_t ip_csum_err;
  1626. uint32_t tcp_udp_csum_err;
  1627. uint32_t rxdma_error;
  1628. uint32_t reo_error;
  1629. } err;
  1630. uint32_t buf_freelist;
  1631. struct cdp_tx_ingress_stats tx_i;
  1632. struct cdp_tx_stats tx;
  1633. struct cdp_rx_stats rx;
  1634. struct cdp_hist_tx_comp tx_comp_histogram;
  1635. struct cdp_hist_rx_ind rx_ind_histogram;
  1636. uint64_t ppdu_stats_counter[CDP_PPDU_STATS_MAX_TAG];
  1637. uint32_t cdp_delayed_ba_not_recev;
  1638. struct cdp_htt_tx_pdev_stats htt_tx_pdev_stats;
  1639. struct cdp_htt_rx_pdev_stats htt_rx_pdev_stats;
  1640. /* Received wdi messages from fw */
  1641. uint32_t wdi_event[CDP_WDI_NUM_EVENTS];
  1642. struct cdp_tid_stats tid_stats;
  1643. /* numbers of data/nondata per RU sizes */
  1644. struct {
  1645. uint32_t data_rx_ru_size[OFDMA_NUM_RU_SIZE];
  1646. uint32_t nondata_rx_ru_size[OFDMA_NUM_RU_SIZE];
  1647. uint32_t data_rx_ppdu;
  1648. uint32_t data_users[OFDMA_NUM_USERS];
  1649. } ul_ofdma;
  1650. struct cdp_tso_stats tso_stats;
  1651. struct cdp_cfr_rcc_stats rcc;
  1652. uint64_t tx_ppdu_proc;
  1653. uint64_t ack_ba_comes_twice;
  1654. uint64_t ppdu_drop;
  1655. uint64_t ppdu_wrap_drop;
  1656. struct {
  1657. uint64_t num_bufs_consumed;
  1658. uint64_t num_pool_bufs_replenish;
  1659. uint64_t num_bufs_alloc_success;
  1660. } rx_buffer_pool;
  1661. };
  1662. /* struct cdp_peer_hmwds_ast_add_status - hmwds peer ast add status
  1663. * @vdev_id: vdev id
  1664. * @status: ast add status
  1665. * @peer_mac: peer mac address
  1666. * @ast_mac: ast node mac address
  1667. */
  1668. struct cdp_peer_hmwds_ast_add_status {
  1669. uint32_t vdev_id;
  1670. uint32_t status;
  1671. uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
  1672. uint8_t ast_mac[QDF_MAC_ADDR_SIZE];
  1673. };
  1674. enum cdp_soc_param_t {
  1675. DP_SOC_PARAM_MSDU_EXCEPTION_DESC,
  1676. DP_SOC_PARAM_MAX,
  1677. };
  1678. #ifdef QCA_ENH_V3_STATS_SUPPORT
  1679. /*
  1680. * Enumeration of PDEV Configuration parameter
  1681. */
  1682. enum _dp_param_t {
  1683. DP_PARAM_MSDU_TTL,
  1684. DP_PARAM_TOTAL_Q_SIZE_RANGE0,
  1685. DP_PARAM_TOTAL_Q_SIZE_RANGE1,
  1686. DP_PARAM_TOTAL_Q_SIZE_RANGE2,
  1687. DP_PARAM_TOTAL_Q_SIZE_RANGE3,
  1688. DP_PARAM_VIDEO_DELAY_STATS_FC,
  1689. DP_PARAM_QFLUSHINTERVAL,
  1690. DP_PARAM_TOTAL_Q_SIZE,
  1691. DP_PARAM_MIN_THRESHOLD,
  1692. DP_PARAM_MAX_Q_LIMIT,
  1693. DP_PARAM_MIN_Q_LIMIT,
  1694. DP_PARAM_CONG_CTRL_TIMER_INTV,
  1695. DP_PARAM_STATS_TIMER_INTV,
  1696. DP_PARAM_ROTTING_TIMER_INTV,
  1697. DP_PARAM_LATENCY_PROFILE,
  1698. DP_PARAM_HOSTQ_DUMP,
  1699. DP_PARAM_TIDQ_MAP,
  1700. DP_PARAM_VIDEO_STATS_FC,
  1701. DP_PARAM_STATS_FC,
  1702. DP_PARAM_MAX,
  1703. };
  1704. #endif
  1705. /* Bitmasks for stats that can block */
  1706. #define EXT_TXRX_FW_STATS 0x0001
  1707. #endif