import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / connectivity / combo / drv_wlan / mt6620 / wlan / include / mgmt / rlm.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rlm.h#2 $
3 */
4
5 /*! \file "rlm.h"
6 \brief
7 */
8
9
10
11 /*
12 ** $Log: rlm.h $
13 *
14 * 07 17 2012 yuche.tsai
15 * NULL
16 * Compile no error before trial run.
17 *
18 * 09 30 2011 cm.chang
19 * [WCXRP00001020] [MT6620 Wi-Fi][Driver] Handle secondary channel offset of AP in 5GHz band
20 * .
21 *
22 * 04 12 2011 cm.chang
23 * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency
24 * .
25 *
26 * 01 13 2011 cm.chang
27 * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module
28 * Refine function when rcv a 20/40M public action frame
29 *
30 * 01 13 2011 cm.chang
31 * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting
32 * Use SCO of BSS_INFO to replace user-defined setting variables
33 *
34 * 01 12 2011 cm.chang
35 * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting
36 * User-defined bandwidth is for 2.4G and 5G individually
37 *
38 * 12 07 2010 cm.chang
39 * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
40 * 1. BSSINFO include RLM parameter
41 * 2. free all sta records when network is disconnected
42 *
43 * 12 07 2010 cm.chang
44 * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant
45 * 1. Country code is from NVRAM or supplicant
46 * 2. Change band definition in CMD/EVENT.
47 *
48 * 10 18 2010 cm.chang
49 * [WCXRP00000114] [MT6620 Wi-Fi] [Driver] Fix compiling warning in Linux about RLM network index checking
50 * Enum member cannot be used as compiling option decision in Linux
51 *
52 * 09 10 2010 cm.chang
53 * NULL
54 * Always update Beacon content if FW sync OBSS info
55 *
56 * 08 31 2010 kevin.huang
57 * NULL
58 * Use LINK LIST operation to process SCAN result
59 *
60 * 08 24 2010 cm.chang
61 * NULL
62 * Support RLM initail channel of Ad-hoc, P2P and BOW
63 *
64 * 08 23 2010 chinghwa.yu
65 * NULL
66 * Update for BOW.
67 *
68 * 08 20 2010 cm.chang
69 * NULL
70 * Migrate RLM code to host from FW
71 *
72 * 08 16 2010 cp.wu
73 * NULL
74 * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI.
75 * There is no CFG_SUPPORT_BOW in driver domain source.
76 *
77 * 08 02 2010 yuche.tsai
78 * NULL
79 * P2P Group Negotiation Code Check in.
80 *
81 * 07 08 2010 cp.wu
82 *
83 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
84 *
85 * 07 08 2010 cm.chang
86 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
87 * Check draft RLM code for HT cap
88 *
89 * 06 28 2010 cm.chang
90 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
91 * 1st draft code for RLM module
92 *
93 * 06 02 2010 cm.chang
94 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
95 * Add RX HT GF compiling option
96 *
97 * 06 02 2010 chinghwa.yu
98 * [BORA00000563]Add WiFi CoEx BCM module
99 * Roll back to remove CFG_SUPPORT_BCM_TEST.
100 *
101 * 06 01 2010 chinghwa.yu
102 * [BORA00000563]Add WiFi CoEx BCM module
103 * Update BCM Test and RW configuration.
104 *
105 * 05 31 2010 cm.chang
106 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
107 * Add some compiling options to control 11n functions
108 *
109 * 05 18 2010 cm.chang
110 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
111 * Ad-hoc Beacon should not carry HT OP and OBSS IEs
112 *
113 * 05 17 2010 cm.chang
114 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
115 * MT6620 does not support L-SIG TXOP
116 *
117 * 05 05 2010 cm.chang
118 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
119 * First draft support for 20/40M bandwidth for AP mode
120 *
121 * 04 24 2010 cm.chang
122 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
123 * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW
124 *
125 * 04 22 2010 cm.chang
126 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
127 * First draft code to support protection in AP mode
128 *
129 * 04 07 2010 cm.chang
130 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
131 * Different invoking order for WTBL entry of associated AP
132 *
133 * 03 24 2010 cm.chang
134 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
135 * Not carry HT cap when being associated with b/g only AP
136 *
137 * 03 03 2010 cm.chang
138 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
139 * Move default value of HT capability to rlm.h
140 *
141 * 02 12 2010 cm.chang
142 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
143 * Use bss info array for concurrent handle
144 *
145 * 01 22 2010 cm.chang
146 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
147 * Support protection and bandwidth switch
148 *
149 * 01 08 2010 kevin.huang
150 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
151 *
152 * Modify the prototype of rlmRecAssocRspHtInfo()
153 *
154 * Dec 9 2009 mtk01104
155 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
156 * Add several function prototypes for HT operation
157 *
158 * Nov 18 2009 mtk01104
159 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
160 *
161 *
162 **
163 */
164
165 #ifndef _RLM_H
166 #define _RLM_H
167
168 /*******************************************************************************
169 * C O M P I L E R F L A G S
170 ********************************************************************************
171 */
172
173 /*******************************************************************************
174 * E X T E R N A L R E F E R E N C E S
175 ********************************************************************************
176 */
177
178 /*******************************************************************************
179 * C O N S T A N T S
180 ********************************************************************************
181 */
182 #define ELEM_EXT_CAP_DEFAULT_VAL \
183 (ELEM_EXT_CAP_20_40_COEXIST_SUPPORT /*| ELEM_EXT_CAP_PSMP_CAP*/)
184
185
186 #if CFG_SUPPORT_RX_STBC
187 #define FIELD_HT_CAP_INFO_RX_STBC HT_CAP_INFO_RX_STBC_1_SS
188 #else
189 #define FIELD_HT_CAP_INFO_RX_STBC HT_CAP_INFO_RX_STBC_NO_SUPPORTED
190 #endif
191
192 #if CFG_SUPPORT_RX_SGI
193 #define FIELD_HT_CAP_INFO_SGI_20M HT_CAP_INFO_SHORT_GI_20M
194 #define FIELD_HT_CAP_INFO_SGI_40M HT_CAP_INFO_SHORT_GI_40M
195 #else
196 #define FIELD_HT_CAP_INFO_SGI_20M 0
197 #define FIELD_HT_CAP_INFO_SGI_40M 0
198 #endif
199
200 #if CFG_SUPPORT_RX_HT_GF
201 #define FIELD_HT_CAP_INFO_HT_GF HT_CAP_INFO_HT_GF
202 #else
203 #define FIELD_HT_CAP_INFO_HT_GF 0
204 #endif
205
206 #define HT_CAP_INFO_DEFAULT_VAL \
207 (HT_CAP_INFO_SUP_CHNL_WIDTH | FIELD_HT_CAP_INFO_HT_GF | \
208 FIELD_HT_CAP_INFO_SGI_20M | FIELD_HT_CAP_INFO_SGI_40M | \
209 FIELD_HT_CAP_INFO_RX_STBC | HT_CAP_INFO_DSSS_CCK_IN_40M)
210
211
212
213 #define AMPDU_PARAM_DEFAULT_VAL \
214 (AMPDU_PARAM_MAX_AMPDU_LEN_64K | AMPDU_PARAM_MSS_NO_RESTRICIT)
215
216
217 #define SUP_MCS_TX_DEFAULT_VAL \
218 SUP_MCS_TX_SET_DEFINED /* TX defined and TX/RX equal (TBD) */
219
220 #if CFG_SUPPORT_MFB
221 #define FIELD_HT_EXT_CAP_MFB HT_EXT_CAP_MCS_FEEDBACK_BOTH
222 #else
223 #define FIELD_HT_EXT_CAP_MFB HT_EXT_CAP_MCS_FEEDBACK_NO_FB
224 #endif
225
226 #if CFG_SUPPORT_RX_RDG
227 #define FIELD_HT_EXT_CAP_RDR HT_EXT_CAP_RD_RESPONDER
228 #else
229 #define FIELD_HT_EXT_CAP_RDR 0
230 #endif
231
232 #if CFG_SUPPORT_MFB || CFG_SUPPORT_RX_RDG
233 #define FIELD_HT_EXT_CAP_HTC HT_EXT_CAP_HTC_SUPPORT
234 #else
235 #define FIELD_HT_EXT_CAP_HTC 0
236 #endif
237
238 #define HT_EXT_CAP_DEFAULT_VAL \
239 (HT_EXT_CAP_PCO | HT_EXT_CAP_PCO_TRANS_TIME_NONE | \
240 FIELD_HT_EXT_CAP_MFB | FIELD_HT_EXT_CAP_HTC | \
241 FIELD_HT_EXT_CAP_RDR)
242
243 #define TX_BEAMFORMING_CAP_DEFAULT_VAL 0
244 #define ASEL_CAP_DEFAULT_VAL 0
245
246
247 /* Define bandwidth from user setting */
248 #define CONFIG_BW_20_40M 0
249 #define CONFIG_BW_20M 1 /* 20MHz only */
250
251 /*******************************************************************************
252 * D A T A T Y P E S
253 ********************************************************************************
254 */
255
256 /*******************************************************************************
257 * P U B L I C D A T A
258 ********************************************************************************
259 */
260
261 /*******************************************************************************
262 * P R I V A T E D A T A
263 ********************************************************************************
264 */
265
266 /*******************************************************************************
267 * M A C R O S
268 ********************************************************************************
269 */
270
271 /* It is used for RLM module to judge if specific network is valid
272 * Note: Ad-hoc mode of AIS is not included now. (TBD)
273 */
274 #define RLM_NET_PARAM_VALID(_prBssInfo) \
275 (IS_BSS_ACTIVE(_prBssInfo) && \
276 ((_prBssInfo)->eConnectionState == PARAM_MEDIA_STATE_CONNECTED || \
277 (_prBssInfo)->eCurrentOPMode == OP_MODE_ACCESS_POINT || \
278 (_prBssInfo)->eCurrentOPMode == OP_MODE_IBSS || \
279 RLM_NET_IS_BOW(_prBssInfo)) \
280 )
281
282 #define RLM_NET_IS_11N(_prBssInfo) \
283 ((_prBssInfo)->ucPhyTypeSet & PHY_TYPE_SET_802_11N)
284 #define RLM_NET_IS_11GN(_prBssInfo) \
285 ((_prBssInfo)->ucPhyTypeSet & PHY_TYPE_SET_802_11GN)
286
287
288 /* This macro is used to sweep all 3 networks */
289 #define RLM_NET_FOR_EACH(_ucNetIdx) \
290 for ((_ucNetIdx) = 0; \
291 (_ucNetIdx) < NETWORK_TYPE_INDEX_NUM; \
292 (_ucNetIdx)++)
293
294 /* This macro is used to sweep all networks excluding BOW */
295 #if CFG_ENABLE_BT_OVER_WIFI
296 /* Note: value of enum NETWORK_TYPE_BOW_INDEX is validated in
297 * rlmStuctureCheck().
298 */
299 #define RLM_NET_FOR_EACH_NO_BOW(_ucNetIdx) \
300 for ((_ucNetIdx) = 0; \
301 (_ucNetIdx) < NETWORK_TYPE_BOW_INDEX; \
302 (_ucNetIdx)++)
303
304 #define RLM_NET_IS_BOW(_prBssInfo) \
305 ((_prBssInfo)->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX)
306
307 #else
308 #define RLM_NET_FOR_EACH_NO_BOW(_ucNetIdx) RLM_NET_FOR_EACH(_ucNetIdx)
309 #define RLM_NET_IS_BOW(_prBssInfo) (FALSE)
310
311 #endif /* end of CFG_ENABLE_BT_OVER_WIFI */
312
313
314 /* The bandwidth modes are not used anymore. They represent if AP
315 * can use 20/40 bandwidth, not all modes. (20110411)
316 */
317 #define RLM_AP_IS_BW_40_ALLOWED(_prAdapter, _prBssInfo) \
318 (((_prBssInfo)->eBand == BAND_2G4 && \
319 (_prAdapter)->rWifiVar.rConnSettings.uc2G4BandwidthMode \
320 == CONFIG_BW_20_40M) || \
321 ((_prBssInfo)->eBand == BAND_5G && \
322 (_prAdapter)->rWifiVar.rConnSettings.uc5GBandwidthMode \
323 == CONFIG_BW_20_40M))
324
325 /*******************************************************************************
326 * F U N C T I O N D E C L A R A T I O N S
327 ********************************************************************************
328 */
329 VOID rlmFsmEventInit(P_ADAPTER_T prAdapter);
330
331 VOID rlmFsmEventUninit(P_ADAPTER_T prAdapter);
332
333 VOID rlmReqGenerateHtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
334
335 VOID rlmReqGenerateExtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
336
337 VOID rlmRspGenerateHtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
338
339 VOID rlmRspGenerateExtCapIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
340
341 VOID rlmRspGenerateHtOpIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
342
343 VOID rlmRspGenerateErpIE(P_ADAPTER_T prAdapter, P_MSDU_INFO_T prMsduInfo);
344
345 VOID rlmProcessBcn(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb, PUINT_8 pucIE, UINT_16 u2IELength);
346
347 VOID
348 rlmProcessAssocRsp(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb, PUINT_8 pucIE, UINT_16 u2IELength);
349
350 VOID rlmFillSyncCmdParam(P_CMD_SET_BSS_RLM_PARAM_T prCmdBody, P_BSS_INFO_T prBssInfo);
351
352 VOID rlmSyncOperationParams(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo);
353
354 VOID rlmBssInitForAPandIbss(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo);
355
356 VOID
357 rlmProcessAssocReq(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb, PUINT_8 pucIE, UINT_16 u2IELength);
358
359 VOID rlmBssAborted(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo);
360
361
362 /*******************************************************************************
363 * F U N C T I O N S
364 ********************************************************************************
365 */
366
367 #ifndef _lint
368 __KAL_INLINE__ VOID rlmDataTypeCheck(VOID)
369 {
370 #if CFG_ENABLE_BT_OVER_WIFI
371 DATA_STRUC_INSPECTING_ASSERT(NETWORK_TYPE_AIS_INDEX < NETWORK_TYPE_BOW_INDEX);
372
373 #if CFG_ENABLE_WIFI_DIRECT
374 DATA_STRUC_INSPECTING_ASSERT(NETWORK_TYPE_P2P_INDEX < NETWORK_TYPE_BOW_INDEX);
375 #endif
376 #endif
377
378 return;
379 }
380 #endif /* _lint */
381
382 #endif /* _RLM_H */