dp_rx_tid.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _DP_RX_TID_H_
  20. #define _DP_RX_TID_H_
  21. #include "dp_types.h"
  22. /*
  23. * dp_rxtid_stats_cmd_cb - function pointer for peer
  24. * rx tid stats cmd call_back
  25. * @soc:
  26. * @cb_ctxt:
  27. * @reo_status:
  28. */
  29. typedef void (*dp_rxtid_stats_cmd_cb)(struct dp_soc *soc, void *cb_ctxt,
  30. union hal_reo_status *reo_status);
  31. #ifndef WLAN_SOFTUMAC_SUPPORT
  32. void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  33. union hal_reo_status *reo_status);
  34. /**
  35. * dp_peer_rx_cleanup() - Cleanup receive TID state
  36. * @vdev: Datapath vdev
  37. * @peer: Datapath peer
  38. *
  39. */
  40. void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer);
  41. /**
  42. * dp_rx_tid_setup_wifi3() - Set up receive TID state
  43. * @peer: Datapath peer handle
  44. * @tid_bitmap: TIDs to be set up
  45. * @ba_window_size: BlockAck window size
  46. * @start_seq: Starting sequence number
  47. *
  48. * Return: QDF_STATUS code
  49. */
  50. QDF_STATUS dp_rx_tid_setup_wifi3(struct dp_peer *peer, uint32_t tid_bitmap,
  51. uint32_t ba_window_size, uint32_t start_seq);
  52. /**
  53. * dp_rx_tid_update_wifi3() - Update receive TID state
  54. * @peer: Datapath peer handle
  55. * @tid: TID
  56. * @ba_window_size: BlockAck window size
  57. * @start_seq: Starting sequence number
  58. * @bar_update: BAR update triggered
  59. *
  60. * Return: QDF_STATUS code
  61. */
  62. QDF_STATUS dp_rx_tid_update_wifi3(struct dp_peer *peer, int tid,
  63. uint32_t ba_window_size, uint32_t start_seq,
  64. bool bar_update);
  65. /*
  66. * dp_rx_tid_delete_cb() - Callback to flush reo descriptor HW cache
  67. * after deleting the entries (ie., setting valid=0)
  68. *
  69. * @soc: DP SOC handle
  70. * @cb_ctxt: Callback context
  71. * @reo_status: REO command status
  72. */
  73. void dp_rx_tid_delete_cb(struct dp_soc *soc,
  74. void *cb_ctxt,
  75. union hal_reo_status *reo_status);
  76. #ifdef IPA_OFFLOAD
  77. void dp_peer_update_tid_stats_from_reo(struct dp_soc *soc, void *cb_ctxt,
  78. union hal_reo_status *reo_status);
  79. int dp_peer_get_rxtid_stats_ipa(struct dp_peer *peer,
  80. dp_rxtid_stats_cmd_cb dp_stats_cmd_cb);
  81. #endif
  82. #ifdef DP_UMAC_HW_RESET_SUPPORT
  83. void dp_reset_tid_q_setup(struct dp_soc *soc);
  84. #endif
  85. /**
  86. * dp_addba_resp_tx_completion_wifi3() - Update Rx Tid State
  87. *
  88. * @cdp_soc: Datapath soc handle
  89. * @peer_mac: Datapath peer mac address
  90. * @vdev_id: id of atapath vdev
  91. * @tid: TID number
  92. * @status: tx completion status
  93. * Return: 0 on success, error code on failure
  94. */
  95. int dp_addba_resp_tx_completion_wifi3(struct cdp_soc_t *cdp_soc,
  96. uint8_t *peer_mac,
  97. uint16_t vdev_id,
  98. uint8_t tid, int status);
  99. /**
  100. * dp_addba_responsesetup_wifi3() - Process ADDBA request from peer
  101. * @cdp_soc: Datapath soc handle
  102. * @peer_mac: Datapath peer mac address
  103. * @vdev_id: id of atapath vdev
  104. * @tid: TID number
  105. * @dialogtoken: output dialogtoken
  106. * @statuscode: output dialogtoken
  107. * @buffersize: Output BA window size
  108. * @batimeout: Output BA timeout
  109. */
  110. QDF_STATUS
  111. dp_addba_responsesetup_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  112. uint16_t vdev_id, uint8_t tid,
  113. uint8_t *dialogtoken, uint16_t *statuscode,
  114. uint16_t *buffersize, uint16_t *batimeout);
  115. /**
  116. * dp_rx_tid_update_ba_win_size() - Update the DP tid BA window size
  117. * @cdp_soc: soc handle
  118. * @peer_mac: mac address of peer handle
  119. * @vdev_id: id of vdev handle
  120. * @tid: tid
  121. * @buffersize: BA window size
  122. *
  123. * Return: success/failure of tid update
  124. */
  125. QDF_STATUS dp_rx_tid_update_ba_win_size(struct cdp_soc_t *cdp_soc,
  126. uint8_t *peer_mac, uint16_t vdev_id,
  127. uint8_t tid, uint16_t buffersize);
  128. /**
  129. * dp_addba_requestprocess_wifi3() - Process ADDBA request from peer
  130. * @cdp_soc: Datapath soc handle
  131. * @peer_mac: Datapath peer mac address
  132. * @vdev_id: id of atapath vdev
  133. * @dialogtoken: dialogtoken from ADDBA frame
  134. * @tid: TID number
  135. * @batimeout: BA timeout
  136. * @buffersize: BA window size
  137. * @startseqnum: Start seq. number received in BA sequence control
  138. *
  139. * Return: 0 on success, error code on failure
  140. */
  141. int dp_addba_requestprocess_wifi3(struct cdp_soc_t *cdp_soc,
  142. uint8_t *peer_mac,
  143. uint16_t vdev_id,
  144. uint8_t dialogtoken,
  145. uint16_t tid, uint16_t batimeout,
  146. uint16_t buffersize,
  147. uint16_t startseqnum);
  148. /**
  149. * dp_set_addba_response() - Set a user defined ADDBA response status code
  150. * @cdp_soc: Datapath soc handle
  151. * @peer_mac: Datapath peer mac address
  152. * @vdev_id: id of atapath vdev
  153. * @tid: TID number
  154. * @statuscode: response status code to be set
  155. */
  156. QDF_STATUS
  157. dp_set_addba_response(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  158. uint16_t vdev_id, uint8_t tid, uint16_t statuscode);
  159. /**
  160. * dp_delba_process_wifi3() - Process DELBA from peer
  161. * @cdp_soc: Datapath soc handle
  162. * @peer_mac: Datapath peer mac address
  163. * @vdev_id: id of atapath vdev
  164. * @tid: TID number
  165. * @reasoncode: Reason code received in DELBA frame
  166. *
  167. * Return: 0 on success, error code on failure
  168. */
  169. int dp_delba_process_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  170. uint16_t vdev_id, int tid, uint16_t reasoncode);
  171. /**
  172. * dp_delba_tx_completion_wifi3() - Handle delba tx completion
  173. * @cdp_soc: soc handle
  174. * @peer_mac: peer mac address
  175. * @vdev_id: id of the vdev handle
  176. * @tid: Tid number
  177. * @status: Tx completion status
  178. *
  179. * Indicate status of delba Tx to DP for stats update and retry
  180. * delba if tx failed.
  181. *
  182. * Return: 0 on success, error code on failure
  183. */
  184. int dp_delba_tx_completion_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  185. uint16_t vdev_id,
  186. uint8_t tid, int status);
  187. /**
  188. * dp_set_pn_check_wifi3() - enable PN check in REO for security
  189. * @soc: Datapath soc handle
  190. * @vdev_id: id of atapath vdev
  191. * @peer_mac: Datapath peer mac address
  192. * @sec_type: security type
  193. * @rx_pn: Receive pn starting number
  194. *
  195. */
  196. QDF_STATUS
  197. dp_set_pn_check_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id,
  198. uint8_t *peer_mac, enum cdp_sec_type sec_type,
  199. uint32_t *rx_pn);
  200. QDF_STATUS
  201. dp_rx_delba_ind_handler(void *soc_handle, uint16_t peer_id,
  202. uint8_t tid, uint16_t win_sz);
  203. /**
  204. * dp_peer_rxtid_stats() - Retried Rx TID (REO queue) stats from HW
  205. * @peer: DP peer handle
  206. * @dp_stats_cmd_cb: REO command callback function
  207. * @cb_ctxt: Callback context
  208. *
  209. * Return: count of tid stats cmd send succeeded
  210. */
  211. int dp_peer_rxtid_stats(struct dp_peer *peer,
  212. dp_rxtid_stats_cmd_cb dp_stats_cmd_cb,
  213. void *cb_ctxt);
  214. QDF_STATUS dp_peer_rx_tids_create(struct dp_peer *peer);
  215. void dp_peer_rx_tids_destroy(struct dp_peer *peer);
  216. #ifdef DUMP_REO_QUEUE_INFO_IN_DDR
  217. /**
  218. * dp_send_cache_flush_for_rx_tid() - Send cache flush cmd to REO per tid
  219. * @soc : dp_soc handle
  220. * @peer: peer
  221. *
  222. * This function is used to send cache flush cmd to reo and
  223. * to register the callback to handle the dumping of the reo
  224. * queue stas from DDR
  225. *
  226. * Return: none
  227. */
  228. void dp_send_cache_flush_for_rx_tid(struct dp_soc *soc, struct dp_peer *peer);
  229. /**
  230. * dp_get_rx_reo_queue_info() - Handler to get rx tid info
  231. * @soc_hdl : cdp_soc_t handle
  232. * @vdev_id: vdev id
  233. *
  234. * Handler to get rx tid info from DDR after h/w cache is
  235. * invalidated first using the cache flush cmd.
  236. *
  237. * Return: none
  238. */
  239. void dp_get_rx_reo_queue_info(struct cdp_soc_t *soc_hdl, uint8_t vdev_id);
  240. /**
  241. * dp_dump_rx_reo_queue_info() - Callback function to dump reo queue stats
  242. * @soc : dp_soc handle
  243. * @cb_ctxt: callback context
  244. * @reo_status: vdev id
  245. *
  246. * This is the callback function registered after sending the reo cmd
  247. * to flush the h/w cache and invalidate it. In the callback the reo
  248. * queue desc info is dumped from DDR.
  249. *
  250. * Return: none
  251. */
  252. void dp_dump_rx_reo_queue_info(struct dp_soc *soc, void *cb_ctxt,
  253. union hal_reo_status *reo_status);
  254. #else /* DUMP_REO_QUEUE_INFO_IN_DDR */
  255. static inline void dp_get_rx_reo_queue_info(struct cdp_soc_t *soc_hdl,
  256. uint8_t vdev_id)
  257. {
  258. }
  259. #endif /* DUMP_REO_QUEUE_INFO_IN_DDR */
  260. void dp_peer_rx_tid_setup(struct dp_peer *peer);
  261. #else
  262. static inline void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt,
  263. union hal_reo_status *reo_status) {}
  264. static inline void dp_peer_rx_cleanup(struct dp_vdev *vdev,
  265. struct dp_peer *peer) {}
  266. static inline int dp_addba_resp_tx_completion_wifi3(struct cdp_soc_t *cdp_soc,
  267. uint8_t *peer_mac,
  268. uint16_t vdev_id,
  269. uint8_t tid, int status)
  270. {
  271. return QDF_STATUS_SUCCESS;
  272. }
  273. static inline QDF_STATUS
  274. dp_addba_responsesetup_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  275. uint16_t vdev_id, uint8_t tid,
  276. uint8_t *dialogtoken, uint16_t *statuscode,
  277. uint16_t *buffersize, uint16_t *batimeout)
  278. {
  279. return QDF_STATUS_SUCCESS;
  280. }
  281. static inline QDF_STATUS
  282. dp_rx_tid_update_ba_win_size(struct cdp_soc_t *cdp_soc,
  283. uint8_t *peer_mac, uint16_t vdev_id,
  284. uint8_t tid, uint16_t buffersize)
  285. {
  286. return QDF_STATUS_SUCCESS;
  287. }
  288. static inline int
  289. dp_addba_requestprocess_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  290. uint16_t vdev_id, uint8_t dialogtoken,
  291. uint16_t tid, uint16_t batimeout,
  292. uint16_t buffersize, uint16_t startseqnum)
  293. {
  294. return QDF_STATUS_SUCCESS;
  295. }
  296. static inline QDF_STATUS
  297. dp_set_addba_response(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  298. uint16_t vdev_id, uint8_t tid, uint16_t statuscode)
  299. {
  300. return QDF_STATUS_SUCCESS;
  301. }
  302. static inline int
  303. dp_delba_process_wifi3(struct cdp_soc_t *cdp_soc, uint8_t *peer_mac,
  304. uint16_t vdev_id, int tid, uint16_t reasoncode)
  305. {
  306. return QDF_STATUS_SUCCESS;
  307. }
  308. static inline int dp_delba_tx_completion_wifi3(struct cdp_soc_t *cdp_soc,
  309. uint8_t *peer_mac,
  310. uint16_t vdev_id,
  311. uint8_t tid, int status)
  312. {
  313. return QDF_STATUS_SUCCESS;
  314. }
  315. static inline QDF_STATUS
  316. dp_set_pn_check_wifi3(struct cdp_soc_t *soc, uint8_t vdev_id,
  317. uint8_t *peer_mac, enum cdp_sec_type sec_type,
  318. uint32_t *rx_pn)
  319. {
  320. return QDF_STATUS_SUCCESS;
  321. }
  322. static inline QDF_STATUS
  323. dp_rx_delba_ind_handler(void *soc_handle, uint16_t peer_id,
  324. uint8_t tid, uint16_t win_sz)
  325. {
  326. return QDF_STATUS_SUCCESS;
  327. }
  328. static inline int
  329. dp_peer_rxtid_stats(struct dp_peer *peer,
  330. dp_rxtid_stats_cmd_cb dp_stats_cmd_cb,
  331. void *cb_ctxt)
  332. {
  333. return 0;
  334. }
  335. static inline QDF_STATUS dp_peer_rx_tids_create(struct dp_peer *peer)
  336. {
  337. return QDF_STATUS_SUCCESS;
  338. }
  339. static inline void dp_peer_rx_tids_destroy(struct dp_peer *peer) {}
  340. static inline void dp_get_rx_reo_queue_info(struct cdp_soc_t *soc_hdl,
  341. uint8_t vdev_id) {}
  342. static inline void dp_peer_rx_tid_setup(struct dp_peer *peer) {}
  343. static inline QDF_STATUS
  344. dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid,
  345. uint32_t ba_window_size, uint32_t start_seq)
  346. {
  347. return QDF_STATUS_SUCCESS;
  348. }
  349. #endif
  350. #endif /* _DP_RX_TID_H_ */