mac.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: BSD-3-Clause-Clear */
  2. /*
  3. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef ATH12K_MAC_H
  7. #define ATH12K_MAC_H
  8. #include <net/mac80211.h>
  9. #include <net/cfg80211.h>
  10. #include "wmi.h"
  11. struct ath12k;
  12. struct ath12k_base;
  13. struct ath12k_hw;
  14. struct ath12k_pdev_map;
  15. struct ath12k_generic_iter {
  16. struct ath12k *ar;
  17. int ret;
  18. };
  19. /* number of failed packets (20 packets with 16 sw reties each) */
  20. #define ATH12K_KICKOUT_THRESHOLD (20 * 16)
  21. /* Use insanely high numbers to make sure that the firmware implementation
  22. * won't start, we have the same functionality already in hostapd. Unit
  23. * is seconds.
  24. */
  25. #define ATH12K_KEEPALIVE_MIN_IDLE 3747
  26. #define ATH12K_KEEPALIVE_MAX_IDLE 3895
  27. #define ATH12K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  28. /* FIXME: should these be in ieee80211.h? */
  29. #define IEEE80211_VHT_MCS_SUPPORT_0_11_MASK GENMASK(23, 16)
  30. #define IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11 BIT(24)
  31. #define ATH12K_CHAN_WIDTH_NUM 14
  32. #define ATH12K_TX_POWER_MAX_VAL 70
  33. #define ATH12K_TX_POWER_MIN_VAL 0
  34. enum ath12k_supported_bw {
  35. ATH12K_BW_20 = 0,
  36. ATH12K_BW_40 = 1,
  37. ATH12K_BW_80 = 2,
  38. ATH12K_BW_160 = 3,
  39. ATH12K_BW_320 = 4,
  40. };
  41. extern const struct htt_rx_ring_tlv_filter ath12k_mac_mon_status_filter_default;
  42. void ath12k_mac_destroy(struct ath12k_base *ab);
  43. void ath12k_mac_unregister(struct ath12k_base *ab);
  44. int ath12k_mac_register(struct ath12k_base *ab);
  45. int ath12k_mac_allocate(struct ath12k_base *ab);
  46. int ath12k_mac_hw_ratecode_to_legacy_rate(u8 hw_rc, u8 preamble, u8 *rateidx,
  47. u16 *rate);
  48. u8 ath12k_mac_bitrate_to_idx(const struct ieee80211_supported_band *sband,
  49. u32 bitrate);
  50. u8 ath12k_mac_hw_rate_to_idx(const struct ieee80211_supported_band *sband,
  51. u8 hw_rate, bool cck);
  52. void __ath12k_mac_scan_finish(struct ath12k *ar);
  53. void ath12k_mac_scan_finish(struct ath12k *ar);
  54. struct ath12k_vif *ath12k_mac_get_arvif(struct ath12k *ar, u32 vdev_id);
  55. struct ath12k_vif *ath12k_mac_get_arvif_by_vdev_id(struct ath12k_base *ab,
  56. u32 vdev_id);
  57. struct ath12k *ath12k_mac_get_ar_by_vdev_id(struct ath12k_base *ab, u32 vdev_id);
  58. struct ath12k *ath12k_mac_get_ar_by_pdev_id(struct ath12k_base *ab, u32 pdev_id);
  59. void ath12k_mac_drain_tx(struct ath12k *ar);
  60. void ath12k_mac_peer_cleanup_all(struct ath12k *ar);
  61. int ath12k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx);
  62. enum rate_info_bw ath12k_mac_bw_to_mac80211_bw(enum ath12k_supported_bw bw);
  63. enum ath12k_supported_bw ath12k_mac_mac80211_bw_to_ath12k_bw(enum rate_info_bw bw);
  64. enum hal_encrypt_type ath12k_dp_tx_get_encrypt_type(u32 cipher);
  65. int ath12k_mac_rfkill_enable_radio(struct ath12k *ar, bool enable);
  66. int ath12k_mac_rfkill_config(struct ath12k *ar);
  67. int ath12k_mac_wait_tx_complete(struct ath12k *ar);
  68. void ath12k_mac_handle_beacon(struct ath12k *ar, struct sk_buff *skb);
  69. void ath12k_mac_handle_beacon_miss(struct ath12k *ar, u32 vdev_id);
  70. int ath12k_mac_vif_set_keepalive(struct ath12k_vif *arvif,
  71. enum wmi_sta_keepalive_method method,
  72. u32 interval);
  73. u8 ath12k_mac_get_target_pdev_id(struct ath12k *ar);
  74. #endif