Project import generated by Copybara. GitOrigin-RevId: 7f5328784eede1d0b4cae74674895ecc29608894
diff --git a/wlan_sd8987/mlan/mlan_decl.h b/wlan_sd8987/mlan/mlan_decl.h index db7f060..f6e4239 100755 --- a/wlan_sd8987/mlan/mlan_decl.h +++ b/wlan_sd8987/mlan/mlan_decl.h
@@ -24,7 +24,7 @@ #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "292.p10" +#define MLAN_RELEASE_VERSION "292.p13" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */
diff --git a/wlan_sd8987/mlinux/mlan_decl.h b/wlan_sd8987/mlinux/mlan_decl.h index db7f060..f6e4239 100755 --- a/wlan_sd8987/mlinux/mlan_decl.h +++ b/wlan_sd8987/mlinux/mlan_decl.h
@@ -24,7 +24,7 @@ #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "292.p10" +#define MLAN_RELEASE_VERSION "292.p13" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */
diff --git a/wlan_sd8987/mlinux/moal_cfg80211.h b/wlan_sd8987/mlinux/moal_cfg80211.h index 279a051..8b5b98c 100755 --- a/wlan_sd8987/mlinux/moal_cfg80211.h +++ b/wlan_sd8987/mlinux/moal_cfg80211.h
@@ -517,4 +517,6 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, pmlan_ds_misc_assoc_rsp assoc_rsp); +mlan_status woal_reset_wifi(moal_handle *handle, t_u8 cnt, char *reason); + #endif /* _MOAL_CFG80211_H_ */
diff --git a/wlan_sd8987/mlinux/moal_cfg80211_util.c b/wlan_sd8987/mlinux/moal_cfg80211_util.c index 0a65618..05cc2ac 100755 --- a/wlan_sd8987/mlinux/moal_cfg80211_util.c +++ b/wlan_sd8987/mlinux/moal_cfg80211_util.c
@@ -788,6 +788,7 @@ //#ifdef RTT_SUPPORT // | WLAN_FEATURE_D2AP_RTT //#endif + | WLAN_FEATURE_TDLS | WLAN_FEATURE_MKEEP_ALIVE; memset(&fw_info, 0, sizeof(mlan_fw_info)); @@ -2957,7 +2958,7 @@ * 24days. */ if (inter_msec > max_msec) { - PRINTM(MMSG, + PRINTM(MINFO, "Out of range, set inter_msec=%llu to max_msec=%llu\n", inter_msec, max_msec); inter_msec = max_msec;
diff --git a/wlan_sd8987/mlinux/moal_main.c b/wlan_sd8987/mlinux/moal_main.c index 3785300..fe3a894 100755 --- a/wlan_sd8987/mlinux/moal_main.c +++ b/wlan_sd8987/mlinux/moal_main.c
@@ -4,7 +4,7 @@ * driver. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -824,9 +824,10 @@ cfg80211_wext = reset_handle->params.cfg80211_wext; //stop pending scan #ifdef STA_CFG80211 - if (IS_STA_CFG80211(cfg80211_wext) && reset_handle->scan_request) { + if (IS_STA_CFG80211(cfg80211_wext) && reset_handle->scan_request + && reset_handle->scan_priv) { moal_private *scan_priv = reset_handle->scan_priv; - cancel_delayed_work_sync(&reset_handle->scan_timeout_work); + /** some supplicant can not handle SCAN abort event */ if (scan_priv->bss_type == MLAN_BSS_TYPE_STA) woal_cfg80211_scan_done(reset_handle->scan_request, @@ -836,6 +837,7 @@ MFALSE); reset_handle->scan_request = NULL; reset_handle->scan_priv = NULL; + cancel_delayed_work_sync(&reset_handle->scan_timeout_work); reset_handle->scan_pending_on_block = MFALSE; MOAL_REL_SEMAPHORE(&reset_handle->async_sem); } @@ -7738,7 +7740,7 @@ memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); wrqu.ap_addr.sa_family = ARPHRD_ETHER; wireless_send_event(priv->netdev, SIOCGIWAP, &wrqu, NULL); - } +} #endif #ifdef STA_CFG80211 if (IS_STA_CFG80211(cfg80211_wext)) {
diff --git a/wlan_sd8987/mlinux/moal_main.h b/wlan_sd8987/mlinux/moal_main.h index f9f3639..33dada0 100755 --- a/wlan_sd8987/mlinux/moal_main.h +++ b/wlan_sd8987/mlinux/moal_main.h
@@ -1615,6 +1615,8 @@ /** If |MTRUE|, suppress Wi-Fi scan requests. */ t_bool scan_suppressed; #endif // defined(WIFI_LATENCY_MODE_SUPPORT) + t_u8 auth_tx_cnt; + t_u8 deauth_evt_cnt; }; #ifdef SDIO
diff --git a/wlan_sd8987/mlinux/moal_shim.c b/wlan_sd8987/mlinux/moal_shim.c index 1d90b3d..4a0db86 100755 --- a/wlan_sd8987/mlinux/moal_shim.c +++ b/wlan_sd8987/mlinux/moal_shim.c
@@ -41,6 +41,9 @@ #if defined(STA_CFG80211) || defined(UAP_CFG80211) #include "moal_cfg80211.h" #include "moal_cfg80211_util.h" +#ifdef STA_SUPPORT +#include "moal_sta_cfg80211.h" +#endif #endif #include <asm/div64.h> @@ -1630,12 +1633,14 @@ skb_put(skb, pmbuf->data_len); } ethh = (struct ethhdr *)(skb->data); - if (ntohs(ethh->h_proto) == ETH_P_PAE) + if (ntohs(ethh->h_proto) == ETH_P_PAE) { PRINTM(MEVENT, - "wlan: %s Rx EAPOL pkt from " MACSTR - "\n", - priv->netdev->name, - MAC2STR(ethh->h_source)); + "wlan: %s Rx EAPOL pkt from " MACSTR + "\n", + priv->netdev->name, + MAC2STR(ethh->h_source)); + priv->deauth_evt_cnt = 0; + } if (!netdev) netdev = priv->netdev; skb->dev = netdev; @@ -2432,6 +2437,7 @@ if (IS_STA_WEXT(cfg80211_wext)) woal_send_iwevcustom_event(priv, CUS_EVT_PORT_RELEASE); #endif + priv->deauth_evt_cnt = 0; woal_broadcast_event(priv, CUS_EVT_PORT_RELEASE, strlen(CUS_EVT_PORT_RELEASE)); break; @@ -3232,6 +3238,7 @@ *) pkt) ->frame_control)) { + priv->auth_tx_cnt = 0; PRINTM(MEVENT, "HostMlme %s: Received auth frame type = 0x%x\n", priv->netdev->name, @@ -3277,6 +3284,22 @@ "HostMlme: Drop deauth/disassociate, current_bss = null\n"); break; } + + if (ieee80211_is_deauth(((struct ieee80211_mgmt*)pkt)->frame_control)) + { + /* subtype 12 deauth packet */ + priv->deauth_evt_cnt++; +#define MAX_DEAUTH_COUNTER 5 + if (priv->deauth_evt_cnt >= MAX_DEAUTH_COUNTER) + { + if (woal_reset_wifi(priv->phandle, priv->deauth_evt_cnt, + "EAPOL timeout") == MLAN_STATUS_SUCCESS) + { + priv->deauth_evt_cnt = 0; + } + } + } + priv->cfg_disconnect = MTRUE; woal_mgmt_frame_register(priv, IEEE80211_STYPE_DEAUTH,
diff --git a/wlan_sd8987/mlinux/moal_sta_cfg80211.c b/wlan_sd8987/mlinux/moal_sta_cfg80211.c index 2184a68..0460506 100755 --- a/wlan_sd8987/mlinux/moal_sta_cfg80211.c +++ b/wlan_sd8987/mlinux/moal_sta_cfg80211.c
@@ -3,7 +3,7 @@ * @brief This file contains the functions for STA CFG80211. * * - * Copyright 2011-2021 NXP + * Copyright 2011-2022 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -1963,6 +1963,27 @@ return ret; } +mlan_status woal_reset_wifi(moal_handle *handle, t_u8 cnt, char *reason) +{ + static wifi_timeval reset_time; + wifi_timeval ts; + t_u64 diff; + +#define MAX_WIFI_RESET_INTERVAL 15*60*1000000 // 15 minute + woal_get_monotonic_time(&ts); + diff = (t_u64)(timeval_to_usec(ts) - timeval_to_usec(reset_time)); + PRINTM(MERROR, "WiFi Reset diff %lld\n", diff); + if (reset_time.time_sec == 0 || diff >= MAX_WIFI_RESET_INTERVAL) + { + reset_time = ts; + PRINTM(MERROR, "WiFi Reset due to %s cnt %d\n", reason, cnt); + /* Do wifi independent reset */ + woal_process_hang(handle); + return MLAN_STATUS_SUCCESS; + } + return MLAN_STATUS_PENDING; +} + /** * @brief This function is authentication handler when host MLME * enable. @@ -2297,6 +2318,15 @@ case MLAN_STATUS_PENDING: atomic_inc(&priv->phandle->tx_pending); queue_work(priv->phandle->workqueue, &priv->phandle->main_work); +#define MAX_AUTH_COUNTER 5 + priv->auth_tx_cnt++; + if (priv->auth_tx_cnt >= MAX_AUTH_COUNTER) { + if (woal_reset_wifi(priv->phandle, priv->auth_tx_cnt, + "auth timeout") == MLAN_STATUS_SUCCESS) + { + priv->auth_tx_cnt = 0; + } + } break; case MLAN_STATUS_SUCCESS: woal_free_mlan_buffer(priv->phandle, pmbuf); @@ -4327,6 +4357,12 @@ ENTER(); PRINTM(MINFO, "Received scan request on %s\n", dev->name); + if (priv->phandle->driver_status) { + PRINTM(MERROR, + "Block woal_cfg80211_scan in abnormal driver state\n"); + LEAVE(); + return -EFAULT; + } #if defined(WIFI_LATENCY_MODE_SUPPORT) if (MTRUE == priv->scan_suppressed) { PRINTM(MINFO, "Suppress scan request per config\n");