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