cdp_txrx_stats_struct.h 53 KB

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