qcacld-3.0: Add a feature flag WLAN_POWER_DEBUG for power stats

Power stats is moved from debugfs to sysfs, and hence add the feature
flag WLAN_POWER_DEBUG such that this feature can be compiled out for
low memory foot print drivers.

Change-Id: Ic395f393580fcd59faa4e4676f67a39ff37bdd1a
CRs-Fixed: 2665089
This commit is contained in:
Aditya Kodukula 2020-04-15 13:30:14 -07:00 committed by nshrivas
parent 25a932a57b
commit f1c3387ee4
10 changed files with 61 additions and 15 deletions

2
Kbuild
View File

@ -2529,7 +2529,7 @@ cppflags-$(CONFIG_QCACLD_WLAN_LFR2) += -DWLAN_FEATURE_HOST_ROAM
cppflags-$(CONFIG_FEATURE_ROAM_DEBUG) += -DFEATURE_ROAM_DEBUG
cppflags-$(CONFIG_WLAN_POWER_DEBUGFS) += -DWLAN_POWER_DEBUGFS
cppflags-$(CONFIG_WLAN_POWER_DEBUG) += -DWLAN_POWER_DEBUG
cppflags-$(CONFIG_WLAN_MWS_INFO_DEBUGFS) += -DWLAN_MWS_INFO_DEBUGFS

View File

