From ac8504a703cb4538e172b66db77ebd2009756a7e Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Mon, 3 Jun 2019 14:51:36 +0530 Subject: [PATCH] qcacld-3.0: Cleanup the scan blacklist path Currently with the support of Blacklist manager component, all the blacklist, avoid list, RSSI-REJECT list is maintained by the BLM, hence the filter logic of the blacklist APs in the scan component is not required. Cleanup the blacklist BSSID APIs, and related functionality. Change-Id: I4c8283d2c5e4ca66c24a25d31a74026510bb452c CRs-Fixed: 2464188 --- .../blacklist_mgr/core/inc/wlan_blm_core.h | 4 +-- .../blacklist_mgr/core/src/wlan_blm_core.c | 4 +-- .../blacklist_mgr/core/src/wlan_blm_main.c | 3 +- .../dispatcher/inc/wlan_blm_ucfg_api.h | 17 +++++++++ .../dispatcher/src/wlan_blm_ucfg_api.c | 14 ++++++++ core/hdd/src/wlan_hdd_main.c | 19 ++++++++++ core/sme/src/common/sme_api.c | 36 ------------------- 7 files changed, 56 insertions(+), 41 deletions(-) diff --git a/components/blacklist_mgr/core/inc/wlan_blm_core.h b/components/blacklist_mgr/core/inc/wlan_blm_core.h index 8e0e936789a0..0f3a071995fb 100644 --- a/components/blacklist_mgr/core/inc/wlan_blm_core.h +++ b/components/blacklist_mgr/core/inc/wlan_blm_core.h @@ -219,7 +219,7 @@ blm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev, enum blm_connection_state con_state); /** - * blm_delete_reject_ap_list() - Clear away BSSID and destroy the reject ap list + * blm_flush_reject_ap_list() - Clear away BSSID and destroy the reject ap list * @blm_ctx: blacklist manager pdev priv object * * This API will clear the BSSID info in the reject AP list maintained by the @@ -228,7 +228,7 @@ blm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev, * Return: None */ void -blm_delete_reject_ap_list(struct blm_pdev_priv_obj *blm_ctx); +blm_flush_reject_ap_list(struct blm_pdev_priv_obj *blm_ctx); /** * blm_get_bssid_reject_list() - Get the BSSIDs in reject list from BLM diff --git a/components/blacklist_mgr/core/src/wlan_blm_core.c b/components/blacklist_mgr/core/src/wlan_blm_core.c index 0c6fbb938323..06f498b91d78 100644 --- a/components/blacklist_mgr/core/src/wlan_blm_core.c +++ b/components/blacklist_mgr/core/src/wlan_blm_core.c @@ -847,7 +847,7 @@ blm_add_userspace_black_list(struct wlan_objmgr_pdev *pdev, } void -blm_delete_reject_ap_list(struct blm_pdev_priv_obj *blm_ctx) +blm_flush_reject_ap_list(struct blm_pdev_priv_obj *blm_ctx) { struct blm_reject_ap *blm_entry = NULL; QDF_STATUS status; @@ -873,7 +873,7 @@ blm_delete_reject_ap_list(struct blm_pdev_priv_obj *blm_ctx) next_node = NULL; } - qdf_list_destroy(&blm_ctx->reject_ap_list); + blm_debug("BLM reject ap list flushed"); qdf_mutex_release(&blm_ctx->reject_ap_list_lock); } diff --git a/components/blacklist_mgr/core/src/wlan_blm_main.c b/components/blacklist_mgr/core/src/wlan_blm_main.c index 2908f154c377..003150b5c149 100644 --- a/components/blacklist_mgr/core/src/wlan_blm_main.c +++ b/components/blacklist_mgr/core/src/wlan_blm_main.c @@ -101,7 +101,8 @@ blm_pdev_object_destroyed_notification(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_E_FAILURE; } /* Clear away the memory allocated for the bad BSSIDs */ - blm_delete_reject_ap_list(blm_ctx); + blm_flush_reject_ap_list(blm_ctx); + qdf_list_destroy(&blm_ctx->reject_ap_list); qdf_mutex_destroy(&blm_ctx->reject_ap_list_lock); wlan_objmgr_pdev_component_obj_detach(pdev, diff --git a/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h b/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h index e0cddce1a1f6..3cc538335265 100644 --- a/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h +++ b/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h @@ -116,6 +116,18 @@ QDF_STATUS ucfg_blm_add_bssid_to_reject_list(struct wlan_objmgr_pdev *pdev, struct reject_ap_info *ap_info); +/** + * ucfg_blm_flush_reject_ap_list() - Flush the reject ap entries stored in BLM. + * @blm_ctx: blacklist manager pdev priv object + * + * This API will clear the BSSID info in the reject AP list maintained by the + * blacklist manager, and will destroy the list as well. + * + * Return: None + */ +void +ucfg_blm_flush_reject_ap_list(struct wlan_objmgr_pdev *pdev); + #else static inline QDF_STATUS ucfg_blm_init(void) @@ -164,5 +176,10 @@ ucfg_blm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev, { } +static inline +void ucfg_blm_flush_reject_ap_list(struct wlan_objmgr_pdev *pdev) +{ +} + #endif #endif /* _WLAN_BLM_UCFG_H_ */ diff --git a/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c b/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c index 66103d834859..d74e27ec7c91 100644 --- a/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c +++ b/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c @@ -138,3 +138,17 @@ ucfg_blm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev, { blm_update_bssid_connect_params(pdev, bssid, con_state); } + +void +ucfg_blm_flush_reject_ap_list(struct wlan_objmgr_pdev *pdev) +{ + struct blm_pdev_priv_obj *blm_ctx; + + blm_ctx = blm_get_pdev_obj(pdev); + if (!blm_ctx) { + blm_err("blm_ctx is NULL"); + return; + } + + blm_flush_reject_ap_list(blm_ctx); +} diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 4418c91fa9d7..256a79ce1866 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3224,6 +3224,21 @@ static int hdd_open(struct net_device *net_dev) return errno; } +static bool +hdd_is_any_sta_interface_open(struct hdd_context *hdd_ctx) +{ + struct hdd_adapter *adapter; + + hdd_for_each_adapter(hdd_ctx, adapter) { + if (adapter->device_mode == QDF_STA_MODE && + (test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags) || + test_bit(SME_SESSION_OPENED, &adapter->event_flags))) + return true; + } + + return false; +} + /** * __hdd_stop() - HDD stop function * @dev: Pointer to net_device structure @@ -3308,6 +3323,10 @@ static int __hdd_stop(struct net_device *dev) /* DeInit the adapter. This ensures datapath cleanup as well */ hdd_deinit_adapter(hdd_ctx, adapter, true); + /* If no STA interface is open, then flush out the BLM entries */ + if (!hdd_is_any_sta_interface_open(hdd_ctx)) + ucfg_blm_flush_reject_ap_list(hdd_ctx->pdev); + if (!hdd_is_any_interface_open(hdd_ctx)) hdd_psoc_idle_timer_start(hdd_ctx); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index ceda0ab93252..72028e60c575 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -925,40 +925,6 @@ QDF_STATUS sme_update_config(mac_handle_t mac_handle, return status; } -/** - * sme_update_scan_roam_params() - Update the scan roaming params - * @mac_ctx: mac ctx - * - * Return: void. - */ -static void sme_update_scan_roam_params(struct mac_context *mac_ctx) -{ - struct roam_filter_params scan_params = {0}; - struct roam_ext_params *roam_params_src; - uint8_t i; - QDF_STATUS status; - - roam_params_src = &mac_ctx->roam.configParam.roam_params; - - scan_params.num_bssid_avoid_list = - roam_params_src->num_bssid_avoid_list; - - if (scan_params.num_bssid_avoid_list > - MAX_AVOID_LIST_BSSID) - scan_params.num_bssid_avoid_list = - MAX_AVOID_LIST_BSSID; - - for (i = 0; i < scan_params.num_bssid_avoid_list; i++) { - qdf_copy_macaddr(&scan_params.bssid_avoid_list[i], - &roam_params_src->bssid_avoid_list[i]); - } - - status = ucfg_scan_update_roam_params(mac_ctx->psoc, &scan_params); - if (QDF_IS_STATUS_ERROR(status)) - sme_err("ailed to update scan roam params with status=%d", - status); -} - /** * sme_update_roam_params() - Store/Update the roaming params * @mac_handle: Opaque handle to the global MAC context @@ -1049,8 +1015,6 @@ QDF_STATUS sme_update_roam_params(mac_handle_t mac_handle, sme_release_global_lock(&mac_ctx->sme); } - sme_update_scan_roam_params(mac_ctx); - return 0; }