dp_mlo.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (c) 2021 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. /* shift value to index into the array, used instead of mult by 2 */
  27. #define DP_MLO_DEST_CHIP_ID_SHIFT 1
  28. /*
  29. * dp_mlo_ctxt
  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_list_lock: lock to protect ml_soc_list
  35. * @mld_peer_hash: peer hash table for ML peers
  36. * Associated peer with this MAC address)
  37. * @mld_peer_hash_lock: lock to protect mld_peer_hash
  38. */
  39. struct dp_mlo_ctxt {
  40. struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
  41. struct dp_soc *ml_soc_list[DP_MAX_MLO_CHIPS];
  42. qdf_spinlock_t ml_soc_list_lock;
  43. struct {
  44. uint32_t mask;
  45. uint32_t idx_bits;
  46. TAILQ_HEAD(, dp_peer) * bins;
  47. } mld_peer_hash;
  48. qdf_spinlock_t mld_peer_hash_lock;
  49. };
  50. /**
  51. * dp_mlo_ctx_to_cdp() - typecast dp mlo context to CDP context
  52. * @mlo_ctxt: DP MLO context
  53. *
  54. * Return: struct cdp_mlo_ctxt pointer
  55. */
  56. static inline
  57. struct cdp_mlo_ctxt *dp_mlo_ctx_to_cdp(struct dp_mlo_ctxt *mlo_ctxt)
  58. {
  59. return (struct cdp_mlo_ctxt *)mlo_ctxt;
  60. }
  61. /**
  62. * cdp_mlo_ctx_to_dp() - typecast cdp_soc_t to
  63. * dp soc handle
  64. * @psoc: CDP psoc handle
  65. *
  66. * Return: struct dp_soc pointer
  67. */
  68. static inline
  69. struct dp_mlo_ctxt *cdp_mlo_ctx_to_dp(struct cdp_mlo_ctxt *mlo_ctxt)
  70. {
  71. return (struct dp_mlo_ctxt *)mlo_ctxt;
  72. }
  73. /**
  74. * dp_soc_mlo_fill_params() - update SOC mlo params
  75. * @soc: DP soc
  76. * @params: soc attach params
  77. *
  78. * Return: struct dp_soc pointer
  79. */
  80. void dp_soc_mlo_fill_params(struct dp_soc *soc,
  81. struct cdp_soc_attach_params *params);
  82. /**
  83. * dp_pdev_mlo_fill_params() - update PDEV mlo params
  84. * @pdev: DP PDEV
  85. * @params: PDEV attach params
  86. *
  87. * Return: struct dp_soc pointer
  88. */
  89. void dp_pdev_mlo_fill_params(struct dp_pdev *pdev,
  90. struct cdp_pdev_attach_params *params);
  91. struct dp_soc*
  92. dp_mlo_get_soc_ref_by_chip_id(struct dp_mlo_ctxt *ml_ctxt, uint8_t chip_id);
  93. #endif /* __DP_MLO_H */