target_if_dp.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /*
  2. * Copyright (c) 2018-2019 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. /**
  20. * DOC: This target interface shall be used by DP
  21. * to communicate with target using WMI.
  22. */
  23. #ifndef _WLAN_TARGET_IF_DP_H_
  24. #define _WLAN_TARGET_IF_DP_H_
  25. #include <qdf_types.h>
  26. #include <qdf_status.h>
  27. #include <wmi_unified_priv.h>
  28. #include <wlan_objmgr_psoc_obj.h>
  29. #include <target_if.h>
  30. #include <cdp_txrx_ops.h>
  31. #include <wlan_cfg.h>
  32. #define PEER_ROUTING_LMAC_ID_INDEX 6
  33. #define PEER_ROUTING_LMAC_ID_BITS 2
  34. /**
  35. * struct reorder_q_setup - reorder queue setup params
  36. * @psoc: psoc
  37. * @vdev_id: vdev id
  38. * @pdev_id: pdev id
  39. * @peer_mac: peer mac address
  40. * @hw_qdesc_paddr: hw queue descriptor
  41. * @tid: tid number
  42. * @queue_no: queue number
  43. * @ba_window_size_valid: BA window size validity flag
  44. * @ba_window_size: BA window size
  45. */
  46. struct reorder_q_setup {
  47. struct cdp_ctrl_objmgr_psoc *psoc;
  48. uint8_t vdev_id;
  49. uint8_t pdev_id;
  50. uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
  51. qdf_dma_addr_t hw_qdesc_paddr;
  52. uint8_t tid;
  53. uint16_t queue_no;
  54. uint8_t ba_window_size_valid;
  55. uint16_t ba_window_size;
  56. };
  57. /**
  58. * struct reorder_q_setup_list - Specific tid params for each tid
  59. * @hw_qdesc_paddr: hw queue descriptor
  60. * @queue_no: queue number
  61. * @ba_window_size: BA window size
  62. * @ba_window_size_valid: BA window size validity flag
  63. */
  64. struct reorder_q_setup_list {
  65. qdf_dma_addr_t hw_qdesc_paddr;
  66. uint16_t queue_no;
  67. uint16_t ba_window_size;
  68. uint8_t ba_window_size_valid;
  69. };
  70. /**
  71. * struct multi_reorder_q_setup - multi reorder queue setup
  72. * params for setting up TIDs at a time
  73. * @q_setup_list: An array for recording the specific params for each tid
  74. * @peer_mac: peer mac address
  75. * @psoc: psoc
  76. * @vdev_id: vdev id
  77. * @pdev_id: pdev id
  78. * @tid_num: Total number of TIDs to be set up
  79. * @tid_bitmap: TIDs to be set up
  80. */
  81. struct multi_reorder_q_setup {
  82. struct reorder_q_setup_list q_setup_list[DP_MAX_TIDS];
  83. uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
  84. struct cdp_ctrl_objmgr_psoc *psoc;
  85. uint8_t vdev_id;
  86. uint8_t pdev_id;
  87. uint8_t tid_num;
  88. uint32_t tid_bitmap;
  89. };
  90. /**
  91. * target_if_get_active_mac_phy_number() - Get max MAC-PHY number enabled by
  92. * target
  93. * @psoc: psoc
  94. *
  95. * Get max active MAC-PHY number in all type of hw modes.
  96. *
  97. * return: active number of MAC-PHY pairs
  98. */
  99. uint32_t target_if_get_active_mac_phy_number(struct wlan_objmgr_psoc *psoc);
  100. /**
  101. * target_if_peer_set_default_routing() - set peer default routing
  102. * @psoc: psoc pointer
  103. * @pdev_id: pdev id
  104. * @peer_macaddr: peer mac address
  105. * @vdev_id: vdev id
  106. * @hash_based: hash based routing
  107. * @ring_num: ring number
  108. * @lmac_peer_id_msb: lmac_peer_id_msb
  109. *
  110. * return: void
  111. */
  112. void
  113. target_if_peer_set_default_routing(struct cdp_ctrl_objmgr_psoc *psoc,
  114. uint8_t pdev_id,
  115. uint8_t *peer_macaddr, uint8_t vdev_id,
  116. bool hash_based, uint8_t ring_num,
  117. uint8_t lmac_peer_id_msb);
  118. /**
  119. * target_if_peer_rx_reorder_queue_setup() - set up rx reorder queue
  120. * @psoc: psoc pointer
  121. * @pdev_id: pdev id
  122. * @vdev_id: vdev id
  123. * @peer_macaddr: peer mac address
  124. * @hw_qdesc: hw queue descriptor
  125. * @tid: tid number
  126. * @queue_no: queue number
  127. * @ba_window_size_valid: BA window size validity flag
  128. * @ba_window_size: BA window size
  129. *
  130. * return: QDF_STATUS_SUCCESS for success or error code
  131. */
  132. QDF_STATUS
  133. target_if_peer_rx_reorder_queue_setup(struct cdp_ctrl_objmgr_psoc *psoc,
  134. uint8_t pdev_id,
  135. uint8_t vdev_id, uint8_t *peer_macaddr,
  136. qdf_dma_addr_t hw_qdesc, int tid,
  137. uint16_t queue_no,
  138. uint8_t ba_window_size_valid,
  139. uint16_t ba_window_size);
  140. /**
  141. * target_if_peer_multi_rx_reorder_queue_setup() - set up multi rx reorder queue
  142. * @psoc: psoc pointer
  143. * @pdev_id: pdev id
  144. * @tid_params: TIDs with their parameters to be set
  145. *
  146. * return: QDF_STATUS_SUCCESS for success or error code
  147. */
  148. QDF_STATUS
  149. target_if_peer_multi_rx_reorder_queue_setup(
  150. struct cdp_ctrl_objmgr_psoc *psoc,
  151. uint8_t pdev_id,
  152. struct multi_rx_reorder_queue_setup_params *tid_params);
  153. /**
  154. * target_if_peer_rx_reorder_queue_remove() - remove rx reorder queue
  155. * @psoc: psoc pointer
  156. * @pdev_id: pdev id
  157. * @vdev_id: vdev id
  158. * @peer_macaddr: peer mac address
  159. * @peer_tid_bitmap: peer tid bitmap
  160. *
  161. * return: QDF_STATUS_SUCCESS for success or error code
  162. */
  163. QDF_STATUS
  164. target_if_peer_rx_reorder_queue_remove(struct cdp_ctrl_objmgr_psoc *psoc,
  165. uint8_t pdev_id,
  166. uint8_t vdev_id, uint8_t *peer_macaddr,
  167. uint32_t peer_tid_bitmap);
  168. /**
  169. * target_if_lro_hash_config() - send LRO hash config to FW
  170. * @psoc: psoc pointer
  171. * @pdev_id: pdev id
  172. * @lro_hash_cfg: LRO hash config parameters
  173. *
  174. * return: QDF_STATUS_SUCCESS for success or error code
  175. */
  176. QDF_STATUS
  177. target_if_lro_hash_config(struct cdp_ctrl_objmgr_psoc *psoc, uint8_t pdev_id,
  178. struct cdp_lro_hash_config *lro_hash_cfg);
  179. #ifdef WLAN_SUPPORT_PPEDS
  180. /**
  181. * target_if_peer_set_ppeds_default_routing() - Set PPE DS routing API
  182. * @soc: psoc handle pointer
  183. * @peer_macaddr: Peer MAC address
  184. * @service_code: Service code
  185. * @priority_valid: Priority valid field
  186. * @src_info: Source information
  187. * @vdev_id: VDEV ID
  188. * @use_ppe: use ppe field value
  189. * @ppe_routing_enabled: PPE routing enabled
  190. *
  191. * This API is used for setting PPE default routing configuration
  192. *
  193. * return: QDF_STATUS_SUCCESS for success or error code
  194. */
  195. QDF_STATUS
  196. target_if_peer_set_ppeds_default_routing(struct cdp_ctrl_objmgr_psoc *soc,
  197. uint8_t *peer_macaddr,
  198. uint16_t service_code,
  199. uint8_t priority_valid,
  200. uint16_t src_info,
  201. uint8_t vdev_id, uint8_t use_ppe,
  202. uint8_t ppe_routing_enabled);
  203. #endif
  204. #ifdef WDS_CONV_TARGET_IF_OPS_ENABLE
  205. /**
  206. * target_if_add_wds_entry() - send wds peer add command to fw
  207. * @soc: SoC handle
  208. * @vdev_id: vdev_id
  209. * @peer_mac: peer mac address
  210. * @dest_mac: MAC address of ast node
  211. * @flags: WDS entry type WMI_HOST_WDS_FLAG_STATIC for static entry
  212. * @type: type from enum cdp_txrx_ast_entry_type
  213. *
  214. * This API is used by WDS source port learning function to
  215. * add a new AST entry in the fw.
  216. *
  217. * return: QDF_STATUS_SUCCESS for success or error code
  218. */
  219. QDF_STATUS
  220. target_if_add_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
  221. uint8_t *peer_mac, const uint8_t *dest_mac,
  222. uint32_t flags, uint8_t type);
  223. /**
  224. * target_if_del_wds_entry() - send wds peer del command to fw
  225. * @soc: SoC handle
  226. * @vdev_id: vdev_id
  227. * @dest_mac: MAC address of ast node
  228. * @type: type from enum cdp_txrx_ast_entry_type
  229. * @delete_in_fw: flag to indicate if entry needs to be deleted in fw
  230. *
  231. * This API is used to delete an AST entry from fw
  232. *
  233. * Return: None
  234. */
  235. void
  236. target_if_del_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
  237. uint8_t *dest_mac, uint8_t type, uint8_t delete_in_fw);
  238. /**
  239. * target_if_update_wds_entry() - send wds peer update command to fw
  240. * @soc: SoC handle
  241. * @vdev_id: vdev_id
  242. * @dest_mac: MAC address of ast node
  243. * @peer_mac: peer mac address
  244. * @flags: WDS entry type WMI_HOST_WDS_FLAG_STATIC for static entry
  245. *
  246. * This API is used by update the peer mac address for the ast
  247. * in the fw.
  248. *
  249. * return: QDF_STATUS_SUCCESS for success or error code
  250. */
  251. QDF_STATUS
  252. target_if_update_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
  253. uint8_t *dest_mac, uint8_t *peer_mac,
  254. uint32_t flags);
  255. #else
  256. static inline QDF_STATUS
  257. target_if_add_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
  258. uint8_t *peer_mac, const uint8_t *dest_mac,
  259. uint32_t flags, uint8_t type)
  260. {
  261. return QDF_STATUS_SUCCESS;
  262. }
  263. static inline void
  264. target_if_del_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
  265. uint8_t *dest_mac, uint8_t type, uint8_t delete_in_fw)
  266. {
  267. }
  268. static inline QDF_STATUS
  269. target_if_update_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
  270. uint8_t *dest_mac, uint8_t *peer_mac,
  271. uint32_t flags)
  272. {
  273. return QDF_STATUS_SUCCESS;
  274. }
  275. #endif /* FEATURE_MCL_REPEATER */
  276. #ifdef WLAN_FEATURE_PEER_TXQ_FLUSH_CONF
  277. /**
  278. * target_if_peer_txq_flush_config() - Send flush command for pending frames
  279. * @psoc: psoc handle pointer
  280. * @vdev_id: VDEV id
  281. * @mac: MAC addr of peer for which the tx queue flush is intended
  282. * @ac: AC mask for identifying the tx queues to be flushed
  283. * @tid: TID mask for identifying the tx queues to be flushed
  284. * @policy: Defines the flush policy
  285. *
  286. * Return: 0 for success or error code
  287. */
  288. int target_if_peer_txq_flush_config(struct cdp_ctrl_objmgr_psoc *psoc,
  289. uint8_t vdev_id, uint8_t *mac,
  290. uint8_t ac, uint32_t tid, uint32_t policy);
  291. #else
  292. static inline int
  293. target_if_peer_txq_flush_config(struct cdp_ctrl_objmgr_psoc *psoc,
  294. uint8_t vdev_id, uint8_t *mac,
  295. uint8_t ac, uint32_t tid,
  296. enum cdp_peer_txq_flush_policy policy)
  297. {
  298. return 0;
  299. }
  300. #endif /* WLAN_FEATURE_PEER_TXQ_FLUSH_CONF */
  301. #endif /* _WLAN_TARGET_IF_DP_H_ */