dp_mlo.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef __DP_MLO_H
  17. #define __DP_MLO_H
  18. #include <dp_types.h>
  19. #include <dp_peer.h>
  20. /* Max number of chips that can participate in MLO */
  21. #define DP_MAX_MLO_CHIPS WLAN_MAX_MLO_CHIPS
  22. /* Max number of peers supported */
  23. #define DP_MAX_MLO_PEER 512
  24. /* Max number of chips supported */
  25. #define DP_MLO_MAX_DEST_CHIP_ID 4
  26. /*
  27. * NB: intentionally not using kernel-doc comment because the kernel-doc
  28. * script does not handle the TAILQ_HEAD macro
  29. * struct dp_mlo_ctxt - datapath MLO context
  30. *
  31. * @ctrl_ctxt: opaque handle of cp mlo mgr
  32. * @ml_soc_list: list of socs which are mlo enabled. This also maintains
  33. * mlo_chip_id to dp_soc mapping
  34. * @ml_soc_cnt: number of SOCs
  35. * @ml_soc_list_lock: lock to protect ml_soc_list
  36. * @mld_peer_hash: peer hash table for ML peers
  37. * Associated peer with this MAC address)
  38. * @mld_peer_hash_lock: lock to protect mld_peer_hash
  39. * @toeplitz_hash_ipv4:
  40. * @toeplitz_hash_ipv6:
  41. * @link_to_pdev_map: link to pdev mapping
  42. * @rx_fst: pointer to rx_fst handle
  43. * @rx_fst_ref_cnt: ref count of rx_fst
  44. * @grp_umac_reset_ctx: UMAC reset context at mlo group level
  45. */
  46. struct dp_mlo_ctxt {
  47. struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
  48. struct dp_soc *ml_soc_list[DP_MAX_MLO_CHIPS];
  49. uint8_t ml_soc_cnt;
  50. qdf_spinlock_t ml_soc_list_lock;
  51. struct {
  52. uint32_t mask;
  53. uint32_t idx_bits;
  54. TAILQ_HEAD(, dp_peer) * bins;
  55. } mld_peer_hash;
  56. qdf_spinlock_t mld_peer_hash_lock;
  57. uint32_t toeplitz_hash_ipv4[LRO_IPV4_SEED_ARR_SZ];
  58. uint32_t toeplitz_hash_ipv6[LRO_IPV6_SEED_ARR_SZ];
  59. struct dp_pdev_be *link_to_pdev_map[WLAN_MAX_MLO_CHIPS *
  60. WLAN_MAX_MLO_LINKS_PER_SOC];
  61. #ifdef DP_UMAC_HW_RESET_SUPPORT
  62. struct dp_soc_mlo_umac_reset_ctx grp_umac_reset_ctx;
  63. #endif
  64. };
  65. /**
  66. * dp_mlo_ctx_to_cdp() - typecast dp mlo context to CDP context
  67. * @mlo_ctxt: DP MLO context
  68. *
  69. * Return: struct cdp_mlo_ctxt pointer
  70. */
  71. static inline
  72. struct cdp_mlo_ctxt *dp_mlo_ctx_to_cdp(struct dp_mlo_ctxt *mlo_ctxt)
  73. {
  74. return (struct cdp_mlo_ctxt *)mlo_ctxt;
  75. }
  76. /**
  77. * cdp_mlo_ctx_to_dp() - typecast CDP MLO context to DP MLO context
  78. * @mlo_ctxt: CDP MLO context
  79. *
  80. * Return: struct dp_soc pointer
  81. */
  82. static inline
  83. struct dp_mlo_ctxt *cdp_mlo_ctx_to_dp(struct cdp_mlo_ctxt *mlo_ctxt)
  84. {
  85. return (struct dp_mlo_ctxt *)mlo_ctxt;
  86. }
  87. /**
  88. * dp_soc_mlo_fill_params() - update SOC mlo params
  89. * @soc: DP soc
  90. * @params: soc attach params
  91. *
  92. * Return: struct dp_soc pointer
  93. */
  94. void dp_soc_mlo_fill_params(struct dp_soc *soc,
  95. struct cdp_soc_attach_params *params);
  96. /**
  97. * dp_pdev_mlo_fill_params() - update PDEV mlo params
  98. * @pdev: DP PDEV
  99. * @params: PDEV attach params
  100. *
  101. * Return: struct dp_soc pointer
  102. */
  103. void dp_pdev_mlo_fill_params(struct dp_pdev *pdev,
  104. struct cdp_pdev_attach_params *params);
  105. /**
  106. * dp_mlo_get_soc_ref_by_chip_id() - Get DP soc from DP ML context.
  107. * @ml_ctxt: DP ML context handle
  108. * @chip_id: MLO chip id
  109. *
  110. * This API will increment a reference count for DP soc. Caller has
  111. * to take care for decrementing refcount.
  112. *
  113. * Return: dp_soc
  114. */
  115. struct dp_soc*
  116. dp_mlo_get_soc_ref_by_chip_id(struct dp_mlo_ctxt *ml_ctxt, uint8_t chip_id);
  117. /**
  118. * dp_mlo_get_rx_hash_key() - Get Rx hash key from MLO context
  119. * @soc: DP SOC
  120. * @lro_hash: Hash params
  121. *
  122. */
  123. void dp_mlo_get_rx_hash_key(struct dp_soc *soc,
  124. struct cdp_lro_hash_config *lro_hash);
  125. /**
  126. * dp_mlo_rx_fst_deref() - decrement rx_fst
  127. * @soc: dp soc
  128. *
  129. * return: soc cnt
  130. */
  131. uint8_t dp_mlo_rx_fst_deref(struct dp_soc *soc);
  132. /**
  133. * dp_mlo_rx_fst_ref() - increment ref of rx_fst
  134. * @soc: dp soc
  135. *
  136. */
  137. void dp_mlo_rx_fst_ref(struct dp_soc *soc);
  138. /**
  139. * dp_mlo_get_rx_fst() - Get Rx FST from MLO context
  140. * @soc: DP SOC
  141. *
  142. * Return: struct dp_rx_fst pointer
  143. */
  144. struct dp_rx_fst *dp_mlo_get_rx_fst(struct dp_soc *soc);
  145. /**
  146. * dp_mlo_set_rx_fst() - Set Rx FST in MLO context
  147. * @soc: DP SOC
  148. * @fst: pointer dp_rx_fst
  149. *
  150. */
  151. void dp_mlo_set_rx_fst(struct dp_soc *soc, struct dp_rx_fst *fst);
  152. /**
  153. * dp_mlo_update_link_to_pdev_map() - map link-id to pdev mapping
  154. * @soc: DP SOC
  155. * @pdev: DP PDEV
  156. *
  157. * Return: none
  158. */
  159. void dp_mlo_update_link_to_pdev_map(struct dp_soc *soc, struct dp_pdev *pdev);
  160. /**
  161. * dp_mlo_update_link_to_pdev_unmap() - unmap link-id to pdev mapping
  162. * @soc: DP SOC
  163. * @pdev: DP PDEV
  164. *
  165. * Return: none
  166. */
  167. void dp_mlo_update_link_to_pdev_unmap(struct dp_soc *soc, struct dp_pdev *pdev);
  168. /**
  169. * dp_mlo_get_delta_tsf2_wrt_mlo_offset() - Get delta between mlo timestamp
  170. * offset and delta tsf2
  171. * @soc: DP SOC
  172. * @hw_link_id: link id
  173. *
  174. * Return: int32_t
  175. */
  176. int32_t dp_mlo_get_delta_tsf2_wrt_mlo_offset(struct dp_soc *soc,
  177. uint8_t hw_link_id);
  178. /**
  179. * dp_mlo_get_delta_tqm_wrt_mlo_offset() - Get delta between mlo timestamp
  180. * offset and delta tqm
  181. * @soc: DP SOC
  182. *
  183. * Return: int32_t
  184. */
  185. int32_t dp_mlo_get_delta_tqm_wrt_mlo_offset(struct dp_soc *soc);
  186. /**
  187. * dp_get_interface_stats_be() - get vdev stats for ath interface
  188. * @soc_hdl: CDP SoC handle
  189. * @vdev_id: vdev Id
  190. * @buf: buffer for vdev stats
  191. * @is_aggregate: for aggregation
  192. *
  193. * Return: QDF_STATUS
  194. */
  195. QDF_STATUS
  196. dp_get_interface_stats_be(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  197. void *buf, bool is_aggregate);
  198. /*
  199. * dp_mlo_debug_print_ptnr_info() - print partner info
  200. * @vdev: DP VDEV
  201. *
  202. * Return: none
  203. */
  204. void dp_mlo_debug_print_ptnr_info(struct dp_vdev *vdev);
  205. #endif /* __DP_MLO_H */