dp_internal.h 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496
  1. /*
  2. * Copyright (c) 2016-2019 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. #ifndef _DP_INTERNAL_H_
  19. #define _DP_INTERNAL_H_
  20. #include "dp_types.h"
  21. #define RX_BUFFER_SIZE_PKTLOG_LITE 1024
  22. #define DP_RSSI_INVAL 0x80
  23. #define DP_RSSI_AVG_WEIGHT 2
  24. /*
  25. * Formula to derive avg_rssi is taken from wifi2.o firmware
  26. */
  27. #define DP_GET_AVG_RSSI(avg_rssi, last_rssi) \
  28. (((avg_rssi) - (((uint8_t)(avg_rssi)) >> DP_RSSI_AVG_WEIGHT)) \
  29. + ((((uint8_t)(last_rssi)) >> DP_RSSI_AVG_WEIGHT)))
  30. /* Macro For NYSM value received in VHT TLV */
  31. #define VHT_SGI_NYSM 3
  32. /* PPDU STATS CFG */
  33. #define DP_PPDU_STATS_CFG_ALL 0xFFFF
  34. /* PPDU stats mask sent to FW to enable enhanced stats */
  35. #define DP_PPDU_STATS_CFG_ENH_STATS 0xE67
  36. /* PPDU stats mask sent to FW to support debug sniffer feature */
  37. #define DP_PPDU_STATS_CFG_SNIFFER 0x2FFF
  38. /* PPDU stats mask sent to FW to support BPR feature*/
  39. #define DP_PPDU_STATS_CFG_BPR 0x2000
  40. /* PPDU stats mask sent to FW to support BPR and enhanced stats feature */
  41. #define DP_PPDU_STATS_CFG_BPR_ENH (DP_PPDU_STATS_CFG_BPR | \
  42. DP_PPDU_STATS_CFG_ENH_STATS)
  43. /* PPDU stats mask sent to FW to support BPR and pcktlog stats feature */
  44. #define DP_PPDU_STATS_CFG_BPR_PKTLOG (DP_PPDU_STATS_CFG_BPR | \
  45. DP_PPDU_TXLITE_STATS_BITMASK_CFG)
  46. /**
  47. * Bitmap of HTT PPDU TLV types for Default mode
  48. */
  49. #define HTT_PPDU_DEFAULT_TLV_BITMAP \
  50. (1 << HTT_PPDU_STATS_COMMON_TLV) | \
  51. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  52. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  53. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  54. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  55. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV)
  56. /**
  57. * Bitmap of HTT PPDU delayed ba TLV types for Default mode
  58. */
  59. #define HTT_PPDU_DELAYED_BA_TLV_BITMAP \
  60. (1 << HTT_PPDU_STATS_COMMON_TLV) | \
  61. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  62. (1 << HTT_PPDU_STATS_USR_RATE_TLV)
  63. /**
  64. * Bitmap of HTT PPDU TLV types for Delayed BA
  65. */
  66. #define HTT_PPDU_STATUS_TLV_BITMAP \
  67. (1 << HTT_PPDU_STATS_COMMON_TLV) | \
  68. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV)
  69. /**
  70. * Bitmap of HTT PPDU TLV types for Sniffer mode bitmap 64
  71. */
  72. #define HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_64 \
  73. ((1 << HTT_PPDU_STATS_COMMON_TLV) | \
  74. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  75. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  76. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  77. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  78. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV) | \
  79. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_64_TLV) | \
  80. (1 << HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_64_TLV))
  81. /**
  82. * Bitmap of HTT PPDU TLV types for Sniffer mode bitmap 256
  83. */
  84. #define HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_256 \
  85. ((1 << HTT_PPDU_STATS_COMMON_TLV) | \
  86. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  87. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  88. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  89. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  90. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV) | \
  91. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV) | \
  92. (1 << HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_256_TLV))
  93. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  94. extern uint8_t
  95. dp_cpu_ring_map[DP_NSS_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS_MAX];
  96. #endif
  97. #if DP_PRINT_ENABLE
  98. #include <stdarg.h> /* va_list */
  99. #include <qdf_types.h> /* qdf_vprint */
  100. #include <cdp_txrx_handle.h>
  101. enum {
  102. /* FATAL_ERR - print only irrecoverable error messages */
  103. DP_PRINT_LEVEL_FATAL_ERR,
  104. /* ERR - include non-fatal err messages */
  105. DP_PRINT_LEVEL_ERR,
  106. /* WARN - include warnings */
  107. DP_PRINT_LEVEL_WARN,
  108. /* INFO1 - include fundamental, infrequent events */
  109. DP_PRINT_LEVEL_INFO1,
  110. /* INFO2 - include non-fundamental but infrequent events */
  111. DP_PRINT_LEVEL_INFO2,
  112. };
  113. #define dp_print(level, fmt, ...) do { \
  114. if (level <= g_txrx_print_level) \
  115. qdf_print(fmt, ## __VA_ARGS__); \
  116. while (0)
  117. #define DP_PRINT(level, fmt, ...) do { \
  118. dp_print(level, "DP: " fmt, ## __VA_ARGS__); \
  119. while (0)
  120. #else
  121. #define DP_PRINT(level, fmt, ...)
  122. #endif /* DP_PRINT_ENABLE */
  123. #define DP_TRACE(LVL, fmt, args ...) \
  124. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \
  125. fmt, ## args)
  126. #ifdef DP_PRINT_NO_CONSOLE
  127. /* Stat prints should not go to console or kernel logs.*/
  128. #define DP_PRINT_STATS(fmt, args ...)\
  129. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, \
  130. fmt, ## args)
  131. #else
  132. #define DP_PRINT_STATS(fmt, args ...)\
  133. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,\
  134. fmt, ## args)
  135. #endif
  136. #define DP_STATS_INIT(_handle) \
  137. qdf_mem_zero(&((_handle)->stats), sizeof((_handle)->stats))
  138. #define DP_STATS_CLR(_handle) \
  139. qdf_mem_zero(&((_handle)->stats), sizeof((_handle)->stats))
  140. #ifndef DISABLE_DP_STATS
  141. #define DP_STATS_INC(_handle, _field, _delta) \
  142. { \
  143. if (likely(_handle)) \
  144. _handle->stats._field += _delta; \
  145. }
  146. #define DP_STATS_INCC(_handle, _field, _delta, _cond) \
  147. { \
  148. if (_cond && likely(_handle)) \
  149. _handle->stats._field += _delta; \
  150. }
  151. #define DP_STATS_DEC(_handle, _field, _delta) \
  152. { \
  153. if (likely(_handle)) \
  154. _handle->stats._field -= _delta; \
  155. }
  156. #define DP_STATS_UPD(_handle, _field, _delta) \
  157. { \
  158. if (likely(_handle)) \
  159. _handle->stats._field = _delta; \
  160. }
  161. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes) \
  162. { \
  163. DP_STATS_INC(_handle, _field.num, _count); \
  164. DP_STATS_INC(_handle, _field.bytes, _bytes) \
  165. }
  166. #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond) \
  167. { \
  168. DP_STATS_INCC(_handle, _field.num, _count, _cond); \
  169. DP_STATS_INCC(_handle, _field.bytes, _bytes, _cond) \
  170. }
  171. #define DP_STATS_AGGR(_handle_a, _handle_b, _field) \
  172. { \
  173. _handle_a->stats._field += _handle_b->stats._field; \
  174. }
  175. #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field) \
  176. { \
  177. DP_STATS_AGGR(_handle_a, _handle_b, _field.num); \
  178. DP_STATS_AGGR(_handle_a, _handle_b, _field.bytes);\
  179. }
  180. #define DP_STATS_UPD_STRUCT(_handle_a, _handle_b, _field) \
  181. { \
  182. _handle_a->stats._field = _handle_b->stats._field; \
  183. }
  184. #else
  185. #define DP_STATS_INC(_handle, _field, _delta)
  186. #define DP_STATS_INCC(_handle, _field, _delta, _cond)
  187. #define DP_STATS_DEC(_handle, _field, _delta)
  188. #define DP_STATS_UPD(_handle, _field, _delta)
  189. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes)
  190. #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond)
  191. #define DP_STATS_AGGR(_handle_a, _handle_b, _field)
  192. #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field)
  193. #endif
  194. #ifdef ENABLE_DP_HIST_STATS
  195. #define DP_HIST_INIT() \
  196. uint32_t num_of_packets[MAX_PDEV_CNT] = {0};
  197. #define DP_HIST_PACKET_COUNT_INC(_pdev_id) \
  198. { \
  199. ++num_of_packets[_pdev_id]; \
  200. }
  201. #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \
  202. do { \
  203. if (_p_cntrs == 1) { \
  204. DP_STATS_INC(_pdev, \
  205. tx_comp_histogram.pkts_1, 1); \
  206. } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \
  207. DP_STATS_INC(_pdev, \
  208. tx_comp_histogram.pkts_2_20, 1); \
  209. } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \
  210. DP_STATS_INC(_pdev, \
  211. tx_comp_histogram.pkts_21_40, 1); \
  212. } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \
  213. DP_STATS_INC(_pdev, \
  214. tx_comp_histogram.pkts_41_60, 1); \
  215. } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \
  216. DP_STATS_INC(_pdev, \
  217. tx_comp_histogram.pkts_61_80, 1); \
  218. } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \
  219. DP_STATS_INC(_pdev, \
  220. tx_comp_histogram.pkts_81_100, 1); \
  221. } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \
  222. DP_STATS_INC(_pdev, \
  223. tx_comp_histogram.pkts_101_200, 1); \
  224. } else if (_p_cntrs > 200) { \
  225. DP_STATS_INC(_pdev, \
  226. tx_comp_histogram.pkts_201_plus, 1); \
  227. } \
  228. } while (0)
  229. #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \
  230. do { \
  231. if (_p_cntrs == 1) { \
  232. DP_STATS_INC(_pdev, \
  233. rx_ind_histogram.pkts_1, 1); \
  234. } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \
  235. DP_STATS_INC(_pdev, \
  236. rx_ind_histogram.pkts_2_20, 1); \
  237. } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \
  238. DP_STATS_INC(_pdev, \
  239. rx_ind_histogram.pkts_21_40, 1); \
  240. } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \
  241. DP_STATS_INC(_pdev, \
  242. rx_ind_histogram.pkts_41_60, 1); \
  243. } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \
  244. DP_STATS_INC(_pdev, \
  245. rx_ind_histogram.pkts_61_80, 1); \
  246. } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \
  247. DP_STATS_INC(_pdev, \
  248. rx_ind_histogram.pkts_81_100, 1); \
  249. } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \
  250. DP_STATS_INC(_pdev, \
  251. rx_ind_histogram.pkts_101_200, 1); \
  252. } else if (_p_cntrs > 200) { \
  253. DP_STATS_INC(_pdev, \
  254. rx_ind_histogram.pkts_201_plus, 1); \
  255. } \
  256. } while (0)
  257. #define DP_TX_HIST_STATS_PER_PDEV() \
  258. do { \
  259. uint8_t hist_stats = 0; \
  260. for (hist_stats = 0; hist_stats < soc->pdev_count; \
  261. hist_stats++) { \
  262. DP_TX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \
  263. num_of_packets[hist_stats]); \
  264. } \
  265. } while (0)
  266. #define DP_RX_HIST_STATS_PER_PDEV() \
  267. do { \
  268. uint8_t hist_stats = 0; \
  269. for (hist_stats = 0; hist_stats < soc->pdev_count; \
  270. hist_stats++) { \
  271. DP_RX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \
  272. num_of_packets[hist_stats]); \
  273. } \
  274. } while (0)
  275. #else
  276. #define DP_HIST_INIT()
  277. #define DP_HIST_PACKET_COUNT_INC(_pdev_id)
  278. #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs)
  279. #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs)
  280. #define DP_RX_HIST_STATS_PER_PDEV()
  281. #define DP_TX_HIST_STATS_PER_PDEV()
  282. #endif
  283. #define DP_HTT_T2H_HP_PIPE 5
  284. static inline void dp_update_pdev_stats(struct dp_pdev *tgtobj,
  285. struct cdp_vdev_stats *srcobj)
  286. {
  287. uint8_t i;
  288. uint8_t pream_type;
  289. for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) {
  290. for (i = 0; i < MAX_MCS; i++) {
  291. tgtobj->stats.tx.pkt_type[pream_type].
  292. mcs_count[i] +=
  293. srcobj->tx.pkt_type[pream_type].
  294. mcs_count[i];
  295. tgtobj->stats.rx.pkt_type[pream_type].
  296. mcs_count[i] +=
  297. srcobj->rx.pkt_type[pream_type].
  298. mcs_count[i];
  299. }
  300. }
  301. for (i = 0; i < MAX_BW; i++) {
  302. tgtobj->stats.tx.bw[i] += srcobj->tx.bw[i];
  303. tgtobj->stats.rx.bw[i] += srcobj->rx.bw[i];
  304. }
  305. for (i = 0; i < SS_COUNT; i++) {
  306. tgtobj->stats.tx.nss[i] += srcobj->tx.nss[i];
  307. tgtobj->stats.rx.nss[i] += srcobj->rx.nss[i];
  308. }
  309. for (i = 0; i < WME_AC_MAX; i++) {
  310. tgtobj->stats.tx.wme_ac_type[i] +=
  311. srcobj->tx.wme_ac_type[i];
  312. tgtobj->stats.rx.wme_ac_type[i] +=
  313. srcobj->rx.wme_ac_type[i];
  314. tgtobj->stats.tx.excess_retries_per_ac[i] +=
  315. srcobj->tx.excess_retries_per_ac[i];
  316. }
  317. for (i = 0; i < MAX_GI; i++) {
  318. tgtobj->stats.tx.sgi_count[i] +=
  319. srcobj->tx.sgi_count[i];
  320. tgtobj->stats.rx.sgi_count[i] +=
  321. srcobj->rx.sgi_count[i];
  322. }
  323. for (i = 0; i < MAX_RECEPTION_TYPES; i++)
  324. tgtobj->stats.rx.reception_type[i] +=
  325. srcobj->rx.reception_type[i];
  326. tgtobj->stats.tx.comp_pkt.bytes += srcobj->tx.comp_pkt.bytes;
  327. tgtobj->stats.tx.comp_pkt.num += srcobj->tx.comp_pkt.num;
  328. tgtobj->stats.tx.ucast.num += srcobj->tx.ucast.num;
  329. tgtobj->stats.tx.ucast.bytes += srcobj->tx.ucast.bytes;
  330. tgtobj->stats.tx.mcast.num += srcobj->tx.mcast.num;
  331. tgtobj->stats.tx.mcast.bytes += srcobj->tx.mcast.bytes;
  332. tgtobj->stats.tx.bcast.num += srcobj->tx.bcast.num;
  333. tgtobj->stats.tx.bcast.bytes += srcobj->tx.bcast.bytes;
  334. tgtobj->stats.tx.tx_success.num += srcobj->tx.tx_success.num;
  335. tgtobj->stats.tx.tx_success.bytes +=
  336. srcobj->tx.tx_success.bytes;
  337. tgtobj->stats.tx.nawds_mcast.num +=
  338. srcobj->tx.nawds_mcast.num;
  339. tgtobj->stats.tx.nawds_mcast.bytes +=
  340. srcobj->tx.nawds_mcast.bytes;
  341. tgtobj->stats.tx.nawds_mcast_drop +=
  342. srcobj->tx.nawds_mcast_drop;
  343. tgtobj->stats.tx.num_ppdu_cookie_valid +=
  344. srcobj->tx.num_ppdu_cookie_valid;
  345. tgtobj->stats.tx.tx_failed += srcobj->tx.tx_failed;
  346. tgtobj->stats.tx.ofdma += srcobj->tx.ofdma;
  347. tgtobj->stats.tx.stbc += srcobj->tx.stbc;
  348. tgtobj->stats.tx.ldpc += srcobj->tx.ldpc;
  349. tgtobj->stats.tx.retries += srcobj->tx.retries;
  350. tgtobj->stats.tx.non_amsdu_cnt += srcobj->tx.non_amsdu_cnt;
  351. tgtobj->stats.tx.amsdu_cnt += srcobj->tx.amsdu_cnt;
  352. tgtobj->stats.tx.non_ampdu_cnt += srcobj->tx.non_ampdu_cnt;
  353. tgtobj->stats.tx.ampdu_cnt += srcobj->tx.ampdu_cnt;
  354. tgtobj->stats.tx.dropped.fw_rem.num += srcobj->tx.dropped.fw_rem.num;
  355. tgtobj->stats.tx.dropped.fw_rem.bytes +=
  356. srcobj->tx.dropped.fw_rem.bytes;
  357. tgtobj->stats.tx.dropped.fw_rem_tx +=
  358. srcobj->tx.dropped.fw_rem_tx;
  359. tgtobj->stats.tx.dropped.fw_rem_notx +=
  360. srcobj->tx.dropped.fw_rem_notx;
  361. tgtobj->stats.tx.dropped.fw_reason1 +=
  362. srcobj->tx.dropped.fw_reason1;
  363. tgtobj->stats.tx.dropped.fw_reason2 +=
  364. srcobj->tx.dropped.fw_reason2;
  365. tgtobj->stats.tx.dropped.fw_reason3 +=
  366. srcobj->tx.dropped.fw_reason3;
  367. tgtobj->stats.tx.dropped.age_out += srcobj->tx.dropped.age_out;
  368. tgtobj->stats.rx.err.mic_err += srcobj->rx.err.mic_err;
  369. if (srcobj->rx.rssi != 0)
  370. tgtobj->stats.rx.rssi = srcobj->rx.rssi;
  371. tgtobj->stats.rx.rx_rate = srcobj->rx.rx_rate;
  372. tgtobj->stats.rx.err.decrypt_err += srcobj->rx.err.decrypt_err;
  373. tgtobj->stats.rx.non_ampdu_cnt += srcobj->rx.non_ampdu_cnt;
  374. tgtobj->stats.rx.amsdu_cnt += srcobj->rx.ampdu_cnt;
  375. tgtobj->stats.rx.non_amsdu_cnt += srcobj->rx.non_amsdu_cnt;
  376. tgtobj->stats.rx.amsdu_cnt += srcobj->rx.amsdu_cnt;
  377. tgtobj->stats.rx.nawds_mcast_drop += srcobj->rx.nawds_mcast_drop;
  378. tgtobj->stats.rx.to_stack.num += srcobj->rx.to_stack.num;
  379. tgtobj->stats.rx.to_stack.bytes += srcobj->rx.to_stack.bytes;
  380. for (i = 0; i < CDP_MAX_RX_RINGS; i++) {
  381. tgtobj->stats.rx.rcvd_reo[i].num +=
  382. srcobj->rx.rcvd_reo[i].num;
  383. tgtobj->stats.rx.rcvd_reo[i].bytes +=
  384. srcobj->rx.rcvd_reo[i].bytes;
  385. }
  386. srcobj->rx.unicast.num =
  387. srcobj->rx.to_stack.num -
  388. (srcobj->rx.multicast.num);
  389. srcobj->rx.unicast.bytes =
  390. srcobj->rx.to_stack.bytes -
  391. (srcobj->rx.multicast.bytes);
  392. tgtobj->stats.rx.unicast.num += srcobj->rx.unicast.num;
  393. tgtobj->stats.rx.unicast.bytes += srcobj->rx.unicast.bytes;
  394. tgtobj->stats.rx.multicast.num += srcobj->rx.multicast.num;
  395. tgtobj->stats.rx.multicast.bytes += srcobj->rx.multicast.bytes;
  396. tgtobj->stats.rx.bcast.num += srcobj->rx.bcast.num;
  397. tgtobj->stats.rx.bcast.bytes += srcobj->rx.bcast.bytes;
  398. tgtobj->stats.rx.raw.num += srcobj->rx.raw.num;
  399. tgtobj->stats.rx.raw.bytes += srcobj->rx.raw.bytes;
  400. tgtobj->stats.rx.intra_bss.pkts.num +=
  401. srcobj->rx.intra_bss.pkts.num;
  402. tgtobj->stats.rx.intra_bss.pkts.bytes +=
  403. srcobj->rx.intra_bss.pkts.bytes;
  404. tgtobj->stats.rx.intra_bss.fail.num +=
  405. srcobj->rx.intra_bss.fail.num;
  406. tgtobj->stats.rx.intra_bss.fail.bytes +=
  407. srcobj->rx.intra_bss.fail.bytes;
  408. tgtobj->stats.tx.last_ack_rssi =
  409. srcobj->tx.last_ack_rssi;
  410. tgtobj->stats.rx.mec_drop.num += srcobj->rx.mec_drop.num;
  411. tgtobj->stats.rx.mec_drop.bytes += srcobj->rx.mec_drop.bytes;
  412. }
  413. static inline void dp_update_pdev_ingress_stats(struct dp_pdev *tgtobj,
  414. struct dp_vdev *srcobj)
  415. {
  416. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.nawds_mcast);
  417. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.rcvd);
  418. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.processed);
  419. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.reinject_pkts);
  420. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.inspect_pkts);
  421. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.raw.raw_pkt);
  422. DP_STATS_AGGR(tgtobj, srcobj, tx_i.raw.dma_map_error);
  423. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.tso.tso_pkt);
  424. DP_STATS_AGGR(tgtobj, srcobj, tx_i.tso.dropped_host.num);
  425. DP_STATS_AGGR(tgtobj, srcobj, tx_i.tso.dropped_target);
  426. DP_STATS_AGGR(tgtobj, srcobj, tx_i.sg.dropped_host.num);
  427. DP_STATS_AGGR(tgtobj, srcobj, tx_i.sg.dropped_target);
  428. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.sg.sg_pkt);
  429. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.mcast_en.mcast_pkt);
  430. DP_STATS_AGGR(tgtobj, srcobj,
  431. tx_i.mcast_en.dropped_map_error);
  432. DP_STATS_AGGR(tgtobj, srcobj,
  433. tx_i.mcast_en.dropped_self_mac);
  434. DP_STATS_AGGR(tgtobj, srcobj,
  435. tx_i.mcast_en.dropped_send_fail);
  436. DP_STATS_AGGR(tgtobj, srcobj, tx_i.mcast_en.ucast);
  437. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.dma_error);
  438. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.ring_full);
  439. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.enqueue_fail);
  440. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.desc_na.num);
  441. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.res_full);
  442. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.headroom_insufficient);
  443. DP_STATS_AGGR(tgtobj, srcobj, tx_i.cce_classified);
  444. DP_STATS_AGGR(tgtobj, srcobj, tx_i.cce_classified_raw);
  445. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.sniffer_rcvd);
  446. DP_STATS_AGGR(tgtobj, srcobj, tx_i.mesh.exception_fw);
  447. DP_STATS_AGGR(tgtobj, srcobj, tx_i.mesh.completion_fw);
  448. tgtobj->stats.tx_i.dropped.dropped_pkt.num =
  449. tgtobj->stats.tx_i.dropped.dma_error +
  450. tgtobj->stats.tx_i.dropped.ring_full +
  451. tgtobj->stats.tx_i.dropped.enqueue_fail +
  452. tgtobj->stats.tx_i.dropped.desc_na.num +
  453. tgtobj->stats.tx_i.dropped.res_full;
  454. tgtobj->stats.tx_i.tso.num_seg =
  455. srcobj->stats.tx_i.tso.num_seg;
  456. }
  457. static inline void dp_update_vdev_stats(struct cdp_vdev_stats *tgtobj,
  458. struct dp_peer *srcobj)
  459. {
  460. uint8_t i;
  461. uint8_t pream_type;
  462. for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) {
  463. for (i = 0; i < MAX_MCS; i++) {
  464. tgtobj->tx.pkt_type[pream_type].
  465. mcs_count[i] +=
  466. srcobj->stats.tx.pkt_type[pream_type].
  467. mcs_count[i];
  468. tgtobj->rx.pkt_type[pream_type].
  469. mcs_count[i] +=
  470. srcobj->stats.rx.pkt_type[pream_type].
  471. mcs_count[i];
  472. }
  473. }
  474. for (i = 0; i < MAX_BW; i++) {
  475. tgtobj->tx.bw[i] += srcobj->stats.tx.bw[i];
  476. tgtobj->rx.bw[i] += srcobj->stats.rx.bw[i];
  477. }
  478. for (i = 0; i < SS_COUNT; i++) {
  479. tgtobj->tx.nss[i] += srcobj->stats.tx.nss[i];
  480. tgtobj->rx.nss[i] += srcobj->stats.rx.nss[i];
  481. }
  482. for (i = 0; i < WME_AC_MAX; i++) {
  483. tgtobj->tx.wme_ac_type[i] +=
  484. srcobj->stats.tx.wme_ac_type[i];
  485. tgtobj->rx.wme_ac_type[i] +=
  486. srcobj->stats.rx.wme_ac_type[i];
  487. tgtobj->tx.excess_retries_per_ac[i] +=
  488. srcobj->stats.tx.excess_retries_per_ac[i];
  489. }
  490. for (i = 0; i < MAX_GI; i++) {
  491. tgtobj->tx.sgi_count[i] +=
  492. srcobj->stats.tx.sgi_count[i];
  493. tgtobj->rx.sgi_count[i] +=
  494. srcobj->stats.rx.sgi_count[i];
  495. }
  496. for (i = 0; i < MAX_RECEPTION_TYPES; i++)
  497. tgtobj->rx.reception_type[i] +=
  498. srcobj->stats.rx.reception_type[i];
  499. tgtobj->tx.comp_pkt.bytes += srcobj->stats.tx.comp_pkt.bytes;
  500. tgtobj->tx.comp_pkt.num += srcobj->stats.tx.comp_pkt.num;
  501. tgtobj->tx.ucast.num += srcobj->stats.tx.ucast.num;
  502. tgtobj->tx.ucast.bytes += srcobj->stats.tx.ucast.bytes;
  503. tgtobj->tx.mcast.num += srcobj->stats.tx.mcast.num;
  504. tgtobj->tx.mcast.bytes += srcobj->stats.tx.mcast.bytes;
  505. tgtobj->tx.bcast.num += srcobj->stats.tx.bcast.num;
  506. tgtobj->tx.bcast.bytes += srcobj->stats.tx.bcast.bytes;
  507. tgtobj->tx.tx_success.num += srcobj->stats.tx.tx_success.num;
  508. tgtobj->tx.tx_success.bytes +=
  509. srcobj->stats.tx.tx_success.bytes;
  510. tgtobj->tx.nawds_mcast.num +=
  511. srcobj->stats.tx.nawds_mcast.num;
  512. tgtobj->tx.nawds_mcast.bytes +=
  513. srcobj->stats.tx.nawds_mcast.bytes;
  514. tgtobj->tx.nawds_mcast_drop +=
  515. srcobj->stats.tx.nawds_mcast_drop;
  516. tgtobj->tx.num_ppdu_cookie_valid +=
  517. srcobj->stats.tx.num_ppdu_cookie_valid;
  518. tgtobj->tx.tx_failed += srcobj->stats.tx.tx_failed;
  519. tgtobj->tx.ofdma += srcobj->stats.tx.ofdma;
  520. tgtobj->tx.stbc += srcobj->stats.tx.stbc;
  521. tgtobj->tx.ldpc += srcobj->stats.tx.ldpc;
  522. tgtobj->tx.retries += srcobj->stats.tx.retries;
  523. tgtobj->tx.non_amsdu_cnt += srcobj->stats.tx.non_amsdu_cnt;
  524. tgtobj->tx.amsdu_cnt += srcobj->stats.tx.amsdu_cnt;
  525. tgtobj->tx.non_ampdu_cnt += srcobj->stats.tx.non_ampdu_cnt;
  526. tgtobj->tx.ampdu_cnt += srcobj->stats.tx.ampdu_cnt;
  527. tgtobj->tx.dropped.fw_rem.num += srcobj->stats.tx.dropped.fw_rem.num;
  528. tgtobj->tx.dropped.fw_rem.bytes +=
  529. srcobj->stats.tx.dropped.fw_rem.bytes;
  530. tgtobj->tx.dropped.fw_rem_tx +=
  531. srcobj->stats.tx.dropped.fw_rem_tx;
  532. tgtobj->tx.dropped.fw_rem_notx +=
  533. srcobj->stats.tx.dropped.fw_rem_notx;
  534. tgtobj->tx.dropped.fw_reason1 +=
  535. srcobj->stats.tx.dropped.fw_reason1;
  536. tgtobj->tx.dropped.fw_reason2 +=
  537. srcobj->stats.tx.dropped.fw_reason2;
  538. tgtobj->tx.dropped.fw_reason3 +=
  539. srcobj->stats.tx.dropped.fw_reason3;
  540. tgtobj->tx.dropped.age_out += srcobj->stats.tx.dropped.age_out;
  541. tgtobj->rx.err.mic_err += srcobj->stats.rx.err.mic_err;
  542. if (srcobj->stats.rx.rssi != 0)
  543. tgtobj->rx.rssi = srcobj->stats.rx.rssi;
  544. tgtobj->rx.rx_rate = srcobj->stats.rx.rx_rate;
  545. tgtobj->rx.err.decrypt_err += srcobj->stats.rx.err.decrypt_err;
  546. tgtobj->rx.non_ampdu_cnt += srcobj->stats.rx.non_ampdu_cnt;
  547. tgtobj->rx.amsdu_cnt += srcobj->stats.rx.ampdu_cnt;
  548. tgtobj->rx.non_amsdu_cnt += srcobj->stats.rx.non_amsdu_cnt;
  549. tgtobj->rx.amsdu_cnt += srcobj->stats.rx.amsdu_cnt;
  550. tgtobj->rx.nawds_mcast_drop += srcobj->stats.rx.nawds_mcast_drop;
  551. tgtobj->rx.to_stack.num += srcobj->stats.rx.to_stack.num;
  552. tgtobj->rx.to_stack.bytes += srcobj->stats.rx.to_stack.bytes;
  553. for (i = 0; i < CDP_MAX_RX_RINGS; i++) {
  554. tgtobj->rx.rcvd_reo[i].num +=
  555. srcobj->stats.rx.rcvd_reo[i].num;
  556. tgtobj->rx.rcvd_reo[i].bytes +=
  557. srcobj->stats.rx.rcvd_reo[i].bytes;
  558. }
  559. srcobj->stats.rx.unicast.num =
  560. srcobj->stats.rx.to_stack.num -
  561. srcobj->stats.rx.multicast.num;
  562. srcobj->stats.rx.unicast.bytes =
  563. srcobj->stats.rx.to_stack.bytes -
  564. srcobj->stats.rx.multicast.bytes;
  565. tgtobj->rx.unicast.num += srcobj->stats.rx.unicast.num;
  566. tgtobj->rx.unicast.bytes += srcobj->stats.rx.unicast.bytes;
  567. tgtobj->rx.multicast.num += srcobj->stats.rx.multicast.num;
  568. tgtobj->rx.multicast.bytes += srcobj->stats.rx.multicast.bytes;
  569. tgtobj->rx.bcast.num += srcobj->stats.rx.bcast.num;
  570. tgtobj->rx.bcast.bytes += srcobj->stats.rx.bcast.bytes;
  571. tgtobj->rx.raw.num += srcobj->stats.rx.raw.num;
  572. tgtobj->rx.raw.bytes += srcobj->stats.rx.raw.bytes;
  573. tgtobj->rx.intra_bss.pkts.num +=
  574. srcobj->stats.rx.intra_bss.pkts.num;
  575. tgtobj->rx.intra_bss.pkts.bytes +=
  576. srcobj->stats.rx.intra_bss.pkts.bytes;
  577. tgtobj->rx.intra_bss.fail.num +=
  578. srcobj->stats.rx.intra_bss.fail.num;
  579. tgtobj->rx.intra_bss.fail.bytes +=
  580. srcobj->stats.rx.intra_bss.fail.bytes;
  581. tgtobj->tx.last_ack_rssi =
  582. srcobj->stats.tx.last_ack_rssi;
  583. tgtobj->rx.mec_drop.num += srcobj->stats.rx.mec_drop.num;
  584. tgtobj->rx.mec_drop.bytes += srcobj->stats.rx.mec_drop.bytes;
  585. }
  586. #define DP_UPDATE_STATS(_tgtobj, _srcobj) \
  587. do { \
  588. uint8_t i; \
  589. uint8_t pream_type; \
  590. for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) { \
  591. for (i = 0; i < MAX_MCS; i++) { \
  592. DP_STATS_AGGR(_tgtobj, _srcobj, \
  593. tx.pkt_type[pream_type].mcs_count[i]); \
  594. DP_STATS_AGGR(_tgtobj, _srcobj, \
  595. rx.pkt_type[pream_type].mcs_count[i]); \
  596. } \
  597. } \
  598. \
  599. for (i = 0; i < MAX_BW; i++) { \
  600. DP_STATS_AGGR(_tgtobj, _srcobj, tx.bw[i]); \
  601. DP_STATS_AGGR(_tgtobj, _srcobj, rx.bw[i]); \
  602. } \
  603. \
  604. for (i = 0; i < SS_COUNT; i++) { \
  605. DP_STATS_AGGR(_tgtobj, _srcobj, rx.nss[i]); \
  606. DP_STATS_AGGR(_tgtobj, _srcobj, tx.nss[i]); \
  607. } \
  608. for (i = 0; i < WME_AC_MAX; i++) { \
  609. DP_STATS_AGGR(_tgtobj, _srcobj, tx.wme_ac_type[i]); \
  610. DP_STATS_AGGR(_tgtobj, _srcobj, rx.wme_ac_type[i]); \
  611. DP_STATS_AGGR(_tgtobj, _srcobj, tx.excess_retries_per_ac[i]); \
  612. \
  613. } \
  614. \
  615. for (i = 0; i < MAX_GI; i++) { \
  616. DP_STATS_AGGR(_tgtobj, _srcobj, tx.sgi_count[i]); \
  617. DP_STATS_AGGR(_tgtobj, _srcobj, rx.sgi_count[i]); \
  618. } \
  619. \
  620. for (i = 0; i < MAX_RECEPTION_TYPES; i++) \
  621. DP_STATS_AGGR(_tgtobj, _srcobj, rx.reception_type[i]); \
  622. \
  623. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.comp_pkt); \
  624. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.ucast); \
  625. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.mcast); \
  626. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.bcast); \
  627. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.tx_success); \
  628. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.nawds_mcast); \
  629. DP_STATS_AGGR(_tgtobj, _srcobj, tx.nawds_mcast_drop); \
  630. DP_STATS_AGGR(_tgtobj, _srcobj, tx.tx_failed); \
  631. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ofdma); \
  632. DP_STATS_AGGR(_tgtobj, _srcobj, tx.stbc); \
  633. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ldpc); \
  634. DP_STATS_AGGR(_tgtobj, _srcobj, tx.retries); \
  635. DP_STATS_AGGR(_tgtobj, _srcobj, tx.non_amsdu_cnt); \
  636. DP_STATS_AGGR(_tgtobj, _srcobj, tx.amsdu_cnt); \
  637. DP_STATS_AGGR(_tgtobj, _srcobj, tx.non_ampdu_cnt); \
  638. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ampdu_cnt); \
  639. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.dropped.fw_rem); \
  640. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_tx); \
  641. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_notx); \
  642. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason1); \
  643. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason2); \
  644. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason3); \
  645. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.age_out); \
  646. \
  647. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.mic_err); \
  648. if (_srcobj->stats.rx.rssi != 0) \
  649. DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rssi); \
  650. DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rx_rate); \
  651. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.decrypt_err); \
  652. DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_ampdu_cnt); \
  653. DP_STATS_AGGR(_tgtobj, _srcobj, rx.ampdu_cnt); \
  654. DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_amsdu_cnt); \
  655. DP_STATS_AGGR(_tgtobj, _srcobj, rx.amsdu_cnt); \
  656. DP_STATS_AGGR(_tgtobj, _srcobj, rx.nawds_mcast_drop); \
  657. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.to_stack); \
  658. \
  659. for (i = 0; i < CDP_MAX_RX_RINGS; i++) \
  660. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.rcvd_reo[i]); \
  661. \
  662. _srcobj->stats.rx.unicast.num = \
  663. _srcobj->stats.rx.to_stack.num - \
  664. _srcobj->stats.rx.multicast.num; \
  665. _srcobj->stats.rx.unicast.bytes = \
  666. _srcobj->stats.rx.to_stack.bytes - \
  667. _srcobj->stats.rx.multicast.bytes; \
  668. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.unicast); \
  669. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.multicast); \
  670. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.bcast); \
  671. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.raw); \
  672. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.pkts); \
  673. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.fail); \
  674. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.mec_drop); \
  675. \
  676. _tgtobj->stats.tx.last_ack_rssi = \
  677. _srcobj->stats.tx.last_ack_rssi; \
  678. } while (0)
  679. extern int dp_peer_find_attach(struct dp_soc *soc);
  680. extern void dp_peer_find_detach(struct dp_soc *soc);
  681. extern void dp_peer_find_hash_add(struct dp_soc *soc, struct dp_peer *peer);
  682. extern void dp_peer_find_hash_remove(struct dp_soc *soc, struct dp_peer *peer);
  683. extern void dp_peer_find_hash_erase(struct dp_soc *soc);
  684. /*
  685. * dp_peer_ppdu_delayed_ba_init() Initialize ppdu in peer
  686. * @peer: Datapath peer
  687. *
  688. * return: void
  689. */
  690. void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer);
  691. /*
  692. * dp_peer_ppdu_delayed_ba_cleanup() free ppdu allocated in peer
  693. * @peer: Datapath peer
  694. *
  695. * return: void
  696. */
  697. void dp_peer_ppdu_delayed_ba_cleanup(struct dp_peer *peer);
  698. extern void dp_peer_rx_init(struct dp_pdev *pdev, struct dp_peer *peer);
  699. void dp_peer_tx_init(struct dp_pdev *pdev, struct dp_peer *peer);
  700. void dp_peer_cleanup(struct dp_vdev *vdev, struct dp_peer *peer,
  701. bool reuse);
  702. void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer,
  703. bool reuse);
  704. void dp_peer_unref_delete(struct dp_peer *peer);
  705. extern void dp_rx_discard(struct dp_vdev *vdev, struct dp_peer *peer,
  706. unsigned tid, qdf_nbuf_t msdu_list);
  707. extern void *dp_find_peer_by_addr(struct cdp_pdev *dev,
  708. uint8_t *peer_mac_addr, uint8_t *peer_id);
  709. extern struct dp_peer *dp_peer_find_hash_find(struct dp_soc *soc,
  710. uint8_t *peer_mac_addr, int mac_addr_is_aligned, uint8_t vdev_id);
  711. #ifdef DP_PEER_EXTENDED_API
  712. QDF_STATUS dp_register_peer(struct cdp_pdev *pdev_handle,
  713. struct ol_txrx_desc_type *sta_desc);
  714. QDF_STATUS dp_clear_peer(struct cdp_pdev *pdev_handle, uint8_t local_id);
  715. void *dp_find_peer_by_addr_and_vdev(struct cdp_pdev *pdev_handle,
  716. struct cdp_vdev *vdev,
  717. uint8_t *peer_addr, uint8_t *local_id);
  718. uint16_t dp_local_peer_id(void *peer);
  719. void *dp_peer_find_by_local_id(struct cdp_pdev *pdev_handle, uint8_t local_id);
  720. QDF_STATUS dp_peer_state_update(struct cdp_pdev *pdev_handle, uint8_t *peer_mac,
  721. enum ol_txrx_peer_state state);
  722. QDF_STATUS dp_get_vdevid(void *peer_handle, uint8_t *vdev_id);
  723. struct cdp_vdev *dp_get_vdev_by_sta_id(struct cdp_pdev *pdev_handle,
  724. uint8_t sta_id);
  725. struct cdp_vdev *dp_get_vdev_for_peer(void *peer);
  726. uint8_t *dp_peer_get_peer_mac_addr(void *peer);
  727. int dp_get_peer_state(void *peer_handle);
  728. void dp_local_peer_id_pool_init(struct dp_pdev *pdev);
  729. void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer);
  730. void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer);
  731. #else
  732. static inline
  733. QDF_STATUS dp_get_vdevid(void *peer_handle, uint8_t *vdev_id)
  734. {
  735. return QDF_STATUS_E_NOSUPPORT;
  736. }
  737. static inline void dp_local_peer_id_pool_init(struct dp_pdev *pdev)
  738. {
  739. }
  740. static inline
  741. void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer)
  742. {
  743. }
  744. static inline
  745. void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer)
  746. {
  747. }
  748. #endif
  749. int dp_addba_resp_tx_completion_wifi3(void *peer_handle, uint8_t tid,
  750. int status);
  751. extern int dp_addba_requestprocess_wifi3(void *peer_handle,
  752. uint8_t dialogtoken, uint16_t tid, uint16_t batimeout,
  753. uint16_t buffersize, uint16_t startseqnum);
  754. extern void dp_addba_responsesetup_wifi3(void *peer_handle, uint8_t tid,
  755. uint8_t *dialogtoken, uint16_t *statuscode,
  756. uint16_t *buffersize, uint16_t *batimeout);
  757. extern void dp_set_addba_response(void *peer_handle, uint8_t tid,
  758. uint16_t statuscode);
  759. extern int dp_delba_process_wifi3(void *peer_handle,
  760. int tid, uint16_t reasoncode);
  761. /*
  762. * dp_delba_tx_completion_wifi3() - Handle delba tx completion
  763. *
  764. * @peer_handle: Peer handle
  765. * @tid: Tid number
  766. * @status: Tx completion status
  767. * Indicate status of delba Tx to DP for stats update and retry
  768. * delba if tx failed.
  769. *
  770. */
  771. int dp_delba_tx_completion_wifi3(void *peer_handle, uint8_t tid,
  772. int status);
  773. extern QDF_STATUS dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid,
  774. uint32_t ba_window_size,
  775. uint32_t start_seq);
  776. extern QDF_STATUS dp_reo_send_cmd(struct dp_soc *soc,
  777. enum hal_reo_cmd_type type, struct hal_reo_cmd_params *params,
  778. void (*callback_fn), void *data);
  779. extern void dp_reo_cmdlist_destroy(struct dp_soc *soc);
  780. /**
  781. * dp_reo_status_ring_handler - Handler for REO Status ring
  782. * @int_ctx: pointer to DP interrupt context
  783. * @soc: DP Soc handle
  784. *
  785. * Returns: Number of descriptors reaped
  786. */
  787. uint32_t dp_reo_status_ring_handler(struct dp_intr *int_ctx,
  788. struct dp_soc *soc);
  789. void dp_aggregate_vdev_stats(struct dp_vdev *vdev,
  790. struct cdp_vdev_stats *vdev_stats);
  791. void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  792. union hal_reo_status *reo_status);
  793. void dp_rx_bar_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  794. union hal_reo_status *reo_status);
  795. QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
  796. uint32_t stats_type_upload_mask, uint32_t config_param_0,
  797. uint32_t config_param_1, uint32_t config_param_2,
  798. uint32_t config_param_3, int cookie, int cookie_msb,
  799. uint8_t mac_id);
  800. void dp_htt_stats_print_tag(struct dp_pdev *pdev,
  801. uint8_t tag_type, uint32_t *tag_buf);
  802. void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf);
  803. void dp_peer_rxtid_stats(struct dp_peer *peer, void (*callback_fn),
  804. void *cb_ctxt);
  805. void dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle,
  806. struct cdp_peer *peer_handle, enum cdp_sec_type sec_type,
  807. uint32_t *rx_pn);
  808. void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id);
  809. void dp_set_michael_key(struct cdp_peer *peer_handle,
  810. bool is_unicast, uint32_t *key);
  811. /**
  812. * dp_check_pdev_exists() - Validate pdev before use
  813. * @soc - dp soc handle
  814. * @data - pdev handle
  815. *
  816. * Return: 0 - success/invalid - failure
  817. */
  818. bool dp_check_pdev_exists(struct dp_soc *soc, struct dp_pdev *data);
  819. /**
  820. * dp_update_delay_stats() - Update delay statistics in structure
  821. * and fill min, max and avg delay
  822. * @pdev: pdev handle
  823. * @delay: delay in ms
  824. * @tid: tid value
  825. * @mode: type of tx delay mode
  826. * @ring id: ring number
  827. *
  828. * Return: none
  829. */
  830. void dp_update_delay_stats(struct dp_pdev *pdev, uint32_t delay,
  831. uint8_t tid, uint8_t mode, uint8_t ring_id);
  832. /**
  833. * dp_print_ring_stats(): Print tail and head pointer
  834. * @pdev: DP_PDEV handle
  835. *
  836. * Return:void
  837. */
  838. void dp_print_ring_stats(struct dp_pdev *pdev);
  839. /**
  840. * dp_print_pdev_cfg_params() - Print the pdev cfg parameters
  841. * @pdev_handle: DP pdev handle
  842. *
  843. * Return - void
  844. */
  845. void dp_print_pdev_cfg_params(struct dp_pdev *pdev);
  846. /**
  847. * dp_print_soc_cfg_params()- Dump soc wlan config parameters
  848. * @soc_handle: Soc handle
  849. *
  850. * Return: void
  851. */
  852. void dp_print_soc_cfg_params(struct dp_soc *soc);
  853. /**
  854. * dp_srng_get_str_from_ring_type() - Return string name for a ring
  855. * @ring_type: Ring
  856. *
  857. * Return: char const pointer
  858. */
  859. const
  860. char *dp_srng_get_str_from_hal_ring_type(enum hal_ring_type ring_type);
  861. /*
  862. * dp_txrx_path_stats() - Function to display dump stats
  863. * @soc - soc handle
  864. *
  865. * return: none
  866. */
  867. void dp_txrx_path_stats(struct dp_soc *soc);
  868. /*
  869. * dp_print_per_ring_stats(): Packet count per ring
  870. * @soc - soc handle
  871. *
  872. * Return - None
  873. */
  874. void dp_print_per_ring_stats(struct dp_soc *soc);
  875. /**
  876. * dp_aggregate_pdev_stats(): Consolidate stats at PDEV level
  877. * @pdev: DP PDEV handle
  878. *
  879. * return: void
  880. */
  881. void dp_aggregate_pdev_stats(struct dp_pdev *pdev);
  882. /**
  883. * dp_print_rx_rates(): Print Rx rate stats
  884. * @vdev: DP_VDEV handle
  885. *
  886. * Return:void
  887. */
  888. void dp_print_rx_rates(struct dp_vdev *vdev);
  889. /**
  890. * dp_print_tx_rates(): Print tx rates
  891. * @vdev: DP_VDEV handle
  892. *
  893. * Return:void
  894. */
  895. void dp_print_tx_rates(struct dp_vdev *vdev);
  896. /**
  897. * dp_print_peer_stats():print peer stats
  898. * @peer: DP_PEER handle
  899. *
  900. * return void
  901. */
  902. void dp_print_peer_stats(struct dp_peer *peer);
  903. /**
  904. * dp_print_pdev_tx_stats(): Print Pdev level TX stats
  905. * @pdev: DP_PDEV Handle
  906. *
  907. * Return:void
  908. */
  909. void
  910. dp_print_pdev_tx_stats(struct dp_pdev *pdev);
  911. /**
  912. * dp_print_pdev_rx_stats(): Print Pdev level RX stats
  913. * @pdev: DP_PDEV Handle
  914. *
  915. * Return: void
  916. */
  917. void
  918. dp_print_pdev_rx_stats(struct dp_pdev *pdev);
  919. /**
  920. * dp_print_pdev_rx_mon_stats(): Print Pdev level RX monitor stats
  921. * @pdev: DP_PDEV Handle
  922. *
  923. * Return: void
  924. */
  925. void
  926. dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev);
  927. /**
  928. * dp_print_soc_tx_stats(): Print SOC level stats
  929. * @soc DP_SOC Handle
  930. *
  931. * Return: void
  932. */
  933. void dp_print_soc_tx_stats(struct dp_soc *soc);
  934. /**
  935. * dp_print_soc_interrupt_stats() - Print interrupt stats for the soc
  936. * @soc: dp_soc handle
  937. *
  938. * Return: None
  939. */
  940. void dp_print_soc_interrupt_stats(struct dp_soc *soc);
  941. /**
  942. * dp_print_soc_rx_stats: Print SOC level Rx stats
  943. * @soc: DP_SOC Handle
  944. *
  945. * Return:void
  946. */
  947. void dp_print_soc_rx_stats(struct dp_soc *soc);
  948. /**
  949. * dp_get_mac_id_for_pdev() - Return mac corresponding to pdev for mac
  950. *
  951. * @mac_id: MAC id
  952. * @pdev_id: pdev_id corresponding to pdev, 0 for MCL
  953. *
  954. * Single pdev using both MACs will operate on both MAC rings,
  955. * which is the case for MCL.
  956. * For WIN each PDEV will operate one ring, so index is zero.
  957. *
  958. */
  959. static inline int dp_get_mac_id_for_pdev(uint32_t mac_id, uint32_t pdev_id)
  960. {
  961. if (mac_id && pdev_id) {
  962. qdf_print("Both mac_id and pdev_id cannot be non zero");
  963. QDF_BUG(0);
  964. return 0;
  965. }
  966. return (mac_id + pdev_id);
  967. }
  968. /*
  969. * dp_get_mac_id_for_mac() - Return mac corresponding WIN and MCL mac_ids
  970. *
  971. * @soc: handle to DP soc
  972. * @mac_id: MAC id
  973. *
  974. * Single pdev using both MACs will operate on both MAC rings,
  975. * which is the case for MCL.
  976. * For WIN each PDEV will operate one ring, so index is zero.
  977. *
  978. */
  979. static inline int dp_get_mac_id_for_mac(struct dp_soc *soc, uint32_t mac_id)
  980. {
  981. /*
  982. * Single pdev using both MACs will operate on both MAC rings,
  983. * which is the case for MCL.
  984. */
  985. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx))
  986. return mac_id;
  987. /* For WIN each PDEV will operate one ring, so index is zero. */
  988. return 0;
  989. }
  990. bool dp_is_soc_reinit(struct dp_soc *soc);
  991. /*
  992. * dp_is_subtype_data() - check if the frame subtype is data
  993. *
  994. * @frame_ctrl: Frame control field
  995. *
  996. * check the frame control field and verify if the packet
  997. * is a data packet.
  998. *
  999. * Return: true or false
  1000. */
  1001. static inline bool dp_is_subtype_data(uint16_t frame_ctrl)
  1002. {
  1003. if (((qdf_cpu_to_le16(frame_ctrl) & QDF_IEEE80211_FC0_TYPE_MASK) ==
  1004. QDF_IEEE80211_FC0_TYPE_DATA) &&
  1005. (((qdf_cpu_to_le16(frame_ctrl) & QDF_IEEE80211_FC0_SUBTYPE_MASK) ==
  1006. QDF_IEEE80211_FC0_SUBTYPE_DATA) ||
  1007. ((qdf_cpu_to_le16(frame_ctrl) & QDF_IEEE80211_FC0_SUBTYPE_MASK) ==
  1008. QDF_IEEE80211_FC0_SUBTYPE_QOS))) {
  1009. return true;
  1010. }
  1011. return false;
  1012. }
  1013. #ifdef WDI_EVENT_ENABLE
  1014. QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  1015. uint32_t stats_type_upload_mask,
  1016. uint8_t mac_id);
  1017. int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
  1018. void *event_cb_sub_handle,
  1019. uint32_t event);
  1020. int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
  1021. void *event_cb_sub_handle,
  1022. uint32_t event);
  1023. void dp_wdi_event_handler(enum WDI_EVENT event, struct dp_soc *soc,
  1024. void *data, u_int16_t peer_id,
  1025. int status, u_int8_t pdev_id);
  1026. int dp_wdi_event_attach(struct dp_pdev *txrx_pdev);
  1027. int dp_wdi_event_detach(struct dp_pdev *txrx_pdev);
  1028. int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  1029. bool enable);
  1030. void *dp_get_pldev(struct cdp_pdev *txrx_pdev);
  1031. void dp_pkt_log_init(struct cdp_pdev *ppdev, void *scn);
  1032. static inline void
  1033. dp_hif_update_pipe_callback(struct dp_soc *dp_soc,
  1034. void *cb_context,
  1035. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t),
  1036. uint8_t pipe_id)
  1037. {
  1038. struct hif_msg_callbacks hif_pipe_callbacks;
  1039. /* TODO: Temporary change to bypass HTC connection for this new
  1040. * HIF pipe, which will be used for packet log and other high-
  1041. * priority HTT messages. Proper HTC connection to be added
  1042. * later once required FW changes are available
  1043. */
  1044. hif_pipe_callbacks.rxCompletionHandler = callback;
  1045. hif_pipe_callbacks.Context = cb_context;
  1046. hif_update_pipe_callback(dp_soc->hif_handle,
  1047. DP_HTT_T2H_HP_PIPE, &hif_pipe_callbacks);
  1048. }
  1049. QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer);
  1050. #else
  1051. static inline int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
  1052. void *event_cb_sub_handle,
  1053. uint32_t event)
  1054. {
  1055. return 0;
  1056. }
  1057. static inline int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
  1058. void *event_cb_sub_handle,
  1059. uint32_t event)
  1060. {
  1061. return 0;
  1062. }
  1063. static inline
  1064. void dp_wdi_event_handler(enum WDI_EVENT event,
  1065. struct dp_soc *soc,
  1066. void *data, u_int16_t peer_id,
  1067. int status, u_int8_t pdev_id)
  1068. {
  1069. }
  1070. static inline int dp_wdi_event_attach(struct dp_pdev *txrx_pdev)
  1071. {
  1072. return 0;
  1073. }
  1074. static inline int dp_wdi_event_detach(struct dp_pdev *txrx_pdev)
  1075. {
  1076. return 0;
  1077. }
  1078. static inline int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  1079. bool enable)
  1080. {
  1081. return 0;
  1082. }
  1083. static inline QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  1084. uint32_t stats_type_upload_mask, uint8_t mac_id)
  1085. {
  1086. return 0;
  1087. }
  1088. static inline void
  1089. dp_hif_update_pipe_callback(struct dp_soc *dp_soc, void *cb_context,
  1090. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t),
  1091. uint8_t pipe_id)
  1092. {
  1093. }
  1094. static inline QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer)
  1095. {
  1096. return QDF_STATUS_SUCCESS;
  1097. }
  1098. #endif /* CONFIG_WIN */
  1099. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  1100. void dp_tx_dump_flow_pool_info(void *soc);
  1101. int dp_tx_delete_flow_pool(struct dp_soc *soc, struct dp_tx_desc_pool_s *pool,
  1102. bool force);
  1103. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  1104. #ifdef PEER_PROTECTED_ACCESS
  1105. /**
  1106. * dp_peer_unref_del_find_by_id() - dec ref and del peer if ref count is
  1107. * taken by dp_peer_find_by_id
  1108. * @peer: peer context
  1109. *
  1110. * Return: none
  1111. */
  1112. static inline void dp_peer_unref_del_find_by_id(struct dp_peer *peer)
  1113. {
  1114. dp_peer_unref_delete(peer);
  1115. }
  1116. #else
  1117. static inline void dp_peer_unref_del_find_by_id(struct dp_peer *peer)
  1118. {
  1119. }
  1120. #endif
  1121. #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
  1122. /**
  1123. * dp_srng_access_start() - Wrapper function to log access start of a hal ring
  1124. * @int_ctx: pointer to DP interrupt context
  1125. * @soc: DP Soc handle
  1126. * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
  1127. *
  1128. * Return: 0 on success; error on failure
  1129. */
  1130. int dp_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
  1131. hal_ring_handle_t hal_ring_hdl);
  1132. /**
  1133. * dp_srng_access_end() - Wrapper function to log access end of a hal ring
  1134. * @int_ctx: pointer to DP interrupt context
  1135. * @soc: DP Soc handle
  1136. * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
  1137. *
  1138. * Return: void
  1139. */
  1140. void dp_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *dp_soc,
  1141. hal_ring_handle_t hal_ring_hdl);
  1142. #else
  1143. static inline int dp_srng_access_start(struct dp_intr *int_ctx,
  1144. struct dp_soc *dp_soc,
  1145. hal_ring_handle_t hal_ring_hdl)
  1146. {
  1147. hal_soc_handle_t hal_soc = dp_soc->hal_soc;
  1148. return hal_srng_access_start(hal_soc, hal_ring_hdl);
  1149. }
  1150. static inline void dp_srng_access_end(struct dp_intr *int_ctx,
  1151. struct dp_soc *dp_soc,
  1152. hal_ring_handle_t hal_ring_hdl)
  1153. {
  1154. hal_soc_handle_t hal_soc = dp_soc->hal_soc;
  1155. return hal_srng_access_end(hal_soc, hal_ring_hdl);
  1156. }
  1157. #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */
  1158. #ifdef QCA_ENH_V3_STATS_SUPPORT
  1159. /**
  1160. * dp_pdev_print_delay_stats(): Print pdev level delay stats
  1161. * @pdev: DP_PDEV handle
  1162. *
  1163. * Return:void
  1164. */
  1165. void dp_pdev_print_delay_stats(struct dp_pdev *pdev);
  1166. /**
  1167. * dp_pdev_print_tid_stats(): Print pdev level tid stats
  1168. * @pdev: DP_PDEV handle
  1169. *
  1170. * Return:void
  1171. */
  1172. void dp_pdev_print_tid_stats(struct dp_pdev *pdev);
  1173. #endif /* CONFIG_WIN */
  1174. void dp_soc_set_txrx_ring_map(struct dp_soc *soc);
  1175. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  1176. /**
  1177. * dp_tx_ppdu_stats_attach - Initialize Tx PPDU stats and enhanced capture
  1178. * @pdev: DP PDEV
  1179. *
  1180. * Return: none
  1181. */
  1182. static inline void dp_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  1183. {
  1184. }
  1185. /**
  1186. * dp_tx_ppdu_stats_detach - Cleanup Tx PPDU stats and enhanced capture
  1187. * @pdev: DP PDEV
  1188. *
  1189. * Return: none
  1190. */
  1191. static inline void dp_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  1192. {
  1193. }
  1194. /**
  1195. * dp_tx_ppdu_stats_process - Deferred PPDU stats handler
  1196. * @context: Opaque work context (PDEV)
  1197. *
  1198. * Return: none
  1199. */
  1200. static inline void dp_tx_ppdu_stats_process(void *context)
  1201. {
  1202. }
  1203. /**
  1204. * dp_tx_add_to_comp_queue() - add completion msdu to queue
  1205. * @soc: DP Soc handle
  1206. * @tx_desc: software Tx descriptor
  1207. * @ts : Tx completion status from HAL/HTT descriptor
  1208. * @peer: DP peer
  1209. *
  1210. * Return: none
  1211. */
  1212. static inline
  1213. QDF_STATUS dp_tx_add_to_comp_queue(struct dp_soc *soc,
  1214. struct dp_tx_desc_s *desc,
  1215. struct hal_tx_completion_status *ts,
  1216. struct dp_peer *peer)
  1217. {
  1218. return QDF_STATUS_E_FAILURE;
  1219. }
  1220. #endif
  1221. /**
  1222. * dp_vdev_to_cdp_vdev() - typecast dp vdev to cdp vdev
  1223. * @vdev: DP vdev handle
  1224. *
  1225. * Return: struct cdp_vdev pointer
  1226. */
  1227. static inline
  1228. struct cdp_vdev *dp_vdev_to_cdp_vdev(struct dp_vdev *vdev)
  1229. {
  1230. return (struct cdp_vdev *)vdev;
  1231. }
  1232. /**
  1233. * dp_pdev_to_cdp_pdev() - typecast dp pdev to cdp pdev
  1234. * @pdev: DP pdev handle
  1235. *
  1236. * Return: struct cdp_pdev pointer
  1237. */
  1238. static inline
  1239. struct cdp_pdev *dp_pdev_to_cdp_pdev(struct dp_pdev *pdev)
  1240. {
  1241. return (struct cdp_pdev *)pdev;
  1242. }
  1243. /**
  1244. * dp_soc_to_cdp_soc() - typecast dp psoc to cdp psoc
  1245. * @psoc: DP psoc handle
  1246. *
  1247. * Return: struct cdp_soc pointer
  1248. */
  1249. static inline
  1250. struct cdp_soc *dp_soc_to_cdp_soc(struct dp_soc *psoc)
  1251. {
  1252. return (struct cdp_soc *)psoc;
  1253. }
  1254. /**
  1255. * dp_soc_to_cdp_soc_t() - typecast dp psoc to
  1256. * ol txrx soc handle
  1257. * @psoc: DP psoc handle
  1258. *
  1259. * Return: struct cdp_soc_t pointer
  1260. */
  1261. static inline
  1262. struct cdp_soc_t *dp_soc_to_cdp_soc_t(struct dp_soc *psoc)
  1263. {
  1264. return (struct cdp_soc_t *)psoc;
  1265. }
  1266. #ifdef WLAN_SUPPORT_RX_FLOW_TAG
  1267. /**
  1268. * dp_rx_flow_update_fse_stats() - Update a flow's statistics
  1269. * @pdev: pdev handle
  1270. * @flow_id: flow index (truncated hash) in the Rx FST
  1271. *
  1272. * Return: Success when flow statistcs is updated, error on failure
  1273. */
  1274. QDF_STATUS dp_rx_flow_get_fse_stats(struct dp_pdev *pdev,
  1275. struct cdp_rx_flow_info *rx_flow_info,
  1276. struct cdp_flow_stats *stats);
  1277. /**
  1278. * dp_rx_flow_delete_entry() - Delete a flow entry from flow search table
  1279. * @pdev: pdev handle
  1280. * @rx_flow_info: DP flow parameters
  1281. *
  1282. * Return: Success when flow is deleted, error on failure
  1283. */
  1284. QDF_STATUS dp_rx_flow_delete_entry(struct dp_pdev *pdev,
  1285. struct cdp_rx_flow_info *rx_flow_info);
  1286. /**
  1287. * dp_rx_flow_add_entry() - Add a flow entry to flow search table
  1288. * @pdev: DP pdev instance
  1289. * @rx_flow_info: DP flow paramaters
  1290. *
  1291. * Return: Success when flow is added, no-memory or already exists on error
  1292. */
  1293. QDF_STATUS dp_rx_flow_add_entry(struct dp_pdev *pdev,
  1294. struct cdp_rx_flow_info *rx_flow_info);
  1295. /**
  1296. * dp_rx_fst_attach() - Initialize Rx FST and setup necessary parameters
  1297. * @soc: SoC handle
  1298. * @pdev: Pdev handle
  1299. *
  1300. * Return: Handle to flow search table entry
  1301. */
  1302. QDF_STATUS dp_rx_fst_attach(struct dp_soc *soc, struct dp_pdev *pdev);
  1303. /**
  1304. * dp_rx_fst_detach() - De-initialize Rx FST
  1305. * @soc: SoC handle
  1306. * @pdev: Pdev handle
  1307. *
  1308. * Return: None
  1309. */
  1310. void dp_rx_fst_detach(struct dp_soc *soc, struct dp_pdev *pdev);
  1311. /**
  1312. * dp_rx_flow_send_fst_fw_setup() - Program FST parameters in FW/HW post-attach
  1313. * @soc: SoC handle
  1314. * @pdev: Pdev handle
  1315. *
  1316. * Return: Success when fst parameters are programmed in FW, error otherwise
  1317. */
  1318. QDF_STATUS dp_rx_flow_send_fst_fw_setup(struct dp_soc *soc,
  1319. struct dp_pdev *pdev);
  1320. #else
  1321. /**
  1322. * dp_rx_fst_attach() - Initialize Rx FST and setup necessary parameters
  1323. * @soc: SoC handle
  1324. * @pdev: Pdev handle
  1325. *
  1326. * Return: Handle to flow search table entry
  1327. */
  1328. static inline
  1329. QDF_STATUS dp_rx_fst_attach(struct dp_soc *soc, struct dp_pdev *pdev)
  1330. {
  1331. return QDF_STATUS_SUCCESS;
  1332. }
  1333. /**
  1334. * dp_rx_fst_detach() - De-initialize Rx FST
  1335. * @soc: SoC handle
  1336. * @pdev: Pdev handle
  1337. *
  1338. * Return: None
  1339. */
  1340. static inline
  1341. void dp_rx_fst_detach(struct dp_soc *soc, struct dp_pdev *pdev)
  1342. {
  1343. }
  1344. #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
  1345. #endif /* #ifndef _DP_INTERNAL_H_ */