dp_mlo.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. */
  37. struct dp_mlo_ctxt {
  38. struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
  39. struct dp_soc *ml_soc_list[DP_MAX_MLO_CHIPS];
  40. qdf_spinlock_t ml_soc_list_lock;
  41. struct {
  42. uint32_t mask;
  43. uint32_t idx_bits;
  44. TAILQ_HEAD(, dp_peer) * bins;
  45. } mld_peer_hash;
  46. qdf_spinlock_t mld_peer_hash_lock;
  47. };
  48. /**
  49. * dp_mlo_ctx_to_cdp() - typecast dp mlo context to CDP context
  50. * @mlo_ctxt: DP MLO context
  51. *
  52. * Return: struct cdp_mlo_ctxt pointer
  53. */
  54. static inline
  55. struct cdp_mlo_ctxt *dp_mlo_ctx_to_cdp(struct dp_mlo_ctxt *mlo_ctxt)
  56. {
  57. return (struct cdp_mlo_ctxt *)mlo_ctxt;
  58. }
  59. /**
  60. * cdp_mlo_ctx_to_dp() - typecast cdp_soc_t to
  61. * dp soc handle
  62. * @psoc: CDP psoc handle
  63. *
  64. * Return: struct dp_soc pointer
  65. */
  66. static inline
  67. struct dp_mlo_ctxt *cdp_mlo_ctx_to_dp(struct cdp_mlo_ctxt *mlo_ctxt)
  68. {
  69. return (struct dp_mlo_ctxt *)mlo_ctxt;
  70. }
  71. /**
  72. * dp_soc_mlo_fill_params() - update SOC mlo params
  73. * @soc: DP soc
  74. * @params: soc attach params
  75. *
  76. * Return: struct dp_soc pointer
  77. */
  78. void dp_soc_mlo_fill_params(struct dp_soc *soc,
  79. struct cdp_soc_attach_params *params);
  80. /**
  81. * dp_pdev_mlo_fill_params() - update PDEV mlo params
  82. * @pdev: DP PDEV
  83. * @params: PDEV attach params
  84. *
  85. * Return: struct dp_soc pointer
  86. */
  87. void dp_pdev_mlo_fill_params(struct dp_pdev *pdev,
  88. struct cdp_pdev_attach_params *params);
  89. struct dp_soc*
  90. dp_mlo_get_soc_ref_by_chip_id(struct dp_mlo_ctxt *ml_ctxt, uint8_t chip_id);
  91. #endif /* __DP_MLO_H */