dp_mlo.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 3
  26. /*
  27. * dp_mlo_ctxt
  28. *
  29. * @ctrl_ctxt: opaque handle of cp mlo mgr
  30. * @ml_soc_list: list of socs which are mlo enabled. This also maintains
  31. * mlo_chip_id to dp_soc mapping
  32. * @ml_soc_list_lock: lock to protect ml_soc_list
  33. * @mld_peer_hash: peer hash table for ML peers
  34. * Associated peer with this MAC address)
  35. * @mld_peer_hash_lock: lock to protect mld_peer_hash
  36. * @link_to_pdev_map: link to pdev mapping
  37. * @rx_fst: pointer to rx_fst handle
  38. * @rx_fst_ref_cnt: ref count of rx_fst
  39. */
  40. struct dp_mlo_ctxt {
  41. struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
  42. struct dp_soc *ml_soc_list[DP_MAX_MLO_CHIPS];
  43. qdf_spinlock_t ml_soc_list_lock;
  44. struct {
  45. uint32_t mask;
  46. uint32_t idx_bits;
  47. TAILQ_HEAD(, dp_peer) * bins;
  48. } mld_peer_hash;
  49. qdf_spinlock_t mld_peer_hash_lock;
  50. uint32_t toeplitz_hash_ipv4[LRO_IPV4_SEED_ARR_SZ];
  51. uint32_t toeplitz_hash_ipv6[LRO_IPV6_SEED_ARR_SZ];
  52. struct dp_pdev_be *link_to_pdev_map[WLAN_MAX_MLO_CHIPS *
  53. WLAN_MAX_MLO_LINKS_PER_SOC];
  54. struct dp_rx_fst *rx_fst;
  55. uint8_t rx_fst_ref_cnt;
  56. };
  57. /**
  58. * dp_mlo_ctx_to_cdp() - typecast dp mlo context to CDP context
  59. * @mlo_ctxt: DP MLO context
  60. *
  61. * Return: struct cdp_mlo_ctxt pointer
  62. */
  63. static inline
  64. struct cdp_mlo_ctxt *dp_mlo_ctx_to_cdp(struct dp_mlo_ctxt *mlo_ctxt)
  65. {
  66. return (struct cdp_mlo_ctxt *)mlo_ctxt;
  67. }
  68. /**
  69. * cdp_mlo_ctx_to_dp() - typecast cdp_soc_t to
  70. * dp soc handle
  71. * @psoc: CDP psoc handle
  72. *
  73. * Return: struct dp_soc pointer
  74. */
  75. static inline
  76. struct dp_mlo_ctxt *cdp_mlo_ctx_to_dp(struct cdp_mlo_ctxt *mlo_ctxt)
  77. {
  78. return (struct dp_mlo_ctxt *)mlo_ctxt;
  79. }
  80. /**
  81. * dp_soc_mlo_fill_params() - update SOC mlo params
  82. * @soc: DP soc
  83. * @params: soc attach params
  84. *
  85. * Return: struct dp_soc pointer
  86. */
  87. void dp_soc_mlo_fill_params(struct dp_soc *soc,
  88. struct cdp_soc_attach_params *params);
  89. /**
  90. * dp_pdev_mlo_fill_params() - update PDEV mlo params
  91. * @pdev: DP PDEV
  92. * @params: PDEV attach params
  93. *
  94. * Return: struct dp_soc pointer
  95. */
  96. void dp_pdev_mlo_fill_params(struct dp_pdev *pdev,
  97. struct cdp_pdev_attach_params *params);
  98. struct dp_soc*
  99. dp_mlo_get_soc_ref_by_chip_id(struct dp_mlo_ctxt *ml_ctxt, uint8_t chip_id);
  100. /**
  101. * dp_mlo_get_rx_hash_key() - Get Rx hash key from MLO context
  102. * @soc: DP SOC
  103. * @lro_hash: Hash params
  104. *
  105. */
  106. void dp_mlo_get_rx_hash_key(struct dp_soc *soc,
  107. struct cdp_lro_hash_config *lro_hash);
  108. /**
  109. * dp_mlo_rx_fst_deref() - decrement rx_fst
  110. * @soc: dp soc
  111. *
  112. * return: soc cnt
  113. */
  114. uint8_t dp_mlo_rx_fst_deref(struct dp_soc *soc);
  115. /**
  116. * dp_mlo_rx_fst_ref() - increment ref of rx_fst
  117. * @soc: dp soc
  118. *
  119. */
  120. void dp_mlo_rx_fst_ref(struct dp_soc *soc);
  121. /**
  122. * dp_mlo_get_rx_fst() - Get Rx FST from MLO context
  123. * @soc: DP SOC
  124. *
  125. * Return: struct dp_rx_fst pointer
  126. */
  127. struct dp_rx_fst *dp_mlo_get_rx_fst(struct dp_soc *soc);
  128. /**
  129. * dp_mlo_set_rx_fst() - Set Rx FST in MLO context
  130. * @soc: DP SOC
  131. * @fst: pointer dp_rx_fst
  132. *
  133. */
  134. void dp_mlo_set_rx_fst(struct dp_soc *soc, struct dp_rx_fst *fst);
  135. /**
  136. * dp_mlo_update_link_to_pdev_map : map link-id to pdev mapping
  137. * @soc: DP SOC
  138. * @pdev: DP PDEV
  139. *
  140. * Return: none
  141. */
  142. void dp_mlo_update_link_to_pdev_map(struct dp_soc *soc, struct dp_pdev *pdev);
  143. /**
  144. * dp_mlo_update_link_to_pdev_unmap : unmap link-id to pdev mapping
  145. * @soc: DP SOC
  146. * @pdev: DP PDEV
  147. *
  148. * Return: none
  149. */
  150. void dp_mlo_update_link_to_pdev_unmap(struct dp_soc *soc, struct dp_pdev *pdev);
  151. /**
  152. * dp_mlo_get_delta_tsf2_wrt_mlo_offset() - Get delta between mlo timestamp
  153. * offset and delta tsf2
  154. * @soc: DP SOC
  155. * @hw_link_id: link id
  156. *
  157. * Return: int32_t
  158. */
  159. int32_t dp_mlo_get_delta_tsf2_wrt_mlo_offset(struct dp_soc *soc,
  160. uint8_t hw_link_id);
  161. /**
  162. * dp_mlo_get_delta_tqm_wrt_mlo_offset() - Get delta between mlo timestamp
  163. * offset and delta tqm
  164. * @soc: DP SOC
  165. *
  166. * Return: int32_t
  167. */
  168. int32_t dp_mlo_get_delta_tqm_wrt_mlo_offset(struct dp_soc *soc);
  169. #endif /* __DP_MLO_H */