8723BU: Update 8723BU wifi driver to version v4.3.16_14189.20150519_BTCOEX2015119...
authorXu Xuehui <xxh@rock-chips.com>
Mon, 19 Oct 2015 03:08:20 +0000 (11:08 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Tue, 20 Oct 2015 03:09:25 +0000 (11:09 +0800)
This driver is released by RealTek, main update as shown below:

1.  Support Android 5.0,5.1 and older
2.  Support Linux kernel 3.19.3 and older
3.  Improve Wi-Fi/BT Coexistence stability and performance
4.  Fix the problem of unexpected scan timeout
5.  Add TDLS function
6.  Fix STA mode disconnect problem caused by not checking TA of DEAUTH and DISASSOC frame
7.  Fix the failed association issue with specific AP which supports only 11n MCS data rate

Change-Id: I103d22a06eecc456c9777f17afdd1049efe9ff6a
Signed-off-by: Xu Xuehui <xxh@rock-chips.com>
234 files changed:
drivers/net/wireless/rockchip_wlan/rtl8723bu/Makefile
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/efuse/rtw_efuse.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ap.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_beamforming.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_bt_mp.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_btcoex.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_cmd.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_debug.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ieee80211.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ioctl_rtl.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ioctl_set.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_mem.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_mlme.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_mlme_ext.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_mp.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_mp_ioctl.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_odm.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_p2p.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_pwrctrl.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_recv.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_security.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_sreset.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_sta_mgt.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_tdls.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_vht.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_wlan_util.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_xmit.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8812a2Ant.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8821a1Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8821a2Ant.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/HalBtcOutSrc.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC-BTCoexist/Mp_Precomp.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/HalHWImg.h [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/HalPhyRf.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/HalPhyRf.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/PhyDM_Adaptivity.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/PhyDM_Adaptivity.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/RtChnlPlan.c [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/RtChnlPlan.h [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_AntDiv.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_AntDiv.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_CfoTracking.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_CfoTracking.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_DIG.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_DIG.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_DynamicBBPowerSaving.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_DynamicBBPowerSaving.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_DynamicTxPower.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_DynamicTxPower.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_EdcaTurboCheck.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_EdcaTurboCheck.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_HWConfig.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_HWConfig.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_NoiseMonitor.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_NoiseMonitor.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_PathDiv.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_PathDiv.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_RaInfo.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_RaInfo.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_RegDefine11AC.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_RegDefine11N.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_debug.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_debug.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_interface.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_interface.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_precomp.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_reg.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/odm_types.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_ACS.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_AntDect.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_AntDect.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_AntDiv.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_AntDiv.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_CfoTracking.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_CfoTracking.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_DIG.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_DIG.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_DynamicBBPowerSaving.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_DynamicTxPower.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_DynamicTxPower.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_EdcaTurboCheck.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_EdcaTurboCheck.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_HWConfig.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_HWConfig.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_PathDiv.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_PathDiv.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_PowerTracking.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_PowerTracking.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_RXHP.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_RaInfo.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_RaInfo.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_RegDefine11AC.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_RegDefine11N.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_beamforming.c [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_beamforming.h [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_debug.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_debug.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_interface.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_interface.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_pre_define.h [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_precomp.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/phydm_types.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalHWImg8723B_BB.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalHWImg8723B_BB.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalHWImg8723B_FW.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalHWImg8723B_MAC.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalHWImg8723B_MAC.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalHWImg8723B_RF.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalHWImg8723B_RF.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalPhyRf_8723B.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/HalPhyRf_8723B.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/odm_RTL8723B.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/odm_RTL8723B.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/odm_RegConfig8723B.c [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/odm_RegConfig8723B.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/OUTSRC/rtl8723b/phydm_RTL8723B.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/efuse/efuse_mask.h [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/efuse/rtl8723b/HalEfuseMask8723B_PCIE.c [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/efuse/rtl8723b/HalEfuseMask8723B_PCIE.h [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/efuse/rtl8723b/HalEfuseMask8723B_USB.c [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/efuse/rtl8723b/HalEfuseMask8723B_USB.h [new file with mode: 0755]
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/hal_btcoex.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/hal_com.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/hal_com_phycfg.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/hal_dm.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/hal_hci/hal_usb.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/hal_intf.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/led/hal_usb_led.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/rtl8723b_cmd.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/rtl8723b_dm.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/rtl8723b_hal_init.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/rtl8723b_mp.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/rtl8723b_phycfg.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/rtl8723b_rxdesc.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/rtl8723b_sreset.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/usb/rtl8723bu_recv.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/usb/rtl8723bu_xmit.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/usb/usb_halinit.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/usb/usb_ops.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/Hal8192CPhyReg.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/Hal8723BPhyReg.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/HalVerDef.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/autoconf.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/basic_types.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/drv_conf.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/drv_types.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_btcoex.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_com.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_com_h2c.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_com_led.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_com_reg.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_data.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_gspi.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_intf.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_pg.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/hal_sdio.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/ieee80211.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/ioctl_cfg80211.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/osdep_intf.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/osdep_service.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/osdep_service_bsd.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/osdep_service_ce.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/osdep_service_linux.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/osdep_service_xp.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/recv_osdep.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtl8192c_recv.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtl8192c_rf.h [deleted file]
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtl8723b_cmd.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtl8723b_hal.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtl8723b_recv.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtl8723b_rf.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtl8723b_spec.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_android.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_br_ext.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_btcoex.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_cmd.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_debug.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_eeprom.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_efuse.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_ioctl_set.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_mlme.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_mlme_ext.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_mp.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_odm.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_p2p.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_pwrctrl.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_recv.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_rf.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_security.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_tdls.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_version.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_vht.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/rtw_xmit.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/sta_info.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/usb_hal.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/usb_ops.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/wifi.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/include/wlan_bssdef.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/custom_gpio_linux.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/ioctl_cfg80211.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/ioctl_cfg80211.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/ioctl_linux.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/os_intfs.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/recv_linux.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/rtw_android.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/rtw_cfgvendor.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/rtw_proc.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/usb_intf.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/usb_ops_linux.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/linux/wifi_version.h
drivers/net/wireless/rockchip_wlan/rtl8723bu/os_dep/osdep_service.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/platform/platform_ARM_SUNnI_sdio.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/platform/platform_arm_act_sdio.c [new file with mode: 0755]

index fd34453..2aa878d 100755 (executable)
@@ -24,14 +24,12 @@ CONFIG_AUTOCFG_CP = n
 
 ########################## WIFI IC ############################
 CONFIG_MULTIDRV = n
-CONFIG_RTL8192C = n
-CONFIG_RTL8192D = n
-CONFIG_RTL8723A = n
 CONFIG_RTL8188E = n
 CONFIG_RTL8812A = n
 CONFIG_RTL8821A = n
 CONFIG_RTL8192E = n
 CONFIG_RTL8723B = y
+CONFIG_RTL8814A = n
 ######################### Interface ###########################
 CONFIG_USB_HCI = y
 CONFIG_PCI_HCI = n
@@ -44,7 +42,6 @@ CONFIG_USB_AUTOSUSPEND = n
 CONFIG_HW_PWRP_DETECTION = n
 CONFIG_WIFI_TEST = n
 CONFIG_BT_COEXIST = y
-CONFIG_RTL8192CU_REDEFINE_1X1 = n
 CONFIG_INTEL_WIDI = n
 CONFIG_WAPI_SUPPORT = n
 CONFIG_EFUSE_CONFIG_FILE = n
@@ -60,6 +57,7 @@ CONFIG_80211W = n
 CONFIG_REDUCE_TX_CPU_LOADING = n
 CONFIG_BR_EXT = y
 CONFIG_ANTENNA_DIVERSITY = n
+CONFIG_TDLS = n
 ######################## Wake On Lan ##########################
 CONFIG_WOWLAN = n
 CONFIG_GPIO_WAKEUP = n
@@ -105,9 +103,11 @@ CONFIG_PLATFORM_SZEBOOK = n
 CONFIG_PLATFORM_ARM_SUNxI = n
 CONFIG_PLATFORM_ARM_SUN6I = n
 CONFIG_PLATFORM_ARM_SUN7I = n
-CONFIG_PLATFORM_ARM_SUN8I = n
+CONFIG_PLATFORM_ARM_SUN8I_W3P1 = n
+CONFIG_PLATFORM_ARM_SUN8I_W5P1 = n
 CONFIG_PLATFORM_ACTIONS_ATM702X = n
 CONFIG_PLATFORM_ACTIONS_ATV5201 = n
+CONFIG_PLATFORM_ACTIONS_ATM705X = n
 CONFIG_PLATFORM_ARM_RTD299X = n
 CONFIG_PLATFORM_ARM_SPREADTRUM_6820 = n
 CONFIG_PLATFORM_ARM_SPREADTRUM_8810 = n
@@ -115,6 +115,8 @@ CONFIG_PLATFORM_ARM_WMT = n
 CONFIG_PLATFORM_TI_DM365 = n
 CONFIG_PLATFORM_MOZART = n
 CONFIG_PLATFORM_RTK119X = n
+CONFIG_PLATFORM_NOVATEK_NT72668 = n
+CONFIG_PLATFORM_HISILICON = n
 ###############################################################
 
 CONFIG_DRVEXT_MODULE = n
@@ -175,6 +177,7 @@ _HAL_INTFS_FILES := hal/hal_intf.o \
 
 _OUTSRC_FILES := hal/OUTSRC/phydm_debug.o      \
                hal/OUTSRC/phydm_AntDiv.o\
+               hal/OUTSRC/phydm_AntDect.o\
                hal/OUTSRC/phydm_interface.o\
                hal/OUTSRC/phydm_HWConfig.o\
                hal/OUTSRC/phydm.o\
@@ -196,12 +199,8 @@ _PLATFORM_FILES := platform/platform_ops.o
 
 ifeq ($(CONFIG_BT_COEXIST), y)
 EXTRA_CFLAGS += -I$(src)/hal/OUTSRC-BTCoexist
-_OUTSRC_FILES += hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.o \
-                               hal/OUTSRC-BTCoexist/HalBtc8192d2Ant.o \
-                               hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.o \
+_OUTSRC_FILES += hal/OUTSRC-BTCoexist/HalBtc8192e1Ant.o \
                                hal/OUTSRC-BTCoexist/HalBtc8192e2Ant.o \
-                               hal/OUTSRC-BTCoexist/HalBtc8723a1Ant.o \
-                               hal/OUTSRC-BTCoexist/HalBtc8723a2Ant.o \
                                hal/OUTSRC-BTCoexist/HalBtc8723b1Ant.o \
                                hal/OUTSRC-BTCoexist/HalBtc8723b2Ant.o \
                                hal/OUTSRC-BTCoexist/HalBtc8812a1Ant.o \
@@ -211,181 +210,6 @@ _OUTSRC_FILES += hal/OUTSRC-BTCoexist/HalBtc8188c2Ant.o \
                                hal/OUTSRC-BTCoexist/HalBtc8821aCsr2Ant.o
 endif
 
-########### HAL_RTL8192C #################################
-
-ifeq ($(CONFIG_RTL8192C), y)
-RTL871X = rtl8192c
-ifeq ($(CONFIG_USB_HCI), y)
-MODULE_NAME = 8192cu
-endif
-ifeq ($(CONFIG_PCI_HCI), y)
-MODULE_NAME = 8192ce
-endif
-EXTRA_CFLAGS += -DCONFIG_RTL8192C
-
-_HAL_INTFS_FILES += \
-       hal/$(RTL871X)/$(RTL871X)_sreset.o \
-       hal/$(RTL871X)/$(RTL871X)_xmit.o
-
-_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
-                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
-                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
-                       hal/$(RTL871X)/$(RTL871X)_dm.o \
-                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
-                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
-
-_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
-
-
-ifeq ($(CONFIG_MP_INCLUDED), y)
-_HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
-endif
-
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/phydm_RTL8192C.o\
-                                                               hal/OUTSRC/$(RTL871X)/HalDMOutSrc8192C_CE.o
-
-ifeq ($(CONFIG_USB_HCI), y)
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8192CUFWImg_CE.o     \
-                                                               hal/OUTSRC/$(RTL871X)/Hal8192CUPHYImg_CE.o      \
-                                                               hal/OUTSRC/$(RTL871X)/Hal8192CUMACImg_CE.o
-endif
-
-ifeq ($(CONFIG_PCI_HCI), y)
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8192CEFWImg_CE.o     \
-                                                               hal/OUTSRC/$(RTL871X)/Hal8192CEPHYImg_CE.o      \
-                                                               hal/OUTSRC/$(RTL871X)/Hal8192CEMACImg_CE.o
-endif
-
-endif
-
-########### HAL_RTL8192D #################################
-ifeq ($(CONFIG_RTL8192D), y)
-RTL871X = rtl8192d
-ifeq ($(CONFIG_USB_HCI), y)
-MODULE_NAME = 8192du
-endif
-ifeq ($(CONFIG_PCI_HCI), y)
-MODULE_NAME = 8192de
-endif
-EXTRA_CFLAGS += -DCONFIG_RTL8192D
-
-_HAL_INTFS_FILES += \
-       hal/$(RTL871X)/$(RTL871X)_xmit.o
-
-_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
-                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
-                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
-                       hal/$(RTL871X)/$(RTL871X)_dm.o \
-                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
-                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
-
-_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
-
-ifeq ($(CONFIG_MP_INCLUDED), y)
-_HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
-endif
-
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/phydm_RTL8192D.o\
-                                                               hal/OUTSRC/$(RTL871X)/HalDMOutSrc8192D_CE.o
-
-
-ifeq ($(CONFIG_USB_HCI), y)
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8192DUFWImg_CE.o \
-                                                               hal/OUTSRC/$(RTL871X)/Hal8192DUPHYImg_CE.o \
-                                                               hal/OUTSRC/$(RTL871X)/Hal8192DUMACImg_CE.o
-endif
-
-ifeq ($(CONFIG_PCI_HCI), y)
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8192DEFWImg_CE.o \
-                                                               hal/OUTSRC/$(RTL871X)/Hal8192DEPHYImg_CE.o \
-                                                               hal/OUTSRC/$(RTL871X)/Hal8192DEMACImg_CE.o
-endif
-
-endif
-
-########### HAL_RTL8723A #################################
-ifeq ($(CONFIG_RTL8723A), y)
-
-RTL871X = rtl8723a
-ifeq ($(CONFIG_GSPI_HCI), y)
-MODULE_NAME = 8723as
-endif
-ifeq ($(CONFIG_SDIO_HCI), y)
-MODULE_NAME = 8723as
-endif
-ifeq ($(CONFIG_USB_HCI), y)
-MODULE_NAME = 8723au
-endif
-ifeq ($(CONFIG_PCI_HCI), y)
-MODULE_NAME = 8723ae
-endif
-EXTRA_CFLAGS += -DCONFIG_RTL8723A
-
-_HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \
-                               hal/$(RTL871X)/Hal8723PwrSeq.o\
-                               hal/$(RTL871X)/$(RTL871X)_xmit.o \
-                               hal/$(RTL871X)/$(RTL871X)_sreset.o
-
-_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
-                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
-                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
-                       hal/$(RTL871X)/$(RTL871X)_dm.o \
-                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
-                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
-                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
-
-ifeq ($(CONFIG_SDIO_HCI), y)
-_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
-else
-ifeq ($(CONFIG_GSPI_HCI), y)
-_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
-else
-_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
-endif
-endif
-
-ifeq ($(CONFIG_MP_INCLUDED), y)
-_HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
-endif
-
-ifeq ($(CONFIG_GSPI_HCI), y)
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8723SHWImg_CE.o
-endif
-
-ifeq ($(CONFIG_SDIO_HCI), y)
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8723SHWImg_CE.o
-endif
-
-ifeq ($(CONFIG_USB_HCI), y)
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8723UHWImg_CE.o
-endif
-
-ifeq ($(CONFIG_PCI_HCI), y)
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/Hal8723EHWImg_CE.o
-endif
-
-#hal/OUTSRC/$(RTL871X)/HalHWImg8723A_FW.o
-_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8723A_BB.o\
-                                                               hal/OUTSRC/$(RTL871X)/HalHWImg8723A_MAC.o\
-                                                               hal/OUTSRC/$(RTL871X)/HalHWImg8723A_RF.o\
-                                                               hal/OUTSRC/$(RTL871X)/phydm_RegConfig8723A.o
-
-_OUTSRC_FILES += hal/OUTSRC/rtl8192c/HalDMOutSrc8192C_CE.o
-
-
-endif
-
 
 ########### HAL_RTL8188E #################################
 ifeq ($(CONFIG_RTL8188E), y)
@@ -438,6 +262,16 @@ ifeq ($(CONFIG_MP_INCLUDED), y)
 _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
 endif
 
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8188E_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8188E_PCIE.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8188E_SDIO.o
+endif
+
 #hal/OUTSRC/$(RTL871X)/Hal8188EFWImg_CE.o
 _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8188E_MAC.o\
                hal/OUTSRC/$(RTL871X)/HalHWImg8188E_BB.o\
@@ -496,6 +330,13 @@ ifeq ($(CONFIG_MP_INCLUDED), y)
 _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
 endif
 
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8192E_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8192E_PCIE.o
+endif
+
 #hal/OUTSRC/$(RTL871X)/HalHWImg8188E_FW.o
 _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8192E_MAC.o\
                hal/OUTSRC/$(RTL871X)/HalHWImg8192E_BB.o\
@@ -553,6 +394,23 @@ ifeq ($(CONFIG_MP_INCLUDED), y)
 _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
 endif
 
+ifeq ($(CONFIG_RTL8812A), y)
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8812A_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8812A_PCIE.o
+endif
+endif
+ifeq ($(CONFIG_RTL8821A), y)
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8821A_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8821A_PCIE.o
+endif
+endif
+
 ifeq ($(CONFIG_RTL8812A), y)
 EXTRA_CFLAGS += -DCONFIG_RTL8812A
 _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8812A_FW.o\
@@ -587,10 +445,10 @@ _OUTSRC_FILES += hal/OUTSRC/rtl8821a/HalHWImg8821A_FW.o\
                hal/OUTSRC/rtl8821a/HalHWImg8821A_BB.o\
                hal/OUTSRC/rtl8821a/HalHWImg8821A_RF.o\
                hal/OUTSRC/rtl8812a/HalPhyRf_8812A.o\
-               hal/OUTSRC/rtl8821a/HalPhyRf_8821A.o\
+               hal/OUTSRC/rtl8821a/HalPhyRf_8821A_CE.o\
                hal/OUTSRC/rtl8821a/phydm_RegConfig8821A.o\
                hal/OUTSRC/rtl8821a/phydm_RTL8821A.o\
-               hal/OUTSRC/rtl8821a/PhyDM_IQK_8821A.o
+               hal/OUTSRC/rtl8821a/PhyDM_IQK_8821A_CE.o
 endif
 
 
@@ -640,6 +498,13 @@ ifeq ($(CONFIG_MP_INCLUDED), y)
 _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
 endif
 
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8723B_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8723B_PCIE.o
+endif
+
 _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8723B_BB.o\
                                                                hal/OUTSRC/$(RTL871X)/HalHWImg8723B_MAC.o\
                                                                hal/OUTSRC/$(RTL871X)/HalHWImg8723B_RF.o\
@@ -651,6 +516,73 @@ _OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8723B_BB.o\
 
 endif
 
+########### HAL_RTL8814A #################################
+ifeq ($(CONFIG_RTL8814A), y)
+
+RTL871X = rtl8814a
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8814au
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8814ae
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8814as
+endif
+
+EXTRA_CFLAGS += -DCONFIG_RTL8814A
+
+_HAL_INTFS_FILES +=  hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8814PwrSeq.o \
+                                       hal/$(RTL871X)/$(RTL871X)_xmit.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+
+
+_HAL_INTFS_FILES +=    \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+ifeq ($(CONFIG_GSPI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+endif
+endif
+
+ifeq ($(CONFIG_MP_INCLUDED), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_mp.o
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8814A_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8814A_PCIE.o
+endif
+
+_OUTSRC_FILES += hal/OUTSRC/$(RTL871X)/HalHWImg8814A_BB.o\
+                                                               hal/OUTSRC/$(RTL871X)/HalHWImg8814A_MAC.o\
+                                                               hal/OUTSRC/$(RTL871X)/HalHWImg8814A_RF.o\
+                                                               hal/OUTSRC/$(RTL871X)/HalHWImg8814A_FW.o\
+                                                               hal/OUTSRC/$(RTL871X)/PhyDM_IQK_8814A.o\
+                                                               hal/OUTSRC/$(RTL871X)/phydm_RegConfig8814A.o\
+                                                               hal/OUTSRC/$(RTL871X)/HalPhyRf_8814A.o\
+                                                               hal/OUTSRC/$(RTL871X)/phydm_RTL8814A.o
+
+endif
+
 ########### AUTO_CFG  #################################
 
 ifeq ($(CONFIG_AUTOCFG_CP), y)
@@ -697,10 +629,6 @@ ifeq ($(CONFIG_BT_COEXIST), y)
 EXTRA_CFLAGS += -DCONFIG_BT_COEXIST
 endif
 
-ifeq ($(CONFIG_RTL8192CU_REDEFINE_1X1), y)
-EXTRA_CFLAGS += -DRTL8192C_RECONFIG_TO_1T1R
-endif
-
 ifeq ($(CONFIG_INTEL_WIDI), y)
 EXTRA_CFLAGS += -DCONFIG_INTEL_WIDI
 endif
@@ -712,16 +640,29 @@ endif
 
 ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y)
 EXTRA_CFLAGS += -DCONFIG_EFUSE_CONFIG_FILE
-ifeq ($(MODULE_NAME), 8189es)
+
+#EFUSE_MAP_PATH
+USER_EFUSE_MAP_PATH ?=
+ifneq ($(USER_EFUSE_MAP_PATH),)
+EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"$(USER_EFUSE_MAP_PATH)\"
+else ifeq ($(MODULE_NAME), 8189es)
 EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8189e.map\"
 else ifeq ($(MODULE_NAME), 8723bs)
 EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8723bs.map\"
 else
 EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_$(MODULE_NAME).map\"
 endif
+
+#WIFIMAC_PATH
+USER_WIFIMAC_PATH ?=
+ifneq ($(USER_WIFIMAC_PATH),)
+EXTRA_CFLAGS += -DWIFIMAC_PATH=\"$(USER_WIFIMAC_PATH)\"
+else
 EXTRA_CFLAGS += -DWIFIMAC_PATH=\"/data/wifimac.txt\"
 endif
 
+endif
+
 ifeq ($(CONFIG_EXT_CLK), y)
 EXTRA_CFLAGS += -DCONFIG_EXT_CLK
 endif
@@ -813,12 +754,13 @@ ifeq ($(CONFIG_ANTENNA_DIVERSITY), y)
 EXTRA_CFLAGS += -DCONFIG_ANTENNA_DIVERSITY
 endif
 
+ifeq ($(CONFIG_TDLS), y)
+EXTRA_CFLAGS += -DCONFIG_TDLS
+endif
 
 ifeq ($(CONFIG_PLATFORM_I386_PC), y)
 EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
-EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
 EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
-EXTRA_CFLAGS += -DCONFIG_P2P_IPS
 SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
 ARCH ?= $(SUBARCH)
 CROSS_COMPILE ?=
@@ -840,6 +782,28 @@ KSRC := $(KERNEL_BUILD_PATH)
 MODULE_NAME :=wlan
 endif
 
+ifeq ($(CONFIG_PLATFORM_ACTIONS_ATM705X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+#EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
+# default setting for Android 4.1, 4.2, 4.3, 4.4
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ACTIONS_ATM705X
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
+
+# Enable this for Android 5.0
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+_PLATFORM_FILES += platform/platform_arm_act_sdio.o
+endif
+
+ARCH := arm
+CROSS_COMPILE := /opt/arm-2011.09/bin/arm-none-linux-gnueabi-
+KSRC := /home/android_sdk/Action-semi/705a_android_L/android/kernel
+endif
+
 ifeq ($(CONFIG_PLATFORM_TI_AM3517), y)
 EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_SHUTTLE
 CROSS_COMPILE := arm-eabi-
@@ -1092,9 +1056,9 @@ endif
 ifeq ($(CONFIG_PLATFORM_ARM_RK2818), y)
 EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS
 ARCH := arm
-#CROSS_COMPILE := /usr/src/release_fae_version/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
-#KSRC := /usr/src/release_fae_version/kernel25_A7_281x
-MODULE_NAME := 8723bu
+CROSS_COMPILE := /usr/src/release_fae_version/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
+KSRC := /usr/src/release_fae_version/kernel25_A7_281x
+MODULE_NAME := wlan
 endif
 
 ifeq ($(CONFIG_PLATFORM_ARM_RK3188), y)
@@ -1104,10 +1068,12 @@ EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
 EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
 # default setting for Special function
 EXTRA_CFLAGS += -DCONFIG_P2P_IPS
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+EXTRA_CFLAGS += -DCONFIG_RESUME_IN_WORKQUEUE
 ARCH := arm
-#CROSS_COMPILE := /home/android_sdk/Rockchip/Rk3188/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
-#KSRC := /home/android_sdk/Rockchip/Rk3188/kernel
-MODULE_NAME := 8723bu
+CROSS_COMPILE := /home/android_sdk/Rockchip/Rk3188/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
+KSRC := /home/android_sdk/Rockchip/Rk3188/kernel
+MODULE_NAME := wlan
 endif
 
 ifeq ($(CONFIG_PLATFORM_ARM_RK3066), y)
@@ -1261,9 +1227,10 @@ CROSS_COMPILE := /home/android_sdk/Allwinner/a20/kitkat-a20_v4.4/lichee/out/andr
 KSRC := /home/android_sdk/Allwinner/a20/kitkat-a20_v4.4/lichee/linux-3.4
 endif
 
-ifeq ($(CONFIG_PLATFORM_ARM_SUN8I), y)
+ifeq ($(CONFIG_PLATFORM_ARM_SUN8I_W3P1), y)
 EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
 EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I_W3P1
 EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
 # default setting for Android 4.1, 4.2
 EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
@@ -1288,6 +1255,34 @@ CROSS_COMPILE := /home/android_sdk/Allwinner/a23/android-kk44/lichee/out/android
 KSRC :=/home/android_sdk/Allwinner/a23/android-kk44/lichee/linux-3.4
 endif
 
+ifeq ($(CONFIG_PLATFORM_ARM_SUN8I_W5P1), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I_W5P1
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
+
+# Enable this for Android 5.0
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o
+endif
+
+ARCH := arm
+# ===Cross compile setting for Android L SDK ===
+CROSS_COMPILE := /home/android_sdk/Allwinner/a33/android-L/lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
+KSRC :=/home/android_sdk/Allwinner/a33/android-L/lichee/linux-3.4
+endif
+
 ifeq ($(CONFIG_PLATFORM_ACTIONS_ATV5201), y)
 EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATV5201
 EXTRA_CFLAGS += -DCONFIG_SDIO_DISABLE_RXFIFO_POLLING_LOOP
@@ -1303,6 +1298,23 @@ EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DUSB_XMITBUF_ALIGN_SZ=1024 -DUSB_PACKET_
 INSTALL_PREFIX :=
 endif
 
+ifeq ($(CONFIG_PLATFORM_HISILICON), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_HISILICON
+ifeq ($(SUPPORT_CONCURRENT),y)
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+endif
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_P2P_IPS
+ARCH := arm
+ifeq ($(CROSS_COMPILE),)
+       CROSS_COMPILE = arm-hisiv200-linux-
+endif
+MODULE_NAME := rtl8192eu
+ifeq ($(KSRC),)
+       KSRC := ../../../../../../kernel/linux-3.4.y
+endif
+endif
+
 # Platfrom setting
 ifeq ($(CONFIG_PLATFORM_ARM_SPREADTRUM_6820), y)
 ifeq ($(CONFIG_ANDROID_2X), y)
@@ -1381,6 +1393,20 @@ MODULE_NAME := 8192eu
 
 endif
 
+ifeq ($(CONFIG_PLATFORM_NOVATEK_NT72668), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_NOVATEK_NT72668
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DDCONFIG_P2P_IPS
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_RX
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+ARCH ?= arm
+CROSS_COMPILE := arm-linux-gnueabihf-
+KVER := 3.8.0
+KSRC := /Custom/Novatek/TCL/linux-3.8_header
+#KSRC := $(KERNELDIR)
+endif
 
 ifeq ($(CONFIG_MULTIDRV), y)
 
@@ -1448,9 +1474,6 @@ $(MODULE_NAME)-y += $(_PLATFORM_FILES)
 $(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o \
                                        core/rtw_mp_ioctl.o
 
-ifeq ($(CONFIG_RTL8723A), y)
-$(MODULE_NAME)-$(CONFIG_MP_INCLUDED)+= core/rtw_bt_mp.o
-endif
 ifeq ($(CONFIG_RTL8723B), y)
 $(MODULE_NAME)-$(CONFIG_MP_INCLUDED)+= core/rtw_bt_mp.o
 endif
index 5d3f80a..e36ae54 100755 (executable)
@@ -22,6 +22,7 @@
 #include <drv_types.h>
 #include <hal_data.h>
 
+#include "../hal/efuse/efuse_mask.h"
 
 /*------------------------Define local variable------------------------------*/
 u8     fakeEfuseBank=0;
@@ -39,6 +40,8 @@ u32   fakeBTEfuseUsedBytes=0;
 u8     fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
 u8     fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN]={0};
 u8     fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN]={0};
+
+u8     maskfileBuffer[32];
 /*------------------------Define local variable------------------------------*/
 
 //------------------------------------------------------------------------------
@@ -433,7 +436,8 @@ efuse_OneByteRead(
        u32     tmpidx = 0;
        u8      bResult;
        u8      readbyte;
-
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(pAdapter);
+       
        //DBG_871X("===> EFUSE_OneByteRead(), addr = %x\n", addr);
        //DBG_871X("===> EFUSE_OneByteRead() start, 0x34 = 0x%X\n", rtw_read32(pAdapter, EFUSE_TEST));
 
@@ -442,9 +446,12 @@ efuse_OneByteRead(
                bResult = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data);
                return bResult;
        }
-
+       
        if(     IS_HARDWARE_TYPE_8723B(pAdapter) ||
-               (IS_HARDWARE_TYPE_8192E(pAdapter) && IS_VENDOR_8192E_B_CUT(pAdapter)))
+               (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->VersionID))) ||
+               //(IS_HARDWARE_TYPE_8188E(pAdapter) && ((IS_I_CUT(pHalData->VersionID)) || (IS_J_CUT(pHalData->VersionID))))
+               (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter))
+         )
        {
                // <20130121, Kordan> For SMIC EFUSE specificatoin.
                //0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8]) 
@@ -495,7 +502,8 @@ efuse_OneByteWrite(
        u8      tmpidx = 0;
        u8      bResult=_FALSE;
        u32 efuseValue = 0;
-
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(pAdapter);
+       
        //DBG_871X("===> EFUSE_OneByteWrite(), addr = %x data=%x\n", addr, data);
        //DBG_871X("===> EFUSE_OneByteWrite() start, 0x34 = 0x%X\n", rtw_read32(pAdapter, EFUSE_TEST));
 
@@ -517,7 +525,11 @@ efuse_OneByteWrite(
 
 
        // <20130227, Kordan> 8192E MP chip A-cut had better not set 0x34[11] until B-Cut.
-       if (IS_HARDWARE_TYPE_8723B(pAdapter)||(IS_HARDWARE_TYPE_8192E(pAdapter) && IS_VENDOR_8192E_B_CUT(pAdapter)))
+       if (    IS_HARDWARE_TYPE_8723B(pAdapter) ||
+               (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->VersionID))) ||
+               //(IS_HARDWARE_TYPE_8188E(pAdapter) && ((IS_I_CUT(pHalData->VersionID)) || (IS_J_CUT(pHalData->VersionID))))
+               (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter))
+         )
        {
                // <20130121, Kordan> For SMIC EFUSE specificatoin.
                //0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8])
@@ -548,7 +560,11 @@ efuse_OneByteWrite(
        }
 
        // disable Efuse program enable
-       if (IS_HARDWARE_TYPE_8723B(pAdapter))
+       if (    IS_HARDWARE_TYPE_8723B(pAdapter) ||
+               (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->VersionID))) ||
+               //(IS_HARDWARE_TYPE_8188E(pAdapter) && ((IS_I_CUT(pHalData->VersionID)) || (IS_J_CUT(pHalData->VersionID))))
+               (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter))
+         )
        {
                PHY_SetMacReg(pAdapter, EFUSE_TEST, BIT(11), 0);
        }
@@ -711,6 +727,8 @@ u8 rtw_efuse_access(PADAPTER padapter, u8 bWrite, u16 start_addr, u16 cnts, u8 *
 u16 efuse_GetMaxSize(PADAPTER padapter)
 {
        u16     max_size;
+
+       max_size = 0;
        EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI , TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_size, _FALSE);
        return max_size;
 }
@@ -759,6 +777,153 @@ u8 rtw_BT_efuse_map_read(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
 
        return _SUCCESS;
 }
+
+BOOLEAN rtw_file_efuse_IsMasked(
+       PADAPTER        pAdapter,
+       u16             Offset
+       )
+{
+       int r = Offset/16;
+       int c = (Offset%16) / 2;
+       int result = 0;
+       
+       if(pAdapter->registrypriv.boffefusemask)
+               return FALSE;
+
+       //DBG_871X(" %s ,Offset=%x r= %d , c=%d , maskfileBuffer[r]= %x \n",__func__,Offset,r,c,maskfileBuffer[r]);
+       if (c < 4) // Upper double word
+           result = (maskfileBuffer[r] & (0x10 << c));
+       else
+           result = (maskfileBuffer[r] & (0x01 << (c-4)));
+       
+       return (result > 0) ? 0 : 1;
+
+}
+
+
+u8 rtw_efuse_file_read(PADAPTER padapter,u8 *filepatch,u8 *buf,u32 len)
+{
+       char *ptmp;
+       char *ptmpbuf=NULL;
+       u32 rtStatus;
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(padapter);
+
+       ptmpbuf = rtw_zmalloc(2048);
+
+       if (ptmpbuf == NULL)
+               return _FALSE;
+
+       _rtw_memset(ptmpbuf,'\0',2048);
+       
+       rtStatus = rtw_retrive_from_file(filepatch, ptmpbuf, 2048);
+
+       if( rtStatus > 100 )
+       {
+               u32 i,j;
+               for(i=0,j=0;j<len;i+=2,j++)
+               {
+                       if (( ptmpbuf[i] == ' ' ) && (ptmpbuf[i+1] != '\n' && ptmpbuf[i+1] != '\0')) {
+                               i++;
+                       }
+                       if( (ptmpbuf[i+1] != '\n' && ptmpbuf[i+1] != '\0'))
+                       {
+                                       buf[j] = simple_strtoul(&ptmpbuf[i],&ptmp, 16);
+                                       DBG_871X(" i=%d,j=%d, %x \n",i,j,buf[j]);
+
+                       } else {
+                               j--;
+                       }
+                       
+               }
+
+       } else {
+               DBG_871X(" %s ,filepatch %s , FAIL %d\n", __func__, filepatch, rtStatus);
+               return _FALSE;
+       }
+       rtw_mfree(ptmpbuf, 2048);
+       DBG_871X(" %s ,filepatch %s , done %d\n", __func__, filepatch, rtStatus);
+       return _TRUE;
+}
+
+
+BOOLEAN 
+efuse_IsMasked(
+       PADAPTER        pAdapter,
+       u16             Offset
+       )
+{
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(pAdapter);
+       
+
+       //if (bEfuseMaskOFF(pAdapter))
+       if(pAdapter->registrypriv.boffefusemask)
+               return FALSE;
+               
+#if DEV_BUS_TYPE == RT_USB_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))  
+               return (IS_MASKED(8188E,_MUSB,Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812(pAdapter))  
+               return (IS_MASKED(8812A,_MUSB,Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8821A)
+       //if (IS_HARDWARE_TYPE_8811AU(pAdapter))  
+       //      return (IS_MASKED(8811A,_MUSB,Offset)) ? TRUE : FALSE;
+       if (IS_HARDWARE_TYPE_8821(pAdapter))  
+               return (IS_MASKED(8821A,_MUSB,Offset)) ? TRUE : FALSE;          
+#endif         
+#if defined(CONFIG_RTL8192E)
+       if (IS_HARDWARE_TYPE_8192E(pAdapter))  
+               return (IS_MASKED(8192E,_MUSB,Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8723B)
+       if (IS_HARDWARE_TYPE_8723B(pAdapter))  
+               return (IS_MASKED(8723B,_MUSB,Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8814A)
+       if (IS_HARDWARE_TYPE_8814A(pAdapter))
+               return (IS_MASKED(8814A, _MUSB, Offset)) ? TRUE : FALSE;
+#endif 
+#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))  
+               return (IS_MASKED(8188E,_MPCIE,Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8192E)
+       if (IS_HARDWARE_TYPE_8192E(pAdapter))   
+               return (IS_MASKED(8192E,_MPCIE,Offset)) ? TRUE : FALSE;
+#endif 
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812(pAdapter))  
+               return (IS_MASKED(8812A,_MPCIE,Offset)) ? TRUE : FALSE;
+#endif 
+#if defined(CONFIG_RTL8821A)
+       if (IS_HARDWARE_TYPE_8821(pAdapter))  
+               return (IS_MASKED(8821A,_MPCIE,Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8723B)
+       if (IS_HARDWARE_TYPE_8723B(pAdapter))  
+               return (IS_MASKED(8723B,_MPCIE,Offset)) ? TRUE : FALSE; 
+#endif
+#if defined(CONFIG_RTL8814A)
+       if (IS_HARDWARE_TYPE_8814A(pAdapter))
+               return (IS_MASKED(8814A, _MPCIE, Offset)) ? TRUE : FALSE;
+#endif
+       //else if (IS_HARDWARE_TYPE_8821B(pAdapter))  
+       //      return (IS_MASKED(8821B,_MPCIE,Offset)) ? TRUE : FALSE; 
+
+#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
+#ifdef CONFIG_RTL8188E_SDIO
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))  
+               return (IS_MASKED(8188E,_MSDIO,Offset)) ? TRUE : FALSE;
+#endif         
+#endif
+
+       return FALSE;   
+}
+
 //------------------------------------------------------------------------------
 u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
 {
@@ -775,7 +940,6 @@ u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
        s32     i, j, idx;
        u8      ret = _SUCCESS;
        u16     mapLen=0;
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
        HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(padapter);
 
        EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
@@ -796,6 +960,23 @@ u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
        ret = rtw_efuse_map_read(padapter, 0, mapLen, map);
        if (ret == _FAIL) goto exit;
 
+       if(padapter->registrypriv.boffefusemask==0)
+       {
+               for (i =0; i < cnts; i++)
+               { 
+                       if(padapter->registrypriv.bFileMaskEfuse==_TRUE)
+                       {
+                               if (rtw_file_efuse_IsMasked(padapter, addr+i))  /*use file efuse mask. */
+                                               data[i] = map[addr+i];
+                       }
+                       else
+                       {
+                               if ( efuse_IsMasked(padapter, addr+i ))
+                                               data[i] = map[addr+i];
+                       }
+                       DBG_8192C("%s , data[%d] = %x, map[addr+i]= %x\n", __func__, i, data[i], map[addr+i]);
+               }
+       }
        Efuse_PowerSwitch(padapter, _TRUE, _TRUE);
 
        idx = 0;
@@ -816,10 +997,10 @@ u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
                                 {      
                                        if (IS_C_CUT(pHalData->VersionID) || IS_B_CUT(pHalData->VersionID))
                                        {
-                                               if(pEEPROM->adjuseVoltageVal == 6)
+                                               if(pHalData->adjuseVoltageVal == 6)
                                                {
                                                                newdata[i] = map[addr + idx];
-                                                               DBG_8192C(" %s ,\n adjuseVoltageVal = %d ,newdata[%d] = %x \n",__func__,pEEPROM->adjuseVoltageVal,i,newdata[i]);         
+                                                               DBG_8192C(" %s ,\n adjuseVoltageVal = %d ,newdata[%d] = %x \n",__func__,pHalData->adjuseVoltageVal,i,newdata[i]);        
                                                }
                                        }
                                  }
@@ -851,8 +1032,35 @@ exit:
        return ret;
 }
 
+u8 rtw_efuse_mask_map_read(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
+{
+       u8      ret = _SUCCESS;
+       u16     mapLen = 0, i = 0;
+       
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
+       
+       ret = rtw_efuse_map_read(padapter, 0, mapLen, data);
+
+       if (padapter->registrypriv.boffefusemask == 0) {
+
+                       for (i = 0; i < cnts; i++) { 
+                               if (padapter->registrypriv.bFileMaskEfuse == _TRUE) {
+                                       if (rtw_file_efuse_IsMasked(padapter, addr+i)) /*use file efuse mask.*/ 
+                                                       data[i] = 0xff;
+                               } else {
+                                       /*DBG_8192C(" %s , data[%d] = %x\n", __func__, i, data[i]);*/
+                                       if (efuse_IsMasked(padapter, addr+i)) {
+                                               data[i] = 0xff;
+                                               /*DBG_8192C(" %s ,mask data[%d] = %x\n", __func__, i, data[i]);*/
+                                       }
+                               }
+                       }
+       
+       }
+       return ret;
+
+}
 
-//------------------------------------------------------------------------------
 u8 rtw_BT_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
 {
 #define RT_ASSERT_RET(expr)                                                                                            \
@@ -1005,9 +1213,9 @@ efuse_ShadowRead1Byte(
        IN      u16             Offset,
        IN OUT  u8              *Value)
 {
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
 
-       *Value = pEEPROM->efuse_eeprom_data[Offset];
+       *Value = pHalData->efuse_eeprom_data[Offset];
 
 }      // EFUSE_ShadowRead1Byte
 
@@ -1018,10 +1226,10 @@ efuse_ShadowRead2Byte(
        IN      u16             Offset,
        IN OUT  u16             *Value)
 {
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
 
-       *Value = pEEPROM->efuse_eeprom_data[Offset];
-       *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
+       *Value = pHalData->efuse_eeprom_data[Offset];
+       *Value |= pHalData->efuse_eeprom_data[Offset+1]<<8;
 
 }      // EFUSE_ShadowRead2Byte
 
@@ -1032,12 +1240,12 @@ efuse_ShadowRead4Byte(
        IN      u16             Offset,
        IN OUT  u32             *Value)
 {
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
 
-       *Value = pEEPROM->efuse_eeprom_data[Offset];
-       *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
-       *Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16;
-       *Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24;
+       *Value = pHalData->efuse_eeprom_data[Offset];
+       *Value |= pHalData->efuse_eeprom_data[Offset+1]<<8;
+       *Value |= pHalData->efuse_eeprom_data[Offset+2]<<16;
+       *Value |= pHalData->efuse_eeprom_data[Offset+3]<<24;
 
 }      // efuse_ShadowRead4Byte
 
@@ -1073,9 +1281,9 @@ efuse_ShadowWrite1Byte(
        IN      u16             Offset,
        IN      u8              Value)
 {
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
 
-       pEEPROM->efuse_eeprom_data[Offset] = Value;
+       pHalData->efuse_eeprom_data[Offset] = Value;
 
 }      // efuse_ShadowWrite1Byte
 
@@ -1086,10 +1294,12 @@ efuse_ShadowWrite2Byte(
        IN      u16             Offset,
        IN      u16             Value)
 {
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
+       
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+       
 
-       pEEPROM->efuse_eeprom_data[Offset] = Value&0x00FF;
-       pEEPROM->efuse_eeprom_data[Offset+1] = Value>>8;
+       pHalData->efuse_eeprom_data[Offset] = Value&0x00FF;
+       pHalData->efuse_eeprom_data[Offset+1] = Value>>8;
 
 }      // efuse_ShadowWrite1Byte
 
@@ -1100,12 +1310,12 @@ efuse_ShadowWrite4Byte(
        IN      u16             Offset,
        IN      u32             Value)
 {
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
 
-       pEEPROM->efuse_eeprom_data[Offset] = (u8)(Value&0x000000FF);
-       pEEPROM->efuse_eeprom_data[Offset+1] = (u8)((Value>>8)&0x0000FF);
-       pEEPROM->efuse_eeprom_data[Offset+2] = (u8)((Value>>16)&0x00FF);
-       pEEPROM->efuse_eeprom_data[Offset+3] = (u8)((Value>>24)&0xFF);
+       pHalData->efuse_eeprom_data[Offset] = (u8)(Value&0x000000FF);
+       pHalData->efuse_eeprom_data[Offset+1] = (u8)((Value>>8)&0x0000FF);
+       pHalData->efuse_eeprom_data[Offset+2] = (u8)((Value>>16)&0x00FF);
+       pHalData->efuse_eeprom_data[Offset+3] = (u8)((Value>>24)&0xFF);
 
 }      // efuse_ShadowWrite1Byte
 
@@ -1130,25 +1340,25 @@ void EFUSE_ShadowMapUpdate(
        IN u8           efuseType,
        IN BOOLEAN      bPseudoTest)
 {
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
        u16     mapLen=0;
 
        EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, bPseudoTest);
 
-       if (pEEPROM->bautoload_fail_flag == _TRUE)
+       if (pHalData->bautoload_fail_flag == _TRUE)
        {
-               _rtw_memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen);
+               _rtw_memset(pHalData->efuse_eeprom_data, 0xFF, mapLen);
        }
        else
        {
                #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE                 
-               if(_SUCCESS != retriveAdaptorInfoFile(pAdapter->registrypriv.adaptor_info_caching_file_path, pEEPROM)) {
+               if(_SUCCESS != retriveAdaptorInfoFile(pAdapter->registrypriv.adaptor_info_caching_file_path, pHalData->efuse_eeprom_data)) {
                #endif
                
-               Efuse_ReadAllMap(pAdapter, efuseType, pEEPROM->efuse_eeprom_data, bPseudoTest);
+               Efuse_ReadAllMap(pAdapter, efuseType, pHalData->efuse_eeprom_data, bPseudoTest);
                
                #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
-                       storeAdaptorInfoFile(pAdapter->registrypriv.adaptor_info_caching_file_path, pEEPROM);
+                       storeAdaptorInfoFile(pAdapter->registrypriv.adaptor_info_caching_file_path, pHalData->efuse_eeprom_data);
                }
                #endif
        }
@@ -1274,12 +1484,12 @@ Efuse_InitSomeVar(
        return _TRUE;
 }
 
-int storeAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv)
+int storeAdaptorInfoFile(char *path, u8* efuse_data)
 {
        int ret =_SUCCESS;
 
-       if(path && eeprom_priv) {
-               ret = rtw_store_to_file(path, eeprom_priv->efuse_eeprom_data, EEPROM_MAX_SIZE_512);
+       if(path && efuse_data) {
+               ret = rtw_store_to_file(path, efuse_data, EEPROM_MAX_SIZE_512);
                if(ret == EEPROM_MAX_SIZE)
                        ret = _SUCCESS;
                else
@@ -1291,15 +1501,15 @@ int storeAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv)
        return ret;
 }
 
-int retriveAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv)
+int retriveAdaptorInfoFile(char *path, u8* efuse_data)
 {
        int ret = _SUCCESS;
        mm_segment_t oldfs;
        struct file *fp;
        
-       if(path && eeprom_priv) {
+       if(path && efuse_data) {
 
-               ret = rtw_retrive_from_file(path, eeprom_priv->efuse_eeprom_data, EEPROM_MAX_SIZE);
+               ret = rtw_retrive_from_file(path, efuse_data, EEPROM_MAX_SIZE);
                
                if(ret == EEPROM_MAX_SIZE)
                        ret = _SUCCESS;
@@ -1333,18 +1543,18 @@ void Rtw_Hal_ReadMACAddrFromFile(PADAPTER padapter)
        u8 source_addr[18];
        loff_t pos = 0;
        u32 curtime = rtw_get_current_time();
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter);
        u8 *head, *end;
 
        u8 null_mac_addr[ETH_ALEN] = {0, 0, 0,0, 0, 0};
        u8 multi_mac_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
        
        _rtw_memset(source_addr, 0, 18);
-       _rtw_memset(pEEPROM->mac_addr, 0, ETH_ALEN);
+       _rtw_memset(pHalData->EEPROMMACAddr, 0, ETH_ALEN);
 
        fp = filp_open("/data/wifimac.txt", O_RDWR,  0644);
        if (IS_ERR(fp)) {
-               pEEPROM->bloadmac_fail_flag = _TRUE;
+               pHalData->bloadmac_fail_flag = _TRUE;
                DBG_871X("Error, wifi mac address file doesn't exist.\n");
        } else {
                fs = get_fs();
@@ -1362,34 +1572,34 @@ void Rtw_Hal_ReadMACAddrFromFile(PADAPTER padapter)
                        if (end && (*end == ':') )
                                *end = '\0';
 
-                       pEEPROM->mac_addr[i] = simple_strtoul(head, NULL, 16 );
+                       pHalData->EEPROMMACAddr[i] = simple_strtoul(head, NULL, 16 );
 
                        if (end) {
                                end++;
                                head = end;
                        }
-                       DBG_871X("%02x \n", pEEPROM->mac_addr[i]);
+                       DBG_871X("%02x \n", pHalData->EEPROMMACAddr[i]);
                }
                DBG_871X("\n");
                set_fs(fs);
-               pEEPROM->bloadmac_fail_flag = _FALSE;
+               pHalData->bloadmac_fail_flag = _FALSE;
                filp_close(fp, NULL);
        }
 
-       if ( (_rtw_memcmp(pEEPROM->mac_addr, null_mac_addr, ETH_ALEN)) ||
-               (_rtw_memcmp(pEEPROM->mac_addr, multi_mac_addr, ETH_ALEN)) ) {
-               pEEPROM->mac_addr[0] = 0x00;
-               pEEPROM->mac_addr[1] = 0xe0;
-               pEEPROM->mac_addr[2] = 0x4c;
-               pEEPROM->mac_addr[3] = (u8)(curtime & 0xff) ;
-               pEEPROM->mac_addr[4] = (u8)((curtime>>8) & 0xff) ;
-               pEEPROM->mac_addr[5] = (u8)((curtime>>16) & 0xff) ;
+       if ( (_rtw_memcmp(pHalData->EEPROMMACAddr, null_mac_addr, ETH_ALEN)) ||
+               (_rtw_memcmp(pHalData->EEPROMMACAddr, multi_mac_addr, ETH_ALEN)) ) {
+               pHalData->EEPROMMACAddr[0] = 0x00;
+               pHalData->EEPROMMACAddr[1] = 0xe0;
+               pHalData->EEPROMMACAddr[2] = 0x4c;
+               pHalData->EEPROMMACAddr[3] = (u8)(curtime & 0xff) ;
+               pHalData->EEPROMMACAddr[4] = (u8)((curtime>>8) & 0xff) ;
+               pHalData->EEPROMMACAddr[5] = (u8)((curtime>>16) & 0xff) ;
        }
 
        DBG_871X("Hal_ReadMACAddrFromFile: Permanent Address = %02x-%02x-%02x-%02x-%02x-%02x !!!\n",
-                 pEEPROM->mac_addr[0], pEEPROM->mac_addr[1],
-                 pEEPROM->mac_addr[2], pEEPROM->mac_addr[3],
-                 pEEPROM->mac_addr[4], pEEPROM->mac_addr[5]);
+                 pHalData->EEPROMMACAddr[0], pHalData->EEPROMMACAddr[1],
+                 pHalData->EEPROMMACAddr[2], pHalData->EEPROMMACAddr[3],
+                 pHalData->EEPROMMACAddr[4], pHalData->EEPROMMACAddr[5]);
 }
 
 
@@ -1400,15 +1610,15 @@ u32 Rtw_Hal_readPGDataFromConfigFile(PADAPTER   padapter)
        mm_segment_t fs;
        u8 temp[3];
        loff_t pos = 0;
-       EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
-       u8      *PROMContent = pEEPROM->efuse_eeprom_data;
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter);
+       u8      *PROMContent = pHalData->efuse_eeprom_data;
 
 
        temp[2] = 0; // add end of string '\0'
 
        fp = filp_open("/system/etc/wifi/wifi_efuse.map", O_RDWR,  0644);
        if (IS_ERR(fp)) {
-               pEEPROM->bloadfile_fail_flag = _TRUE;
+               pHalData->bloadfile_fail_flag = _TRUE;
                DBG_871X("Error, Efuse configure file doesn't exist.\n");
                return _FAIL;
        }
@@ -1428,7 +1638,7 @@ u32 Rtw_Hal_readPGDataFromConfigFile(PADAPTER     padapter)
 
        filp_close(fp, NULL);
        
-       pEEPROM->bloadfile_fail_flag = _FALSE;
+       pHalData->bloadfile_fail_flag = _FALSE;
        
        return _SUCCESS;
 }
index ca63436..f605feb 100755 (executable)
@@ -534,8 +534,8 @@ void        expire_timeout_chk(_adapter *padapter)
                                                //add_ba_hdl(padapter, (u8*)paddbareq_parm);\r
 \r
                                                DBG_871X("issue addba_req to check if sta alive, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);\r
-                                               \r
-                                               issue_action_BA(padapter, psta->hwaddr, RTW_WLAN_ACTION_ADDBA_REQ, (u16)priority);              \r
+\r
+                                               issue_addba_req(padapter, psta->hwaddr, (u8)priority);\r
                \r
                                                _set_timer(&psta->addba_retry_timer, ADDBA_TO);\r
                                                \r
@@ -1310,6 +1310,7 @@ void start_bss_network(_adapter *padapter, u8 *pbuf)
 \r
        rtw_hal_set_hwreg(padapter, HW_VAR_DO_IQK, NULL);\r
 \r
+#if 0\r
        if(pmlmepriv->cur_network.join_res != _TRUE) //setting only at  first time\r
        {\r
                //u32 initialgain;\r
@@ -1322,11 +1323,12 @@ void start_bss_network(_adapter *padapter, u8 *pbuf)
                //Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, _FALSE);\r
                \r
                //turn on all dynamic functions \r
-               Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE);\r
+               /* Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, _TRUE);*/\r
 \r
                //rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));\r
        \r
        }\r
+#endif\r
 #ifdef CONFIG_80211N_HT\r
        //set channel, bwmode   \r
        p = rtw_get_ie((pnetwork->IEs + sizeof(NDIS_802_11_FIXED_IEs)), _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - sizeof(NDIS_802_11_FIXED_IEs)));\r
@@ -1380,9 +1382,6 @@ void start_bss_network(_adapter *padapter, u8 *pbuf)
        }\r
 #endif\r
 \r
-#ifdef CONFIG_DUALMAC_CONCURRENT\r
-       dc_set_ap_channel_bandwidth(padapter, cur_channel, cur_ch_offset, cur_bwmode);\r
-#else //!CONFIG_DUALMAC_CONCURRENT     \r
 #ifdef CONFIG_CONCURRENT_MODE\r
        //TODO: need to judge the phy parameters on concurrent mode for single phy\r
        concurrent_set_ap_chbw(padapter, cur_channel, cur_ch_offset, cur_bwmode);\r
@@ -1393,7 +1392,6 @@ void start_bss_network(_adapter *padapter, u8 *pbuf)
        pmlmeext->cur_bwmode = cur_bwmode;\r
        pmlmeext->cur_ch_offset = cur_ch_offset;\r
 #endif //!CONFIG_CONCURRENT_MODE\r
-#endif //!CONFIG_DUALMAC_CONCURRENT\r
 \r
        pmlmeext->cur_wireless_mode = pmlmepriv->cur_network.network_type;\r
 \r
@@ -1495,7 +1493,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf,  int len)
 \r
        pbss_network->Rssi = 0;\r
 \r
-       _rtw_memcpy(pbss_network->MacAddress, myid(&(padapter->eeprompriv)), ETH_ALEN);\r
+       _rtw_memcpy(pbss_network->MacAddress, adapter_mac_addr(padapter), ETH_ALEN);\r
        \r
        //beacon interval\r
        p = rtw_get_beacon_interval_from_ie(ie);//ie + 8;       // 8: TimeStamp, 2: Beacon Interval 2:Capability\r
@@ -1798,8 +1796,13 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf,  int len)
                                        set_mcs_rate_by_mask(HT_CAP_ELE_RX_MCS_MAP(pht_cap), MCS_RATE_1R);\r
                                        break;\r
                                case RF_2T2R:\r
-                               default:\r
                                        set_mcs_rate_by_mask(HT_CAP_ELE_RX_MCS_MAP(pht_cap), MCS_RATE_2R);\r
+                                       break;\r
+                               case RF_3T3R:\r
+                                       set_mcs_rate_by_mask(HT_CAP_ELE_RX_MCS_MAP(pht_cap), MCS_RATE_3R);\r
+                                       break;\r
+                               default:\r
+                                       DBG_871X("[warning] rf_type %d is not expected\n", rf_type);\r
                        }\r
                        for (i = 0; i < 10; i++)\r
                                *(HT_CAP_ELE_RX_MCS_MAP(pht_cap)+i) &= padapter->mlmeextpriv.default_supported_mcs_set[i];\r
@@ -3172,7 +3175,7 @@ void rtw_ap_restore_network(_adapter *padapter)
                        if(     (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||\r
                                (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_))\r
                        {\r
-                               rtw_setstakey_cmd(padapter, psta, _TRUE,_FALSE);\r
+                               rtw_setstakey_cmd(padapter, psta, UNICAST_KEY,_FALSE);\r
                        }                       \r
                }\r
        }\r
@@ -3185,6 +3188,7 @@ void start_ap_mode(_adapter *padapter)
        struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);\r
        struct sta_priv *pstapriv = &padapter->stapriv;\r
        struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;\r
+       struct mlme_ext_info    *pmlmeinfo = &(pmlmeext->mlmext_info);\r
        struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;\r
        \r
        pmlmepriv->update_bcn = _FALSE;\r
@@ -3202,10 +3206,12 @@ void start_ap_mode(_adapter *padapter)
 #ifdef CONFIG_80211N_HT\r
        pmlmepriv->num_sta_no_ht = 0;\r
 #endif //CONFIG_80211N_HT\r
+       pmlmeinfo->HT_info_enable =0;\r
+       pmlmeinfo->HT_caps_enable=0;\r
+       pmlmeinfo->HT_enable=0;\r
+       \r
        pmlmepriv->num_sta_ht_20mhz = 0;\r
-\r
        pmlmepriv->olbc = _FALSE;\r
-\r
        pmlmepriv->olbc_ht = _FALSE;\r
        \r
 #ifdef CONFIG_80211N_HT\r
index 8d8c614..cfdba22 100755 (executable)
@@ -92,8 +92,8 @@ struct beamforming_entry      *beamforming_add_entry(PADAPTER adapter, u8* ra, u16 ai
                pEntry->sound_bw = bw;\r
                if (check_fwstate(pmlmepriv, WIFI_AP_STATE))\r
                {\r
-                       u16     BSSID = ((adapter->eeprompriv.mac_addr[5] & 0xf0) >> 4) ^ \r
-                                                       (adapter->eeprompriv.mac_addr[5] & 0xf);        // BSSID[44:47] xor BSSID[40:43]\r
+                       u16     BSSID = ((*(adapter_mac_addr(adapter) + 5) & 0xf0) >> 4) ^ \r
+                               (*(adapter_mac_addr(adapter) + 5) & 0xf); /* BSSID[44:47] xor BSSID[40:43] */\r
                        pEntry->p_aid = (aid + BSSID * 32) & 0x1ff;             // (dec(A) + dec(B)*32) mod 512\r
                }               \r
                else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))\r
@@ -145,7 +145,7 @@ void        beamforming_dym_ndpa_rate(PADAPTER adapter)
        u16     NDPARate = MGN_6M;\r
        PHAL_DATA_TYPE  pHalData = GET_HAL_DATA(adapter);\r
        \r
-       if(pHalData->dmpriv.MinUndecoratedPWDBForDM > 30) // link RSSI > 30%\r
+       if(pHalData->MinUndecoratedPWDBForDM > 30) // link RSSI > 30%\r
                NDPARate = MGN_24M;\r
        else\r
                NDPARate = MGN_6M;\r
@@ -349,7 +349,7 @@ BOOLEAN     issue_ht_ndpa_packet(PADAPTER Adapter, u8 *ra, CHANNEL_WIDTH bw, u8 qidx
        SetFrameSubType(pframe, WIFI_ACTION_NOACK);\r
 \r
        _rtw_memcpy(pwlanhdr->addr1, ra, ETH_ALEN);\r
-       _rtw_memcpy(pwlanhdr->addr2, myid(&(Adapter->eeprompriv)), ETH_ALEN);\r
+       _rtw_memcpy(pwlanhdr->addr2, adapter_mac_addr(Adapter), ETH_ALEN);\r
        _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);\r
 \r
        if( pmlmeext->cur_wireless_mode == WIRELESS_11B)\r
@@ -429,7 +429,7 @@ BOOLEAN     issue_vht_ndpa_packet(PADAPTER Adapter, u8 *ra, u16 aid, CHANNEL_WIDTH b
        SetFrameSubType(pframe, WIFI_NDPA);\r
 \r
        _rtw_memcpy(pwlanhdr->addr1, ra, ETH_ALEN);\r
-       _rtw_memcpy(pwlanhdr->addr2, myid(&(Adapter->eeprompriv)), ETH_ALEN);\r
+       _rtw_memcpy(pwlanhdr->addr2, adapter_mac_addr(Adapter), ETH_ALEN);\r
 \r
        if (IsSupported5G(pmlmeext->cur_wireless_mode) || IsSupportedHT(pmlmeext->cur_wireless_mode))\r
                aSifsTime = 16;\r
index 73f2105..5a03484 100755 (executable)
 #include <drv_types.h>\r
 #include <rtw_bt_mp.h>\r
 \r
-#ifdef CONFIG_RTL8723A\r
-#include <rtl8723a_hal.h>\r
-#elif defined(CONFIG_RTL8723B)\r
+#if defined(CONFIG_RTL8723B)\r
 #include <rtl8723b_hal.h>\r
 #endif\r
 \r
-#if defined(CONFIG_RTL8723A) || defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8821A)\r
+#if defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8821A)\r
 void MPh2c_timeout_handle(void *FunctionContext)\r
 {\r
        PADAPTER pAdapter;\r
@@ -135,9 +133,7 @@ mptbt_SendH2c(
                        pMptCtx->MptH2cRspEvent = _FALSE;\r
                        pMptCtx->MptBtC2hEvent = _FALSE;\r
 \r
-#if defined(CONFIG_RTL8723A)\r
-                       rtw_hal_fill_h2c_cmd(Adapter, 70, h2cCmdLen, (pu1Byte)pH2c);\r
-#elif defined(CONFIG_RTL8723B)\r
+#if defined(CONFIG_RTL8723B)\r
                        rtl8723b_set_FwBtMpOper_cmd(Adapter, pH2c->opCode, pH2c->opCodeVer, pH2c->reqNum, pH2c->buf);\r
 #endif\r
                        pMptCtx->h2cReqNum++;\r
@@ -1089,25 +1085,7 @@ mptbt_BtSetGeneral(
                                calVal = pBtReq->pParamStart[1];\r
                        break;\r
                case BT_GSET_UPDATE_BT_PATCH:\r
-                       if(IS_HARDWARE_TYPE_8723AE(Adapter) && Adapter->bFWReady)\r
-                       {\r
-                               u1Byte i;\r
-                               DBG_8192C ("[MPT], write regs for load patch\n");\r
-                               //BTFwPatch8723A(Adapter);\r
-                               PlatformEFIOWrite1Byte(Adapter, 0xCC, 0x2d);\r
-                               rtw_msleep_os(50);\r
-                               PlatformEFIOWrite4Byte(Adapter, 0x68, 0xa005000c);\r
-                               rtw_msleep_os(50);\r
-                               PlatformEFIOWrite4Byte(Adapter, 0x68, 0xb005000c);\r
-                               rtw_msleep_os(50);\r
-                               PlatformEFIOWrite1Byte(Adapter, 0xCC, 0x29);\r
-                               for(i=0; i<12; i++)\r
-                               rtw_msleep_os(100);\r
-//#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)\r
-//                             BTFwPatch8723A(Adapter);\r
-//#endif\r
-                               DBG_8192C("[MPT], load BT FW Patch finished!!!\n");\r
-                       }\r
+                       \r
                        break;\r
                default:\r
                        {\r
index 157b875..7930aa1 100755 (executable)
@@ -19,8 +19,9 @@
  ******************************************************************************/
 #ifdef CONFIG_BT_COEXIST
 
-#include <rtw_btcoex.h>
+#include <drv_types.h>
 #include <hal_btcoex.h>
+#include <hal_data.h>
 
 
 void rtw_btcoex_Initialize(PADAPTER padapter)
@@ -45,16 +46,38 @@ void rtw_btcoex_HAL_Initialize(PADAPTER padapter, u8 bWifiOnly)
 
 void rtw_btcoex_IpsNotify(PADAPTER padapter, u8 type)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
        hal_btcoex_IpsNotify(padapter, type);
 }
 
 void rtw_btcoex_LpsNotify(PADAPTER padapter, u8 type)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
        hal_btcoex_LpsNotify(padapter, type);
 }
 
 void rtw_btcoex_ScanNotify(PADAPTER padapter, u8 type)
 {
+       PHAL_DATA_TYPE  pHalData;
+#ifdef CONFIG_BT_COEXIST_SOCKET_TRX
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+       PBT_MGNT        pBtMgnt=&pcoex_info->BtMgnt;
+#endif //CONFIG_BT_COEXIST_SOCKET_TRX
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
 #ifdef CONFIG_CONCURRENT_MODE
        if ((_FALSE == type) && (padapter->pbuddy_adapter))
        {
@@ -64,11 +87,22 @@ void rtw_btcoex_ScanNotify(PADAPTER padapter, u8 type)
        }
 #endif
 
+#ifdef CONFIG_BT_COEXIST_SOCKET_TRX
+       if(pBtMgnt->ExtConfig.bEnableWifiScanNotify)
+               rtw_btcoex_SendScanNotify(padapter, type);
+#endif //CONFIG_BT_COEXIST_SOCKET_TRX  
+
        hal_btcoex_ScanNotify(padapter, type);
 }
 
 void rtw_btcoex_ConnectNotify(PADAPTER padapter, u8 action)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
 #ifdef DBG_CONFIG_ERROR_RESET
        if (_TRUE == rtw_hal_sreset_inprogress(padapter))
        {
@@ -92,6 +126,12 @@ void rtw_btcoex_ConnectNotify(PADAPTER padapter, u8 action)
 
 void rtw_btcoex_MediaStatusNotify(PADAPTER padapter, u8 mediaStatus)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
 #ifdef DBG_CONFIG_ERROR_RESET
        if (_TRUE == rtw_hal_sreset_inprogress(padapter))
        {
@@ -121,26 +161,56 @@ void rtw_btcoex_MediaStatusNotify(PADAPTER padapter, u8 mediaStatus)
 
 void rtw_btcoex_SpecialPacketNotify(PADAPTER padapter, u8 pktType)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
        hal_btcoex_SpecialPacketNotify(padapter, pktType);
 }
 
 void rtw_btcoex_IQKNotify(PADAPTER padapter, u8 state)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
        hal_btcoex_IQKNotify(padapter, state);
 }
 
 void rtw_btcoex_BtInfoNotify(PADAPTER padapter, u8 length, u8 *tmpBuf)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
        hal_btcoex_BtInfoNotify(padapter, length, tmpBuf);
 }
 
 void rtw_btcoex_SuspendNotify(PADAPTER padapter, u8 state)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
        hal_btcoex_SuspendNotify(padapter, state);
 }
 
 void rtw_btcoex_HaltNotify(PADAPTER padapter)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
        if (_FALSE == padapter->bup)
        {
                DBG_871X(FUNC_ADPT_FMT ": bup=%d Skip!\n",
@@ -177,14 +247,32 @@ u8 rtw_btcoex_IsBtDisabled(PADAPTER padapter)
 
 void rtw_btcoex_Handler(PADAPTER padapter)
 {
+       PHAL_DATA_TYPE  pHalData;
+
+       pHalData = GET_HAL_DATA(padapter);
+
+       if (_FALSE == pHalData->EEPROMBluetoothCoexist)
+               return;
+
 #if defined(CONFIG_CONCURRENT_MODE)
        if (padapter->adapter_type != PRIMARY_ADAPTER)
                return;
 #endif
 
+
+
        hal_btcoex_Hanlder(padapter);
 }
 
+s32 rtw_btcoex_IsBTCoexRejectAMPDU(PADAPTER padapter)
+{
+       s32 coexctrl;
+
+       coexctrl = hal_btcoex_IsBTCoexRejectAMPDU(padapter);
+
+       return coexctrl;
+}
+
 s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(PADAPTER padapter)
 {
        s32 coexctrl;
@@ -300,64 +388,27 @@ u8 rtw_btcoex_IsBtLinkExist(PADAPTER padapter)
        return hal_btcoex_IsBtLinkExist(padapter);
 }
 
+void rtw_btcoex_SetBtPatchVersion(PADAPTER padapter,u16 btHciVer, u16 btPatchVer)
+{
+       hal_btcoex_SetBtPatchVersion(padapter,btHciVer,btPatchVer);
+}
+
+void rtw_btcoex_SetHciVersion(PADAPTER  padapter, u16 hciVersion)
+{
+       hal_btcoex_SetHciVersion(padapter, hciVersion);
+}
+
+void rtw_btcoex_StackUpdateProfileInfo(void) 
+{
+       hal_btcoex_StackUpdateProfileInfo();
+}
+
 // ==================================================
 // Below Functions are called by BT-Coex
 // ==================================================
-void rtw_btcoex_RejectApAggregatedPacket(PADAPTER padapter, u8 enable)
+void rtw_btcoex_rx_ampdu_apply(PADAPTER padapter)
 {
-       struct mlme_ext_info *pmlmeinfo;
-
-       pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
-
-       if (_TRUE == enable)
-       {
-               struct sta_info *psta = NULL;
-
-               pmlmeinfo->bAcceptAddbaReq = _FALSE;
-
-               if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) {
-                       psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
-                       if (psta)
-                               send_delba(padapter, 0, psta->hwaddr);
-               } else if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) {
-                       _irqL irqL;
-                       _list *phead, *plist;
-                       u8 peer_num = 0;
-                       char peers[NUM_STA];
-                       struct sta_priv *pstapriv = &padapter->stapriv;
-                       int i;
-
-                       _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
-                       phead = &pstapriv->asoc_list;
-                       plist = get_next(phead);
-
-                       while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
-                               int stainfo_offset;
-                               
-                               psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
-                               plist = get_next(plist);
-
-                               stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
-                               if (stainfo_offset_valid(stainfo_offset))
-                                       peers[peer_num++] = stainfo_offset;
-                       }
-       
-                       _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
-
-                       if (peer_num) {
-                               for (i = 0; i < peer_num; i++) {
-                                       psta = rtw_get_stainfo_by_offset(pstapriv, peers[i]);
-                                       if (psta)
-                                               send_delba(padapter, 0, psta->hwaddr);
-                               }
-                       }
-               }
-       }
-       else
-       {
-               pmlmeinfo->bAcceptAddbaReq = _TRUE;
-       }
+       rtw_rx_ampdu_apply(padapter);
 }
 
 void rtw_btcoex_LPS_Enter(PADAPTER padapter)
@@ -387,5 +438,1240 @@ void rtw_btcoex_LPS_Leave(PADAPTER padapter)
                pwrpriv->bpower_saving = _FALSE;
        }
 }
+
+
+// ==================================================
+// Below Functions are BT-Coex socket related function
+// ==================================================
+
+#ifdef CONFIG_BT_COEXIST_SOCKET_TRX
+_adapter *pbtcoexadapter = NULL;
+u8 rtw_btcoex_btinfo_cmd(_adapter *adapter, u8 *buf, u16 len)
+{
+       struct cmd_obj *ph2c;
+       struct drvextra_cmd_parm *pdrvextra_cmd_parm;
+       u8 *btinfo;
+       struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
+       u8      res = _SUCCESS;
+
+       ph2c = (struct cmd_obj*)rtw_zmalloc(sizeof(struct cmd_obj));
+       if (ph2c == NULL) {
+               res = _FAIL;
+               goto exit;
+       }
+
+       pdrvextra_cmd_parm = (struct drvextra_cmd_parm*)rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
+       if (pdrvextra_cmd_parm == NULL) {
+               rtw_mfree((u8*)ph2c, sizeof(struct cmd_obj));
+               res = _FAIL;
+               goto exit;
+       }
+
+       btinfo = rtw_zmalloc(len);
+       if (btinfo == NULL) {
+               rtw_mfree((u8*)ph2c, sizeof(struct cmd_obj));
+               rtw_mfree((u8*)pdrvextra_cmd_parm, sizeof(struct drvextra_cmd_parm));
+               res = _FAIL;
+               goto exit;
+       }
+
+       pdrvextra_cmd_parm->ec_id = BTINFO_WK_CID;
+       pdrvextra_cmd_parm->type = 0;
+       pdrvextra_cmd_parm->size = len;
+       pdrvextra_cmd_parm->pbuf = btinfo;
+
+       _rtw_memcpy(btinfo, buf, len);
+
+       init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
+
+       res = rtw_enqueue_cmd(pcmdpriv, ph2c);
+
+exit:
+       return res;
+}
+
+u8 rtw_btcoex_send_event_to_BT(_adapter *padapter, u8 status,  u8 event_code, u8 opcode_low, u8 opcode_high,u8 *dbg_msg)
+{
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0,tx_event_length = 0;
+       rtw_HCI_event *pEvent;
+       
+       pEvent = (rtw_HCI_event*)(&localBuf[0]);
+
+       pEvent->EventCode = event_code;
+       pEvent->Data[0] = 0x1;  //packet #
+       pEvent->Data[1] = opcode_low;
+       pEvent->Data[2] = opcode_high;
+       len = len + 3;
+
+               // Return parameters starts from here
+       pRetPar = &pEvent->Data[len];           
+       pRetPar[0] = status;            //status
+
+       len++;
+       pEvent->Length = len;
+
+       //total tx event length + EventCode length + sizeof(length)
+       tx_event_length = pEvent->Length + 2;
+#if 0
+       rtw_btcoex_dump_tx_msg((u8 *)pEvent, tx_event_length, dbg_msg);
+#endif         
+       status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               
+       return status;
+}
+
+/* 
+Ref: 
+Realtek Wi-Fi Driver
+Host Controller Interface for
+Bluetooth 3.0 + HS V1.4 2013/02/07
+
+Window team code & BT team code
+ */
+
+
+u8 rtw_btcoex_parse_BT_info_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       #define BT_INFO_LENGTH 8
+       
+       u8 curPollEnable = pcmd[0];
+       u8 curPollTime = pcmd[1];
+       u8 btInfoReason = pcmd[2];
+       u8 btInfoLen = pcmd[3];
+       u8 btinfo[BT_INFO_LENGTH];
+
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0,tx_event_length = 0;
+       RTW_HCI_STATUS status = HCI_STATUS_SUCCESS;
+       rtw_HCI_event *pEvent;
+
+       DBG_871X("%s\n",__func__);
+       DBG_871X("current Poll Enable: %d, currrent Poll Time: %d\n",curPollEnable,curPollTime);
+       DBG_871X("BT Info reason: %d, BT Info length: %d\n",btInfoReason,btInfoLen);
+       /*DBG_871X("%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n"
+               ,pcmd[4],pcmd[5],pcmd[6],pcmd[7],pcmd[8],pcmd[9],pcmd[10],pcmd[11]);*/
+
+       _rtw_memset(btinfo, 0, BT_INFO_LENGTH);
+       
+#if 1
+       if(BT_INFO_LENGTH != btInfoLen)
+       {
+               status = HCI_STATUS_INVALID_HCI_CMD_PARA_VALUE;
+               DBG_871X("Error BT Info Length: %d\n",btInfoLen);
+               //return _FAIL;
+       }
+       else
+#endif
+       {
+               if(0x1 == btInfoReason || 0x2 == btInfoReason)
+               {
+                       _rtw_memcpy(btinfo, &pcmd[4], btInfoLen);
+                       btinfo[0] = btInfoReason;
+                       rtw_btcoex_btinfo_cmd(padapter,btinfo,btInfoLen);
+               }
+               else
+               {
+                       DBG_871X("Other BT info reason\n");
+               }
+       }
+
+       //send complete event to BT
+       {
+
+               pEvent = (rtw_HCI_event*)(&localBuf[0]);
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_BT_INFO_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_BT_INFO_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+                       // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+                       //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+#if 0
+               rtw_btcoex_dump_tx_msg((u8 *)pEvent, tx_event_length,"BT_info_event");
+#endif         
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               
+               return status;
+                       //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+u8 rtw_btcoex_parse_BT_patch_ver_info_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       RTW_HCI_STATUS status=HCI_STATUS_SUCCESS;
+       u16             btPatchVer=0x0, btHciVer=0x0;
+       //u16           *pU2tmp;
+       
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+
+       btHciVer = pcmd[0] | pcmd[1]<<8;
+       btPatchVer = pcmd[2] | pcmd[3]<<8;
+
+
+       DBG_871X("%s, cmd:%02x %02x %02x %02x\n",__func__, pcmd[0] ,pcmd[1] ,pcmd[2] ,pcmd[3]);
+       DBG_871X("%s, HCI Ver:%d, Patch Ver:%d\n",__func__, btHciVer,btPatchVer);
+       
+       rtw_btcoex_SetBtPatchVersion(padapter,btHciVer,btPatchVer);
+
+
+       //send complete event to BT
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_BT_PATCH_VERSION_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_BT_PATCH_VERSION_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+#if 0
+               rtw_btcoex_dump_tx_msg((u8 *)pEvent, tx_event_length,"BT_patch_event");
+#endif
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+u8 rtw_btcoex_parse_HCI_Ver_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       RTW_HCI_STATUS status=HCI_STATUS_SUCCESS;
+       u16 hciver = pcmd[0] | pcmd[1] <<8;
+       
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+       PBT_MGNT        pBtMgnt=&pcoex_info->BtMgnt;
+       pBtMgnt->ExtConfig.HCIExtensionVer = hciver;
+       DBG_871X("%s, HCI Version: %d\n",__func__,pBtMgnt->ExtConfig.HCIExtensionVer);
+       if(pBtMgnt->ExtConfig.HCIExtensionVer  < 4)
+       {
+               status = HCI_STATUS_INVALID_HCI_CMD_PARA_VALUE;
+               DBG_871X("%s, Version = %d, HCI Version < 4\n",__func__,pBtMgnt->ExtConfig.HCIExtensionVer );
+       }
+       else
+       {
+               rtw_btcoex_SetHciVersion(padapter,hciver);
+       }
+       //send complete event to BT
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_EXTENSION_VERSION_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_EXTENSION_VERSION_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+       
+}
+
+u8 rtw_btcoex_parse_WIFI_scan_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       RTW_HCI_STATUS status=HCI_STATUS_SUCCESS;
+
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+       PBT_MGNT        pBtMgnt=&pcoex_info->BtMgnt;
+       pBtMgnt->ExtConfig.bEnableWifiScanNotify= pcmd[0];
+       DBG_871X("%s, bEnableWifiScanNotify: %d\n",__func__,pBtMgnt->ExtConfig.bEnableWifiScanNotify);
+       
+       //send complete event to BT
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_ENABLE_WIFI_SCAN_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_ENABLE_WIFI_SCAN_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+u8 rtw_btcoex_parse_HCI_link_status_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       RTW_HCI_STATUS  status=HCI_STATUS_SUCCESS;
+       struct bt_coex_info     *pcoex_info=&padapter->coex_info;
+       PBT_MGNT        pBtMgnt=&pcoex_info->BtMgnt;
+       //PBT_DBG               pBtDbg=&padapter->MgntInfo.BtInfo.BtDbg;
+       u8              i, numOfHandle=0, numOfAcl=0;
+       u16             conHandle;
+       u8              btProfile, btCoreSpec, linkRole;
+       u8              *pTriple;
+
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       
+       //pBtDbg->dbgHciInfo.hciCmdCntLinkStatusNotify++;
+       //RT_DISP_DATA(FIOCTL, IOCTL_BT_HCICMD_EXT, "LinkStatusNotify, Hex Data :\n", 
+       //              &pHciCmd->Data[0], pHciCmd->Length);
+
+       DBG_871X("BTLinkStatusNotify\n");
+
+       // Current only RTL8723 support this command.
+       //pBtMgnt->bSupportProfile = TRUE;
+       pBtMgnt->bSupportProfile = _FALSE;
+
+       pBtMgnt->ExtConfig.NumberOfACL = 0;
+       pBtMgnt->ExtConfig.NumberOfSCO = 0;
+       
+       numOfHandle = pcmd[0];
+       //RT_DISP(FIOCTL, IOCTL_BT_HCICMD_EXT, ("numOfHandle = 0x%x\n", numOfHandle));
+       //RT_DISP(FIOCTL, IOCTL_BT_HCICMD_EXT, ("HCIExtensionVer = %d\n", pBtMgnt->ExtConfig.HCIExtensionVer));
+       DBG_871X("numOfHandle = 0x%x\n", numOfHandle);
+       DBG_871X("HCIExtensionVer = %d\n", pBtMgnt->ExtConfig.HCIExtensionVer);
+       
+       pTriple = &pcmd[1];
+       for(i=0; i<numOfHandle; i++)
+       {       
+               if(pBtMgnt->ExtConfig.HCIExtensionVer < 1)
+               {
+                       conHandle = *((u8 *)&pTriple[0]);
+                       btProfile = pTriple[2];
+                       btCoreSpec = pTriple[3];
+                       if(BT_PROFILE_SCO == btProfile)
+                       {
+                               pBtMgnt->ExtConfig.NumberOfSCO++;
+                       }
+                       else
+                       {
+                               pBtMgnt->ExtConfig.NumberOfACL++;                       
+                               pBtMgnt->ExtConfig.aclLink[i].ConnectHandle = conHandle;
+                               pBtMgnt->ExtConfig.aclLink[i].BTProfile = btProfile;
+                               pBtMgnt->ExtConfig.aclLink[i].BTCoreSpec = btCoreSpec;
+                       }
+                       //RT_DISP(FIOCTL, IOCTL_BT_HCICMD_EXT, 
+                       //      ("Connection_Handle=0x%x, BTProfile=%d, BTSpec=%d\n",
+                       //              conHandle, btProfile, btCoreSpec));
+                       DBG_871X("Connection_Handle=0x%x, BTProfile=%d, BTSpec=%d\n", conHandle, btProfile, btCoreSpec);
+                       pTriple += 4;
+               }
+               else if(pBtMgnt->ExtConfig.HCIExtensionVer >= 1)
+               {
+                       conHandle = *((pu2Byte)&pTriple[0]);
+                       btProfile = pTriple[2];
+                       btCoreSpec = pTriple[3];
+                       linkRole = pTriple[4];
+                       if(BT_PROFILE_SCO == btProfile)
+                       {
+                               pBtMgnt->ExtConfig.NumberOfSCO++;
+                       }
+                       else
+                       {
+                               pBtMgnt->ExtConfig.NumberOfACL++;                       
+                               pBtMgnt->ExtConfig.aclLink[i].ConnectHandle = conHandle;
+                               pBtMgnt->ExtConfig.aclLink[i].BTProfile = btProfile;
+                               pBtMgnt->ExtConfig.aclLink[i].BTCoreSpec = btCoreSpec;
+                               pBtMgnt->ExtConfig.aclLink[i].linkRole = linkRole;
+                       }
+                       //RT_DISP(FIOCTL, IOCTL_BT_HCICMD_EXT, 
+                       DBG_871X("Connection_Handle=0x%x, BTProfile=%d, BTSpec=%d, LinkRole=%d\n",
+                               conHandle, btProfile, btCoreSpec, linkRole);
+                       pTriple += 5;
+               }       
+       }
+       rtw_btcoex_StackUpdateProfileInfo();
+
+               //send complete event to BT
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_LINK_STATUS_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_LINK_STATUS_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+       
+       
+}
+
+u8 rtw_btcoex_parse_HCI_BT_coex_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       RTW_HCI_STATUS  status=HCI_STATUS_SUCCESS;
+
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_BT_COEX_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_BT_COEX_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+u8 rtw_btcoex_parse_HCI_BT_operation_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       RTW_HCI_STATUS  status=HCI_STATUS_SUCCESS;
+
+       DBG_871X("%s, OP code: %d\n",__func__,pcmd[0]);
+
+       switch(pcmd[0])
+       {
+               case HCI_BT_OP_NONE:
+                       DBG_871X("[bt operation] : Operation None!!\n");
+                       break;
+               case HCI_BT_OP_INQUIRY_START:
+                       DBG_871X("[bt operation] : Inquiry start!!\n");
+                       break;
+               case HCI_BT_OP_INQUIRY_FINISH:
+                       DBG_871X("[bt operation] : Inquiry finished!!\n");
+                       break;
+               case HCI_BT_OP_PAGING_START:
+                       DBG_871X("[bt operation] : Paging is started!!\n");
+                       break;
+               case HCI_BT_OP_PAGING_SUCCESS:
+                       DBG_871X("[bt operation] : Paging complete successfully!!\n");
+                       break;
+               case HCI_BT_OP_PAGING_UNSUCCESS:
+                       DBG_871X("[bt operation] : Paging complete unsuccessfully!!\n");
+                       break;
+               case HCI_BT_OP_PAIRING_START:
+                       DBG_871X("[bt operation] : Pairing start!!\n");
+                       break;
+               case HCI_BT_OP_PAIRING_FINISH:
+                       DBG_871X("[bt operation] : Pairing finished!!\n");
+                       break;
+               case HCI_BT_OP_BT_DEV_ENABLE:
+                       DBG_871X("[bt operation] : BT Device is enabled!!\n");
+                       break;
+               case HCI_BT_OP_BT_DEV_DISABLE:
+                       DBG_871X("[bt operation] : BT Device is disabled!!\n");
+                       break;
+               default:
+                       DBG_871X("[bt operation] : Unknown, error!!\n");
+                       break;
+       }
+
+                       //send complete event to BT
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_BT_OPERATION_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_BT_OPERATION_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+u8 rtw_btcoex_parse_BT_AFH_MAP_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       RTW_HCI_STATUS  status=HCI_STATUS_SUCCESS;
+
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_BT_AFH_MAP_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_BT_AFH_MAP_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+u8 rtw_btcoex_parse_BT_register_val_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       RTW_HCI_STATUS  status=HCI_STATUS_SUCCESS;
+
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_BT_REGISTER_VALUE_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_BT_REGISTER_VALUE_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+u8 rtw_btcoex_parse_HCI_BT_abnormal_notify_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       RTW_HCI_STATUS  status=HCI_STATUS_SUCCESS;
+
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_BT_ABNORMAL_NOTIFY, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_BT_ABNORMAL_NOTIFY, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+u8 rtw_btcoex_parse_HCI_query_RF_status_cmd(_adapter *padapter, u8 *pcmd, u16 cmdlen)
+{
+       u8 localBuf[6] = "";
+       u8 *pRetPar;
+       u8      len=0, tx_event_length =0;
+       rtw_HCI_event *pEvent;
+       RTW_HCI_STATUS  status=HCI_STATUS_SUCCESS;
+
+       {
+               pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+
+               pEvent->EventCode = HCI_EVENT_COMMAND_COMPLETE;
+               pEvent->Data[0] = 0x1;  //packet #
+               pEvent->Data[1] = HCIOPCODELOW(HCI_QUERY_RF_STATUS, OGF_EXTENSION);
+               pEvent->Data[2] = HCIOPCODEHIGHT(HCI_QUERY_RF_STATUS, OGF_EXTENSION);
+               len = len + 3;
+
+               // Return parameters starts from here
+               pRetPar = &pEvent->Data[len];           
+               pRetPar[0] = status;            //status
+
+               len++;
+               pEvent->Length = len;
+
+               //total tx event length + EventCode length + sizeof(length)
+               tx_event_length = pEvent->Length + 2;
+
+               status = rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+               return status;
+               //bthci_IndicateEvent(Adapter, PPacketIrpEvent, len+2);
+       }
+}
+
+/*****************************************
+* HCI cmd format :
+*| 15 - 0                                              |       
+*| OPcode (OCF|OGF<<10)                |
+*| 15 - 8              |7 - 0                  |
+*|Cmd para     |Cmd para Length        |
+*|Cmd para......                               |
+******************************************/
+
+//bit 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
+//      |      OCF                                  |     OGF       |
+void rtw_btcoex_parse_hci_extend_cmd(_adapter *padapter, u8 *pcmd, u16 len,const u16 hci_OCF)
+{
+
+       DBG_871X("%s: OCF: %x\n",__func__,hci_OCF);
+       switch(hci_OCF)
+       {
+               case HCI_EXTENSION_VERSION_NOTIFY:
+                       DBG_871X("HCI_EXTENSION_VERSION_NOTIFY\n");
+                       rtw_btcoex_parse_HCI_Ver_notify_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_LINK_STATUS_NOTIFY:
+                       DBG_871X("HCI_LINK_STATUS_NOTIFY\n");
+                       rtw_btcoex_parse_HCI_link_status_notify_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_BT_OPERATION_NOTIFY:
+                       // only for 8723a 2ant
+                       DBG_871X("HCI_BT_OPERATION_NOTIFY\n");
+                       rtw_btcoex_parse_HCI_BT_operation_notify_cmd(padapter,pcmd, len);
+                       //
+                       break;
+               case HCI_ENABLE_WIFI_SCAN_NOTIFY:
+                       DBG_871X("HCI_ENABLE_WIFI_SCAN_NOTIFY\n");
+                       rtw_btcoex_parse_WIFI_scan_notify_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_QUERY_RF_STATUS:
+                       // only for 8723b 2ant
+                       DBG_871X("HCI_QUERY_RF_STATUS\n");
+                       rtw_btcoex_parse_HCI_query_RF_status_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_BT_ABNORMAL_NOTIFY:
+                       DBG_871X("HCI_BT_ABNORMAL_NOTIFY\n");
+                       rtw_btcoex_parse_HCI_BT_abnormal_notify_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_BT_INFO_NOTIFY:
+                       DBG_871X("HCI_BT_INFO_NOTIFY\n");
+                       rtw_btcoex_parse_BT_info_notify_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_BT_COEX_NOTIFY:
+                       DBG_871X("HCI_BT_COEX_NOTIFY\n");
+                       rtw_btcoex_parse_HCI_BT_coex_notify_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_BT_PATCH_VERSION_NOTIFY:
+                       DBG_871X("HCI_BT_PATCH_VERSION_NOTIFY\n");
+                       rtw_btcoex_parse_BT_patch_ver_info_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_BT_AFH_MAP_NOTIFY:
+                       DBG_871X("HCI_BT_AFH_MAP_NOTIFY\n");
+                       rtw_btcoex_parse_BT_AFH_MAP_notify_cmd(padapter,pcmd, len);
+                       break;
+               case HCI_BT_REGISTER_VALUE_NOTIFY:
+                       DBG_871X("HCI_BT_REGISTER_VALUE_NOTIFY\n");
+                       rtw_btcoex_parse_BT_register_val_notify_cmd(padapter,pcmd, len);
+                       break;
+               default:
+                       DBG_871X("ERROR!!! Unknown OCF: %x\n",hci_OCF);
+                       break;
+                       
+       }
+}
+
+void rtw_btcoex_parse_hci_cmd(_adapter *padapter, u8 *pcmd, u16 len)
+{
+       u16 opcode = pcmd[0] | pcmd[1]<<8;
+       u16 hci_OGF = HCI_OGF(opcode);
+       u16 hci_OCF = HCI_OCF(opcode);
+       u8 cmdlen = len -3;
+       u8 pare_len = pcmd[2];
+
+       DBG_871X("%s\n",__func__);
+       DBG_871X("OGF: %x,OCF: %x\n",hci_OGF,hci_OCF);
+       switch(hci_OGF)
+       {
+               case OGF_EXTENSION:
+                       DBG_871X("HCI_EXTENSION_CMD_OGF\n");
+                       rtw_btcoex_parse_hci_extend_cmd(padapter, &pcmd[3], cmdlen, hci_OCF);
+                       break;
+               default:
+                       DBG_871X("Other OGF: %x\n",hci_OGF);
+                       break;
+       }
+}
+
+u16 rtw_btcoex_parse_recv_data(u8 *msg, u8 msg_size)
+{
+       u8 cmp_msg1[32] = attend_ack;
+       u8 cmp_msg2[32] = leave_ack;
+       u8 cmp_msg3[32] = bt_leave;
+       u8 cmp_msg4[32] = invite_req;
+       u8 cmp_msg5[32] = attend_req;
+       u8 cmp_msg6[32] = invite_rsp;
+       u8 res = OTHER;
+       
+       if (_rtw_memcmp(cmp_msg1, msg, msg_size) == _TRUE) {
+               /*DBG_871X("%s, msg:%s\n",__func__,msg);*/
+               res = RX_ATTEND_ACK;
+       } else if (_rtw_memcmp(cmp_msg2, msg, msg_size) == _TRUE) {
+               /*DBG_871X("%s, msg:%s\n",__func__,msg);*/
+               res = RX_LEAVE_ACK;
+       } else if (_rtw_memcmp(cmp_msg3, msg, msg_size) == _TRUE) {
+               /*DBG_871X("%s, msg:%s\n",__func__,msg);*/
+               res = RX_BT_LEAVE;
+       } else if (_rtw_memcmp(cmp_msg4, msg, msg_size) == _TRUE) {
+               /*DBG_871X("%s, msg:%s\n",__func__,msg);*/
+               res = RX_INVITE_REQ;
+       } else if (_rtw_memcmp(cmp_msg5, msg, msg_size) == _TRUE) {
+               res = RX_ATTEND_REQ;
+       } else if (_rtw_memcmp(cmp_msg6, msg, msg_size) == _TRUE) {
+               res = RX_INVITE_RSP;
+       } else {
+               DBG_871X("%s, %s\n", __func__, msg);
+               res = OTHER;
+       }
+       
+       DBG_871X("%s, res:%d\n", __func__, res);
+       
+       return res;
+}
+
+void rtw_btcoex_recvmsgbysocket(void *data)
+{
+       u8 recv_data[255];
+       u8 tx_msg[255] = leave_ack;
+       u32 len = 0;
+       
+       u16 recv_length = 0;
+       u16 parse_res = 0;
+#if 0
+       u8 para_len = 0, polling_enable = 0, poling_interval = 0, reason = 0, btinfo_len = 0;
+       u8 btinfo[BT_INFO_LEN] = {0};
+#endif
+
+       struct bt_coex_info *pcoex_info = NULL;
+       struct sock *sk = NULL;
+       struct sk_buff *skb = NULL;
+       
+       DBG_871X("%s\n",__func__);
+
+       if (pbtcoexadapter == NULL) {
+               DBG_871X("%s: btcoexadapter NULL!\n", __func__);
+               return;
+       }
+
+       pcoex_info = &pbtcoexadapter->coex_info;
+       sk = pcoex_info->sk_store;
+
+       if (sk == NULL) {
+               DBG_871X("%s: critical error when receive socket data!\n", __func__);
+               return;
+       }
+       
+       len = skb_queue_len(&sk->sk_receive_queue);
+       while (len > 0) {
+               skb = skb_dequeue(&sk->sk_receive_queue);
+
+               /*important: cut the udp header from skb->data! header length is 8 byte*/
+               recv_length = skb->len-8;
+               _rtw_memset(recv_data, 0, sizeof(recv_data));
+               _rtw_memcpy(recv_data, skb->data+8, recv_length);
+               
+               parse_res = rtw_btcoex_parse_recv_data(recv_data, recv_length);
+/*
+               if (RX_ATTEND_ACK == parse_res) {
+                       //attend ack 
+                       pcoex_info->BT_attend = _TRUE;
+                       DBG_871X("RX_ATTEND_ACK!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+               } else if (RX_ATTEND_REQ == parse_res) {
+                       //attend req from BT 
+                       pcoex_info->BT_attend = _TRUE;
+                       DBG_871X("RX_BT_ATTEND_REQ!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+                       rtw_btcoex_sendmsgbysocket(pbtcoexadapter, attend_ack, sizeof(attend_ack), _FALSE);
+               } else if (RX_INVITE_REQ == parse_res) {
+                       //invite req from BT
+                       pcoex_info->BT_attend = _TRUE;
+                       DBG_871X("RX_INVITE_REQ!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+                       rtw_btcoex_sendmsgbysocket(pbtcoexadapter, invite_rsp, sizeof(invite_rsp), _FALSE);
+               } else if (RX_INVITE_RSP == parse_res) {
+                       //invite rsp
+                       pcoex_info->BT_attend = _TRUE;
+                       DBG_871X("RX_INVITE_RSP!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+               } else if (RX_LEAVE_ACK == parse_res) {
+                       //mean BT know wifi  will leave
+                       pcoex_info->BT_attend = _FALSE;
+                       DBG_871X("RX_LEAVE_ACK!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);                   
+               } else if (RX_BT_LEAVE == parse_res) {
+                       //BT leave
+                       rtw_btcoex_sendmsgbysocket(pbtcoexadapter, leave_ack, sizeof(leave_ack), _FALSE); // no ack
+                       pcoex_info->BT_attend = _FALSE;
+                       DBG_871X("RX_BT_LEAVE!sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);                     
+               } else {
+                       //todo: check if recv data are really hci cmds
+                       if (_TRUE == pcoex_info->BT_attend)
+                               rtw_btcoex_parse_hci_cmd(pbtcoexadapter, recv_data, recv_length);
+               }
+*/
+               switch (parse_res) {
+               case RX_ATTEND_ACK:
+                       /* attend ack */
+                       pcoex_info->BT_attend = _TRUE;
+                       DBG_871X("RX_ATTEND_ACK!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+                       break;
+
+               case RX_ATTEND_REQ:
+                       pcoex_info->BT_attend = _TRUE;
+                       DBG_871X("RX_BT_ATTEND_REQ!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+                       rtw_btcoex_sendmsgbysocket(pbtcoexadapter, attend_ack, sizeof(attend_ack), _FALSE);
+                       break;
+
+               case RX_INVITE_REQ:
+                       /* invite req from BT */
+                       pcoex_info->BT_attend = _TRUE;
+                       DBG_871X("RX_INVITE_REQ!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+                       rtw_btcoex_sendmsgbysocket(pbtcoexadapter, invite_rsp, sizeof(invite_rsp), _FALSE);
+                       break;
+
+               case RX_INVITE_RSP:
+                        /*invite rsp*/
+                       pcoex_info->BT_attend = _TRUE;
+                       DBG_871X("RX_INVITE_RSP!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+                       break;
+
+               case RX_LEAVE_ACK:
+                       /* mean BT know wifi  will leave */
+                       pcoex_info->BT_attend = _FALSE;
+                       DBG_871X("RX_LEAVE_ACK!,sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);   
+                       break;
+
+               case RX_BT_LEAVE:
+                       /* BT leave */
+                       rtw_btcoex_sendmsgbysocket(pbtcoexadapter, leave_ack, sizeof(leave_ack), _FALSE); /* no ack */
+                       pcoex_info->BT_attend = _FALSE;
+                       DBG_871X("RX_BT_LEAVE!sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);             
+                       break;
+
+               default:
+                       if (_TRUE == pcoex_info->BT_attend)
+                               rtw_btcoex_parse_hci_cmd(pbtcoexadapter, recv_data, recv_length);
+                       else
+                               DBG_871X("ERROR!! BT is UP\n");
+                       break;
+
+               }
+               
+               len--;
+               kfree_skb(skb);
+       }
+}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0))
+void rtw_btcoex_recvmsg_init(struct sock *sk_in, s32 bytes)
+#else
+void rtw_btcoex_recvmsg_init(struct sock *sk_in)
+#endif
+{
+       struct bt_coex_info *pcoex_info = NULL;
+       
+       if (pbtcoexadapter == NULL) {
+               DBG_871X("%s: btcoexadapter NULL\n", __func__);
+               return;
+       }
+       pcoex_info = &pbtcoexadapter->coex_info;
+       pcoex_info->sk_store = sk_in;
+       if (pcoex_info->btcoex_wq != NULL)
+               queue_delayed_work(pcoex_info->btcoex_wq, &pcoex_info->recvmsg_work, 0);
+       else
+               DBG_871X("%s: BTCOEX workqueue NULL\n", __func__);
+}
+
+u8 rtw_btcoex_sendmsgbysocket(_adapter *padapter, u8 *msg, u8 msg_size, bool force)
+{
+       u8 error; 
+       struct msghdr   udpmsg; 
+       mm_segment_t    oldfs; 
+       struct iovec    iov; 
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+
+       DBG_871X("%s: msg:%s, force:%s\n", __func__, msg, force == _TRUE?"TRUE":"FALSE");
+       if (_FALSE == force) {
+               if (_FALSE == pcoex_info->BT_attend) {
+                       DBG_871X("TX Blocked: WiFi-BT disconnected\n");                 
+                       return _FAIL;
+               }
+       }
+               
+       iov.iov_base     = (void *)msg; 
+       iov.iov_len      = msg_size; 
+       udpmsg.msg_name  = &pcoex_info->bt_sockaddr; 
+       udpmsg.msg_namelen      = sizeof(struct sockaddr_in); 
+       udpmsg.msg_iov   = &iov; 
+       udpmsg.msg_iovlen       = 1; 
+       udpmsg.msg_control      = NULL; 
+       udpmsg.msg_controllen = 0; 
+       udpmsg.msg_flags        = MSG_DONTWAIT | MSG_NOSIGNAL; 
+       oldfs = get_fs(); 
+       set_fs(KERNEL_DS); 
+       error = sock_sendmsg(pcoex_info->udpsock, &udpmsg, msg_size); 
+       set_fs(oldfs); 
+       if (error < 0) {
+               DBG_871X("Error when sendimg msg, error:%d\n", error); 
+               return _FAIL;
+       } else
+               return _SUCCESS;
+}
+
+u8 rtw_btcoex_create_kernel_socket(_adapter *padapter)
+{
+       s8 kernel_socket_err; 
+       u8 tx_msg[255] = attend_req;
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+       s32 sock_reuse = 1;
+       u8 status = _FAIL;
+       
+       DBG_871X("%s CONNECT_PORT %d\n", __func__, CONNECT_PORT);
+
+       if (NULL == pcoex_info) {
+               DBG_871X("coex_info: NULL\n"); 
+               status =  _FAIL;
+       }
+       
+       kernel_socket_err = sock_create(PF_INET, SOCK_DGRAM, 0, &pcoex_info->udpsock); 
+    
+       if (kernel_socket_err < 0) { 
+               DBG_871X("Error during creation of socket error:%d\n", kernel_socket_err); 
+               status = _FAIL; 
+       } else {
+               _rtw_memset(&(pcoex_info->wifi_sockaddr), 0, sizeof(pcoex_info->wifi_sockaddr)); 
+               pcoex_info->wifi_sockaddr.sin_family = AF_INET; 
+               pcoex_info->wifi_sockaddr.sin_port = htons(CONNECT_PORT); 
+               pcoex_info->wifi_sockaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+
+               _rtw_memset(&(pcoex_info->bt_sockaddr), 0, sizeof(pcoex_info->bt_sockaddr)); 
+               pcoex_info->bt_sockaddr.sin_family = AF_INET; 
+               pcoex_info->bt_sockaddr.sin_port = htons(CONNECT_PORT_BT); 
+               pcoex_info->bt_sockaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+
+               pcoex_info->sk_store = NULL;
+               kernel_socket_err = pcoex_info->udpsock->ops->bind(pcoex_info->udpsock, (struct sockaddr *)&pcoex_info->wifi_sockaddr, 
+                       sizeof(pcoex_info->wifi_sockaddr)); 
+               if (kernel_socket_err == 0) {   
+                       DBG_871X("binding socket success\n"); 
+                       pcoex_info->udpsock->sk->sk_data_ready = rtw_btcoex_recvmsg_init;
+                       pcoex_info->sock_open |=  KERNEL_SOCKET_OK;
+                       pcoex_info->BT_attend = _FALSE;
+                       DBG_871X("WIFI sending attend_req\n"); 
+                       rtw_btcoex_sendmsgbysocket(padapter, attend_req, sizeof(attend_req), _TRUE);
+                       status = _SUCCESS;
+               } else { 
+                       pcoex_info->BT_attend = _FALSE;
+                       sock_release(pcoex_info->udpsock); /* bind fail release socket */
+                       DBG_871X("Error binding socket: %d\n", kernel_socket_err); 
+                       status = _FAIL;
+               } 
+                       
+       }
+
+       return status;
+}
+
+void rtw_btcoex_close_kernel_socket(_adapter *padapter)
+{
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+       if (pcoex_info->sock_open & KERNEL_SOCKET_OK) {
+               DBG_871X("release kernel socket\n");
+               sock_release(pcoex_info->udpsock);
+               pcoex_info->sock_open &= ~(KERNEL_SOCKET_OK);   
+               if (_TRUE == pcoex_info->BT_attend)
+                       pcoex_info->BT_attend = _FALSE;
+               
+               DBG_871X("sock_open:%d, BT_attend:%d\n", pcoex_info->sock_open, pcoex_info->BT_attend);
+       }
+}
+
+void rtw_btcoex_init_socket(_adapter *padapter)
+{
+               
+       u8 is_invite = _FALSE;
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+       DBG_871X("%s\n", __func__);
+       if (_FALSE == pcoex_info->is_exist) {
+               _rtw_memset(pcoex_info,0,sizeof(struct bt_coex_info));
+               pcoex_info->btcoex_wq = create_workqueue("BTCOEX");
+               INIT_DELAYED_WORK(&pcoex_info->recvmsg_work,
+                         (void *)rtw_btcoex_recvmsgbysocket);
+               pbtcoexadapter = padapter;
+               if (rtw_btcoex_create_kernel_socket(padapter) == _SUCCESS) {
+                       pcoex_info->is_exist = _TRUE;
+               } else {
+                       pcoex_info->is_exist = _FALSE;
+                       pbtcoexadapter = NULL;
+               }
+               
+               DBG_871X("%s: pbtcoexadapter:%p, coex_info->is_exist: %s\n"
+                       , __func__, pbtcoexadapter, pcoex_info->is_exist == _TRUE?"TRUE":"FALSE");
+       }
+}
+
+void rtw_btcoex_close_socket(_adapter *padapter)
+{
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+
+       DBG_871X("%s--coex_info->is_exist: %s, pcoex_info->BT_attend:%s\n"
+               , __func__, pcoex_info->is_exist == _TRUE?"TRUE":"FALSE", pcoex_info->BT_attend == _TRUE?"TRUE":"FALSE");
+       
+       if (_TRUE == pcoex_info->is_exist) {
+               if (_TRUE == pcoex_info->BT_attend) {
+                       /*inform BT wifi leave*/
+                       rtw_btcoex_sendmsgbysocket(padapter, wifi_leave, sizeof(wifi_leave), _FALSE);
+                       msleep(50);
+               }
+               rtw_btcoex_close_kernel_socket(padapter);
+               pbtcoexadapter = NULL;
+               pcoex_info->is_exist = _FALSE;
+       }
+       if (pcoex_info->btcoex_wq != NULL) {
+               flush_workqueue(pcoex_info->btcoex_wq);
+               destroy_workqueue(pcoex_info->btcoex_wq);
+       }
+}
+
+void rtw_btcoex_dump_tx_msg(u8 *tx_msg, u8 len, u8 *msg_name)
+{
+       u8      i = 0;
+       DBG_871X("======> Msg name: %s\n", msg_name);
+       for(i=0;i<len;i++)
+       {
+               printk("%02x ", tx_msg[i]);
+       }
+       printk("\n");
+       DBG_871X("Msg name: %s <======\n", msg_name);
+}
+
+/* Porting from Windows team */
+void rtw_btcoex_SendEventExtBtCoexControl(PADAPTER padapter, u8 bNeedDbgRsp, u8 dataLen, void *pData)
+{
+       u8                      len=0, tx_event_length = 0;
+       u8                      localBuf[32] = "";
+       u8                      *pRetPar;
+       u8                      opCode=0;
+       u8                      *pInBuf=(pu1Byte)pData;
+       u8                      *pOpCodeContent;
+       rtw_HCI_event *pEvent;
+
+       opCode = pInBuf[0];     
+
+       DBG_871X("%s, OPCode:%02x\n",__func__,opCode);
+
+       pEvent = (rtw_HCI_event*)(&localBuf[0]);
+
+       //len += bthci_ExtensionEventHeaderRtk(&localBuf[0], 
+       //      HCI_EVENT_EXT_BT_COEX_CONTROL);
+       pEvent->EventCode = HCI_EVENT_EXTENSION_RTK;
+       pEvent->Data[0] = HCI_EVENT_EXT_BT_COEX_CONTROL;        //extension event code
+       len ++;
+       
+       // Return parameters starts from here
+       pRetPar = &pEvent->Data[len];
+       _rtw_memcpy(&pRetPar[0], pData, dataLen);
+
+       len += dataLen;
+
+       pEvent->Length = len;
+
+       //total tx event length + EventCode length + sizeof(length)
+       tx_event_length = pEvent->Length + 2;
+#if 0
+       rtw_btcoex_dump_tx_msg((u8 *)pEvent, tx_event_length, "BT COEX CONTROL", _FALSE);
+#endif
+       rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+
+}
+
+/* Porting from Windows team */
+void rtw_btcoex_SendEventExtBtInfoControl(PADAPTER padapter, u8 dataLen, void *pData)
+{
+       rtw_HCI_event *pEvent;
+       u8                      *pRetPar;
+       u8                      len=0, tx_event_length = 0;
+       u8                      localBuf[32] = "";
+
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+       PBT_MGNT                pBtMgnt = &pcoex_info->BtMgnt;
+       
+       DBG_871X("%s\n",__func__);
+       if(pBtMgnt->ExtConfig.HCIExtensionVer < 4) //not support
+       {
+               DBG_871X("ERROR: HCIExtensionVer = %d, HCIExtensionVer<4 !!!!\n",pBtMgnt->ExtConfig.HCIExtensionVer);
+               return;
+       }
+
+       pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+       //len += bthci_ExtensionEventHeaderRtk(&localBuf[0], 
+       //              HCI_EVENT_EXT_BT_INFO_CONTROL);
+       pEvent->EventCode = HCI_EVENT_EXTENSION_RTK;
+       pEvent->Data[0] = HCI_EVENT_EXT_BT_INFO_CONTROL;                //extension event code
+       len ++;
+
+       // Return parameters starts from here
+       pRetPar = &pEvent->Data[len];
+       _rtw_memcpy(&pRetPar[0], pData, dataLen);
+
+       len += dataLen;
+
+       pEvent->Length = len;
+
+       //total tx event length + EventCode length + sizeof(length)
+       tx_event_length = pEvent->Length + 2;
+#if 0
+       rtw_btcoex_dump_tx_msg((u8 *)pEvent, tx_event_length, "BT INFO CONTROL");
+#endif
+       rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+       
+}
+
+void rtw_btcoex_SendScanNotify(PADAPTER padapter, u8 scanType)
+{
+       u8      len=0, tx_event_length=0;
+       u8      localBuf[7] = "";
+       u8      *pRetPar;
+       u8      *pu1Temp;
+       rtw_HCI_event *pEvent;
+       struct bt_coex_info *pcoex_info = &padapter->coex_info;
+       PBT_MGNT                pBtMgnt = &pcoex_info->BtMgnt;
+
+//     if(!pBtMgnt->BtOperationOn)
+//             return;
+               
+       pEvent = (rtw_HCI_event *)(&localBuf[0]);
+
+//     len += bthci_ExtensionEventHeaderRtk(&localBuf[0], 
+//                     HCI_EVENT_EXT_WIFI_SCAN_NOTIFY);
+
+       pEvent->EventCode = HCI_EVENT_EXTENSION_RTK;
+       pEvent->Data[0] = HCI_EVENT_EXT_WIFI_SCAN_NOTIFY;               //extension event code
+       len ++;
+
+       // Return parameters starts from here
+       //pRetPar = &PPacketIrpEvent->Data[len];
+       //pu1Temp = (u8 *)&pRetPar[0];
+       //*pu1Temp = scanType;
+       pEvent->Data[len] = scanType;
+       len += 1;
+
+       pEvent->Length = len;
+
+       //total tx event length + EventCode length + sizeof(length)
+       tx_event_length = pEvent->Length + 2;
+#if 0
+       rtw_btcoex_dump_tx_msg((u8 *)pEvent, tx_event_length, "WIFI SCAN OPERATION");
+#endif 
+       rtw_btcoex_sendmsgbysocket(padapter, (u8 *)pEvent, tx_event_length, _FALSE);
+}
+#endif //CONFIG_BT_COEXIST_SOCKET_TRX
 #endif // CONFIG_BT_COEXIST
 
index 6ed8f22..e6309a8 100755 (executable)
@@ -20,7 +20,6 @@
 #define _RTW_CMD_C_
 
 #include <drv_types.h>
-
 /*
 Caller and the rtw_cmd_thread can protect cmd_q by spin_lock.
 No irqsave is necessary.
@@ -651,8 +650,8 @@ post_process:
                _enter_critical_mutex(&(pcmd->padapter->cmdpriv.sctx_mutex), NULL);
                if (pcmd->sctx) {
                        if (0)
-                       DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" pcmd->sctx\n",
-                               FUNC_ADPT_ARG(pcmd->padapter));
+                               DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" pcmd->sctx\n",
+                                       FUNC_ADPT_ARG(pcmd->padapter));
                        if (pcmd->res == H2C_SUCCESS)
                                rtw_sctx_done(&pcmd->sctx);
                        else
@@ -912,8 +911,8 @@ _func_enter_;
                                _rtw_memcpy(&psurveyPara->ssid[i], &ssid[i], sizeof(NDIS_802_11_SSID));
                                psurveyPara->ssid_num++;
                                if (0)
-                               DBG_871X(FUNC_ADPT_FMT" ssid:(%s, %d)\n", FUNC_ADPT_ARG(padapter),
-                                       psurveyPara->ssid[i].Ssid, psurveyPara->ssid[i].SsidLength);
+                                       DBG_871X(FUNC_ADPT_FMT" ssid:(%s, %d)\n", FUNC_ADPT_ARG(padapter),
+                                               psurveyPara->ssid[i].Ssid, psurveyPara->ssid[i].SsidLength);
                        }
                }
        }
@@ -926,8 +925,8 @@ _func_enter_;
                                _rtw_memcpy(&psurveyPara->ch[i], &ch[i], sizeof(struct rtw_ieee80211_channel));
                                psurveyPara->ch_num++;
                                if (0)
-                               DBG_871X(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter),
-                                       psurveyPara->ch[i].hw_value);
+                                       DBG_871X(FUNC_ADPT_FMT" ch:%u\n", FUNC_ADPT_ARG(padapter),
+                                               psurveyPara->ch[i].hw_value);
                        }
                }
        }
@@ -942,11 +941,16 @@ _func_enter_;
 
 #ifdef CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
                if((padapter->pbuddy_adapter->mlmeextpriv.mlmext_info.state&0x03) == WIFI_FW_AP_STATE)
-                       _set_timer(&pmlmepriv->scan_to_timer, SURVEY_TO * 
-                                               ( padapter->mlmeextpriv.max_chan_nums + ( padapter->mlmeextpriv.max_chan_nums / RTW_SCAN_NUM_OF_CH ) * RTW_STAY_AP_CH_MILLISECOND ) + 1000 );
+               {
+                       if(IsSupported5G(padapter->registrypriv.wireless_mode) 
+                               && IsSupported24G(padapter->registrypriv.wireless_mode)) //dual band
+                               mlme_set_scan_to_timer(pmlmepriv, CONC_SCANNING_TIMEOUT_DUAL_BAND);
+                       else //single band
+                               mlme_set_scan_to_timer(pmlmepriv, CONC_SCANNING_TIMEOUT_SINGLE_BAND);
+               }               
                else
 #endif //CONFIG_STA_MODE_SCAN_UNDER_AP_MODE
-                       _set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT);
+                       mlme_set_scan_to_timer(pmlmepriv, SCANNING_TIMEOUT);
 
                rtw_led_control(padapter, LED_CTL_SITE_SURVEY);
        } else {
@@ -1437,6 +1441,7 @@ _func_enter_;
                        case Ndis802_11APMode:
                        case Ndis802_11AutoUnknown:
                        case Ndis802_11InfrastructureMax:
+                       case Ndis802_11Monitor:
                                break;
 
                }
@@ -1667,7 +1672,7 @@ _func_exit_;
        return res;
 }
 
-u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 unicast_key, bool enqueue)
+u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool enqueue)
 {
        struct cmd_obj*                 ph2c;
        struct set_stakey_parm  *psetstakey_para;
@@ -1689,27 +1694,23 @@ _func_enter_;
        _rtw_memcpy(psetstakey_para->addr, sta->hwaddr,ETH_ALEN);
                
        if(check_fwstate(pmlmepriv, WIFI_STATION_STATE)){
-#ifdef CONFIG_TDLS             
-               if(sta->tdls_sta_state&TDLS_LINKED_STATE)
-                       psetstakey_para->algorithm=(u8)sta->dot118021XPrivacy;
-               else
-#endif //CONFIG_TDLS
                        psetstakey_para->algorithm =(unsigned char) psecuritypriv->dot11PrivacyAlgrthm;
        }else{
                GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, _FALSE);
        }
 
-       if (unicast_key == _TRUE) {
+       if (key_type == GROUP_KEY) {
+               _rtw_memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16);
+       }
+       else if (key_type == UNICAST_KEY) {
+               _rtw_memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16);
+       }
 #ifdef CONFIG_TDLS
-               if((sta->tdls_sta_state&TDLS_LINKED_STATE)==TDLS_LINKED_STATE)
+       else if(key_type == TDLS_KEY){
                        _rtw_memcpy(&psetstakey_para->key, sta->tpk.tk, 16);
-               else
-#endif //CONFIG_TDLS
-                       _rtw_memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16);
-       }
-       else {
-               _rtw_memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16);
+               psetstakey_para->algorithm=(u8)sta->dot118021XPrivacy;
        }
+#endif /* CONFIG_TDLS */
 
        //jeff: set this becasue at least sw key is ready
        padapter->securitypriv.busetkipkey=_TRUE;
@@ -2318,7 +2319,8 @@ _func_enter_;
        }
 
        _rtw_spinlock(&(padapter->tdlsinfo.cmd_lock));
-       _rtw_memcpy(TDLSoption->addr, addr, 6); 
+       if (addr != NULL)
+               _rtw_memcpy(TDLSoption->addr, addr, 6);
        TDLSoption->option = option;
        _rtw_spinunlock(&(padapter->tdlsinfo.cmd_lock));
        init_h2fwcmd_w_parm_no_rsp(pcmdobj, TDLSoption, GEN_CMD_CODE(_TDLS));
@@ -2458,8 +2460,8 @@ u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer)
                
 #ifdef CONFIG_TDLS
 #ifdef CONFIG_TDLS_AUTOSETUP
-               if( ( ptdlsinfo->watchdog_count % TDLS_WATCHDOG_PERIOD ) == 0 ) //10 * 2sec, periodically sending
-               {
+               /* TDLS_WATCHDOG_PERIOD * 2sec, periodically send */
+               if ((ptdlsinfo->watchdog_count % TDLS_WATCHDOG_PERIOD ) == 0) {
                        _rtw_memcpy(txmgmt.peer, baddr, ETH_ALEN);
                        issue_tdls_dis_req( padapter, &txmgmt );
                }
@@ -2477,7 +2479,10 @@ u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer)
 #endif //CONFIG_LPS_SLOW_TRANSITION
                        )
                {
-                       //DBG_871X("(-)Tx = %d, Rx = %d \n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod);
+#ifdef DBG_RX_COUNTER_DUMP
+                       if( padapter->dump_rx_cnt_mode & DUMP_DRV_TRX_COUNTER_DATA)
+                               DBG_871X("(-)Tx = %d, Rx = %d \n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod);
+#endif 
                        bEnterPS= _FALSE;
 #ifdef CONFIG_LPS_SLOW_TRANSITION
                        if(bBusyTraffic == _TRUE)
@@ -2499,7 +2504,10 @@ u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer)
                }
                else
                {
-                       //DBG_871X("(+)Tx = %d, Rx = %d \n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod);
+#ifdef DBG_RX_COUNTER_DUMP             
+                       if( padapter->dump_rx_cnt_mode & DUMP_DRV_TRX_COUNTER_DATA)
+                               DBG_871X("(+)Tx = %d, Rx = %d \n",pmlmepriv->LinkDetectInfo.NumTxOkInPeriod,pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod);
+#endif                 
 #ifdef CONFIG_LPS_SLOW_TRANSITION
                        if(pmlmepriv->LinkDetectInfo.TrafficTransitionCount>=2)
                                pmlmepriv->LinkDetectInfo.TrafficTransitionCount -=2;
@@ -2627,8 +2635,11 @@ void dynamic_chk_wk_hdl(_adapter *padapter)
 
        //if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING|_FW_UNDER_SURVEY)==_FALSE)
        {
-               linked_status_chk(padapter, 0); 
+               linked_status_chk(padapter, 0);
                traffic_status_watchdog(padapter, 0);
+               #ifdef DBG_RX_COUNTER_DUMP
+               rtw_dump_rx_counters(padapter);
+               #endif
                dm_DynamicUsbTxAgg(padapter, 0);
        }
 
@@ -3282,35 +3293,39 @@ void btinfo_evt_dump(void *sel, void *buf)
        DBG_871X_SEL_NL(sel, "cid:0x%02x, len:%u\n", info->cid, info->len);
 
        if (info->len > 2)
-       DBG_871X_SEL_NL(sel, "byte2:%s%s%s%s%s%s%s%s\n"
-               , info->bConnection?"bConnection ":""
-               , info->bSCOeSCO?"bSCOeSCO ":""
-               , info->bInQPage?"bInQPage ":""
-               , info->bACLBusy?"bACLBusy ":""
-               , info->bSCOBusy?"bSCOBusy ":""
-               , info->bHID?"bHID ":""
-               , info->bA2DP?"bA2DP ":""
-               , info->bFTP?"bFTP":""
-       );
+               DBG_871X_SEL_NL(sel, "byte2:%s%s%s%s%s%s%s%s\n"
+                       , info->bConnection?"bConnection ":""
+                       , info->bSCOeSCO?"bSCOeSCO ":""
+                       , info->bInQPage?"bInQPage ":""
+                       , info->bACLBusy?"bACLBusy ":""
+                       , info->bSCOBusy?"bSCOBusy ":""
+                       , info->bHID?"bHID ":""
+                       , info->bA2DP?"bA2DP ":""
+                       , info->bFTP?"bFTP":""
+               );
 
        if (info->len > 3)
-       DBG_871X_SEL_NL(sel, "retry_cnt:%u\n", info->retry_cnt);
+               DBG_871X_SEL_NL(sel, "retry_cnt:%u\n", info->retry_cnt);
 
        if (info->len > 4)
-       DBG_871X_SEL_NL(sel, "rssi:%u\n", info->rssi);
+               DBG_871X_SEL_NL(sel, "rssi:%u\n", info->rssi);
 
        if (info->len > 5)
-       DBG_871X_SEL_NL(sel, "byte5:%s%s\n"
-               , info->eSCO_SCO?"eSCO_SCO ":""
-               , info->Master_Slave?"Master_Slave ":""
-       );
+               DBG_871X_SEL_NL(sel, "byte5:%s%s\n"
+                       , info->eSCO_SCO?"eSCO_SCO ":""
+                       , info->Master_Slave?"Master_Slave ":""
+               );
 }
 
 static void rtw_btinfo_hdl(_adapter *adapter, u8 *buf, u16 buf_len)
 {
        #define BTINFO_WIFI_FETCH 0x23
        #define BTINFO_BT_AUTO_RPT 0x27
+#ifdef CONFIG_BT_COEXIST_SOCKET_TRX
+       struct btinfo_8761ATV *info = (struct btinfo_8761ATV *)buf;
+#else //!CONFIG_BT_COEXIST_SOCKET_TRX
        struct btinfo *info = (struct btinfo *)buf;
+#endif //CONFIG_BT_COEXIST_SOCKET_TRX
        u8 cmd_idx;
        u8 len;
 
@@ -3325,14 +3340,23 @@ static void rtw_btinfo_hdl(_adapter *adapter, u8 *buf, u16 buf_len)
 
 //#define DBG_PROC_SET_BTINFO_EVT
 #ifdef DBG_PROC_SET_BTINFO_EVT
+#ifdef CONFIG_BT_COEXIST_SOCKET_TRX
+       DBG_871X("%s: btinfo[0]=%x,btinfo[1]=%x,btinfo[2]=%x,btinfo[3]=%x btinfo[4]=%x,btinfo[5]=%x,btinfo[6]=%x,btinfo[7]=%x\n"
+                               , __func__, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
+#else//!CONFIG_BT_COEXIST_SOCKET_TRX
        btinfo_evt_dump(RTW_DBGDUMP, info);
-#endif
+#endif //CONFIG_BT_COEXIST_SOCKET_TRX
+#endif // DBG_PROC_SET_BTINFO_EVT
 
        /* transform BT-FW btinfo to WiFI-FW C2H format and notify */
        if (cmd_idx == BTINFO_WIFI_FETCH)
                buf[1] = 0;
        else if (cmd_idx == BTINFO_BT_AUTO_RPT)
                buf[1] = 2;
+#ifdef CONFIG_BT_COEXIST_SOCKET_TRX
+       else if(0x01 == cmd_idx || 0x02 == cmd_idx)
+               buf[1] = buf[0];
+#endif //CONFIG_BT_COEXIST_SOCKET_TRX
        rtw_btcoex_BtInfoNotify(adapter ,len+1, &buf[1]);
 }
 
@@ -3379,7 +3403,7 @@ u8 rtw_btinfo_cmd(_adapter *adapter, u8 *buf, u16 len)
 exit:
        return res;
 }
-#endif
+#endif //CONFIG_BT_COEXIST
 
 //#ifdef CONFIG_C2H_PACKET_EN
 u8 rtw_c2h_packet_wk_cmd(PADAPTER padapter, u8 *pbuf, u16 length)
@@ -3536,6 +3560,9 @@ static void c2h_wk_callback(_workitem *work)
                                rtw_mfree(c2h_evt, 16);
                                continue;
                        }
+               } else {
+                       rtw_warn_on(1);
+                       continue;
                }
 
                /* Special pointer to trigger c2h_evt_clear only */
@@ -3676,10 +3703,10 @@ _func_enter_;
        {
                //TODO: cancel timer and do timeout handler directly...
                //need to make timeout handlerOS independent
-               _set_timer(&pmlmepriv->scan_to_timer, 1);
+               mlme_set_scan_to_timer(pmlmepriv, 1);
        }
        else if (pcmd->res != H2C_SUCCESS) {
-               _set_timer(&pmlmepriv->scan_to_timer, 1);
+               mlme_set_scan_to_timer(pmlmepriv, 1);
                RT_TRACE(_module_rtl871x_cmd_c_,_drv_err_,("\n ********Error: MgntActrtw_set_802_11_bssid_LIST_SCAN Fail ************\n\n."));
        } 
 
index 72cad73..ab58df1 100755 (executable)
@@ -60,6 +60,10 @@ u32 GlobalDebugLevel = _drv_err_;
 
 #include <rtw_version.h>
 
+#ifdef CONFIG_TDLS
+#define TDLS_DBG_INFO_SPACE_BTWN_ITEM_AND_VALUE        41
+#endif
+
 void dump_drv_version(void *sel)
 {
        DBG_871X_SEL_NL(sel, "%s %s\n", DRV_NAME, DRIVERVERSION);
@@ -105,6 +109,19 @@ void mac_reg_dump(void *sel, _adapter *adapter)
                if((j++)%4 == 0)
                        DBG_871X_SEL(sel, "\n");
        }
+       
+#ifdef CONFIG_RTL8814A
+       {
+               for(i=0x1000;i<0x1650;i+=4)
+               {
+                       if(j%4==1)
+                               DBG_871X_SEL_NL(sel, "0x%03x",i);
+                       DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter,i));
+                       if((j++)%4 == 0)
+                               DBG_871X_SEL(sel, "\n");
+               }
+       }
+#endif /* CONFIG_RTL8814A */
 }
 
 void bb_reg_dump(void *sel, _adapter *adapter)
