qcacmn: Add support for WMI_TWT_SESSION_STATS_EVENT

Add support for WMI_TWT_SESSION_STATS_EVENT.

Change-Id: I7bee07360824ca599c82d9dc3f1709acb00466d8
CRs-Fixed: 3085541
Bu işleme şunda yer alıyor:
Srinivas Girigowda
2021-10-06 14:22:51 +05:30
işlemeyi yapan: Madan Koyyalamudi
ebeveyn 2040cc94c8
işleme 75335f0708
8 değiştirilmiş dosya ile 326 ekleme ve 2 silme

Dosyayı Görüntüle

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -230,3 +231,67 @@ wlan_cp_stats_comp_obj_config(enum wlan_objmgr_obj_type obj_type,
return status;
}
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
QDF_STATUS
wlan_cp_stats_twt_get_session_evt_handler(
struct wlan_objmgr_psoc *psoc,
struct twt_session_stats_info *twt_params)
{
int i;
uint32_t event_type;
struct wlan_objmgr_peer *peer;
struct peer_cp_stats *peer_cp_stats_priv;
QDF_STATUS status = QDF_STATUS_SUCCESS;
if (!psoc || !twt_params)
return QDF_STATUS_E_INVAL;
peer = wlan_objmgr_get_peer_by_mac(psoc, twt_params->peer_mac.bytes,
WLAN_CP_STATS_ID);
if (!peer) {
cp_stats_err("peer is NULL");
return QDF_STATUS_E_INVAL;
}
peer_cp_stats_priv = wlan_cp_stats_get_peer_stats_obj(peer);
if (!peer_cp_stats_priv) {
cp_stats_err("peer_cp_stats_priv is null");
status = QDF_STATUS_E_INVAL;
goto cleanup;
}
if (twt_params->event_type == HOST_TWT_SESSION_UPDATE ||
twt_params->event_type == HOST_TWT_SESSION_TEARDOWN) {
/* Update for a existing session, find by dialog_id */
for (i = 0; i < TWT_PEER_MAX_SESSIONS; i++) {
if (peer_cp_stats_priv->twt_param[i].dialog_id !=
twt_params->dialog_id)
continue;
qdf_mem_copy(&peer_cp_stats_priv->twt_param[i],
twt_params, sizeof(*twt_params));
goto cleanup;
}
} else if (twt_params->event_type == HOST_TWT_SESSION_SETUP) {
/* New session, fill in any existing invalid session */
for (i = 0; i < TWT_PEER_MAX_SESSIONS; i++) {
event_type =
peer_cp_stats_priv->twt_param[i].event_type;
if (event_type != HOST_TWT_SESSION_SETUP &&
event_type != HOST_TWT_SESSION_UPDATE) {
qdf_mem_copy(&peer_cp_stats_priv->twt_param[i],
twt_params, sizeof(*twt_params));
goto cleanup;
}
}
}
cp_stats_err("Unable to save twt session params with dialog id %d",
twt_params->dialog_id);
status = QDF_STATUS_E_INVAL;
cleanup:
wlan_objmgr_peer_release_ref(peer, WLAN_CP_STATS_ID);
return status;
}
#endif

Dosyayı Görüntüle

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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,5 +49,27 @@ QDF_STATUS wlan_cp_stats_comp_obj_config(
void *cmn_obj,
void *comp_priv_obj);
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
/**
* wlan_cp_stats_twt_get_session_evt_handler() - twt get sessions evt handler
* @psoc: pointer to psoc object
* @twt_params: twt params
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS
wlan_cp_stats_twt_get_session_evt_handler(
struct wlan_objmgr_psoc *psoc,
struct twt_session_stats_info *twt_params);
#else
static inline QDF_STATUS
wlan_cp_stats_twt_get_session_evt_handler(
struct wlan_objmgr_psoc *psoc,
struct twt_session_stats_info *twt_params)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif
#endif /* QCA_SUPPORT_CP_STATS */
#endif /* __WLAN_CP_STATS_COMP_HANDLER_H__ */

Dosyayı Görüntüle

