qcacld-3.0: Add support for big data stats

Add support of big data stats in the cpstats
component.

Change-Id: I3642035d9f25237c80b529da78c51bb1ccf0035a
CRs-Fixed: 2868949
This commit is contained in:
sheenam monga 2021-03-08 11:46:47 +05:30 committed by snandini
parent cdfaa7501a
commit 044bbd5a53
6 changed files with 321 additions and 2 deletions

View File

@ -61,6 +61,7 @@
* @TYPE_MIB_STATS: MIB stats was requested
* @TYPE_PEER_STATS_INFO_EXT: peer stats info ext was requested
* @TYPE_CONGESTION_STATS: congestion stats was requested
* @TYPE_BIG_DATA_STATS: big data stats was requested
*/
enum stats_req_type {
TYPE_CONNECTION_TX_POWER = 0,
@ -69,6 +70,7 @@ enum stats_req_type {
TYPE_MIB_STATS,
TYPE_PEER_STATS_INFO_EXT,
TYPE_CONGESTION_STATS,
TYPE_BIG_DATA_STATS,
TYPE_MAX,
};
@ -178,6 +180,28 @@ struct wake_lock_stats {
struct stats_event;
/**
* struct big_data_stats_event - big data stats event param
* @vdev_id: vdev id
* @tsf_out_of_sync: tsf out of sync
* @ani_level: ani level
* @last_data_tx_pwr: tx pwr last data frm
* @target_power_dsss: tx power dsss
* @target_power_ofdm: target power ofdm
* @last_tx_data_rix: rx lateset data frame
* @last_tx_data_rate_kbps: tx latest data frame
*/
struct big_data_stats_event {
uint32_t vdev_id;
uint32_t tsf_out_of_sync;
int32_t ani_level;
uint32_t last_data_tx_pwr;
uint32_t target_power_dsss;
uint32_t target_power_ofdm;
uint32_t last_tx_data_rix;
uint32_t last_tx_data_rate_kbps;
};
/**
* struct request_info: details of each request
* @cookie: identifier for os_if request
@ -201,6 +225,10 @@ struct request_info {
void *cookie);
void (*congestion_notif_cb)(uint8_t vdev_id,
uint8_t congestion);
#ifdef WLAN_FEATURE_BIG_DATA_STATS
void (*get_big_data_stats_cb)(struct big_data_stats_event *ev,
void *cookie);
#endif
} u;
uint32_t vdev_id;
uint32_t pdev_id;

View File

@ -69,6 +69,34 @@ QDF_STATUS tgt_mc_cp_stats_process_infra_stats_event(
struct infra_cp_stats_event *infra_event);
#endif
#ifdef WLAN_FEATURE_BIG_DATA_STATS
/**
* tgt_mc_cp_stats_process_big_data_stats_event(): API to process big data
* stats event
* @psoc: pointer to psoc object
* @event: big data stats event parameters
*
* Return: status of operation
*/
QDF_STATUS
tgt_mc_cp_stats_process_big_data_stats_event(
struct wlan_objmgr_psoc *psoc,
struct big_data_stats_event *event);
/**
* tgt_send_cp_big_data_stats_req(): API to send big data stats request
* to lmac
* @psoc: pointer to psoc object
* @req: pointer to request info
*
* Return: status of operation
*/
QDF_STATUS tgt_send_cp_big_data_stats_req(struct wlan_objmgr_psoc *psoc,
struct request_info *req);
#endif
/**
* tgt_send_mc_cp_stats_req(): API to send stats request to lmac
* @psoc: pointer to psoc object

View File

@ -152,7 +152,6 @@ QDF_STATUS ucfg_mc_cp_stats_write_wow_stats(
QDF_STATUS ucfg_mc_cp_stats_send_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info);
/**
* wlan_cfg80211_mc_twt_clear_infra_cp_stats() - send request to reset
* control path statistics
@ -338,6 +337,30 @@ void ucfg_mc_cp_stats_register_pmo_handler(void);
#else
void static inline ucfg_mc_cp_stats_register_pmo_handler(void) { };
#endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */
#ifdef WLAN_FEATURE_BIG_DATA_STATS
/**
* ucfg_send_big_data_stats_request() - API to send big data stats
* request
* @vdev: pointer to vdev object
* @type: request type
* @info: request info
*
* Return: status of operation
*/
QDF_STATUS ucfg_send_big_data_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info);
#else
static inline
QDF_STATUS ucfg_send_big_data_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info)
{
return QDF_STATUS_SUCCESS;
}
#endif
#else
void static inline ucfg_mc_cp_stats_register_pmo_handler(void) { };
static inline QDF_STATUS ucfg_mc_cp_stats_send_stats_request(
@ -391,5 +414,14 @@ static inline QDF_STATUS ucfg_mc_cp_stats_get_vdev_wake_lock_stats(
{
return QDF_STATUS_SUCCESS;
}
static inline
QDF_STATUS ucfg_send_big_data_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info)
{
return QDF_STATUS_SUCCESS;
}
#endif /* QCA_SUPPORT_CP_STATS */
#endif /* __WLAN_CP_STATS_MC_UCFG_API_H__ */

View File

@ -67,11 +67,46 @@ tgt_cp_stats_register_infra_cp_stats_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
}
#endif
#ifdef WLAN_FEATURE_BIG_DATA_STATS
static void
tgt_cp_stats_register_big_data_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
{
rx_ops->cp_stats_rx_ops.process_big_data_stats_event =
tgt_mc_cp_stats_process_big_data_stats_event;
}
static QDF_STATUS
send_big_data_stats_req(struct wlan_lmac_if_cp_stats_tx_ops *tx_ops,
struct wlan_objmgr_psoc *psoc,
struct request_info *req)
{
if (!tx_ops->send_req_big_data_stats) {
cp_stats_err("could not get send_req_big_data_stats");
return QDF_STATUS_E_NULL_VALUE;
}
return tx_ops->send_req_big_data_stats(psoc, req);
}
#else
static void
tgt_cp_stats_register_big_data_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
{}
static QDF_STATUS
send_big_data_stats_req(struct wlan_lmac_if_cp_stats_tx_ops *tx_ops,
struct wlan_objmgr_psoc *psoc,
struct request_info *req)
{
return QDF_STATUS_SUCCESS;
}
#endif
void tgt_cp_stats_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
{
rx_ops->cp_stats_rx_ops.process_stats_event =
tgt_mc_cp_stats_process_stats_event;
tgt_cp_stats_register_infra_cp_stats_rx_ops(rx_ops);
tgt_cp_stats_register_big_data_rx_ops(rx_ops);
}
static void tgt_mc_cp_stats_extract_tx_power(struct wlan_objmgr_psoc *psoc,
@ -1168,6 +1203,43 @@ QDF_STATUS tgt_mc_cp_stats_process_stats_event(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_BIG_DATA_STATS
QDF_STATUS
tgt_mc_cp_stats_process_big_data_stats_event(struct wlan_objmgr_psoc *psoc,
struct big_data_stats_event *ev)
{
QDF_STATUS status;
struct request_info last_req = {0};
bool pending = false;
if (!ev) {
cp_stats_err("invalid data");
return QDF_STATUS_E_INVAL;
}
status = ucfg_mc_cp_stats_get_pending_req(psoc,
TYPE_BIG_DATA_STATS,
&last_req);
if (QDF_IS_STATUS_ERROR(status)) {
cp_stats_err("ucfg_mc_cp_stats_get_pending_req failed");
return QDF_STATUS_E_FAILURE;
}
ucfg_mc_cp_stats_reset_pending_req(psoc, TYPE_BIG_DATA_STATS,
&last_req, &pending);
if (last_req.u.get_big_data_stats_cb && pending) {
last_req.u.get_big_data_stats_cb(ev, last_req.cookie);
last_req.u.get_big_data_stats_cb = NULL;
} else {
cp_stats_err("callback to send big data stats not found");
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}
#endif
QDF_STATUS tgt_mc_cp_stats_inc_wake_lock_stats(struct wlan_objmgr_psoc *psoc,
uint32_t reason,
struct wake_lock_stats *stats,
@ -1205,6 +1277,9 @@ QDF_STATUS tgt_send_mc_cp_stats_req(struct wlan_objmgr_psoc *psoc,
}
status = tx_ops->send_req_peer_stats(psoc, req);
break;
case TYPE_BIG_DATA_STATS:
status = send_big_data_stats_req(tx_ops, psoc, req);
break;
default:
if (!tx_ops->send_req_stats) {
cp_stats_err("could not get send_req_stats");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021 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
@ -706,6 +706,24 @@ QDF_STATUS ucfg_mc_cp_stats_send_stats_request(struct wlan_objmgr_vdev *vdev,
return tgt_send_mc_cp_stats_req(wlan_vdev_get_psoc(vdev), type, info);
}
#ifdef WLAN_FEATURE_BIG_DATA_STATS
QDF_STATUS ucfg_send_big_data_stats_request(struct wlan_objmgr_vdev *vdev,
enum stats_req_type type,
struct request_info *info)
{
QDF_STATUS status;
status = ucfg_mc_cp_stats_set_pending_req(wlan_vdev_get_psoc(vdev),
type, info);
if (QDF_IS_STATUS_ERROR(status)) {
cp_stats_err("ucfg_mc_cp_stats_set_pending_req pdev failed: %d",
status);
return status;
}
return tgt_send_mc_cp_stats_req(wlan_vdev_get_psoc(vdev), type, info);
}
#endif
QDF_STATUS ucfg_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
int *dbm)
{

View File

@ -915,6 +915,78 @@ end:
return qdf_status_to_os_return(status);
}
#ifdef WLAN_FEATURE_BIG_DATA_STATS
static int target_if_mc_cp_stats_big_data_stats_event_handler(ol_scn_t scn,
uint8_t *data,
uint32_t datalen)
{
QDF_STATUS status;
struct big_data_stats_event ev = {0};
struct wlan_objmgr_psoc *psoc;
struct wmi_unified *wmi_handle;
struct wlan_lmac_if_cp_stats_rx_ops *rx_ops;
if (!scn || !data) {
cp_stats_err("scn: 0x%pK, data: 0x%pK", scn, data);
return -EINVAL;
}
psoc = target_if_get_psoc_from_scn_hdl(scn);
if (!psoc) {
cp_stats_err("null psoc");
return -EINVAL;
}
rx_ops = target_if_cp_stats_get_rx_ops(psoc);
if (!rx_ops || !rx_ops->process_big_data_stats_event) {
cp_stats_err("callback not registered");
return -EINVAL;
}
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
cp_stats_err("wmi_handle is null");
return -EINVAL;
}
status = wmi_extract_big_data_stats_param(wmi_handle, data, &ev);
if (QDF_IS_STATUS_ERROR(status)) {
cp_stats_err("extract event failed");
goto end;
}
status = rx_ops->process_big_data_stats_event(psoc, &ev);
end:
return qdf_status_to_os_return(status);
}
/**
* target_if_cp_stats_send_big_data_stats_req() - API to send request to wmi
* @psoc: pointer to psoc object
* @req: pointer to object containing stats request parameters
*
* Return: status of operation.
*/
static QDF_STATUS target_if_cp_stats_send_big_data_stats_req(
struct wlan_objmgr_psoc *psoc,
struct request_info *req)
{
struct wmi_unified *wmi_handle;
struct stats_request_params param = {0};
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
cp_stats_err("wmi_handle is null.");
return QDF_STATUS_E_NULL_VALUE;
}
param.vdev_id = req->vdev_id;
return wmi_unified_big_data_stats_request_send(wmi_handle,
&param);
}
#endif
static QDF_STATUS
target_if_cp_stats_extract_peer_stats_event(struct wmi_unified *wmi_hdl,
struct stats_event *ev,
@ -1121,6 +1193,62 @@ static void target_if_cp_stats_inc_wake_lock_stats(uint32_t reason,
}
}
#ifdef WLAN_FEATURE_BIG_DATA_STATS
static QDF_STATUS
target_if_register_big_data_event_handler(struct wmi_unified *wmi_handle)
{
return wmi_unified_register_event_handler(
wmi_handle, wmi_vdev_send_big_data_p2_eventid,
target_if_mc_cp_stats_big_data_stats_event_handler,
WMI_RX_WORK_CTX);
}
static void
target_if_unregister_big_data_event_handler(struct wmi_unified *wmi_handle)
{
wmi_unified_unregister_event_handler(wmi_handle,
wmi_vdev_send_big_data_p2_eventid);
}
static QDF_STATUS
target_if_big_data_stats_register_tx_ops(struct wlan_lmac_if_cp_stats_tx_ops
*cp_stats_tx_ops)
{
cp_stats_tx_ops->send_req_big_data_stats =
target_if_cp_stats_send_big_data_stats_req;
return QDF_STATUS_SUCCESS;
}
static void
target_if_big_data_stats_unregister_tx_ops(struct wlan_lmac_if_cp_stats_tx_ops
*cp_stats_tx_ops)
{
cp_stats_tx_ops->send_req_big_data_stats = NULL;
}
#else
static QDF_STATUS
target_if_register_big_data_event_handler(struct wmi_unified *wmi_handle)
{
return QDF_STATUS_SUCCESS;
}
static void
target_if_unregister_big_data_event_handler(struct wmi_unified *wmi_handle)
{}
static QDF_STATUS
target_if_big_data_stats_register_tx_ops(struct wlan_lmac_if_cp_stats_tx_ops
*cp_stats_tx_ops)
{
return QDF_STATUS_SUCCESS;
}
static void
target_if_big_data_stats_unregister_tx_ops(struct wlan_lmac_if_cp_stats_tx_ops
*cp_stats_tx_ops)
{}
#endif
static QDF_STATUS
target_if_mc_cp_stats_register_event_handler(struct wlan_objmgr_psoc *psoc)
{
@ -1153,6 +1281,10 @@ target_if_mc_cp_stats_register_event_handler(struct wlan_objmgr_psoc *psoc)
if (QDF_IS_STATUS_ERROR(ret_val))
cp_stats_err("Failed to register peer stats info event cb");
ret_val = target_if_register_big_data_event_handler(wmi_handle);
if (QDF_IS_STATUS_ERROR(ret_val))
cp_stats_err("Failed to register big data stats info event cb");
return ret_val;
}
@ -1171,6 +1303,9 @@ target_if_mc_cp_stats_unregister_event_handler(struct wlan_objmgr_psoc *psoc)
cp_stats_err("wmi_handle is null");
return QDF_STATUS_E_INVAL;
}
target_if_unregister_big_data_event_handler(wmi_handle);
wmi_unified_unregister_event_handler(wmi_handle,
wmi_peer_stats_info_event_id);
wmi_unified_unregister_event_handler(wmi_handle,
@ -1329,6 +1464,8 @@ target_if_mc_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
cp_stats_tx_ops->send_req_peer_stats =
target_if_cp_stats_send_peer_stats_req;
target_if_big_data_stats_register_tx_ops(cp_stats_tx_ops);
return QDF_STATUS_SUCCESS;
}
@ -1348,6 +1485,7 @@ target_if_mc_cp_stats_unregister_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
return QDF_STATUS_E_FAILURE;
}
target_if_big_data_stats_unregister_tx_ops(cp_stats_tx_ops);
cp_stats_tx_ops->inc_wake_lock_stats = NULL;
cp_stats_tx_ops->send_req_stats = NULL;
cp_stats_tx_ops->send_req_peer_stats = NULL;