diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index f7aa2a7390..32d5277143 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1772,11 +1772,16 @@ static QDF_STATUS hdd_hostapd_chan_change(struct wlan_hdd_link_info *link_info, bool legacy_phymode; struct hdd_adapter *adapter = link_info->adapter; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - struct sap_ch_selected_s *sap_chan_selected = - &sap_event->sapevt.sap_ch_selected; + struct sap_ch_selected_s *sap_chan_selected; struct sap_config *sap_config = &link_info->session.ap.sap_config; + if (sap_event->sapHddEventCode == eSAP_CHANNEL_CHANGE_RESP) + sap_chan_selected = + &sap_event->sapevt.sap_chan_cng_rsp.sap_ch_selected; + else + sap_chan_selected = &sap_event->sapevt.sap_ch_selected; + sap_ch_param.ch_width = sap_chan_selected->ch_width; sap_ch_param.mhz_freq_seg0 = sap_chan_selected->vht_seg0_center_ch_freq; @@ -2357,6 +2362,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event, /* Invalidate the channel info. */ ap_ctx->operating_chan_freq = 0; + qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0); + /* reset the dfs_cac_status and dfs_cac_block_tx flag only when * the last BSS is stopped */ @@ -3076,7 +3083,20 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event, if (!QDF_IS_STATUS_SUCCESS(qdf_status)) hdd_err("qdf_event_set failed! status: %d", qdf_status); - return hdd_hostapd_chan_change(link_info, sap_event); + if (sap_event->sapevt.sap_chan_cng_rsp.ch_change_rsp_status != + eSAP_STATUS_SUCCESS) { + /* This is much more serious issue, we have to vacate + * the channel due to the presence of radar or coex + * but our channel change failed, stop the BSS operation + * completely and inform hostapd + */ + hdd_debug("SAP[vdev%d] channel switch fail, will stop", + link_info->vdev_id); + schedule_work(&adapter->sap_stop_bss_work); + return QDF_STATUS_SUCCESS; + } else { + return hdd_hostapd_chan_change(link_info, sap_event); + } default: hdd_debug("SAP message is not handled"); goto stopbss; diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 424e202eba..249631b4fe 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -388,6 +388,16 @@ struct sap_ch_change_ind { uint32_t new_chan_freq; }; +/** + * struct sap_ch_change_rsp - channel change response + * @sap_ch_selected: channel parameters of new channel + * @ch_change_rsp_status: channel change response status + */ +struct sap_ch_change_rsp { + struct sap_ch_selected_s sap_ch_selected; + eSapStatus ch_change_rsp_status; +}; + /* * This struct will be filled in and passed to sap_event_cb that is * provided during wlansap_start_bss call The event id corresponding to @@ -422,8 +432,8 @@ struct sap_event { tSap_MaxAssocExceededEvent sapMaxAssocExceeded; struct sap_ch_selected_s sap_ch_selected; struct sap_ch_change_ind sap_chan_cng_ind; + struct sap_ch_change_rsp sap_chan_cng_rsp; struct sap_acs_scan_complete_event sap_acs_scan_comp; - QDF_STATUS ch_change_rsp_status; } sapevt; }; diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index 43104a55d6..f3ec907371 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -1410,19 +1410,13 @@ QDF_STATUS wlansap_roam_callback(void *ctx, qdf_ret_status = sap_signal_hdd_event(sap_ctx, csr_roam_info, eSAP_CHANNEL_CHANGE_RESP, - (void *)QDF_STATUS_SUCCESS); + (void *)eSAP_STATUS_SUCCESS); break; case eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE: - /* This is much more serious issue, we have to vacate the - * channel due to the presence of radar but our channel change - * failed, stop the BSS operation completely and inform hostapd - */ - qdf_ret_status = wlansap_stop_bss(sap_ctx); - qdf_ret_status = sap_signal_hdd_event(sap_ctx, csr_roam_info, eSAP_CHANNEL_CHANGE_RESP, - (void *)QDF_STATUS_E_FAILURE); + (void *)eSAP_STATUS_FAILURE); break; case eCSR_ROAM_EXT_CHG_CHNL_UPDATE_IND: qdf_status = sap_signal_hdd_event(sap_ctx, csr_roam_info, diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 0f830f287a..3c9de583ad 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -2787,7 +2787,10 @@ QDF_STATUS sap_signal_hdd_event(struct sap_context *sap_ctx, case eSAP_CHANNEL_CHANGE_RESP: sap_ap_event->sapHddEventCode = eSAP_CHANNEL_CHANGE_RESP; - acs_selected = &sap_ap_event->sapevt.sap_ch_selected; + sap_ap_event->sapevt.sap_chan_cng_rsp.ch_change_rsp_status = + (eSapStatus)context; + acs_selected = + &sap_ap_event->sapevt.sap_chan_cng_rsp.sap_ch_selected; acs_selected->pri_ch_freq = sap_ctx->chan_freq; acs_selected->ht_sec_ch_freq = sap_ctx->sec_ch_freq; acs_selected->ch_width =