@@ -154,7 +171,7 @@ void rf_reg_dump(void *sel, _adapter *adapter)
 static u8 fwdl_test_chksum_fail = 0;
 static u8 fwdl_test_wintint_rdy_fail = 0;
 
-bool rtw_fwdl_test_trigger_chksum_fail()
+bool rtw_fwdl_test_trigger_chksum_fail(void)
 {
        if (fwdl_test_chksum_fail) {
                DBG_871X_LEVEL(_drv_always_, "fwdl test case: trigger chksum_fail\n");
@@ -164,7 +181,7 @@ bool rtw_fwdl_test_trigger_chksum_fail()
        return _FALSE;
 }
 
-bool rtw_fwdl_test_trigger_wintint_rdy_fail()
+bool rtw_fwdl_test_trigger_wintint_rdy_fail(void)
 {
        if (fwdl_test_wintint_rdy_fail) {
                DBG_871X_LEVEL(_drv_always_, "fwdl test case: trigger wintint_rdy_fail\n");
@@ -176,11 +193,23 @@ bool rtw_fwdl_test_trigger_wintint_rdy_fail()
 
 static u32 g_wait_hiq_empty_ms = 0;
 
-u32 rtw_get_wait_hiq_empty_ms()
+u32 rtw_get_wait_hiq_empty_ms(void)
 {
        return g_wait_hiq_empty_ms;
 }
 
+static u8 del_rx_ampdu_test_no_tx_fail = 0;
+
+bool rtw_del_rx_ampdu_test_trigger_no_tx_fail(void)
+{
+       if (del_rx_ampdu_test_no_tx_fail) {
+               DBG_871X_LEVEL(_drv_always_, "del_rx_ampdu test case: trigger no_tx_fail\n");
+               del_rx_ampdu_test_no_tx_fail--;
+               return _TRUE;
+       }
+       return _FALSE;
+}
+
 void rtw_sink_rtp_seq_dbg( _adapter *adapter,_pkt *pkt)
 {
        struct recv_priv *precvpriv = &(adapter->recvpriv);
@@ -196,6 +225,21 @@ void rtw_sink_rtp_seq_dbg( _adapter *adapter,_pkt *pkt)
        }
 }
 
+void sta_rx_reorder_ctl_dump(void *sel, struct sta_info *sta)
+{
+       struct recv_reorder_ctrl *reorder_ctl;
+       int i;
+
+       for (i = 0; i < 16; i++) {
+               reorder_ctl = &sta->recvreorder_ctrl[i];
+               if (reorder_ctl->ampdu_size != RX_AMPDU_SIZE_INVALID || reorder_ctl->indicate_seq != 0xFFFF) {
+                       DBG_871X_SEL_NL(sel, "tid=%d, enable=%d, ampdu_size=%u, indicate_seq=%u\n"
+                               , i, reorder_ctl->enable, reorder_ctl->ampdu_size, reorder_ctl->indicate_seq
+                       );
+               }
+       }
+}
+
 #ifdef CONFIG_PROC_DEBUG
 ssize_t proc_set_write_reg(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
 {
@@ -593,16 +637,8 @@ int proc_get_ap_info(struct seq_file *m, void *v)
                DBG_871X_SEL_NL(m, "vht_ldpc_cap=0x%x, vht_stbc_cap=0x%x, vht_beamform_cap=0x%x\n", psta->vhtpriv.ldpc_cap, psta->vhtpriv.stbc_cap, psta->vhtpriv.beamform_cap);
                DBG_871X_SEL_NL(m, "vht_mcs_map=0x%x, vht_highest_rate=0x%x, vht_ampdu_len=%d\n", *(u16*)psta->vhtpriv.vht_mcs_map, psta->vhtpriv.vht_highest_rate, psta->vhtpriv.ampdu_len);
 #endif
-                                       
-               for(i=0;i<16;i++)
-               {                                                       
-                       preorder_ctrl = &psta->recvreorder_ctrl[i];
-                       if(preorder_ctrl->enable)
-                       {
-                               DBG_871X_SEL_NL(m, "tid=%d, indicate_seq=%d\n", i, preorder_ctrl->indicate_seq);
-                       }
-               }       
-                                                       
+
+               sta_rx_reorder_ctl_dump(m, psta);
        }
        else
        {                                                       
@@ -628,6 +664,27 @@ int proc_get_adapter_state(struct seq_file *m, void *v)
 
        return 0;
 }
+
+ssize_t proc_reset_trx_info(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
+{
+       struct net_device *dev = data;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       struct dvobj_priv *psdpriv = padapter->dvobj;
+       struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
+       char cmd[32];
+       if (buffer && !copy_from_user(cmd, buffer, sizeof(cmd))) {
+               if('0' == cmd[0]){
+                       pdbgpriv->dbg_rx_ampdu_drop_count = 0;
+                       pdbgpriv->dbg_rx_ampdu_forced_indicate_count = 0;
+                       pdbgpriv->dbg_rx_ampdu_loss_count = 0;
+                       pdbgpriv->dbg_rx_dup_mgt_frame_drop_count = 0;
+                       pdbgpriv->dbg_rx_ampdu_window_shift_cnt = 0;
+                       pdbgpriv->dbg_rx_conflic_mac_addr_cnt = 0;
+               }
+       }
+
+       return count;
+}
        
 int proc_get_trx_info(struct seq_file *m, void *v)
 {
@@ -636,6 +693,8 @@ int proc_get_trx_info(struct seq_file *m, void *v)
        _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
        struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
        struct recv_priv  *precvpriv = &padapter->recvpriv;
+       struct dvobj_priv *psdpriv = padapter->dvobj;
+       struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
        struct hw_xmit *phwxmit;
 
        dump_os_queue(m, padapter);
@@ -657,6 +716,17 @@ int proc_get_trx_info(struct seq_file *m, void *v)
        DBG_871X_SEL_NL(m, "rx_urb_pending_cn=%d\n", ATOMIC_READ(&(precvpriv->rx_pending_cnt)));
 #endif
 
+       //Folowing are RX info
+       //Counts of packets whose seq_num is less than preorder_ctrl->indicate_seq, Ex delay, retransmission, redundant packets and so on
+       DBG_871X_SEL_NL(m,"Rx: Counts of Packets Whose Seq_Num Less Than Reorder Control Seq_Num: %llu\n",(unsigned long long)pdbgpriv->dbg_rx_ampdu_drop_count);
+       //How many times the Rx Reorder Timer is triggered.
+       DBG_871X_SEL_NL(m,"Rx: Reorder Time-out Trigger Counts: %llu\n",(unsigned long long)pdbgpriv->dbg_rx_ampdu_forced_indicate_count);
+       //Total counts of packets loss
+       DBG_871X_SEL_NL(m,"Rx: Packet Loss Counts: %llu\n",(unsigned long long)pdbgpriv->dbg_rx_ampdu_loss_count);
+       DBG_871X_SEL_NL(m,"Rx: Duplicate Management Frame Drop Count: %llu\n",(unsigned long long)pdbgpriv->dbg_rx_dup_mgt_frame_drop_count);
+       DBG_871X_SEL_NL(m,"Rx: AMPDU BA window shift Count: %llu\n",(unsigned long long)pdbgpriv->dbg_rx_ampdu_window_shift_cnt);
+       /*The same mac addr counts*/
+       DBG_871X_SEL_NL(m, "Rx: Conflict MAC Address Frames Count: %llu\n", (unsigned long long)pdbgpriv->dbg_rx_conflic_mac_addr_cnt);
        return 0;
 }
 
@@ -704,7 +774,7 @@ int proc_get_rate_ctl(struct seq_file *m, void *v)
                data_fb = adapter->data_fb?1:0;
                DBG_871X_SEL_NL(m, "FIXED %s%s%s\n"
                        , HDATA_RATE(data_rate)
-                       , sgi?" SGI":" LGI"
+                       , data_rate>DESC_RATE54M?(sgi?" SGI":" LGI"):""
                        , data_fb?" FB":""
                );
                DBG_871X_SEL_NL(m, "0x%02x %u\n", adapter->fix_rate, adapter->data_fb);
@@ -738,7 +808,43 @@ ssize_t proc_set_rate_ctl(struct file *file, const char __user *buffer, size_t c
 
        return count;
 }
+#ifdef DBG_RX_COUNTER_DUMP
+int proc_get_rx_cnt_dump(struct seq_file *m, void *v)
+{
+       struct net_device *dev = m->private;
+       int i;
+       _adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
+
+       DBG_871X_SEL_NL(m, "BIT0- Dump RX counters of DRV \n");
+       DBG_871X_SEL_NL(m, "BIT1- Dump RX counters of MAC \n");
+       DBG_871X_SEL_NL(m, "BIT2- Dump RX counters of PHY \n");
+       DBG_871X_SEL_NL(m, "BIT3- Dump TRX data frame of DRV \n");
+       DBG_871X_SEL_NL(m, "dump_rx_cnt_mode = 0x%02x \n", adapter->dump_rx_cnt_mode);
+
+       return 0;
+}
+ssize_t proc_set_rx_cnt_dump(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
+{
+       struct net_device *dev = data;
+       _adapter *adapter = (_adapter *)rtw_netdev_priv(dev);
+       char tmp[32];
+       u8 dump_rx_cnt_mode;
+
+       if (count < 1)
+               return -EFAULT;
 
+       if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {              
+
+               int num = sscanf(tmp, "%hhx", &dump_rx_cnt_mode);
+
+               rtw_dump_phy_rxcnts_preprocess(adapter,dump_rx_cnt_mode);
+               adapter->dump_rx_cnt_mode = dump_rx_cnt_mode;
+               
+       }
+
+       return count;
+}
+#endif
 ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
 {
        struct net_device *dev = data;
@@ -755,6 +861,22 @@ ssize_t proc_set_fwdl_test_case(struct file *file, const char __user *buffer, si
        return count;
 }
 
+ssize_t proc_set_del_rx_ampdu_test_case(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
+{
+       struct net_device *dev = data;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       char tmp[32];
+       int num;
+
+       if (count < 1)
+               return -EFAULT;
+
+       if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
+               num = sscanf(tmp, "%hhu", &del_rx_ampdu_test_no_tx_fail);
+
+       return count;
+}
+
 ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
 {
        struct net_device *dev = data;
@@ -1096,9 +1218,11 @@ int proc_get_rx_signal(struct seq_file *m, void *v)
        //DBG_871X_SEL_NL(m, "rxpwdb:%d\n", padapter->recvpriv.rxpwdb);
        DBG_871X_SEL_NL(m, "signal_strength:%u\n", padapter->recvpriv.signal_strength);
        DBG_871X_SEL_NL(m, "signal_qual:%u\n", padapter->recvpriv.signal_qual);
+
+       rtw_get_noise(padapter);
        DBG_871X_SEL_NL(m, "noise:%d\n", padapter->recvpriv.noise);
-       rtw_odm_get_perpkt_rssi(m,padapter);
        #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA
+       rtw_odm_get_perpkt_rssi(m,padapter);
        rtw_get_raw_rssi_info(m,padapter);
        #endif
        return 0;
@@ -1261,14 +1385,24 @@ int proc_get_rx_ampdu(struct seq_file *m, void *v)
 {
        struct net_device *dev = m->private;
        _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
-       struct registry_priv    *pregpriv = &padapter->registrypriv;
-       struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
-       struct mlme_ext_info    *pmlmeinfo = &(pmlmeext->mlmext_info);
 
-       if(pregpriv)
-               DBG_871X_SEL_NL(m,
-                       "bAcceptAddbaReq = %d , 0:Reject AP's Add BA req, 1:Accept AP's Add BA req.\n", pmlmeinfo->bAcceptAddbaReq
-                       );
+       DBG_871X_SEL(m, "accept: ");
+       if (padapter->fix_rx_ampdu_accept == RX_AMPDU_ACCEPT_INVALID)
+               DBG_871X_SEL_NL(m, "%u%s\n", rtw_rx_ampdu_is_accept(padapter), "(auto)");
+       else
+               DBG_871X_SEL_NL(m, "%u%s\n", padapter->fix_rx_ampdu_accept, "(fixed)");
+
+       DBG_871X_SEL(m, "size: ");
+       if (padapter->fix_rx_ampdu_size == RX_AMPDU_SIZE_INVALID)
+               DBG_871X_SEL_NL(m, "%u%s\n", rtw_rx_ampdu_size(padapter), "(auto)");
+       else
+               DBG_871X_SEL_NL(m, "%u%s\n", padapter->fix_rx_ampdu_size, "(fixed)");
+
+       DBG_871X_SEL_NL(m, "%19s %17s\n", "fix_rx_ampdu_accept", "fix_rx_ampdu_size");
+
+       DBG_871X_SEL(m, "%-19d %-17u\n"
+               , padapter->fix_rx_ampdu_accept
+               , padapter->fix_rx_ampdu_size);
 
        return 0;
 }
@@ -1281,28 +1415,25 @@ ssize_t proc_set_rx_ampdu(struct file *file, const char __user *buffer, size_t c
        struct mlme_ext_priv    *pmlmeext = &padapter->mlmeextpriv;
        struct mlme_ext_info    *pmlmeinfo = &(pmlmeext->mlmext_info);
        char tmp[32];
-       u32 mode;
+       u8 accept;
+       u8 size;
 
        if (count < 1)
                return -EFAULT;
 
-       if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {              
+       if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
 
-               int num = sscanf(tmp, "%d ", &mode);
+               int num = sscanf(tmp, "%hhu %hhu", &accept, &size);
 
-               if( pregpriv && mode < 2 )
-               {
-                       pmlmeinfo->bAcceptAddbaReq = mode;
-                       DBG_871X("pmlmeinfo->bAcceptAddbaReq=%d \n",pmlmeinfo->bAcceptAddbaReq);
-                       if(mode == 0)
-                       {
-                               //tear down Rx AMPDU
-                               send_delba(padapter, 0, get_my_bssid(&(pmlmeinfo->network)));// recipient
-                       }
-               }
+               if (num >= 1)
+                       rtw_rx_ampdu_set_accept(padapter, accept, RX_AMPDU_DRV_FIXED);
+               if (num >= 2)
+                       rtw_rx_ampdu_set_size(padapter, size, RX_AMPDU_DRV_FIXED);
 
+               rtw_rx_ampdu_apply(padapter);
        }
 
+exit:
        return count;
 }
 int proc_get_rx_ampdu_factor(struct seq_file *m, void *v)
@@ -1588,9 +1719,8 @@ int proc_get_all_sta_info(struct seq_file *m, void *v)
        struct sta_info *psta;
        _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
        struct sta_priv *pstapriv = &padapter->stapriv;
-       int i, j;
+       int i;
        _list   *plist, *phead;
-       struct recv_reorder_ctrl *preorder_ctrl;
 
        DBG_871X_SEL_NL(m, "sta_dz_bitmap=0x%x, tim_bitmap=0x%x\n", pstapriv->sta_dz_bitmap, pstapriv->tim_bitmap);
 
@@ -1632,15 +1762,8 @@ int proc_get_all_sta_info(struct seq_file *m, void *v)
                                DBG_871X_SEL_NL(m, "wpa2_pairwise_cipher=0x%x\n", psta->wpa2_pairwise_cipher);
                                DBG_871X_SEL_NL(m, "qos_info=0x%x\n", psta->qos_info);
                                DBG_871X_SEL_NL(m, "dot118021XPrivacy=0x%x\n", psta->dot118021XPrivacy);
-                                                               
-                               for(j=0;j<16;j++)
-                               {                                                       
-                                       preorder_ctrl = &psta->recvreorder_ctrl[j];
-                                       if(preorder_ctrl->enable)
-                                       {
-                                               DBG_871X_SEL_NL(m, "tid=%d, indicate_seq=%d\n", j, preorder_ctrl->indicate_seq);
-                                       }
-                               }
+
+                               sta_rx_reorder_ctl_dump(m, psta);
 
 #ifdef CONFIG_TDLS
                                DBG_871X_SEL_NL(m, "tdls_sta_state=0x%08x\n", psta->tdls_sta_state);
@@ -2040,5 +2163,538 @@ ssize_t proc_set_new_bcn_max(struct file *file, const char __user *buffer, size_
 
        return count;
 }
+
+#ifdef CONFIG_POWER_SAVING
+int proc_get_ps_info(struct seq_file *m, void *v)
+{      
+       struct net_device *dev = m->private;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
+       u8 ips_mode = pwrpriv->ips_mode;
+       u8 lps_mode = pwrpriv->power_mgnt;
+       char *str = "";
+
+       DBG_871X_SEL_NL(m, "======Power Saving Info:======\n");
+       DBG_871X_SEL_NL(m, "*IPS:\n");
+
+       if (ips_mode == IPS_NORMAL) {
+#ifdef CONFIG_FWLPS_IN_IPS
+               str = "FW_LPS_IN_IPS";
+#else
+               str = "Card Disable";
+#endif
+       } else if (ips_mode == IPS_NONE) {
+               str = "NO IPS";
+       } else if (ips_mode == IPS_LEVEL_2) {
+               str = "IPS_LEVEL_2";
+       } else {
+               str = "invalid ips_mode";
+       }
+
+       DBG_871X_SEL_NL(m, " IPS mode: %s\n", str);
+       DBG_871X_SEL_NL(m, " IPS enter count:%d, IPS leave count:%d\n",
+                       pwrpriv->ips_enter_cnts, pwrpriv->ips_leave_cnts);
+       DBG_871X_SEL_NL(m, "------------------------------\n");
+       DBG_871X_SEL_NL(m, "*LPS:\n");
+
+       if (lps_mode == PS_MODE_ACTIVE) {
+               str = "NO LPS";
+       } else if (lps_mode == PS_MODE_MIN) {
+               str = "MIN";
+       } else if (lps_mode == PS_MODE_MAX) {
+               str = "MAX";
+       } else if (lps_mode == PS_MODE_DTIM) {
+               str = "DTIM";
+       } else {
+               sprintf(str, "%d", lps_mode);
+       }
+
+       DBG_871X_SEL_NL(m, " LPS mode: %s\n", str);
+
+       if (pwrpriv->dtim != 0)
+               DBG_871X_SEL_NL(m, " DTIM: %d\n", pwrpriv->dtim);
+       DBG_871X_SEL_NL(m, " LPS enter count:%d, LPS leave count:%d\n",
+                       pwrpriv->lps_enter_cnts, pwrpriv->lps_leave_cnts);
+       DBG_871X_SEL_NL(m, "=============================\n");
+       return 0;
+}
+#endif //CONFIG_POWER_SAVING
+
+#ifdef CONFIG_TDLS
+static int proc_tdls_display_tdls_function_info(struct seq_file *m)
+{
+       struct net_device *dev = m->private;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+       u8 SpaceBtwnItemAndValue = TDLS_DBG_INFO_SPACE_BTWN_ITEM_AND_VALUE;
+       u8 SpaceBtwnItemAndValueTmp = 0;
+       BOOLEAN FirstMatchFound = _FALSE;
+       int j= 0;
+       
+       DBG_871X_SEL_NL(m, "============[TDLS Function Info]============\n");
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Prohibited", (ptdlsinfo->ap_prohibited == _TRUE) ? "_TRUE" : "_FALSE");
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Channel Switch Prohibited", (ptdlsinfo->ch_switch_prohibited == _TRUE) ? "_TRUE" : "_FALSE");
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Link Established", (ptdlsinfo->link_established == _TRUE) ? "_TRUE" : "_FALSE");
+       DBG_871X_SEL_NL(m, "%-*s = %d/%d\n", SpaceBtwnItemAndValue, "TDLS STA Num (Linked/Allowed)", ptdlsinfo->sta_cnt, MAX_ALLOWED_TDLS_STA_NUM);
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Allowed STA Num Reached", (ptdlsinfo->sta_maximum == _TRUE) ? "_TRUE" : "_FALSE");
+
+#ifdef CONFIG_TDLS_CH_SW
+       DBG_871X_SEL_NL(m, "%-*s =", SpaceBtwnItemAndValue, "TDLS CH SW State");
+       if (ptdlsinfo->chsw_info.ch_sw_state == TDLS_STATE_NONE)
+       {
+               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_STATE_NONE");
+       }
+       else
+       {
+               for (j = 0; j < 32; j++)
+               {
+                       if (ptdlsinfo->chsw_info.ch_sw_state & BIT(j))
+                       {
+                               if (FirstMatchFound ==  _FALSE)
+                               {
+                                       SpaceBtwnItemAndValueTmp = 1;
+                                       FirstMatchFound = _TRUE;
+                               }
+                               else
+                               {
+                                       SpaceBtwnItemAndValueTmp = SpaceBtwnItemAndValue + 3;
+                               }
+                               switch (BIT(j))
+                               {
+                                       case TDLS_INITIATOR_STATE:
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_INITIATOR_STATE");
+                                               break;
+                                       case TDLS_RESPONDER_STATE:
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_RESPONDER_STATE");
+                                               break;
+                                       case TDLS_LINKED_STATE:
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_LINKED_STATE");
+                                               break;
+                                       case TDLS_WAIT_PTR_STATE:               
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_WAIT_PTR_STATE");
+                                               break;
+                                       case TDLS_ALIVE_STATE:          
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_ALIVE_STATE");
+                                               break;
+                                       case TDLS_CH_SWITCH_ON_STATE:   
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_CH_SWITCH_ON_STATE");
+                                               break;
+                                       case TDLS_PEER_AT_OFF_STATE:            
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_PEER_AT_OFF_STATE");
+                                               break;
+                                       case TDLS_CH_SW_INITIATOR_STATE:                
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_CH_SW_INITIATOR_STATE");
+                                               break;
+                                       case TDLS_WAIT_CH_RSP_STATE:            
+                                               DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValue, " ", "TDLS_WAIT_CH_RSP_STATE");
+                                               break;
+                                       default:
+                                               DBG_871X_SEL_NL(m, "%-*sBIT(%d)\n", SpaceBtwnItemAndValueTmp, " ", j);
+                                               break;
+                               }
+                       }
+               }
+       }
+
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS CH SW On", (ATOMIC_READ(&ptdlsinfo->chsw_info.chsw_on) == _TRUE) ? "_TRUE" : "_FALSE");
+       DBG_871X_SEL_NL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Off-Channel Num", ptdlsinfo->chsw_info.off_ch_num);
+       DBG_871X_SEL_NL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Channel Offset", ptdlsinfo->chsw_info.ch_offset);
+       DBG_871X_SEL_NL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Current Time", ptdlsinfo->chsw_info.cur_time);
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS CH SW Delay Switch Back", (ptdlsinfo->chsw_info.delay_switch_back == _TRUE) ? "_TRUE" : "_FALSE");
+       DBG_871X_SEL_NL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Dump Back", ptdlsinfo->chsw_info.dump_stack);
+#endif
+
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Device Discovered", (ptdlsinfo->dev_discovered == _TRUE) ? "_TRUE" : "_FALSE");
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Enable", (ptdlsinfo->tdls_enable == _TRUE) ? "_TRUE" : "_FALSE");
+       DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS Driver Setup", (ptdlsinfo->driver_setup == _TRUE) ? "_TRUE" : "_FALSE");
+       
+       return 0;
+}
+
+static int proc_tdls_display_network_info(struct seq_file *m)
+{
+       struct net_device *dev = m->private;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+       struct wlan_network *cur_network = &(pmlmepriv->cur_network);
+       int i = 0;
+       u8 SpaceBtwnItemAndValue = TDLS_DBG_INFO_SPACE_BTWN_ITEM_AND_VALUE;
+
+       /* Display the linked AP/GO info */
+       DBG_871X_SEL_NL(m, "============[Associated AP/GO Info]============\n");
+       
+       if ((pmlmepriv->fw_state & WIFI_STATION_STATE) && (pmlmepriv->fw_state & _FW_LINKED))
+       {
+               DBG_871X_SEL_NL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "BSSID", cur_network->network.Ssid.Ssid);
+               DBG_871X_SEL_NL(m, "%-*s = "MAC_FMT"\n", SpaceBtwnItemAndValue, "Mac Address", MAC_ARG(cur_network->network.MacAddress));
+               
+               DBG_871X_SEL_NL(m, "%-*s = ", SpaceBtwnItemAndValue, "Wireless Mode");
+               for (i = 0; i < 8; i++)
+               {
+                       if (pmlmeext->cur_wireless_mode & BIT(i))
+                       {
+                               switch (BIT(i))
+                               {
+                                       case WIRELESS_11B: 
+                                               DBG_871X_SEL_NL(m, "%4s", "11B ");
+                                               break;
+                                       case WIRELESS_11G:
+                                               DBG_871X_SEL_NL(m, "%4s", "11G ");
+                                               break;
+                                       case WIRELESS_11A:
+                                               DBG_871X_SEL_NL(m, "%4s", "11A ");
+                                               break;
+                                       case WIRELESS_11_24N:
+                                               DBG_871X_SEL_NL(m, "%7s", "11_24N ");
+                                               break;
+                                       case WIRELESS_11_5N:
+                                               DBG_871X_SEL_NL(m, "%6s", "11_5N ");
+                                               break;
+                                       case WIRELESS_AUTO:
+                                               DBG_871X_SEL_NL(m, "%5s", "AUTO ");
+                                               break;
+                                       case WIRELESS_11AC:
+                                               DBG_871X_SEL_NL(m, "%5s", "11AC ");
+                                               break;
+                               }
+                       }
+               }
+               DBG_871X_SEL_NL(m, "\n");
+
+               DBG_871X_SEL_NL(m, "%-*s = ", SpaceBtwnItemAndValue, "Privacy");
+               switch (padapter->securitypriv.dot11PrivacyAlgrthm)
+               {
+                       case _NO_PRIVACY_:
+                               DBG_871X_SEL_NL(m, "%s\n", "NO PRIVACY");
+                               break;
+                       case _WEP40_:   
+                               DBG_871X_SEL_NL(m, "%s\n", "WEP 40");
+                               break;
+                       case _TKIP_:
+                               DBG_871X_SEL_NL(m, "%s\n", "TKIP");
+                               break;
+                       case _TKIP_WTMIC_:
+                               DBG_871X_SEL_NL(m, "%s\n", "TKIP WTMIC");
+                               break;
+                       case _AES_:                             
+                               DBG_871X_SEL_NL(m, "%s\n", "AES");
+                               break;
+                       case _WEP104_:
+                               DBG_871X_SEL_NL(m, "%s\n", "WEP 104");
+                               break;
+                       case _WEP_WPA_MIXED_:
+                               DBG_871X_SEL_NL(m, "%s\n", "WEP/WPA Mixed");
+                               break;
+                       case _SMS4_:
+                               DBG_871X_SEL_NL(m, "%s\n", "SMS4");
+                               break;
+#ifdef CONFIG_IEEE80211W
+                       case _BIP_:
+                               DBG_871X_SEL_NL(m, "%s\n", "BIP");
+                               break;  
+#endif //CONFIG_IEEE80211W
+               }
+               
+               DBG_871X_SEL_NL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "Channel", pmlmeext->cur_channel);
+               DBG_871X_SEL_NL(m, "%-*s = ", SpaceBtwnItemAndValue, "Channel Offset");
+               switch (pmlmeext->cur_ch_offset)
+               {
+                       case HAL_PRIME_CHNL_OFFSET_DONT_CARE:
+                               DBG_871X_SEL_NL(m, "%s\n", "N/A");
+                               break;
+                       case HAL_PRIME_CHNL_OFFSET_LOWER:
+                               DBG_871X_SEL_NL(m, "%s\n", "Lower");
+                               break;
+                       case HAL_PRIME_CHNL_OFFSET_UPPER:
+                               DBG_871X_SEL_NL(m, "%s\n", "Upper");
+                               break;
+               }
+               
+               DBG_871X_SEL_NL(m, "%-*s = ", SpaceBtwnItemAndValue, "Bandwidth Mode");
+               switch (pmlmeext->cur_bwmode)
+               {
+                       case CHANNEL_WIDTH_20:
+                               DBG_871X_SEL_NL(m, "%s\n", "20MHz");
+                               break;
+                       case CHANNEL_WIDTH_40:
+                               DBG_871X_SEL_NL(m, "%s\n", "40MHz");
+                               break;
+                       case CHANNEL_WIDTH_80:
+                               DBG_871X_SEL_NL(m, "%s\n", "80MHz");
+                               break;
+                       case CHANNEL_WIDTH_160:
+                               DBG_871X_SEL_NL(m, "%s\n", "160MHz");
+                               break;
+                       case CHANNEL_WIDTH_80_80:
+                               DBG_871X_SEL_NL(m, "%s\n", "80MHz + 80MHz");
+                               break;
+               }
+       }
+       else
+       {
+               DBG_871X_SEL_NL(m, "No association with AP/GO exists!\n");
+       }
+
+       return 0;
+}
+
+static int proc_tdls_display_tdls_sta_info(struct seq_file *m)
+{
+       struct net_device *dev = m->private;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       struct sta_priv *pstapriv = &padapter->stapriv;
+       struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+       struct sta_info *psta;
+       int i = 0, j = 0;
+       _irqL irqL;
+       _list   *plist, *phead;
+       u8 SpaceBtwnItemAndValue = TDLS_DBG_INFO_SPACE_BTWN_ITEM_AND_VALUE;
+       u8 SpaceBtwnItemAndValueTmp = 0;
+       u8 NumOfTdlsStaToShow = 0;
+       BOOLEAN FirstMatchFound = _FALSE;
+       
+       /* Search for TDLS sta info to display */
+       _enter_critical_bh(&pstapriv->sta_hash_lock, &irqL);
+       for (i=0; i< NUM_STA; i++)
+       {
+               phead = &(pstapriv->sta_hash[i]);
+               plist = get_next(phead);        
+               while ((rtw_end_of_queue_search(phead, plist)) == _FALSE)
+               {
+                               psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
+                               plist = get_next(plist);
+                               if (psta->tdls_sta_state != TDLS_STATE_NONE)
+                               {
+                                       /* We got one TDLS sta info to show */
+                                       DBG_871X_SEL_NL(m, "============[TDLS Peer STA Info: STA %d]============\n", ++NumOfTdlsStaToShow);
+                                       DBG_871X_SEL_NL(m, "%-*s = "MAC_FMT"\n", SpaceBtwnItemAndValue, "Mac Address", MAC_ARG(psta->hwaddr));
+                                       DBG_871X_SEL_NL(m, "%-*s =", SpaceBtwnItemAndValue, "TDLS STA State");
+                                       SpaceBtwnItemAndValueTmp = 0;
+                                       FirstMatchFound = _FALSE;
+                                       for (j = 0; j < 32; j++)
+                                       {
+                                               if (psta->tdls_sta_state & BIT(j))
+                                               {
+                                                       if (FirstMatchFound ==  _FALSE)
+                                                       {
+                                                               SpaceBtwnItemAndValueTmp = 1;
+                                                               FirstMatchFound = _TRUE;
+                                                       }
+                                                       else
+                                                       {
+                                                               SpaceBtwnItemAndValueTmp = SpaceBtwnItemAndValue + 3;
+                                                       }
+                                                       switch (BIT(j))
+                                                       {
+                                                               case TDLS_INITIATOR_STATE:
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_INITIATOR_STATE");
+                                                                       break;
+                                                               case TDLS_RESPONDER_STATE:
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_RESPONDER_STATE");
+                                                                       break;
+                                                               case TDLS_LINKED_STATE:
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_LINKED_STATE");
+                                                                       break;
+                                                               case TDLS_WAIT_PTR_STATE:               
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_WAIT_PTR_STATE");
+                                                                       break;
+                                                               case TDLS_ALIVE_STATE:          
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_ALIVE_STATE");
+                                                                       break;
+                                                               case TDLS_CH_SWITCH_ON_STATE:   
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_CH_SWITCH_ON_STATE");
+                                                                       break;
+                                                               case TDLS_PEER_AT_OFF_STATE:            
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_PEER_AT_OFF_STATE");
+                                                                       break;
+                                                               case TDLS_CH_SW_INITIATOR_STATE:                
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValueTmp, " ", "TDLS_CH_SW_INITIATOR_STATE");
+                                                                       break;
+                                                               case TDLS_WAIT_CH_RSP_STATE:            
+                                                                       DBG_871X_SEL_NL(m, "%-*s%s\n", SpaceBtwnItemAndValue, " ", "TDLS_WAIT_CH_RSP_STATE");
+                                                                       break;
+                                                               default:
+                                                                       DBG_871X_SEL_NL(m, "%-*sBIT(%d)\n", SpaceBtwnItemAndValueTmp, " ", j);
+                                                                       break;
+                                                       }
+                                               }
+                                       }
+
+                                       DBG_871X_SEL_NL(m, "%-*s = ", SpaceBtwnItemAndValue, "Wireless Mode");
+                                       for (j = 0; j < 8; j++)
+                                       {
+                                               if (psta->wireless_mode & BIT(j))
+                                               {
+                                                       switch (BIT(j))
+                                                       {
+                                                               case WIRELESS_11B: 
+                                                                       DBG_871X_SEL_NL(m, "%4s", "11B ");
+                                                                       break;
+                                                               case WIRELESS_11G:
+                                                                       DBG_871X_SEL_NL(m, "%4s", "11G ");
+                                                                       break;
+                                                               case WIRELESS_11A:
+                                                                       DBG_871X_SEL_NL(m, "%4s", "11A ");
+                                                                       break;
+                                                               case WIRELESS_11_24N:
+                                                                       DBG_871X_SEL_NL(m, "%7s", "11_24N ");
+                                                                       break;
+                                                               case WIRELESS_11_5N:
+                                                                       DBG_871X_SEL_NL(m, "%6s", "11_5N ");
+                                                                       break;
+                                                               case WIRELESS_AUTO:
+                                                                       DBG_871X_SEL_NL(m, "%5s", "AUTO ");
+                                                                       break;
+                                                               case WIRELESS_11AC:
+                                                                       DBG_871X_SEL_NL(m, "%5s", "11AC ");
+                                                                       break;
+                                                       }
+                                               }
+                                       }
+                                       DBG_871X_SEL_NL(m, "\n");
+
+                                       DBG_871X_SEL_NL(m, "%-*s = ", SpaceBtwnItemAndValue, "Bandwidth Mode");
+                                       switch (psta->bw_mode)
+                                       {
+                                               case CHANNEL_WIDTH_20:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "20MHz");
+                                                       break;
+                                               case CHANNEL_WIDTH_40:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "40MHz");
+                                                       break;
+                                               case CHANNEL_WIDTH_80:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "80MHz");
+                                                       break;
+                                               case CHANNEL_WIDTH_160:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "160MHz");
+                                                       break;
+                                               case CHANNEL_WIDTH_80_80:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "80MHz + 80MHz");
+                                                       break;
+                                       }
+
+                                       DBG_871X_SEL_NL(m, "%-*s = ", SpaceBtwnItemAndValue, "Privacy");
+                                       switch (psta->dot118021XPrivacy)
+                                       {
+                                               case _NO_PRIVACY_:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "NO PRIVACY");
+                                                       break;
+                                               case _WEP40_:   
+                                                       DBG_871X_SEL_NL(m, "%s\n", "WEP 40");
+                                                       break;
+                                               case _TKIP_:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "TKIP");
+                                                       break;
+                                               case _TKIP_WTMIC_:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "TKIP WTMIC");
+                                                       break;
+                                               case _AES_:                             
+                                                       DBG_871X_SEL_NL(m, "%s\n", "AES");
+                                                       break;
+                                               case _WEP104_:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "WEP 104");
+                                                       break;
+                                               case _WEP_WPA_MIXED_:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "WEP/WPA Mixed");
+                                                       break;
+                                               case _SMS4_:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "SMS4");
+                                                       break;
+#ifdef CONFIG_IEEE80211W
+                                               case _BIP_:
+                                                       DBG_871X_SEL_NL(m, "%s\n", "BIP");
+                                                       break;
+#endif //CONFIG_IEEE80211W
+                                       }
+
+                                       DBG_871X_SEL_NL(m, "%-*s = %d sec/%d sec\n", SpaceBtwnItemAndValue, "TPK Lifetime (Current/Expire)", psta->TPK_count, psta->TDLS_PeerKey_Lifetime);
+                                       DBG_871X_SEL_NL(m, "%-*s = %llu\n", SpaceBtwnItemAndValue, "Tx Packets Over Direct Link", psta->sta_stats.tx_pkts);
+                                       DBG_871X_SEL_NL(m, "%-*s = %llu\n", SpaceBtwnItemAndValue, "Rx Packets Over Direct Link", psta->sta_stats.rx_data_pkts);
+                               }
+               }
+       }
+       _exit_critical_bh(&pstapriv->sta_hash_lock, &irqL);
+       if (NumOfTdlsStaToShow == 0)
+       {
+               DBG_871X_SEL_NL(m, "============[TDLS Peer STA Info]============\n");
+               DBG_871X_SEL_NL(m, "No TDLS direct link exists!\n");
+       }
+
+       return 0;
+}
+
+int proc_get_tdls_info(struct seq_file *m, void *v)
+{
+       struct net_device *dev = m->private;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+       struct wlan_network *cur_network = &(pmlmepriv->cur_network);
+       struct sta_priv *pstapriv = &padapter->stapriv;
+       struct tdls_info *ptdlsinfo = &padapter->tdlsinfo;
+       struct sta_info *psta;
+       int i = 0, j = 0;
+       _irqL irqL;
+       _list   *plist, *phead;
+       u8 SpaceBtwnItemAndValue = 41;
+       u8 SpaceBtwnItemAndValueTmp = 0;
+       u8 NumOfTdlsStaToShow = 0;
+       BOOLEAN FirstMatchFound = _FALSE;
+
+       proc_tdls_display_tdls_function_info(m);
+       proc_tdls_display_network_info(m);
+       proc_tdls_display_tdls_sta_info(m);     
+
+       return 0;
+}
+#endif
+
+int proc_get_monitor(struct seq_file *m, void *v)
+{
+       struct net_device *dev = m->private;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+
+       if (WIFI_MONITOR_STATE == get_fwstate(pmlmepriv)) {
+               DBG_871X_SEL_NL(m, "Monitor mode : Enable\n");
+
+               DBG_871X_SEL_NL(m, "ch=%d, ch_offset=%d, bw=%d\n",
+                                               rtw_get_oper_ch(padapter), rtw_get_oper_choffset(padapter), rtw_get_oper_bw(padapter));
+       } else {
+               DBG_871X_SEL_NL(m, "Monitor mode : Disable\n");
+       }
+
+       return 0;
+}
+
+ssize_t proc_set_monitor(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data)
+{
+       char tmp[32];
+       struct net_device *dev = data;
+       _adapter *padapter = (_adapter *)rtw_netdev_priv(dev);
+       u8 target_chan, target_offset, target_bw;
+
+       if (count < 3) {
+               DBG_871X("argument size is less than 3\n");
+               return -EFAULT;
+       }
+
+       if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
+               int num = sscanf(tmp, "%hhu %hhu %hhu", &target_chan, &target_offset, &target_bw);
+
+               if (num != 3) {
+                       DBG_871X("invalid write_reg parameter!\n");
+                       return count;
+               }
+
+               padapter->mlmeextpriv.cur_channel  = target_chan;
+               set_channel_bwmode(padapter, target_chan, target_offset, target_bw);
+       }
+
+       return count;
+}
+
 #endif
 
