2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rlm.h#2 $
14 ** 07 12 2013 terry.wu
15 ** [BORA00002207] [MT6630 Wi-Fi] TXM & MQM Implementation
16 ** 1. Update VHT IE composing function
18 ** 3. Exchange bss/sta rec update sequence for temp solution
20 ** 01 17 2013 cm.chang
21 ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
22 ** Use ucBssIndex to replace eNetworkTypeIndex
24 ** 11 06 2012 eason.tsai
25 ** [BORA00002255] [MT6630 Wi-Fi][Driver] develop
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)
33 * 07 17 2012 yuche.tsai
35 * Compile no error before trial run.
38 * [WCXRP00001020] [MT6620 Wi-Fi][Driver] Handle secondary channel offset of AP in 5GHz band
42 * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency
46 * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module
47 * Refine function when rcv a 20/40M public action frame
50 * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting
51 * Use SCO of BSS_INFO to replace user-defined setting variables
54 * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting
55 * User-defined bandwidth is for 2.4G and 5G individually
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
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.
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
73 * Always update Beacon content if FW sync OBSS info
75 * 08 31 2010 kevin.huang
77 * Use LINK LIST operation to process SCAN result
81 * Support RLM initail channel of Ad-hoc, P2P and BOW
83 * 08 23 2010 chinghwa.yu
89 * Migrate RLM code to host from FW
93 * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI.
94 * There is no CFG_SUPPORT_BOW in driver domain source.
96 * 08 02 2010 yuche.tsai
98 * P2P Group Negotiation Code Check in.
102 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
104 * 07 08 2010 cm.chang
105 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
106 * Check draft RLM code for HT cap
108 * 06 28 2010 cm.chang
109 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
110 * 1st draft code for RLM module
112 * 06 02 2010 cm.chang
113 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
114 * Add RX HT GF compiling option
116 * 06 02 2010 chinghwa.yu
117 * [BORA00000563]Add WiFi CoEx BCM module
118 * Roll back to remove CFG_SUPPORT_BCM_TEST.
120 * 06 01 2010 chinghwa.yu
121 * [BORA00000563]Add WiFi CoEx BCM module
122 * Update BCM Test and RW configuration.
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
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
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
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
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
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
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
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
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
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
164 * 01 22 2010 cm.chang
165 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
166 * Support protection and bandwidth switch
168 * 01 08 2010 kevin.huang
169 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
171 * Modify the prototype of rlmRecAssocRspHtInfo()
173 * Dec 9 2009 mtk01104
174 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
175 * Add several function prototypes for HT operation
177 * Nov 18 2009 mtk01104
178 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
187 /*******************************************************************************
188 * C O M P I L E R F L A G S
189 ********************************************************************************
192 /*******************************************************************************
193 * E X T E R N A L R E F E R E N C E S
194 ********************************************************************************
197 extern BOOLEAN g_bIcapEnable
;
198 extern BOOLEAN g_bCaptureDone
;
199 extern UINT_16 g_u2DumpIndex
;
201 /*******************************************************************************
203 ********************************************************************************
205 #define ELEM_EXT_CAP_DEFAULT_VAL \
206 (ELEM_EXT_CAP_20_40_COEXIST_SUPPORT /*| ELEM_EXT_CAP_PSMP_CAP*/)
209 #if CFG_SUPPORT_RX_STBC
210 #define FIELD_HT_CAP_INFO_RX_STBC HT_CAP_INFO_RX_STBC_1_SS
212 #define FIELD_HT_CAP_INFO_RX_STBC HT_CAP_INFO_RX_STBC_NO_SUPPORTED
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
219 #define FIELD_HT_CAP_INFO_SGI_20M 0
220 #define FIELD_HT_CAP_INFO_SGI_40M 0
223 #if CFG_SUPPORT_RX_HT_GF
224 #define FIELD_HT_CAP_INFO_HT_GF HT_CAP_INFO_HT_GF
226 #define FIELD_HT_CAP_INFO_HT_GF 0
229 #define HT_CAP_INFO_DEFAULT_VAL \
230 (HT_CAP_INFO_SUP_CHNL_WIDTH | HT_CAP_INFO_DSSS_CCK_IN_40M)
233 #define AMPDU_PARAM_DEFAULT_VAL \
234 (AMPDU_PARAM_MAX_AMPDU_LEN_64K | AMPDU_PARAM_MSS_NO_RESTRICIT)
237 #define SUP_MCS_TX_DEFAULT_VAL \
238 SUP_MCS_TX_SET_DEFINED /* TX defined and TX/RX equal (TBD) */
241 #define FIELD_HT_EXT_CAP_MFB HT_EXT_CAP_MCS_FEEDBACK_BOTH
243 #define FIELD_HT_EXT_CAP_MFB HT_EXT_CAP_MCS_FEEDBACK_NO_FB
246 #if CFG_SUPPORT_RX_RDG
247 #define FIELD_HT_EXT_CAP_RDR HT_EXT_CAP_RD_RESPONDER
249 #define FIELD_HT_EXT_CAP_RDR 0
252 #if CFG_SUPPORT_MFB || CFG_SUPPORT_RX_RDG
253 #define FIELD_HT_EXT_CAP_HTC HT_EXT_CAP_HTC_SUPPORT
255 #define FIELD_HT_EXT_CAP_HTC 0
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)
263 #define TX_BEAMFORMING_CAP_DEFAULT_VAL 0
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)
273 #define TX_BEAMFORMING_CAP_BFEE 0
276 #define ASEL_CAP_DEFAULT_VAL 0
279 /* Define bandwidth from user setting */
280 #define CONFIG_BW_20_40M 0
281 #define CONFIG_BW_20M 1 /* 20MHz only */
283 #if CFG_SUPPORT_802_11AC
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)
290 #define FIELD_VHT_CAP_INFO_BF 0
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))
297 #define VHT_CAP_INFO_DEFAULT_HIGHEST_DATA_RATE 0
299 /*******************************************************************************
301 ********************************************************************************
304 /*******************************************************************************
305 * P U B L I C D A T A
306 ********************************************************************************
309 /*******************************************************************************
310 * P R I V A T E D A T A
311 ********************************************************************************
314 /*******************************************************************************
316 ********************************************************************************
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)
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)) \
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)
335 #if CFG_SUPPORT_802_11AC
336 #define RLM_NET_IS_11AC(_prBssInfo) \
337 ((_prBssInfo)->ucPhyTypeSet & PHY_TYPE_SET_802_11AC)
341 /* The bandwidth modes are not used anymore. They represent if AP
342 * can use 20/40 bandwidth, not all modes. (20110411)
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))
352 /*******************************************************************************
353 * F U N C T I O N D E C L A R A T I O N S
354 ********************************************************************************
356 VOID
rlmFsmEventInit(P_ADAPTER_T prAdapter
);
358 VOID
rlmFsmEventUninit(P_ADAPTER_T prAdapter
);
360 VOID
rlmReqGenerateHtCapIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
362 VOID
rlmReqGenerateExtCapIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
364 VOID
rlmRspGenerateHtCapIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
366 VOID
rlmRspGenerateExtCapIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
368 VOID
rlmRspGenerateHtOpIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
370 VOID
rlmRspGenerateErpIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
372 VOID
rlmGenerateMTKOuiIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
374 BOOLEAN
rlmParseCheckMTKOuiIE(IN P_ADAPTER_T prAdapter
, IN PUINT_8 pucBuf
, IN PUINT_32 pu4Cap
);
376 VOID
rlmProcessBcn(P_ADAPTER_T prAdapter
, P_SW_RFB_T prSwRfb
, PUINT_8 pucIE
, UINT_16 u2IELength
);
379 rlmProcessAssocRsp(P_ADAPTER_T prAdapter
, P_SW_RFB_T prSwRfb
, PUINT_8 pucIE
, UINT_16 u2IELength
);
381 VOID
rlmFillSyncCmdParam(P_CMD_SET_BSS_RLM_PARAM_T prCmdBody
, P_BSS_INFO_T prBssInfo
);
383 VOID
rlmSyncOperationParams(P_ADAPTER_T prAdapter
, P_BSS_INFO_T prBssInfo
);
385 VOID
rlmBssInitForAPandIbss(P_ADAPTER_T prAdapter
, P_BSS_INFO_T prBssInfo
);
388 rlmProcessAssocReq(P_ADAPTER_T prAdapter
, P_SW_RFB_T prSwRfb
, PUINT_8 pucIE
, UINT_16 u2IELength
);
390 VOID
rlmBssAborted(P_ADAPTER_T prAdapter
, P_BSS_INFO_T prBssInfo
);
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
);
401 UINT_32
rlmFillHtCapIEByAdapter(P_ADAPTER_T prAdapter
, P_BSS_INFO_T prBssInfo
, UINT_8
*pOutBuf
);
404 UINT_32
rlmFillVhtCapIEByAdapter(P_ADAPTER_T prAdapter
, P_BSS_INFO_T prBssInfo
, UINT_8
*pOutBuf
);
410 #if CFG_SUPPORT_802_11AC
411 VOID
rlmReqGenerateVhtCapIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
413 VOID
rlmRspGenerateVhtCapIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
415 VOID
rlmRspGenerateVhtOpIE(P_ADAPTER_T prAdapter
, P_MSDU_INFO_T prMsduInfo
);
417 VOID
rlmFillVhtOpIE(P_ADAPTER_T prAdapter
, P_BSS_INFO_T prBssInfo
, P_MSDU_INFO_T prMsduInfo
);
422 rlmProcessSpecMgtAction(
423 P_ADAPTER_T prAdapter
,
428 rlmSendOpModeNotificationFrame(
429 P_ADAPTER_T prAdapter
,
430 P_STA_RECORD_T prStaRec
,
431 UINT_8 ucChannelWidth
,
437 /*******************************************************************************
439 ********************************************************************************
443 static __KAL_INLINE__ VOID
rlmDataTypeCheck(VOID
)