From c13cfaf10fc0b606eb8acf580c903db76774a500 Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Fri, 4 Aug 2017 11:35:03 -0700 Subject: [PATCH] qcacld-3.0: Introduce rate limiting in PE debug Introduce debugging rate limiting functionality in PE by using QDF abstraction and use it for the logs which are not needed to be printed very often Change-Id: I9ff5924786519da52917a6c0f14d9c8beabcca53 CRs-Fixed: 2087172 --- core/mac/src/include/sir_debug.h | 23 +++++++++++++++++++ core/mac/src/pe/lim/lim_utils.c | 2 +- .../src/sys/legacy/src/utils/src/parser_api.c | 18 ++++++++++----- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/core/mac/src/include/sir_debug.h b/core/mac/src/include/sir_debug.h index 741ef00f3e5c..af25ce0f3b84 100644 --- a/core/mac/src/include/sir_debug.h +++ b/core/mac/src/include/sir_debug.h @@ -46,6 +46,29 @@ #define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] #define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x" +#define pe_log_rate_limited(rate, level, args...) \ + QDF_TRACE_RATE_LIMITED(rate, QDF_MODULE_ID_PE, level, ## args) +#define pe_log_rate_limited_fl(rate, level, format, args...) \ + pe_log_rate_limited(rate, level, FL(format), ## args) +#define pe_alert_rate_limited(rate, format, args...) \ + pe_log_rate_limited_fl(rate, QDF_TRACE_LEVEL_FATAL,\ + format, ## args) +#define pe_err_rate_limited(rate, format, args...) \ + pe_log_rate_limited_fl(rate, QDF_TRACE_LEVEL_ERROR,\ + format, ## args) +#define pe_warn_rate_limited(rate, format, args...) \ + pe_log_rate_limited_fl(rate, QDF_TRACE_LEVEL_WARN,\ + format, ## args) +#define pe_notice_rate_limited(rate, format, args...) \ + pe_log_rate_limited_fl(rate, QDF_TRACE_LEVEL_INFO,\ + format, ## args) +#define pe_info_rate_limited(rate, format, args...) \ + pe_log_rate_limited_fl(rate, QDF_TRACE_LEVEL_INFO,\ + format, ## args) +#define pe_debug_rate_limited(rate, format, args...) \ + pe_log_rate_limited_fl(rate, QDF_TRACE_LEVEL_DEBUG,\ + format, ## args) + #define pe_log(level, args...) QDF_TRACE(QDF_MODULE_ID_PE, level, ## args) #define pe_logfl(level, format, args...) pe_log(level, FL(format), ## args) diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 79087d7b1c55..a3363eda6178 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -6697,7 +6697,7 @@ void lim_update_extcap_struct(tpAniSirGlobal mac_ctx, } if (DOT11F_EID_EXTCAP != buf[0] || buf[1] > DOT11F_IE_EXTCAP_MAX_LEN) { - pe_warn("Invalid IEs eid: %d elem_len: %d", + pe_debug_rate_limited(30, "Invalid IEs eid: %d elem_len: %d", buf[0], buf[1]); return; } diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index b376bbe51517..1ec243773511 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -2146,7 +2146,8 @@ sir_convert_probe_req_frame2_struct(tpAniSirGlobal pMac, } if (!pr.SuppRates.present) { - pe_warn("Mandatory IE Supported Rates not present!"); + pe_debug_rate_limited(30, + "Mandatory IE Supported Rates not present!"); return eSIR_FAILURE; } else { pProbeReq->suppRatesPresent = 1; @@ -2400,7 +2401,8 @@ tSirRetStatus sir_convert_probe_frame2_struct(tpAniSirGlobal pMac, } if (!pr->SuppRates.present) { - pe_warn("Mandatory IE Supported Rates not present!"); + pe_debug_rate_limited(30, + "Mandatory IE Supported Rates not present!"); } else { pProbeResp->suppRatesPresent = 1; convert_supp_rates(pMac, &pProbeResp->supportedRates, @@ -2981,7 +2983,8 @@ sir_convert_assoc_resp_frame2_struct(tpAniSirGlobal pMac, if (!ar->SuppRates.present) { pAssocRsp->suppRatesPresent = 0; - pe_warn("Mandatory IE Supported Rates not present!"); + pe_debug_rate_limited(30, + "Mandatory IE Supported Rates not present!"); } else { pAssocRsp->suppRatesPresent = 1; convert_supp_rates(pMac, &pAssocRsp->supportedRates, @@ -3372,7 +3375,8 @@ sir_beacon_ie_ese_bcn_report(tpAniSirGlobal pMac, } if (!pBies->SuppRates.present) { - pe_warn("Mandatory IE Supported Rates not present!"); + pe_debug_rate_limited(30, + "Mandatory IE Supported Rates not present!"); } else { eseBcnReportMandatoryIe.suppRatesPresent = 1; convert_supp_rates(pMac, &eseBcnReportMandatoryIe.supportedRates, @@ -3650,7 +3654,8 @@ sir_parse_beacon_ie(tpAniSirGlobal pMac, } if (!pBies->SuppRates.present) { - pe_warn("Mandatory IE Supported Rates not present!"); + pe_debug_rate_limited(30, + "Mandatory IE Supported Rates not present!"); } else { pBeaconStruct->suppRatesPresent = 1; convert_supp_rates(pMac, &pBeaconStruct->supportedRates, @@ -3987,7 +3992,8 @@ sir_convert_beacon_frame2_struct(tpAniSirGlobal pMac, } if (!pBeacon->SuppRates.present) { - pe_warn("Mandatory IE Supported Rates not present!"); + pe_debug_rate_limited(30, + "Mandatory IE Supported Rates not present!"); } else { pBeaconStruct->suppRatesPresent = 1; convert_supp_rates(pMac, &pBeaconStruct->supportedRates,