index ba6cad2..6c5f744 100755 (executable)
@@ -88,7 +88,7 @@ uint  rtw_is_cckrates_included(u8 *rate)
                {               
                        if  (  (((rate[i]) & 0x7f) == 2)        || (((rate[i]) & 0x7f) == 4) ||         
                        (((rate[i]) & 0x7f) == 11)  || (((rate[i]) & 0x7f) == 22) )             
-                       return _TRUE;   
+                               return _TRUE;
                        i++;
                }
                
@@ -104,8 +104,7 @@ uint        rtw_is_cckratesonly_included(u8 *rate)
        {
                        if  (  (((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
                                (((rate[i]) & 0x7f) != 11)  && (((rate[i]) & 0x7f) != 22) )
-
-                       return _FALSE;          
+                               return _FALSE;
 
                        i++;
        }
@@ -933,41 +932,45 @@ u8 *rtw_get_wps_ie_from_scan_queue(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps
 u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
 {
        uint cnt;
-       u8 *wpsie_ptr=NULL;
-       u8 eid, wps_oui[4]={0x0,0x50,0xf2,0x04};
+       u8 *wpsie_ptr = NULL;
+       u8 eid, wps_oui[4] = {0x00, 0x50, 0xf2, 0x04};
 
-       if(wps_ielen)
+       if (wps_ielen)
                *wps_ielen = 0;
 
-       if(!in_ie || in_len<=0)
+       if (!in_ie) {
+               rtw_warn_on(1);
+               return wpsie_ptr;
+       }
+
+       if (in_len <= 0)
                return wpsie_ptr;
 
        cnt = 0;
 
-       while(cnt<in_len)
-       {
+       while (cnt + 1 + 4 < in_len) {
                eid = in_ie[cnt];
 
-               if((eid==_WPA_IE_ID_)&&(_rtw_memcmp(&in_ie[cnt+2], wps_oui, 4)==_TRUE))
-               {
-                       wpsie_ptr = &in_ie[cnt];
+               if (cnt + 1 + 4 >= MAX_IE_SZ) {
+                       rtw_warn_on(1);
+                       return NULL;
+               }
 
-                       if(wps_ie)
-                               _rtw_memcpy(wps_ie, &in_ie[cnt], in_ie[cnt+1]+2);
-                       
-                       if(wps_ielen)
-                               *wps_ielen = in_ie[cnt+1]+2;
-                       
-                       cnt+=in_ie[cnt+1]+2;
+               if (eid == WLAN_EID_VENDOR_SPECIFIC && _rtw_memcmp(&in_ie[cnt + 2], wps_oui, 4) == _TRUE) {
+                       wpsie_ptr = in_ie + cnt;
+
+                       if (wps_ie)
+                               _rtw_memcpy(wps_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
+
+                       if (wps_ielen)
+                               *wps_ielen = in_ie[cnt + 1] + 2;
 
                        break;
+               } else {
+                       cnt += in_ie[cnt + 1] + 2;
                }
-               else
-               {
-                       cnt+=in_ie[cnt+1]+2; //goto next        
-               }               
 
-       }       
+       }
 
        return wpsie_ptr;
 }
@@ -1382,60 +1385,119 @@ int rtw_get_mac_addr_intel(unsigned char *buf)
 }
 #endif //CONFIG_PLATFORM_INTEL_BYT
 
+/*
+ * Description:
+ * rtw_check_invalid_mac_address: 
+ * This is only used for checking mac address valid or not.
+ *
+ * Input:
+ * adapter: mac_address pointer.
+ *
+ * Output:
+ * _TRUE: The mac address is invalid.
+ * _FALSE: The mac address is valid.
+ *
+ * Auther: Isaac.Li
+ */
+u8 rtw_check_invalid_mac_address(u8 *mac_addr)
+{
+       u8 null_mac_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
+       u8 multi_mac_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+       u8 res = _FALSE;
+
+       if (_rtw_memcmp(mac_addr, null_mac_addr, ETH_ALEN)) {
+               res = _TRUE;
+               goto func_exit;
+       }
+
+       if (_rtw_memcmp(mac_addr, multi_mac_addr, ETH_ALEN)) {
+               res = _TRUE;
+               goto func_exit;
+       }
+
+       if (mac_addr[0] & BIT0) {
+               res = _TRUE;
+               goto func_exit;
+       }
+
+       if (mac_addr[0] & BIT1) {
+               res = _TRUE;
+               goto func_exit;
+       }
+
+func_exit:
+       return res;
+}
+
 extern char* rtw_initmac;
 #include <linux/rfkill-wlan.h>
-void rtw_macaddr_cfg(u8 *mac_addr)
+/**
+ * rtw_macaddr_cfg - Decide the mac address used
+ * @out: buf to store mac address decided
+ * @hw_mac_addr: mac address from efuse/epprom
+ */
+void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr)
 {
        u8 mac[ETH_ALEN];
-       if(mac_addr == NULL)    return;
-       
-       if ( rtw_initmac )
-       {       //      Users specify the mac address
-               int jj,kk;
 
-               for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
-               {
-                       mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
-               }
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-       }
-#ifdef CONFIG_PLATFORM_INTEL_BYT
-       else if (0 == rtw_get_mac_addr_intel(mac))
-       {
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+       if (out == NULL) {
+               rtw_warn_on(1);
+               return;
        }
-#endif //CONFIG_PLATFORM_INTEL_BYT
-       else
-    {
-        printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1],
-            mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
+
+       /* Users specify the mac address */
+       if (rtw_initmac) {
+               int jj,kk;
+
+               for (jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3)
+                       mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk + 1]);
+
+               goto err_chk;
+         }
+        
+        else {
+
+        printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", out[0], out[1],
+            out[2], out[3], out[4], out[5]);
         if (!rockchip_wifi_mac_addr(mac)) {
             printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
                 mac[2], mac[3], mac[4], mac[5]);
-            _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+            _rtw_memcpy(out, mac, ETH_ALEN);
+            goto err_chk;
         } else {
             //  Use the mac address stored in the Efuse
-            _rtw_memcpy(mac, mac_addr, ETH_ALEN);
+            _rtw_memcpy(mac, hw_mac_addr, ETH_ALEN);
+              goto err_chk;
         }
-    }
 
-       if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
-            (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
-           ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
-            (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
-       {
+     }
+
+#ifdef CONFIG_PLATFORM_INTEL_BYT
+       if (rtw_get_mac_addr_intel(mac) == 0)
+               goto err_chk;
+#endif
+
+       
+
+err_chk:
+       //if (rtw_check_invalid_mac_address(mac) == _TRUE) 
+        if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
+             (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
+            ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
+             (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0))){
+               DBG_871X_LEVEL(_drv_err_, "invalid mac addr:"MAC_FMT", assign default one!!!\n", MAC_ARG(mac));
+
+               /* use default mac address */
                mac[0] = 0x00;
                mac[1] = 0xe0;
                mac[2] = 0x4c;
                mac[3] = 0x87;
                mac[4] = 0x00;
                mac[5] = 0x00;
-               // use default mac addresss
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-               DBG_871X("MAC Address from efuse error, assign default one !!!\n");
-       }       
+       }
 
-       DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
+       _rtw_memcpy(out, mac, ETH_ALEN);
+       DBG_871X("%s mac addr:"MAC_FMT"\n", __func__, MAC_ARG(out));
 }
 
 #ifdef CONFIG_80211N_HT
@@ -1647,47 +1709,48 @@ u8 *rtw_get_p2p_ie_from_scan_queue(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_
  */
 u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen)
 {
-       uint cnt = 0;
-       u8 *p2p_ie_ptr;
-       u8 eid, p2p_oui[4]={0x50,0x6F,0x9A,0x09};
+       uint cnt;
+       u8 *p2p_ie_ptr = NULL;
+       u8 eid, p2p_oui[4] = {0x50, 0x6F, 0x9A, 0x09};
 
-       if ( p2p_ielen != NULL )
+       if (p2p_ielen)
                *p2p_ielen = 0;
 
-       while(cnt<in_len)
-       {
+       if (!in_ie || in_len < 0) {
+               rtw_warn_on(1);
+               return p2p_ie_ptr;
+       }
+
+       if (in_len <= 0)
+               return p2p_ie_ptr;
+
+       cnt = 0;
+
+       while (cnt + 1 + 4 < in_len) {
                eid = in_ie[cnt];
-               if ((in_len < 0) || (cnt > MAX_IE_SZ)) {
-                       rtw_dump_stack();
+
+               if (cnt + 1 + 4 >= MAX_IE_SZ) {
+                       rtw_warn_on(1);
                        return NULL;
-               }               
-               if( ( eid == _VENDOR_SPECIFIC_IE_ ) && ( _rtw_memcmp( &in_ie[cnt+2], p2p_oui, 4) == _TRUE ) )
-               {
+               }
+
+               if (eid == WLAN_EID_VENDOR_SPECIFIC && _rtw_memcmp(&in_ie[cnt + 2], p2p_oui, 4) == _TRUE) {
                        p2p_ie_ptr = in_ie + cnt;
-               
-                       if ( p2p_ie != NULL )
-                       {
-                               _rtw_memcpy( p2p_ie, &in_ie[ cnt ], in_ie[ cnt + 1 ] + 2 );
-                       }
 
-                       if ( p2p_ielen != NULL )
-                       {
-                               *p2p_ielen = in_ie[ cnt + 1 ] + 2;
-                       }
-                       
-                       return p2p_ie_ptr;
+                       if (p2p_ie)
+                               _rtw_memcpy(p2p_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
+
+                       if (p2p_ielen)
+                               *p2p_ielen = in_ie[cnt + 1] + 2;
 
                        break;
+               } else {
+                       cnt += in_ie[cnt + 1] + 2;
                }
-               else
-               {
-                       cnt += in_ie[ cnt + 1 ] +2; //goto next 
-               }               
-               
-       }       
 
-       return NULL;
+       }
 
+       return p2p_ie_ptr;
 }
 
 /**
@@ -1850,10 +1913,10 @@ void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id)
        if( (p2p_ie=rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori)) ) 
        {
                if (0)
-               if(rtw_get_p2p_attr(p2p_ie, p2p_ielen_ori, attr_id, NULL, NULL)) {
-                       DBG_871X("rtw_get_p2p_attr: GOT P2P_ATTR:%u!!!!!!!!\n", attr_id);
-                       dump_ies(RTW_DBGDUMP, bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_);
-               }
+                       if(rtw_get_p2p_attr(p2p_ie, p2p_ielen_ori, attr_id, NULL, NULL)) {
+                               DBG_871X("rtw_get_p2p_attr: GOT P2P_ATTR:%u!!!!!!!!\n", attr_id);
+                               dump_ies(RTW_DBGDUMP, bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_);
+                       }
 
                p2p_ielen=rtw_p2p_attr_remove(p2p_ie, p2p_ielen_ori, attr_id);
                if(p2p_ielen != p2p_ielen_ori) {
index d97d3aa..9989659 100755 (executable)
@@ -492,7 +492,6 @@ NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv* poid_par_priv)
 {
        NDIS_STATUS             status = NDIS_STATUS_SUCCESS;
        PADAPTER                padapter = (PADAPTER)(poid_par_priv->adapter_context);
-       struct eeprom_priv*     peeprompriv = &padapter->eeprompriv;    
 
        if(poid_par_priv->type_of_oid != QUERY_OID)
        {
@@ -500,7 +499,7 @@ NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv* poid_par_priv)
                return status;
        }               
        *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-       *(u16 *)poid_par_priv->information_buf = peeprompriv->channel_plan ;
+       *(u16 *)poid_par_priv->information_buf = padapter->mlmepriv.ChannelPlan ;
 
        return status;
 }
@@ -508,7 +507,6 @@ NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv* poid_par_priv)
 {
        NDIS_STATUS             status = NDIS_STATUS_SUCCESS;
        PADAPTER                padapter = (PADAPTER)(poid_par_priv->adapter_context);
-       struct eeprom_priv*     peeprompriv = &padapter->eeprompriv;    
        
        if(poid_par_priv->type_of_oid != SET_OID)
        {
@@ -516,7 +514,7 @@ NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv* poid_par_priv)
                return status;
        }               
        
-       peeprompriv->channel_plan = *(u16 *)poid_par_priv->information_buf ;
+       padapter->mlmepriv.ChannelPlan  = *(u16 *)poid_par_priv->information_buf ;
 
        return status;
 }
index 59b88f4..5ca4a56 100755 (executable)
@@ -673,7 +673,10 @@ _func_enter_;
 
                        case Ndis802_11AutoUnknown:
                        case Ndis802_11InfrastructureMax:
-                               break;                                                  
+                               break;
+                       case Ndis802_11Monitor:
+                               set_fwstate(pmlmepriv, WIFI_MONITOR_STATE);
+                               break;
                }
 
                //SecClearAllKeys(adapter);
@@ -996,8 +999,8 @@ _func_enter_;
                        }
                }
 
-               // Check key length for WEP. For NDTEST, 2005.01.27, by rcnjko.
-               if(     (encryptionalgo== _WEP40_|| encryptionalgo== _WEP104_) && (key->KeyLength != 5 || key->KeyLength != 13)) {
+               /* Check key length for WEP. For NDTEST, 2005.01.27, by rcnjko. -> modify checking condition*/
+               if (((encryptionalgo == _WEP40_) && (key->KeyLength != 5)) || ((encryptionalgo == _WEP104_) && (key->KeyLength != 13))) {
                        RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("WEP KeyLength:0x%x != 5 or 13\n", key->KeyLength));
                        ret=_FAIL;
                        goto exit;
@@ -1252,16 +1255,22 @@ _func_enter_;
 
                
                        //Set key to CAM through H2C command
+                       #if 0
                        if(bgrouptkey)//never go to here
                        {
-                               res=rtw_setstakey_cmd(padapter, stainfo, _FALSE, _TRUE);
+                               res=rtw_setstakey_cmd(padapter, stainfo, GROUP_KEY, _TRUE);
                                RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(group)\n"));
                        }
                        else{
-                               res=rtw_setstakey_cmd(padapter, stainfo, _TRUE, _TRUE);
+                               res=rtw_setstakey_cmd(padapter, stainfo, UNICAST_KEY, _TRUE);
                                RT_TRACE(_module_rtl871x_ioctl_set_c_,_drv_err_,("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(unicast)\n"));
                        }
+                       #else
                        
+                       res = rtw_setstakey_cmd(padapter, stainfo, UNICAST_KEY, _TRUE);
+                       RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n rtw_set_802_11_add_key:rtw_setstakey_cmd(unicast)\n"));
+                       #endif
+
                        if(res ==_FALSE)
                                ret= _FAIL;
                        
@@ -1469,7 +1478,7 @@ int rtw_set_country(_adapter *adapter, const char *country_code)
 * 
 * Return _SUCCESS or _FAIL
 */
-int rtw_set_band(_adapter *adapter, enum _BAND band)
+int rtw_set_band(_adapter *adapter, u8 band)
 {
        if (rtw_band_valid(band)) {
                DBG_871X(FUNC_ADPT_FMT" band:%d\n", FUNC_ADPT_ARG(adapter), band);
index a4de3e6..5675b63 100755 (executable)
@@ -52,6 +52,8 @@ static int __init rtw_mem_init(void)
        struct sk_buff *pskb=NULL;\r
 \r
        printk("%s\n", __func__);\r
+       pr_info("NR_PREALLOC_RECV_SKB: %d\n", NR_PREALLOC_RECV_SKB);\r
+       pr_info("MAX_RECVBUF_SZ: %d\n", MAX_RECVBUF_SZ);\r
 \r
 #ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX\r
        for(i=0; i<NR_RECVBUFF; i++)\r\r
index 1047bc0..c6c7079 100755 (executable)
@@ -1025,7 +1025,8 @@ _func_enter_;
        //_enter_critical_bh(&queue->lock, &irqL);
 
        #if defined(CONFIG_P2P) && defined(CONFIG_P2P_REMOVE_GROUP_INFO)
-       rtw_WLAN_BSSID_EX_remove_p2p_attr(pnetwork, P2P_ATTR_GROUP_INFO);
+       if (adapter->registrypriv.wifi_spec == 0)
+               rtw_WLAN_BSSID_EX_remove_p2p_attr(pnetwork, P2P_ATTR_GROUP_INFO);
        #endif
        
        update_current_network(adapter, pnetwork);
@@ -1203,46 +1204,34 @@ _func_exit_;
 void rtw_surveydone_event_callback(_adapter    *adapter, u8 *pbuf)
 {
        _irqL  irqL;
-       u8 timer_cancelled = _FALSE;
+       u8 timer_cancelled;
        struct  mlme_priv       *pmlmepriv = &(adapter->mlmepriv);
-       
-#ifdef CONFIG_MLME_EXT 
 
+#ifdef CONFIG_MLME_EXT
        mlmeext_surveydone_event_callback(adapter);
-
 #endif
 
-_func_enter_;                  
+_func_enter_;
 
        _enter_critical_bh(&pmlmepriv->lock, &irqL);
-       if(pmlmepriv->wps_probe_req_ie)
-       {
+       if (pmlmepriv->wps_probe_req_ie) {
                u32 free_len = pmlmepriv->wps_probe_req_ie_len;
                pmlmepriv->wps_probe_req_ie_len = 0;
                rtw_mfree(pmlmepriv->wps_probe_req_ie, free_len);
-               pmlmepriv->wps_probe_req_ie = NULL;                     
+               pmlmepriv->wps_probe_req_ie = NULL;
        }
-       
+
        RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("rtw_surveydone_event_callback: fw_state:%x\n\n", get_fwstate(pmlmepriv)));
-       
-       if (check_fwstate(pmlmepriv,_FW_UNDER_SURVEY))
-       {
-               //u8 timer_cancelled;
 
-               timer_cancelled = _TRUE;
-               //_cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled);
-               
-               _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
-       }
-       else {
-       
-               RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_,("nic status =%x, survey done event comes too late!\n", get_fwstate(pmlmepriv)));    
+       if (check_fwstate(pmlmepriv,_FW_UNDER_SURVEY) == _FALSE) {
+               DBG_871X(FUNC_ADPT_FMT" fw_state:0x%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv));
+               //rtw_warn_on(1);
        }
-       _exit_critical_bh(&pmlmepriv->lock, &irqL);
 
-       if(timer_cancelled)
-               _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled);
+       _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
+       _exit_critical_bh(&pmlmepriv->lock, &irqL);
 
+       _cancel_timer(&pmlmepriv->scan_to_timer, &timer_cancelled);
 
        _enter_critical_bh(&pmlmepriv->lock, &irqL);
 
@@ -1258,12 +1247,12 @@ _func_enter_;
                        {
                                set_fwstate(pmlmepriv, _FW_UNDER_LINKING);      
                                
-                               if(rtw_select_and_join_from_scanned_queue(pmlmepriv)==_SUCCESS)
-                               {
-                                       _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT );
-                               }
-                               else    
-                               {
+                               if(rtw_select_and_join_from_scanned_queue(pmlmepriv)==_SUCCESS)
+                               {
+                                       _set_timer(&pmlmepriv->assoc_timer, MAX_JOIN_TIMEOUT);
+                               }
+                               else
+                               {
                                        WLAN_BSSID_EX    *pdev_network = &(adapter->registrypriv.dev_network);                  
                                        u8 *pibss = adapter->registrypriv.dev_network.MacAddress;
 
@@ -1278,7 +1267,8 @@ _func_enter_;
                                        rtw_update_registrypriv_dev_network(adapter);
                                        rtw_generate_random_ibss(pibss);
 
-                                               pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
+       
+                                       pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
                        
                                        if(rtw_createbss_cmd(adapter)!=_SUCCESS)
                                        {
@@ -1360,9 +1350,6 @@ _func_enter_;
 #ifdef CONFIG_CONCURRENT_MODE  
        rtw_os_xmit_schedule(adapter->pbuddy_adapter);
 #endif
-#ifdef CONFIG_DUALMAC_CONCURRENT
-       dc_resume_xmit(adapter);
-#endif
 
 #ifdef CONFIG_DRVEXT_MODULE_WSC
        drvext_surveydone_callback(&adapter->drvextpriv);
@@ -1490,9 +1477,8 @@ _func_enter_;
                psta = rtw_get_stainfo(&adapter->stapriv, tgt_network->network.MacAddress);
 
 #ifdef CONFIG_TDLS
-               if(ptdlsinfo->link_established == _TRUE)
-               {
-                       rtw_tdls_cmd(adapter, myid(&(adapter->eeprompriv)), TDLS_RS_RCR);
+               if (ptdlsinfo->link_established == _TRUE) {
+                       rtw_tdls_cmd(adapter, NULL, TDLS_RS_RCR);
                        rtw_reset_tdls_info(adapter);
                        rtw_free_all_stainfo(adapter);
                        //_enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);
@@ -1524,9 +1510,8 @@ _func_enter_;
 
        if(lock_scanned_queue)
                _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
-       
-//     pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress);
-        pwlan = _rtw_find_same_network(&pmlmepriv->scanned_queue, tgt_network);
+
+       pwlan = _rtw_find_same_network(&pmlmepriv->scanned_queue, tgt_network);
        if(pwlan)               
        {
                pwlan->fixed = _FALSE;
@@ -1735,8 +1720,8 @@ u32 rtw_scan_abort_timeout(_adapter *adapter, u32 timeout_ms)
 {
        u32 start;
        u32 pass_ms;
-       struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
-       struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv);
+       struct mlme_priv        *pmlmepriv = &(adapter->mlmepriv);
+       struct mlme_ext_priv    *pmlmeext = &(adapter->mlmeextpriv);
 
        start = rtw_get_current_time();
        pmlmeext->scan_abort = _TRUE;
@@ -1873,6 +1858,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(_adapter *padapter, struct wl
                        #endif
                        preorder_ctrl->wend_b= 0xffff;
                        preorder_ctrl->wsize_b = 64;//max_ampdu_sz;//ex. 32(kbytes) -> wsize_b=32
+                       preorder_ctrl->ampdu_size = RX_AMPDU_SIZE_INVALID;
                }
 
                
@@ -1891,6 +1877,7 @@ static struct sta_info *rtw_joinbss_update_stainfo(_adapter *padapter, struct wl
                                #endif
                                preorder_ctrl->wend_b= 0xffff;
                                preorder_ctrl->wsize_b = 64;//max_ampdu_sz;//ex. 32(kbytes) -> wsize_b=32
+                               preorder_ctrl->ampdu_size = RX_AMPDU_SIZE_INVALID;
                        }
                }
        }
@@ -2207,10 +2194,6 @@ _func_enter_;
        rtw_os_xmit_schedule(adapter->pbuddy_adapter);
 #endif 
 
-#ifdef CONFIG_DUALMAC_CONCURRENT
-       dc_resume_xmit(adapter);
-#endif
-
 _func_exit_;
 }
 
@@ -2416,7 +2399,7 @@ _func_enter_;
        
 #ifdef CONFIG_RTL8711
        //submit SetStaKey_cmd to tell fw, fw will allocate an CAM entry for this sta   
-       rtw_setstakey_cmd(adapter, psta, _FALSE, _TRUE);
+       rtw_setstakey_cmd(adapter, psta, GROUP_KEY, _TRUE);
 #endif
                
 exit:
@@ -2705,16 +2688,19 @@ _func_exit_;
 void rtw_scan_timeout_handler (_adapter *adapter)
 {      
        _irqL irqL;
-       struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
-       
+       struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
        DBG_871X(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv));
 
        _enter_critical_bh(&pmlmepriv->lock, &irqL);
        
        _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
-
+       
        _exit_critical_bh(&pmlmepriv->lock, &irqL);
-
+       
+#ifdef CONFIG_IOCTL_CFG80211
+       rtw_cfg80211_surveydone_event_callback(adapter);
+#endif //CONFIG_IOCTL_CFG80211
+       
        rtw_indicate_scan_done(adapter, _TRUE);
 
 #if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_IOCTL_CFG80211)
@@ -2854,7 +2840,7 @@ void rtw_dynamic_check_timer_handlder(_adapter *adapter)
                DBG_871X("IsBtDisabled=%d, IsBtControlLps=%d\n", rtw_btcoex_IsBtDisabled(adapter), rtw_btcoex_IsBtControlLps(adapter));
 #endif
 
-#ifdef CONFIG_LPS_LCLK_WD_TIMER
+#ifdef CONFIG_LPS_LCLK_WD_TIMER /* to avoid leaving lps 32k frequently*/
        if ((adapter_to_pwrctl(adapter)->bFwCurrentInPSMode ==_TRUE )
 #ifdef CONFIG_BT_COEXIST
                && (rtw_btcoex_IsBtControlLps(adapter) == _FALSE)
@@ -2946,7 +2932,7 @@ inline void rtw_clear_scan_deny(_adapter *adapter)
        struct mlme_priv *mlmepriv = &adapter->mlmepriv;
        ATOMIC_SET(&mlmepriv->set_scan_deny, 0);
        if (0)
-       DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter));
+               DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter));
 }
 
 void rtw_set_scan_deny_timer_hdl(_adapter *adapter)
@@ -2962,7 +2948,7 @@ void rtw_set_scan_deny(_adapter *adapter, u32 ms)
 #endif
 
        if (0)
-       DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter));
+               DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter));
        ATOMIC_SET(&mlmepriv->set_scan_deny, 1);
        _set_timer(&mlmepriv->set_scan_deny_timer, ms);
        
@@ -2971,7 +2957,7 @@ void rtw_set_scan_deny(_adapter *adapter, u32 ms)
                return;
 
        if (0)
-       DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter->pbuddy_adapter));
+               DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter->pbuddy_adapter));
        b_mlmepriv = &adapter->pbuddy_adapter->mlmepriv;
        ATOMIC_SET(&b_mlmepriv->set_scan_deny, 1);
        _set_timer(&b_mlmepriv->set_scan_deny_timer, ms);       
