diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 895dccdbcf72..98d43c5fa2c2 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -288,6 +288,7 @@ #define HDD_SESSION_ID_INVALID 0xFF #define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */ +#define SCAN_REJECT_THRESHOLD 15 /* Default Psoc id */ #define DEFAULT_PSOC_ID 1 @@ -1621,6 +1622,7 @@ struct hdd_context_s { uint8_t last_scan_reject_session_id; enum scan_reject_states last_scan_reject_reason; unsigned long last_scan_reject_timestamp; + uint8_t scan_reject_cnt; bool dfs_cac_offload; bool reg_offload; #ifdef FEATURE_WLAN_CH_AVOID diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index caa94c561cf6..176b57323e61 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1406,6 +1406,7 @@ QDF_STATUS hdd_wlan_re_init(void) pHddCtx->last_scan_reject_session_id = 0xFF; pHddCtx->last_scan_reject_reason = 0; pHddCtx->last_scan_reject_timestamp = 0; + pHddCtx->scan_reject_cnt = 0; hdd_set_roaming_in_progress(false); complete(&pAdapter->roaming_comp_var); diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index 1ec652451ae4..fbb1e01aaecf 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -925,14 +925,19 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy, pHddCtx->last_scan_reject_timestamp = jiffies_to_msecs(jiffies) + SCAN_REJECT_THRESHOLD_TIME; + pHddCtx->scan_reject_cnt = 0; } else { - hdd_debug("curr_session id %d curr_reason %d threshold time has elapsed? %d", - curr_session_id, curr_reason, + pHddCtx->scan_reject_cnt++; + hdd_debug("curr_session id %d curr_reason %d count %d threshold time has elapsed? %d", + curr_session_id, curr_reason, pHddCtx->scan_reject_cnt, qdf_system_time_after(jiffies_to_msecs(jiffies), pHddCtx->last_scan_reject_timestamp)); - if (qdf_system_time_after(jiffies_to_msecs(jiffies), + if ((pHddCtx->scan_reject_cnt >= + SCAN_REJECT_THRESHOLD) && + qdf_system_time_after(jiffies_to_msecs(jiffies), pHddCtx->last_scan_reject_timestamp)) { pHddCtx->last_scan_reject_timestamp = 0; + pHddCtx->scan_reject_cnt = 0; if (pHddCtx->config->enable_fatal_event) { cds_flush_logs(WLAN_LOG_TYPE_FATAL, WLAN_LOG_INDICATOR_HOST_DRIVER, @@ -954,6 +959,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy, pHddCtx->last_scan_reject_timestamp = 0; pHddCtx->last_scan_reject_session_id = 0xFF; pHddCtx->last_scan_reject_reason = 0; + pHddCtx->scan_reject_cnt = 0; /* Check whether SAP scan can be skipped or not */ if (pAdapter->device_mode == QDF_SAP_MODE &&