base.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright(c) 2009-2012 Realtek Corporation.*/
  3. #ifndef __RTL_BASE_H__
  4. #define __RTL_BASE_H__
  5. enum ap_peer {
  6. PEER_UNKNOWN = 0,
  7. PEER_RTL = 1,
  8. PEER_RTL_92SE = 2,
  9. PEER_BROAD = 3,
  10. PEER_RAL = 4,
  11. PEER_ATH = 5,
  12. PEER_CISCO = 6,
  13. PEER_MARV = 7,
  14. PEER_AIRGO = 9,
  15. PEER_MAX = 10,
  16. };
  17. #define RTL_DUMMY_OFFSET 0
  18. #define RTL_DUMMY_UNIT 8
  19. #define RTL_TX_DUMMY_SIZE (RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT)
  20. #define RTL_TX_DESC_SIZE 32
  21. #define RTL_TX_HEADER_SIZE (RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE)
  22. #define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */
  23. #define MAX_BIT_RATE_40MHZ_MCS7 150 /* Mbps */
  24. #define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS9 867 /* Mbps */
  25. #define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS7 650 /* Mbps */
  26. #define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS9 780 /* Mbps */
  27. #define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS7 585 /* Mbps */
  28. #define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS9 434 /* Mbps */
  29. #define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS7 325 /* Mbps */
  30. #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9 390 /* Mbps */
  31. #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7 293 /* Mbps */
  32. #define FRAME_OFFSET_FRAME_CONTROL 0
  33. #define FRAME_OFFSET_DURATION 2
  34. #define FRAME_OFFSET_ADDRESS1 4
  35. #define FRAME_OFFSET_ADDRESS2 10
  36. #define FRAME_OFFSET_ADDRESS3 16
  37. #define FRAME_OFFSET_SEQUENCE 22
  38. #define FRAME_OFFSET_ADDRESS4 24
  39. #define MAX_LISTEN_INTERVAL 10
  40. #define MAX_RATE_TRIES 4
  41. #define SET_80211_PS_POLL_AID(_hdr, _val) \
  42. (*(u16 *)((u8 *)(_hdr) + 2) = _val)
  43. #define SET_80211_PS_POLL_BSSID(_hdr, _val) \
  44. ether_addr_copy(((u8 *)(_hdr)) + 4, (u8 *)(_val))
  45. #define SET_80211_PS_POLL_TA(_hdr, _val) \
  46. ether_addr_copy(((u8 *)(_hdr))+10, (u8 *)(_val))
  47. #define SET_80211_HDR_ADDRESS1(_hdr, _val) \
  48. CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val))
  49. #define SET_80211_HDR_ADDRESS2(_hdr, _val) \
  50. CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val))
  51. #define SET_80211_HDR_ADDRESS3(_hdr, _val) \
  52. CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val))
  53. #define SET_TX_DESC_SPE_RPT(__pdesc, __val) \
  54. le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(19))
  55. #define SET_TX_DESC_SW_DEFINE(__pdesc, __val) \
  56. le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(11, 0))
  57. int rtl_init_core(struct ieee80211_hw *hw);
  58. void rtl_deinit_core(struct ieee80211_hw *hw);
  59. void rtl_init_rx_config(struct ieee80211_hw *hw);
  60. void rtl_init_rfkill(struct ieee80211_hw *hw);
  61. void rtl_deinit_rfkill(struct ieee80211_hw *hw);
  62. void rtl_watch_dog_timer_callback(struct timer_list *t);
  63. void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq);
  64. bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
  65. int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht,
  66. bool isvht, u8 desc_rate);
  67. bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
  68. u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
  69. bool is_enc);
  70. void rtl_tx_ackqueue(struct ieee80211_hw *hw, struct sk_buff *skb);
  71. bool rtl_is_tx_report_skb(struct ieee80211_hw *hw, struct sk_buff *skb);
  72. void rtl_set_tx_report(struct rtl_tcb_desc *ptcb_desc, u8 *pdesc,
  73. struct ieee80211_hw *hw, struct rtlwifi_tx_info *info);
  74. void rtl_tx_report_handler(struct ieee80211_hw *hw, u8 *tmp_buf,
  75. u8 c2h_cmd_len);
  76. bool rtl_check_tx_report_acked(struct ieee80211_hw *hw);
  77. void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms);
  78. u32 rtl_get_hal_edca_param(struct ieee80211_hw *hw,
  79. struct ieee80211_vif *vif,
  80. enum wireless_mode wirelessmode,
  81. struct ieee80211_tx_queue_params *param);
  82. void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
  83. void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb);
  84. void rtl_scan_list_expire(struct ieee80211_hw *hw);
  85. int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  86. struct ieee80211_sta *sta, u16 tid, u16 *ssn);
  87. int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  88. struct ieee80211_sta *sta, u16 tid);
  89. int rtl_tx_agg_oper(struct ieee80211_hw *hw,
  90. struct ieee80211_sta *sta, u16 tid);
  91. int rtl_rx_agg_start(struct ieee80211_hw *hw,
  92. struct ieee80211_sta *sta, u16 tid);
  93. int rtl_rx_agg_stop(struct ieee80211_hw *hw,
  94. struct ieee80211_sta *sta, u16 tid);
  95. void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv);
  96. void rtl_c2hcmd_launcher(struct ieee80211_hw *hw, int exec);
  97. void rtl_c2hcmd_enqueue(struct ieee80211_hw *hw, struct sk_buff *skb);
  98. u8 rtl_mrate_idx_to_arfr_id(struct ieee80211_hw *hw, u8 rate_index,
  99. enum wireless_mode wirelessmode);
  100. void rtl_get_tcb_desc(struct ieee80211_hw *hw,
  101. struct ieee80211_tx_info *info,
  102. struct ieee80211_sta *sta,
  103. struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc);
  104. int rtl_send_smps_action(struct ieee80211_hw *hw,
  105. struct ieee80211_sta *sta,
  106. enum ieee80211_smps_mode smps);
  107. u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie);
  108. void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len);
  109. u8 rtl_tid_to_ac(u8 tid);
  110. void rtl_easy_concurrent_retrytimer_callback(struct timer_list *t);
  111. extern struct rtl_global_var rtl_global_var;
  112. void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation);
  113. #endif