@@ -3071,11 +3057,11 @@ _func_enter_;
                mlme->pscanned = get_next(mlme->pscanned);
 
                if (0)
-               DBG_871X("%s("MAC_FMT", ch%u) rssi:%d\n"
-                       , pnetwork->network.Ssid.Ssid
-                       , MAC_ARG(pnetwork->network.MacAddress)
-                       , pnetwork->network.Configuration.DSConfig
-                       , (int)pnetwork->network.Rssi);
+                       DBG_871X("%s("MAC_FMT", ch%u) rssi:%d\n"
+                               , pnetwork->network.Ssid.Ssid
+                               , MAC_ARG(pnetwork->network.MacAddress)
+                               , pnetwork->network.Configuration.DSConfig
+                               , (int)pnetwork->network.Rssi);
 
                rtw_check_roaming_candidate(mlme, &candidate, pnetwork);
  
@@ -3149,16 +3135,11 @@ static int rtw_check_join_candidate(struct mlme_priv *mlme
        }
 
        if(updated){
-               DBG_871X("[by_bssid:%u][assoc_ssid:%s]"
-                       #ifdef  CONFIG_LAYER2_ROAMING
-                       "[to_roam:%u] "
-                       #endif
+               DBG_871X("[by_bssid:%u][assoc_ssid:%s][to_roam:%u] "
                        "new candidate: %s("MAC_FMT", ch%u) rssi:%d\n",
                        mlme->assoc_by_bssid,
                        mlme->assoc_ssid.Ssid,
-                       #ifdef  CONFIG_LAYER2_ROAMING
                        rtw_to_roam(adapter),
-                       #endif
                        (*candidate)->network.Ssid.Ssid,
                        MAC_ARG((*candidate)->network.MacAddress),
                        (*candidate)->network.Configuration.DSConfig,
@@ -3221,11 +3202,11 @@ _func_enter_;
                pmlmepriv->pscanned = get_next(pmlmepriv->pscanned);
 
                if (0)
-               DBG_871X("%s("MAC_FMT", ch%u) rssi:%d\n"
-                       , pnetwork->network.Ssid.Ssid
-                       , MAC_ARG(pnetwork->network.MacAddress)
-                       , pnetwork->network.Configuration.DSConfig
-                       , (int)pnetwork->network.Rssi);
+                       DBG_871X("%s("MAC_FMT", ch%u) rssi:%d\n"
+                               , pnetwork->network.Ssid.Ssid
+                               , MAC_ARG(pnetwork->network.MacAddress)
+                               , pnetwork->network.Configuration.DSConfig
+                               , (int)pnetwork->network.Rssi);
 
                rtw_check_join_candidate(pmlmepriv, &candidate, pnetwork);
  
@@ -3668,9 +3649,8 @@ _func_exit_;
 void rtw_init_registrypriv_dev_network(        _adapter* adapter)
 {
        struct registry_priv* pregistrypriv = &adapter->registrypriv;
-       struct eeprom_priv* peepriv = &adapter->eeprompriv;
        WLAN_BSSID_EX    *pdev_network = &pregistrypriv->dev_network;
-       u8 *myhwaddr = myid(peepriv);
+       u8 *myhwaddr = adapter_mac_addr(adapter);
        
 _func_enter_;
 
@@ -3698,6 +3678,7 @@ void rtw_update_registrypriv_dev_network(_adapter* adapter)
        struct  security_priv*  psecuritypriv = &adapter->securitypriv;
        struct  wlan_network    *cur_network = &adapter->mlmepriv.cur_network;
        //struct        xmit_priv       *pxmitpriv = &adapter->xmitpriv;
+       struct mlme_ext_priv    *pmlmeext = &adapter->mlmeextpriv;
 
 _func_enter_;
 
@@ -3745,9 +3726,15 @@ _func_enter_;
        pdev_network->Configuration.DSConfig = (pregistrypriv->channel);
        RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("pregistrypriv->channel=%d, pdev_network->Configuration.DSConfig=0x%x\n", pregistrypriv->channel, pdev_network->Configuration.DSConfig));  
 
-       if(cur_network->network.InfrastructureMode == Ndis802_11IBSS)
+       if (cur_network->network.InfrastructureMode == Ndis802_11IBSS) {
                pdev_network->Configuration.ATIMWindow = (0);
 
+               if (pmlmeext->cur_channel != 0)
+                       pdev_network->Configuration.DSConfig = pmlmeext->cur_channel;
+               else 
+                       pdev_network->Configuration.DSConfig = 1;
+       }
+
        pdev_network->InfrastructureMode = (cur_network->network.InfrastructureMode);
 
        // 1. Supported rates
@@ -3973,6 +3960,12 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
        /* todo: disable SM power save mode */
        ht_capie.cap_info |= IEEE80211_HT_CAP_SM_PS;
 
+       /* RX LDPC */
+       if (TEST_FLAG(phtpriv->ldpc_cap, LDPC_HT_ENABLE_RX)) {
+               ht_capie.cap_info |= IEEE80211_HT_CAP_LDPC_CODING;
+               DBG_871X("[HT] Declare supporting RX LDPC\n");
+       }
+
        if (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_RX)) {
                if((pregistrypriv->rx_stbc == 0x3) ||                                                   /* enable for 2.4/5 GHz */
                        ((channel <= 14) && (pregistrypriv->rx_stbc == 0x1)) || /* enable for 2.4GHz */
@@ -4001,8 +3994,6 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
 
        case RF_2T2R:
        case RF_1T2R:
-       default:
-
                if (stbc_rx_enable)
                        ht_capie.cap_info |= IEEE80211_HT_CAP_RX_STBC_2R;//RX STBC two spatial stream
 
@@ -4012,9 +4003,14 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
                else
                                set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_2R);       
                #else //CONFIG_DISABLE_MCS13TO15
-                       set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_2R);       
+                       set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_2R);
                #endif //CONFIG_DISABLE_MCS13TO15
                break;
+       case RF_3T3R:
+               set_mcs_rate_by_mask(ht_capie.supp_mcs_set, MCS_RATE_3R);
+               break;
+       default:
+               DBG_871X("[warning] rf_type %d is not expected\n", rf_type);
        }
 
        {
@@ -4186,7 +4182,7 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel)
                (pmlmeinfo->HT_info.infos[0] & BIT(2)))
        {
                int i;
-               u8      rf_type;
+               u8      rf_type = RF_1T1R;
 
                rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
 
@@ -4201,9 +4197,8 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel)
                        case RF_1T2R:
                                set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_1R);                                                        
                                break;
