diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h index 951abffa6b0b..2378e8aa4f51 100644 --- a/core/cds/inc/cds_concurrency.h +++ b/core/cds/inc/cds_concurrency.h @@ -852,6 +852,7 @@ QDF_STATUS cds_get_valid_chan_weights(struct sir_pcl_chan_weights *weight); QDF_STATUS cds_set_hw_mode_on_channel_switch(uint8_t session_id); void cds_set_do_hw_mode_change_flag(bool flag); bool cds_is_hw_mode_change_after_vdev_up(void); +void cds_checkn_update_hw_mode_single_mac_mode(uint8_t channel); void cds_dump_connection_status_info(void); uint32_t cds_mode_specific_connection_count(enum cds_con_mode mode, uint32_t *list); diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index b6f8364b2143..e5519c4727c2 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -9116,6 +9116,45 @@ uint8_t cds_get_mcc_operating_channel(uint8_t session_id) return chan; } +/** + * cds_checkn_update_hw_mode_single_mac_mode() - Set hw_mode to SMM + * if required + * @channel: channel number for the new STA connection + * + * After the STA disconnection, if the hw_mode is in DBS and the new STA + * connection is coming in the band in which existing connections are + * present, then this function stops the dbs opportunistic timer and sets + * the hw_mode to Single MAC mode (SMM). + * + * Return: None + */ +void cds_checkn_update_hw_mode_single_mac_mode(uint8_t channel) +{ + uint8_t i; + cds_context_type *cds_ctx; + + cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); + if (!cds_ctx) { + cds_err("Invalid CDS Context"); + return; + } + + for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { + if (conc_connection_list[i].in_use) + if (!CDS_IS_SAME_BAND_CHANNELS(channel, + conc_connection_list[i].chan)) { + cds_info("DBS required"); + return; + } + } + + if (QDF_TIMER_STATE_RUNNING == + cds_ctx->dbs_opportunistic_timer.state) + qdf_mc_timer_stop(&cds_ctx->dbs_opportunistic_timer); + + cds_dbs_opportunistic_timer_handler((void *)cds_ctx); +} + /** * cds_set_do_hw_mode_change_flag() - Set flag to indicate hw mode change * @flag: Indicate if hw mode change is required or not diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 36a8a46a71f5..926d4f077678 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11166,6 +11166,8 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter, tCsrRoamProfile *pRoamProfile; eCsrAuthType RSNAuthType; tSmeConfigParams *sme_config; + uint8_t channel = 0; + struct sir_hw_mode_params hw_mode; ENTER(); @@ -11458,6 +11460,21 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter, pRoamProfile->ChannelInfo.ChannelList = NULL; pRoamProfile->ChannelInfo.numOfChannels = 0; + if (!QDF_IS_STATUS_SUCCESS( + wma_get_current_hw_mode(&hw_mode))) { + hdd_err("wma_get_current_hw_mode failed"); + return status; + } + + if ((QDF_STA_MODE == pAdapter->device_mode) + && hw_mode.dbs_cap) { + cds_get_channel_from_scan_result(pAdapter, + pRoamProfile, &channel); + if (channel) + cds_checkn_update_hw_mode_single_mac_mode + (channel); + } + } else { hdd_err("No valid Roam profile"); return -EINVAL;