cdp_txrx_stats_struct.h 54 KB

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