qcacmn: Add support for rate limiting QDF trace prints

The existing QDF implementation does the following
1. The QDF trace either prints to the console
2. The QDF trace message  is directed to the utils,
   which based on log level
	a. redirects to a user space daemon or
	b. redirects to console

There is excessive logging detection in the utils code
before redirecting the prints to  the console.
If the number of prints to console is more than
the configured threshold, we assert in development builds.

Moving the API for excessive logging detection from utils to
QDF trace.

The configuration for detection of excessive logging currently
is only for the number of prints per second.
Adding time configuration also to detection of excess logging
to the console.

CRs-Fixed: 2809752
Change-Id: Iecc408fc9b576fa900a6d7ee793639f1dde3110d
This commit is contained in:
Vivek
2020-11-29 15:21:30 +05:30
zatwierdzone przez snandini
rodzic e04aeaeed8
commit 3327a6a92b
3 zmienionych plików z 121 dodań i 34 usunięć

Wyświetl plik

@@ -596,6 +596,43 @@ QDF_STATUS qdf_trace_spin_lock_init(void)
#endif
#endif
#ifdef WLAN_MAX_LOGS_PER_SEC
/**
* qdf_detected_excessive_logging() - Excessive logging detected
*
* Track logging count using a quasi-tumbling window.
* If the max logging count for a given window is exceeded,
* return true else fails.
*
* Return: true/false
*/
bool qdf_detected_excessive_logging(void);
/**
* qdf_rl_print_count_set() - set the ratelimiting print count
* @rl_print_time: ratelimiting print count
*
* Return: none
*/
void qdf_rl_print_count_set(uint32_t rl_print_count);
/**
* qdf_rl_print_time_set() - set the ratelimiting print time
* @rl_print_time: ratelimiting print time
*
* Return: none
*/
void qdf_rl_print_time_set(uint32_t rl_print_time);
#else /* WLAN_MAX_LOGS_PER_SEC */
static inline bool qdf_detected_excessive_logging(void)
{
return false;
}
static inline void qdf_rl_print_count_set(uint32_t rl_print_count) {}
static inline void qdf_rl_print_time_set(uint32_t rl_print_time) {}
#endif /* WLAN_MAX_LOGS_PER_SEC */
#ifdef ENABLE_MTRACE_LOG
/**
* qdf_mtrace_log() - Logs a message tracepoint to DIAG