dp_mlo.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 3
  22. /* Max number of peers supported */
  23. #define DP_MAX_MLO_PEER 512
  24. /*
  25. * dp_mlo_ctxt
  26. *
  27. * @ctrl_ctxt: opaque handle of cp mlo mgr
  28. * @ml_soc_list: list of socs which are mlo enabled. This also maintains
  29. * mlo_chip_id to dp_soc mapping
  30. * @ml_soc_list_lock: lock to protect ml_soc_list
  31. * @mld_peer_hash: peer hash table for ML peers
  32. * Associated peer with this MAC address)
  33. * @mld_peer_hash_lock: lock to protect mld_peer_hash
  34. */
  35. struct dp_mlo_ctxt {
  36. struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
  37. struct dp_soc *ml_soc_list[DP_MAX_MLO_CHIPS];
  38. qdf_spinlock_t ml_soc_list_lock;
  39. struct {
  40. uint32_t mask;
  41. uint32_t idx_bits;
  42. TAILQ_HEAD(, dp_peer) * bins;
  43. } mld_peer_hash;
  44. qdf_spinlock_t mld_peer_hash_lock;
  45. };
  46. /**
  47. * dp_mlo_ctx_to_cdp() - typecast dp mlo context to CDP context
  48. * @mlo_ctxt: DP MLO context
  49. *
  50. * Return: struct cdp_mlo_ctxt pointer
  51. */
  52. static inline
  53. struct cdp_mlo_ctxt *dp_mlo_ctx_to_cdp(struct dp_mlo_ctxt *mlo_ctxt)
  54. {
  55. return (struct cdp_mlo_ctxt *)mlo_ctxt;
  56. }
  57. /**
  58. * cdp_mlo_ctx_to_dp() - typecast cdp_soc_t to
  59. * dp soc handle
  60. * @psoc: CDP psoc handle
  61. *
  62. * Return: struct dp_soc pointer
  63. */
  64. static inline
  65. struct dp_mlo_ctxt *cdp_mlo_ctx_to_dp(struct cdp_mlo_ctxt *mlo_ctxt)
  66. {
  67. return (struct dp_mlo_ctxt *)mlo_ctxt;
  68. }
  69. /**
  70. * dp_soc_mlo_fill_params() - update SOC mlo params
  71. * @soc: DP soc
  72. * @params: soc attach params
  73. *
  74. * Return: struct dp_soc pointer
  75. */
  76. void dp_soc_mlo_fill_params(struct dp_soc *soc,
  77. struct cdp_soc_attach_params *params);
  78. /**
  79. * dp_pdev_mlo_fill_params() - update PDEV mlo params
  80. * @pdev: DP PDEV
  81. * @params: PDEV attach params
  82. *
  83. * Return: struct dp_soc pointer
  84. */
  85. void dp_pdev_mlo_fill_params(struct dp_pdev *pdev,
  86. struct cdp_pdev_attach_params *params);
  87. #endif /* __DP_MLO_H */