mt76_connac.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* SPDX-License-Identifier: ISC */
  2. /* Copyright (C) 2020 MediaTek Inc. */
  3. #ifndef __MT76_CONNAC_H
  4. #define __MT76_CONNAC_H
  5. #include "mt76.h"
  6. #define MT76_CONNAC_SCAN_IE_LEN 600
  7. #define MT76_CONNAC_MAX_SCHED_SCAN_INTERVAL 10
  8. #define MT76_CONNAC_MAX_SCHED_SCAN_SSID 10
  9. #define MT76_CONNAC_MAX_SCAN_MATCH 16
  10. #define MT76_CONNAC_COREDUMP_TIMEOUT (HZ / 20)
  11. #define MT76_CONNAC_COREDUMP_SZ (128 * 1024)
  12. enum {
  13. CMD_CBW_20MHZ = IEEE80211_STA_RX_BW_20,
  14. CMD_CBW_40MHZ = IEEE80211_STA_RX_BW_40,
  15. CMD_CBW_80MHZ = IEEE80211_STA_RX_BW_80,
  16. CMD_CBW_160MHZ = IEEE80211_STA_RX_BW_160,
  17. CMD_CBW_10MHZ,
  18. CMD_CBW_5MHZ,
  19. CMD_CBW_8080MHZ,
  20. CMD_HE_MCS_BW80 = 0,
  21. CMD_HE_MCS_BW160,
  22. CMD_HE_MCS_BW8080,
  23. CMD_HE_MCS_BW_NUM
  24. };
  25. enum {
  26. HW_BSSID_0 = 0x0,
  27. HW_BSSID_1,
  28. HW_BSSID_2,
  29. HW_BSSID_3,
  30. HW_BSSID_MAX = HW_BSSID_3,
  31. EXT_BSSID_START = 0x10,
  32. EXT_BSSID_1,
  33. EXT_BSSID_15 = 0x1f,
  34. EXT_BSSID_MAX = EXT_BSSID_15,
  35. REPEATER_BSSID_START = 0x20,
  36. REPEATER_BSSID_MAX = 0x3f,
  37. };
  38. struct mt76_connac_pm {
  39. bool enable;
  40. spinlock_t txq_lock;
  41. struct {
  42. struct mt76_wcid *wcid;
  43. struct sk_buff *skb;
  44. } tx_q[IEEE80211_NUM_ACS];
  45. struct work_struct wake_work;
  46. struct completion wake_cmpl;
  47. struct delayed_work ps_work;
  48. unsigned long last_activity;
  49. unsigned long idle_timeout;
  50. };
  51. struct mt76_connac_coredump {
  52. struct sk_buff_head msg_list;
  53. struct delayed_work work;
  54. unsigned long last_activity;
  55. };
  56. extern const struct wiphy_wowlan_support mt76_connac_wowlan_support;
  57. static inline bool is_mt7921(struct mt76_dev *dev)
  58. {
  59. return mt76_chip(dev) == 0x7961;
  60. }
  61. static inline bool is_mt7663(struct mt76_dev *dev)
  62. {
  63. return mt76_chip(dev) == 0x7663;
  64. }
  65. int mt76_connac_pm_wake(struct mt76_phy *phy, struct mt76_connac_pm *pm);
  66. void mt76_connac_power_save_sched(struct mt76_phy *phy,
  67. struct mt76_connac_pm *pm);
  68. void mt76_connac_free_pending_tx_skbs(struct mt76_connac_pm *pm,
  69. struct mt76_wcid *wcid);
  70. static inline void
  71. mt76_connac_mutex_acquire(struct mt76_dev *dev, struct mt76_connac_pm *pm)
  72. __acquires(&dev->mutex)
  73. {
  74. mutex_lock(&dev->mutex);
  75. mt76_connac_pm_wake(&dev->phy, pm);
  76. }
  77. static inline void
  78. mt76_connac_mutex_release(struct mt76_dev *dev, struct mt76_connac_pm *pm)
  79. __releases(&dev->mutex)
  80. {
  81. mt76_connac_power_save_sched(&dev->phy, pm);
  82. mutex_unlock(&dev->mutex);
  83. }
  84. void mt76_connac_pm_queue_skb(struct ieee80211_hw *hw,
  85. struct mt76_connac_pm *pm,
  86. struct mt76_wcid *wcid,
  87. struct sk_buff *skb);
  88. void mt76_connac_pm_dequeue_skbs(struct mt76_phy *phy,
  89. struct mt76_connac_pm *pm);
  90. #endif /* __MT76_CONNAC_H */