1d27a76faSLarry Finger /* SPDX-License-Identifier: GPL-2.0 */ 2d27a76faSLarry Finger /* Copyright(c) 2009-2012 Realtek Corporation.*/ 3f1d2b4d3SLarry Finger 4f1d2b4d3SLarry Finger #ifndef __RTL_BASE_H__ 5f1d2b4d3SLarry Finger #define __RTL_BASE_H__ 6f1d2b4d3SLarry Finger 7f1d2b4d3SLarry Finger enum ap_peer { 8f1d2b4d3SLarry Finger PEER_UNKNOWN = 0, 9f1d2b4d3SLarry Finger PEER_RTL = 1, 10f1d2b4d3SLarry Finger PEER_RTL_92SE = 2, 11f1d2b4d3SLarry Finger PEER_BROAD = 3, 12f1d2b4d3SLarry Finger PEER_RAL = 4, 13f1d2b4d3SLarry Finger PEER_ATH = 5, 14f1d2b4d3SLarry Finger PEER_CISCO = 6, 15f1d2b4d3SLarry Finger PEER_MARV = 7, 16f1d2b4d3SLarry Finger PEER_AIRGO = 9, 17f1d2b4d3SLarry Finger PEER_MAX = 10, 18f1d2b4d3SLarry Finger }; 19f1d2b4d3SLarry Finger 20f1d2b4d3SLarry Finger #define RTL_DUMMY_OFFSET 0 21f1d2b4d3SLarry Finger #define RTL_DUMMY_UNIT 8 22f1d2b4d3SLarry Finger #define RTL_TX_DUMMY_SIZE (RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT) 23f1d2b4d3SLarry Finger #define RTL_TX_DESC_SIZE 32 24f1d2b4d3SLarry Finger #define RTL_TX_HEADER_SIZE (RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE) 25f1d2b4d3SLarry Finger 26f1d2b4d3SLarry Finger #define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */ 27f1d2b4d3SLarry Finger #define MAX_BIT_RATE_40MHZ_MCS7 150 /* Mbps */ 28f1d2b4d3SLarry Finger 29f1d2b4d3SLarry Finger #define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS9 867 /* Mbps */ 30f1d2b4d3SLarry Finger #define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS7 650 /* Mbps */ 31f1d2b4d3SLarry Finger #define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS9 780 /* Mbps */ 32f1d2b4d3SLarry Finger #define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS7 585 /* Mbps */ 33f1d2b4d3SLarry Finger 34f1d2b4d3SLarry Finger #define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS9 434 /* Mbps */ 35f1d2b4d3SLarry Finger #define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS7 325 /* Mbps */ 36f1d2b4d3SLarry Finger #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9 390 /* Mbps */ 37f1d2b4d3SLarry Finger #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7 293 /* Mbps */ 38f1d2b4d3SLarry Finger 39f1d2b4d3SLarry Finger #define FRAME_OFFSET_FRAME_CONTROL 0 40f1d2b4d3SLarry Finger #define FRAME_OFFSET_DURATION 2 41f1d2b4d3SLarry Finger #define FRAME_OFFSET_ADDRESS1 4 42f1d2b4d3SLarry Finger #define FRAME_OFFSET_ADDRESS2 10 43f1d2b4d3SLarry Finger #define FRAME_OFFSET_ADDRESS3 16 44f1d2b4d3SLarry Finger #define FRAME_OFFSET_SEQUENCE 22 45f1d2b4d3SLarry Finger #define FRAME_OFFSET_ADDRESS4 24 469d546198SSouptick Joarder #define MAX_LISTEN_INTERVAL 10 479d546198SSouptick Joarder #define MAX_RATE_TRIES 4 48f1d2b4d3SLarry Finger 49f1d2b4d3SLarry Finger #define SET_80211_PS_POLL_AID(_hdr, _val) \ 50f1d2b4d3SLarry Finger (*(u16 *)((u8 *)(_hdr) + 2) = _val) 51f1d2b4d3SLarry Finger #define SET_80211_PS_POLL_BSSID(_hdr, _val) \ 52f1d2b4d3SLarry Finger ether_addr_copy(((u8 *)(_hdr)) + 4, (u8 *)(_val)) 53f1d2b4d3SLarry Finger #define SET_80211_PS_POLL_TA(_hdr, _val) \ 54f1d2b4d3SLarry Finger ether_addr_copy(((u8 *)(_hdr))+10, (u8 *)(_val)) 55f1d2b4d3SLarry Finger 56f1d2b4d3SLarry Finger #define SET_80211_HDR_ADDRESS1(_hdr, _val) \ 57f1d2b4d3SLarry Finger CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val)) 58f1d2b4d3SLarry Finger #define SET_80211_HDR_ADDRESS2(_hdr, _val) \ 59f1d2b4d3SLarry Finger CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val)) 60f1d2b4d3SLarry Finger #define SET_80211_HDR_ADDRESS3(_hdr, _val) \ 61f1d2b4d3SLarry Finger CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val)) 62f1d2b4d3SLarry Finger 638479580bSPing-Ke Shih #define SET_TX_DESC_SPE_RPT(__pdesc, __val) \ 64*f0dcd57eSLarry Finger le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(19)) 658479580bSPing-Ke Shih #define SET_TX_DESC_SW_DEFINE(__pdesc, __val) \ 66*f0dcd57eSLarry Finger le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(11, 0)) 678479580bSPing-Ke Shih 68f1d2b4d3SLarry Finger int rtl_init_core(struct ieee80211_hw *hw); 69f1d2b4d3SLarry Finger void rtl_deinit_core(struct ieee80211_hw *hw); 70f1d2b4d3SLarry Finger void rtl_init_rx_config(struct ieee80211_hw *hw); 71f1d2b4d3SLarry Finger void rtl_init_rfkill(struct ieee80211_hw *hw); 72f1d2b4d3SLarry Finger void rtl_deinit_rfkill(struct ieee80211_hw *hw); 73f1d2b4d3SLarry Finger 747c51d17cSKees Cook void rtl_watch_dog_timer_callback(struct timer_list *t); 7512dfa2f6SPing-Ke Shih void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq); 76f1d2b4d3SLarry Finger 77f1d2b4d3SLarry Finger bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx); 78f1d2b4d3SLarry Finger int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht, 79f1d2b4d3SLarry Finger bool isvht, u8 desc_rate); 80f1d2b4d3SLarry Finger bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); 81f1d2b4d3SLarry Finger u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx, 82f1d2b4d3SLarry Finger bool is_enc); 83f1d2b4d3SLarry Finger 846acfbb81STzu-En Huang void rtl_tx_ackqueue(struct ieee80211_hw *hw, struct sk_buff *skb); 858479580bSPing-Ke Shih bool rtl_is_tx_report_skb(struct ieee80211_hw *hw, struct sk_buff *skb); 866acfbb81STzu-En Huang void rtl_set_tx_report(struct rtl_tcb_desc *ptcb_desc, u8 *pdesc, 876acfbb81STzu-En Huang struct ieee80211_hw *hw, struct rtlwifi_tx_info *info); 888479580bSPing-Ke Shih void rtl_tx_report_handler(struct ieee80211_hw *hw, u8 *tmp_buf, 898479580bSPing-Ke Shih u8 c2h_cmd_len); 908479580bSPing-Ke Shih bool rtl_check_tx_report_acked(struct ieee80211_hw *hw); 918479580bSPing-Ke Shih void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms); 92c1816f17SPing-Ke Shih u32 rtl_get_hal_edca_param(struct ieee80211_hw *hw, 93c1816f17SPing-Ke Shih struct ieee80211_vif *vif, 94c1816f17SPing-Ke Shih enum wireless_mode wirelessmode, 95c1816f17SPing-Ke Shih struct ieee80211_tx_queue_params *param); 968479580bSPing-Ke Shih 97f1d2b4d3SLarry Finger void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb); 98c76ab8e7SPing-Ke Shih void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb); 99c76ab8e7SPing-Ke Shih void rtl_scan_list_expire(struct ieee80211_hw *hw); 100f1d2b4d3SLarry Finger int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 101f1d2b4d3SLarry Finger struct ieee80211_sta *sta, u16 tid, u16 *ssn); 102f1d2b4d3SLarry Finger int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 103f1d2b4d3SLarry Finger struct ieee80211_sta *sta, u16 tid); 104f1d2b4d3SLarry Finger int rtl_tx_agg_oper(struct ieee80211_hw *hw, 105f1d2b4d3SLarry Finger struct ieee80211_sta *sta, u16 tid); 106f1d2b4d3SLarry Finger int rtl_rx_agg_start(struct ieee80211_hw *hw, 107f1d2b4d3SLarry Finger struct ieee80211_sta *sta, u16 tid); 108f1d2b4d3SLarry Finger int rtl_rx_agg_stop(struct ieee80211_hw *hw, 109f1d2b4d3SLarry Finger struct ieee80211_sta *sta, u16 tid); 1102635664eSPing-Ke Shih void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv); 111cceb0a59SPing-Ke Shih void rtl_c2hcmd_launcher(struct ieee80211_hw *hw, int exec); 1129ae6ed27SPing-Ke Shih void rtl_c2hcmd_enqueue(struct ieee80211_hw *hw, struct sk_buff *skb); 113f1d2b4d3SLarry Finger 114a75f3eebSPing-Ke Shih u8 rtl_mrate_idx_to_arfr_id(struct ieee80211_hw *hw, u8 rate_index, 115a75f3eebSPing-Ke Shih enum wireless_mode wirelessmode); 116f1d2b4d3SLarry Finger void rtl_get_tcb_desc(struct ieee80211_hw *hw, 117f1d2b4d3SLarry Finger struct ieee80211_tx_info *info, 118f1d2b4d3SLarry Finger struct ieee80211_sta *sta, 119f1d2b4d3SLarry Finger struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc); 120f1d2b4d3SLarry Finger 121f1d2b4d3SLarry Finger int rtl_send_smps_action(struct ieee80211_hw *hw, 122f1d2b4d3SLarry Finger struct ieee80211_sta *sta, 123f1d2b4d3SLarry Finger enum ieee80211_smps_mode smps); 124f1d2b4d3SLarry Finger u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie); 125f1d2b4d3SLarry Finger void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len); 126f1d2b4d3SLarry Finger u8 rtl_tid_to_ac(u8 tid); 127f1d2b4d3SLarry Finger extern struct rtl_global_var rtl_global_var; 128f1d2b4d3SLarry Finger void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation); 129f1d2b4d3SLarry Finger 130f1d2b4d3SLarry Finger #endif 131