diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h index 0059f03250..8292bd60d8 100644 --- a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h @@ -26,39 +26,36 @@ #define __WLAN_CP_STATS_ATF_DEFS_H__ #ifdef QCA_SUPPORT_CP_STATS -#include -#include -#include /** - * struct atf_cp_stats - ATF statistics + * struct atf_peer_cp_stats - ATF statistics + * @vdev_id: vdev object identifier * @tokens: tokens distributed by strictq/fairq - * @act_tokens: tokens available, after adjustemnt of - * excess consumed in prev cycle + * @act_tokens: tokens available, after adjustemnt of excess + * consumed in prev cycle * @total: total tokens distributed by strictq/fairq * @contribution: tokens contributed by this node * @tot_contribution: tokens contributed by all nodes * @borrow: tokens borrowed by this node * @unused: tokens not used * @pkt_drop_nobuf: packets dropped as node is already holding - * it's share of tx buffers + * it's share of tx buffers * @allowed_bufs: max tx buffers that this node can hold * @max_num_buf_held: max tx buffers held by this node * @min_num_buf_held: min tx buffers held by this node * @num_tx_bufs: packets sent for this node * @num_tx_bytes: bytes sent for this node * @tokens_common: tokens distributed by strictq/fairq - * (for non-atf nodes) + * (for non-atf nodes) * @act_tokens_common: tokens available, after adjustemnt of - * excess consumed in prev cycle - * (for non-atf nodes) + * excess consumed in prev cycle (for non-atf nodes) * @timestamp: time when stats are updated * @weighted_unusedtokens_percent: weighted unused tokens percent * @raw_tx_tokens: raw tokens * @throughput: attainable throughput assuming 100% airtime * @total_used_tokens: total of used tokens */ -struct atf_cp_stats { +struct atf_peer_cp_stats { uint8_t vdev_id; uint32_t tokens; uint32_t act_tokens; @@ -82,45 +79,5 @@ struct atf_cp_stats { uint64_t total_used_tokens; }; -/** - * struct atfcntbl - Structure for ATF config table element - * @ssid: SSID - * @sta_mac: STA MAC address - * @value: value to configure - * @info_mark: 1 -- STA, 0 -- VDEV - * @assoc_status: 1 -- Yes, 0 -- No - * @all_tokens_used: 1 -- Yes, 0 -- No - * @cfg_value: Config value - * @grpname: Group name - */ -struct atfcntbl_cs { - uint8_t ssid[SSID_MAX_LEN + 1]; - uint8_t sta_mac[MAC_ADDR_SIZE]; - uint32_t value; - uint8_t info_mark; - uint8_t assoc_status; - uint8_t all_tokens_used; - uint32_t cfg_value; - uint8_t grpname[SSID_MAX_LEN + 1]; -}; - -/** - * struct atftable - ATF table - * @id_type: Sub command - * @atf_info: Array of atfcntbl - * @info_cnt: Count of info entry - * @busy: Busy state flag - * @atf_group: Group ID - * @show_per_peer_table: Flag to show per peer table - */ -struct atftable_cs { - uint16_t id_type; - struct atfcntbl atf_info[ATF_ACTIVED_MAX_CLIENTS + ATF_CFG_NUM_VDEV]; - uint16_t info_cnt; - uint8_t atf_status; - uint32_t busy; - uint32_t atf_group; -}; - #endif /* QCA_SUPPORT_CP_STATS */ #endif /* __WLAN_CP_STATS_ATF_DEFS_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_api.h index 3ce4bed2f2..56d186968e 100644 --- a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_api.h +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_api.h @@ -28,6 +28,9 @@ #include #include #include "../../core/src/wlan_cp_stats_defs.h" +#ifdef WLAN_ATF_ENABLE +#include +#endif #define UCFG_PDEV_CP_STATS_SET_FUNCS(field) \ static inline void \ @@ -630,5 +633,32 @@ QDF_STATUS wlan_ucfg_get_pdev_hw_cp_stats(struct wlan_objmgr_pdev *pdev, QDF_STATUS wlan_ucfg_set_pdev_hw_cp_stats(struct wlan_objmgr_pdev *pdev, struct pdev_hw_stats *hw_stats); +#ifdef WLAN_ATF_ENABLE +/** + * wlan_ucfg_get_atf_peer_cp_stats() - ucfg API to get ATF peer cp stats + * @peer_obj: pointer to peer object + * @atf_cps: pointer to atf peer cp stats object to populate + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS wlan_ucfg_get_atf_peer_cp_stats(struct wlan_objmgr_peer *peer, + struct atf_peer_cp_stats *atf_cps); + +/** + * wlan_ucfg_get_atf_peer_cp_stats_from_mac() - ucfg API to get ATF + * peer cp stats from peer mac address + * @vdev_obj: pointer to vdev object + * @mac: pointer to peer mac address + * @atf_cps: pointer to atf peer cp stats object to populate + * + * Return: QDF_STATUS - Success or Failure + */ +QDF_STATUS +wlan_ucfg_get_atf_peer_cp_stats_from_mac(struct wlan_objmgr_vdev *vdev, + uint8_t *mac, + struct atf_peer_cp_stats *astats); + +#endif + #endif /* QCA_SUPPORT_CP_STATS */ #endif /* __WLAN_CP_STATS_IC_UCFG_API_H__ */ diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_api.c index c831636c9a..4e6dbb9ed3 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_api.c @@ -24,7 +24,9 @@ */ #include #include +#ifdef WLAN_ATF_ENABLE #include +#endif #include #include "../../core/src/wlan_cp_stats_cmn_api_i.h" #include @@ -253,3 +255,86 @@ struct pdev_ic_cp_stats } qdf_export_symbol(wlan_get_pdev_cp_stats_ref); + +#ifdef WLAN_ATF_ENABLE +QDF_STATUS +wlan_ucfg_get_atf_peer_cp_stats(struct wlan_objmgr_peer *peer, + struct atf_peer_cp_stats *atf_cps) +{ + struct peer_cp_stats *peer_cs; + + if (!peer) { + cp_stats_err("Invalid input, peer obj is null"); + return QDF_STATUS_E_INVAL; + } + + if (!atf_cps) { + cp_stats_err("Invalid input, ATF cp stats obj is null"); + return QDF_STATUS_E_INVAL; + } + + peer_cs = wlan_cp_stats_get_peer_stats_obj(peer); + if (peer_cs) { + if (peer_cs->peer_comp_priv_obj[WLAN_CP_STATS_ATF]) { + wlan_cp_stats_peer_obj_lock(peer_cs); + qdf_mem_copy(atf_cps, + peer_cs->peer_comp_priv_obj[WLAN_CP_STATS_ATF], + sizeof(*atf_cps)); + wlan_cp_stats_peer_obj_unlock(peer_cs); + return QDF_STATUS_SUCCESS; + } + } + + return QDF_STATUS_E_FAILURE; +} + +QDF_STATUS +wlan_ucfg_get_atf_peer_cp_stats_from_mac(struct wlan_objmgr_vdev *vdev, + uint8_t *mac, + struct atf_peer_cp_stats *astats) +{ + struct wlan_objmgr_peer *peer; + struct wlan_objmgr_psoc *psoc; + struct wlan_objmgr_pdev *pdev; + QDF_STATUS status; + + if (!vdev) { + cp_stats_err("vdev object is NULL"); + return QDF_STATUS_E_INVAL; + } + + if (!mac) { + cp_stats_err("peer mac address is NULL"); + return QDF_STATUS_E_INVAL; + } + + if (!astats) { + cp_stats_err("atf peer stats obj is NULL"); + return QDF_STATUS_E_INVAL; + } + + psoc = wlan_vdev_get_psoc(vdev); + if (!psoc) { + cp_stats_err("psoc is NULL"); + return QDF_STATUS_E_INVAL; + } + + pdev = wlan_vdev_get_pdev(vdev); + if (!pdev) { + cp_stats_err("pdev is NULL"); + return QDF_STATUS_E_INVAL; + } + + peer = wlan_objmgr_get_peer(psoc, wlan_objmgr_pdev_get_pdev_id(pdev), + mac, WLAN_CP_STATS_ID); + if (!peer) { + cp_stats_err("peer is NULL"); + return QDF_STATUS_E_INVAL; + } + + status = wlan_ucfg_get_atf_peer_cp_stats(peer, astats); + wlan_objmgr_peer_release_ref(peer, WLAN_CP_STATS_ID); + + return status; +} +#endif