diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index c8e7baf30caf..31d782d7c955 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -239,6 +239,34 @@ static void wma_set_ipa_disable_config( #ifndef NUM_OF_ADDITIONAL_FW_PEERS #define NUM_OF_ADDITIONAL_FW_PEERS 2 #endif + +/** + * wma_update_num_peers_tids() - Update num_peers and tids based on num_vdevs + * @wma_handle: wma handle + * @tgt_cfg: Resource config given to target + * + * Get num_vdevs from tgt_cfg and update num_peers and tids based on it. + * + * Return: none + */ +static void wma_update_num_peers_tids(t_wma_handle *wma_handle, + target_resource_config *tgt_cfg) + +{ + uint8_t no_of_peers_supported; + + no_of_peers_supported = wma_get_number_of_peers_supported(wma_handle); + + tgt_cfg->num_peers = no_of_peers_supported + tgt_cfg->num_vdevs + + NUM_OF_ADDITIONAL_FW_PEERS; + /* The current firmware implementation requires the number of + * offload peers should be (number of vdevs + 1). + */ + tgt_cfg->num_tids = + wma_get_number_of_tids_supported(no_of_peers_supported, + tgt_cfg->num_vdevs); +} + /** * wma_set_default_tgt_config() - set default tgt config * @wma_handle: wma handle @@ -250,15 +278,11 @@ static void wma_set_default_tgt_config(tp_wma_handle wma_handle, target_resource_config *tgt_cfg, struct cds_config_info *cds_cfg) { - uint8_t no_of_peers_supported; - - no_of_peers_supported = wma_get_number_of_peers_supported(wma_handle); - qdf_mem_zero(tgt_cfg, sizeof(target_resource_config)); + tgt_cfg->num_vdevs = cds_cfg->num_vdevs; - tgt_cfg->num_peers = no_of_peers_supported + - cds_cfg->num_vdevs + - NUM_OF_ADDITIONAL_FW_PEERS; + wma_update_num_peers_tids(wma_handle, tgt_cfg); + /* The current firmware implementation requires the number of * offload peers should be (number of vdevs + 1). */ @@ -266,8 +290,6 @@ static void wma_set_default_tgt_config(tp_wma_handle wma_handle, tgt_cfg->num_offload_reorder_buffs = cds_cfg->ap_maxoffload_reorderbuffs + 1; tgt_cfg->num_peer_keys = CFG_TGT_NUM_PEER_KEYS; - tgt_cfg->num_tids = wma_get_number_of_tids_supported( - no_of_peers_supported, cds_cfg->num_vdevs); tgt_cfg->ast_skid_limit = CFG_TGT_AST_SKID_LIMIT; tgt_cfg->tx_chain_mask = CFG_TGT_DEFAULT_TX_CHAIN_MASK; tgt_cfg->rx_chain_mask = CFG_TGT_DEFAULT_RX_CHAIN_MASK; @@ -6747,8 +6769,24 @@ int wma_rx_service_ready_ext_event(void *handle, uint8_t *event, if (wmi_service_enabled(wma_handle->wmi_handle, wmi_service_nan_vdev)) ucfg_nan_set_vdev_creation_supp_by_fw(wma_handle->psoc, true); - if (ucfg_nan_is_vdev_creation_allowed(wma_handle->psoc)) + /* + * Firmware can accommodate maximum 4 vdevs and the ini gNumVdevs + * indicates the same. + * If host driver is going to create vdev for NAN, it indicates + * the total no.of vdevs supported to firmware which includes the + * NAN vdev. + * If firmware is going to create NAN discovery vdev, host should + * indicate 3 vdevs and firmware shall add 1 vdev for NAN. So decrement + * the num_vdevs by 1. + */ + if (ucfg_nan_is_vdev_creation_allowed(wma_handle->psoc)) { wlan_res_cfg->nan_separate_iface_support = true; + } else { + wlan_res_cfg->num_vdevs--; + wma_update_num_peers_tids(wma_handle, wlan_res_cfg); + } + + WMA_LOGD("%s: num_vdevs: %u", __func__, wlan_res_cfg->num_vdevs); wma_init_dbr_params(wma_handle);