1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef __RTL_BASE_H__
27#define __RTL_BASE_H__
28
29enum ap_peer {
30 PEER_UNKNOWN = 0,
31 PEER_RTL = 1,
32 PEER_RTL_92SE = 2,
33 PEER_BROAD = 3,
34 PEER_RAL = 4,
35 PEER_ATH = 5,
36 PEER_CISCO = 6,
37 PEER_MARV = 7,
38 PEER_AIRGO = 9,
39 PEER_MAX = 10,
40};
41
42#define RTL_DUMMY_OFFSET 0
43#define RTL_DUMMY_UNIT 8
44#define RTL_TX_DUMMY_SIZE (RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT)
45#define RTL_TX_DESC_SIZE 32
46#define RTL_TX_HEADER_SIZE (RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE)
47
48#define HT_AMSDU_SIZE_4K 3839
49#define HT_AMSDU_SIZE_8K 7935
50
51#define MAX_BIT_RATE_40MHZ_MCS15 300
52#define MAX_BIT_RATE_40MHZ_MCS7 150
53
54#define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS9 867
55#define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS7 650
56#define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS9 780
57#define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS7 585
58
59#define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS9 434
60#define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS7 325
61#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9 390
62#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7 293
63
64#define RTL_RATE_COUNT_LEGACY 12
65#define RTL_CHANNEL_COUNT 14
66
67#define FRAME_OFFSET_FRAME_CONTROL 0
68#define FRAME_OFFSET_DURATION 2
69#define FRAME_OFFSET_ADDRESS1 4
70#define FRAME_OFFSET_ADDRESS2 10
71#define FRAME_OFFSET_ADDRESS3 16
72#define FRAME_OFFSET_SEQUENCE 22
73#define FRAME_OFFSET_ADDRESS4 24
74
75#define SET_80211_HDR_FRAME_CONTROL(_hdr, _val) \
76 WRITEEF2BYTE(_hdr, _val)
77#define SET_80211_HDR_TYPE_AND_SUBTYPE(_hdr, _val) \
78 WRITEEF1BYTE(_hdr, _val)
79#define SET_80211_HDR_PWR_MGNT(_hdr, _val) \
80 SET_BITS_TO_LE_2BYTE(_hdr, 12, 1, _val)
81#define SET_80211_HDR_TO_DS(_hdr, _val) \
82 SET_BITS_TO_LE_2BYTE(_hdr, 8, 1, _val)
83
84#define SET_80211_PS_POLL_AID(_hdr, _val) \
85 (*(u16 *)((u8 *)(_hdr) + 2) = _val)
86#define SET_80211_PS_POLL_BSSID(_hdr, _val) \
87 ether_addr_copy(((u8 *)(_hdr)) + 4, (u8 *)(_val))
88#define SET_80211_PS_POLL_TA(_hdr, _val) \
89 ether_addr_copy(((u8 *)(_hdr))+10, (u8 *)(_val))
90
91#define SET_80211_HDR_DURATION(_hdr, _val) \
92 (*(u16 *)((u8 *)(_hdr) + FRAME_OFFSET_DURATION) = le16_to_cpu(_val))
93#define SET_80211_HDR_ADDRESS1(_hdr, _val) \
94 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val))
95#define SET_80211_HDR_ADDRESS2(_hdr, _val) \
96 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val))
97#define SET_80211_HDR_ADDRESS3(_hdr, _val) \
98 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val))
99#define SET_80211_HDR_FRAGMENT_SEQUENCE(_hdr, _val) \
100 WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_SEQUENCE, _val)
101
102#define SET_BEACON_PROBE_RSP_TIME_STAMP_LOW(__phdr, __val) \
103 WRITEEF4BYTE(((u8 *)(__phdr)) + 24, __val)
104#define SET_BEACON_PROBE_RSP_TIME_STAMP_HIGH(__phdr, __val) \
105 WRITEEF4BYTE(((u8 *)(__phdr)) + 28, __val)
106#define SET_BEACON_PROBE_RSP_BEACON_INTERVAL(__phdr, __val) \
107 WRITEEF2BYTE(((u8 *)(__phdr)) + 32, __val)
108#define GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) \
109 READEF2BYTE(((u8 *)(__phdr)) + 34)
110#define SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \
111 WRITEEF2BYTE(((u8 *)(__phdr)) + 34, __val)
112#define MASK_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \
113 SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, \
114 (GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) & (~(__val))))
115
116int rtl_init_core(struct ieee80211_hw *hw);
117void rtl_deinit_core(struct ieee80211_hw *hw);
118void rtl_init_rx_config(struct ieee80211_hw *hw);
119void rtl_init_rfkill(struct ieee80211_hw *hw);
120void rtl_deinit_rfkill(struct ieee80211_hw *hw);
121
122void rtl_watch_dog_timer_callback(unsigned long data);
123void rtl_deinit_deferred_work(struct ieee80211_hw *hw);
124
125bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
126int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
127 bool isht, u8 desc_rate, bool first_ampdu);
128bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
129u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
130
131void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
132void rtl_watch_dog_timer_callback(unsigned long data);
133int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
134 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
135int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
136 struct ieee80211_sta *sta, u16 tid);
137int rtl_tx_agg_oper(struct ieee80211_hw *hw,
138 struct ieee80211_sta *sta, u16 tid);
139int rtl_rx_agg_start(struct ieee80211_hw *hw,
140 struct ieee80211_sta *sta, u16 tid);
141int rtl_rx_agg_stop(struct ieee80211_hw *hw,
142 struct ieee80211_sta *sta, u16 tid);
143void rtl_watchdog_wq_callback(void *data);
144void rtl_fwevt_wq_callback(void *data);
145
146void rtl_get_tcb_desc(struct ieee80211_hw *hw,
147 struct ieee80211_tx_info *info,
148 struct ieee80211_sta *sta,
149 struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc);
150
151int rtl_send_smps_action(struct ieee80211_hw *hw,
152 struct ieee80211_sta *sta,
153 enum ieee80211_smps_mode smps);
154u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie);
155void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len);
156u8 rtl_tid_to_ac(u8 tid);
157extern struct attribute_group rtl_attribute_group;
158void rtl_easy_concurrent_retrytimer_callback(unsigned long data);
159extern struct rtl_global_var rtl_global_var;
160void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation);
161
162#endif
163