From 0e6e858aa97e2708e86eedb9ee13ee1ce312106e Mon Sep 17 00:00:00 2001 From: Kiran Kumar Lokere Date: Thu, 20 Feb 2020 19:02:35 -0800 Subject: [PATCH] qcacld-3.0: Correct the SAP event in channel switch response In channel switch response start bss success event is used to indicate the success in which the initial bss settings are done that is leading to set the incorrect keys after the channel switch. Use the channel change event to indicate channel switch success. Change-Id: I0915ee78a97e5f27ce83c31cc673cb8820ae535b CRs-Fixed: 2620809 --- core/hdd/src/wlan_hdd_hostapd.c | 2 +- core/sap/src/sap_api_link_cntl.c | 2 -- core/sap/src/sap_fsm.c | 20 +++++++++++++++----- core/sap/src/sap_internal.h | 3 ++- core/sap/src/sap_module.c | 6 +----- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 9f19decc20f6..4e263b68fc3d 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -2486,7 +2486,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event, if (hostapd_state->bss_state != BSS_STOP) { /* Allow suspend for old channel */ hdd_hostapd_channel_allow_suspend(adapter, - ap_ctx->operating_chan_freq); + ap_ctx->sap_context->freq_before_ch_switch); /* Prevent suspend for new channel */ hdd_hostapd_channel_prevent_suspend(adapter, sap_event->sapevt.sap_ch_selected.pri_ch_freq); diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index 03dce19842c0..3670e686284c 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -1067,8 +1067,6 @@ QDF_STATUS wlansap_roam_callback(void *ctx, case eCSR_ROAM_SET_CHANNEL_RSP: QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, FL("Received set channel response")); - /* SAP channel change request processing is completed */ - sap_ctx->is_chan_change_inprogress = false; break; case eCSR_ROAM_CAC_COMPLETE_IND: QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index c74610183a60..e3c6da7f4aaf 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -2488,10 +2488,18 @@ static QDF_STATUS sap_fsm_state_starting(struct sap_context *sap_ctx, sap_ctx->ch_params.ch_width); sap_ctx->fsm_state = SAP_STARTED; - /* Action code for transition */ - qdf_status = sap_signal_hdd_event(sap_ctx, roam_info, - eSAP_START_BSS_EVENT, - (void *) eSAP_STATUS_SUCCESS); + if (sap_ctx->is_chan_change_inprogress) { + /* SAP channel change request processing is completed */ + sap_ctx->is_chan_change_inprogress = false; + qdf_status = sap_signal_hdd_event(sap_ctx, roam_info, + eSAP_CHANNEL_CHANGE_EVENT, + (void *)eSAP_STATUS_SUCCESS); + } else { + /* Action code for transition */ + qdf_status = sap_signal_hdd_event(sap_ctx, roam_info, + eSAP_START_BSS_EVENT, + (void *) eSAP_STATUS_SUCCESS); + } sap_chan_freq = sap_ctx->chan_freq; band = wlan_reg_freq_to_band(sap_ctx->chan_freq); if (sap_ctx->ch_params.center_freq_seg1) @@ -2506,7 +2514,9 @@ static QDF_STATUS sap_fsm_state_starting(struct sap_context *sap_ctx, * CAC is done if the operating channel is DFS */ if (sap_ctx->ch_params.ch_width == CH_WIDTH_160MHZ) { - is_dfs = true; + is_dfs = wlan_reg_get_5g_bonded_channel_state_for_freq( + mac_ctx->pdev, sap_chan_freq, + CH_WIDTH_160MHZ); } else if (sap_ctx->ch_params.ch_width == CH_WIDTH_80P80MHZ) { if (wlan_reg_get_channel_state_for_freq( mac_ctx->pdev, diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index 48ea78769ff1..aeda026d28b2 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 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 @@ -225,6 +225,7 @@ struct sap_context { bool dfs_cac_offload; bool is_chan_change_inprogress; qdf_list_t owe_pending_assoc_ind_list; + uint32_t freq_before_ch_switch; }; /*---------------------------------------------------------------------------- diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index c2c3b530a364..8ec7c40f13de 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -1770,6 +1770,7 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx, wlan_reg_set_channel_params_for_freq(mac_ctx->pdev, target_chan_freq, 0, ch_params); sap_ctx->ch_params = *ch_params; + sap_ctx->freq_before_ch_switch = sap_ctx->chan_freq; /* Update the channel as this will be used to * send event to supplicant */ @@ -1790,11 +1791,6 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx, ch_params->sec_ch_offset, ch_params->center_freq_seg0, ch_params->center_freq_seg1); - if (QDF_IS_STATUS_SUCCESS(status)) - sap_signal_hdd_event(sap_ctx, NULL, - eSAP_CHANNEL_CHANGE_EVENT, - (void *) eSAP_STATUS_SUCCESS); - return status; }