From 53f1d00e8f3675588ad4ef58ce7de51b7a05a017 Mon Sep 17 00:00:00 2001 From: Vijay Krishnan Date: Thu, 23 Jul 2020 21:54:35 +0530 Subject: [PATCH] qcacmn: Remove references to CHAN_NUM_API CONFIG_CHAN_NUM_API macro will be disabled. Remove all the references to any function defined/declared under the macro. The function reg_get_channel_list_with_power was placed under CHAN_NUM_API by mistake. This API does not have any CHAN_FREQ_API counterpart. Therefore, move this function out of CHAN_NUM_API macro. The function dfs_send_radar_ind_for_freq is redundant as its counterpart dfs_send_radar_ind has the same arguments and same functionality, removing the function dfs_send_radar_ind_for_freq. The function dfs_send_radar_ind is moved out of CHAN_NUM_API macro. The function wlan_reg_chan_to_freq, wlan_reg_legacy_chan_to_freq is moved out of CONFIG_CHAN_NUM_API macro. Since it is applicable for legacy bands. CRs-Fixed: 2711600 Change-Id: Ib29be638c17ce51f928c865e362ac5b2b8954b42 --- umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c | 28 +------- .../lmac_if/src/wlan_lmac_if.c | 19 ------ .../regulatory/core/src/reg_services_common.c | 4 +- .../regulatory/core/src/reg_services_common.h | 20 +++--- .../dispatcher/inc/wlan_reg_services_api.h | 3 +- .../dispatcher/src/wlan_reg_services_api.c | 4 +- umac/wifi_pos/src/wifi_pos_main.c | 66 ++++++++++++------- 7 files changed, 58 insertions(+), 86 deletions(-) diff --git a/umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c b/umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c index 54e68c6af7..11f46b7ded 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c @@ -70,7 +70,6 @@ void dfs_mlme_mark_dfs_for_freq(struct wlan_objmgr_pdev *pdev, } #endif #else /* Else of ndef MCL_DFS_SUPPORT */ -#ifdef CONFIG_CHAN_NUM_API static void dfs_send_radar_ind(struct wlan_objmgr_pdev *pdev, void *object, void *arg) @@ -87,31 +86,6 @@ static void dfs_send_radar_ind(struct wlan_objmgr_pdev *pdev, dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "eWNI_SME_DFS_RADAR_FOUND pdev%d posted", vdev_id); } -#endif - -/* dfs_send_radar_ind_for_freq() - Send radar found indication. - * @pdev: Pointer to wlan_objmgr_pdev. - * @object: Pointer to wlan_objmgr_vdev. - * @arg : void pointer to args. - */ -#ifdef CONFIG_CHAN_FREQ_API -static void dfs_send_radar_ind_for_freq(struct wlan_objmgr_pdev *pdev, - void *object, - void *arg) -{ - struct scheduler_msg sme_msg = {0}; - uint8_t vdev_id = wlan_vdev_get_id((struct wlan_objmgr_vdev *)object); - - sme_msg.type = eWNI_SME_DFS_RADAR_FOUND; - sme_msg.bodyptr = NULL; - sme_msg.bodyval = vdev_id; - scheduler_post_message(QDF_MODULE_ID_DFS, - QDF_MODULE_ID_SME, - QDF_MODULE_ID_SME, &sme_msg); - dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "eWNI_SME_DFS_RADAR_FOUND pdev%d posted", - vdev_id); -} -#endif #ifdef CONFIG_CHAN_NUM_API void dfs_mlme_mark_dfs(struct wlan_objmgr_pdev *pdev, @@ -153,7 +127,7 @@ void dfs_mlme_mark_dfs_for_freq(struct wlan_objmgr_pdev *pdev, vdev = wlan_pdev_peek_active_first_vdev(pdev, WLAN_DFS_ID); if (vdev) { - dfs_send_radar_ind_for_freq(pdev, vdev, NULL); + dfs_send_radar_ind(pdev, vdev, NULL); wlan_objmgr_vdev_release_ref(vdev, WLAN_DFS_ID); } } diff --git a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c index 43c3d379b8..dff261616c 100644 --- a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c +++ b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c @@ -466,24 +466,6 @@ static void register_dfs_rx_ops_for_freq(struct wlan_lmac_if_dfs_rx_ops *rx_ops) } #endif -/* - * register_dfs_rx_ops_for_ieee() - Register DFS rx ops for IEEE channel based - * APIs - * rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops. - */ - -#ifdef CONFIG_CHAN_NUM_API -static void register_dfs_rx_ops_for_ieee(struct wlan_lmac_if_dfs_rx_ops *rx_ops) -{ - if (!rx_ops) - return; - rx_ops->dfs_find_vht80_chan_for_precac = - tgt_dfs_find_vht80_chan_for_precac; - rx_ops->dfs_set_current_channel = - tgt_dfs_set_current_channel; -} -#endif - /* * register_rcac_dfs_rx_ops() - Register DFS RX-Ops for Rolling CAC specific * APIs. @@ -592,7 +574,6 @@ wlan_lmac_if_umac_dfs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) register_precac_auto_chan_rx_ops_ieee(dfs_rx_ops); register_precac_auto_chan_rx_ops_freq(dfs_rx_ops); register_dfs_rx_ops_for_freq(dfs_rx_ops); - register_dfs_rx_ops_for_ieee(dfs_rx_ops); register_rcac_dfs_rx_ops(dfs_rx_ops); return QDF_STATUS_SUCCESS; diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index 3759edd874..ce54ec54d3 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -1066,7 +1066,6 @@ struct wlan_lmac_if_reg_tx_ops *reg_get_psoc_tx_ops( return &tx_ops->reg_ops; } -#ifdef CONFIG_CHAN_NUM_API QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, struct channel_power *ch_list, uint8_t *num_chan) @@ -1107,6 +1106,7 @@ QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_SUCCESS; } +#ifdef CONFIG_CHAN_NUM_API enum channel_enum reg_get_chan_enum(uint8_t chan_num) { uint32_t count; @@ -1819,7 +1819,6 @@ uint16_t reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, max_chan_range); } -#ifdef CONFIG_CHAN_NUM_API qdf_freq_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint8_t chan_num) { @@ -1856,6 +1855,7 @@ qdf_freq_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, return 0; } +#ifdef CONFIG_CHAN_NUM_API bool reg_chan_is_49ghz(struct wlan_objmgr_pdev *pdev, uint8_t chan_num) { qdf_freq_t freq = 0; diff --git a/umac/regulatory/core/src/reg_services_common.h b/umac/regulatory/core/src/reg_services_common.h index 7f96ae1a21..fd28258c7e 100644 --- a/umac/regulatory/core/src/reg_services_common.h +++ b/umac/regulatory/core/src/reg_services_common.h @@ -127,15 +127,6 @@ extern const struct chan_map channel_map_jp[]; extern const struct chan_map channel_map_china[]; extern const struct chan_map channel_map_global[]; -#ifdef CONFIG_CHAN_NUM_API -/** - * reg_get_chan_enum() - Get channel enum for given channel number - * @chan_num: Channel number - * - * Return: Channel enum - */ -enum channel_enum reg_get_chan_enum(uint8_t chan_num); - /** * reg_get_channel_list_with_power() - Provides the channel list with power * @pdev: Pointer to pdev @@ -148,6 +139,15 @@ QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, struct channel_power *ch_list, uint8_t *num_chan); +#ifdef CONFIG_CHAN_NUM_API +/** + * reg_get_chan_enum() - Get channel enum for given channel number + * @chan_num: Channel number + * + * Return: Channel enum + */ +enum channel_enum reg_get_chan_enum(uint8_t chan_num); + /** * reg_get_channel_state() - Get channel state from regulatory * @pdev: Pointer to pdev @@ -357,7 +357,6 @@ bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint8_t chan); */ uint8_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq); -#ifdef CONFIG_CHAN_NUM_API /** * reg_chan_to_freq() - Get frequency from channel number * @pdev: Pointer to pdev @@ -377,6 +376,7 @@ qdf_freq_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint8_t chan_num); uint16_t reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint8_t chan_num); +#ifdef CONFIG_CHAN_NUM_API /** * reg_chan_is_49ghz() - Check if the input channel number is 4.9GHz * @pdev: Pdev pointer diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index a0856025aa..3592c71763 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -318,6 +318,7 @@ bool wlan_reg_is_channel_valid_5g_sbs(uint8_t curchan, uint8_t newchan); */ #define WLAN_REG_CHAN_TO_BAND(chan_num) wlan_reg_chan_to_band(chan_num) enum band_info wlan_reg_chan_to_band(uint8_t chan_num); +#endif /* CONFIG_CHAN_NUM_API */ /** * wlan_reg_get_channel_list_with_power() - Provide the channel list with power @@ -328,7 +329,7 @@ enum band_info wlan_reg_chan_to_band(uint8_t chan_num); QDF_STATUS wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, struct channel_power *ch_list, uint8_t *num_chan); -#endif /* CONFIG_CHAN_NUM_API */ + /** * wlan_reg_read_default_country() - Read the default country for the regdomain * @country: pointer to the country code. diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index fd343a3ec6..1fd34b1d10 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -42,7 +42,6 @@ #include <../../core/src/reg_offload_11d_scan.h> #include -#ifdef CONFIG_CHAN_NUM_API /** * wlan_reg_get_channel_list_with_power() - Provide the channel list with power * @ch_list: pointer to the channel list. @@ -58,7 +57,6 @@ QDF_STATUS wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev, */ return reg_get_channel_list_with_power(pdev, ch_list, num_chan); } -#endif /* CONFIG_CHAN_NUM_API */ /** * wlan_reg_read_default_country() - Read the default country for the regdomain @@ -562,7 +560,6 @@ uint8_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, qdf_export_symbol(wlan_reg_freq_to_chan); -#ifdef CONFIG_CHAN_NUM_API qdf_freq_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint8_t chan_num) { @@ -577,6 +574,7 @@ qdf_freq_t wlan_reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev, return reg_legacy_chan_to_freq(pdev, chan_num); } +#ifdef CONFIG_CHAN_NUM_API bool wlan_reg_chan_is_49ghz(struct wlan_objmgr_pdev *pdev, uint8_t chan_num) { diff --git a/umac/wifi_pos/src/wifi_pos_main.c b/umac/wifi_pos/src/wifi_pos_main.c index 6352a6dc1e..f30a9427c7 100644 --- a/umac/wifi_pos/src/wifi_pos_main.c +++ b/umac/wifi_pos/src/wifi_pos_main.c @@ -440,21 +440,23 @@ static void wifi_pos_get_reg_info(struct wlan_objmgr_pdev *pdev, /** * wifi_pos_get_valid_channels: Get the list of valid channels from the * given channel list - * @channels: Channel list to be validated + * @chan_freqs: Channel frequencies to be validated * @num_ch: NUmber of channels in the channel list to be validated * @valid_channel_list: Pointer to valid channel list * * Return: Number of valid channels in the given list */ - -static uint32_t wifi_pos_get_valid_channels(uint8_t *channels, uint32_t num_ch, - uint8_t *valid_channel_list) { +static uint32_t wifi_pos_get_valid_channels(qdf_freq_t *chan_freqs, + uint32_t num_ch, + qdf_freq_t *valid_channel_list) +{ uint32_t i, num_valid_channels = 0; for (i = 0; i < num_ch; i++) { - if (wlan_reg_get_chan_enum(channels[i]) == INVALID_CHANNEL) + if (wlan_reg_get_chan_enum_for_freq(chan_freqs[i]) == + INVALID_CHANNEL) continue; - valid_channel_list[num_valid_channels++] = channels[i]; + valid_channel_list[num_valid_channels++] = chan_freqs[i]; } return num_valid_channels; } @@ -495,21 +497,23 @@ static void wifi_pos_get_ch_info(struct wlan_objmgr_psoc *psoc, static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc, struct wifi_pos_req_msg *req) { - uint8_t idx, band_mask; - uint8_t *buf; + uint8_t idx; + uint8_t *buf = NULL; uint32_t len, i, freq; uint32_t reg_info_1; uint32_t reg_info_2; + qdf_freq_t *chan_freqs = NULL; bool oem_6g_support_disable; uint8_t *channels = req->buf; struct wlan_objmgr_pdev *pdev; uint32_t num_ch = req->buf_len; - uint8_t valid_channel_list[NUM_CHANNELS]; + qdf_freq_t valid_channel_list[NUM_CHANNELS]; uint32_t num_valid_channels = 0; struct wifi_pos_ch_info_rsp *ch_info; - struct wifi_pos_channel_list *ch_list; + struct wifi_pos_channel_list *ch_list = NULL; struct wifi_pos_psoc_priv_obj *wifi_pos_obj = wifi_pos_get_psoc_priv_obj(psoc); + QDF_STATUS ret_val; if (!wifi_pos_obj) { wifi_pos_err("wifi_pos priv obj is null"); @@ -527,12 +531,21 @@ static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc, } if (num_ch > NUM_CHANNELS) { wifi_pos_err("Invalid number of channels"); - return QDF_STATUS_E_INVAL; + ret_val = QDF_STATUS_E_INVAL; + goto cleanup; + } + + chan_freqs = qdf_mem_malloc(NUM_CHANNELS * (sizeof(*chan_freqs))); + if (!chan_freqs) { + ret_val = QDF_STATUS_E_NOMEM; + goto cleanup; } ch_list = qdf_mem_malloc(sizeof(*ch_list)); - if (!ch_list) - return QDF_STATUS_E_NOMEM; + if (!ch_list) { + ret_val = QDF_STATUS_E_NOMEM; + goto cleanup; + } if (num_ch == 0 && req->rsp_version == WIFI_POS_RSP_V2_NL) { wifi_pos_get_ch_info(psoc, ch_list); @@ -549,18 +562,21 @@ static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc, num_valid_channels++; } } else { + for (i = 0; i < NUM_CHANNELS; i++) + chan_freqs[i] = + wlan_reg_chan_band_to_freq(pdev, channels[i], + BIT(REG_BAND_5G) | + BIT(REG_BAND_2G)); /* v1 has ch_list with frequencies in order of 2.4g, 5g only */ num_valid_channels = wifi_pos_get_valid_channels( - channels, num_ch, + chan_freqs, num_ch, valid_channel_list); - band_mask = BIT(REG_BAND_5G) | BIT(REG_BAND_2G); for (i = 0; i < num_valid_channels; i++) { - ch_list->chan_info[i].chan_num = valid_channel_list[i]; ch_list->chan_info[i].center_freq = - wlan_reg_chan_band_to_freq( - pdev, - ch_list->chan_info[i].chan_num, - band_mask); + valid_channel_list[i]; + ch_list->chan_info[i].chan_num = + wlan_reg_freq_to_chan(pdev, ch_list-> + chan_info[i].center_freq); } } @@ -568,9 +584,8 @@ static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc, num_valid_channels; buf = qdf_mem_malloc(len); if (!buf) { - wlan_objmgr_pdev_release_ref(pdev, WLAN_WIFI_POS_CORE_ID); - qdf_mem_free(ch_list); - return QDF_STATUS_E_NOMEM; + ret_val = QDF_STATUS_E_NOMEM; + goto cleanup; } /* First byte of message body will have num of channels */ @@ -600,12 +615,15 @@ static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc, wifi_pos_obj->wifi_pos_send_rsp(psoc, wifi_pos_obj->app_pid, WIFI_POS_CMD_GET_CH_INFO, len, buf); + ret_val = QDF_STATUS_SUCCESS; +cleanup: qdf_mem_free(buf); qdf_mem_free(ch_list); + qdf_mem_free(chan_freqs); wlan_objmgr_pdev_release_ref(pdev, WLAN_WIFI_POS_CORE_ID); - return QDF_STATUS_SUCCESS; + return ret_val; } static void wifi_pos_vdev_iterator(struct wlan_objmgr_psoc *psoc,