Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: wifi: Optimize the memory consumed by logs #12122

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions drivers/wifi/nrf700x/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ config NRF700X_REG_DOMAIN
config NET_MGMT_EVENT_STACK_SIZE
default 2048 if !WPA_SUPP

config NRF700X_LOG_VERBOSE
bool "Maintains the verbosity of information in logs"

module = WIFI_NRF700X
module-dep = LOG
module-str = Log level for Wi-Fi nRF700x driver
module-help = Sets log level for Wi-Fi nRF700x driver
source "subsys/logging/Kconfig.template.log_config"

config NRF700X_LOG_LEVEL
int "Sets the log level of Wi-Fi driver"
default 0 if WIFI_NRF700X_LOG_LEVEL_DBG # MSG_EXCESSIVE
default 3 if WIFI_NRF700X_LOG_LEVEL_INF # MSG_INFO
default 5 if WIFI_NRF700X_LOG_LEVEL_ERR # MSG_ERROR
default 6

config NRF700X_ON_QSPI
def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF700X_QSPI))
select NRFX_QSPI
Expand Down
15 changes: 15 additions & 0 deletions drivers/wifi/nrf700x/osal/os_if/inc/osal_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include <stdarg.h>
#include "osal_structs.h"

#ifndef CONFIG_NRF700X_LOG_VERBOSE
#define __func__ ""
#endif /* CONFIG_NRF700X_LOG_VERBOSE */
/**
* wifi_nrf_osal_init() - Initialize the OSAL layer.
*
Expand Down Expand Up @@ -314,6 +317,9 @@ void wifi_nrf_osal_spinlock_irq_rel(struct wifi_nrf_osal_priv *opriv,
unsigned long *flags);


#if CONFIG_NRF700X_LOG_LEVEL > 0
#define wifi_nrf_osal_log_dbg(level, fmt, ...)
#else
/**
* wifi_nrf_osal_log_dbg() - Log a debug message.
* @opriv: Pointer to the OSAL context returned by the @wifi_nrf_osal_init API.
Expand All @@ -326,8 +332,12 @@ void wifi_nrf_osal_spinlock_irq_rel(struct wifi_nrf_osal_priv *opriv,
*/
int wifi_nrf_osal_log_dbg(struct wifi_nrf_osal_priv *opriv,
const char *fmt, ...);
#endif


#if CONFIG_NRF700X_LOG_LEVEL > 3
#define wifi_nrf_osal_log_info(level, fmt, ...)
#else
/**
* wifi_nrf_osal_log_info() - Log a informational message.
* @opriv: Pointer to the OSAL context returned by the @wifi_nrf_osal_init API.
Expand All @@ -340,8 +350,12 @@ int wifi_nrf_osal_log_dbg(struct wifi_nrf_osal_priv *opriv,
*/
int wifi_nrf_osal_log_info(struct wifi_nrf_osal_priv *opriv,
const char *fmt, ...);
#endif


#if CONFIG_NRF700X_LOG_LEVEL > 5
#define wifi_nrf_osal_log_err(level, fmt, ...)
#else /* > 5 */
/**
* wifi_nrf_osal_log_err() - Logs an error message.
* @opriv: Pointer to the OSAL context returned by the @wifi_nrf_osal_init API.
Expand All @@ -354,6 +368,7 @@ int wifi_nrf_osal_log_info(struct wifi_nrf_osal_priv *opriv,
*/
int wifi_nrf_osal_log_err(struct wifi_nrf_osal_priv *opriv,
const char *fmt, ...);
#endif


/**
Expand Down
6 changes: 6 additions & 0 deletions drivers/wifi/nrf700x/osal/os_if/src/osal.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ void wifi_nrf_osal_spinlock_irq_rel(struct wifi_nrf_osal_priv *opriv,
}


#if CONFIG_NRF700X_LOG_LEVEL < 1
int wifi_nrf_osal_log_dbg(struct wifi_nrf_osal_priv *opriv,
const char *fmt,
...)
Expand All @@ -204,8 +205,10 @@ int wifi_nrf_osal_log_dbg(struct wifi_nrf_osal_priv *opriv,

return ret;
}
#endif /* CONFIG_NRF700X_LOG_LEVEL < 1 */


#if CONFIG_NRF700X_LOG_LEVEL <= 3
int wifi_nrf_osal_log_info(struct wifi_nrf_osal_priv *opriv,
const char *fmt,
...)
Expand All @@ -221,8 +224,10 @@ int wifi_nrf_osal_log_info(struct wifi_nrf_osal_priv *opriv,

return ret;
}
#endif /* CONFIG_NRF700X_LOG_LEVEL <=3 */


#if CONFIG_NRF700X_LOG_LEVEL <= 5
int wifi_nrf_osal_log_err(struct wifi_nrf_osal_priv *opriv,
const char *fmt,
...)
Expand All @@ -238,6 +243,7 @@ int wifi_nrf_osal_log_err(struct wifi_nrf_osal_priv *opriv,

return ret;
}
#endif /* CONFIG_NRF700X_LOG_LEVEL <=5 */


void *wifi_nrf_osal_llist_node_alloc(struct wifi_nrf_osal_priv *opriv)
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ manifest:
- name: hostap
repo-path: sdk-hostap
path: modules/lib/hostap
revision: 44c4504d1549ab0f6dda503050ad5ca2654d0f91
revision: 8b0abe8f10ef14b25a97972da46aee8ee5aef63a
userdata:
ncs:
upstream-url: https://w1.fi/cgit/hostap/
Expand Down
Loading