@ -172,6 +172,7 @@ ifneq ($(CONFIG_MOBILE_ROUTER), y)
CONFIG_QCOM_TDLS := y
CONFIG_WLAN_SYSFS := y
CONFIG_WLAN_POWER_DEBUG := y
#Enable Beacon Reception Stats
CONFIG_FEATURE_BECN_STATS := y
endif
@ -501,8 +502,6 @@ ifeq ($(CONFIG_DEBUG_FS), y)
# configuration.
CONFIG_WLAN_DEBUGFS := y
CONFIG_WLAN_POWER_DEBUGFS := y
# Flag to enable streamfs. Depends on CONFIG_DEBUG_FS and
# CONFIG_RELAY in kernel configuration.
ifeq ($(CONFIG_RELAY), y)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018, 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
@ -48,6 +48,7 @@ void hdd_sysfs_create_version_interface(struct wlan_objmgr_psoc *psoc);
* Return: none
*/
void hdd_sysfs_destroy_version_interface(void);
#ifdef WLAN_POWER_DEBUG
/**
* hdd_sysfs_create_powerstats_interface() - create power_stats interface
*
@ -62,6 +63,17 @@ void hdd_sysfs_create_powerstats_interface(void);
void hdd_sysfs_destroy_powerstats_interface(void);
#else
static inline
void hdd_sysfs_create_powerstats_interface(void)
{
}
static inline
void hdd_sysfs_destroy_powerstats_interface(void)
{
}
#endif /*End of WLAN_POWER_DEBUG */
#else
static inline
void hdd_sysfs_create_driver_root_obj(void)
{
}
@ -71,16 +83,6 @@ void hdd_sysfs_destroy_driver_root_obj(void)
{
}
static inline
void hdd_sysfs_create_version_interface(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void hdd_sysfs_destroy_version_interface(void)
{
}
static inline
void hdd_sysfs_create_powerstats_interface(void)
{
@ -90,6 +92,16 @@ static inline
void hdd_sysfs_destroy_powerstats_interface(void)
{
}
static inline
void hdd_sysfs_create_version_interface(struct wlan_objmgr_psoc *psoc)
{
}
static inline
void hdd_sysfs_destroy_version_interface(void)
{
}
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-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
@ -33,7 +33,9 @@
#include "cds_api.h"
#include <wlan_osif_request_manager.h>
#include <qdf_mem.h>
#ifdef WLAN_POWER_DEBUG
#include <sir_api.h>
#endif
#include "osif_sync.h"
#define MAX_PSOC_ID_SIZE 10
@ -123,6 +125,7 @@ static ssize_t show_fw_version(struct kobject *kobj,
return length;
};
#ifdef WLAN_POWER_DEBUG
struct power_stats_priv {
struct power_stats_response power_stats;
};
@ -273,6 +276,7 @@ static ssize_t show_device_power_stats(struct kobject *kobj,
return length;
}
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
struct beacon_reception_stats_priv {
@ -431,8 +435,10 @@ static struct kobj_attribute dr_ver_attribute =
__ATTR(driver_version, 0440, show_driver_version, NULL);
static struct kobj_attribute fw_ver_attribute =
__ATTR(version, 0440, show_fw_version, NULL);
#ifdef WLAN_POWER_DEBUG
static struct kobj_attribute power_stats_attribute =
__ATTR(power_stats, 0444, show_device_power_stats, NULL);
#endif
void hdd_sysfs_create_version_interface(struct wlan_objmgr_psoc *psoc)
{
@ -493,6 +499,7 @@ void hdd_sysfs_destroy_version_interface(void)
}
}
#ifdef WLAN_POWER_DEBUG
void hdd_sysfs_create_powerstats_interface(void)
{
int error;
@ -544,6 +551,7 @@ void hdd_sysfs_destroy_driver_root_obj(void)
driver_kobject = NULL;
}
}
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
static int hdd_sysfs_create_bcn_reception_interface(struct hdd_adapter

View File

@ -3335,6 +3335,7 @@ struct auto_shutdown_cmd {
};
#endif
#ifdef WLAN_POWER_DEBUG
/**
* struct power_stats_response - Power stats response
* @cumulative_sleep_time_ms: cumulative sleep time in ms
@ -3354,6 +3355,7 @@ struct power_stats_response {
uint32_t num_debug_register;
uint32_t *debug_registers;
};
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
#define MAX_BCNMISS_BITMAP 8

View File

@ -2296,11 +2296,13 @@ QDF_STATUS sme_set_lost_link_info_cb(mac_handle_t mac_handle,
*/
QDF_STATUS sme_update_new_channel_event(mac_handle_t mac_handle,
uint8_t session_id);
#ifdef WLAN_POWER_DEBUG
QDF_STATUS sme_power_debug_stats_req(
mac_handle_t mac_handle,
void (*callback_fn)(struct power_stats_response *response,
void *context),
void *power_stats_context);
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
/**

View File

@ -299,9 +299,11 @@ struct sme_context {
link_layer_stats_cb link_layer_stats_cb;
void (*link_layer_stats_ext_cb)(hdd_handle_t callback_ctx,
tSirLLStatsResults *rsp);
#ifdef WLAN_POWER_DEBUG
void *power_debug_stats_context;
void (*power_stats_resp_callback)(struct power_stats_response *rsp,
void *callback_context);
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
void *beacon_stats_context;
void (*beacon_stats_resp_callback)(struct bcn_reception_stats_rsp *rsp,

View File

@ -10802,6 +10802,7 @@ QDF_STATUS sme_ll_stats_set_thresh(mac_handle_t mac_handle,
#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
#ifdef WLAN_POWER_DEBUG
/**
* sme_power_debug_stats_req() - SME API to collect Power debug stats
* @callback_fn: Pointer to the callback function for Power stats event
@ -10840,6 +10841,7 @@ QDF_STATUS sme_power_debug_stats_req(
}
return status;
}
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
QDF_STATUS sme_beacon_debug_stats_req(

View File

@ -4828,6 +4828,7 @@ int wma_get_arp_stats_handler(void *handle, uint8_t *data,
*
* Return: 0 on success, error number otherwise
*/
#ifdef WLAN_POWER_DEBUG
int wma_unified_power_debug_stats_event_handler(void *handle,
uint8_t *cmd_param_info, uint32_t len)
{
@ -4901,6 +4902,15 @@ int wma_unified_power_debug_stats_event_handler(void *handle,
qdf_mem_free(power_stats_results);
return 0;
}
#else
int wma_unified_power_debug_stats_event_handler(void *handle,
uint8_t *cmd_param_info,
uint32_t len)
{
return 0;
}
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
int wma_unified_beacon_debug_stats_event_handler(void *handle,
uint8_t *cmd_param_info,

View File

@ -3174,11 +3174,13 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
wma_peer_info_event_handler,
WMA_RX_SERIALIZER_CTX);
#ifdef WLAN_POWER_DEBUG
/* register for Chip Power stats event */
wmi_unified_register_event_handler(wma_handle->wmi_handle,
wmi_pdev_chip_power_stats_event_id,
wma_unified_power_debug_stats_event_handler,
WMA_RX_SERIALIZER_CTX);
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
/* register for beacon stats event */
wmi_unified_register_event_handler(wma_handle->wmi_handle,
@ -7529,6 +7531,7 @@ static inline QDF_STATUS wma_send_wow_pulse_cmd(tp_wma_handle wma_handle,
*
* Return: QDF_STATUS
*/
#ifdef WLAN_POWER_DEBUG
static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle)
{
wmi_pdev_get_chip_power_stats_cmd_fixed_param *cmd;
@ -7566,6 +7569,12 @@ static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle)
}
return QDF_STATUS_SUCCESS;
}
#else
static QDF_STATUS wma_process_power_debug_stats_req(tp_wma_handle wma_handle)
{
return QDF_STATUS_SUCCESS;
}
#endif
#ifdef WLAN_FEATURE_BEACON_RECEPTION_STATS
static QDF_STATUS wma_process_beacon_debug_stats_req(tp_wma_handle wma_handle,
uint32_t *vdev_id)