diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 7e98122e7849..6eaa2fd5feab 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -1899,29 +1899,6 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter) return 0; } -/** - * wlan_hdd_sap_get_nol() - Get SAPs NOL - * @ap_adapter: AP adapter - * @nol: Non-occupancy list - * @nol_len: Length of NOL - * - * Get the NOL for SAP - * - * Return: Zero on success, non-zero on failure - */ -static int wlan_hdd_sap_get_nol(struct hdd_adapter *ap_adapter, uint8_t *nol, - uint32_t *nol_len) -{ - QDF_STATUS ret; - - ret = wlansap_get_dfs_nol(WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter), - nol, nol_len); - if (QDF_IS_STATUS_ERROR(ret)) - return -EINVAL; - - return 0; -} - /** * hdd_update_vendor_pcl_list() - This API will return unsorted pcl list * @hdd_ctx: hdd context @@ -9689,67 +9666,6 @@ static int wlan_hdd_set_chan_before_pre_cac(struct hdd_adapter *ap_adapter, return 0; } -/** - * wlan_hdd_get_chanlist_without_nol() - This API removes the channels which - * are in nol list from provided channel list - * @adapter: AP adapter - * @channel_count: channel count - * @channel_list: channel list - * - * Return: None - */ -static void wlan_hdd_get_chanlist_without_nol(struct hdd_adapter *adapter, - uint32_t *channel_count, - uint8_t *channel_list) -{ - uint8_t i, j; - uint32_t nol_len = 0; - uint8_t nol[QDF_MAX_NUM_CHAN] = {0}; - uint8_t tmp_chan_list[QDF_MAX_NUM_CHAN] = {0}; - uint32_t chan_count; - bool found; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - - if (!hdd_ctx) { - hdd_err("hdd ctx not found"); - *channel_count = 0; - return; - } - - if ((*channel_count == 0) || (*channel_count > QDF_MAX_NUM_CHAN)) { - hdd_err("invalid channel count %d", *channel_count); - return; - } - - wlan_hdd_sap_get_nol(adapter, nol, &nol_len); - if (nol_len == 0) - return; - - qdf_mem_copy(tmp_chan_list, channel_list, *channel_count); - chan_count = *channel_count; - qdf_mem_zero(channel_list, chan_count); - *channel_count = 0; - - for (i = 0 ; i < chan_count; i++) { - if ((hdd_ctx->config->force_sap_acs_st_ch > tmp_chan_list[i]) || - (hdd_ctx->config->force_sap_acs_end_ch < tmp_chan_list[i])) - continue; - found = false; - for (j = 0; j < nol_len; j++) { - if (tmp_chan_list[i] == nol[j]) { - found = true; - hdd_notice("skipped channel %d due to nol", - nol[j]); - break; - } - } - if (!found) { - channel_list[*channel_count] = tmp_chan_list[i]; - *channel_count = *channel_count + 1; - } - } -} - int wlan_hdd_sap_get_valid_channellist(struct hdd_adapter *adapter, uint32_t *channel_count, uint8_t *channel_list, @@ -9761,6 +9677,8 @@ int wlan_hdd_sap_get_valid_channellist(struct hdd_adapter *adapter, uint32_t chan_count; uint8_t i; QDF_STATUS status; + struct wlan_objmgr_pdev *pdev = hdd_ctx->hdd_pdev; + uint8_t tmp_chan; sap_config = &adapter->session.ap.sap_config; @@ -9774,21 +9692,24 @@ int wlan_hdd_sap_get_valid_channellist(struct hdd_adapter *adapter, } for (i = 0; i < chan_count; i++) { + tmp_chan = tmp_chan_list[i]; if (*channel_count < QDF_MAX_NUM_CHAN) { if ((BAND_2G == band) && - (WLAN_REG_IS_24GHZ_CH(tmp_chan_list[i]))) { - channel_list[*channel_count] = tmp_chan_list[i]; + (WLAN_REG_IS_24GHZ_CH(tmp_chan)) && + (!wlan_reg_is_disable_ch(pdev, tmp_chan))) { + channel_list[*channel_count] = tmp_chan; *channel_count += 1; } else if ((BAND_5G == band) && - (WLAN_REG_IS_5GHZ_CH(tmp_chan_list[i]))) { - channel_list[*channel_count] = tmp_chan_list[i]; + (WLAN_REG_IS_5GHZ_CH(tmp_chan)) && + (!wlan_reg_is_disable_ch(pdev, tmp_chan))) { + channel_list[*channel_count] = tmp_chan; *channel_count += 1; } } else { break; } } - wlan_hdd_get_chanlist_without_nol(adapter, channel_count, channel_list); + if (*channel_count == 0) { hdd_err("no valid channel found"); return -EINVAL; @@ -9814,12 +9735,9 @@ static int wlan_hdd_validate_and_get_pre_cac_ch(struct hdd_context *hdd_ctx, uint8_t channel, uint8_t *pre_cac_chan) { - uint32_t i, j; + uint32_t i; QDF_STATUS status; - int ret; - uint8_t nol[QDF_MAX_NUM_CHAN]; - uint32_t nol_len = 0, weight_len = 0; - bool found; + uint32_t weight_len = 0; uint32_t len = WNI_CFG_VALID_CHANNEL_LIST_LEN; uint8_t channel_list[QDF_MAX_NUM_CHAN] = {0}; uint8_t pcl_weights[QDF_MAX_NUM_CHAN] = {0}; @@ -9840,17 +9758,7 @@ static int wlan_hdd_validate_and_get_pre_cac_ch(struct hdd_context *hdd_ctx, } policy_mgr_update_with_safe_channel_list(hdd_ctx->hdd_psoc, channel_list, &len, pcl_weights, weight_len); - ret = wlan_hdd_sap_get_nol(ap_adapter, nol, &nol_len); for (i = 0; i < len; i++) { - found = false; - for (j = 0; j < nol_len; j++) { - if (channel_list[i] == nol[j]) { - found = true; - break; - } - } - if (found) - continue; if (wlan_reg_is_dfs_ch(hdd_ctx->hdd_pdev, channel_list[i])) { *pre_cac_chan = channel_list[i]; diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 28130cbee04a..52b16c98196f 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4118,8 +4118,6 @@ static __iw_softap_getparam(struct net_device *dev, QDF_STATUS status; int ret; struct hdd_context *hdd_ctx; - uint8_t nol[QDF_MAX_NUM_CHAN]; - uint32_t nol_len = 0; ENTER_DEV(dev); @@ -4248,10 +4246,6 @@ static __iw_softap_getparam(struct net_device *dev, struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); struct wlan_objmgr_pdev *pdev; - wlansap_get_dfs_nol( - WLAN_HDD_GET_SAP_CTX_PTR(adapter), - nol, &nol_len); - pdev = hdd_ctx->hdd_pdev; if (!pdev) { hdd_err("null pdev"); diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 15d9986c98bc..19549c10c120 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -1330,19 +1330,6 @@ void wlansap_extend_to_acs_range(tHalHandle hal, uint8_t *startChannelNum, uint8_t *endChannelNum, uint8_t *bandStartChannel, uint8_t *bandEndChannel); -/** - * wlansap_get_dfs_nol() - Get the DFS NOL - * @sap_ctx: SAP context - * @nol: Pointer to the NOL - * @nol_len: Length of the NOL - * - * Provides the DFS NOL - * - * Return: QDF_STATUS - */ -QDF_STATUS wlansap_get_dfs_nol(struct sap_context *sap_ctx, - uint8_t *nol, uint32_t *nol_len); - /** * wlansap_set_dfs_nol() - Set dfs nol * @sap_ctx: SAP context diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 10711e65fa5c..f793ca8e0659 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -2344,92 +2344,6 @@ QDF_STATUS wlan_sap_set_vendor_acs(struct sap_context *sap_context, return QDF_STATUS_SUCCESS; } -QDF_STATUS wlansap_get_dfs_nol(struct sap_context *sap_ctx, - uint8_t *nol, uint32_t *nol_len) -{ - int i = 0, j = 0; - void *hHal = NULL; - tpAniSirGlobal pMac = NULL; - uint64_t current_time, found_time, elapsed_time; - unsigned long left_time; - tSapDfsNolInfo *dfs_nol = NULL; - bool bAvailable = false; - *nol_len = 0; - - if (NULL == sap_ctx) { - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, - "%s: Invalid SAP pointer", __func__); - return QDF_STATUS_E_FAULT; - } - hHal = CDS_GET_HAL_CB(); - if (NULL == hHal) { - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, - "%s: Invalid HAL pointer", __func__); - return QDF_STATUS_E_FAULT; - } - pMac = PMAC_STRUCT(hHal); - - if (!pMac->sap.SapDfsInfo.numCurrentRegDomainDfsChannels) { - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, - "%s: DFS NOL is empty", __func__); - return QDF_STATUS_SUCCESS; - } - - dfs_nol = pMac->sap.SapDfsInfo.sapDfsChannelNolList; - - if (!dfs_nol) { - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, - "%s: DFS NOL context is null", __func__); - return QDF_STATUS_E_FAULT; - } - - for (i = 0; i < pMac->sap.SapDfsInfo.numCurrentRegDomainDfsChannels; - i++) { - if (!dfs_nol[i].dfs_channel_number) - continue; - - current_time = cds_get_monotonic_boottime(); - found_time = dfs_nol[i].radar_found_timestamp; - - elapsed_time = current_time - found_time; - - /* check if channel is available - * if either channel is usable or available, or timer expired 30mins - */ - bAvailable = - ((dfs_nol[i].radar_status_flag == - eSAP_DFS_CHANNEL_AVAILABLE) - || (dfs_nol[i].radar_status_flag == - eSAP_DFS_CHANNEL_USABLE) - || (elapsed_time >= SAP_DFS_NON_OCCUPANCY_PERIOD)); - - if (bAvailable) { - dfs_nol[i].radar_status_flag = - eSAP_DFS_CHANNEL_AVAILABLE; - dfs_nol[i].radar_found_timestamp = 0; - - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, - "%s: Channel[%d] is AVAILABLE", - __func__, dfs_nol[i].dfs_channel_number); - } else { - - /* the time left in min */ - left_time = SAP_DFS_NON_OCCUPANCY_PERIOD - elapsed_time; - left_time = left_time / (60 * 1000 * 1000); - - nol[j++] = dfs_nol[i].dfs_channel_number; - (*nol_len)++; - - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, - "%s: Channel[%d] is UNAVAILABLE [%lu min left]", - __func__, - dfs_nol[i].dfs_channel_number, left_time); - } - } - - return QDF_STATUS_SUCCESS; -} - QDF_STATUS wlansap_set_dfs_nol(struct sap_context *sap_ctx, eSapDfsNolType conf) {