diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 8ccda9788514..91d1fb609e35 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -61,6 +61,7 @@ #include "wlan_p2p_ucfg_api.h" #include "wlan_ipa_ucfg_api.h" #include "wlan_hdd_stats.h" +#include "wlan_hdd_scan.h" #include "wlan_hdd_nud_tracking.h" /* These are needed to recognize WPA and RSN suite types */ @@ -2740,6 +2741,12 @@ hdd_association_completion_handler(struct hdd_adapter *adapter, return QDF_STATUS_E_NULL_VALUE; } + /* + * reset scan reject params if connection is success or we received + * final failure from CSR after trying with all APs. + */ + hdd_reset_scan_reject_params(hdd_ctx, roamStatus, roamResult); + /* * Enable roaming on other STA iface except this one. * Firmware dosent support connection on one STA iface while diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 7eae7ccf5982..6bdbd0867574 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1408,10 +1408,7 @@ QDF_STATUS hdd_wlan_re_init(void) /* Restart all adapters */ hdd_start_all_adapters(hdd_ctx); - hdd_ctx->last_scan_reject_session_id = 0xFF; - hdd_ctx->last_scan_reject_reason = 0; - hdd_ctx->last_scan_reject_timestamp = 0; - hdd_ctx->scan_reject_cnt = 0; + hdd_init_scan_reject_params(hdd_ctx); hdd_set_roaming_in_progress(false); complete(&adapter->roaming_comp_var); diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index a6c25b394054..6059f7c09621 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -322,6 +322,28 @@ void wlan_hdd_cfg80211_scan_block_cb(struct work_struct *work) cds_ssr_unprotect(__func__); } +void hdd_init_scan_reject_params(struct hdd_context *hdd_ctx) +{ + if (hdd_ctx) { + hdd_ctx->last_scan_reject_timestamp = 0; + hdd_ctx->last_scan_reject_session_id = 0xFF; + hdd_ctx->last_scan_reject_reason = 0; + hdd_ctx->scan_reject_cnt = 0; + } +} + +void hdd_reset_scan_reject_params(struct hdd_context *hdd_ctx, + eRoamCmdStatus roam_status, + eCsrRoamResult roam_result) +{ + if ((roam_status == eCSR_ROAM_ASSOCIATION_FAILURE) || + (roam_status == eCSR_ROAM_CANCELLED) || + (roam_result == eCSR_ROAM_RESULT_ASSOCIATED)) { + hdd_debug("Reset scan reject params"); + hdd_init_scan_reject_params(hdd_ctx); + } +} + /* * wlan_hdd_update_scan_ies() - API to update the scan IEs of scan request * with already stored default scan IEs @@ -594,10 +616,8 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy, } return -EBUSY; } - hdd_ctx->last_scan_reject_timestamp = 0; - hdd_ctx->last_scan_reject_session_id = 0xFF; - hdd_ctx->last_scan_reject_reason = 0; - hdd_ctx->scan_reject_cnt = 0; + + hdd_init_scan_reject_params(hdd_ctx); /* Check whether SAP scan can be skipped or not */ if (adapter->device_mode == QDF_SAP_MODE && diff --git a/core/hdd/src/wlan_hdd_scan.h b/core/hdd/src/wlan_hdd_scan.h index 302d222f1a99..bcc874b43be3 100644 --- a/core/hdd/src/wlan_hdd_scan.h +++ b/core/hdd/src/wlan_hdd_scan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -115,6 +115,26 @@ void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev); #endif +/** + * hdd_init_scan_reject_params() - init scan reject params + * @hdd_ctx: hdd contxt + * + * Return: None + */ +void hdd_init_scan_reject_params(struct hdd_context *hdd_ctx); + +/** + * hdd_reset_scan_reject_params() - reset scan reject params per roam stats + * @hdd_ctx: hdd contxt + * @roam_status: roam status + * @roam_result: roam result + * + * Return: None + */ +void hdd_reset_scan_reject_params(struct hdd_context *hdd_ctx, + eRoamCmdStatus roam_status, + eCsrRoamResult roam_result); + /** * wlan_hdd_cfg80211_scan_block_cb() - scan block work handler * @work: Pointer to work