dp_internal.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  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_AVG_WEIGHT 2
  23. /*
  24. * Formula to derive avg_rssi is taken from wifi2.o firmware
  25. */
  26. #define DP_GET_AVG_RSSI(avg_rssi, last_rssi) \
  27. (((avg_rssi) - (((uint8_t)(avg_rssi)) >> DP_RSSI_AVG_WEIGHT)) \
  28. + ((((uint8_t)(last_rssi)) >> DP_RSSI_AVG_WEIGHT)))
  29. /* Macro For NYSM value received in VHT TLV */
  30. #define VHT_SGI_NYSM 3
  31. /* PPDU STATS CFG */
  32. #define DP_PPDU_STATS_CFG_ALL 0xFFFF
  33. /* PPDU stats mask sent to FW to enable enhanced stats */
  34. #define DP_PPDU_STATS_CFG_ENH_STATS 0xE67
  35. /* PPDU stats mask sent to FW to support debug sniffer feature */
  36. #define DP_PPDU_STATS_CFG_SNIFFER 0x2FFF
  37. /* PPDU stats mask sent to FW to support BPR feature*/
  38. #define DP_PPDU_STATS_CFG_BPR 0x2000
  39. /* PPDU stats mask sent to FW to support BPR and enhanced stats feature */
  40. #define DP_PPDU_STATS_CFG_BPR_ENH (DP_PPDU_STATS_CFG_BPR | \
  41. DP_PPDU_STATS_CFG_ENH_STATS)
  42. /* PPDU stats mask sent to FW to support BPR and pcktlog stats feature */
  43. #define DP_PPDU_STATS_CFG_BPR_PKTLOG (DP_PPDU_STATS_CFG_BPR | \
  44. DP_PPDU_TXLITE_STATS_BITMASK_CFG)
  45. /**
  46. * Bitmap of HTT PPDU TLV types for Default mode
  47. */
  48. #define HTT_PPDU_DEFAULT_TLV_BITMAP \
  49. (1 << HTT_PPDU_STATS_COMMON_TLV) | \
  50. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  51. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  52. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  53. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  54. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV)
  55. /**
  56. * Bitmap of HTT PPDU TLV types for Sniffer mode bitmap 64
  57. */
  58. #define HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_64 \
  59. ((1 << HTT_PPDU_STATS_COMMON_TLV) | \
  60. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  61. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  62. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  63. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  64. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV) | \
  65. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_64_TLV) | \
  66. (1 << HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_64_TLV))
  67. /**
  68. * Bitmap of HTT PPDU TLV types for Sniffer mode bitmap 256
  69. */
  70. #define HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_256 \
  71. ((1 << HTT_PPDU_STATS_COMMON_TLV) | \
  72. (1 << HTT_PPDU_STATS_USR_COMMON_TLV) | \
  73. (1 << HTT_PPDU_STATS_USR_RATE_TLV) | \
  74. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) | \
  75. (1 << HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV) | \
  76. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV) | \
  77. (1 << HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV) | \
  78. (1 << HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_256_TLV))
  79. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  80. extern uint8_t
  81. dp_cpu_ring_map[DP_NSS_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS];
  82. #endif
  83. #if DP_PRINT_ENABLE
  84. #include <stdarg.h> /* va_list */
  85. #include <qdf_types.h> /* qdf_vprint */
  86. #include <cdp_txrx_handle.h>
  87. enum {
  88. /* FATAL_ERR - print only irrecoverable error messages */
  89. DP_PRINT_LEVEL_FATAL_ERR,
  90. /* ERR - include non-fatal err messages */
  91. DP_PRINT_LEVEL_ERR,
  92. /* WARN - include warnings */
  93. DP_PRINT_LEVEL_WARN,
  94. /* INFO1 - include fundamental, infrequent events */
  95. DP_PRINT_LEVEL_INFO1,
  96. /* INFO2 - include non-fundamental but infrequent events */
  97. DP_PRINT_LEVEL_INFO2,
  98. };
  99. #define dp_print(level, fmt, ...) do { \
  100. if (level <= g_txrx_print_level) \
  101. qdf_print(fmt, ## __VA_ARGS__); \
  102. while (0)
  103. #define DP_PRINT(level, fmt, ...) do { \
  104. dp_print(level, "DP: " fmt, ## __VA_ARGS__); \
  105. while (0)
  106. #else
  107. #define DP_PRINT(level, fmt, ...)
  108. #endif /* DP_PRINT_ENABLE */
  109. #define DP_TRACE(LVL, fmt, args ...) \
  110. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \
  111. fmt, ## args)
  112. #define DP_TRACE_STATS(LVL, fmt, args ...) \
  113. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \
  114. fmt, ## args)
  115. #ifdef CONFIG_MCL
  116. /* Stat prints should not go to console or kernel logs.*/
  117. #define DP_PRINT_STATS(fmt, args ...)\
  118. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, \
  119. fmt, ## args)
  120. #else
  121. #define DP_PRINT_STATS(fmt, args ...)\
  122. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,\
  123. fmt, ## args)
  124. #endif
  125. #define DP_STATS_INIT(_handle) \
  126. qdf_mem_zero(&((_handle)->stats), sizeof((_handle)->stats))
  127. #define DP_STATS_CLR(_handle) \
  128. qdf_mem_zero(&((_handle)->stats), sizeof((_handle)->stats))
  129. #ifndef DISABLE_DP_STATS
  130. #define DP_STATS_INC(_handle, _field, _delta) \
  131. { \
  132. if (likely(_handle)) \
  133. _handle->stats._field += _delta; \
  134. }
  135. #define DP_STATS_INCC(_handle, _field, _delta, _cond) \
  136. { \
  137. if (_cond && likely(_handle)) \
  138. _handle->stats._field += _delta; \
  139. }
  140. #define DP_STATS_DEC(_handle, _field, _delta) \
  141. { \
  142. if (likely(_handle)) \
  143. _handle->stats._field -= _delta; \
  144. }
  145. #define DP_STATS_UPD(_handle, _field, _delta) \
  146. { \
  147. if (likely(_handle)) \
  148. _handle->stats._field = _delta; \
  149. }
  150. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes) \
  151. { \
  152. DP_STATS_INC(_handle, _field.num, _count); \
  153. DP_STATS_INC(_handle, _field.bytes, _bytes) \
  154. }
  155. #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond) \
  156. { \
  157. DP_STATS_INCC(_handle, _field.num, _count, _cond); \
  158. DP_STATS_INCC(_handle, _field.bytes, _bytes, _cond) \
  159. }
  160. #define DP_STATS_AGGR(_handle_a, _handle_b, _field) \
  161. { \
  162. _handle_a->stats._field += _handle_b->stats._field; \
  163. }
  164. #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field) \
  165. { \
  166. DP_STATS_AGGR(_handle_a, _handle_b, _field.num); \
  167. DP_STATS_AGGR(_handle_a, _handle_b, _field.bytes);\
  168. }
  169. #define DP_STATS_UPD_STRUCT(_handle_a, _handle_b, _field) \
  170. { \
  171. _handle_a->stats._field = _handle_b->stats._field; \
  172. }
  173. #else
  174. #define DP_STATS_INC(_handle, _field, _delta)
  175. #define DP_STATS_INCC(_handle, _field, _delta, _cond)
  176. #define DP_STATS_DEC(_handle, _field, _delta)
  177. #define DP_STATS_UPD(_handle, _field, _delta)
  178. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes)
  179. #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond)
  180. #define DP_STATS_AGGR(_handle_a, _handle_b, _field)
  181. #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field)
  182. #endif
  183. #ifdef ENABLE_DP_HIST_STATS
  184. #define DP_HIST_INIT() \
  185. uint32_t num_of_packets[MAX_PDEV_CNT] = {0};
  186. #define DP_HIST_PACKET_COUNT_INC(_pdev_id) \
  187. { \
  188. ++num_of_packets[_pdev_id]; \
  189. }
  190. #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \
  191. do { \
  192. if (_p_cntrs == 1) { \
  193. DP_STATS_INC(_pdev, \
  194. tx_comp_histogram.pkts_1, 1); \
  195. } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \
  196. DP_STATS_INC(_pdev, \
  197. tx_comp_histogram.pkts_2_20, 1); \
  198. } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \
  199. DP_STATS_INC(_pdev, \
  200. tx_comp_histogram.pkts_21_40, 1); \
  201. } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \
  202. DP_STATS_INC(_pdev, \
  203. tx_comp_histogram.pkts_41_60, 1); \
  204. } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \
  205. DP_STATS_INC(_pdev, \
  206. tx_comp_histogram.pkts_61_80, 1); \
  207. } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \
  208. DP_STATS_INC(_pdev, \
  209. tx_comp_histogram.pkts_81_100, 1); \
  210. } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \
  211. DP_STATS_INC(_pdev, \
  212. tx_comp_histogram.pkts_101_200, 1); \
  213. } else if (_p_cntrs > 200) { \
  214. DP_STATS_INC(_pdev, \
  215. tx_comp_histogram.pkts_201_plus, 1); \
  216. } \
  217. } while (0)
  218. #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \
  219. do { \
  220. if (_p_cntrs == 1) { \
  221. DP_STATS_INC(_pdev, \
  222. rx_ind_histogram.pkts_1, 1); \
  223. } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \
  224. DP_STATS_INC(_pdev, \
  225. rx_ind_histogram.pkts_2_20, 1); \
  226. } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \
  227. DP_STATS_INC(_pdev, \
  228. rx_ind_histogram.pkts_21_40, 1); \
  229. } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \
  230. DP_STATS_INC(_pdev, \
  231. rx_ind_histogram.pkts_41_60, 1); \
  232. } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \
  233. DP_STATS_INC(_pdev, \
  234. rx_ind_histogram.pkts_61_80, 1); \
  235. } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \
  236. DP_STATS_INC(_pdev, \
  237. rx_ind_histogram.pkts_81_100, 1); \
  238. } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \
  239. DP_STATS_INC(_pdev, \
  240. rx_ind_histogram.pkts_101_200, 1); \
  241. } else if (_p_cntrs > 200) { \
  242. DP_STATS_INC(_pdev, \
  243. rx_ind_histogram.pkts_201_plus, 1); \
  244. } \
  245. } while (0)
  246. #define DP_TX_HIST_STATS_PER_PDEV() \
  247. do { \
  248. uint8_t hist_stats = 0; \
  249. for (hist_stats = 0; hist_stats < soc->pdev_count; \
  250. hist_stats++) { \
  251. DP_TX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \
  252. num_of_packets[hist_stats]); \
  253. } \
  254. } while (0)
  255. #define DP_RX_HIST_STATS_PER_PDEV() \
  256. do { \
  257. uint8_t hist_stats = 0; \
  258. for (hist_stats = 0; hist_stats < soc->pdev_count; \
  259. hist_stats++) { \
  260. DP_RX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \
  261. num_of_packets[hist_stats]); \
  262. } \
  263. } while (0)
  264. #else
  265. #define DP_HIST_INIT()
  266. #define DP_HIST_PACKET_COUNT_INC(_pdev_id)
  267. #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs)
  268. #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs)
  269. #define DP_RX_HIST_STATS_PER_PDEV()
  270. #define DP_TX_HIST_STATS_PER_PDEV()
  271. #endif
  272. #define DP_HTT_T2H_HP_PIPE 5
  273. static inline void dp_update_pdev_stats(struct dp_pdev *tgtobj,
  274. struct cdp_vdev_stats *srcobj)
  275. {
  276. uint8_t i;
  277. uint8_t pream_type;
  278. for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) {
  279. for (i = 0; i < MAX_MCS; i++) {
  280. tgtobj->stats.tx.pkt_type[pream_type].
  281. mcs_count[i] +=
  282. srcobj->tx.pkt_type[pream_type].
  283. mcs_count[i];
  284. tgtobj->stats.rx.pkt_type[pream_type].
  285. mcs_count[i] +=
  286. srcobj->rx.pkt_type[pream_type].
  287. mcs_count[i];
  288. }
  289. }
  290. for (i = 0; i < MAX_BW; i++) {
  291. tgtobj->stats.tx.bw[i] += srcobj->tx.bw[i];
  292. tgtobj->stats.rx.bw[i] += srcobj->rx.bw[i];
  293. }
  294. for (i = 0; i < SS_COUNT; i++) {
  295. tgtobj->stats.tx.nss[i] += srcobj->tx.nss[i];
  296. tgtobj->stats.rx.nss[i] += srcobj->rx.nss[i];
  297. }
  298. for (i = 0; i < WME_AC_MAX; i++) {
  299. tgtobj->stats.tx.wme_ac_type[i] +=
  300. srcobj->tx.wme_ac_type[i];
  301. tgtobj->stats.rx.wme_ac_type[i] +=
  302. srcobj->rx.wme_ac_type[i];
  303. tgtobj->stats.tx.excess_retries_per_ac[i] +=
  304. srcobj->tx.excess_retries_per_ac[i];
  305. }
  306. for (i = 0; i < MAX_GI; i++) {
  307. tgtobj->stats.tx.sgi_count[i] +=
  308. srcobj->tx.sgi_count[i];
  309. tgtobj->stats.rx.sgi_count[i] +=
  310. srcobj->rx.sgi_count[i];
  311. }
  312. for (i = 0; i < MAX_RECEPTION_TYPES; i++)
  313. tgtobj->stats.rx.reception_type[i] +=
  314. srcobj->rx.reception_type[i];
  315. tgtobj->stats.tx.comp_pkt.bytes += srcobj->tx.comp_pkt.bytes;
  316. tgtobj->stats.tx.comp_pkt.num += srcobj->tx.comp_pkt.num;
  317. tgtobj->stats.tx.ucast.num += srcobj->tx.ucast.num;
  318. tgtobj->stats.tx.ucast.bytes += srcobj->tx.ucast.bytes;
  319. tgtobj->stats.tx.mcast.num += srcobj->tx.mcast.num;
  320. tgtobj->stats.tx.mcast.bytes += srcobj->tx.mcast.bytes;
  321. tgtobj->stats.tx.bcast.num += srcobj->tx.bcast.num;
  322. tgtobj->stats.tx.bcast.bytes += srcobj->tx.bcast.bytes;
  323. tgtobj->stats.tx.tx_success.num += srcobj->tx.tx_success.num;
  324. tgtobj->stats.tx.tx_success.bytes +=
  325. srcobj->tx.tx_success.bytes;
  326. tgtobj->stats.tx.nawds_mcast.num +=
  327. srcobj->tx.nawds_mcast.num;
  328. tgtobj->stats.tx.nawds_mcast.bytes +=
  329. srcobj->tx.nawds_mcast.bytes;
  330. tgtobj->stats.tx.nawds_mcast_drop +=
  331. srcobj->tx.nawds_mcast_drop;
  332. tgtobj->stats.tx.tx_failed += srcobj->tx.tx_failed;
  333. tgtobj->stats.tx.ofdma += srcobj->tx.ofdma;
  334. tgtobj->stats.tx.stbc += srcobj->tx.stbc;
  335. tgtobj->stats.tx.ldpc += srcobj->tx.ldpc;
  336. tgtobj->stats.tx.retries += srcobj->tx.retries;
  337. tgtobj->stats.tx.non_amsdu_cnt += srcobj->tx.non_amsdu_cnt;
  338. tgtobj->stats.tx.amsdu_cnt += srcobj->tx.amsdu_cnt;
  339. tgtobj->stats.tx.non_ampdu_cnt += srcobj->tx.non_ampdu_cnt;
  340. tgtobj->stats.tx.ampdu_cnt += srcobj->tx.ampdu_cnt;
  341. tgtobj->stats.tx.dropped.fw_rem.num += srcobj->tx.dropped.fw_rem.num;
  342. tgtobj->stats.tx.dropped.fw_rem.bytes +=
  343. srcobj->tx.dropped.fw_rem.bytes;
  344. tgtobj->stats.tx.dropped.fw_rem_tx +=
  345. srcobj->tx.dropped.fw_rem_tx;
  346. tgtobj->stats.tx.dropped.fw_rem_notx +=
  347. srcobj->tx.dropped.fw_rem_notx;
  348. tgtobj->stats.tx.dropped.fw_reason1 +=
  349. srcobj->tx.dropped.fw_reason1;
  350. tgtobj->stats.tx.dropped.fw_reason2 +=
  351. srcobj->tx.dropped.fw_reason2;
  352. tgtobj->stats.tx.dropped.fw_reason3 +=
  353. srcobj->tx.dropped.fw_reason3;
  354. tgtobj->stats.tx.dropped.age_out += srcobj->tx.dropped.age_out;
  355. tgtobj->stats.rx.err.mic_err += srcobj->rx.err.mic_err;
  356. if (srcobj->rx.rssi != 0)
  357. tgtobj->stats.rx.rssi = srcobj->rx.rssi;
  358. tgtobj->stats.rx.rx_rate = srcobj->rx.rx_rate;
  359. tgtobj->stats.rx.err.decrypt_err += srcobj->rx.err.decrypt_err;
  360. tgtobj->stats.rx.non_ampdu_cnt += srcobj->rx.non_ampdu_cnt;
  361. tgtobj->stats.rx.amsdu_cnt += srcobj->rx.ampdu_cnt;
  362. tgtobj->stats.rx.non_amsdu_cnt += srcobj->rx.non_amsdu_cnt;
  363. tgtobj->stats.rx.amsdu_cnt += srcobj->rx.amsdu_cnt;
  364. tgtobj->stats.rx.nawds_mcast_drop += srcobj->rx.nawds_mcast_drop;
  365. tgtobj->stats.rx.to_stack.num += srcobj->rx.to_stack.num;
  366. tgtobj->stats.rx.to_stack.bytes += srcobj->rx.to_stack.bytes;
  367. for (i = 0; i < CDP_MAX_RX_RINGS; i++) {
  368. tgtobj->stats.rx.rcvd_reo[i].num +=
  369. srcobj->rx.rcvd_reo[i].num;
  370. tgtobj->stats.rx.rcvd_reo[i].bytes +=
  371. srcobj->rx.rcvd_reo[i].bytes;
  372. }
  373. srcobj->rx.unicast.num =
  374. srcobj->rx.to_stack.num -
  375. (srcobj->rx.multicast.num);
  376. srcobj->rx.unicast.bytes =
  377. srcobj->rx.to_stack.bytes -
  378. (srcobj->rx.multicast.bytes);
  379. tgtobj->stats.rx.unicast.num += srcobj->rx.unicast.num;
  380. tgtobj->stats.rx.unicast.bytes += srcobj->rx.unicast.bytes;
  381. tgtobj->stats.rx.multicast.num += srcobj->rx.multicast.num;
  382. tgtobj->stats.rx.multicast.bytes += srcobj->rx.multicast.bytes;
  383. tgtobj->stats.rx.bcast.num += srcobj->rx.bcast.num;
  384. tgtobj->stats.rx.bcast.bytes += srcobj->rx.bcast.bytes;
  385. tgtobj->stats.rx.raw.num += srcobj->rx.raw.num;
  386. tgtobj->stats.rx.raw.bytes += srcobj->rx.raw.bytes;
  387. tgtobj->stats.rx.intra_bss.pkts.num +=
  388. srcobj->rx.intra_bss.pkts.num;
  389. tgtobj->stats.rx.intra_bss.pkts.bytes +=
  390. srcobj->rx.intra_bss.pkts.bytes;
  391. tgtobj->stats.rx.intra_bss.fail.num +=
  392. srcobj->rx.intra_bss.fail.num;
  393. tgtobj->stats.rx.intra_bss.fail.bytes +=
  394. srcobj->rx.intra_bss.fail.bytes;
  395. tgtobj->stats.tx.last_ack_rssi =
  396. srcobj->tx.last_ack_rssi;
  397. tgtobj->stats.rx.mec_drop.num += srcobj->rx.mec_drop.num;
  398. tgtobj->stats.rx.mec_drop.bytes += srcobj->rx.mec_drop.bytes;
  399. }
  400. static inline void dp_update_pdev_ingress_stats(struct dp_pdev *tgtobj,
  401. struct dp_vdev *srcobj)
  402. {
  403. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.nawds_mcast);
  404. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.rcvd);
  405. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.processed);
  406. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.reinject_pkts);
  407. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.inspect_pkts);
  408. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.raw.raw_pkt);
  409. DP_STATS_AGGR(tgtobj, srcobj, tx_i.raw.dma_map_error);
  410. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.tso.tso_pkt);
  411. DP_STATS_AGGR(tgtobj, srcobj, tx_i.tso.dropped_host.num);
  412. DP_STATS_AGGR(tgtobj, srcobj, tx_i.tso.dropped_target);
  413. DP_STATS_AGGR(tgtobj, srcobj, tx_i.sg.dropped_host.num);
  414. DP_STATS_AGGR(tgtobj, srcobj, tx_i.sg.dropped_target);
  415. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.sg.sg_pkt);
  416. DP_STATS_AGGR_PKT(tgtobj, srcobj, tx_i.mcast_en.mcast_pkt);
  417. DP_STATS_AGGR(tgtobj, srcobj,
  418. tx_i.mcast_en.dropped_map_error);
  419. DP_STATS_AGGR(tgtobj, srcobj,
  420. tx_i.mcast_en.dropped_self_mac);
  421. DP_STATS_AGGR(tgtobj, srcobj,
  422. tx_i.mcast_en.dropped_send_fail);
  423. DP_STATS_AGGR(tgtobj, srcobj, tx_i.mcast_en.ucast);
  424. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.dma_error);
  425. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.ring_full);
  426. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.enqueue_fail);
  427. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.desc_na.num);
  428. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.res_full);
  429. DP_STATS_AGGR(tgtobj, srcobj, tx_i.dropped.headroom_insufficient);
  430. DP_STATS_AGGR(tgtobj, srcobj, tx_i.cce_classified);
  431. DP_STATS_AGGR(tgtobj, srcobj, tx_i.cce_classified_raw);
  432. DP_STATS_AGGR(tgtobj, srcobj, tx_i.mesh.exception_fw);
  433. DP_STATS_AGGR(tgtobj, srcobj, tx_i.mesh.completion_fw);
  434. tgtobj->stats.tx_i.dropped.dropped_pkt.num =
  435. tgtobj->stats.tx_i.dropped.dma_error +
  436. tgtobj->stats.tx_i.dropped.ring_full +
  437. tgtobj->stats.tx_i.dropped.enqueue_fail +
  438. tgtobj->stats.tx_i.dropped.desc_na.num +
  439. tgtobj->stats.tx_i.dropped.res_full;
  440. tgtobj->stats.tx_i.tso.num_seg =
  441. srcobj->stats.tx_i.tso.num_seg;
  442. }
  443. static inline void dp_update_vdev_stats(struct cdp_vdev_stats *tgtobj,
  444. struct dp_peer *srcobj)
  445. {
  446. uint8_t i;
  447. uint8_t pream_type;
  448. for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) {
  449. for (i = 0; i < MAX_MCS; i++) {
  450. tgtobj->tx.pkt_type[pream_type].
  451. mcs_count[i] +=
  452. srcobj->stats.tx.pkt_type[pream_type].
  453. mcs_count[i];
  454. tgtobj->rx.pkt_type[pream_type].
  455. mcs_count[i] +=
  456. srcobj->stats.rx.pkt_type[pream_type].
  457. mcs_count[i];
  458. }
  459. }
  460. for (i = 0; i < MAX_BW; i++) {
  461. tgtobj->tx.bw[i] += srcobj->stats.tx.bw[i];
  462. tgtobj->rx.bw[i] += srcobj->stats.rx.bw[i];
  463. }
  464. for (i = 0; i < SS_COUNT; i++) {
  465. tgtobj->tx.nss[i] += srcobj->stats.tx.nss[i];
  466. tgtobj->rx.nss[i] += srcobj->stats.rx.nss[i];
  467. }
  468. for (i = 0; i < WME_AC_MAX; i++) {
  469. tgtobj->tx.wme_ac_type[i] +=
  470. srcobj->stats.tx.wme_ac_type[i];
  471. tgtobj->rx.wme_ac_type[i] +=
  472. srcobj->stats.rx.wme_ac_type[i];
  473. tgtobj->tx.excess_retries_per_ac[i] +=
  474. srcobj->stats.tx.excess_retries_per_ac[i];
  475. }
  476. for (i = 0; i < MAX_GI; i++) {
  477. tgtobj->tx.sgi_count[i] +=
  478. srcobj->stats.tx.sgi_count[i];
  479. tgtobj->rx.sgi_count[i] +=
  480. srcobj->stats.rx.sgi_count[i];
  481. }
  482. for (i = 0; i < MAX_RECEPTION_TYPES; i++)
  483. tgtobj->rx.reception_type[i] +=
  484. srcobj->stats.rx.reception_type[i];
  485. tgtobj->tx.comp_pkt.bytes += srcobj->stats.tx.comp_pkt.bytes;
  486. tgtobj->tx.comp_pkt.num += srcobj->stats.tx.comp_pkt.num;
  487. tgtobj->tx.ucast.num += srcobj->stats.tx.ucast.num;
  488. tgtobj->tx.ucast.bytes += srcobj->stats.tx.ucast.bytes;
  489. tgtobj->tx.mcast.num += srcobj->stats.tx.mcast.num;
  490. tgtobj->tx.mcast.bytes += srcobj->stats.tx.mcast.bytes;
  491. tgtobj->tx.bcast.num += srcobj->stats.tx.bcast.num;
  492. tgtobj->tx.bcast.bytes += srcobj->stats.tx.bcast.bytes;
  493. tgtobj->tx.tx_success.num += srcobj->stats.tx.tx_success.num;
  494. tgtobj->tx.tx_success.bytes +=
  495. srcobj->stats.tx.tx_success.bytes;
  496. tgtobj->tx.nawds_mcast.num +=
  497. srcobj->stats.tx.nawds_mcast.num;
  498. tgtobj->tx.nawds_mcast.bytes +=
  499. srcobj->stats.tx.nawds_mcast.bytes;
  500. tgtobj->tx.nawds_mcast_drop +=
  501. srcobj->stats.tx.nawds_mcast_drop;
  502. tgtobj->tx.tx_failed += srcobj->stats.tx.tx_failed;
  503. tgtobj->tx.ofdma += srcobj->stats.tx.ofdma;
  504. tgtobj->tx.stbc += srcobj->stats.tx.stbc;
  505. tgtobj->tx.ldpc += srcobj->stats.tx.ldpc;
  506. tgtobj->tx.retries += srcobj->stats.tx.retries;
  507. tgtobj->tx.non_amsdu_cnt += srcobj->stats.tx.non_amsdu_cnt;
  508. tgtobj->tx.amsdu_cnt += srcobj->stats.tx.amsdu_cnt;
  509. tgtobj->tx.non_ampdu_cnt += srcobj->stats.tx.non_ampdu_cnt;
  510. tgtobj->tx.ampdu_cnt += srcobj->stats.tx.ampdu_cnt;
  511. tgtobj->tx.dropped.fw_rem.num += srcobj->stats.tx.dropped.fw_rem.num;
  512. tgtobj->tx.dropped.fw_rem.bytes +=
  513. srcobj->stats.tx.dropped.fw_rem.bytes;
  514. tgtobj->tx.dropped.fw_rem_tx +=
  515. srcobj->stats.tx.dropped.fw_rem_tx;
  516. tgtobj->tx.dropped.fw_rem_notx +=
  517. srcobj->stats.tx.dropped.fw_rem_notx;
  518. tgtobj->tx.dropped.fw_reason1 +=
  519. srcobj->stats.tx.dropped.fw_reason1;
  520. tgtobj->tx.dropped.fw_reason2 +=
  521. srcobj->stats.tx.dropped.fw_reason2;
  522. tgtobj->tx.dropped.fw_reason3 +=
  523. srcobj->stats.tx.dropped.fw_reason3;
  524. tgtobj->tx.dropped.age_out += srcobj->stats.tx.dropped.age_out;
  525. tgtobj->rx.err.mic_err += srcobj->stats.rx.err.mic_err;
  526. if (srcobj->stats.rx.rssi != 0)
  527. tgtobj->rx.rssi = srcobj->stats.rx.rssi;
  528. tgtobj->rx.rx_rate = srcobj->stats.rx.rx_rate;
  529. tgtobj->rx.err.decrypt_err += srcobj->stats.rx.err.decrypt_err;
  530. tgtobj->rx.non_ampdu_cnt += srcobj->stats.rx.non_ampdu_cnt;
  531. tgtobj->rx.amsdu_cnt += srcobj->stats.rx.ampdu_cnt;
  532. tgtobj->rx.non_amsdu_cnt += srcobj->stats.rx.non_amsdu_cnt;
  533. tgtobj->rx.amsdu_cnt += srcobj->stats.rx.amsdu_cnt;
  534. tgtobj->rx.nawds_mcast_drop += srcobj->stats.rx.nawds_mcast_drop;
  535. tgtobj->rx.to_stack.num += srcobj->stats.rx.to_stack.num;
  536. tgtobj->rx.to_stack.bytes += srcobj->stats.rx.to_stack.bytes;
  537. for (i = 0; i < CDP_MAX_RX_RINGS; i++) {
  538. tgtobj->rx.rcvd_reo[i].num +=
  539. srcobj->stats.rx.rcvd_reo[i].num;
  540. tgtobj->rx.rcvd_reo[i].bytes +=
  541. srcobj->stats.rx.rcvd_reo[i].bytes;
  542. }
  543. srcobj->stats.rx.unicast.num =
  544. srcobj->stats.rx.to_stack.num -
  545. srcobj->stats.rx.multicast.num;
  546. srcobj->stats.rx.unicast.bytes =
  547. srcobj->stats.rx.to_stack.bytes -
  548. srcobj->stats.rx.multicast.bytes;
  549. tgtobj->rx.unicast.num += srcobj->stats.rx.unicast.num;
  550. tgtobj->rx.unicast.bytes += srcobj->stats.rx.unicast.bytes;
  551. tgtobj->rx.multicast.num += srcobj->stats.rx.multicast.num;
  552. tgtobj->rx.multicast.bytes += srcobj->stats.rx.multicast.bytes;
  553. tgtobj->rx.bcast.num += srcobj->stats.rx.bcast.num;
  554. tgtobj->rx.bcast.bytes += srcobj->stats.rx.bcast.bytes;
  555. tgtobj->rx.raw.num += srcobj->stats.rx.raw.num;
  556. tgtobj->rx.raw.bytes += srcobj->stats.rx.raw.bytes;
  557. tgtobj->rx.intra_bss.pkts.num +=
  558. srcobj->stats.rx.intra_bss.pkts.num;
  559. tgtobj->rx.intra_bss.pkts.bytes +=
  560. srcobj->stats.rx.intra_bss.pkts.bytes;
  561. tgtobj->rx.intra_bss.fail.num +=
  562. srcobj->stats.rx.intra_bss.fail.num;
  563. tgtobj->rx.intra_bss.fail.bytes +=
  564. srcobj->stats.rx.intra_bss.fail.bytes;
  565. tgtobj->tx.last_ack_rssi =
  566. srcobj->stats.tx.last_ack_rssi;
  567. tgtobj->rx.mec_drop.num += srcobj->stats.rx.mec_drop.num;
  568. tgtobj->rx.mec_drop.bytes += srcobj->stats.rx.mec_drop.bytes;
  569. }
  570. #define DP_UPDATE_STATS(_tgtobj, _srcobj) \
  571. do { \
  572. uint8_t i; \
  573. uint8_t pream_type; \
  574. for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) { \
  575. for (i = 0; i < MAX_MCS; i++) { \
  576. DP_STATS_AGGR(_tgtobj, _srcobj, \
  577. tx.pkt_type[pream_type].mcs_count[i]); \
  578. DP_STATS_AGGR(_tgtobj, _srcobj, \
  579. rx.pkt_type[pream_type].mcs_count[i]); \
  580. } \
  581. } \
  582. \
  583. for (i = 0; i < MAX_BW; i++) { \
  584. DP_STATS_AGGR(_tgtobj, _srcobj, tx.bw[i]); \
  585. DP_STATS_AGGR(_tgtobj, _srcobj, rx.bw[i]); \
  586. } \
  587. \
  588. for (i = 0; i < SS_COUNT; i++) { \
  589. DP_STATS_AGGR(_tgtobj, _srcobj, rx.nss[i]); \
  590. DP_STATS_AGGR(_tgtobj, _srcobj, tx.nss[i]); \
  591. } \
  592. for (i = 0; i < WME_AC_MAX; i++) { \
  593. DP_STATS_AGGR(_tgtobj, _srcobj, tx.wme_ac_type[i]); \
  594. DP_STATS_AGGR(_tgtobj, _srcobj, rx.wme_ac_type[i]); \
  595. DP_STATS_AGGR(_tgtobj, _srcobj, tx.excess_retries_per_ac[i]); \
  596. \
  597. } \
  598. \
  599. for (i = 0; i < MAX_GI; i++) { \
  600. DP_STATS_AGGR(_tgtobj, _srcobj, tx.sgi_count[i]); \
  601. DP_STATS_AGGR(_tgtobj, _srcobj, rx.sgi_count[i]); \
  602. } \
  603. \
  604. for (i = 0; i < MAX_RECEPTION_TYPES; i++) \
  605. DP_STATS_AGGR(_tgtobj, _srcobj, rx.reception_type[i]); \
  606. \
  607. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.comp_pkt); \
  608. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.ucast); \
  609. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.mcast); \
  610. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.bcast); \
  611. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.tx_success); \
  612. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.nawds_mcast); \
  613. DP_STATS_AGGR(_tgtobj, _srcobj, tx.nawds_mcast_drop); \
  614. DP_STATS_AGGR(_tgtobj, _srcobj, tx.tx_failed); \
  615. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ofdma); \
  616. DP_STATS_AGGR(_tgtobj, _srcobj, tx.stbc); \
  617. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ldpc); \
  618. DP_STATS_AGGR(_tgtobj, _srcobj, tx.retries); \
  619. DP_STATS_AGGR(_tgtobj, _srcobj, tx.non_amsdu_cnt); \
  620. DP_STATS_AGGR(_tgtobj, _srcobj, tx.amsdu_cnt); \
  621. DP_STATS_AGGR(_tgtobj, _srcobj, tx.non_ampdu_cnt); \
  622. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ampdu_cnt); \
  623. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.dropped.fw_rem); \
  624. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_tx); \
  625. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_notx); \
  626. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason1); \
  627. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason2); \
  628. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason3); \
  629. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.age_out); \
  630. \
  631. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.mic_err); \
  632. if (_srcobj->stats.rx.rssi != 0) \
  633. DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rssi); \
  634. DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rx_rate); \
  635. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.decrypt_err); \
  636. DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_ampdu_cnt); \
  637. DP_STATS_AGGR(_tgtobj, _srcobj, rx.ampdu_cnt); \
  638. DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_amsdu_cnt); \
  639. DP_STATS_AGGR(_tgtobj, _srcobj, rx.amsdu_cnt); \
  640. DP_STATS_AGGR(_tgtobj, _srcobj, rx.nawds_mcast_drop); \
  641. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.to_stack); \
  642. \
  643. for (i = 0; i < CDP_MAX_RX_RINGS; i++) \
  644. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.rcvd_reo[i]); \
  645. \
  646. _srcobj->stats.rx.unicast.num = \
  647. _srcobj->stats.rx.to_stack.num - \
  648. _srcobj->stats.rx.multicast.num; \
  649. _srcobj->stats.rx.unicast.bytes = \
  650. _srcobj->stats.rx.to_stack.bytes - \
  651. _srcobj->stats.rx.multicast.bytes; \
  652. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.unicast); \
  653. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.multicast); \
  654. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.bcast); \
  655. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.raw); \
  656. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.pkts); \
  657. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.fail); \
  658. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.mec_drop); \
  659. \
  660. _tgtobj->stats.tx.last_ack_rssi = \
  661. _srcobj->stats.tx.last_ack_rssi; \
  662. } while (0)
  663. extern int dp_peer_find_attach(struct dp_soc *soc);
  664. extern void dp_peer_find_detach(struct dp_soc *soc);
  665. extern void dp_peer_find_hash_add(struct dp_soc *soc, struct dp_peer *peer);
  666. extern void dp_peer_find_hash_remove(struct dp_soc *soc, struct dp_peer *peer);
  667. extern void dp_peer_find_hash_erase(struct dp_soc *soc);
  668. extern void dp_peer_rx_init(struct dp_pdev *pdev, struct dp_peer *peer);
  669. void dp_peer_tx_init(struct dp_pdev *pdev, struct dp_peer *peer);
  670. extern void dp_peer_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  671. extern void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  672. extern void dp_peer_unref_delete(void *peer_handle);
  673. extern void dp_rx_discard(struct dp_vdev *vdev, struct dp_peer *peer,
  674. unsigned tid, qdf_nbuf_t msdu_list);
  675. extern void *dp_find_peer_by_addr(struct cdp_pdev *dev,
  676. uint8_t *peer_mac_addr, uint8_t *peer_id);
  677. extern struct dp_peer *dp_peer_find_hash_find(struct dp_soc *soc,
  678. uint8_t *peer_mac_addr, int mac_addr_is_aligned, uint8_t vdev_id);
  679. #ifndef CONFIG_WIN
  680. QDF_STATUS dp_register_peer(struct cdp_pdev *pdev_handle,
  681. struct ol_txrx_desc_type *sta_desc);
  682. QDF_STATUS dp_clear_peer(struct cdp_pdev *pdev_handle, uint8_t local_id);
  683. void *dp_find_peer_by_addr_and_vdev(struct cdp_pdev *pdev_handle,
  684. struct cdp_vdev *vdev,
  685. uint8_t *peer_addr, uint8_t *local_id);
  686. uint16_t dp_local_peer_id(void *peer);
  687. void *dp_peer_find_by_local_id(struct cdp_pdev *pdev_handle, uint8_t local_id);
  688. QDF_STATUS dp_peer_state_update(struct cdp_pdev *pdev_handle, uint8_t *peer_mac,
  689. enum ol_txrx_peer_state state);
  690. QDF_STATUS dp_get_vdevid(void *peer_handle, uint8_t *vdev_id);
  691. struct cdp_vdev *dp_get_vdev_by_sta_id(struct cdp_pdev *pdev_handle,
  692. uint8_t sta_id);
  693. struct cdp_vdev *dp_get_vdev_for_peer(void *peer);
  694. uint8_t *dp_peer_get_peer_mac_addr(void *peer);
  695. int dp_get_peer_state(void *peer_handle);
  696. void dp_local_peer_id_pool_init(struct dp_pdev *pdev);
  697. void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer);
  698. void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer);
  699. #else
  700. static inline void dp_local_peer_id_pool_init(struct dp_pdev *pdev)
  701. {
  702. }
  703. static inline
  704. void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer)
  705. {
  706. }
  707. static inline
  708. void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer)
  709. {
  710. }
  711. #endif
  712. int dp_addba_resp_tx_completion_wifi3(void *peer_handle, uint8_t tid,
  713. int status);
  714. extern int dp_addba_requestprocess_wifi3(void *peer_handle,
  715. uint8_t dialogtoken, uint16_t tid, uint16_t batimeout,
  716. uint16_t buffersize, uint16_t startseqnum);
  717. extern void dp_addba_responsesetup_wifi3(void *peer_handle, uint8_t tid,
  718. uint8_t *dialogtoken, uint16_t *statuscode,
  719. uint16_t *buffersize, uint16_t *batimeout);
  720. extern void dp_set_addba_response(void *peer_handle, uint8_t tid,
  721. uint16_t statuscode);
  722. extern int dp_delba_process_wifi3(void *peer_handle,
  723. int tid, uint16_t reasoncode);
  724. /*
  725. * dp_delba_tx_completion_wifi3() - Handle delba tx completion
  726. *
  727. * @peer_handle: Peer handle
  728. * @tid: Tid number
  729. * @status: Tx completion status
  730. * Indicate status of delba Tx to DP for stats update and retry
  731. * delba if tx failed.
  732. *
  733. */
  734. int dp_delba_tx_completion_wifi3(void *peer_handle, uint8_t tid,
  735. int status);
  736. extern int dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid,
  737. uint32_t ba_window_size, uint32_t start_seq);
  738. extern QDF_STATUS dp_reo_send_cmd(struct dp_soc *soc,
  739. enum hal_reo_cmd_type type, struct hal_reo_cmd_params *params,
  740. void (*callback_fn), void *data);
  741. extern void dp_reo_cmdlist_destroy(struct dp_soc *soc);
  742. /**
  743. * dp_reo_status_ring_handler - Handler for REO Status ring
  744. * @soc: DP Soc handle
  745. *
  746. * Returns: Number of descriptors reaped
  747. */
  748. uint32_t dp_reo_status_ring_handler(struct dp_soc *soc);
  749. void dp_aggregate_vdev_stats(struct dp_vdev *vdev,
  750. struct cdp_vdev_stats *vdev_stats);
  751. void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  752. union hal_reo_status *reo_status);
  753. void dp_rx_bar_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  754. union hal_reo_status *reo_status);
  755. uint16_t dp_tx_me_send_convert_ucast(struct cdp_vdev *vdev_handle,
  756. qdf_nbuf_t nbuf, uint8_t newmac[][QDF_MAC_ADDR_SIZE],
  757. uint8_t new_mac_cnt);
  758. void dp_tx_me_alloc_descriptor(struct cdp_pdev *pdev);
  759. void dp_tx_me_free_descriptor(struct cdp_pdev *pdev);
  760. QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
  761. uint32_t stats_type_upload_mask, uint32_t config_param_0,
  762. uint32_t config_param_1, uint32_t config_param_2,
  763. uint32_t config_param_3, int cookie, int cookie_msb,
  764. uint8_t mac_id);
  765. void dp_htt_stats_print_tag(uint8_t tag_type, uint32_t *tag_buf);
  766. void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf);
  767. void dp_peer_rxtid_stats(struct dp_peer *peer, void (*callback_fn),
  768. void *cb_ctxt);
  769. void dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle,
  770. struct cdp_peer *peer_handle, enum cdp_sec_type sec_type,
  771. uint32_t *rx_pn);
  772. void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id);
  773. void dp_set_michael_key(struct cdp_peer *peer_handle,
  774. bool is_unicast, uint32_t *key);
  775. #ifdef CONFIG_WIN
  776. uint32_t dp_pdev_tid_stats_display(void *pdev_handle,
  777. enum _ol_ath_param_t param, uint32_t value, void *buff);
  778. #endif
  779. void dp_update_delay_stats(struct dp_pdev *pdev, uint32_t delay,
  780. uint8_t tid, uint8_t mode);
  781. /**
  782. * dp_print_ring_stats(): Print tail and head pointer
  783. * @pdev: DP_PDEV handle
  784. *
  785. * Return:void
  786. */
  787. void dp_print_ring_stats(struct dp_pdev *pdev);
  788. /**
  789. * dp_print_pdev_cfg_params() - Print the pdev cfg parameters
  790. * @pdev_handle: DP pdev handle
  791. *
  792. * Return - void
  793. */
  794. void dp_print_pdev_cfg_params(struct dp_pdev *pdev);
  795. /**
  796. * dp_print_soc_cfg_params()- Dump soc wlan config parameters
  797. * @soc_handle: Soc handle
  798. *
  799. * Return: void
  800. */
  801. void dp_print_soc_cfg_params(struct dp_soc *soc);
  802. /**
  803. * dp_srng_get_str_from_ring_type() - Return string name for a ring
  804. * @ring_type: Ring
  805. *
  806. * Return: char const pointer
  807. */
  808. const
  809. char *dp_srng_get_str_from_hal_ring_type(enum hal_ring_type ring_type);
  810. /*
  811. * dp_txrx_path_stats() - Function to display dump stats
  812. * @soc - soc handle
  813. *
  814. * return: none
  815. */
  816. void dp_txrx_path_stats(struct dp_soc *soc);
  817. /*
  818. * dp_print_per_ring_stats(): Packet count per ring
  819. * @soc - soc handle
  820. *
  821. * Return - None
  822. */
  823. void dp_print_per_ring_stats(struct dp_soc *soc);
  824. /**
  825. * dp_aggregate_pdev_stats(): Consolidate stats at PDEV level
  826. * @pdev: DP PDEV handle
  827. *
  828. * return: void
  829. */
  830. void dp_aggregate_pdev_stats(struct dp_pdev *pdev);
  831. /**
  832. * dp_print_rx_rates(): Print Rx rate stats
  833. * @vdev: DP_VDEV handle
  834. *
  835. * Return:void
  836. */
  837. void dp_print_rx_rates(struct dp_vdev *vdev);
  838. /**
  839. * dp_print_tx_rates(): Print tx rates
  840. * @vdev: DP_VDEV handle
  841. *
  842. * Return:void
  843. */
  844. void dp_print_tx_rates(struct dp_vdev *vdev);
  845. /**
  846. * dp_print_peer_stats():print peer stats
  847. * @peer: DP_PEER handle
  848. *
  849. * return void
  850. */
  851. void dp_print_peer_stats(struct dp_peer *peer);
  852. /**
  853. * dp_get_mac_id_for_pdev() - Return mac corresponding to pdev for mac
  854. *
  855. * @mac_id: MAC id
  856. * @pdev_id: pdev_id corresponding to pdev, 0 for MCL
  857. *
  858. * Single pdev using both MACs will operate on both MAC rings,
  859. * which is the case for MCL.
  860. * For WIN each PDEV will operate one ring, so index is zero.
  861. *
  862. */
  863. static inline int dp_get_mac_id_for_pdev(uint32_t mac_id, uint32_t pdev_id)
  864. {
  865. if (mac_id && pdev_id) {
  866. qdf_print("Both mac_id and pdev_id cannot be non zero");
  867. QDF_BUG(0);
  868. return 0;
  869. }
  870. return (mac_id + pdev_id);
  871. }
  872. /*
  873. * dp_get_mac_id_for_mac() - Return mac corresponding WIN and MCL mac_ids
  874. *
  875. * @soc: handle to DP soc
  876. * @mac_id: MAC id
  877. *
  878. * Single pdev using both MACs will operate on both MAC rings,
  879. * which is the case for MCL.
  880. * For WIN each PDEV will operate one ring, so index is zero.
  881. *
  882. */
  883. static inline int dp_get_mac_id_for_mac(struct dp_soc *soc, uint32_t mac_id)
  884. {
  885. /*
  886. * Single pdev using both MACs will operate on both MAC rings,
  887. * which is the case for MCL.
  888. */
  889. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx))
  890. return mac_id;
  891. /* For WIN each PDEV will operate one ring, so index is zero. */
  892. return 0;
  893. }
  894. bool dp_is_soc_reinit(struct dp_soc *soc);
  895. #ifdef WDI_EVENT_ENABLE
  896. QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  897. uint32_t stats_type_upload_mask,
  898. uint8_t mac_id);
  899. int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
  900. void *event_cb_sub_handle,
  901. uint32_t event);
  902. int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
  903. void *event_cb_sub_handle,
  904. uint32_t event);
  905. void dp_wdi_event_handler(enum WDI_EVENT event, void *soc,
  906. void *data, u_int16_t peer_id,
  907. int status, u_int8_t pdev_id);
  908. int dp_wdi_event_attach(struct dp_pdev *txrx_pdev);
  909. int dp_wdi_event_detach(struct dp_pdev *txrx_pdev);
  910. int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  911. bool enable);
  912. void *dp_get_pldev(struct cdp_pdev *txrx_pdev);
  913. void dp_pkt_log_init(struct cdp_pdev *ppdev, void *scn);
  914. static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context,
  915. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id)
  916. {
  917. struct hif_msg_callbacks hif_pipe_callbacks;
  918. struct dp_soc *dp_soc = (struct dp_soc *)soc;
  919. /* TODO: Temporary change to bypass HTC connection for this new
  920. * HIF pipe, which will be used for packet log and other high-
  921. * priority HTT messages. Proper HTC connection to be added
  922. * later once required FW changes are available
  923. */
  924. hif_pipe_callbacks.rxCompletionHandler = callback;
  925. hif_pipe_callbacks.Context = cb_context;
  926. hif_update_pipe_callback(dp_soc->hif_handle,
  927. DP_HTT_T2H_HP_PIPE, &hif_pipe_callbacks);
  928. }
  929. QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer);
  930. #else
  931. static inline int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
  932. void *event_cb_sub_handle,
  933. uint32_t event)
  934. {
  935. return 0;
  936. }
  937. static inline int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
  938. void *event_cb_sub_handle,
  939. uint32_t event)
  940. {
  941. return 0;
  942. }
  943. static inline void dp_wdi_event_handler(enum WDI_EVENT event, void *soc,
  944. void *data, u_int16_t peer_id,
  945. int status, u_int8_t pdev_id)
  946. {
  947. }
  948. static inline int dp_wdi_event_attach(struct dp_pdev *txrx_pdev)
  949. {
  950. return 0;
  951. }
  952. static inline int dp_wdi_event_detach(struct dp_pdev *txrx_pdev)
  953. {
  954. return 0;
  955. }
  956. static inline int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  957. bool enable)
  958. {
  959. return 0;
  960. }
  961. static inline QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  962. uint32_t stats_type_upload_mask, uint8_t mac_id)
  963. {
  964. return 0;
  965. }
  966. static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context,
  967. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id)
  968. {
  969. }
  970. static inline QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer)
  971. {
  972. return QDF_STATUS_SUCCESS;
  973. }
  974. #endif /* CONFIG_WIN */
  975. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  976. void dp_tx_dump_flow_pool_info(void *soc);
  977. int dp_tx_delete_flow_pool(struct dp_soc *soc, struct dp_tx_desc_pool_s *pool,
  978. bool force);
  979. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  980. #ifdef PEER_PROTECTED_ACCESS
  981. /**
  982. * dp_peer_unref_del_find_by_id() - dec ref and del peer if ref count is
  983. * taken by dp_peer_find_by_id
  984. * @peer: peer context
  985. *
  986. * Return: none
  987. */
  988. static inline void dp_peer_unref_del_find_by_id(struct dp_peer *peer)
  989. {
  990. dp_peer_unref_delete(peer);
  991. }
  992. #else
  993. static inline void dp_peer_unref_del_find_by_id(struct dp_peer *peer)
  994. {
  995. }
  996. #endif
  997. #ifdef CONFIG_WIN
  998. /**
  999. * dp_pdev_print_delay_stats(): Print pdev level delay stats
  1000. * @pdev: DP_PDEV handle
  1001. *
  1002. * Return:void
  1003. */
  1004. void dp_pdev_print_delay_stats(struct dp_pdev *pdev);
  1005. /**
  1006. * dp_pdev_print_tid_stats(): Print pdev level tid stats
  1007. * @pdev: DP_PDEV handle
  1008. *
  1009. * Return:void
  1010. */
  1011. void dp_pdev_print_tid_stats(struct dp_pdev *pdev);
  1012. #endif /* CONFIG_WIN */
  1013. void dp_soc_set_txrx_ring_map(struct dp_soc *soc);
  1014. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  1015. /**
  1016. * dp_tx_ppdu_stats_attach - Initialize Tx PPDU stats and enhanced capture
  1017. * @pdev: DP PDEV
  1018. *
  1019. * Return: none
  1020. */
  1021. static inline void dp_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  1022. {
  1023. }
  1024. /**
  1025. * dp_tx_ppdu_stats_detach - Cleanup Tx PPDU stats and enhanced capture
  1026. * @pdev: DP PDEV
  1027. *
  1028. * Return: none
  1029. */
  1030. static inline void dp_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  1031. {
  1032. }
  1033. /**
  1034. * dp_tx_ppdu_stats_process - Deferred PPDU stats handler
  1035. * @context: Opaque work context (PDEV)
  1036. *
  1037. * Return: none
  1038. */
  1039. static inline void dp_tx_ppdu_stats_process(void *context)
  1040. {
  1041. }
  1042. /**
  1043. * dp_tx_add_to_comp_queue() - add completion msdu to queue
  1044. * @soc: DP Soc handle
  1045. * @tx_desc: software Tx descriptor
  1046. * @ts : Tx completion status from HAL/HTT descriptor
  1047. * @peer: DP peer
  1048. *
  1049. * Return: none
  1050. */
  1051. static inline
  1052. QDF_STATUS dp_tx_add_to_comp_queue(struct dp_soc *soc,
  1053. struct dp_tx_desc_s *desc,
  1054. struct hal_tx_completion_status *ts,
  1055. struct dp_peer *peer)
  1056. {
  1057. return QDF_STATUS_E_FAILURE;
  1058. }
  1059. #endif
  1060. #endif /* #ifndef _DP_INTERNAL_H_ */