From 1967ff92ff9f00d448c431674e5f2f32b983425b Mon Sep 17 00:00:00 2001 From: Amruta Kulkarni Date: Wed, 5 Feb 2020 14:57:04 -0800 Subject: [PATCH] qcacld-3.0: Log enhancement for policy mgr Enhance logs in policy mgr module to remove duplicate or unwanted prints and keep only useful logs to debug. Change-Id: Ifd585256955aceec29286d82838be0c588228c32 CRs-Fixed: 2614763 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 13 ++ .../policy_mgr/src/wlan_policy_mgr_action.c | 4 +- .../policy_mgr/src/wlan_policy_mgr_core.c | 9 +- .../src/wlan_policy_mgr_get_set_utils.c | 57 +++------ .../policy_mgr/src/wlan_policy_mgr_i.h | 5 +- .../policy_mgr/src/wlan_policy_mgr_pcl.c | 120 +++++++++++++----- core/wma/src/wma_main.c | 11 +- 7 files changed, 137 insertions(+), 82 deletions(-) diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index af3729566e86..50851d656259 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -3302,4 +3302,17 @@ bool policy_mgr_is_sap_go_on_2g(struct wlan_objmgr_psoc *psoc); bool policy_mgr_get_5g_scc_prefer( struct wlan_objmgr_psoc *psoc, enum policy_mgr_con_mode mode); +/** + * policy_mgr_dump_channel_list() - Print channel list + * @len: Length of pcl list + * @pcl_channels: pcl channels list + * @pcl_weight: pcl weight list + * + * + * Return: True or false + */ +bool policy_mgr_dump_channel_list(uint32_t len, + uint32_t *pcl_channels, + uint8_t *pcl_weight); + #endif /* __WLAN_POLICY_MGR_API_H */ diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index e7b5032c6c75..e03bb3fc8174 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -1304,10 +1304,8 @@ bool policy_mgr_is_safe_channel(struct wlan_objmgr_psoc *psoc, } - if (pm_ctx->unsafe_channel_count == 0) { - policy_mgr_debug("There are no unsafe channels"); + if (pm_ctx->unsafe_channel_count == 0) return is_safe; - } for (j = 0; j < pm_ctx->unsafe_channel_count; j++) { if (ch_freq == pm_ctx->unsafe_channel_list[j]) { diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c index 4149abda1f8e..cfc316566d75 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c @@ -2010,11 +2010,11 @@ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero( (channel_state == CHANNEL_STATE_INVALID)) /* Set weight of inactive channels to 0 */ weight_list[i] = 0; - - policy_mgr_debug("ch freq: [%d] - %d, weight[%d] - %d", - i, pcl_channels[i], i, weight_list[i]); } + policy_mgr_dump_channel_list(orig_channel_count, + pcl_channels, weight_list); + return; } @@ -2172,7 +2172,6 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc, */ sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc); - policy_mgr_debug("sta_sap_scc_on_dfs_chan %u", sta_sap_scc_on_dfs_chan); if ((mode == PM_SAP_MODE) || (mode == PM_P2P_GO_MODE)) { if ((policy_mgr_mode_specific_connection_count(psoc, PM_STA_MODE, @@ -2813,7 +2812,7 @@ bool policy_mgr_is_5g_channel_allowed(struct wlan_objmgr_psoc *psoc, WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq) && (ch_freq != pm_conc_connection_list[list[index]].freq)) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); - policy_mgr_err("don't allow MCC if SAP/GO on DFS channel"); + policy_mgr_rl_debug("don't allow MCC if SAP/GO on DFS channel"); return false; } index++; diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index de8fefb61976..ca8d0df64f5d 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -874,8 +874,6 @@ bool policy_mgr_find_if_fw_supports_dbs(struct wlan_objmgr_psoc *psoc) dbs_support = wmi_service_enabled(wmi_handle, wmi_service_dual_band_simultaneous_support); - policy_mgr_debug("is DBS supported by FW/HW: %s", - dbs_support ? "yes" : "no"); /* 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 @@ -900,9 +898,7 @@ bool policy_mgr_find_if_hwlist_has_dbs(struct wlan_objmgr_psoc *psoc) } for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) { param = pm_ctx->hw_mode.hw_mode_list[i]; - policy_mgr_debug("HW param: %x", param); if (POLICY_MGR_HW_MODE_DBS_MODE_GET(param)) { - policy_mgr_debug("HW (%d) is DBS capable", i); found = 1; break; } @@ -926,9 +922,7 @@ static bool policy_mgr_find_if_hwlist_has_sbs(struct wlan_objmgr_psoc *psoc) } for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) { param = pm_ctx->hw_mode.hw_mode_list[i]; - policy_mgr_debug("HW param: %x", param); if (POLICY_MGR_HW_MODE_SBS_MODE_GET(param)) { - policy_mgr_debug("HW (%d) is SBS capable", i); found = 1; break; } @@ -972,27 +966,32 @@ bool policy_mgr_is_dbs_scan_allowed(struct wlan_objmgr_psoc *psoc) bool policy_mgr_is_hw_dbs_capable(struct wlan_objmgr_psoc *psoc) { - if (!policy_mgr_is_dbs_enable(psoc)) { - policy_mgr_debug("DBS is disabled"); + if (!policy_mgr_is_dbs_enable(psoc)) + return false; + + if (!policy_mgr_find_if_fw_supports_dbs(psoc)) + return false; + + if (!policy_mgr_find_if_hwlist_has_dbs(psoc)) { + policymgr_nofl_debug("HW mode list has no DBS"); return false; } - if (!policy_mgr_find_if_fw_supports_dbs(psoc)) { - policy_mgr_debug("HW mode list has no DBS"); - return false; - } - - return policy_mgr_find_if_hwlist_has_dbs(psoc); + return true; } bool policy_mgr_is_hw_sbs_capable(struct wlan_objmgr_psoc *psoc) { if (!policy_mgr_find_if_fw_supports_dbs(psoc)) { - policy_mgr_debug("HW mode list has no DBS"); return false; } - return policy_mgr_find_if_hwlist_has_sbs(psoc); + if (!policy_mgr_find_if_hwlist_has_sbs(psoc)) { + policymgr_nofl_debug("HW mode list has no SBS"); + return false; + } + + return true; } QDF_STATUS policy_mgr_get_dbs_hw_modes(struct wlan_objmgr_psoc *psoc, @@ -1086,8 +1085,6 @@ QDF_STATUS policy_mgr_get_current_hw_mode(struct wlan_objmgr_psoc *psoc, QDF_STATUS status; uint32_t old_hw_index = 0, new_hw_index = 0; - policy_mgr_debug("Get the current hw mode"); - status = policy_mgr_get_old_and_new_hw_index(psoc, &old_hw_index, &new_hw_index); if (QDF_STATUS_SUCCESS != status) { @@ -1127,7 +1124,7 @@ bool policy_mgr_is_dbs_enable(struct wlan_objmgr_psoc *psoc) struct policy_mgr_psoc_priv_obj *pm_ctx; if (policy_mgr_is_dual_mac_disabled_in_ini(psoc)) { - policy_mgr_debug("DBS is disabled from ini"); + policy_mgr_rl_debug("DBS is disabled from ini"); return false; } @@ -1137,10 +1134,6 @@ bool policy_mgr_is_dbs_enable(struct wlan_objmgr_psoc *psoc) return false; } - policy_mgr_debug("DBS=%d", - WMI_DBS_FW_MODE_CFG_DBS_GET( - pm_ctx->dual_mac_cfg.cur_fw_mode_config)); - if (WMI_DBS_FW_MODE_CFG_DBS_GET( pm_ctx->dual_mac_cfg.cur_fw_mode_config)) return true; @@ -2041,9 +2034,7 @@ uint32_t policy_mgr_get_mode_specific_conn_info( count = policy_mgr_mode_specific_connection_count( psoc, mode, list); qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); - if (count == 0) { - policy_mgr_debug("No mode:[%d] connection", mode); - } else if (count == 1) { + if (count == 1) { *ch_freq_list = pm_conc_connection_list[list[index]].freq; *vdev_id = pm_conc_connection_list[list[index]].vdev_id; @@ -2055,7 +2046,6 @@ uint32_t policy_mgr_get_mode_specific_conn_info( vdev_id[index] = pm_conc_connection_list[list[index]].vdev_id; } - policy_mgr_debug("Multiple mode:[%d] connections", mode); } qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); @@ -2331,8 +2321,6 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, sta_sap_scc_on_dfs_chan = policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(psoc); - policy_mgr_debug("sta_sap_scc_on_dfs_chan %u", - sta_sap_scc_on_dfs_chan); if (!sta_sap_scc_on_dfs_chan && ((mode == PM_P2P_GO_MODE) || (mode == PM_SAP_MODE))) { @@ -2348,7 +2336,7 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc, num_connections) { if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) { if (policy_mgr_is_sap_p2pgo_on_dfs(psoc)) { - policy_mgr_err("MCC not allowed: SAP/P2PGO on DFS"); + policy_mgr_rl_debug("MCC not allowed: SAP/P2PGO on DFS"); goto done; } } @@ -3498,8 +3486,8 @@ bool policy_mgr_is_dnsc_set(struct wlan_objmgr_vdev *vdev) roffchan = wlan_vdev_mlme_cap_get(vdev, WLAN_VDEV_C_RESTRICT_OFFCHAN); - policy_mgr_debug("Restrict offchannel:%s", - roffchan ? "set" : "clear"); + if (roffchan) + policy_mgr_debug("Restrict offchannel is set"); return roffchan; } @@ -3520,15 +3508,13 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, cc_count = policy_mgr_get_mode_specific_conn_info( psoc, &op_ch_freq_list[cc_count], &vdev_id[cc_count], PM_SAP_MODE); - policy_mgr_debug("Number of SAP modes: %d", cc_count); if (cc_count < MAX_NUMBER_OF_CONC_CONNECTIONS) cc_count = cc_count + policy_mgr_get_mode_specific_conn_info( psoc, &op_ch_freq_list[cc_count], &vdev_id[cc_count], PM_P2P_GO_MODE); - policy_mgr_debug("Number of beaconing entities (SAP + GO):%d", - cc_count); + if (!cc_count) { *ok = true; return QDF_STATUS_SUCCESS; @@ -3596,7 +3582,6 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc, wlan_objmgr_vdev_release_ref(vdev, WLAN_POLICY_MGR_ID); } } - policy_mgr_debug("freq: %d ok %d", ch_freq, *ok); return QDF_STATUS_SUCCESS; } diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h index b616676d8bd2..3ccb32f19887 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-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 @@ -181,6 +181,9 @@ #define policymgr_nofl_debug(params...) \ QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_POLICY_MGR, params) +#define policy_mgr_rl_debug(params...) \ + QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_POLICY_MGR, params) + #define PM_CONC_CONNECTION_LIST_VALID_INDEX(index) \ ((MAX_NUMBER_OF_CONC_CONNECTIONS > index) && \ (pm_conc_connection_list[index].in_use)) diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index fa3cef1b4e9d..98cfb14e0579 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-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 @@ -30,6 +30,7 @@ #include "wlan_policy_mgr_i.h" #include "qdf_types.h" #include "qdf_trace.h" +#include "qdf_str.h" #include "wlan_objmgr_global_obj.h" #include "wlan_utility.h" #include "wlan_mlme_ucfg_api.h" @@ -559,7 +560,10 @@ static QDF_STATUS policy_mgr_pcl_modification_for_sap( uint32_t *len) { QDF_STATUS status = QDF_STATUS_E_FAILURE; - uint32_t i; + bool mandatory_modified_pcl = false; + bool nol_modified_pcl = false; + bool dfs_modified_pcl = false; + bool modified_final_pcl = false; if (policy_mgr_is_sap_mandatory_channel_set(psoc)) { status = policy_mgr_modify_sap_pcl_based_on_mandatory_channel( @@ -569,10 +573,7 @@ static QDF_STATUS policy_mgr_pcl_modification_for_sap( "failed to get mandatory modified pcl for SAP"); return status; } - policy_mgr_debug("mandatory modified pcl len:%d", *len); - for (i = 0; i < *len; i++) - policy_mgr_debug("chan:%d weight:%d", - pcl_channels[i], pcl_weight[i]); + mandatory_modified_pcl = true; } status = policy_mgr_modify_sap_pcl_based_on_nol( @@ -581,10 +582,7 @@ static QDF_STATUS policy_mgr_pcl_modification_for_sap( policy_mgr_err("failed to get nol modified pcl for SAP"); return status; } - policy_mgr_debug("nol modified pcl len:%d", *len); - for (i = 0; i < *len; i++) - policy_mgr_debug("chan:%d weight:%d", - pcl_channels[i], pcl_weight[i]); + nol_modified_pcl = true; status = policy_mgr_modify_sap_pcl_based_on_dfs( psoc, pcl_channels, pcl_weight, len); @@ -592,10 +590,7 @@ static QDF_STATUS policy_mgr_pcl_modification_for_sap( policy_mgr_err("failed to get dfs modified pcl for SAP"); return status; } - policy_mgr_debug("dfs modified pcl len:%d", *len); - for (i = 0; i < *len; i++) - policy_mgr_debug("chan:%d weight:%d", - pcl_channels[i], pcl_weight[i]); + dfs_modified_pcl = true; status = policy_mgr_modify_pcl_based_on_srd (psoc, pcl_channels, pcl_weight, len); @@ -603,10 +598,12 @@ static QDF_STATUS policy_mgr_pcl_modification_for_sap( policy_mgr_err("failed to get srd modified pcl for SAP"); return status; } - policy_mgr_debug("modified final pcl len:%d", *len); - for (i = 0; i < *len; i++) - policy_mgr_debug("chan:%d weight:%d", - pcl_channels[i], pcl_weight[i]); + modified_final_pcl = true; + policy_mgr_debug(" %d %d %d %d", + mandatory_modified_pcl, + nol_modified_pcl, + dfs_modified_pcl, + modified_final_pcl); return QDF_STATUS_SUCCESS; } @@ -618,7 +615,6 @@ static QDF_STATUS policy_mgr_pcl_modification_for_p2p_go( { QDF_STATUS status = QDF_STATUS_E_FAILURE; struct policy_mgr_psoc_priv_obj *pm_ctx; - uint32_t i; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -639,10 +635,7 @@ static QDF_STATUS policy_mgr_pcl_modification_for_p2p_go( policy_mgr_err("failed to get srd modified pcl for P2P-GO"); return status; } - policy_mgr_debug("modified pcl len:%d", *len); - for (i = 0; i < *len; i++) - policy_mgr_debug("ch freq:%d weight:%d", - pcl_channels[i], pcl_weight[i]); + policy_mgr_dump_channel_list(*len, pcl_channels, pcl_weight); return QDF_STATUS_SUCCESS; } @@ -726,7 +719,7 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, uint8_t *pcl_weight, uint32_t weight_len) { QDF_STATUS status = QDF_STATUS_E_FAILURE; - uint32_t num_connections = 0, i; + uint32_t num_connections = 0; enum policy_mgr_conc_priority_mode first_index = 0; enum policy_mgr_one_connection_mode second_index = 0; enum policy_mgr_two_connection_mode third_index = 0; @@ -819,10 +812,6 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, break; } - policy_mgr_debug("index1:%d index2:%d index3:%d pcl:%d dbs:%d", - first_index, second_index, third_index, - pcl, policy_mgr_is_hw_dbs_capable(psoc)); - /* once the PCL enum is obtained find out the exact channel list with * help from sme_get_cfg_valid_channels */ @@ -833,11 +822,7 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, return status; } - policy_mgr_debug("pcl len:%d", *len); - for (i = 0; i < *len; i++) { - policy_mgr_debug("chan:%d weight:%d", - pcl_channels[i], pcl_weight[i]); - } + policy_mgr_dump_channel_list(*len, pcl_channels, pcl_weight); policy_mgr_mode_specific_modification_on_pcl( psoc, pcl_channels, pcl_weight, len, mode); @@ -2418,3 +2403,72 @@ uint32_t policy_mgr_get_alternate_channel_for_sap( return ch_freq; } +/* + * Buffer len size to consider the 4 char freq, 3 char weight, 2 char + * for open close brackets and space and a space, Total 10 + */ +#define CHAN_WEIGHT_CHAR_LEN 10 +#define MAX_CHAN_TO_PRINT 39 + +bool policy_mgr_dump_channel_list(uint32_t len, uint32_t *pcl_channels, + uint8_t *pcl_weight) +{ + uint32_t idx, buff_len, num = 0, count = 0, count_6G = 0; + char *chan_buff = NULL; + + buff_len = (QDF_MIN(len, MAX_CHAN_TO_PRINT) * CHAN_WEIGHT_CHAR_LEN) + 1; + chan_buff = qdf_mem_malloc(buff_len); + if (!chan_buff) + return false; + + policymgr_nofl_debug("Total PCL Chan Freq %d", len); + for (idx = 0; idx < len; idx++) { + if (!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_channels[idx])) { + num += qdf_scnprintf(chan_buff + num, buff_len - num, + " %d[%d]", pcl_channels[idx], + pcl_weight[idx]); + count++; + if (count >= MAX_CHAN_TO_PRINT) { + /* Print the MAX_CHAN_TO_PRINT channels */ + policymgr_nofl_debug("2G+5G Freq[weight]:%s", + chan_buff); + count = 0; + num = 0; + } + } else { + count_6G++; + } + } + /* Print any pending channels */ + if (num) + policymgr_nofl_debug("2G+5G Freq[weight]:%s", chan_buff); + + if (!count_6G) + goto free; + + count = 0; + num = 0; + for (idx = 0; idx < len; idx++) { + if (WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_channels[idx])) { + num += qdf_scnprintf(chan_buff + num, buff_len - num, + " %d[%d]", pcl_channels[idx], + pcl_weight[idx]); + count++; + if (count >= MAX_CHAN_TO_PRINT) { + /* Print the MAX_CHAN_TO_PRINT channels */ + policymgr_nofl_debug("6G Freq[weight]:%s", + chan_buff); + count = 0; + num = 0; + } + } + } + /* Print any pending channels */ + if (num) + policymgr_nofl_debug("6G Freq[weight]:%s", chan_buff); + +free: + qdf_mem_free(chan_buff); + + return true; +} diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 2bd8c95f24c4..313d03978ad9 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -5359,8 +5359,10 @@ wma_is_dbs_mandatory(struct wlan_objmgr_psoc *psoc, uint8_t supported_band = 0; if (!policy_mgr_find_if_fw_supports_dbs(psoc) || - !policy_mgr_find_if_hwlist_has_dbs(psoc)) + !policy_mgr_find_if_hwlist_has_dbs(psoc)) { + wma_debug("DBS is not mandatory"); return false; + } total_mac_phy_cnt = target_psoc_get_total_mac_phy_cnt(tgt_hdl); mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); @@ -9068,15 +9070,16 @@ QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle, msg->chan_weights.saved_chan_list[i])) msg->chan_weights.weighed_valid_list[i] = WEIGHT_OF_DISALLOWED_CHANNELS; - WMA_LOGD("%s: freq:%d weight[%d]=%d", __func__, - msg->chan_weights.saved_chan_list[i], i, - msg->chan_weights.weighed_valid_list[i]); } if (!QDF_IS_STATUS_SUCCESS(status)) { WMA_LOGE("%s: Error in creating weighed pcl", __func__); return status; } + wma_debug("Dump channel list send to wmi"); + policy_mgr_dump_channel_list(msg->chan_weights.saved_num_chan, + msg->chan_weights.saved_chan_list, + msg->chan_weights.weighed_valid_list); if (wmi_unified_pdev_set_pcl_cmd(wma_handle->wmi_handle, &msg->chan_weights))