0001
0002
0003
0004 #ifndef __RTL_BASE_H__
0005 #define __RTL_BASE_H__
0006
0007 enum ap_peer {
0008 PEER_UNKNOWN = 0,
0009 PEER_RTL = 1,
0010 PEER_RTL_92SE = 2,
0011 PEER_BROAD = 3,
0012 PEER_RAL = 4,
0013 PEER_ATH = 5,
0014 PEER_CISCO = 6,
0015 PEER_MARV = 7,
0016 PEER_AIRGO = 9,
0017 PEER_MAX = 10,
0018 };
0019
0020 #define RTL_DUMMY_OFFSET 0
0021 #define RTL_DUMMY_UNIT 8
0022 #define RTL_TX_DUMMY_SIZE (RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT)
0023 #define RTL_TX_DESC_SIZE 32
0024 #define RTL_TX_HEADER_SIZE (RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE)
0025
0026 #define MAX_BIT_RATE_40MHZ_MCS15 300
0027 #define MAX_BIT_RATE_40MHZ_MCS7 150
0028
0029 #define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS9 867
0030 #define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS7 650
0031 #define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS9 780
0032 #define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS7 585
0033
0034 #define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS9 434
0035 #define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS7 325
0036 #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9 390
0037 #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7 293
0038
0039 #define FRAME_OFFSET_FRAME_CONTROL 0
0040 #define FRAME_OFFSET_DURATION 2
0041 #define FRAME_OFFSET_ADDRESS1 4
0042 #define FRAME_OFFSET_ADDRESS2 10
0043 #define FRAME_OFFSET_ADDRESS3 16
0044 #define FRAME_OFFSET_SEQUENCE 22
0045 #define FRAME_OFFSET_ADDRESS4 24
0046 #define MAX_LISTEN_INTERVAL 10
0047 #define MAX_RATE_TRIES 4
0048
0049 #define SET_80211_PS_POLL_AID(_hdr, _val) \
0050 (*(u16 *)((u8 *)(_hdr) + 2) = _val)
0051 #define SET_80211_PS_POLL_BSSID(_hdr, _val) \
0052 ether_addr_copy(((u8 *)(_hdr)) + 4, (u8 *)(_val))
0053 #define SET_80211_PS_POLL_TA(_hdr, _val) \
0054 ether_addr_copy(((u8 *)(_hdr))+10, (u8 *)(_val))
0055
0056 #define SET_80211_HDR_ADDRESS1(_hdr, _val) \
0057 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val))
0058 #define SET_80211_HDR_ADDRESS2(_hdr, _val) \
0059 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val))
0060 #define SET_80211_HDR_ADDRESS3(_hdr, _val) \
0061 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val))
0062
0063 #define SET_TX_DESC_SPE_RPT(__pdesc, __val) \
0064 le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(19))
0065 #define SET_TX_DESC_SW_DEFINE(__pdesc, __val) \
0066 le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(11, 0))
0067
0068 int rtl_init_core(struct ieee80211_hw *hw);
0069 void rtl_deinit_core(struct ieee80211_hw *hw);
0070 void rtl_init_rx_config(struct ieee80211_hw *hw);
0071 void rtl_init_rfkill(struct ieee80211_hw *hw);
0072 void rtl_deinit_rfkill(struct ieee80211_hw *hw);
0073
0074 void rtl_watch_dog_timer_callback(struct timer_list *t);
0075 void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq);
0076
0077 bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
0078 int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht,
0079 bool isvht, u8 desc_rate);
0080 bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
0081 u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
0082 bool is_enc);
0083
0084 void rtl_tx_ackqueue(struct ieee80211_hw *hw, struct sk_buff *skb);
0085 bool rtl_is_tx_report_skb(struct ieee80211_hw *hw, struct sk_buff *skb);
0086 void rtl_set_tx_report(struct rtl_tcb_desc *ptcb_desc, u8 *pdesc,
0087 struct ieee80211_hw *hw, struct rtlwifi_tx_info *info);
0088 void rtl_tx_report_handler(struct ieee80211_hw *hw, u8 *tmp_buf,
0089 u8 c2h_cmd_len);
0090 bool rtl_check_tx_report_acked(struct ieee80211_hw *hw);
0091 void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms);
0092 u32 rtl_get_hal_edca_param(struct ieee80211_hw *hw,
0093 struct ieee80211_vif *vif,
0094 enum wireless_mode wirelessmode,
0095 struct ieee80211_tx_queue_params *param);
0096
0097 void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
0098 void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb);
0099 void rtl_scan_list_expire(struct ieee80211_hw *hw);
0100 int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
0101 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
0102 int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
0103 struct ieee80211_sta *sta, u16 tid);
0104 int rtl_tx_agg_oper(struct ieee80211_hw *hw,
0105 struct ieee80211_sta *sta, u16 tid);
0106 int rtl_rx_agg_start(struct ieee80211_hw *hw,
0107 struct ieee80211_sta *sta, u16 tid);
0108 int rtl_rx_agg_stop(struct ieee80211_hw *hw,
0109 struct ieee80211_sta *sta, u16 tid);
0110 void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv);
0111 void rtl_c2hcmd_launcher(struct ieee80211_hw *hw, int exec);
0112 void rtl_c2hcmd_enqueue(struct ieee80211_hw *hw, struct sk_buff *skb);
0113
0114 u8 rtl_mrate_idx_to_arfr_id(struct ieee80211_hw *hw, u8 rate_index,
0115 enum wireless_mode wirelessmode);
0116 void rtl_get_tcb_desc(struct ieee80211_hw *hw,
0117 struct ieee80211_tx_info *info,
0118 struct ieee80211_sta *sta,
0119 struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc);
0120
0121 int rtl_send_smps_action(struct ieee80211_hw *hw,
0122 struct ieee80211_sta *sta,
0123 enum ieee80211_smps_mode smps);
0124 u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie);
0125 void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len);
0126 u8 rtl_tid_to_ac(u8 tid);
0127 void rtl_easy_concurrent_retrytimer_callback(struct timer_list *t);
0128 extern struct rtl_global_var rtl_global_var;
0129 void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation);
0130
0131 #endif