From 0fa2d4c851891a660074edc09840adbb9f4c7878 Mon Sep 17 00:00:00 2001 From: poornakumar-pk Date: Tue, 6 Oct 2026 10:30:03 +0530 Subject: [PATCH] LTE-3100: DFS channel can't be reuse for BH on nop_started Reason for change: It prevents the STA connection attempt when the candidate is invalid Test Procedure: check XLE not use same channel while it is in the nop_started state Risks: Priority: P1 Signed-off-by: poornakumar_mezhiselvam@comcast.com --- source/core/services/vap_svc_mesh_ext.c | 64 +++++++++++++++++++++++++ source/utils/wifi_util.c | 6 ++- 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/source/core/services/vap_svc_mesh_ext.c b/source/core/services/vap_svc_mesh_ext.c index fd9a422c3a..4b1e564901 100644 --- a/source/core/services/vap_svc_mesh_ext.c +++ b/source/core/services/vap_svc_mesh_ext.c @@ -1064,9 +1064,20 @@ void ext_try_connecting(vap_svc_t *svc) bss_candidate_t *new_bss = NULL; bss_candidate_t *last_connected_bss = NULL; bool found_at_least_one_candidate = false; + bool candidate_valid; wifi_ctrl_t *ctrl; + wifi_mgr_t *mgr; + wifi_radio_operationParam_t *radio_params; + wifi_radio_operationParam_t *candidate_params; + unsigned char candidate_channel; ctrl = svc->ctrl; + mgr = (wifi_mgr_t *)get_wifimgr_obj(); + if (mgr == NULL) { + wifi_util_error_print(WIFI_CTRL, "%s:%d: failed to get wifi manager\n", + __func__, __LINE__); + return; + } ext = &svc->u.ext; if (ext->conn_state == connection_state_connection_to_nb_in_progress) { @@ -1161,6 +1172,59 @@ void ext_try_connecting(vap_svc_t *svc) return; } vap_index = get_sta_vap_index_for_radio(svc->prop, radio_index); + radio_params = get_wifidb_radio_map(radio_index); + if (radio_params == NULL) { + wifi_util_error_print(WIFI_CTRL, + "%s:%d: failed to get radio parameters for radio index %d\n", __func__, __LINE__, + radio_index); + return; + } + + candidate_channel = 0; + convert_freq_to_channel(candidate->external_ap.freq, &candidate_channel); + candidate_params = (wifi_radio_operationParam_t *)malloc(sizeof(wifi_radio_operationParam_t)); + if (candidate_params == NULL) { + wifi_util_error_print(WIFI_CTRL, "%s:%d: failed to allocate candidate radio parameters\n", + __func__, __LINE__); + return; + } + + pthread_mutex_lock(&mgr->data_cache_lock); + memcpy(candidate_params, radio_params, sizeof(wifi_radio_operationParam_t)); + pthread_mutex_unlock(&mgr->data_cache_lock); + + candidate_params->channel = candidate_channel; + if (candidate->external_ap.oper_chan_bw != 0) { + candidate_params->channelWidth = candidate->external_ap.oper_chan_bw; + } + + candidate_valid = (candidate_channel != 0) && + (wifi_radio_operationParam_validation(&mgr->hal_cap, candidate_params) == RETURN_OK); + free(candidate_params); + candidate_params = NULL; + + if (!candidate_valid) { + wifi_util_error_print(WIFI_CTRL, + "%s:%d: rejecting backhaul candidate bssid:%s freq:%d; channel is unavailable\n", + __func__, __LINE__, to_mac_str(candidate->external_ap.bssid, bssid_str), + candidate->external_ap.freq); + + if (ext->conn_state == connection_state_connection_to_nb_in_progress) { + memset(&ext->new_bss, 0, sizeof(ext->new_bss)); + ext_set_conn_state(ext, connection_state_disconnected_scan_list_none, __func__, + __LINE__); + } else if (ext->conn_state == connection_state_connection_to_lcb_in_progress) { + memset(&ext->last_connected_bss, 0, sizeof(ext->last_connected_bss)); + ext_set_conn_state(ext, connection_state_disconnected_scan_list_none, __func__, + __LINE__); + } else { + candidate->conn_attempt = connection_attempt_failed; + candidate->conn_retry_attempt = STA_MAX_CONNECT_ATTEMPT; + } + + schedule_connect_sm(svc); + return; + } if (ctrl->rf_status_down == true) { hotspot_timing_target_detected(); } diff --git a/source/utils/wifi_util.c b/source/utils/wifi_util.c index 433f404e23..1c7ba6a7e2 100644 --- a/source/utils/wifi_util.c +++ b/source/utils/wifi_util.c @@ -3732,8 +3732,10 @@ int wifi_radio_operationParam_validation(wifi_hal_capability_t *hal_cap, wifi_r is_valid = true; } - //If radar was detected on the selected DFS channel, return error - if( (oper->channel >= 52 && oper->channel <=144) ) { + //If radar was detected in the selected 5GHz operating block, return error + if (is_valid && + (is_5g_20M_channel_in_dfs(oper->channel) || + oper->channelWidth == WIFI_CHANNELBANDWIDTH_160MHZ)) { UINT inputChannelBlock = 0; UINT firstChannelInBand = 36; int blockStartChannel = 0;