dp_mlo.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright (c) 2021-2022 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. */
  38. struct dp_mlo_ctxt {
  39. struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
  40. struct dp_soc *ml_soc_list[DP_MAX_MLO_CHIPS];
  41. qdf_spinlock_t ml_soc_list_lock;
  42. struct {
  43. uint32_t mask;
  44. uint32_t idx_bits;
  45. TAILQ_HEAD(, dp_peer) * bins;
  46. } mld_peer_hash;
  47. qdf_spinlock_t mld_peer_hash_lock;
  48. uint32_t toeplitz_hash_ipv4[LRO_IPV4_SEED_ARR_SZ];
  49. uint32_t toeplitz_hash_ipv6[LRO_IPV6_SEED_ARR_SZ];
  50. struct dp_pdev_be *link_to_pdev_map[WLAN_MAX_MLO_CHIPS *
  51. WLAN_MAX_MLO_LINKS_PER_SOC];
  52. };
  53. /**
  54. * dp_mlo_ctx_to_cdp() - typecast dp mlo context to CDP context
  55. * @mlo_ctxt: DP MLO context
  56. *
  57. * Return: struct cdp_mlo_ctxt pointer
  58. */
  59. static inline
  60. struct cdp_mlo_ctxt *dp_mlo_ctx_to_cdp(struct dp_mlo_ctxt *mlo_ctxt)
  61. {
  62. return (struct cdp_mlo_ctxt *)mlo_ctxt;
  63. }
  64. /**
  65. * cdp_mlo_ctx_to_dp() - typecast cdp_soc_t to
  66. * dp soc handle
  67. * @psoc: CDP psoc handle
  68. *
  69. * Return: struct dp_soc pointer
  70. */
  71. static inline
  72. struct dp_mlo_ctxt *cdp_mlo_ctx_to_dp(struct cdp_mlo_ctxt *mlo_ctxt)
  73. {
  74. return (struct dp_mlo_ctxt *)mlo_ctxt;
  75. }
  76. /**
  77. * dp_soc_mlo_fill_params() - update SOC mlo params
  78. * @soc: DP soc
  79. * @params: soc attach params
  80. *
  81. * Return: struct dp_soc pointer
  82. */
  83. void dp_soc_mlo_fill_params(struct dp_soc *soc,
  84. struct cdp_soc_attach_params *params);
  85. /**
  86. * dp_pdev_mlo_fill_params() - update PDEV mlo params
  87. * @pdev: DP PDEV
  88. * @params: PDEV attach params
  89. *
  90. * Return: struct dp_soc pointer
  91. */
  92. void dp_pdev_mlo_fill_params(struct dp_pdev *pdev,
  93. struct cdp_pdev_attach_params *params);
  94. struct dp_soc*
  95. dp_mlo_get_soc_ref_by_chip_id(struct dp_mlo_ctxt *ml_ctxt, uint8_t chip_id);
  96. /**
  97. * dp_mlo_get_rx_hash_key() - Get Rx hash key from MLO context
  98. * @soc: DP SOC
  99. * @lro_hash: Hash params
  100. *
  101. */
  102. void dp_mlo_get_rx_hash_key(struct dp_soc *soc,
  103. struct cdp_lro_hash_config *lro_hash);
  104. /**
  105. * dp_mlo_update_link_to_pdev_map : map link-id to pdev mapping
  106. * @soc: DP SOC
  107. * @pdev: DP PDEV
  108. *
  109. * Return: none
  110. */
  111. void dp_mlo_update_link_to_pdev_map(struct dp_soc *soc, struct dp_pdev *pdev);
  112. /**
  113. * dp_mlo_update_link_to_pdev_unmap : unmap link-id to pdev mapping
  114. * @soc: DP SOC
  115. * @pdev: DP PDEV
  116. *
  117. * Return: none
  118. */
  119. void dp_mlo_update_link_to_pdev_unmap(struct dp_soc *soc, struct dp_pdev *pdev);
  120. /**
  121. * dp_mlo_get_delta_tsf2_wrt_mlo_offset() - Get delta between mlo timestamp
  122. * offset and delta tsf2
  123. * @soc: DP SOC
  124. * @hw_link_id: link id
  125. *
  126. * Return: int32_t
  127. */
  128. int32_t dp_mlo_get_delta_tsf2_wrt_mlo_offset(struct dp_soc *soc,
  129. uint8_t hw_link_id);
  130. /**
  131. * dp_mlo_get_delta_tqm_wrt_mlo_offset() - Get delta between mlo timestamp
  132. * offset and delta tqm
  133. * @soc: DP SOC
  134. *
  135. * Return: int32_t
  136. */
  137. int32_t dp_mlo_get_delta_tqm_wrt_mlo_offset(struct dp_soc *soc);
  138. #endif /* __DP_MLO_H */