qcacld-3.0: Cleanup WMA HWMODE

Cleanup WMA HWMODE and WMA HWMODE List
as the same functionality is already taken
care by policy manager

Change-Id: I5dc1342422e70737111f882013ed3a6351a85336
CRs-Fixed: 3064739
Šī revīzija ir iekļauta:
Utkarsh Bhatnagar
2021-10-28 08:01:19 +05:30
revīziju iesūtīja Madan Koyyalamudi
vecāks 59fc065c82
revīzija 40d0e1ae42
9 mainīti faili ar 100 papildinājumiem un 322 dzēšanām

Parādīt failu

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2021, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -201,7 +201,8 @@ __hdd_sysfs_pm_dbs_store(struct hdd_context *hdd_ctx,
switch (value) {
case 0:
case 1:
wma_set_dbs_capability_ut(value);
policy_mgr_set_dbs_cap_ut(hdd_ctx->psoc, value);
wma_enable_dbs_service_ut();
break;
default:
hdd_err_rl("invalid value %d", value);

Parādīt failu

@@ -6778,10 +6778,11 @@ static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
{
hdd_debug("<iwpriv wlan0 pm_dbs> is called");
if (apps_args[0] == 0)
wma_set_dbs_capability_ut(0);
policy_mgr_set_dbs_cap_ut(hdd_ctx->psoc, 0);
else
wma_set_dbs_capability_ut(1);
policy_mgr_set_dbs_cap_ut(hdd_ctx->psoc, 1);
wma_enable_dbs_service_ut();
if (apps_args[1] >= PM_THROUGHPUT &&
apps_args[1] <= PM_LATENCY) {
hdd_debug("setting system pref to [%d]\n",

Parādīt failu

@@ -855,8 +855,6 @@ struct wma_wlm_stats_data {
* @hw_bd_info: hardware board info
* @miracast_value: miracast value
* @log_completion_timer: log completion timer
* @num_dbs_hw_modes: Number of HW modes supported by the FW
* @hw_mode: DBS HW mode list
* @old_hw_mode_index: Previous configured HW mode index
* @new_hw_mode_index: Current configured HW mode index
* @peer_authorized_cb: peer authorized hdd callback
@@ -981,8 +979,6 @@ typedef struct {
uint32_t hw_bd_info[HW_BD_INFO_SIZE];
uint32_t miracast_value;
qdf_mc_timer_t log_completion_timer;
uint32_t num_dbs_hw_modes;
struct dbs_hw_mode_info hw_mode;
uint32_t old_hw_mode_index;
uint32_t new_hw_mode_index;
wma_peer_authorized_fp peer_authorized_cb;

Parādīt failu

@@ -201,11 +201,7 @@ QDF_STATUS wma_post_ctrl_msg(struct mac_context *mac, struct scheduler_msg *pMsg
void wma_update_intf_hw_mode_params(uint32_t vdev_id, uint32_t mac_id,
uint32_t cfgd_hw_mode_index);
#ifdef MPC_UT_FRAMEWORK
void wma_set_dbs_capability_ut(uint32_t dbs);
#else
static inline void wma_set_dbs_capability_ut(uint32_t dbs) {}
#endif
QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy,
enum hw_mode_dbs_capab hw_mode, enum cds_band_type band);
bool wma_is_rx_ldpc_supported_for_channel(uint32_t ch_freq);
@@ -838,4 +834,16 @@ void wma_cleanup_vdev(struct wlan_objmgr_vdev *vdev);
*/
void wma_set_wakeup_logs_to_console(bool value);
#ifdef MPC_UT_FRAMEWORK
/**
* wma_enable_dbs_service_ut() - enable dbs wmi service for unit testing.
*
* Sets DBS capability is also set in the service bit map.
*
* Return: None
*/
void wma_enable_dbs_service_ut(void);
#else
static inline void wma_enable_dbs_service_ut(void) {}
#endif
#endif /* WMA_API_H */

Parādīt failu

@@ -4432,13 +4432,6 @@ QDF_STATUS wma_close(void)
qdf_atomic_set(&wma_handle->sap_num_clients_connected, 0);
qdf_atomic_set(&wma_handle->go_num_clients_connected, 0);
/* Free DBS list */
if (wma_handle->hw_mode.hw_mode_list) {
qdf_mem_free(wma_handle->hw_mode.hw_mode_list);
wma_handle->hw_mode.hw_mode_list = NULL;
wma_debug("DBS list is freed");
}
if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) {
qdf_wake_lock_destroy(&wma_handle->go_d3_wow_wake_lock);
qdf_wake_lock_destroy(&wma_handle->sap_d3_wow_wake_lock);
@@ -5603,41 +5596,6 @@ static int wma_update_hdd_cfg(tp_wma_handle wma_handle)
return ret;
}
/**
* wma_dump_dbs_hw_mode() - Print the DBS HW modes
* @wma_handle: WMA handle
*
* Prints the DBS HW modes sent by the FW as part
* of WMI ready event
*
* Return: None
*/
static void wma_dump_dbs_hw_mode(tp_wma_handle wma_handle)
{
uint32_t i, param;
if (wma_validate_handle(wma_handle))
return;
for (i = 0; i < wma_handle->num_dbs_hw_modes; i++) {
param = wma_handle->hw_mode.hw_mode_list[i];
wma_debug("[%d]-MAC0: tx_ss:%d rx_ss:%d bw_idx:%d",
i,
WMA_HW_MODE_MAC0_TX_STREAMS_GET(param),
WMA_HW_MODE_MAC0_RX_STREAMS_GET(param),
WMA_HW_MODE_MAC0_BANDWIDTH_GET(param));
wma_debug("[%d]-MAC1: tx_ss:%d rx_ss:%d bw_idx:%d",
i,
WMA_HW_MODE_MAC1_TX_STREAMS_GET(param),
WMA_HW_MODE_MAC1_RX_STREAMS_GET(param),
WMA_HW_MODE_MAC1_BANDWIDTH_GET(param));
wma_debug("[%d] DBS:%d SBS:%d", i,
WMA_HW_MODE_DBS_MODE_GET(param),
WMA_HW_MODE_SBS_MODE_GET(param));
}
policy_mgr_dump_dbs_hw_mode(wma_handle->psoc);
}
/**
* wma_init_scan_fw_mode_config() - Initialize scan/fw mode config
* @psoc: Object manager psoc
@@ -5926,25 +5884,13 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
return -EINVAL;
}
wma_handle->num_dbs_hw_modes = ev->num_dbs_hw_modes;
ev_wlan_dbs_hw_mode_list = param_buf->wlan_dbs_hw_mode_list;
/* Continuing with the rest of the processing,
* even if memory allocation fails
*/
wma_handle->hw_mode.hw_mode_list =
qdf_mem_malloc(sizeof(*wma_handle->hw_mode.hw_mode_list) *
wma_handle->num_dbs_hw_modes);
if (wma_handle->hw_mode.hw_mode_list)
qdf_mem_copy(wma_handle->hw_mode.hw_mode_list,
ev_wlan_dbs_hw_mode_list,
(sizeof(*wma_handle->hw_mode.hw_mode_list) *
wma_handle->num_dbs_hw_modes));
policy_mgr_init_dbs_hw_mode(wma_handle->psoc,
ev->num_dbs_hw_modes, ev_wlan_dbs_hw_mode_list);
wma_dump_dbs_hw_mode(wma_handle);
policy_mgr_init_dbs_hw_mode(wma_handle->psoc, ev->num_dbs_hw_modes,
ev_wlan_dbs_hw_mode_list);
/* Initializes the fw_mode and scan_config to zero.
* If ext service ready event is present it will set
@@ -6004,7 +5950,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to register swba beacon event cb");
goto free_hw_mode_list;
goto failure;
}
#ifdef WLAN_FEATURE_LPSS
wma_handle->lpss_support =
@@ -6027,7 +5973,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
WMA_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to register CSA offload event cb");
goto free_hw_mode_list;
goto failure;
}
}
@@ -6044,7 +5990,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
WMA_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to register MGMT over WMI completion handler");
goto free_hw_mode_list;
goto failure;
}
status = wmi_unified_register_event_handler(
@@ -6054,7 +6000,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
WMA_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to register MGMT over WMI completion handler");
goto free_hw_mode_list;
goto failure;
}
} else {
@@ -6064,7 +6010,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
status = wma_register_gtk_offload_event(wma_handle);
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to register GTK offload event cb");
goto free_hw_mode_list;
goto failure;
}
status = wmi_unified_register_event_handler(wmi_handle,
@@ -6073,7 +6019,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
WMA_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to register WMI_TBTTOFFSET_UPDATE_EVENTID callback");
goto free_hw_mode_list;
goto failure;
}
if (wmi_service_enabled(wma_handle->wmi_handle,
@@ -6086,7 +6032,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
WMA_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to register RCPI event handler");
goto free_hw_mode_list;
goto failure;
}
wma_handle->rcpi_enabled = true;
}
@@ -6113,7 +6059,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
WMA_RX_SERIALIZER_CTX);
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to register log supported event cb");
goto free_hw_mode_list;
goto failure;
}
cdp_mark_first_wakeup_packet(
@@ -6139,7 +6085,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
status = wmi_unified_save_fw_version_cmd(wmi_handle, param_buf);
if (QDF_IS_STATUS_ERROR(status)) {
wma_err("Failed to send WMI_INIT_CMDID command");
goto free_hw_mode_list;
goto failure;
}
if (wmi_service_enabled(wmi_handle, wmi_service_ext_msg)) {
@@ -6158,13 +6104,7 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
return 0;
free_hw_mode_list:
if (wma_handle->hw_mode.hw_mode_list) {
qdf_mem_free(wma_handle->hw_mode.hw_mode_list);
wma_handle->hw_mode.hw_mode_list = NULL;
wma_debug("DBS list is freed");
}
failure:
return -EINVAL;
}
@@ -6462,124 +6402,6 @@ static void wma_print_populate_soc_caps(struct target_psoc_info *tgt_hdl)
wma_debug("<====== HW mode cap printing ends ======>\n");
}
/**
* wma_map_wmi_channel_width_to_hw_mode_bw() - returns bandwidth
* in terms of hw_mode_bandwidth
* @width: bandwidth in terms of wmi_channel_width
*
* This function returns the bandwidth in terms of hw_mode_bandwidth.
*
* Return: BW in terms of hw_mode_bandwidth.
*/
static enum hw_mode_bandwidth wma_map_wmi_channel_width_to_hw_mode_bw(
wmi_channel_width width)
{
switch (width) {
case WMI_CHAN_WIDTH_20:
return HW_MODE_20_MHZ;
case WMI_CHAN_WIDTH_40:
return HW_MODE_40_MHZ;
case WMI_CHAN_WIDTH_80:
return HW_MODE_80_MHZ;
case WMI_CHAN_WIDTH_160:
return HW_MODE_160_MHZ;
case WMI_CHAN_WIDTH_80P80:
return HW_MODE_80_PLUS_80_MHZ;
case WMI_CHAN_WIDTH_5:
return HW_MODE_5_MHZ;
case WMI_CHAN_WIDTH_10:
return HW_MODE_10_MHZ;
#ifdef WLAN_FEATURE_11BE
case WMI_CHAN_WIDTH_320:
return HW_MODE_320_MHZ;
#endif
default:
return HW_MODE_BW_NONE;
}
return HW_MODE_BW_NONE;
}
/**
* wma_get_hw_mode_params() - get TX-RX stream and bandwidth
* supported from the capabilities.
* @caps: PHY capability
* @info: param to store TX-RX stream and BW information
*
* This function will calculate TX-RX stream and bandwidth supported
* as per the PHY capability, and assign to mac_ss_bw_info.
*
* Return: none
*/
static void wma_get_hw_mode_params(struct wlan_psoc_host_mac_phy_caps *caps,
struct mac_ss_bw_info *info)
{
if (!caps) {
wma_err("Invalid capabilities");
return;
}
info->mac_tx_stream = wma_get_num_of_setbits_from_bitmask(
QDF_MAX(caps->tx_chain_mask_2G,
caps->tx_chain_mask_5G));
info->mac_rx_stream = wma_get_num_of_setbits_from_bitmask(
QDF_MAX(caps->rx_chain_mask_2G,
caps->rx_chain_mask_5G));
info->mac_bw = wma_map_wmi_channel_width_to_hw_mode_bw(
QDF_MAX(caps->max_bw_supported_2G,
caps->max_bw_supported_5G));
}
/**
* wma_set_hw_mode_params() - sets TX-RX stream, bandwidth and
* DBS in hw_mode_list
* @wma_handle: pointer to wma global structure
* @mac0_ss_bw_info: TX-RX streams, BW for MAC0
* @mac1_ss_bw_info: TX-RX streams, BW for MAC1
* @pos: refers to hw_mode_index
* @dbs_mode: dbs_mode for the dbs_hw_mode
* @sbs_mode: sbs_mode for the sbs_hw_mode
*
* This function sets TX-RX stream, bandwidth and DBS mode in
* hw_mode_list.
*
* Return: none
*/
static void wma_set_hw_mode_params(t_wma_handle *wma_handle,
struct mac_ss_bw_info mac0_ss_bw_info,
struct mac_ss_bw_info mac1_ss_bw_info,
uint32_t pos, uint32_t dbs_mode,
uint32_t sbs_mode)
{
WMA_HW_MODE_MAC0_TX_STREAMS_SET(
wma_handle->hw_mode.hw_mode_list[pos],
mac0_ss_bw_info.mac_tx_stream);
WMA_HW_MODE_MAC0_RX_STREAMS_SET(
wma_handle->hw_mode.hw_mode_list[pos],
mac0_ss_bw_info.mac_rx_stream);
WMA_HW_MODE_MAC0_BANDWIDTH_SET(
wma_handle->hw_mode.hw_mode_list[pos],
mac0_ss_bw_info.mac_bw);
WMA_HW_MODE_MAC1_TX_STREAMS_SET(
wma_handle->hw_mode.hw_mode_list[pos],
mac1_ss_bw_info.mac_tx_stream);
WMA_HW_MODE_MAC1_RX_STREAMS_SET(
wma_handle->hw_mode.hw_mode_list[pos],
mac1_ss_bw_info.mac_rx_stream);
WMA_HW_MODE_MAC1_BANDWIDTH_SET(
wma_handle->hw_mode.hw_mode_list[pos],
mac1_ss_bw_info.mac_bw);
WMA_HW_MODE_DBS_MODE_SET(
wma_handle->hw_mode.hw_mode_list[pos],
dbs_mode);
WMA_HW_MODE_AGILE_DFS_SET(
wma_handle->hw_mode.hw_mode_list[pos],
HW_MODE_AGILE_DFS_NONE);
WMA_HW_MODE_SBS_MODE_SET(
wma_handle->hw_mode.hw_mode_list[pos],
sbs_mode);
}
/**
* wma_update_hw_mode_list() - updates hw_mode_list
* @wma_handle: pointer to wma global structure
@@ -6595,9 +6417,6 @@ static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle,
{
struct wlan_psoc_host_mac_phy_caps *tmp, *mac_phy_cap;
uint32_t i, hw_config_type, j = 0;
uint32_t dbs_mode, sbs_mode;
struct mac_ss_bw_info mac0_ss_bw_info = {0};
struct mac_ss_bw_info mac1_ss_bw_info = {0};
WMI_PHY_CAPABILITY new_supported_band = 0;
bool supported_band_update_failure = false;
struct wlan_psoc_target_capability_info *tgt_cap_info;
@@ -6615,38 +6434,11 @@ static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle,
return QDF_STATUS_E_FAILURE;
}
/*
* This list was updated as part of service ready event. Re-populate
* HW mode list from the device capabilities.
*/
if (wma_handle->hw_mode.hw_mode_list) {
qdf_mem_free(wma_handle->hw_mode.hw_mode_list);
wma_handle->hw_mode.hw_mode_list = NULL;
wma_debug("DBS list is freed");
}
wma_handle->hw_mode.hw_mode_list =
qdf_mem_malloc(sizeof(*wma_handle->hw_mode.hw_mode_list) *
num_hw_modes);
if (!wma_handle->hw_mode.hw_mode_list) {
wma_handle->num_dbs_hw_modes = 0;
return QDF_STATUS_E_FAILURE;
}
wma_debug("Updated HW mode list: Num modes:%d",
num_hw_modes);
wma_handle->num_dbs_hw_modes = num_hw_modes;
wma_debug("Num modes:%d", num_hw_modes);
for (i = 0; i < num_hw_modes; i++) {
/* Update for MAC0 */
tmp = &mac_phy_cap[j++];
wma_get_hw_mode_params(tmp, &mac0_ss_bw_info);
hw_config_type = tmp->hw_mode_config_type;
dbs_mode = HW_MODE_DBS_NONE;
sbs_mode = HW_MODE_SBS_NONE;
mac1_ss_bw_info.mac_tx_stream = 0;
mac1_ss_bw_info.mac_rx_stream = 0;
mac1_ss_bw_info.mac_bw = 0;
if (wma_update_supported_bands(tmp->supported_bands,
&new_supported_band)
!= QDF_STATUS_SUCCESS)
@@ -6659,24 +6451,11 @@ static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle,
(hw_config_type == WMI_HW_MODE_DBS_OR_SBS)) {
/* Update for MAC1 */
tmp = &mac_phy_cap[j++];
wma_get_hw_mode_params(tmp, &mac1_ss_bw_info);
if (hw_config_type == WMI_HW_MODE_DBS ||
hw_config_type == WMI_HW_MODE_DBS_OR_SBS)
dbs_mode = HW_MODE_DBS;
if ((hw_config_type == WMI_HW_MODE_SBS_PASSIVE) ||
(hw_config_type == WMI_HW_MODE_SBS) ||
(hw_config_type == WMI_HW_MODE_DBS_OR_SBS))
sbs_mode = HW_MODE_SBS;
if (QDF_STATUS_SUCCESS !=
wma_update_supported_bands(tmp->supported_bands,
&new_supported_band))
wma_update_supported_bands(tmp->supported_bands,
&new_supported_band))
supported_band_update_failure = true;
}
/* Updating HW mode list */
wma_set_hw_mode_params(wma_handle, mac0_ss_bw_info,
mac1_ss_bw_info, i, dbs_mode,
sbs_mode);
}
/* overwrite phy_capability which we got from service ready event */
@@ -6691,7 +6470,7 @@ static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle,
policy_mgr_update_hw_mode_list(wma_handle->psoc,
tgt_hdl))
wma_err("failed to update policy manager");
wma_dump_dbs_hw_mode(wma_handle);
return QDF_STATUS_SUCCESS;
}
@@ -9611,6 +9390,20 @@ QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g,
return QDF_STATUS_SUCCESS;
}
#ifdef MPC_UT_FRAMEWORK
void wma_enable_dbs_service_ut(void)
{
tp_wma_handle wma;
wma = cds_get_context(QDF_MODULE_ID_WMA);
if (!wma)
return;
WMI_SERVICE_ENABLE(wma->wmi_service_bitmap,
WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT);
}
#endif
#ifdef FEATURE_ANI_LEVEL_REQUEST
QDF_STATUS wma_send_ani_level_request(tp_wma_handle wma_handle,
uint32_t *freqs, uint8_t num_freqs)

Parādīt failu

@@ -1,69 +0,0 @@
/*
* Copyright (c) 2015-2016, 2018-2020 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wma_utils_ut.c
* This file contains utilities related to unit test framework
*/
/* Header files */
#include "wma.h"
/**
* wma_set_dbs_capability_ut() - Set DBS capability for UT framework
* @dbs: Value of DBS capability to be set
*
* Sets the DBS capability for unit test framework. If the HW mode is
* already sent by the FW, only the DBS capability needs to be set. If the
* FW did not send any HW mode list, a single entry is created and DBS mode
* is set in it. The DBS capability is also set in the service bit map.
*
* Return: None
*/
void wma_set_dbs_capability_ut(uint32_t dbs)
{
tp_wma_handle wma;
uint32_t i;
wma = cds_get_context(QDF_MODULE_ID_WMA);
if (!wma)
return;
/* DBS list was not configured by the FW, so
* for UT, we can configure a single entry
*/
if (!wma->hw_mode.hw_mode_list) {
wma->num_dbs_hw_modes = 1;
wma->hw_mode.hw_mode_list =
qdf_mem_malloc(sizeof(*wma->hw_mode.hw_mode_list) *
wma->num_dbs_hw_modes);
if (!wma->hw_mode.hw_mode_list)
return;
wma->hw_mode.hw_mode_list[0] = 0x0000;
}
for (i = 0; i < wma->num_dbs_hw_modes; i++) {
WMA_HW_MODE_DBS_MODE_SET(wma->hw_mode.hw_mode_list[i],
dbs);
}
WMI_SERVICE_ENABLE(wma->wmi_service_bitmap,
WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT);
}