-                       case RF_2T2R:                   
-                       default:
-#ifdef CONFIG_DISABLE_MCS13TO15
+                       case RF_2T2R:
+                               #ifdef CONFIG_DISABLE_MCS13TO15
                                if(pmlmeext->cur_bwmode == CHANNEL_WIDTH_40 && pregistrypriv->wifi_spec != 1 )                          
                                        set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R_13TO15_OFF);                             
                                else
@@ -4211,6 +4206,12 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel)
 #else //CONFIG_DISABLE_MCS13TO15
                                set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_2R);
 #endif //CONFIG_DISABLE_MCS13TO15
+                               break;
+                       case RF_3T3R:
+                               set_mcs_rate_by_mask(pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate, MCS_RATE_3R);
+                               break;
+                       default:
+                               DBG_871X("[warning] rf_type %d is not expected\n", rf_type);
                }
 
                //switch to the 40M Hz mode accoring to the AP
@@ -4307,21 +4308,17 @@ void rtw_issue_addbareq_cmd_tdls(_adapter *padapter, struct xmit_frame *pxmitfra
 
        priority = pattrib->priority;
 
-       if(pattrib->direct_link == _TRUE)
-       {
+       if (pattrib->direct_link == _TRUE) {
                ptdls_sta = rtw_get_stainfo(&padapter->stapriv, pattrib->dst);
-               if((ptdls_sta != NULL) && (ptdls_sta->tdls_sta_state & TDLS_ESTABLISHED))
-               {
+               if ((ptdls_sta != NULL) && (ptdls_sta->tdls_sta_state & TDLS_LINKED_STATE)) {
                        phtpriv = &ptdls_sta->htpriv;
 
-                       if((phtpriv->ht_option==_TRUE) && (phtpriv->ampdu_enable==_TRUE)) 
-                       {
+                       if ((phtpriv->ht_option == _TRUE) && (phtpriv->ampdu_enable == _TRUE)) {
                                issued = (phtpriv->agg_enable_bitmap>>priority)&0x1;
                                issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1;
 
-                               if(0==issued)
-                               {
-                                       DBG_871X("rtw_issue_addbareq_cmd, p=%d\n", priority);
+                               if (0 == issued) {
+                                       DBG_871X("[%s], p=%d\n", __FUNCTION__, priority);
                                        ptdls_sta->htpriv.candidate_tid_bitmap |= BIT((u8)priority);
                                        rtw_addbareq_cmd(padapter,(u8)priority, pattrib->dst);
                                }
@@ -4396,7 +4393,7 @@ void rtw_append_exented_cap(_adapter *padapter, u8 *out_ie, uint *pout_len)
 #endif //CONFIG_80211AC_VHT
        u8      cap_content[8] = {0};
        u8      *pframe;
-
+       u8   null_content[8] = {0};
 
        if (phtpriv->bss_coexist) {
                SET_EXT_CAPABILITY_ELE_BSS_COEXIST(cap_content, 1);
@@ -4407,8 +4404,13 @@ void rtw_append_exented_cap(_adapter *padapter, u8 *out_ie, uint *pout_len)
                SET_EXT_CAPABILITY_ELE_OP_MODE_NOTIF(cap_content, 1);
        }
 #endif //CONFIG_80211AC_VHT
-
-       pframe = rtw_set_ie(out_ie+*pout_len, EID_EXTCapability, 8, cap_content , pout_len);
+       /*
+               From 802.11 specification,if a STA does not support any of capabilities defined
+               in the Extended Capabilities element, then the STA is not required to 
+               transmit the Extended Capabilities element. 
+       */
+       if (_FALSE == _rtw_memcmp(cap_content, null_content, 8))
+               pframe = rtw_set_ie(out_ie + *pout_len, EID_EXTCapability, 8, cap_content , pout_len);
 }
 #endif
 
@@ -4567,3 +4569,4 @@ const char *get_miracast_mode_str(int mode)
 
        return miracast_mode_str[mode];
 }
+
index 7cf52d0..41ec956 100755 (executable)
@@ -288,7 +288,7 @@ static RT_CHANNEL_PLAN_MAP  RTW_ChannelPlanMap[RT_CHANNEL_DOMAIN_MAX] = {
        {0x01,0x23},    //0x58, RT_CHANNEL_DOMAIN_WORLD_MKK4
 };
 
-static RT_CHANNEL_PLAN_MAP     RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x01,0x02}; //use the conbination for max channel numbers
+static RT_CHANNEL_PLAN_MAP     RTW_CHANNEL_PLAN_MAP_REALTEK_DEFINE = {0x00,0x02}; //use the conbination for max channel numbers
 
 /*
  * Search the @param ch in given @param ch_set
@@ -319,9 +319,9 @@ int rtw_ch_set_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch)
  */
 bool rtw_mlme_band_check(_adapter *adapter, const u32 ch)
 {
-       if (adapter->setband == GHZ24_50 /* 2.4G and 5G */
-               || (adapter->setband == GHZ_24 && ch < 35) /* 2.4G only */
-               || (adapter->setband == GHZ_50 && ch > 35) /* 5G only */
+       if (adapter->setband == WIFI_FREQUENCY_BAND_AUTO /* 2.4G and 5G */
+               || (adapter->setband == WIFI_FREQUENCY_BAND_2GHZ && ch < 35) /* 2.4G only */
+               || (adapter->setband == WIFI_FREQUENCY_BAND_5GHZ && ch > 35) /* 5G only */
        ) {
                return _TRUE;
        }
@@ -351,7 +351,7 @@ void init_mlme_default_rate_set(_adapter* padapter)
 
        unsigned char   mixed_datarate[NumRates] = {_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_,_9M_RATE_, _12M_RATE_, _18M_RATE_, _24M_RATE_, _36M_RATE_, _48M_RATE_, _54M_RATE_, 0xff};
        unsigned char   mixed_basicrate[NumRates] ={_1M_RATE_, _2M_RATE_, _5M_RATE_, _11M_RATE_, _6M_RATE_, _12M_RATE_, _24M_RATE_, 0xff,};
-       unsigned char   supported_mcs_set[16] = {0xff, 0xff, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
+       unsigned char   supported_mcs_set[16] = {0xff, 0xff, 0xff, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
 
        _rtw_memcpy(pmlmeext->datarate, mixed_datarate, NumRates);
        _rtw_memcpy(pmlmeext->basicrate, mixed_basicrate, NumRates);
@@ -679,7 +679,7 @@ static void _mgt_dispatcher(_adapter *padapter, struct mlme_handler *ptable, uni
          if(ptable->func)
         {
                 //receive the frames that ra(a1) is my address or ra(a1) is bc address.
-               if (!_rtw_memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
+               if (!_rtw_memcmp(GetAddr1Ptr(pframe), adapter_mac_addr(padapter), ETH_ALEN) &&
                        !_rtw_memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN)) 
                {
                        return;
@@ -726,7 +726,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
     &n