From e4b24877f9b3df2840985d6e8302be384f30dd3b Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Fri, 27 Oct 2017 08:37:12 -0700 Subject: [PATCH] qcacld-3.0: Refactor hdd_clear_all_sta() Function hdd_clear_all_sta() is not as "clean" as it could be so refactor it. Change-Id: I6cba74464a8b7d9536f931c16f5100dd8072fcba CRs-Fixed: 2134919 --- core/hdd/src/wlan_hdd_hostapd.c | 45 ++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 65f9839a2c68..69116a7c5c15 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -660,27 +660,36 @@ static void hdd_hostapd_inactivity_timer_cb(void *context) EXIT(); } +static void hdd_clear_sta(struct hdd_adapter *adapter, uint8_t sta_id) +{ + struct hdd_ap_ctx *ap_ctx; + struct hdd_station_info *sta_info; + struct tagCsrDelStaParams del_sta_params; + + ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter); + + if (sta_id == ap_ctx->broadcast_sta_id) + return; + + sta_info = &adapter->sta_info[sta_id]; + if (!sta_info->in_use) + return; + + wlansap_populate_del_sta_params(sta_info->sta_mac.bytes, + eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, + (SIR_MAC_MGMT_DISASSOC >> 4), + &del_sta_params); + + hdd_softap_sta_disassoc(adapter, &del_sta_params); +} + static void hdd_clear_all_sta(struct hdd_adapter *adapter) { - uint8_t staId = 0; - struct tagCsrDelStaParams del_sta_params; - struct hdd_ap_ctx *ap_ctx; + uint8_t sta_id; - hdd_debug("Clearing all the STA entry...."); - ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter); - for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) { - if (adapter->sta_info[staId].in_use && - (staId != ap_ctx->broadcast_sta_id)) { - wlansap_populate_del_sta_params( - &adapter->sta_info[staId].sta_mac. - bytes[0], eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, - (SIR_MAC_MGMT_DISASSOC >> 4), &del_sta_params); - - /* Disconnect all the stations */ - hdd_softap_sta_disassoc(adapter, - &del_sta_params); - } - } + ENTER_DEV(adapter->dev); + for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) + hdd_clear_sta(adapter, sta_id); } static int hdd_stop_bss_link(struct hdd_adapter *adapter,