@@ -38,6 +38,9 @@
#include <wlan_cp_stats_utils_api.h>
#include <wlan_cp_stats_ext_type.h>
#include <wlan_cp_stats_public_structs.h>
#ifdef WLAN_FEATURE_MIB_STATS
#include <wlan_cp_stats_mc_defs.h>
#endif
/* noise floor */
#define CP_STATS_TGT_NOISE_FLOOR_DBM (-96)
@@ -110,6 +113,7 @@ struct vdev_cp_stats {
* @peer_comp_priv_obj[]: component's private object pointers
* @peer_cp_stats_lock: lock to protect object
* @rx_pnerr_stats_inc: callback function to update rx PN error stats
* @twt_param: Pointer to peer twt session parameters
*/
struct peer_cp_stats {
struct wlan_objmgr_peer *peer_obj;
@@ -117,6 +121,9 @@ struct peer_cp_stats {
void *peer_comp_priv_obj[WLAN_CP_STATS_MAX_COMPONENTS];
qdf_spinlock_t peer_cp_stats_lock;
void (*rx_pnerr_stats_inc)(struct wlan_objmgr_peer *peer, uint32_t val);
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
struct twt_session_stats_info twt_param[TWT_PEER_MAX_SESSIONS];
#endif
};
/**

Dosyayı Görüntüle

@@ -30,6 +30,7 @@
#ifdef QCA_SUPPORT_CP_STATS
#include <wlan_objmgr_cmn.h>
#include <wlan_twt_public_structs.h>
#define cp_stats_debug(args ...) \
QDF_TRACE_DEBUG(QDF_MODULE_ID_CP_STATS, ## args)
@@ -165,6 +166,28 @@ void wlan_cp_stats_vdev_ucast_rx_pnerr(struct wlan_objmgr_vdev *vdev);
*/
void wlan_cp_stats_peer_rx_pnerr(struct wlan_objmgr_peer *peer);
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
/**
* tgt_cp_stats_twt_get_session_evt_handler() - twt get sessions evt handler
* @psoc: pointer to psoc object
* @twt_params: twt params
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS
tgt_cp_stats_twt_get_session_evt_handler(
struct wlan_objmgr_psoc *psoc,
struct twt_session_stats_info *twt_params);
#else
static inline QDF_STATUS
tgt_cp_stats_twt_get_session_evt_handler(
struct wlan_objmgr_psoc *psoc,
struct twt_session_stats_info *twt_params)
{
return QDF_STATUS_E_NOSUPPORT;
}
#endif
#else /* QCA_SUPPORT_CP_STATS */
static inline
void wlan_cp_stats_vdev_ucast_rx_pnerr(struct wlan_objmgr_vdev *vdev)

Dosyayı Görüntüle

@@ -25,6 +25,7 @@
*/
#include "../../core/src/wlan_cp_stats_defs.h"
#include "../../core/src/wlan_cp_stats_obj_mgr_handler.h"
#include "../../core/src/wlan_cp_stats_comp_handler.h"
#include <wlan_cp_stats_utils_api.h>
#include <wlan_cp_stats_ucfg_api.h>
@@ -366,3 +367,13 @@ void wlan_cp_stats_peer_rx_pnerr(struct wlan_objmgr_peer *peer)
if (peer_cs && peer_cs->rx_pnerr_stats_inc)
peer_cs->rx_pnerr_stats_inc(peer, 1);
}
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
QDF_STATUS
tgt_cp_stats_twt_get_session_evt_handler(
struct wlan_objmgr_psoc *psoc,
struct twt_session_stats_info *twt_params)
{
return wlan_cp_stats_twt_get_session_evt_handler(psoc, twt_params);
}
#endif

Dosyayı Görüntüle

@@ -192,6 +192,10 @@ struct wlan_lmac_if_cp_stats_rx_ops {
struct wlan_objmgr_psoc *psoc,
stats_big_data_stats_event *ev);
#endif
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
QDF_STATUS (*twt_get_session_param_resp)(struct wlan_objmgr_psoc *psoc,
struct twt_session_stats_info *params);
#endif
};
#endif

Dosyayı Görüntüle

@@ -64,6 +64,7 @@
#ifdef QCA_SUPPORT_CP_STATS
#include <wlan_cp_stats_tgt_api.h>
#include <wlan_cp_stats_utils_api.h>
#endif /* QCA_SUPPORT_CP_STATS */
#include <wlan_vdev_mgr_tgt_if_rx_api.h>
@@ -97,6 +98,26 @@ tgt_vdev_mgr_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
}
#ifdef QCA_SUPPORT_CP_STATS
#if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
/**
* wlan_target_if_cp_stats_rx_ops_register() - register cp_stats rx ops
* @rx_ops: lmac rx_ops
*
* Return: none
*/
static void
wlan_target_if_cp_stats_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
{
rx_ops->cp_stats_rx_ops.twt_get_session_param_resp =
tgt_cp_stats_twt_get_session_evt_handler;
}
#else
static void
wlan_target_if_cp_stats_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
{
}
#endif
/**
* wlan_lmac_if_cp_stats_rx_ops_register() - API to register cp stats Rx Ops
* @rx_ops: pointer to lmac rx ops
@@ -108,6 +129,7 @@ tgt_vdev_mgr_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
static void
wlan_lmac_if_cp_stats_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
{
wlan_target_if_cp_stats_rx_ops_register(rx_ops);
tgt_cp_stats_register_rx_ops(rx_ops);
}
#else