qcacld-3.0: Add Periodically STA stats API to DP component

Add APIs to print periodic STA Stats in DP component.

Change-Id: I716b3e0be34fb7472d62adbf74565bd5d51a39c2
CRs-Fixed: 3166166
This commit is contained in:
Amit Mehta
2022-04-04 22:09:28 +05:30
committed by Madan Koyyalamudi
parent c76ff11020
commit ad3a5fbc02
5 changed files with 150 additions and 12 deletions

View File

@@ -38,7 +38,7 @@ void dp_periodic_sta_stats_config(struct wlan_dp_psoc_cfg *config,
/** /**
* dp_periodic_sta_stats_init() - Initialize periodic stats display flag * dp_periodic_sta_stats_init() - Initialize periodic stats display flag
* @adapter: Pointer to the station adapter * @dp_intf: Pointer to the station interface
* *
* Return: none * Return: none
*/ */
@@ -54,23 +54,23 @@ void dp_periodic_sta_stats_display(struct wlan_dp_psoc_context *dp_ctx);
/** /**
* dp_periodic_sta_stats_start() - Start displaying periodic stats for STA * dp_periodic_sta_stats_start() - Start displaying periodic stats for STA
* @adapter: Pointer to the station adapter * @vdev: vdev handle
* *
* Return: none * Return: none
*/ */
void dp_periodic_sta_stats_start(struct wlan_dp_intf *dp_intf); void dp_periodic_sta_stats_start(struct wlan_objmgr_vdev *vdev);
/** /**
* dp_periodic_sta_stats_stop() - Stop displaying periodic stats for STA * dp_periodic_sta_stats_stop() - Stop displaying periodic stats for STA
* @adapter: Pointer to the station adapter * @vdev: vdev handle
* *
* Return: none * Return: none
*/ */
void dp_periodic_sta_stats_stop(struct wlan_dp_intf *dp_intf); void dp_periodic_sta_stats_stop(struct wlan_objmgr_vdev *vdev);
/** /**
* dp_periodic_sta_stats_mutex_create() - Create mutex for STA periodic stats * dp_periodic_sta_stats_mutex_create() - Create mutex for STA periodic stats
* @adapter: Pointer to the station adapter * @dp_intf: Pointer to the station interface
* *
* Return: none * Return: none
*/ */
@@ -78,7 +78,7 @@ void dp_periodic_sta_stats_mutex_create(struct wlan_dp_intf *dp_intf);
/** /**
* dp_periodic_sta_stats_mutex_destroy() - Destroy STA periodic stats mutex * dp_periodic_sta_stats_mutex_destroy() - Destroy STA periodic stats mutex
* @adapter: Pointer to the station adapter * @dp_intf: Pointer to the station interface
* *
* Return: none * Return: none
*/ */
@@ -96,11 +96,11 @@ dp_periodic_sta_stats_config(struct wlan_dp_psoc_cfg *config,
{ {
} }
static inline void dp_periodic_sta_stats_start(struct wlan_dp_intf *dp_intf) static inline void dp_periodic_sta_stats_start(struct wlan_objmgr_vdev *vdev)
{ {
} }
static inline void dp_periodic_sta_stats_stop(struct wlan_dp_intf *dp_intf) static inline void dp_periodic_sta_stats_stop(struct wlan_objmgr_vdev *vdev)
{ {
} }

View File

@@ -86,6 +86,12 @@ struct wlan_dp_psoc_cfg {
uint32_t rx_reap_loop_pkt_limit; uint32_t rx_reap_loop_pkt_limit;
uint32_t rx_hp_oos_update_limit; uint32_t rx_hp_oos_update_limit;
uint64_t rx_softirq_max_yield_duration_ns; uint64_t rx_softirq_max_yield_duration_ns;
#ifdef WLAN_FEATURE_PERIODIC_STA_STATS
/* Periodicity of logging */
uint32_t periodic_stats_timer_interval;
/* Duration for which periodic logging should be done */
uint32_t periodic_stats_timer_duration;
#endif /* WLAN_FEATURE_PERIODIC_STA_STATS */
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
/* bandwidth threshold for ultra high bandwidth */ /* bandwidth threshold for ultra high bandwidth */
uint32_t bus_bw_ultra_high_threshold; uint32_t bus_bw_ultra_high_threshold;
@@ -266,6 +272,13 @@ struct wlan_dp_intf {
qdf_netdev_t dev; qdf_netdev_t dev;
/**Device TX/RX statistics*/ /**Device TX/RX statistics*/
struct dp_stats dp_stats; struct dp_stats dp_stats;
#ifdef WLAN_FEATURE_PERIODIC_STA_STATS
/* Indicate whether to display sta periodic stats */
bool is_sta_periodic_stats_enabled;
uint16_t periodic_stats_timer_count;
uint32_t periodic_stats_timer_counter;
qdf_mutex_t sta_periodic_stats_lock;
#endif /* WLAN_FEATURE_PERIODIC_STA_STATS */
#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
unsigned long prev_rx_packets; unsigned long prev_rx_packets;
unsigned long prev_tx_packets; unsigned long prev_tx_packets;

View File

@@ -18,11 +18,59 @@
* DOC: WLAN Host Device Driver periodic STA statistics related implementation * DOC: WLAN Host Device Driver periodic STA statistics related implementation
*/ */
#include "cfg_ucfg_api.h"
#include "wlan_dp_periodic_sta_stats.h" #include "wlan_dp_periodic_sta_stats.h"
void dp_periodic_sta_stats_display(struct wlan_dp_psoc_context *dp_ctx) void dp_periodic_sta_stats_display(struct wlan_dp_psoc_context *dp_ctx)
{ {
struct wlan_dp_intf *dp_intf, next_dp_intf = NULL;
struct dp_stats sta_stats;
struct wlan_dp_psoc_cfg *dp_cfg;
char *dev_name;
bool should_log;
if (!dp_ctx)
return;
dp_for_each_intf_held_safe(dp_ctx, dp_intf, next_dp_intf) {
should_log = false;
if (dp_intf->device_mode != QDF_STA_MODE)
continue;
dp_cfg = dp_ctx->dp_cfg;
qdf_mutex_acquire(&dp_intf->sta_periodic_stats_lock);
if (!dp_intf->is_sta_periodic_stats_enabled) {
qdf_mutex_release(&dp_intf->sta_periodic_stats_lock);
continue;
}
dp_intf->periodic_stats_timer_counter++;
if ((dp_intf->periodic_stats_timer_counter *
dp_cfg->bus_bw_compute_interval) >=
dp_cfg->periodic_stats_timer_interval) {
should_log = true;
dp_intf->periodic_stats_timer_count--;
if (dp_intf->periodic_stats_timer_count == 0)
dp_intf->is_sta_periodic_stats_enabled = false;
dp_intf->periodic_stats_timer_counter = 0;
}
qdf_mutex_release(&dp_intf->sta_periodic_stats_lock);
if (should_log) {
dev_name = qdf_netdev_get_devname(dp_intf->dev);
sta_stats = dp_intf->dp_stats;
dp_nofl_info("%s: Tx ARP requests: %d", dev_name,
sta_stats.dp_arp_stats.tx_arp_req_count);
dp_nofl_info("%s: Rx ARP responses: %d", dev_name,
sta_stats.dp_arp_stats.rx_arp_rsp_count);
dp_nofl_info("%s: Tx DNS requests: %d", dev_name,
sta_stats.dp_dns_stats.tx_dns_req_count);
dp_nofl_info("%s: Rx DNS responses: %d", dev_name,
sta_stats.dp_dns_stats.rx_dns_rsp_count);
}
}
} }
void dp_periodic_sta_stats_config(struct dp_config *config, void dp_periodic_sta_stats_config(struct dp_config *config,
@@ -30,22 +78,68 @@ void dp_periodic_sta_stats_config(struct dp_config *config,
{ {
} }
void dp_periodic_sta_stats_start(struct wlan_dp_intf *dp_intf) void dp_periodic_sta_stats_start(struct wlan_objmgr_vdev *vdev)
{ {
struct wlan_dp_intf *dp_intf = dp_get_vdev_priv_obj(vdev);
struct dp_config *dp_cfg;
if (!dp_intf) {
dp_nofl_err("Unable to get DP interface");
return;
}
dp_cfg = dp_intf->dp_ctx->dp_cfg;
if ((dp_intf->device_mode == QDF_STA_MODE) &&
(dp_cfg->periodic_stats_timer_interval > 0)) {
qdf_mutex_acquire(&dp_intf->sta_periodic_stats_lock);
/* Stop the periodic ARP and DNS stats timer */
dp_intf->periodic_stats_timer_count = 0;
dp_intf->is_sta_periodic_stats_enabled = false;
qdf_mutex_release(&dp_intf->sta_periodic_stats_lock);
}
} }
void dp_periodic_sta_stats_stop(struct wlan_dp_intf *dp_intf) void dp_periodic_sta_stats_stop(struct wlan_objmgr_vdev *vdev)
{ {
struct wlan_dp_intf *dp_intf = dp_get_vdev_priv_obj(vdev);
struct dp_config *dp_cfg;
if (!dp_intf) {
dp_nofl_err("Unable to get DP interface");
return;
}
dp_cfg = dp_intf->dp_ctx->dp_cfg;
if ((dp_intf->device_mode == QDF_STA_MODE) &&
(dp_cfg->periodic_stats_timer_interval > 0)) {
qdf_mutex_acquire(&dp_intf->sta_periodic_stats_lock);
dp_intf->periodic_stats_timer_count =
dp_cfg->periodic_stats_timer_duration /
dp_cfg->periodic_stats_timer_interval;
dp_intf->periodic_stats_timer_counter = 0;
if (dp_intf->periodic_stats_timer_count > 0)
dp_intf->is_sta_periodic_stats_enabled = true;
qdf_mutex_release(&dp_intf->sta_periodic_stats_lock);
}
} }
void dp_periodic_sta_stats_init(struct wlan_dp_intf *dp_intf) void dp_periodic_sta_stats_init(struct wlan_dp_intf *dp_intf)
{ {
dp_intf->is_sta_periodic_stats_enabled = false;
} }
void dp_periodic_sta_stats_mutex_create(struct wlan_dp_intf *dp_intf) void dp_periodic_sta_stats_mutex_create(struct wlan_dp_intf *dp_intf)
{ {
qdf_mutex_create(&dp_intf->sta_periodic_stats_lock);
} }
void dp_periodic_sta_stats_mutex_destroy(struct wlan_dp_intf *dp_intf) void dp_periodic_sta_stats_mutex_destroy(struct wlan_dp_intf *dp_intf)
{ {
qdf_mutex_destroy(&dp_intf->sta_periodic_stats_lock);
} }

View File

@@ -159,6 +159,22 @@ void ucfg_dp_bbm_context_deinit(struct wlan_objmgr_psoc *psoc);
void ucfg_dp_bbm_apply_independent_policy(struct wlan_objmgr_psoc *psoc, void ucfg_dp_bbm_apply_independent_policy(struct wlan_objmgr_psoc *psoc,
struct bbm_params *params); struct bbm_params *params);
/**
* ucfg_dp_periodic_sta_stats_start() - Start displaying periodic stats for STA
* @adapter: Pointer to the station adapter
*
* Return: none
*/
void ucfg_dp_periodic_sta_stats_start(struct wlan_objmgr_vdev *vdev);
/**
* ucfg_dp_periodic_sta_stats_stop() - Stop displaying periodic stats for STA
* @adapter: Pointer to the station adapter
*
* Return: none
*/
void ucfg_dp_periodic_sta_stats_stop(struct wlan_objmgr_vdev *vdev);
/** /**
* ucfg_dp_set_rx_mode_rps() - Enable/disable RPS in SAP mode * ucfg_dp_set_rx_mode_rps() - Enable/disable RPS in SAP mode
* @enable: Set true to enable RPS in SAP mode * @enable: Set true to enable RPS in SAP mode

View File

@@ -29,6 +29,7 @@
#include "wlan_pmo_obj_mgmt_api.h" #include "wlan_pmo_obj_mgmt_api.h"
#include "wlan_dp_objmgr.h" #include "wlan_dp_objmgr.h"
#include "wlan_dp_bus_bandwidth.h" #include "wlan_dp_bus_bandwidth.h"
#include "wlan_dp_periodic_sta_stats.h"
void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc, void ucfg_dp_update_inf_mac(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *cur_mac, struct qdf_mac_addr *cur_mac,
@@ -79,6 +80,9 @@ ucfg_dp_create_intf(struct wlan_objmgr_psoc *psoc,
qdf_list_insert_front(&dp_ctx->intf_list, &dp_intf->node); qdf_list_insert_front(&dp_ctx->intf_list, &dp_intf->node);
qdf_spin_unlock_bh(&dp_ctx->intf_list_lock); qdf_spin_unlock_bh(&dp_ctx->intf_list_lock);
dp_periodic_sta_stats_init(dp_intf);
dp_periodic_sta_stats_mutex_create(dp_intf);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
@@ -101,6 +105,7 @@ ucfg_dp_destroy_intf(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
dp_periodic_sta_stats_mutex_destroy(dp_intf);
qdf_spin_lock_bh(&dp_ctx->intf_list_lock); qdf_spin_lock_bh(&dp_ctx->intf_list_lock);
qdf_list_remove_node(&dp_ctx->intf_list, &dp_intf->node); qdf_list_remove_node(&dp_ctx->intf_list, &dp_intf->node);
qdf_spin_unlock_bh(&dp_ctx->intf_list_lock); qdf_spin_unlock_bh(&dp_ctx->intf_list_lock);
@@ -492,6 +497,16 @@ void ucfg_dp_set_rx_mode_rps(bool enable)
dp_set_rx_mode_rps(enable); dp_set_rx_mode_rps(enable);
} }
void ucfg_dp_periodic_sta_stats_start(struct wlan_objmgr_vdev *vdev)
{
dp_periodic_sta_stats_start(vdev);
}
void ucfg_dp_periodic_sta_stats_stop(struct wlan_objmgr_vdev *vdev)
{
dp_periodic_sta_stats_stop(vdev);
}
void ucfg_dp_try_send_rps_ind(struct wlan_objmgr_vdev *vdev) void ucfg_dp_try_send_rps_ind(struct wlan_objmgr_vdev *vdev)
{ {
dp_try_send_rps_ind(vdev); dp_try_send_rps_ind(vdev);