rlm.h 12 KB

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