dp_internal.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  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. extern void dp_reo_status_ring_handler(struct dp_soc *soc);
  743. void dp_aggregate_vdev_stats(struct dp_vdev *vdev,
  744. struct cdp_vdev_stats *vdev_stats);
  745. void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  746. union hal_reo_status *reo_status);
  747. void dp_rx_bar_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  748. union hal_reo_status *reo_status);
  749. uint16_t dp_tx_me_send_convert_ucast(struct cdp_vdev *vdev_handle,
  750. qdf_nbuf_t nbuf, uint8_t newmac[][QDF_MAC_ADDR_SIZE],
  751. uint8_t new_mac_cnt);
  752. void dp_tx_me_alloc_descriptor(struct cdp_pdev *pdev);
  753. void dp_tx_me_free_descriptor(struct cdp_pdev *pdev);
  754. QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
  755. uint32_t stats_type_upload_mask, uint32_t config_param_0,
  756. uint32_t config_param_1, uint32_t config_param_2,
  757. uint32_t config_param_3, int cookie, int cookie_msb,
  758. uint8_t mac_id);
  759. void dp_htt_stats_print_tag(uint8_t tag_type, uint32_t *tag_buf);
  760. void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf);
  761. void dp_peer_rxtid_stats(struct dp_peer *peer, void (*callback_fn),
  762. void *cb_ctxt);
  763. void dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle,
  764. struct cdp_peer *peer_handle, enum cdp_sec_type sec_type,
  765. uint32_t *rx_pn);
  766. void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id);
  767. void dp_set_michael_key(struct cdp_peer *peer_handle,
  768. bool is_unicast, uint32_t *key);
  769. #ifdef CONFIG_WIN
  770. uint32_t dp_pdev_tid_stats_display(void *pdev_handle,
  771. enum _ol_ath_param_t param, uint32_t value, void *buff);
  772. #endif
  773. void dp_update_delay_stats(struct dp_pdev *pdev, uint32_t delay,
  774. uint8_t tid, uint8_t mode);
  775. /**
  776. * dp_print_ring_stats(): Print tail and head pointer
  777. * @pdev: DP_PDEV handle
  778. *
  779. * Return:void
  780. */
  781. void dp_print_ring_stats(struct dp_pdev *pdev);
  782. /**
  783. * dp_print_pdev_cfg_params() - Print the pdev cfg parameters
  784. * @pdev_handle: DP pdev handle
  785. *
  786. * Return - void
  787. */
  788. void dp_print_pdev_cfg_params(struct dp_pdev *pdev);
  789. /**
  790. * dp_print_soc_cfg_params()- Dump soc wlan config parameters
  791. * @soc_handle: Soc handle
  792. *
  793. * Return: void
  794. */
  795. void dp_print_soc_cfg_params(struct dp_soc *soc);
  796. /**
  797. * dp_srng_get_str_from_ring_type() - Return string name for a ring
  798. * @ring_type: Ring
  799. *
  800. * Return: char const pointer
  801. */
  802. const
  803. char *dp_srng_get_str_from_hal_ring_type(enum hal_ring_type ring_type);
  804. /**
  805. * dp_get_mac_id_for_pdev() - Return mac corresponding to pdev for mac
  806. *
  807. * @mac_id: MAC id
  808. * @pdev_id: pdev_id corresponding to pdev, 0 for MCL
  809. *
  810. * Single pdev using both MACs will operate on both MAC rings,
  811. * which is the case for MCL.
  812. * For WIN each PDEV will operate one ring, so index is zero.
  813. *
  814. */
  815. static inline int dp_get_mac_id_for_pdev(uint32_t mac_id, uint32_t pdev_id)
  816. {
  817. if (mac_id && pdev_id) {
  818. qdf_print("Both mac_id and pdev_id cannot be non zero");
  819. QDF_BUG(0);
  820. return 0;
  821. }
  822. return (mac_id + pdev_id);
  823. }
  824. /*
  825. * dp_get_mac_id_for_mac() - Return mac corresponding WIN and MCL mac_ids
  826. *
  827. * @soc: handle to DP soc
  828. * @mac_id: MAC id
  829. *
  830. * Single pdev using both MACs will operate on both MAC rings,
  831. * which is the case for MCL.
  832. * For WIN each PDEV will operate one ring, so index is zero.
  833. *
  834. */
  835. static inline int dp_get_mac_id_for_mac(struct dp_soc *soc, uint32_t mac_id)
  836. {
  837. /*
  838. * Single pdev using both MACs will operate on both MAC rings,
  839. * which is the case for MCL.
  840. */
  841. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx))
  842. return mac_id;
  843. /* For WIN each PDEV will operate one ring, so index is zero. */
  844. return 0;
  845. }
  846. bool dp_is_soc_reinit(struct dp_soc *soc);
  847. #ifdef WDI_EVENT_ENABLE
  848. QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  849. uint32_t stats_type_upload_mask,
  850. uint8_t mac_id);
  851. int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
  852. void *event_cb_sub_handle,
  853. uint32_t event);
  854. int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
  855. void *event_cb_sub_handle,
  856. uint32_t event);
  857. void dp_wdi_event_handler(enum WDI_EVENT event, void *soc,
  858. void *data, u_int16_t peer_id,
  859. int status, u_int8_t pdev_id);
  860. int dp_wdi_event_attach(struct dp_pdev *txrx_pdev);
  861. int dp_wdi_event_detach(struct dp_pdev *txrx_pdev);
  862. int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  863. bool enable);
  864. void *dp_get_pldev(struct cdp_pdev *txrx_pdev);
  865. void dp_pkt_log_init(struct cdp_pdev *ppdev, void *scn);
  866. static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context,
  867. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id)
  868. {
  869. struct hif_msg_callbacks hif_pipe_callbacks;
  870. struct dp_soc *dp_soc = (struct dp_soc *)soc;
  871. /* TODO: Temporary change to bypass HTC connection for this new
  872. * HIF pipe, which will be used for packet log and other high-
  873. * priority HTT messages. Proper HTC connection to be added
  874. * later once required FW changes are available
  875. */
  876. hif_pipe_callbacks.rxCompletionHandler = callback;
  877. hif_pipe_callbacks.Context = cb_context;
  878. hif_update_pipe_callback(dp_soc->hif_handle,
  879. DP_HTT_T2H_HP_PIPE, &hif_pipe_callbacks);
  880. }
  881. QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer);
  882. #else
  883. static inline int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
  884. void *event_cb_sub_handle,
  885. uint32_t event)
  886. {
  887. return 0;
  888. }
  889. static inline int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
  890. void *event_cb_sub_handle,
  891. uint32_t event)
  892. {
  893. return 0;
  894. }
  895. static inline void dp_wdi_event_handler(enum WDI_EVENT event, void *soc,
  896. void *data, u_int16_t peer_id,
  897. int status, u_int8_t pdev_id)
  898. {
  899. }
  900. static inline int dp_wdi_event_attach(struct dp_pdev *txrx_pdev)
  901. {
  902. return 0;
  903. }
  904. static inline int dp_wdi_event_detach(struct dp_pdev *txrx_pdev)
  905. {
  906. return 0;
  907. }
  908. static inline int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  909. bool enable)
  910. {
  911. return 0;
  912. }
  913. static inline QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  914. uint32_t stats_type_upload_mask, uint8_t mac_id)
  915. {
  916. return 0;
  917. }
  918. static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context,
  919. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id)
  920. {
  921. }
  922. static inline QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer)
  923. {
  924. return QDF_STATUS_SUCCESS;
  925. }
  926. #endif /* CONFIG_WIN */
  927. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  928. void dp_tx_dump_flow_pool_info(void *soc);
  929. int dp_tx_delete_flow_pool(struct dp_soc *soc, struct dp_tx_desc_pool_s *pool,
  930. bool force);
  931. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  932. #ifdef PEER_PROTECTED_ACCESS
  933. /**
  934. * dp_peer_unref_del_find_by_id() - dec ref and del peer if ref count is
  935. * taken by dp_peer_find_by_id
  936. * @peer: peer context
  937. *
  938. * Return: none
  939. */
  940. static inline void dp_peer_unref_del_find_by_id(struct dp_peer *peer)
  941. {
  942. dp_peer_unref_delete(peer);
  943. }
  944. #else
  945. static inline void dp_peer_unref_del_find_by_id(struct dp_peer *peer)
  946. {
  947. }
  948. #endif
  949. #ifdef CONFIG_WIN
  950. /**
  951. * dp_pdev_print_delay_stats(): Print pdev level delay stats
  952. * @pdev: DP_PDEV handle
  953. *
  954. * Return:void
  955. */
  956. void dp_pdev_print_delay_stats(struct dp_pdev *pdev);
  957. /**
  958. * dp_pdev_print_tid_stats(): Print pdev level tid stats
  959. * @pdev: DP_PDEV handle
  960. *
  961. * Return:void
  962. */
  963. void dp_pdev_print_tid_stats(struct dp_pdev *pdev);
  964. #endif /* CONFIG_WIN */
  965. void dp_soc_set_txrx_ring_map(struct dp_soc *soc);
  966. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  967. /**
  968. * dp_tx_ppdu_stats_attach - Initialize Tx PPDU stats and enhanced capture
  969. * @pdev: DP PDEV
  970. *
  971. * Return: none
  972. */
  973. static inline void dp_tx_ppdu_stats_attach(struct dp_pdev *pdev)
  974. {
  975. }
  976. /**
  977. * dp_tx_ppdu_stats_detach - Cleanup Tx PPDU stats and enhanced capture
  978. * @pdev: DP PDEV
  979. *
  980. * Return: none
  981. */
  982. static inline void dp_tx_ppdu_stats_detach(struct dp_pdev *pdev)
  983. {
  984. }
  985. /**
  986. * dp_tx_ppdu_stats_process - Deferred PPDU stats handler
  987. * @context: Opaque work context (PDEV)
  988. *
  989. * Return: none
  990. */
  991. static inline void dp_tx_ppdu_stats_process(void *context)
  992. {
  993. }
  994. /**
  995. * dp_tx_add_to_comp_queue() - add completion msdu to queue
  996. * @soc: DP Soc handle
  997. * @tx_desc: software Tx descriptor
  998. * @ts : Tx completion status from HAL/HTT descriptor
  999. * @peer: DP peer
  1000. *
  1001. * Return: none
  1002. */
  1003. static inline
  1004. QDF_STATUS dp_tx_add_to_comp_queue(struct dp_soc *soc,
  1005. struct dp_tx_desc_s *desc,
  1006. struct hal_tx_completion_status *ts,
  1007. struct dp_peer *peer)
  1008. {
  1009. return QDF_STATUS_E_FAILURE;
  1010. }
  1011. #endif
  1012. #endif /* #ifndef _DP_INTERNAL_H_ */