dp_internal.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. /*
  2. * Copyright (c) 2016-2018 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. #if DP_PRINT_ENABLE
  23. #include <stdarg.h> /* va_list */
  24. #include <qdf_types.h> /* qdf_vprint */
  25. #include <cdp_txrx_handle.h>
  26. enum {
  27. /* FATAL_ERR - print only irrecoverable error messages */
  28. DP_PRINT_LEVEL_FATAL_ERR,
  29. /* ERR - include non-fatal err messages */
  30. DP_PRINT_LEVEL_ERR,
  31. /* WARN - include warnings */
  32. DP_PRINT_LEVEL_WARN,
  33. /* INFO1 - include fundamental, infrequent events */
  34. DP_PRINT_LEVEL_INFO1,
  35. /* INFO2 - include non-fundamental but infrequent events */
  36. DP_PRINT_LEVEL_INFO2,
  37. };
  38. #define dp_print(level, fmt, ...) do { \
  39. if (level <= g_txrx_print_level) \
  40. qdf_print(fmt, ## __VA_ARGS__); \
  41. while (0)
  42. #define DP_PRINT(level, fmt, ...) do { \
  43. dp_print(level, "DP: " fmt, ## __VA_ARGS__); \
  44. while (0)
  45. #else
  46. #define DP_PRINT(level, fmt, ...)
  47. #endif /* DP_PRINT_ENABLE */
  48. #define DP_TRACE(LVL, fmt, args ...) \
  49. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \
  50. fmt, ## args)
  51. #define DP_TRACE_STATS(LVL, fmt, args ...) \
  52. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_##LVL, \
  53. fmt, ## args)
  54. #define DP_PRINT_STATS(fmt, args ...) \
  55. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, \
  56. fmt, ## args)
  57. #define DP_STATS_INIT(_handle) \
  58. qdf_mem_set(&((_handle)->stats), sizeof((_handle)->stats), 0x0)
  59. #define DP_STATS_CLR(_handle) \
  60. qdf_mem_set(&((_handle)->stats), sizeof((_handle)->stats), 0x0)
  61. #ifndef DISABLE_DP_STATS
  62. #define DP_STATS_INC(_handle, _field, _delta) \
  63. { \
  64. if (likely(_handle)) \
  65. _handle->stats._field += _delta; \
  66. }
  67. #define DP_STATS_INCC(_handle, _field, _delta, _cond) \
  68. { \
  69. if (_cond && likely(_handle)) \
  70. _handle->stats._field += _delta; \
  71. }
  72. #define DP_STATS_DEC(_handle, _field, _delta) \
  73. { \
  74. if (likely(_handle)) \
  75. _handle->stats._field -= _delta; \
  76. }
  77. #define DP_STATS_UPD(_handle, _field, _delta) \
  78. { \
  79. if (likely(_handle)) \
  80. _handle->stats._field = _delta; \
  81. }
  82. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes) \
  83. { \
  84. DP_STATS_INC(_handle, _field.num, _count); \
  85. DP_STATS_INC(_handle, _field.bytes, _bytes) \
  86. }
  87. #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond) \
  88. { \
  89. DP_STATS_INCC(_handle, _field.num, _count, _cond); \
  90. DP_STATS_INCC(_handle, _field.bytes, _bytes, _cond) \
  91. }
  92. #define DP_STATS_AGGR(_handle_a, _handle_b, _field) \
  93. { \
  94. _handle_a->stats._field += _handle_b->stats._field; \
  95. }
  96. #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field) \
  97. { \
  98. DP_STATS_AGGR(_handle_a, _handle_b, _field.num); \
  99. DP_STATS_AGGR(_handle_a, _handle_b, _field.bytes);\
  100. }
  101. #define DP_STATS_UPD_STRUCT(_handle_a, _handle_b, _field) \
  102. { \
  103. _handle_a->stats._field = _handle_b->stats._field; \
  104. }
  105. #define DP_HIST_INIT() \
  106. uint32_t num_of_packets[MAX_PDEV_CNT] = {0};
  107. #define DP_HIST_PACKET_COUNT_INC(_pdev_id) \
  108. { \
  109. ++num_of_packets[_pdev_id]; \
  110. }
  111. #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \
  112. do { \
  113. if (_p_cntrs == 1) { \
  114. DP_STATS_INC(_pdev, \
  115. tx_comp_histogram.pkts_1, 1); \
  116. } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \
  117. DP_STATS_INC(_pdev, \
  118. tx_comp_histogram.pkts_2_20, 1); \
  119. } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \
  120. DP_STATS_INC(_pdev, \
  121. tx_comp_histogram.pkts_21_40, 1); \
  122. } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \
  123. DP_STATS_INC(_pdev, \
  124. tx_comp_histogram.pkts_41_60, 1); \
  125. } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \
  126. DP_STATS_INC(_pdev, \
  127. tx_comp_histogram.pkts_61_80, 1); \
  128. } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \
  129. DP_STATS_INC(_pdev, \
  130. tx_comp_histogram.pkts_81_100, 1); \
  131. } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \
  132. DP_STATS_INC(_pdev, \
  133. tx_comp_histogram.pkts_101_200, 1); \
  134. } else if (_p_cntrs > 200) { \
  135. DP_STATS_INC(_pdev, \
  136. tx_comp_histogram.pkts_201_plus, 1); \
  137. } \
  138. } while (0)
  139. #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs) \
  140. do { \
  141. if (_p_cntrs == 1) { \
  142. DP_STATS_INC(_pdev, \
  143. rx_ind_histogram.pkts_1, 1); \
  144. } else if (_p_cntrs > 1 && _p_cntrs <= 20) { \
  145. DP_STATS_INC(_pdev, \
  146. rx_ind_histogram.pkts_2_20, 1); \
  147. } else if (_p_cntrs > 20 && _p_cntrs <= 40) { \
  148. DP_STATS_INC(_pdev, \
  149. rx_ind_histogram.pkts_21_40, 1); \
  150. } else if (_p_cntrs > 40 && _p_cntrs <= 60) { \
  151. DP_STATS_INC(_pdev, \
  152. rx_ind_histogram.pkts_41_60, 1); \
  153. } else if (_p_cntrs > 60 && _p_cntrs <= 80) { \
  154. DP_STATS_INC(_pdev, \
  155. rx_ind_histogram.pkts_61_80, 1); \
  156. } else if (_p_cntrs > 80 && _p_cntrs <= 100) { \
  157. DP_STATS_INC(_pdev, \
  158. rx_ind_histogram.pkts_81_100, 1); \
  159. } else if (_p_cntrs > 100 && _p_cntrs <= 200) { \
  160. DP_STATS_INC(_pdev, \
  161. rx_ind_histogram.pkts_101_200, 1); \
  162. } else if (_p_cntrs > 200) { \
  163. DP_STATS_INC(_pdev, \
  164. rx_ind_histogram.pkts_201_plus, 1); \
  165. } \
  166. } while (0)
  167. #define DP_TX_HIST_STATS_PER_PDEV() \
  168. do { \
  169. uint8_t hist_stats = 0; \
  170. for (hist_stats = 0; hist_stats < soc->pdev_count; \
  171. hist_stats++) { \
  172. DP_TX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \
  173. num_of_packets[hist_stats]); \
  174. } \
  175. } while (0)
  176. #define DP_RX_HIST_STATS_PER_PDEV() \
  177. do { \
  178. uint8_t hist_stats = 0; \
  179. for (hist_stats = 0; hist_stats < soc->pdev_count; \
  180. hist_stats++) { \
  181. DP_RX_HISTOGRAM_UPDATE(soc->pdev_list[hist_stats], \
  182. num_of_packets[hist_stats]); \
  183. } \
  184. } while (0)
  185. #else
  186. #define DP_STATS_INC(_handle, _field, _delta)
  187. #define DP_STATS_INCC(_handle, _field, _delta, _cond)
  188. #define DP_STATS_DEC(_handle, _field, _delta)
  189. #define DP_STATS_UPD(_handle, _field, _delta)
  190. #define DP_STATS_INC_PKT(_handle, _field, _count, _bytes)
  191. #define DP_STATS_INCC_PKT(_handle, _field, _count, _bytes, _cond)
  192. #define DP_STATS_AGGR(_handle_a, _handle_b, _field)
  193. #define DP_STATS_AGGR_PKT(_handle_a, _handle_b, _field)
  194. #define DP_HIST_INIT()
  195. #define DP_HIST_PACKET_COUNT_INC(_pdev_id)
  196. #define DP_TX_HISTOGRAM_UPDATE(_pdev, _p_cntrs)
  197. #define DP_RX_HISTOGRAM_UPDATE(_pdev, _p_cntrs)
  198. #define DP_RX_HIST_STATS_PER_PDEV()
  199. #define DP_TX_HIST_STATS_PER_PDEV()
  200. #endif
  201. #define DP_HTT_T2H_HP_PIPE 5
  202. #define DP_UPDATE_STATS(_tgtobj, _srcobj) \
  203. do { \
  204. uint8_t i; \
  205. uint8_t pream_type; \
  206. for (pream_type = 0; pream_type < DOT11_MAX; pream_type++) { \
  207. for (i = 0; i < MAX_MCS; i++) { \
  208. DP_STATS_AGGR(_tgtobj, _srcobj, \
  209. tx.pkt_type[pream_type].mcs_count[i]); \
  210. DP_STATS_AGGR(_tgtobj, _srcobj, \
  211. rx.pkt_type[pream_type].mcs_count[i]); \
  212. } \
  213. } \
  214. \
  215. for (i = 0; i < MAX_BW; i++) { \
  216. DP_STATS_AGGR(_tgtobj, _srcobj, tx.bw[i]); \
  217. DP_STATS_AGGR(_tgtobj, _srcobj, rx.bw[i]); \
  218. } \
  219. \
  220. for (i = 0; i < SS_COUNT; i++) { \
  221. DP_STATS_AGGR(_tgtobj, _srcobj, rx.nss[i]); \
  222. DP_STATS_AGGR(_tgtobj, _srcobj, tx.nss[i]); \
  223. } \
  224. for (i = 0; i < WME_AC_MAX; i++) { \
  225. DP_STATS_AGGR(_tgtobj, _srcobj, tx.wme_ac_type[i]); \
  226. DP_STATS_AGGR(_tgtobj, _srcobj, rx.wme_ac_type[i]); \
  227. DP_STATS_AGGR(_tgtobj, _srcobj, tx.excess_retries_per_ac[i]); \
  228. \
  229. } \
  230. \
  231. for (i = 0; i < MAX_GI; i++) { \
  232. DP_STATS_AGGR(_tgtobj, _srcobj, tx.sgi_count[i]); \
  233. DP_STATS_AGGR(_tgtobj, _srcobj, rx.sgi_count[i]); \
  234. } \
  235. \
  236. for (i = 0; i < MAX_RECEPTION_TYPES; i++) \
  237. DP_STATS_AGGR(_tgtobj, _srcobj, rx.reception_type[i]); \
  238. \
  239. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.comp_pkt); \
  240. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.ucast); \
  241. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.mcast); \
  242. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.bcast); \
  243. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.tx_success); \
  244. DP_STATS_AGGR(_tgtobj, _srcobj, tx.tx_failed); \
  245. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ofdma); \
  246. DP_STATS_AGGR(_tgtobj, _srcobj, tx.stbc); \
  247. DP_STATS_AGGR(_tgtobj, _srcobj, tx.ldpc); \
  248. DP_STATS_AGGR(_tgtobj, _srcobj, tx.retries); \
  249. DP_STATS_AGGR(_tgtobj, _srcobj, tx.non_amsdu_cnt); \
  250. DP_STATS_AGGR(_tgtobj, _srcobj, tx.amsdu_cnt); \
  251. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem); \
  252. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_tx); \
  253. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_rem_notx); \
  254. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason1); \
  255. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason2); \
  256. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.fw_reason3); \
  257. DP_STATS_AGGR(_tgtobj, _srcobj, tx.dropped.age_out); \
  258. \
  259. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.mic_err); \
  260. DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rssi); \
  261. DP_STATS_UPD_STRUCT(_tgtobj, _srcobj, rx.rx_rate); \
  262. DP_STATS_AGGR(_tgtobj, _srcobj, rx.err.decrypt_err); \
  263. DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_ampdu_cnt); \
  264. DP_STATS_AGGR(_tgtobj, _srcobj, rx.ampdu_cnt); \
  265. DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_amsdu_cnt); \
  266. DP_STATS_AGGR(_tgtobj, _srcobj, rx.amsdu_cnt); \
  267. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.to_stack); \
  268. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.bcast);\
  269. \
  270. for (i = 0; i < CDP_MAX_RX_RINGS; i++) \
  271. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.rcvd_reo[i]); \
  272. \
  273. _srcobj->stats.rx.unicast.num = \
  274. _srcobj->stats.rx.to_stack.num - \
  275. _srcobj->stats.rx.multicast.num; \
  276. _srcobj->stats.rx.unicast.bytes = \
  277. _srcobj->stats.rx.to_stack.bytes - \
  278. _srcobj->stats.rx.multicast.bytes; \
  279. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.unicast); \
  280. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.multicast); \
  281. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.raw); \
  282. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.pkts); \
  283. DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.intra_bss.fail); \
  284. \
  285. _tgtobj->stats.tx.last_ack_rssi = \
  286. _srcobj->stats.tx.last_ack_rssi; \
  287. } while (0)
  288. extern int dp_peer_find_attach(struct dp_soc *soc);
  289. extern void dp_peer_find_detach(struct dp_soc *soc);
  290. extern void dp_peer_find_hash_add(struct dp_soc *soc, struct dp_peer *peer);
  291. extern void dp_peer_find_hash_remove(struct dp_soc *soc, struct dp_peer *peer);
  292. extern void dp_peer_find_hash_erase(struct dp_soc *soc);
  293. extern void dp_peer_rx_init(struct dp_pdev *pdev, struct dp_peer *peer);
  294. extern void dp_peer_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  295. extern void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  296. extern void dp_peer_unref_delete(void *peer_handle);
  297. extern void dp_rx_discard(struct dp_vdev *vdev, struct dp_peer *peer,
  298. unsigned tid, qdf_nbuf_t msdu_list);
  299. extern void *dp_find_peer_by_addr(struct cdp_pdev *dev,
  300. uint8_t *peer_mac_addr, uint8_t *peer_id);
  301. #ifndef CONFIG_WIN
  302. QDF_STATUS dp_register_peer(struct cdp_pdev *pdev_handle,
  303. struct ol_txrx_desc_type *sta_desc);
  304. QDF_STATUS dp_clear_peer(struct cdp_pdev *pdev_handle, uint8_t local_id);
  305. void *dp_find_peer_by_addr_and_vdev(struct cdp_pdev *pdev_handle,
  306. struct cdp_vdev *vdev,
  307. uint8_t *peer_addr, uint8_t *local_id);
  308. uint16_t dp_local_peer_id(void *peer);
  309. void *dp_peer_find_by_local_id(struct cdp_pdev *pdev_handle, uint8_t local_id);
  310. QDF_STATUS dp_peer_state_update(struct cdp_pdev *pdev_handle, uint8_t *peer_mac,
  311. enum ol_txrx_peer_state state);
  312. QDF_STATUS dp_get_vdevid(void *peer_handle, uint8_t *vdev_id);
  313. struct cdp_vdev *dp_get_vdev_by_sta_id(struct cdp_pdev *pdev_handle,
  314. uint8_t sta_id);
  315. struct cdp_vdev *dp_get_vdev_for_peer(void *peer);
  316. uint8_t *dp_peer_get_peer_mac_addr(void *peer);
  317. int dp_get_peer_state(void *peer_handle);
  318. void dp_local_peer_id_pool_init(struct dp_pdev *pdev);
  319. void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer);
  320. void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer);
  321. qdf_time_t *dp_get_last_assoc_received(void *peer_handle);
  322. qdf_time_t *dp_get_last_disassoc_received(void *peer_handle);
  323. qdf_time_t *dp_get_last_deauth_received(void *peer_handle);
  324. #endif
  325. extern int dp_addba_requestprocess_wifi3(void *peer_handle,
  326. uint8_t dialogtoken, uint16_t tid, uint16_t batimeout,
  327. uint16_t buffersize, uint16_t startseqnum);
  328. extern void dp_addba_responsesetup_wifi3(void *peer_handle, uint8_t tid,
  329. uint8_t *dialogtoken, uint16_t *statuscode,
  330. uint16_t *buffersize, uint16_t *batimeout);
  331. extern void dp_set_addba_response(void *peer_handle, uint8_t tid,
  332. uint16_t statuscode);
  333. extern int dp_delba_process_wifi3(void *peer_handle,
  334. int tid, uint16_t reasoncode);
  335. extern int dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid,
  336. uint32_t ba_window_size, uint32_t start_seq);
  337. extern QDF_STATUS dp_reo_send_cmd(struct dp_soc *soc,
  338. enum hal_reo_cmd_type type, struct hal_reo_cmd_params *params,
  339. void (*callback_fn), void *data);
  340. extern void dp_reo_cmdlist_destroy(struct dp_soc *soc);
  341. extern void dp_reo_status_ring_handler(struct dp_soc *soc);
  342. void dp_aggregate_vdev_stats(struct dp_vdev *vdev);
  343. void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  344. union hal_reo_status *reo_status);
  345. void dp_rx_bar_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  346. union hal_reo_status *reo_status);
  347. uint16_t dp_tx_me_send_convert_ucast(struct cdp_vdev *vdev_handle,
  348. qdf_nbuf_t nbuf, uint8_t newmac[][DP_MAC_ADDR_LEN],
  349. uint8_t new_mac_cnt);
  350. void dp_tx_me_alloc_descriptor(struct cdp_pdev *pdev);
  351. void dp_tx_me_free_descriptor(struct cdp_pdev *pdev);
  352. QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
  353. uint32_t stats_type_upload_mask, uint32_t config_param_0,
  354. uint32_t config_param_1, uint32_t config_param_2,
  355. uint32_t config_param_3, int cookie, int cookie_msb,
  356. uint8_t channel);
  357. void dp_htt_stats_print_tag(uint8_t tag_type, uint32_t *tag_buf);
  358. void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf);
  359. void dp_peer_rxtid_stats(struct dp_peer *peer, void (*callback_fn),
  360. void *cb_ctxt);
  361. void dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle,
  362. struct cdp_peer *peer_handle, enum cdp_sec_type sec_type,
  363. uint32_t *rx_pn);
  364. void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id);
  365. void dp_mark_peer_inact(void *peer_handle, bool inactive);
  366. bool dp_set_inact_params(struct cdp_pdev *pdev_handle,
  367. u_int16_t inact_check_interval,
  368. u_int16_t inact_normal, u_int16_t inact_overload);
  369. bool dp_start_inact_timer(struct cdp_pdev *pdev_handle, bool enable);
  370. void dp_set_overload(struct cdp_pdev *pdev_handle, bool overload);
  371. bool dp_peer_is_inact(void *peer_handle);
  372. void dp_init_inact_timer(struct dp_soc *soc);
  373. void dp_free_inact_timer(struct dp_soc *soc);
  374. /*
  375. * dp_get_mac_id_for_pdev() - Return mac corresponding to pdev for mac
  376. *
  377. * @mac_id: MAC id
  378. * @pdev_id: pdev_id corresponding to pdev, 0 for MCL
  379. *
  380. * Single pdev using both MACs will operate on both MAC rings,
  381. * which is the case for MCL.
  382. * For WIN each PDEV will operate one ring, so index is zero.
  383. *
  384. */
  385. static inline int dp_get_mac_id_for_pdev(uint32_t mac_id, uint32_t pdev_id)
  386. {
  387. if (mac_id && pdev_id) {
  388. qdf_print("Both mac_id and pdev_id cannot be non zero");
  389. QDF_BUG(0);
  390. return 0;
  391. }
  392. return (mac_id + pdev_id);
  393. }
  394. /*
  395. * dp_get_mac_id_for_mac() - Return mac corresponding WIN and MCL mac_ids
  396. *
  397. * @soc: handle to DP soc
  398. * @mac_id: MAC id
  399. *
  400. * Single pdev using both MACs will operate on both MAC rings,
  401. * which is the case for MCL.
  402. * For WIN each PDEV will operate one ring, so index is zero.
  403. *
  404. */
  405. static inline int dp_get_mac_id_for_mac(struct dp_soc *soc, uint32_t mac_id)
  406. {
  407. /*
  408. * Single pdev using both MACs will operate on both MAC rings,
  409. * which is the case for MCL.
  410. */
  411. if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx))
  412. return mac_id;
  413. /* For WIN each PDEV will operate one ring, so index is zero. */
  414. return 0;
  415. }
  416. #ifdef WDI_EVENT_ENABLE
  417. QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  418. uint32_t stats_type_upload_mask,
  419. uint8_t mac_id);
  420. int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
  421. void *event_cb_sub_handle,
  422. uint32_t event);
  423. int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
  424. void *event_cb_sub_handle,
  425. uint32_t event);
  426. void dp_wdi_event_handler(enum WDI_EVENT event, void *soc,
  427. void *data, u_int16_t peer_id,
  428. int status, u_int8_t pdev_id);
  429. int dp_wdi_event_attach(struct dp_pdev *txrx_pdev);
  430. int dp_wdi_event_detach(struct dp_pdev *txrx_pdev);
  431. int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  432. bool enable);
  433. void *dp_get_pldev(struct cdp_pdev *txrx_pdev);
  434. void dp_pkt_log_init(struct cdp_pdev *ppdev, void *scn);
  435. static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context,
  436. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id)
  437. {
  438. struct hif_msg_callbacks hif_pipe_callbacks;
  439. struct dp_soc *dp_soc = (struct dp_soc *)soc;
  440. /* TODO: Temporary change to bypass HTC connection for this new
  441. * HIF pipe, which will be used for packet log and other high-
  442. * priority HTT messsages. Proper HTC connection to be added
  443. * later once required FW changes are available
  444. */
  445. hif_pipe_callbacks.rxCompletionHandler = callback;
  446. hif_pipe_callbacks.Context = cb_context;
  447. hif_update_pipe_callback(dp_soc->hif_handle,
  448. DP_HTT_T2H_HP_PIPE, &hif_pipe_callbacks);
  449. }
  450. #else
  451. static inline int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
  452. void *event_cb_sub_handle,
  453. uint32_t event)
  454. {
  455. return 0;
  456. }
  457. static inline int dp_wdi_event_sub(struct cdp_pdev *txrx_pdev_handle,
  458. void *event_cb_sub_handle,
  459. uint32_t event)
  460. {
  461. return 0;
  462. }
  463. static inline void dp_wdi_event_handler(enum WDI_EVENT event, void *soc,
  464. void *data, u_int16_t peer_id,
  465. int status, u_int8_t pdev_id)
  466. {
  467. }
  468. static inline int dp_wdi_event_attach(struct dp_pdev *txrx_pdev)
  469. {
  470. return 0;
  471. }
  472. static inline int dp_wdi_event_detach(struct dp_pdev *txrx_pdev)
  473. {
  474. return 0;
  475. }
  476. static inline int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
  477. bool enable)
  478. {
  479. return 0;
  480. }
  481. static inline QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  482. uint32_t stats_type_upload_mask, uint8_t mac_id);
  483. {
  484. return 0;
  485. }
  486. static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context,
  487. QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id)
  488. {
  489. }
  490. #endif /* CONFIG_WIN */
  491. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  492. void dp_tx_dump_flow_pool_info(void *soc);
  493. int dp_tx_delete_flow_pool(struct dp_soc *soc, struct dp_tx_desc_pool_s *pool,
  494. bool force);
  495. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  496. #endif /* #ifndef _DP_INTERNAL_H_ */