diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 42ec575c70a4..163553efac13 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -51,7 +51,7 @@ #include "cds_ieee80211_common.h" #include "wlan_objmgr_psoc_obj.h" #include -#include "wlan_policy_mgr_api.h" +#include /* Platform specific configuration for max. no. of fragments */ #define QCA_OL_11AC_TX_MAX_FRAGS 2 @@ -1490,7 +1490,6 @@ typedef struct { /* OCB request contexts */ struct sir_ocb_config *ocb_config_req; - struct dual_mac_config dual_mac_cfg; uint8_t max_scan; uint16_t self_gen_frm_pwr; bool tx_chain_mask_cck; @@ -2153,7 +2152,7 @@ QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle, struct wmi_pcl_chan_weights *msg); QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle, - struct sir_hw_mode *msg); + struct policy_mgr_hw_mode *msg); QDF_STATUS wma_get_scan_id(uint32_t *scan_id); QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle, @@ -2202,7 +2201,6 @@ static inline QDF_STATUS wma_set_gateway_params(tp_wma_handle wma, QDF_STATUS wma_lro_config_cmd(void *handle, struct cdp_lro_hash_config *wma_lro_cmd); -bool wma_is_current_hwmode_dbs(void); void wma_indicate_err(enum ol_rx_err_type err_type, struct ol_error_info *err_info); diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h index eb062905ee54..a9d8eb6a9717 100644 --- a/core/wma/inc/wma_api.h +++ b/core/wma/inc/wma_api.h @@ -37,7 +37,6 @@ #include "htc_api.h" #endif #include "lim_global.h" -#include "cds_concurrency.h" #include "cds_utils.h" #include "scheduler_api.h" #include "wlan_policy_mgr_api.h" @@ -165,49 +164,10 @@ tSirRetStatus wma_post_ctrl_msg(tpAniSirGlobal pMac, void wma_register_wow_wakeup_events(WMA_HANDLE handle, uint8_t vdev_id, uint8_t vdev_type, uint8_t sub_type); void wma_register_wow_default_patterns(WMA_HANDLE handle, uint8_t vdev_id); -int8_t wma_get_hw_mode_idx_from_dbs_hw_list(enum hw_mode_ss_config mac0_ss, - enum hw_mode_bandwidth mac0_bw, - enum hw_mode_ss_config mac1_ss, - enum hw_mode_bandwidth mac1_bw, - enum hw_mode_dbs_capab dbs, - enum hw_mode_agile_dfs_capab dfs, - enum hw_mode_sbs_capab sbs); -QDF_STATUS wma_get_hw_mode_from_idx(uint32_t idx, - struct sir_hw_mode_params *hw_mode); -int8_t wma_get_num_dbs_hw_modes(void); -bool wma_is_hw_dbs_capable(void); -bool wma_is_hw_sbs_capable(void); -bool wma_is_hw_dbs_2x2_capable(void); int8_t wma_get_mac_id_of_vdev(uint32_t vdev_id); void wma_update_intf_hw_mode_params(uint32_t vdev_id, uint32_t mac_id, uint32_t cfgd_hw_mode_index); -QDF_STATUS wma_get_old_and_new_hw_index(uint32_t *old_hw_mode_index, - uint32_t *new_hw_mode_index); void wma_set_dbs_capability_ut(uint32_t dbs); -QDF_STATUS wma_get_dbs_hw_modes(bool *one_by_one_dbs, bool *two_by_two_dbs); -QDF_STATUS wma_get_current_hw_mode(struct sir_hw_mode_params *hw_mode); -bool wma_is_dbs_enable(void); -enum cds_hw_mode_change -wma_get_cds_hw_mode_change_from_hw_mode_index(uint32_t hw_mode_index); - -QDF_STATUS wma_get_updated_scan_config(uint32_t *scan_config, - bool dbs_scan, - bool dbs_plus_agile_scan, - bool single_mac_scan_with_dfs); -QDF_STATUS wma_get_updated_fw_mode_config(uint32_t *fw_mode_config, - bool dbs, - bool agile_dfs); -bool wma_get_dbs_scan_config(void); -bool wma_get_dbs_plus_agile_scan_config(void); -bool wma_get_single_mac_scan_with_dfs_config(void); -bool wma_get_dbs_config(void); -bool wma_get_agile_dfs_config(void); -bool wma_is_dual_mac_disabled_in_ini(void); -bool wma_get_prev_dbs_config(void); -bool wma_get_prev_agile_dfs_config(void); -bool wma_get_prev_dbs_scan_config(void); -bool wma_get_prev_dbs_plus_agile_scan_config(void); -bool wma_get_prev_single_mac_scan_with_dfs_config(void); 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 channel); @@ -215,7 +175,6 @@ bool wma_is_rx_ldpc_supported_for_channel(uint32_t channel); #if defined(FEATURE_LRO) int wma_lro_init(struct cdp_lro_hash_config *lro_config); #endif -bool wma_is_scan_simultaneous_capable(void); QDF_STATUS wma_remove_beacon_filter(WMA_HANDLE wma, struct beacon_filter_param *filter_params); diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 8609445d9409..c4b3678631ba 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -52,7 +52,6 @@ #include "lim_session_utils.h" #include "cds_utils.h" -#include "cds_concurrency.h" #if !defined(REMOVE_PKT_LOG) #include "pktlog_ac.h" @@ -72,7 +71,7 @@ #include #include -#include "cds_concurrency.h" +#include "wlan_policy_mgr_api.h" #include "wma_nan_datapath.h" #include "wlan_tgt_def_config.h" #include @@ -820,7 +819,8 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info, if (NULL == mac_ctx) { wma_release_wmi_resp_wakelock(wma); WMA_LOGE("%s: Failed to get mac_ctx", __func__); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); return -EINVAL; } #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ @@ -832,14 +832,16 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info, param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) cmd_param_info; if (!param_buf) { WMA_LOGE("Invalid start response event buffer"); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); return -EINVAL; } resp_event = param_buf->fixed_param; if (!resp_event) { WMA_LOGE("Invalid start response event buffer"); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); return -EINVAL; } @@ -895,7 +897,8 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info, wma->interfaces[resp_event->vdev_id].bssid, ¶m) != QDF_STATUS_SUCCESS) { WMA_LOGE("%s : failed to send vdev up", __func__); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); return -EEXIST; } qdf_atomic_set(&wma->interfaces[resp_event->vdev_id]. @@ -920,7 +923,8 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info, if (!req_msg) { WMA_LOGE("%s: Failed to lookup request message for vdev %d", __func__, resp_event->vdev_id); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); return -EINVAL; } @@ -938,7 +942,8 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info, if (!params) { WMA_LOGE("%s: channel switch params is NULL for vdev %d", __func__, resp_event->vdev_id); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); return -EINVAL; } @@ -969,7 +974,8 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info, __func__, resp_event->vdev_id); wma_vdev_set_mlme_state(wma, resp_event->vdev_id, WLAN_VDEV_S_STOP); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); } else { wma_vdev_set_mlme_state(wma, resp_event->vdev_id, WLAN_VDEV_S_RUN); @@ -989,7 +995,8 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info, iface->bssid, ¶m) != QDF_STATUS_SUCCESS) { WMA_LOGE(FL("failed to send vdev up")); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); return -EEXIST; } wma_vdev_set_mlme_state(wma, resp_event->vdev_id, @@ -2886,7 +2893,7 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, tpAddBssParams add_bss) uint8_t vdev_id, peer_id; QDF_STATUS status; int8_t maxTxPower; - struct sir_hw_mode_params hw_mode = {0}; + struct policy_mgr_hw_mode_params hw_mode = {0}; void *soc = cds_get_context(QDF_MODULE_ID_SOC); pdev = cds_get_context(QDF_MODULE_ID_TXRX); @@ -2962,9 +2969,9 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, tpAddBssParams add_bss) if (req.ssid.length > 0) qdf_mem_copy(req.ssid.ssId, add_bss->ssId.ssId, add_bss->ssId.length); - status = wma_get_current_hw_mode(&hw_mode); + status = policy_mgr_get_current_hw_mode(wma->psoc, &hw_mode); if (!QDF_IS_STATUS_SUCCESS(status)) - WMA_LOGE("wma_get_current_hw_mode failed"); + WMA_LOGE("policy_mgr_get_current_hw_mode failed"); if ((add_bss->nss == 2) && !hw_mode.dbs_cap) { req.preferred_rx_streams = 2; @@ -3015,7 +3022,7 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, tpAddBssParams add_bss) uint8_t vdev_id, peer_id; QDF_STATUS status; tSetBssKeyParams key_info; - struct sir_hw_mode_params hw_mode = {0}; + struct policy_mgr_hw_mode_params hw_mode = {0}; void *soc = cds_get_context(QDF_MODULE_ID_SOC); vdev = wma_find_vdev_by_addr(wma, add_bss->selfMacAddr, &vdev_id); @@ -3111,9 +3118,9 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, tpAddBssParams add_bss) if (req.ssid.length > 0) qdf_mem_copy(req.ssid.ssId, add_bss->ssId.ssId, add_bss->ssId.length); - status = wma_get_current_hw_mode(&hw_mode); + status = policy_mgr_get_current_hw_mode(wma->psoc, &hw_mode); if (!QDF_IS_STATUS_SUCCESS(status)) - WMA_LOGE("wma_get_current_hw_mode failed"); + WMA_LOGE("policy_mgr_get_current_hw_mode failed"); if ((add_bss->nss == 2) && !hw_mode.dbs_cap) { req.preferred_rx_streams = 2; @@ -3173,7 +3180,7 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss) int pps_val = 0; bool roam_synch_in_progress = false; tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE); - struct sir_hw_mode_params hw_mode = {0}; + struct policy_mgr_hw_mode_params hw_mode = {0}; bool peer_assoc_sent = false; void *soc = cds_get_context(QDF_MODULE_ID_SOC); @@ -3295,9 +3302,10 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss) if (req.ssid.length > 0) qdf_mem_copy(req.ssid.ssId, add_bss->ssId.ssId, add_bss->ssId.length); - status = wma_get_current_hw_mode(&hw_mode); + status = policy_mgr_get_current_hw_mode(wma->psoc, + &hw_mode); if (!QDF_IS_STATUS_SUCCESS(status)) - WMA_LOGE("wma_get_current_hw_mode failed"); + WMA_LOGE("policy_mgr_get_current_hw_mode failed"); if ((add_bss->nss == 2) && !hw_mode.dbs_cap) { req.preferred_rx_streams = 2; @@ -4020,7 +4028,8 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params) ¶m) != QDF_STATUS_SUCCESS) { WMA_LOGP("%s: Failed to send vdev up cmd: vdev %d bssid %pM", __func__, params->smesessionId, params->bssId); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); status = QDF_STATUS_E_FAILURE; } else { wma_set_vdev_mgmt_rate(wma, params->smesessionId); diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index de9e1b86ad54..976c739448b9 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -73,7 +73,7 @@ #include "wma_internal.h" #include "wma_ocb.h" -#include "cds_concurrency.h" +#include "wlan_policy_mgr_api.h" #include "cdp_txrx_cfg.h" #include "cdp_txrx_flow_ctrl_legacy.h" #include "cdp_txrx_flow_ctrl_v2.h" @@ -2794,6 +2794,8 @@ static int wma_pdev_set_hw_mode_resp_evt_handler(void *handle, wma->old_hw_mode_index = wma->new_hw_mode_index; wma->new_hw_mode_index = wmi_event->cfgd_hw_mode_index; } + policy_mgr_update_hw_mode_index(wma->psoc, + wmi_event->cfgd_hw_mode_index); } WMA_LOGI("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d", @@ -2870,6 +2872,10 @@ void wma_process_pdev_hw_mode_trans_ind(void *handle, } wma->old_hw_mode_index = fixed_param->old_hw_mode_index; wma->new_hw_mode_index = fixed_param->new_hw_mode_index; + policy_mgr_update_new_hw_mode_index(wma->psoc, + fixed_param->new_hw_mode_index); + policy_mgr_update_old_hw_mode_index(wma->psoc, + fixed_param->old_hw_mode_index); WMA_LOGI("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d", __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); @@ -2981,14 +2987,8 @@ static int wma_pdev_set_dual_mode_config_resp_evt_handler(void *handle, dual_mac_cfg_resp->status = wmi_event->status; if (SET_HW_MODE_STATUS_OK == dual_mac_cfg_resp->status) { - wma->dual_mac_cfg.prev_scan_config = - wma->dual_mac_cfg.cur_scan_config; - wma->dual_mac_cfg.prev_fw_mode_config = - wma->dual_mac_cfg.cur_fw_mode_config; - wma->dual_mac_cfg.cur_scan_config = - wma->dual_mac_cfg.req_scan_config; - wma->dual_mac_cfg.cur_fw_mode_config = - wma->dual_mac_cfg.req_fw_mode_config; + policy_mgr_update_dbs_scan_config(wma->psoc); + policy_mgr_update_dbs_fw_config(wma->psoc); } /* Pass the message to PE */ @@ -4470,6 +4470,7 @@ static void wma_dump_dbs_hw_mode(tp_wma_handle wma_handle) WMA_HW_MODE_DBS_MODE_GET(param), WMA_HW_MODE_SBS_MODE_GET(param)); } + policy_mgr_dump_dbs_hw_mode(wma_handle->psoc); } /** @@ -4487,61 +4488,14 @@ static void wma_init_scan_fw_mode_config(tp_wma_handle wma_handle, uint32_t scan_config, uint32_t fw_config) { - tpAniSirGlobal mac = cds_get_context(QDF_MODULE_ID_PE); - WMA_LOGD("%s: Enter", __func__); - if (!mac) { - WMA_LOGE("%s: Invalid mac handle", __func__); - return; - } - if (!wma_handle) { WMA_LOGE("%s: Invalid WMA handle", __func__); return; } - wma_handle->dual_mac_cfg.cur_scan_config = 0; - wma_handle->dual_mac_cfg.cur_fw_mode_config = 0; - - /* If dual mac features are disabled in the INI, we - * need not proceed further - */ - if (mac->dual_mac_feature_disable) { - WMA_LOGE("%s: Disabling dual mac capabilities", __func__); - /* All capabilites are initialized to 0. We can return */ - goto done; - } - - /* Initialize concurrent_scan_config_bits with default FW value */ - WMI_DBS_CONC_SCAN_CFG_DBS_SCAN_SET( - wma_handle->dual_mac_cfg.cur_scan_config, - WMI_DBS_CONC_SCAN_CFG_DBS_SCAN_GET(scan_config)); - WMI_DBS_CONC_SCAN_CFG_AGILE_SCAN_SET( - wma_handle->dual_mac_cfg.cur_scan_config, - WMI_DBS_CONC_SCAN_CFG_AGILE_SCAN_GET(scan_config)); - WMI_DBS_CONC_SCAN_CFG_AGILE_DFS_SCAN_SET( - wma_handle->dual_mac_cfg.cur_scan_config, - WMI_DBS_CONC_SCAN_CFG_AGILE_DFS_SCAN_GET(scan_config)); - - /* Initialize fw_mode_config_bits with default FW value */ - WMI_DBS_FW_MODE_CFG_DBS_SET( - wma_handle->dual_mac_cfg.cur_fw_mode_config, - WMI_DBS_FW_MODE_CFG_DBS_GET(fw_config)); - WMI_DBS_FW_MODE_CFG_AGILE_DFS_SET( - wma_handle->dual_mac_cfg.cur_fw_mode_config, - WMI_DBS_FW_MODE_CFG_AGILE_DFS_GET(fw_config)); -done: - /* Initialize the previous scan/fw mode config */ - wma_handle->dual_mac_cfg.prev_scan_config = - wma_handle->dual_mac_cfg.cur_scan_config; - wma_handle->dual_mac_cfg.prev_fw_mode_config = - wma_handle->dual_mac_cfg.cur_fw_mode_config; - - WMA_LOGD("%s: cur_scan_config:%x cur_fw_mode_config:%x", - __func__, - wma_handle->dual_mac_cfg.cur_scan_config, - wma_handle->dual_mac_cfg.cur_fw_mode_config); + policy_mgr_init_dbs_config(wma_handle->psoc, scan_config, fw_config); } /** @@ -4612,7 +4566,8 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info, 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); /* Initializes the fw_mode and scan_config to zero. @@ -4635,6 +4590,8 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info, wma_handle->target_fw_version = ev->fw_build_vers; wma_handle->new_hw_mode_index = ev->default_dbs_hw_mode_index; + policy_mgr_update_new_hw_mode_index(wma_handle->psoc, + ev->default_dbs_hw_mode_index); wma_handle->fine_time_measurement_cap = ev->wmi_fw_sub_feat_caps; WMA_LOGD("%s: Firmware default hw mode index : %d", @@ -4960,7 +4917,7 @@ QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy, return QDF_STATUS_E_FAILURE; } - if (!wma_is_dbs_enable()) + if (!policy_mgr_is_dbs_enable(wma_handle->psoc)) our_hw_mode = HW_MODE_DBS_NONE; if (!caps_per_phy) { @@ -5324,6 +5281,10 @@ static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle) mac1_ss_bw_info, i, dbs_mode, sbs_mode); } + + if (QDF_STATUS_SUCCESS != + policy_mgr_update_hw_mode_list(wma_handle->psoc, phy_caps)) + WMA_LOGE("%s: failed to update policy manager", __func__); wma_dump_dbs_hw_mode(wma_handle); return QDF_STATUS_SUCCESS; } @@ -7002,7 +6963,7 @@ QDF_STATUS wma_mc_process_msg(void *cds_context, struct scheduler_msg *msg) break; case SIR_HAL_PDEV_SET_HW_MODE: wma_send_pdev_set_hw_mode_cmd(wma_handle, - (struct sir_hw_mode *)msg->bodyptr); + (struct policy_mgr_hw_mode *)msg->bodyptr); qdf_mem_free(msg->bodyptr); break; case WMA_OCB_SET_CONFIG_CMD: @@ -7262,7 +7223,8 @@ QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle, } msg->saved_num_chan = wma_handle->saved_chan.num_channels; - status = cds_get_valid_chan_weights((struct sir_pcl_chan_weights *)msg); + status = policy_mgr_get_valid_chan_weights(wma_handle->psoc, + (struct policy_mgr_pcl_chan_weights *)msg); for (i = 0; i < msg->saved_num_chan; i++) { msg->weighed_valid_list[i] = @@ -7298,7 +7260,7 @@ QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle, * Return: Success if the cmd is sent successfully to the firmware */ QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle, - struct sir_hw_mode *msg) + struct policy_mgr_hw_mode *msg) { struct sir_set_hw_mode_resp *param; @@ -7371,8 +7333,8 @@ QDF_STATUS wma_send_pdev_set_dual_mac_config(tp_wma_handle wma_handle, return status; } - wma_handle->dual_mac_cfg.req_scan_config = msg->scan_config; - wma_handle->dual_mac_cfg.req_fw_mode_config = msg->fw_mode_config; + policy_mgr_update_dbs_req_config(wma_handle->psoc, + msg->scan_config, msg->fw_mode_config); return QDF_STATUS_SUCCESS; } diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index a90607c166eb..ee69c13b773a 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -63,7 +63,7 @@ #include "ol_fw.h" #include "dfs.h" #include "wma_internal.h" -#include "cds_concurrency.h" +#include "wlan_policy_mgr_api.h" #include "cdp_txrx_flow_ctrl_legacy.h" #include #include @@ -2554,7 +2554,8 @@ void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info) ¶m); if (QDF_IS_STATUS_ERROR(status)) { WMA_LOGE(FL("failed to send vdev up")); - cds_set_do_hw_mode_change_flag(false); + policy_mgr_set_do_hw_mode_change_flag( + wma->psoc, false); return; } wma_vdev_set_mlme_state(wma, vdev_id, WLAN_VDEV_S_RUN); diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index 0b62d89b8dee..524cd7eb53bd 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -55,7 +55,7 @@ #include "lim_session_utils.h" #include "cds_utils.h" -#include "cds_concurrency.h" +#include "wlan_policy_mgr_api.h" #if !defined(REMOVE_PKT_LOG) #include "pktlog_ac.h" @@ -74,6 +74,8 @@ #include #include "wma_he.h" #include +#include + #define WMA_MCC_MIRACAST_REST_TIME 400 #define WMA_SCAN_ID_MASK 0x0fff @@ -425,14 +427,16 @@ QDF_STATUS wma_get_buf_start_scan_cmd(tp_wma_handle wma_handle, QDF_MIN(scan_req->maxChannelTime, (WMA_CTS_DURATION_MS_MAX - WMA_ROAM_SCAN_CHANNEL_SWITCH_TIME)); - if (!wma_is_hw_dbs_capable() || - (wma_is_hw_dbs_capable() && + if (!policy_mgr_is_hw_dbs_capable(wma_handle->psoc) || + (policy_mgr_is_hw_dbs_capable(wma_handle->psoc) && CDS_IS_CHANNEL_5GHZ( - cds_get_channel(CDS_SAP_MODE, NULL)))) { + policy_mgr_get_channel(wma_handle->psoc, + PM_SAP_MODE, NULL)))) { cmd->dwell_time_passive = cmd->dwell_time_active; } cmd->burst_duration = 0; - if (CDS_IS_DFS_CH(cds_get_channel(CDS_SAP_MODE, NULL))) + if (CDS_IS_DFS_CH(policy_mgr_get_channel(wma_handle->psoc, + PM_SAP_MODE, NULL))) cmd->burst_duration = WMA_BURST_SCAN_MAX_NUM_OFFCHANNELS * scan_req->maxChannelTime; @@ -2895,7 +2899,7 @@ void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params) void *peer; struct cdp_pdev *pdev; struct wma_txrx_node *intr = wma->interfaces; - struct sir_hw_mode_params hw_mode = {0}; + struct policy_mgr_hw_mode_params hw_mode = {0}; void *soc = cds_get_context(QDF_MODULE_ID_SOC); WMA_LOGD("%s: Enter", __func__); @@ -2935,9 +2939,9 @@ void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params) WMA_LOGI(FL("vht_capable: %d, dot11_mode: %d"), req.vht_capable, req.dot11_mode); - status = wma_get_current_hw_mode(&hw_mode); + status = policy_mgr_get_current_hw_mode(wma->psoc, &hw_mode); if (!QDF_IS_STATUS_SUCCESS(status)) - WMA_LOGE("wma_get_current_hw_mode failed"); + WMA_LOGE("policy_mgr_get_current_hw_mode failed"); if ((params->nss == 2) && !hw_mode.dbs_cap) { req.preferred_rx_streams = 2; diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index 314100d2818f..25b7b729f49a 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -63,7 +63,7 @@ #include "dfs.h" #include "wma_internal.h" -#include "cds_concurrency.h" +#include "wlan_policy_mgr_api.h" #include "wmi_unified_param.h" #include "linux/ieee80211.h" #include @@ -2739,398 +2739,6 @@ QDF_STATUS wma_get_wcnss_software_version(void *p_cds_gctx, return QDF_STATUS_SUCCESS; } -/** - * wma_get_tx_rx_ss_from_config() - Get Tx/Rx spatial stream from HW mode config - * @mac_ss: Config which indicates the HW mode as per 'hw_mode_ss_config' - * @tx_ss: Contains the Tx spatial stream - * @rx_ss: Contains the Rx spatial stream - * - * Returns the number of spatial streams of Tx and Rx - * - * Return: None - */ -static void wma_get_tx_rx_ss_from_config(enum hw_mode_ss_config mac_ss, - uint32_t *tx_ss, uint32_t *rx_ss) -{ - switch (mac_ss) { - case HW_MODE_SS_0x0: - *tx_ss = 0; - *rx_ss = 0; - break; - case HW_MODE_SS_1x1: - *tx_ss = 1; - *rx_ss = 1; - break; - case HW_MODE_SS_2x2: - *tx_ss = 2; - *rx_ss = 2; - break; - case HW_MODE_SS_3x3: - *tx_ss = 3; - *rx_ss = 3; - break; - case HW_MODE_SS_4x4: - *tx_ss = 4; - *rx_ss = 4; - break; - default: - *tx_ss = 0; - *rx_ss = 0; - } -} - -/** - * wma_get_matching_hw_mode_index() - Get matching HW mode index - * @wma: WMA handle - * @mac0_tx_ss: Number of tx spatial streams of MAC0 - * @mac0_rx_ss: Number of rx spatial streams of MAC0 - * @mac0_bw: Bandwidth of MAC0 of type 'hw_mode_bandwidth' - * @mac1_tx_ss: Number of tx spatial streams of MAC1 - * @mac1_rx_ss: Number of rx spatial streams of MAC1 - * @mac1_bw: Bandwidth of MAC1 of type 'hw_mode_bandwidth' - * @dbs: DBS capability of type 'hw_mode_dbs_capab' - * @dfs: Agile DFS capability of type 'hw_mode_agile_dfs_capab' - * @sbs: SBS capability of type 'hw_mode_sbs_capab' - * - * Fetches the HW mode index corresponding to the HW mode provided - * - * Return: Positive hw mode index in case a match is found or a negative - * value, otherwise - */ -static int8_t wma_get_matching_hw_mode_index(tp_wma_handle wma, - uint32_t mac0_tx_ss, uint32_t mac0_rx_ss, - enum hw_mode_bandwidth mac0_bw, - uint32_t mac1_tx_ss, uint32_t mac1_rx_ss, - enum hw_mode_bandwidth mac1_bw, - enum hw_mode_dbs_capab dbs, - enum hw_mode_agile_dfs_capab dfs, - enum hw_mode_sbs_capab sbs) -{ - uint32_t i; - uint32_t t_mac0_tx_ss, t_mac0_rx_ss, t_mac0_bw; - uint32_t t_mac1_tx_ss, t_mac1_rx_ss, t_mac1_bw; - uint32_t dbs_mode, agile_dfs_mode, sbs_mode; - int8_t found = -EINVAL; - - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return found; - } - - for (i = 0; i < wma->num_dbs_hw_modes; i++) { - t_mac0_tx_ss = WMA_HW_MODE_MAC0_TX_STREAMS_GET( - wma->hw_mode.hw_mode_list[i]); - if (t_mac0_tx_ss != mac0_tx_ss) - continue; - - t_mac0_rx_ss = WMA_HW_MODE_MAC0_RX_STREAMS_GET( - wma->hw_mode.hw_mode_list[i]); - if (t_mac0_rx_ss != mac0_rx_ss) - continue; - - t_mac0_bw = WMA_HW_MODE_MAC0_BANDWIDTH_GET( - wma->hw_mode.hw_mode_list[i]); - /* - * Firmware advertises max bw capability as CBW 80+80 - * for single MAC. Thus CBW 20/40/80 should also be - * supported, if CBW 80+80 is supported. - */ - if (t_mac0_bw < mac0_bw) - continue; - - t_mac1_tx_ss = WMA_HW_MODE_MAC1_TX_STREAMS_GET( - wma->hw_mode.hw_mode_list[i]); - if (t_mac1_tx_ss != mac1_tx_ss) - continue; - - t_mac1_rx_ss = WMA_HW_MODE_MAC1_RX_STREAMS_GET( - wma->hw_mode.hw_mode_list[i]); - if (t_mac1_rx_ss != mac1_rx_ss) - continue; - - t_mac1_bw = WMA_HW_MODE_MAC1_BANDWIDTH_GET( - wma->hw_mode.hw_mode_list[i]); - if (t_mac1_bw < mac1_bw) - continue; - - dbs_mode = WMA_HW_MODE_DBS_MODE_GET( - wma->hw_mode.hw_mode_list[i]); - if (dbs_mode != dbs) - continue; - - agile_dfs_mode = WMA_HW_MODE_AGILE_DFS_GET( - wma->hw_mode.hw_mode_list[i]); - if (agile_dfs_mode != dfs) - continue; - - sbs_mode = WMA_HW_MODE_SBS_MODE_GET( - wma->hw_mode.hw_mode_list[i]); - if (sbs_mode != sbs) - continue; - - found = i; - WMA_LOGI("%s: hw_mode index %d found", - __func__, i); - break; - } - return found; -} - -/** - * wma_get_hw_mode_from_dbs_hw_list() - Get hw_mode index - * @mac0_ss: MAC0 spatial stream configuration - * @mac0_bw: MAC0 bandwidth configuration - * @mac1_ss: MAC1 spatial stream configuration - * @mac1_bw: MAC1 bandwidth configuration - * @dbs: HW DBS capability - * @dfs: HW Agile DFS capability - * @sbs: HW SBS capability - * - * Get the HW mode index corresponding to the HW modes spatial stream, - * bandwidth, DBS, Agile DFS and SBS capability - * - * Return: Index number if a match is found or -negative value if not found - */ -int8_t wma_get_hw_mode_idx_from_dbs_hw_list(enum hw_mode_ss_config mac0_ss, - enum hw_mode_bandwidth mac0_bw, - enum hw_mode_ss_config mac1_ss, - enum hw_mode_bandwidth mac1_bw, - enum hw_mode_dbs_capab dbs, - enum hw_mode_agile_dfs_capab dfs, - enum hw_mode_sbs_capab sbs) -{ - tp_wma_handle wma; - uint32_t mac0_tx_ss, mac0_rx_ss; - uint32_t mac1_tx_ss, mac1_rx_ss; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return -EINVAL; - } - - wma_get_tx_rx_ss_from_config(mac0_ss, &mac0_tx_ss, &mac0_rx_ss); - wma_get_tx_rx_ss_from_config(mac1_ss, &mac1_tx_ss, &mac1_rx_ss); - - WMA_LOGI("%s: MAC0: TxSS=%d, RxSS=%d, BW=%d", - __func__, mac0_tx_ss, mac0_rx_ss, mac0_bw); - WMA_LOGI("%s: MAC1: TxSS=%d, RxSS=%d, BW=%d", - __func__, mac1_tx_ss, mac1_rx_ss, mac1_bw); - WMA_LOGI("%s: DBS=%d, Agile DFS=%d, SBS=%d", - __func__, dbs, dfs, sbs); - - return wma_get_matching_hw_mode_index(wma, mac0_tx_ss, mac0_rx_ss, - mac0_bw, - mac1_tx_ss, mac1_rx_ss, - mac1_bw, - dbs, dfs, sbs); -} - -/** - * wma_get_hw_mode_from_idx() - Get HW mode based on index - * @idx: HW mode index - * @hw_mode: HW mode params - * - * Fetches the HW mode parameters - * - * Return: Success if hw mode is obtained and the hw mode params - */ -QDF_STATUS wma_get_hw_mode_from_idx(uint32_t idx, - struct sir_hw_mode_params *hw_mode) -{ - tp_wma_handle wma; - uint32_t param; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return QDF_STATUS_E_FAILURE; - } - - if (idx > wma->num_dbs_hw_modes) { - WMA_LOGE("%s: Invalid index", __func__); - return QDF_STATUS_E_FAILURE; - } - - if (!wma->num_dbs_hw_modes) { - WMA_LOGE("%s: No dbs hw modes available", __func__); - return QDF_STATUS_E_FAILURE; - } - - param = wma->hw_mode.hw_mode_list[idx]; - - hw_mode->mac0_tx_ss = WMA_HW_MODE_MAC0_TX_STREAMS_GET(param); - hw_mode->mac0_rx_ss = WMA_HW_MODE_MAC0_RX_STREAMS_GET(param); - hw_mode->mac0_bw = WMA_HW_MODE_MAC0_BANDWIDTH_GET(param); - hw_mode->mac1_tx_ss = WMA_HW_MODE_MAC1_TX_STREAMS_GET(param); - hw_mode->mac1_rx_ss = WMA_HW_MODE_MAC1_RX_STREAMS_GET(param); - hw_mode->mac1_bw = WMA_HW_MODE_MAC1_BANDWIDTH_GET(param); - hw_mode->dbs_cap = WMA_HW_MODE_DBS_MODE_GET(param); - hw_mode->agile_dfs_cap = WMA_HW_MODE_AGILE_DFS_GET(param); - hw_mode->sbs_cap = WMA_HW_MODE_SBS_MODE_GET(param); - - return QDF_STATUS_SUCCESS; -} - -/** - * wma_get_num_dbs_hw_modes() - Get number of HW mode - * - * Fetches the number of DBS HW modes returned by the FW - * - * Return: Negative value on error or returns the number of DBS HW modes - */ -int8_t wma_get_num_dbs_hw_modes(void) -{ - tp_wma_handle wma; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return -EINVAL; - } - return wma->num_dbs_hw_modes; -} - -/** - * wma_is_hw_dbs_capable() - Check if HW is DBS capable - * - * Checks if the HW is DBS capable - * - * Return: true if the HW is DBS capable - */ -bool wma_is_hw_dbs_capable(void) -{ - tp_wma_handle wma; - uint32_t param, i, found = 0; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return false; - } - - if (!wma_is_dbs_enable()) { - WMA_LOGI("%s: DBS is disabled", __func__); - return false; - } - - WMA_LOGI("%s: DBS service bit map: %d", __func__, - WMI_SERVICE_IS_ENABLED(wma->wmi_service_bitmap, - WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT)); - - /* The agreement with FW is that: To know if the target is DBS - * capable, DBS needs to be supported both in the HW mode list - * and in the service ready event - */ - if (!(WMI_SERVICE_IS_ENABLED(wma->wmi_service_bitmap, - WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT))) - return false; - - for (i = 0; i < wma->num_dbs_hw_modes; i++) { - param = wma->hw_mode.hw_mode_list[i]; - WMA_LOGI("%s: HW param: %x", __func__, param); - if (WMA_HW_MODE_DBS_MODE_GET(param)) { - WMA_LOGI("%s: HW (%d) is DBS capable", __func__, i); - found = 1; - break; - } - } - - if (found) - return true; - - return false; -} - -/** - * wma_is_hw_sbs_capable() - Check if HW is SBS capable - * - * Checks if the HW is SBS capable - * - * Return: true if the HW is SBS capable - */ -bool wma_is_hw_sbs_capable(void) -{ - tp_wma_handle wma; - uint32_t param, i, found = 0; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return false; - } - - /* The agreement with FW is that: To know if the target is SBS - * capable, SBS needs to be supported both in the HW mode list - * and DBS needs to be supported in the service ready event - */ - if (!(WMI_SERVICE_IS_ENABLED(wma->wmi_service_bitmap, - WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT))) { - WMA_LOGE("%s: SBS cannot be supported since DBS is disabled", - __func__); - return false; - } - - for (i = 0; i < wma->num_dbs_hw_modes; i++) { - param = wma->hw_mode.hw_mode_list[i]; - WMA_LOGI("%s: HW param: %x", __func__, param); - if (WMA_HW_MODE_SBS_MODE_GET(param)) { - WMA_LOGI("%s: HW (%d) is SBS capable", __func__, i); - found = 1; - break; - } - } - - if (found) - return true; - - return false; -} - -/* - * wma_get_cds_hw_mode_change_from_hw_mode_index - Returns value in terms of - * cds_hw_mode_change enums derived from hw_mode_index. - * - * Returns cds_hw_mode_change value derived from hw_mode_index. - * - * Return: value in terms of cds_hw_mode_change enums. - */ -enum cds_hw_mode_change -wma_get_cds_hw_mode_change_from_hw_mode_index(uint32_t hw_mode_index) -{ - tp_wma_handle wma; - uint32_t param = 0; - enum cds_hw_mode_change value = CDS_HW_MODE_NOT_IN_PROGRESS; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - goto ret_value; - } - - WMA_LOGI("%s: HW param: %x", __func__, param); - - param = wma->hw_mode.hw_mode_list[hw_mode_index]; - if (WMA_HW_MODE_DBS_MODE_GET(param)) { - WMA_LOGI("%s: DBS is requested with HW (%d)", __func__, - hw_mode_index); - value = CDS_DBS_IN_PROGRESS; - goto ret_value; - } - - if (WMA_HW_MODE_SBS_MODE_GET(param)) { - WMA_LOGI("%s: SBS is requested with HW (%d)", __func__, - hw_mode_index); - value = CDS_SBS_IN_PROGRESS; - goto ret_value; - } - - value = CDS_SMM_IN_PROGRESS; - WMA_LOGI("%s: SMM is requested with HW (%d)", __func__, - hw_mode_index); -ret_value: - return value; -} /** * wma_get_mac_id_of_vdev() - Get MAC id corresponding to a vdev @@ -3156,36 +2764,6 @@ int8_t wma_get_mac_id_of_vdev(uint32_t vdev_id) return -EINVAL; } -/** - * wma_get_old_and_new_hw_index() - Get the old and new HW index - * @old_hw_mode_index: Value at this pointer contains the old HW mode index - * Default value when not configured is WMA_DEFAULT_HW_MODE_INDEX - * @new_hw_mode_index: Value at this pointer contains the new HW mode index - * Default value when not configured is WMA_DEFAULT_HW_MODE_INDEX - * - * Get the old and new HW index configured in the driver - * - * Return: Failure in case the HW mode indices cannot be fetched and Success - * otherwise. When no HW mode transition has happened the values of - * old_hw_mode_index and new_hw_mode_index will be the same. - */ -QDF_STATUS wma_get_old_and_new_hw_index(uint32_t *old_hw_mode_index, - uint32_t *new_hw_mode_index) -{ - tp_wma_handle wma; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return QDF_STATUS_E_INVAL; - } - - *old_hw_mode_index = wma->old_hw_mode_index; - *new_hw_mode_index = wma->new_hw_mode_index; - - return QDF_STATUS_SUCCESS; -} - /** * wma_update_intf_hw_mode_params() - Update WMA params * @vdev_id: VDEV id whose params needs to be updated @@ -3233,565 +2811,6 @@ void wma_update_intf_hw_mode_params(uint32_t vdev_id, uint32_t mac_id, } } -/** - * wma_get_dbs_hw_modes() - Get the DBS HW modes for userspace - * @one_by_one_dbs: 1x1 DBS capability of HW - * @two_by_two_dbs: 2x2 DBS capability of HW - * - * Provides the DBS HW mode capability such as whether - * 1x1 DBS, 2x2 DBS is supported by the HW or not. - * - * Return: Failure in case of error and 0 on success - * one_by_one_dbs/two_by_two_dbs will be false, - * if they are not supported. - * one_by_one_dbs/two_by_two_dbs will be true, - * if they are supported. - * false values of one_by_one_dbs/two_by_two_dbs, - * indicate DBS is disabled - */ -QDF_STATUS wma_get_dbs_hw_modes(bool *one_by_one_dbs, bool *two_by_two_dbs) -{ - tp_wma_handle wma; - uint32_t i; - int8_t found_one_by_one = -EINVAL, found_two_by_two = -EINVAL; - uint32_t conf1_tx_ss, conf1_rx_ss; - uint32_t conf2_tx_ss, conf2_rx_ss; - - *one_by_one_dbs = false; - *two_by_two_dbs = false; - - if (wma_is_hw_dbs_capable() == false) { - WMA_LOGE("%s: HW is not DBS capable", __func__); - /* Caller will understand that DBS is disabled */ - return QDF_STATUS_SUCCESS; - - } - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return QDF_STATUS_E_FAILURE; - } - - /* To check 1x1 capability */ - wma_get_tx_rx_ss_from_config(HW_MODE_SS_1x1, - &conf1_tx_ss, &conf1_rx_ss); - /* To check 2x2 capability */ - wma_get_tx_rx_ss_from_config(HW_MODE_SS_2x2, - &conf2_tx_ss, &conf2_rx_ss); - - for (i = 0; i < wma->num_dbs_hw_modes; i++) { - uint32_t t_conf0_tx_ss, t_conf0_rx_ss; - uint32_t t_conf1_tx_ss, t_conf1_rx_ss; - uint32_t dbs_mode; - - t_conf0_tx_ss = WMA_HW_MODE_MAC0_TX_STREAMS_GET( - wma->hw_mode.hw_mode_list[i]); - t_conf0_rx_ss = WMA_HW_MODE_MAC0_RX_STREAMS_GET( - wma->hw_mode.hw_mode_list[i]); - t_conf1_tx_ss = WMA_HW_MODE_MAC1_TX_STREAMS_GET( - wma->hw_mode.hw_mode_list[i]); - t_conf1_rx_ss = WMA_HW_MODE_MAC1_RX_STREAMS_GET( - wma->hw_mode.hw_mode_list[i]); - dbs_mode = WMA_HW_MODE_DBS_MODE_GET( - wma->hw_mode.hw_mode_list[i]); - - if (((((t_conf0_tx_ss == conf1_tx_ss) && - (t_conf0_rx_ss == conf1_rx_ss)) || - ((t_conf1_tx_ss == conf1_tx_ss) && - (t_conf1_rx_ss == conf1_rx_ss))) && - (dbs_mode == HW_MODE_DBS)) && - (found_one_by_one < 0)) { - found_one_by_one = i; - WMA_LOGI("%s: 1x1 hw_mode index %d found", - __func__, i); - /* Once an entry is found, need not check for 1x1 - * again - */ - continue; - } - - if (((((t_conf0_tx_ss == conf2_tx_ss) && - (t_conf0_rx_ss == conf2_rx_ss)) || - ((t_conf1_tx_ss == conf2_tx_ss) && - (t_conf1_rx_ss == conf2_rx_ss))) && - (dbs_mode == HW_MODE_DBS)) && - (found_two_by_two < 0)) { - found_two_by_two = i; - WMA_LOGI("%s: 2x2 hw_mode index %d found", - __func__, i); - /* Once an entry is found, need not check for 2x2 - * again - */ - continue; - } - } - - if (found_one_by_one >= 0) - *one_by_one_dbs = true; - if (found_two_by_two >= 0) - *two_by_two_dbs = true; - - return QDF_STATUS_SUCCESS; -} - -/** - * wma_get_current_hw_mode() - Get current HW mode params - * @hw_mode: HW mode parameters - * - * Provides the current HW mode parameters if the HW mode is initialized - * in the driver - * - * Return: Success if the current HW mode params are successfully populated - */ -QDF_STATUS wma_get_current_hw_mode(struct sir_hw_mode_params *hw_mode) -{ - QDF_STATUS status; - uint32_t old_hw_index = 0, new_hw_index = 0; - - WMA_LOGI("%s: Get the current hw mode", __func__); - - status = wma_get_old_and_new_hw_index(&old_hw_index, - &new_hw_index); - if (QDF_STATUS_SUCCESS != status) { - WMA_LOGE("%s: Failed to get HW mode index", __func__); - return QDF_STATUS_E_FAILURE; - } - - if (new_hw_index == WMA_DEFAULT_HW_MODE_INDEX) { - WMA_LOGE("%s: HW mode is not yet initialized", __func__); - return QDF_STATUS_E_FAILURE; - } - - status = wma_get_hw_mode_from_idx(new_hw_index, hw_mode); - if (QDF_STATUS_SUCCESS != status) { - WMA_LOGE("%s: Failed to get HW mode index", __func__); - return QDF_STATUS_E_FAILURE; - } - return QDF_STATUS_SUCCESS; -} - -/** - * wma_is_current_hwmode_dbs() - Check if current hw mode is DBS - * - * Checks if current hardware mode of the system is DBS or no - * - * Return: true or false - */ -bool wma_is_current_hwmode_dbs(void) -{ - struct sir_hw_mode_params hw_mode; - - if (!wma_is_hw_dbs_capable()) - return false; - if (QDF_STATUS_SUCCESS != wma_get_current_hw_mode(&hw_mode)) - return false; - if (hw_mode.dbs_cap) - return true; - return false; -} - -/** - * wma_is_dbs_enable() - Check if master DBS control is enabled - * - * Checks if the master DBS control is enabled. This will be used - * to override any other DBS capability - * - * Return: True if master DBS control is enabled - */ -bool wma_is_dbs_enable(void) -{ - tp_wma_handle wma; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return false; - } - - WMA_LOGD("%s: DBS=%d", __func__, - WMI_DBS_FW_MODE_CFG_DBS_GET(wma->dual_mac_cfg.cur_fw_mode_config)); - - if (WMI_DBS_FW_MODE_CFG_DBS_GET(wma->dual_mac_cfg.cur_fw_mode_config)) - return true; - - return false; -} - -/** - * wma_get_updated_scan_config() - Get the updated scan configuration - * @scan_config: Pointer containing the updated scan config - * @dbs_scan: 0 or 1 indicating if DBS scan needs to be enabled/disabled - * @dbs_plus_agile_scan: 0 or 1 indicating if DBS plus agile scan needs to be - * enabled/disabled - * @single_mac_scan_with_dfs: 0 or 1 indicating if single MAC scan with DFS - * needs to be enabled/disabled - * - * Takes the current scan configuration and set the necessary scan config - * bits to either 0/1 and provides the updated value to the caller who - * can use this to pass it on to the FW - * - * Return: 0 on success - */ -QDF_STATUS wma_get_updated_scan_config(uint32_t *scan_config, - bool dbs_scan, - bool dbs_plus_agile_scan, - bool single_mac_scan_with_dfs) -{ - tp_wma_handle wma; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return QDF_STATUS_E_FAILURE; - } - *scan_config = wma->dual_mac_cfg.cur_scan_config; - - WMI_DBS_CONC_SCAN_CFG_DBS_SCAN_SET(*scan_config, dbs_scan); - WMI_DBS_CONC_SCAN_CFG_AGILE_SCAN_SET(*scan_config, - dbs_plus_agile_scan); - WMI_DBS_CONC_SCAN_CFG_AGILE_DFS_SCAN_SET(*scan_config, - single_mac_scan_with_dfs); - - WMA_LOGD("%s: *scan_config:%x ", __func__, *scan_config); - return QDF_STATUS_SUCCESS; -} - -/** - * wma_get_updated_fw_mode_config() - Get the updated fw mode configuration - * @fw_mode_config: Pointer containing the updated fw mode config - * @dbs: 0 or 1 indicating if DBS needs to be enabled/disabled - * @agile_dfs: 0 or 1 indicating if agile DFS needs to be enabled/disabled - * - * Takes the current fw mode configuration and set the necessary fw mode config - * bits to either 0/1 and provides the updated value to the caller who - * can use this to pass it on to the FW - * - * Return: 0 on success - */ -QDF_STATUS wma_get_updated_fw_mode_config(uint32_t *fw_mode_config, - bool dbs, - bool agile_dfs) -{ - tp_wma_handle wma; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return QDF_STATUS_E_FAILURE; - } - *fw_mode_config = wma->dual_mac_cfg.cur_fw_mode_config; - - WMI_DBS_FW_MODE_CFG_DBS_SET(*fw_mode_config, dbs); - WMI_DBS_FW_MODE_CFG_AGILE_DFS_SET(*fw_mode_config, agile_dfs); - - WMA_LOGD("%s: *fw_mode_config:%x ", __func__, *fw_mode_config); - return QDF_STATUS_SUCCESS; -} - -/** - * wma_get_dbs_config() - Get DBS bit - * - * Gets the DBS bit of fw_mode_config_bits - * - * Return: 0 or 1 to indicate the DBS bit - */ -bool wma_get_dbs_config(void) -{ - tp_wma_handle wma; - uint32_t fw_mode_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - fw_mode_config = wma->dual_mac_cfg.cur_fw_mode_config; - - return WMI_DBS_FW_MODE_CFG_DBS_GET(fw_mode_config); -} - -/** - * wma_get_agile_dfs_config() - Get Agile DFS bit - * - * Gets the Agile DFS bit of fw_mode_config_bits - * - * Return: 0 or 1 to indicate the Agile DFS bit - */ -bool wma_get_agile_dfs_config(void) -{ - tp_wma_handle wma; - uint32_t fw_mode_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - fw_mode_config = wma->dual_mac_cfg.cur_fw_mode_config; - - return WMI_DBS_FW_MODE_CFG_AGILE_DFS_GET(fw_mode_config); -} - -/** - * wma_get_dbs_scan_config() - Get DBS scan bit - * - * Gets the DBS scan bit of concurrent_scan_config_bits - * - * Return: 0 or 1 to indicate the DBS scan bit - */ -bool wma_get_dbs_scan_config(void) -{ - tp_wma_handle wma; - uint32_t scan_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - scan_config = wma->dual_mac_cfg.cur_scan_config; - - return WMI_DBS_CONC_SCAN_CFG_DBS_SCAN_GET(scan_config); -} - -/** - * wma_get_dbs_plus_agile_scan_config() - Get DBS plus agile scan bit - * - * Gets the DBS plus agile scan bit of concurrent_scan_config_bits - * - * Return: 0 or 1 to indicate the DBS plus agile scan bit - */ -bool wma_get_dbs_plus_agile_scan_config(void) -{ - tp_wma_handle wma; - uint32_t scan_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - scan_config = wma->dual_mac_cfg.cur_scan_config; - - return WMI_DBS_CONC_SCAN_CFG_AGILE_SCAN_GET(scan_config); -} - -/** - * wma_get_single_mac_scan_with_dfs_config() - Get Single MAC scan with DFS bit - * - * Gets the Single MAC scan with DFS bit of concurrent_scan_config_bits - * - * Return: 0 or 1 to indicate the Single MAC scan with DFS bit - */ -bool wma_get_single_mac_scan_with_dfs_config(void) -{ - tp_wma_handle wma; - uint32_t scan_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - scan_config = wma->dual_mac_cfg.cur_scan_config; - - return WMI_DBS_CONC_SCAN_CFG_AGILE_DFS_SCAN_GET(scan_config); -} - -/** - * wma_is_dual_mac_disabled_in_ini() - Check if dual mac is disabled in INI - * - * Checks if the dual mac feature is disabled in INI - * - * Return: true if the dual mac feature is disabled from INI - */ -bool wma_is_dual_mac_disabled_in_ini(void) -{ - tpAniSirGlobal mac = cds_get_context(QDF_MODULE_ID_PE); - - if (!mac) { - WMA_LOGE("%s: Invalid mac pointer", __func__); - return true; - } - - if (mac->dual_mac_feature_disable) - return true; - - return false; -} - -/** - * wma_get_prev_dbs_config() - Get prev DBS bit - * - * Gets the previous DBS bit of fw_mode_config_bits - * - * Return: 0 or 1 to indicate the DBS bit - */ -bool wma_get_prev_dbs_config(void) -{ - tp_wma_handle wma; - uint32_t fw_mode_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - fw_mode_config = wma->dual_mac_cfg.prev_fw_mode_config; - - return WMI_DBS_FW_MODE_CFG_DBS_GET(fw_mode_config); -} - -/** - * wma_get_prev_agile_dfs_config() - Get prev Agile DFS bit - * - * Gets the previous Agile DFS bit of fw_mode_config_bits - * - * Return: 0 or 1 to indicate the Agile DFS bit - */ -bool wma_get_prev_agile_dfs_config(void) -{ - tp_wma_handle wma; - uint32_t fw_mode_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - fw_mode_config = wma->dual_mac_cfg.prev_fw_mode_config; - - return WMI_DBS_FW_MODE_CFG_AGILE_DFS_GET(fw_mode_config); -} - -/** - * wma_get_prev_dbs_scan_config() - Get prev DBS scan bit - * - * Gets the previous DBS scan bit of concurrent_scan_config_bits - * - * Return: 0 or 1 to indicate the DBS scan bit - */ -bool wma_get_prev_dbs_scan_config(void) -{ - tp_wma_handle wma; - uint32_t scan_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - scan_config = wma->dual_mac_cfg.prev_scan_config; - - return WMI_DBS_CONC_SCAN_CFG_DBS_SCAN_GET(scan_config); -} - -/** - * wma_get_prev_dbs_plus_agile_scan_config() - Get prev DBS plus agile scan bit - * - * Gets the previous DBS plus agile scan bit of concurrent_scan_config_bits - * - * Return: 0 or 1 to indicate the DBS plus agile scan bit - */ -bool wma_get_prev_dbs_plus_agile_scan_config(void) -{ - tp_wma_handle wma; - uint32_t scan_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - scan_config = wma->dual_mac_cfg.prev_scan_config; - - return WMI_DBS_CONC_SCAN_CFG_AGILE_SCAN_GET(scan_config); -} - -/** - * wma_get_prev_single_mac_scan_with_dfs_config() - Get prev Single MAC scan - * with DFS bit - * - * Gets the previous Single MAC scan with DFS bit of concurrent_scan_config_bits - * - * Return: 0 or 1 to indicate the Single MAC scan with DFS bit - */ -bool wma_get_prev_single_mac_scan_with_dfs_config(void) -{ - tp_wma_handle wma; - uint32_t scan_config; - - if (wma_is_dual_mac_disabled_in_ini()) - return false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - /* We take that it is disabled and proceed */ - return false; - } - scan_config = wma->dual_mac_cfg.prev_scan_config; - - return WMI_DBS_CONC_SCAN_CFG_AGILE_DFS_SCAN_GET(scan_config); -} - -/** - * wma_is_scan_simultaneous_capable() - Check if scan parallelization is - * supported or not - * - * currently scan parallelization feature support is dependent on DBS but - * it can be independent in future. - * - * Return: True if master DBS control is enabled - */ -bool wma_is_scan_simultaneous_capable(void) -{ - if (wma_is_hw_dbs_capable()) - return true; - - return false; -} - /** * wma_get_vht_ch_width - return vht channel width * @@ -3882,57 +2901,6 @@ bool wma_is_p2p_lo_capable(void) return false; } -/** - * wma_is_hw_dbs_2x2_capable() - if hardware is capable of dbs 2x2 - * - * This function checks if hw_modes supported are always capable of - * DBS 2x2. - * true: DBS 2x2 can always be supported - * false: hw_modes support DBS 1x1 as well - * - * Return: true - DBS2x2, false - DBS1x1 - */ -bool wma_is_hw_dbs_2x2_capable(void) -{ - tp_wma_handle wma; - int i, param; - uint32_t dbs, tx_chain0, rx_chain0, tx_chain1, rx_chain1; - uint32_t final_min_rf_chains = 2; - uint32_t min_rf_chains, min_mac0_rf_chains, min_mac1_rf_chains; - bool is_dbs_found = false; - - wma = cds_get_context(QDF_MODULE_ID_WMA); - if (!wma) { - WMA_LOGE("%s: Invalid WMA handle", __func__); - return false; - } - - for (i = 0; i < wma->num_dbs_hw_modes; i++) { - param = wma->hw_mode.hw_mode_list[i]; - tx_chain0 = WMA_HW_MODE_MAC0_TX_STREAMS_GET(param); - rx_chain0 = WMA_HW_MODE_MAC0_RX_STREAMS_GET(param); - dbs = WMA_HW_MODE_DBS_MODE_GET(param); - tx_chain1 = WMA_HW_MODE_MAC1_TX_STREAMS_GET(param); - rx_chain1 = WMA_HW_MODE_MAC1_RX_STREAMS_GET(param); - - if (dbs) { - min_mac0_rf_chains = QDF_MIN(tx_chain0, rx_chain0); - min_mac1_rf_chains = QDF_MIN(tx_chain1, rx_chain1); - min_rf_chains = QDF_MIN(min_mac0_rf_chains, - min_mac1_rf_chains); - is_dbs_found = true; - } else { - continue; - } - final_min_rf_chains = QDF_MIN(final_min_rf_chains, - min_rf_chains); - } - if (false == is_dbs_found) - final_min_rf_chains = 0; - - return (final_min_rf_chains == 2) ? true : false; -} - bool wma_is_vdev_up(uint8_t vdev_id) { struct wlan_objmgr_vdev *vdev;