From b5f97c169618862a2dc9d0e99734d97c0875b130 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Thu, 14 Nov 2019 20:37:13 +0100 Subject: [PATCH] Fixed 8821au (8811au) support, fixed fw bug. fixes #466 --- core/rtw_sta_mgt.c | 2 ++ hal/rtl8812a/rtl8812a_hal_init.c | 31 ++++++++++++++++++++++++++----- os_dep/linux/ioctl_cfg80211.c | 7 +++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index cb8a4d7..f8c390d 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -510,6 +510,8 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr) } else { psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); + if (!psta) + goto exit; rtw_list_delete(&(psta->list)); /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */ diff --git a/hal/rtl8812a/rtl8812a_hal_init.c b/hal/rtl8812a/rtl8812a_hal_init.c index 8c474ef..e90e493 100644 --- a/hal/rtl8812a/rtl8812a_hal_init.c +++ b/hal/rtl8812a/rtl8812a_hal_init.c @@ -18,7 +18,8 @@ #include #ifdef CONFIG_RTL8812A #include "hal8812a_fw.h" -#else +#endif +#ifdef CONFIG_RTL8821A #include "hal8821a_fw.h" #endif /* ------------------------------------------------------------------------- @@ -517,11 +518,16 @@ FirmwareDownload8812( #ifdef CONFIG_WOWLAN if (pwrpriv->wowlan_mode) { #ifdef CONFIG_RTL8812A + if (IS_HARDWARE_TYPE_8812(Adapter)) { pFirmware->szFwBuffer = array_mp_8812a_fw_wowlan; pFirmware->ulFwLength = array_length_mp_8812a_fw_wowlan; -#else + } +#endif +#ifdef CONFIG_RTL8821A + if (IS_HARDWARE_TYPE_8821(Adapter)) { pFirmware->szFwBuffer = array_mp_8821a_fw_wowlan; pFirmware->ulFwLength = array_length_mp_8821a_fw_wowlan; + } #endif RTW_INFO("%s fw:%s, size: %d\n", __func__, "WoWLAN", pFirmware->ulFwLength); @@ -531,11 +537,16 @@ FirmwareDownload8812( #ifdef CONFIG_AP_WOWLAN if (pwrpriv->wowlan_ap_mode) { #ifdef CONFIG_RTL8812A + if (IS_HARDWARE_TYPE_8812(Adapter)) { pFirmware->szFwBuffer = array_mp_8812a_fw_ap; pFirmware->ulFwLength = array_length_mp_8812a_fw_ap; -#else + } +#endif +#ifdef CONFIG_RTL8821A + if (IS_HARDWARE_TYPE_8821(Adapter)) { pFirmware->szFwBuffer = array_mp_8821a_fw_ap; pFirmware->ulFwLength = array_length_mp_8821a_fw_ap; + } #endif RTW_INFO("%s fw: %s, size: %d\n", __func__, "AP_WoWLAN", pFirmware->ulFwLength); @@ -546,11 +557,16 @@ FirmwareDownload8812( if (pHalData->EEPROMBluetoothCoexist == _TRUE) { #ifdef CONFIG_RTL8812A + if (IS_HARDWARE_TYPE_8812(pAdapter)) { pFirmware->szFwBuffer = array_mp_8812a_fw_nic_bt; pFirmware->ulFwLength = array_length_mp_8812a_fw_nic_bt; -#else + } +#endif +#ifdef CONFIG_RTL8821A + if (IS_HARDWARE_TYPE_8821(pAdapter)) { pFirmware->szFwBuffer = array_mp_8821a_fw_nic_bt; pFirmware->ulFwLength = array_length_mp_8821a_fw_nic_bt; + } #endif RTW_INFO("%s fw:%s, size: %d\n", __FUNCTION__, "NIC-BTCOEX", pFirmware->ulFwLength); @@ -559,11 +575,16 @@ FirmwareDownload8812( { #ifdef CONFIG_RTL8812A + if (IS_HARDWARE_TYPE_8812(Adapter)) { pFirmware->szFwBuffer = array_mp_8812a_fw_nic; pFirmware->ulFwLength = array_length_mp_8812a_fw_nic; -#else + } +#endif +#ifdef CONFIG_RTL8821A + if (IS_HARDWARE_TYPE_8821(Adapter)) { pFirmware->szFwBuffer = array_mp_8821a_fw_nic; pFirmware->ulFwLength = array_length_mp_8821a_fw_nic; + } #endif RTW_INFO("%s fw:%s, size: %d\n", __FUNCTION__, "NIC", pFirmware->ulFwLength); diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 83e5ffc..1ba416d 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -2638,10 +2638,17 @@ void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork) select_network.InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS); #endif + if (!wiphy) { + pr_info("88XXAU: rtw_cfg80211_unlink_bss: wiphy is NULL\n"); + return; + } + if (bss) { cfg80211_unlink_bss(wiphy, bss); RTW_INFO("%s(): cfg80211_unlink %s!!\n", __func__, select_network.Ssid.Ssid); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + if (!padapter->rtw_wdev->wiphy) + return; cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss); #else cfg80211_put_bss(bss);