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 3cc538335265..a6cd7635310f 100644 --- a/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h +++ b/components/blacklist_mgr/dispatcher/inc/wlan_blm_ucfg_api.h @@ -117,16 +117,16 @@ 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. + * ucfg_blm_wifi_off() - Inform the blacklist manager about wifi off * @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. + * This API will inform the blacklist manager that the user has turned wifi off + * from the UI, and the blacklist manager can take action based upon this. * * Return: None */ void -ucfg_blm_flush_reject_ap_list(struct wlan_objmgr_pdev *pdev); +ucfg_blm_wifi_off(struct wlan_objmgr_pdev *pdev); #else static inline @@ -177,7 +177,7 @@ 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) +void ucfg_blm_wifi_off(struct wlan_objmgr_pdev *pdev) { } 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 f6204425b5fc..afd603b7143c 100644 --- a/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c +++ b/components/blacklist_mgr/dispatcher/src/wlan_blm_ucfg_api.c @@ -141,10 +141,15 @@ ucfg_blm_update_bssid_connect_params(struct wlan_objmgr_pdev *pdev, } void -ucfg_blm_flush_reject_ap_list(struct wlan_objmgr_pdev *pdev) +ucfg_blm_wifi_off(struct wlan_objmgr_pdev *pdev) { struct blm_pdev_priv_obj *blm_ctx; + if (!pdev) { + blm_err("pdev is NULL"); + return; + } + blm_ctx = blm_get_pdev_obj(pdev); if (!blm_ctx) { blm_err("blm_ctx is NULL"); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index cb809eeb0e50..0743a971c286 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3225,21 +3225,6 @@ 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 @@ -3324,10 +3309,6 @@ 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); @@ -13072,6 +13053,17 @@ static int wlan_hdd_state_ctrl_param_open(struct inode *inode, return 0; } +static void hdd_inform_wifi_off(void) +{ + struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + + if (!hdd_ctx) { + hdd_err("Invalid hdd/pdev context"); + return; + } + ucfg_blm_wifi_off(hdd_ctx->pdev); +} + static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp, const char __user *user_buf, size_t count, @@ -13090,6 +13082,7 @@ static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp, if (strncmp(buf, wlan_off_str, strlen(wlan_off_str)) == 0) { pr_debug("Wifi turning off from UI\n"); + hdd_inform_wifi_off(); goto exit; }