chan.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
  2. * Copyright(c) 2020-2022 Realtek Corporation
  3. */
  4. #ifndef __RTW89_CHAN_H__
  5. #define __RTW89_CHAN_H__
  6. #include "core.h"
  7. /* The dwell time in TU before doing rtw89_chanctx_work(). */
  8. #define RTW89_CHANCTX_TIME_MCC_PREPARE 100
  9. #define RTW89_CHANCTX_TIME_MCC 100
  10. /* various MCC setting time in TU */
  11. #define RTW89_MCC_LONG_TRIGGER_TIME 300
  12. #define RTW89_MCC_SHORT_TRIGGER_TIME 100
  13. #define RTW89_MCC_EARLY_TX_BCN_TIME 10
  14. #define RTW89_MCC_EARLY_RX_BCN_TIME 5
  15. #define RTW89_MCC_MIN_RX_BCN_TIME 10
  16. #define RTW89_MCC_DFLT_BCN_OFST_TIME 40
  17. #define RTW89_MCC_MIN_GO_DURATION \
  18. (RTW89_MCC_EARLY_TX_BCN_TIME + RTW89_MCC_MIN_RX_BCN_TIME)
  19. #define RTW89_MCC_MIN_STA_DURATION \
  20. (RTW89_MCC_EARLY_RX_BCN_TIME + RTW89_MCC_MIN_RX_BCN_TIME)
  21. #define RTW89_MCC_DFLT_GROUP 0
  22. #define RTW89_MCC_NEXT_GROUP(cur) (((cur) + 1) % 4)
  23. #define RTW89_MCC_DFLT_TX_NULL_EARLY 3
  24. #define RTW89_MCC_DFLT_COURTESY_SLOT 3
  25. #define NUM_OF_RTW89_MCC_ROLES 2
  26. enum rtw89_chanctx_pause_reasons {
  27. RTW89_CHANCTX_PAUSE_REASON_HW_SCAN,
  28. RTW89_CHANCTX_PAUSE_REASON_ROC,
  29. };
  30. static inline bool rtw89_get_entity_state(struct rtw89_dev *rtwdev)
  31. {
  32. struct rtw89_hal *hal = &rtwdev->hal;
  33. return READ_ONCE(hal->entity_active);
  34. }
  35. static inline void rtw89_set_entity_state(struct rtw89_dev *rtwdev, bool active)
  36. {
  37. struct rtw89_hal *hal = &rtwdev->hal;
  38. WRITE_ONCE(hal->entity_active, active);
  39. }
  40. static inline
  41. enum rtw89_entity_mode rtw89_get_entity_mode(struct rtw89_dev *rtwdev)
  42. {
  43. struct rtw89_hal *hal = &rtwdev->hal;
  44. return READ_ONCE(hal->entity_mode);
  45. }
  46. static inline void rtw89_set_entity_mode(struct rtw89_dev *rtwdev,
  47. enum rtw89_entity_mode mode)
  48. {
  49. struct rtw89_hal *hal = &rtwdev->hal;
  50. WRITE_ONCE(hal->entity_mode, mode);
  51. }
  52. void rtw89_chan_create(struct rtw89_chan *chan, u8 center_chan, u8 primary_chan,
  53. enum rtw89_band band, enum rtw89_bandwidth bandwidth);
  54. bool rtw89_assign_entity_chan(struct rtw89_dev *rtwdev,
  55. enum rtw89_sub_entity_idx idx,
  56. const struct rtw89_chan *new);
  57. void rtw89_config_entity_chandef(struct rtw89_dev *rtwdev,
  58. enum rtw89_sub_entity_idx idx,
  59. const struct cfg80211_chan_def *chandef);
  60. void rtw89_config_roc_chandef(struct rtw89_dev *rtwdev,
  61. enum rtw89_sub_entity_idx idx,
  62. const struct cfg80211_chan_def *chandef);
  63. void rtw89_entity_init(struct rtw89_dev *rtwdev);
  64. enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev);
  65. void rtw89_chanctx_work(struct work_struct *work);
  66. void rtw89_queue_chanctx_work(struct rtw89_dev *rtwdev);
  67. void rtw89_queue_chanctx_change(struct rtw89_dev *rtwdev,
  68. enum rtw89_chanctx_changes change);
  69. void rtw89_chanctx_track(struct rtw89_dev *rtwdev);
  70. void rtw89_chanctx_pause(struct rtw89_dev *rtwdev,
  71. enum rtw89_chanctx_pause_reasons rsn);
  72. void rtw89_chanctx_proceed(struct rtw89_dev *rtwdev);
  73. int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev,
  74. struct ieee80211_chanctx_conf *ctx);
  75. void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev,
  76. struct ieee80211_chanctx_conf *ctx);
  77. void rtw89_chanctx_ops_change(struct rtw89_dev *rtwdev,
  78. struct ieee80211_chanctx_conf *ctx,
  79. u32 changed);
  80. int rtw89_chanctx_ops_assign_vif(struct rtw89_dev *rtwdev,
  81. struct rtw89_vif *rtwvif,
  82. struct ieee80211_chanctx_conf *ctx);
  83. void rtw89_chanctx_ops_unassign_vif(struct rtw89_dev *rtwdev,
  84. struct rtw89_vif *rtwvif,
  85. struct ieee80211_chanctx_conf *ctx);
  86. #endif