qca-wifi: Add new files in cp_stats component
Add new files in cp_stats component which are WIN
specific and moved from cmn_dev
Change-Id: I80236dd6fbe9caf1960033b2fa50982e187ec80e
diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_api.h
new file mode 100644
index 0000000..e0b999d
--- /dev/null
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_api.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_ic_acs_api.h
+ *
+ * This file provide declarations for APIs exposed for accessing ACS related
+ * control plane stats
+ */
+
+#ifndef __WLAN_CP_STATS_IC_ACS_API_H__
+#define __WLAN_CP_STATS_IC_ACS_API_H__
+#ifdef QCA_SUPPORT_CP_STATS
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_IC_ACS_API_H__ */
diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_defs.h
new file mode 100644
index 0000000..f4dc9f4
--- /dev/null
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_acs_defs.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_acs_defs.h
+ *
+ * This header file declare APIs defines structure for
+ * common ACS functionality
+ */
+
+#ifndef __WLAN_CP_STATS_ACS_DEFS_H__
+#define __WLAN_CP_STATS_ACS_DEFS_H__
+
+#endif /* __WLAN_CP_STATS_ACS_DEFS_H__ */
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
new file mode 100644
index 0000000..8292bd6
--- /dev/null
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_atf_defs.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_atf_defs.h
+ *
+ * This header file provides structure definitions to ATF control plane stats
+ */
+
+#ifndef __WLAN_CP_STATS_ATF_DEFS_H__
+#define __WLAN_CP_STATS_ATF_DEFS_H__
+
+#ifdef QCA_SUPPORT_CP_STATS
+
+/**
+ * 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
+ * @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
+ * @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)
+ * @act_tokens_common: tokens available, after adjustemnt of
+ * 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_peer_cp_stats {
+ uint8_t vdev_id;
+ uint32_t tokens;
+ uint32_t act_tokens;
+ uint32_t total;
+ uint32_t contribution;
+ uint32_t tot_contribution;
+ uint32_t borrow;
+ uint32_t unused;
+ uint32_t pkt_drop_nobuf;
+ uint16_t allowed_bufs;
+ uint16_t max_num_buf_held;
+ uint16_t min_num_buf_held;
+ uint16_t num_tx_bufs;
+ uint32_t num_tx_bytes;
+ uint32_t tokens_common;
+ uint32_t act_tokens_common;
+ uint32_t timestamp;
+ uint32_t weighted_unusedtokens_percent;
+ uint32_t raw_tx_tokens;
+ uint32_t throughput;
+ uint64_t total_used_tokens;
+};
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_ATF_DEFS_H__ */
diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_dcs_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_dcs_defs.h
new file mode 100644
index 0000000..2e1a752
--- /dev/null
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_dcs_defs.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_ic_dcs_defs.h
+ *
+ * This header file provide structure definitions for DCS control plane stats
+ */
+
+#ifndef __WLAN_CP_STATS_IC_DCS_CHAN_STATS_H__
+#define __WLAN_CP_STATS_IC_DCS_CHAN_STATS_H__
+
+#ifdef QCA_SUPPORT_CP_STATS
+
+/**
+ * struct pdev_dcs_chan_stats - DCS statistics
+ * @dcs_total_util: total channel utilization percentage
+ * @dcs_ap_tx_util: tx channel utilization percentage
+ * @dcs_ap_rx_util: rx channel utilization percentage
+ * @dcs_self_bss_util: self BSS utilization percentage
+ * @dcs_obss_util: other BSS utilization percentage
+ * @dcs_obss_rx_util: total Rx channel utilization percentage
+ * @dcs_free_medium: free medium percentage
+ * @dcs_non_wifi_util: non wifi utilization percentage
+ * @dcs_ss_under_util: spatial stream under util
+ * @dcs_sec_20_util: secondary 20MHz util
+ * @dcs_sec_40_util: secondary 40Mhz util
+ * @dcs_sec_80_util: secondary 80MHz util
+ */
+struct pdev_dcs_chan_stats {
+ uint8_t dcs_total_util;
+ uint8_t dcs_ap_tx_util;
+ uint8_t dcs_ap_rx_util;
+ uint8_t dcs_self_bss_util;
+ uint8_t dcs_obss_util;
+ uint8_t dcs_obss_rx_util;
+ uint8_t dcs_free_medium;
+ uint8_t dcs_non_wifi_util;
+ uint32_t dcs_ss_under_util;
+ uint32_t dcs_sec_20_util;
+ uint32_t dcs_sec_40_util;
+ uint32_t dcs_sec_80_util;
+};
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_IC_DCS_CHAN_STATS_H__ */
diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_defs.h
new file mode 100644
index 0000000..12a2f45
--- /dev/null
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_defs.h
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_ic_defs.h
+ *
+ * This header file maintain structure definitions for cp stats specific to ic
+ */
+
+#ifndef __WLAN_CP_STATS_IC_DEFS_H__
+#define __WLAN_CP_STATS_IC_DEFS_H__
+
+#ifdef QCA_SUPPORT_CP_STATS
+
+#include <wlan_cp_stats_ic_dcs_defs.h>
+/**
+ * struct pdev_rx_rssi - rx rssi information
+ *
+ * @rx_rssi_pri20: primary 20 rssi
+ * @rx_rssi_sec20: secondary 20 rssi
+ * @rx_rssi_sec40: secondary 40 rssi
+ * @rx_rssi_sec80: secondary 80 rssi
+ */
+struct pdev_rx_rssi {
+ uint8_t rx_rssi_pri20;
+ uint8_t rx_rssi_sec20;
+ uint8_t rx_rssi_sec40;
+ uint8_t rx_rssi_sec80;
+};
+
+/**
+ * struct pdev_hw_stats - pdev hw stats
+ *
+ * @tx_hw_retries: tx hw retries
+ * @rx_hw_retries: rx hw retries
+ */
+struct pdev_hw_stats {
+ uint64_t tx_hw_retries;
+ uint64_t tx_hw_failures;
+};
+
+/**
+ * struct pdev_80211_stats - control plane stats at pdev
+ *
+ * the same statistics were earlier maintained with a reference to
+ * ieee80211_mac_stats in vap structure, now the same structure will be
+ * used as interface structure with user space application
+ * make sure to align this structure with ieee80211_mac_stats
+ *
+ * @cs_tx_beacon: tx beacon
+ * @cs_be_nobuf: tx no buf
+ * @cs_tx_buf_count: tx buf count
+ * @cs_tx_mgmt: tx mgmt
+ * @cs_rx_mgmt: rx mgmt
+ * @cs_rx_num_mgmt: rx num mgmt
+ * @cs_rx_num_ctl: rx num ctrl
+ * @cs_tx_rssi: tx rssi
+ * @cs_rx_rssi_comb: rx rssi comb
+ * @cs_rx_overrun: rx over run frames
+ * @cs_rx_phy_err: rx phy error count
+ * @cs_rx_ack_err: rx ack error count
+ * @cs_rx_rts_err: rx rts error count
+ * @cs_rx_rts_success: rx rts success count
+ * @cs_no_beacons: rx beacon
+ * @cs_mib_int_count: mib int count
+ * @cs_rx_looplimit_start: rx loop limit start
+ * @cs_rx_looplimit_end: rx loop limit end
+ * @cs_ap_stats_tx_cal_enable: ap stats tx cal enable status
+ * @cs_tgt_asserts: tgt assert count
+ * @cs_chan_nf: channel noise floor
+ * @cs_chan_nf_sec80: channel noise floor secondary 80
+ * @cs_wmi_tx_mgmt: wmi tx mgmt
+ * @cs_wmi_tx_mgmt_completions: wmi tx mgmt complete
+ * @cs_wmi_tx_mgmt_completion_err: wmi tx mgmt error
+ * @cs_peer_delete_req: peer del request
+ * @cs_peer_delete_resp: peer del response
+ * @cs_rx_mgmt_rssi_drop: rx mgmt rssi drop
+ * @cs_tx_retries: tx retries
+ * @cs_tx_frame_count: tx frame count
+ * @cs_rx_frame_count: rx frame count
+ * @cs_rx_clear_count: rx clear count
+ * @cs_cycle_count: cycle count
+ * @cs_phy_err_count: phy error count
+ * @cs_chan_tx_pwr: channel tx power
+ * @cs_fcsbad: fcs error count
+ */
+struct pdev_80211_stats {
+ uint64_t cs_tx_beacon;
+ uint32_t cs_be_nobuf;
+ uint32_t cs_tx_buf_count;
+ uint32_t cs_tx_mgmt;
+ uint32_t cs_rx_mgmt;
+ uint32_t cs_rx_num_mgmt;
+ uint32_t cs_rx_num_ctl;
+ uint32_t cs_tx_rssi;
+ uint32_t cs_rx_rssi_comb;
+ struct pdev_rx_rssi cs_rx_rssi_chain0;
+ struct pdev_rx_rssi cs_rx_rssi_chain1;
+ struct pdev_rx_rssi cs_rx_rssi_chain2;
+ struct pdev_rx_rssi cs_rx_rssi_chain3;
+ uint32_t cs_rx_overrun;
+ uint32_t cs_rx_phy_err;
+ uint32_t cs_rx_ack_err;
+ uint32_t cs_rx_rts_err;
+ uint32_t cs_rx_rts_success;
+ uint32_t cs_no_beacons;
+ uint32_t cs_mib_int_count;
+ uint32_t cs_rx_looplimit_start;
+ uint32_t cs_rx_looplimit_end;
+ uint8_t cs_ap_stats_tx_cal_enable;
+ uint32_t cs_tgt_asserts;
+ int16_t cs_chan_nf;
+ int16_t cs_chan_nf_sec80;
+ uint64_t cs_wmi_tx_mgmt;
+ uint64_t cs_wmi_tx_mgmt_completions;
+ uint32_t cs_wmi_tx_mgmt_completion_err;
+ uint32_t cs_peer_delete_req;
+ uint32_t cs_peer_delete_resp;
+ uint32_t cs_rx_mgmt_rssi_drop;
+ uint32_t cs_tx_retries;
+ uint32_t cs_tx_frame_count;
+ uint32_t cs_rx_frame_count;
+ uint32_t cs_rx_clear_count;
+ uint32_t cs_cycle_count;
+ uint32_t cs_phy_err_count;
+ uint32_t cs_chan_tx_pwr;
+ uint32_t cs_fcsbad;
+
+ /* at places of copying required for scn-stats, copy till here only */
+ struct pdev_hw_stats hw_stats;
+ struct pdev_dcs_chan_stats chan_stats;
+};
+
+/**
+ * struct lmac_pdev_80211_stats - control plane stats at pdev
+ *
+ * the same statistics were earlier maintained with a reference to
+ * ath_stats structure, now the same structure will be
+ * used as interface structure with user space application
+ *
+ * @cs_ast_reset_on_error: resets on error
+ * @cs_ast_hardware: fatal hardware error interrupts
+ * @cs_ast_halresets: HAL resets
+ * @cs_ast_bmiss: beacon miss interrupts
+ * @cs_ast_brssi: beacon rssi threshold interrupts
+ * @cs_ast_tx_fifoerr: management frames transmitted
+ * @cs_ast_tx_filtered: tx failed 'cuz xmit filtered
+ * @cs_ast_tx_noack: tx frames with no ack marked
+ * @cs_ast_tx_shortpre: tx frames with short preamble
+ * @cs_ast_tx_altrate: tx frames with alternate rate
+ * @cs_ast_tx_protect: tx frames with protection
+ * @cs_ast_rx_nobuf: rx setup failed 'cuz no skbuff
+ * @cs_ast_rx_hal_in_progress: rx hal in progress
+ * @cs_ast_rx_num_unknown: rx num unknown
+ * @cs_ast_per_cal: periodic calibration calls
+ * @cs_ast_per_calfai: periodic calibration failed
+ * @cs_ast_per_rfgain: periodic calibration rfgain reset
+ * @cs_ast_ant_defswitch: rx/default antenna switches
+ * @cs_ast_bb_hang: BB hang detected
+ * @cs_ast_mac_hang: MAC hang detected
+ * @cs_ast_wow_wakeups: count of hibernate and standby wakeups
+ * @cs_ast_wow_wakeupsok: count of wakeups thru WoW
+ * @cs_ast_cfend_sched: count of CF-END frames scheduled
+ * @cs_ast_cfend_sent: count of CF-END frames sent
+ * @cs_ast_noise_floor: noise floor
+ */
+
+struct lmac_pdev_80211_stats {
+ uint32_t cs_ast_reset_on_error;
+ uint32_t cs_ast_hardware;
+ uint32_t cs_ast_halresets;
+ uint32_t cs_ast_bmiss;
+ uint32_t cs_ast_brssi;
+ uint32_t cs_ast_tx_fifoerr;
+ uint32_t cs_ast_tx_filtered;
+ uint32_t cs_ast_tx_noack;
+ uint32_t cs_ast_tx_shortpre;
+ uint32_t cs_ast_tx_altrate;
+ uint32_t cs_ast_tx_protect;
+ uint32_t cs_ast_rx_nobuf;
+ uint32_t cs_ast_rx_hal_in_progress;
+ uint32_t cs_ast_rx_num_unknown;
+ uint32_t cs_ast_per_cal;
+ uint32_t cs_ast_per_calfail;
+ uint32_t cs_ast_per_rfgain;
+ uint32_t cs_ast_ant_defswitch;
+ uint32_t cs_ast_bb_hang;
+ uint32_t cs_ast_mac_hang;
+#ifdef ATH_WOW
+ uint32_t cs_ast_wow_wakeups;
+ uint32_t cs_ast_wow_wakeupsok;
+#endif
+#ifdef ATH_SUPPORT_CFEND
+ uint32_t cs_ast_cfend_sched;
+ uint32_t cs_ast_cfend_sent;
+#endif
+ int16_t cs_ast_noise_floor;
+};
+
+/**
+ * struct pdev_ic_cp_stats - control plane stats specific to WIN at pdev
+ * @stats: 80211 stats
+ * @lmac_stats: lmac 80211 stats
+ */
+struct pdev_ic_cp_stats {
+ struct pdev_80211_stats stats;
+ struct lmac_pdev_80211_stats lmac_stats;
+};
+
+/**
+ * struct vdev_80211_stats - control plane 80211 stats at vdev
+ *
+ * the same statistics were earlier maintained with a reference to
+ * ieee80211_mac_stats in vap structure, now the same structure will be
+ * used as interface structure with user space application
+ * make sure to align this structure with ieee80211_mac_stats
+ *
+ * @cs_tx_bcn_swba: tx beacon
+ * @cs_tx_offchan_mgmt: tx offchan mgmt
+ * @cs_tx_offchan_data: tx offchan data
+ * @cs_tx_offchan_fail: tx offchan fail
+ * @cs_rx_wrongbss: rx from wrong bssid
+ * @cs_rx_tooshort: rx packet length too short
+ * @cs_rx_wrongdir: rx wrong direction
+ * @cs_rx_not_assoc: rx discard cuz sta !assoc
+ * @cs_rx_no_privacy: rx wep but privacy off
+ * @cs_rx_mgt_discard: rx mgmt frames discard
+ * @cs_rx_ctl: rx control frames discard
+ * @cs_rx_rs_too_big: rx rate set truncated
+ * @cs_rx_elem_missing: rx required element missing
+ * @cs_rx_elem_too_big: rx elem too big
+ * @cs_rx_chan_err: rx chan err
+ * @cs_rx_node_alloc: rx frame dropped
+ * @cs_rx_ssid_mismatch: rx ssid mismatch
+ * @cs_rx_auth_unsupported: rx auth unsupported algo
+ * @cs_rx_auth_fail: rx auth fail
+ * @cs_rx_auth_countermeasures: rx auth discard cuz counter measures
+ * @cs_rx_assoc_bss: rx assoc from wrong bss
+ * @cs_rx_assoc_notauth: rx assoc w/o auth
+ * @cs_rx_assoc_cap_mismatch: rx assoc w/ cap mismatch
+ * @cs_rx_assoc_norate: rx assoc w/ no rate match
+ * @cs_rx_assoc_wpaie_err: rx assoc w/ WPA err
+ * @cs_rx_action: rx action frames
+ * @cs_rx_auth_err: rx auth errors
+ * @cs_tx_nodefkey: tx nodefkey cuz no defkey
+ * @cs_tx_noheadroom: tx failed no headroom space
+ * @cs_rx_nocipherctx: rx no cipher context key
+ * @cs_rx_acl: rx acl
+ * @cs_rx_nowds: rx 4-addr packets with no wds enabled
+ * @cs_tx_nonode: tx tx failed for lack of buf
+ * @cs_tx_unknown_mgt: tx unkonwn mgmt
+ * @cs_tx_cipher_err: tx cipher error
+ * @cs_node_timeout: node timeout
+ * @cs_crypto_nomem: no memory for crypto ctx
+ * @cs_crypto_tkip: tkip crypto done in s/w
+ * @cs_crypto_tkipenmic: tkip en-MIC done in s/w
+ * @cs_crypto_tkipcm: crypto tkip counter measures
+ * @cs_crypto_ccmp: crypto ccmp done in s/w
+ * @cs_crypto_wep: crypto wep done in s/w
+ * @cs_crypto_setkey_cipher: crypto set key cipher
+ * @cs_crypto_setkey_nokey: crypto set key no key index
+ * @cs_crypto_delkey: crypto driver key delete failed
+ * @cs_crypto_cipher_err: crypto cipher err
+ * @cs_crypto_attach_fail: crypto attach fail
+ * @cs_crypto_swfallback: crypto sw fallback
+ * @cs_crypto_keyfail: crypto key fail
+ * @cs_ibss_capmismatch: ibss cap mismatch
+ * @cs_ps_unassoc: ps unassoc
+ * @cs_ps_aid_err: ps aid err
+ * @cs_padding: padding
+ * @cs_invalid_macaddr_nodealloc_failcnt: invalid mac node alloc failures
+ * @cs_tx_bcn_succ_cnt:tx beacon success
+ * @cs_tx_bcn_outage_cnt: tx beacon outage
+ * @total_num_offchan_tx_mgmt: total number of offchan TX mgmt frames
+ * @total_num_offchan_tx_data: total number of offchan TX data frames
+ * @num_offchan_tx_failed: number of offchan TX frames failed
+ * @sta_xceed_rlim: no of connections refused after radio limit
+ * @sta_xceed_vlim: no of connections refused after vap limit
+ * @mlme_auth_attempt: no of 802.11 MLME Auth Attempt
+ * @mlme_auth_success: no of 802.11 MLME Auth Success
+ * @authorize_attempt: no of Authorization Attempt
+ * @authorize_success: no of Authorization successful
+ */
+struct vdev_80211_stats {
+ uint64_t cs_rx_wrongbss;
+ uint64_t cs_rx_tooshort;
+ uint64_t cs_rx_wrongdir;
+ uint64_t cs_rx_mcast_echo;
+ uint64_t cs_rx_not_assoc;
+ uint64_t cs_rx_noprivacy;
+ uint64_t cs_rx_mgmt_discard;
+ uint64_t cs_rx_ctl;
+ uint64_t cs_rx_rs_too_big;
+ uint64_t cs_rx_elem_missing;
+ uint64_t cs_rx_elem_too_big;
+ uint64_t cs_rx_chan_err;
+ uint64_t cs_rx_node_alloc;
+ uint64_t cs_rx_ssid_mismatch;
+ uint64_t cs_rx_auth_unsupported;
+ uint64_t cs_rx_auth_fail;
+ uint64_t cs_rx_auth_countermeasures;
+ uint64_t cs_rx_assoc_bss;
+ uint64_t cs_rx_assoc_notauth;
+ uint64_t cs_rx_assoc_cap_mismatch;
+ uint64_t cs_rx_assoc_norate;
+ uint64_t cs_rx_assoc_wpaie_err;
+ uint64_t cs_rx_action;
+ uint64_t cs_rx_auth_err;
+ uint64_t cs_tx_nodefkey;
+ uint64_t cs_tx_noheadroom;
+ uint64_t cs_rx_acl;
+ uint64_t cs_rx_nowds;
+ uint64_t cs_tx_nobuf;
+ uint64_t cs_tx_nonode;
+ uint64_t cs_tx_cipher_err;
+ uint64_t cs_tx_not_ok;
+ uint64_t cs_tx_bcn_swba;
+ uint64_t cs_node_timeout;
+ uint64_t cs_crypto_nomem;
+ uint64_t cs_crypto_tkip;
+ uint64_t cs_crypto_tkipenmic;
+ uint64_t cs_crypto_tkipcm;
+ uint64_t cs_crypto_ccmp;
+ uint64_t cs_crypto_wep;
+ uint64_t cs_crypto_setkey_cipher;
+ uint64_t cs_crypto_setkey_nokey;
+ uint64_t cs_crypto_delkey;
+ uint64_t cs_crypto_cipher_err;
+ uint64_t cs_crypto_attach_fail;
+ uint64_t cs_crypto_swfallback;
+ uint64_t cs_crypto_keyfail;
+ uint64_t cs_ibss_capmismatch;
+ uint64_t cs_ps_unassoc;
+ uint64_t cs_ps_aid_err;
+ uint64_t cs_padding;
+ uint64_t cs_tx_offchan_mgmt;
+ uint64_t cs_tx_offchan_data;
+ uint64_t cs_tx_offchan_fail;
+ uint64_t cs_invalid_macaddr_nodealloc_fail;
+ uint64_t cs_tx_bcn_success;
+ uint64_t cs_tx_bcn_outage;
+ uint64_t cs_sta_xceed_rlim;
+ uint64_t cs_sta_xceed_vlim;
+ uint64_t cs_mlme_auth_attempt;
+ uint64_t cs_mlme_auth_success;
+ uint64_t cs_authorize_attempt;
+ uint64_t cs_authorize_success;
+};
+
+/**
+ * struct vdev_80211_mac_stats - control plane 80211 mac stats at vdev
+ *
+ * the same statistics were earlier maintained with a reference to
+ * ieee80211_mac_stats in vap structure, now the same structure will be
+ * used as interface structure with user space application
+ * make sure to align this structure with ieee80211_mac_stats
+ *
+ * @cs_rx_badkeyid: rx bad keyid
+ * @cs_rx_decryptok: rx decrypt success
+ * @cs_rx_wepfail: rx wep failures
+ * @cs_rx_tkipreplay: rx tkip replays
+ * @cs_rx_tkipformat: rx tkip format
+ * @cs_rx_tkipicv: rx tkip icv
+ * @cs_rx_ccmpreplay: rx ccmp replay
+ * @cs_rx_ccmpformat: rx ccmp format
+ * @cs_rx_ccmpmic: rx ccmp mic failures
+ * @cs_rx_wpireplay: rx wpi replay
+ * @cs_rx_wpimic: rx wpi mic failures
+ * @cs_rx_countermeasure: rx counter measures count
+ * @cs_tx_mgmt: tx mgmt
+ * @cs_rx_mgmt: rx mgmt
+ * @cs_tx_discard: tx dropped due to errors
+ * @cs_rx_mgmt: rx dropped due to errors
+ */
+struct vdev_80211_mac_stats {
+ uint64_t cs_rx_badkeyid;
+ uint64_t cs_rx_decryptok;
+ uint64_t cs_rx_wepfail;
+ uint64_t cs_rx_tkipreplay;
+ uint64_t cs_rx_tkipformat;
+ uint64_t cs_rx_tkipicv;
+ uint64_t cs_rx_ccmpreplay;
+ uint64_t cs_rx_ccmpformat;
+ uint64_t cs_rx_ccmpmic;
+ uint64_t cs_rx_wpireplay;
+ uint64_t cs_rx_wpimic;
+ uint64_t cs_rx_countermeasure;
+ uint64_t cs_tx_mgmt;
+ uint64_t cs_rx_mgmt;
+ uint64_t cs_tx_discard;
+ uint64_t cs_rx_discard;
+};
+
+/**
+ * struct vdev_ic_cp_stats - control plane stats specific to WIN at vdev
+ * @stats: 80211 stats
+ * @ucast_stats: unicast stats
+ * @mcast_stats: multicast or broadcast stats
+ */
+struct vdev_ic_cp_stats {
+ struct vdev_80211_stats stats;
+ struct vdev_80211_mac_stats ucast_stats;
+ struct vdev_80211_mac_stats mcast_stats;
+};
+
+/**
+ * struct peer_ic_cp_stats - control plane stats specific to WIN at peer
+ * the same statistics were earlier maintained with a reference to
+ * ieee80211_nodestats in ni structure, now the same structure will be
+ * as interface structure with user space application
+ * make sure to align this structure with ieee80211_nodestats always
+ *
+ * @cs_rx_mgmt_rssi: rx mgmt rssi
+ * @cs_rx_mgmt: rx mgmt
+ * @cs_rx_noprivacy: rx no privacy
+ * @cs_rx_wepfail: rx wep failures
+ * @cs_rx_ccmpmic: rx ccmp mic failures
+ * @cs_rx_wpimic: rx wpi mic failures
+ * @cs_rx_tkipicv: rx tkip icv
+ * @cs_tx_mgmt: tx mgmt
+ * @cs_is_tx_not_ok: tx failures
+ * @cs_ps_discard: ps discard
+ * @cs_rx_mgmt_rate: rx mgmt rate
+ * @cs_psq_drops: psq drops
+ * @cs_tx_dropblock: tx dropblock
+ * @cs_tx_assoc: tx assoc success
+ * @cs_tx_assoc_fail: tx assoc failure
+ */
+struct peer_ic_cp_stats {
+ int8_t cs_rx_mgmt_rssi;
+ uint32_t cs_rx_mgmt;
+ uint32_t cs_rx_noprivacy;
+ uint32_t cs_rx_wepfail;
+ uint32_t cs_rx_ccmpmic;
+ uint32_t cs_rx_wpimic;
+ uint32_t cs_rx_tkipicv;
+ uint32_t cs_tx_mgmt;
+ uint32_t cs_is_tx_not_ok;
+ uint32_t cs_ps_discard;
+ uint32_t cs_rx_mgmt_rate;
+ uint32_t cs_psq_drops;
+#ifdef ATH_SUPPORT_IQUE
+ uint32_t cs_tx_dropblock;
+#endif
+ uint32_t cs_tx_assoc;
+ uint32_t cs_tx_assoc_fail;
+ uint32_t cs_is_tx_nobuf;
+};
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_IC_DEFS_H__ */
diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_tgt_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_tgt_api.h
new file mode 100644
index 0000000..8a5ab66
--- /dev/null
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_tgt_api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_ic_tgt_api.h
+ *
+ * This header file provides API declarations required for southbound
+ * interaction specific to ic
+ */
+#ifndef __WLAN_CP_STATS_IC_TGT_API_H__
+#define __WLAN_CP_STATS_IC_TGT_API_H__
+
+#ifdef QCA_SUPPORT_CP_STATS
+
+#include <wlan_objmgr_cmn.h>
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_IC_TGT_API_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
new file mode 100644
index 0000000..557d138
--- /dev/null
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_ucfg_api.h
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_ic_ucfg_api.h
+ *
+ */
+
+#ifndef __WLAN_CP_STATS_IC_UCFG_API_H__
+#define __WLAN_CP_STATS_IC_UCFG_API_H__
+
+#ifdef QCA_SUPPORT_CP_STATS
+#include <wlan_objmgr_cmn.h>
+#include <wlan_cp_stats_ic_defs.h>
+#include <wlan_cp_stats_ic_dcs_defs.h>
+#include <umac/cp_stats/core/src/wlan_cp_stats_defs.h>
+#ifdef WLAN_ATF_ENABLE
+#include <wlan_cp_stats_ic_atf_defs.h>
+#endif
+
+#define UCFG_PDEV_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ ucfg_pdev_cp_stats_##field##_inc(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ if (_pdev_cs) { \
+ struct pdev_ic_cp_stats *_pdev_ics = \
+ _pdev_cs->pdev_stats; \
+ if (_pdev_ics) { \
+ _pdev_ics->stats.cs_##field += _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_pdev_cp_stats_##field##_dec(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ if (_pdev_cs) { \
+ struct pdev_ic_cp_stats *_pdev_ics = \
+ _pdev_cs->pdev_stats; \
+ if (_pdev_ics) { \
+ _pdev_ics->stats.cs_##field -= _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_pdev_cp_stats_##field##_update(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ if (_pdev_cs) { \
+ struct pdev_ic_cp_stats *_pdev_ics = \
+ _pdev_cs->pdev_stats; \
+ if (_pdev_ics) { \
+ _pdev_ics->stats.cs_##field = _val;\
+ } \
+ } \
+ }
+
+UCFG_PDEV_CP_STATS_SET_FUNCS(tx_beacon);
+UCFG_PDEV_CP_STATS_SET_FUNCS(be_nobuf);
+UCFG_PDEV_CP_STATS_SET_FUNCS(tx_buf_count);
+UCFG_PDEV_CP_STATS_SET_FUNCS(tx_mgmt);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_mgmt);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_num_mgmt);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_num_ctl);
+UCFG_PDEV_CP_STATS_SET_FUNCS(tx_rssi);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_rssi_comb);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_overrun);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_phy_err);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_ack_err);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_rts_err);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_rts_success);
+UCFG_PDEV_CP_STATS_SET_FUNCS(no_beacons);
+UCFG_PDEV_CP_STATS_SET_FUNCS(mib_int_count);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_looplimit_start);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_looplimit_end);
+UCFG_PDEV_CP_STATS_SET_FUNCS(ap_stats_tx_cal_enable);
+UCFG_PDEV_CP_STATS_SET_FUNCS(tgt_asserts);
+UCFG_PDEV_CP_STATS_SET_FUNCS(chan_nf);
+UCFG_PDEV_CP_STATS_SET_FUNCS(chan_nf_sec80);
+UCFG_PDEV_CP_STATS_SET_FUNCS(wmi_tx_mgmt);
+UCFG_PDEV_CP_STATS_SET_FUNCS(wmi_tx_mgmt_completions);
+UCFG_PDEV_CP_STATS_SET_FUNCS(wmi_tx_mgmt_completion_err);
+UCFG_PDEV_CP_STATS_SET_FUNCS(peer_delete_req);
+UCFG_PDEV_CP_STATS_SET_FUNCS(peer_delete_resp);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_mgmt_rssi_drop);
+UCFG_PDEV_CP_STATS_SET_FUNCS(tx_retries);
+UCFG_PDEV_CP_STATS_SET_FUNCS(tx_frame_count);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_frame_count);
+UCFG_PDEV_CP_STATS_SET_FUNCS(rx_clear_count);
+UCFG_PDEV_CP_STATS_SET_FUNCS(cycle_count);
+UCFG_PDEV_CP_STATS_SET_FUNCS(phy_err_count);
+UCFG_PDEV_CP_STATS_SET_FUNCS(chan_tx_pwr);
+
+#define UCFG_PDEV_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ ucfg_pdev_cp_stats_##field##_get(struct wlan_objmgr_pdev *_pdev) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ struct pdev_ic_cp_stats *_pdev_ics; \
+ if (_pdev_cs) { \
+ _pdev_ics = _pdev_cs->pdev_stats; \
+ if (_pdev_ics) \
+ return _pdev_ics->stats.cs_##field; \
+ } \
+ return 0; \
+ }
+
+UCFG_PDEV_CP_STATS_GET_FUNCS(tx_mgmt);
+UCFG_PDEV_CP_STATS_GET_FUNCS(rx_num_mgmt);
+UCFG_PDEV_CP_STATS_GET_FUNCS(ap_stats_tx_cal_enable);
+UCFG_PDEV_CP_STATS_GET_FUNCS(wmi_tx_mgmt);
+UCFG_PDEV_CP_STATS_GET_FUNCS(wmi_tx_mgmt_completions);
+UCFG_PDEV_CP_STATS_GET_FUNCS(wmi_tx_mgmt_completion_err);
+UCFG_PDEV_CP_STATS_GET_FUNCS(tgt_asserts);
+UCFG_PDEV_CP_STATS_GET_FUNCS(rx_phy_err);
+UCFG_PDEV_CP_STATS_GET_FUNCS(fcsbad);
+
+#define UCFG_PDEV_CHAN_STATS_GET_FUNCS(field) \
+ static inline uint32_t \
+ ucfg_pdev_chan_stats_##field##_get(struct wlan_objmgr_pdev *_pdev) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ struct pdev_ic_cp_stats *_pdev_ic; \
+ if (_pdev_cs) { \
+ _pdev_ic = _pdev_cs->pdev_stats; \
+ if (_pdev_ic) \
+ return _pdev_ic->stats.chan_stats.dcs_##field; \
+ } \
+ return 0; \
+ }
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(self_bss_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(obss_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(obss_rx_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(ap_rx_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(ap_tx_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(free_medium);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(non_wifi_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(ss_under_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(sec_20_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(sec_40_util);
+UCFG_PDEV_CHAN_STATS_GET_FUNCS(sec_80_util);
+
+static inline void ucfg_pdev_cp_stats_reset(struct wlan_objmgr_pdev *_pdev)
+{
+ struct pdev_cp_stats *pdev_cps = NULL;
+
+ pdev_cps = wlan_cp_stats_get_pdev_stats_obj(_pdev);
+ if (!pdev_cps)
+ return;
+
+ qdf_mem_zero(pdev_cps->pdev_stats, sizeof(struct pdev_ic_cp_stats));
+}
+
+#define UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ ucfg_pdev_lmac_cp_stats_##field##_inc(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ if (_pdev_cs) { \
+ struct pdev_ic_cp_stats *_pdev_ics = \
+ _pdev_cs->pdev_stats; \
+ if (_pdev_ics) { \
+ _pdev_ics->lmac_stats.cs_##field += _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_pdev_lmac_cp_stats_##field##_dec(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ if (_pdev_cs) { \
+ struct pdev_ic_cp_stats *_pdev_ics = \
+ _pdev_cs->pdev_stats; \
+ if (_pdev_ics) { \
+ _pdev_ics->lmac_stats.cs_##field -= _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_pdev_lmac_cp_stats_##field##_update( \
+ struct wlan_objmgr_pdev *_pdev, uint64_t _val) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ if (_pdev_cs) { \
+ struct pdev_ic_cp_stats *_pdev_ics = \
+ _pdev_cs->pdev_stats; \
+ if (_pdev_ics) { \
+ _pdev_ics->lmac_stats.cs_##field = _val;\
+ } \
+ } \
+ }
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_reset_on_error);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_hardware);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_halresets);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_bmiss);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_brssi);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_fifoerr);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_filtered);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_noack);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_shortpre);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_altrate);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_protect);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_rx_nobuf);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_rx_hal_in_progress);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_rx_num_unknown);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_per_cal);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_per_calfail);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_per_rfgain);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_ant_defswitch);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_bb_hang);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_mac_hang);
+#ifdef ATH_WOW
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_wow_wakeups);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_wow_wakeupsok);
+#endif
+#ifdef ATH_SUPPORT_CFEND
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_cfend_sched);
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_cfend_sent);
+#endif
+UCFG_PDEV_LMAC_CP_STATS_SET_FUNCS(ast_noise_floor);
+
+#define UCFG_PDEV_LMAC_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ ucfg_pdev_lmac_cp_stats_##field##_get(struct wlan_objmgr_pdev *_pdev) \
+ { \
+ struct pdev_cp_stats *_pdev_cs = \
+ wlan_cp_stats_get_pdev_stats_obj(_pdev); \
+ struct pdev_ic_cp_stats *_pdev_ics; \
+ uint64_t stat = 0; \
+ if (_pdev_cs) { \
+ wlan_cp_stats_pdev_obj_lock(_pdev_cs); \
+ _pdev_ics = _pdev_cs->pdev_stats; \
+ if (_pdev_ics) { \
+ stat = _pdev_ics->lmac_stats.cs_##field; \
+ } \
+ wlan_cp_stats_pdev_obj_unlock(_pdev_cs); \
+ return stat; \
+ } \
+ else \
+ return 0; \
+ }
+
+UCFG_PDEV_LMAC_CP_STATS_GET_FUNCS(ast_tx_fifoerr);
+UCFG_PDEV_LMAC_CP_STATS_GET_FUNCS(ast_tx_filtered);
+UCFG_PDEV_LMAC_CP_STATS_GET_FUNCS(ast_noise_floor);
+
+#define UCFG_VDEV_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ ucfg_vdev_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->stats.cs_##field += _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_vdev_cp_stats_##field##_dec(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->stats.cs_##field -= _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_vdev_cp_stats_##field##_update(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->stats.cs_##field = _val;\
+ } \
+ } \
+ }
+
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_wrongbss);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_tooshort);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_wrongdir);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_not_assoc);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_noprivacy);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_mgmt_discard);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_ctl);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_rs_too_big);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_elem_missing);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_elem_too_big);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_chan_err);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_node_alloc);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_ssid_mismatch);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_auth_unsupported);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_auth_fail);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_auth_countermeasures);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_assoc_bss);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_assoc_notauth);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_assoc_cap_mismatch);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_assoc_norate);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_assoc_wpaie_err);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_action);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_auth_err);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_nodefkey);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_noheadroom);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_acl);
+UCFG_VDEV_CP_STATS_SET_FUNCS(rx_nowds);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_nobuf);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_nonode);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_cipher_err);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_not_ok);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_bcn_swba);
+UCFG_VDEV_CP_STATS_SET_FUNCS(node_timeout);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_nomem);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_tkip);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_tkipenmic);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_tkipcm);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_ccmp);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_wep);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_setkey_cipher);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_setkey_nokey);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_delkey);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_cipher_err);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_attach_fail);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_swfallback);
+UCFG_VDEV_CP_STATS_SET_FUNCS(crypto_keyfail);
+UCFG_VDEV_CP_STATS_SET_FUNCS(ibss_capmismatch);
+UCFG_VDEV_CP_STATS_SET_FUNCS(ps_unassoc);
+UCFG_VDEV_CP_STATS_SET_FUNCS(ps_aid_err);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_offchan_mgmt);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_offchan_data);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_offchan_fail);
+UCFG_VDEV_CP_STATS_SET_FUNCS(invalid_macaddr_nodealloc_fail);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_bcn_success);
+UCFG_VDEV_CP_STATS_SET_FUNCS(tx_bcn_outage);
+UCFG_VDEV_CP_STATS_SET_FUNCS(sta_xceed_rlim);
+UCFG_VDEV_CP_STATS_SET_FUNCS(sta_xceed_vlim);
+UCFG_VDEV_CP_STATS_SET_FUNCS(mlme_auth_attempt);
+UCFG_VDEV_CP_STATS_SET_FUNCS(mlme_auth_success);
+UCFG_VDEV_CP_STATS_SET_FUNCS(authorize_attempt);
+UCFG_VDEV_CP_STATS_SET_FUNCS(authorize_success);
+
+#define UCFG_VDEV_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ ucfg_vdev_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ struct vdev_ic_cp_stats *_vdev_ics; \
+ if (_vdev_cs) { \
+ _vdev_ics = _vdev_cs->vdev_stats; \
+ if (_vdev_ics) \
+ return _vdev_ics->stats.cs_##field; \
+ } \
+ return 0; \
+ }
+
+UCFG_VDEV_CP_STATS_GET_FUNCS(rx_wrongbss);
+UCFG_VDEV_CP_STATS_GET_FUNCS(rx_wrongdir);
+UCFG_VDEV_CP_STATS_GET_FUNCS(rx_ssid_mismatch);
+
+#define UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ ucfg_vdev_ucast_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->ucast_stats.cs_##field += _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_vdev_ucast_cp_stats_##field##_dec(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->ucast_stats.cs_##field -= _val;\
+ } \
+ } \
+ } \
+ static inline void ucfg_vdev_ucast_cp_stats_##field##_update( \
+ struct wlan_objmgr_vdev *_vdev, uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->ucast_stats.cs_##field = _val;\
+ } \
+ } \
+ }
+
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_badkeyid);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_decryptok);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wepfail);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipicv);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipreplay);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipformat);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpmic);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpreplay);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpformat);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wpimic);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wpireplay);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_countermeasure);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_mgmt);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(tx_mgmt);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(rx_discard);
+UCFG_VDEV_UCAST_CP_STATS_SET_FUNCS(tx_discard);
+
+#define UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ ucfg_vdev_ucast_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ struct vdev_ic_cp_stats *_vdev_ics; \
+ if (_vdev_cs) { \
+ _vdev_ics = _vdev_cs->vdev_stats; \
+ if (_vdev_ics) \
+ return _vdev_ics->ucast_stats.cs_##field; \
+ } \
+ return 0; \
+ }
+
+UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(rx_decryptok);
+UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(rx_ccmpmic);
+UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(rx_ccmpreplay);
+UCFG_VDEV_UCAST_CP_STATS_GET_FUNCS(rx_wepfail);
+
+#define UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ ucfg_vdev_mcast_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->mcast_stats.cs_##field += _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_vdev_mcast_cp_stats_##field##_dec(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->mcast_stats.cs_##field -= _val;\
+ } \
+ } \
+ } \
+ static inline void ucfg_vdev_mcast_cp_stats_##field##_update( \
+ struct wlan_objmgr_vdev *_vdev, uint64_t _val) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ if (_vdev_cs) { \
+ struct vdev_ic_cp_stats *_vdev_ics = \
+ _vdev_cs->vdev_stats; \
+ if (_vdev_ics) { \
+ _vdev_ics->mcast_stats.cs_##field = _val;\
+ } \
+ } \
+ }
+
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_badkeyid);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_decryptok);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wepfail);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipicv);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipreplay);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipformat);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpmic);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpreplay);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpformat);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wpimic);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wpireplay);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_countermeasure);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_mgmt);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(tx_mgmt);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(rx_discard);
+UCFG_VDEV_MCAST_CP_STATS_SET_FUNCS(tx_discard);
+
+#define UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ ucfg_vdev_mcast_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+ { \
+ struct vdev_cp_stats *_vdev_cs = \
+ wlan_cp_stats_get_vdev_stats_obj(_vdev); \
+ struct vdev_ic_cp_stats *_vdev_ics; \
+ if (_vdev_cs) { \
+ _vdev_ics = _vdev_cs->vdev_stats; \
+ if (_vdev_ics) \
+ return _vdev_ics->mcast_stats.cs_##field; \
+ } \
+ return 0; \
+ }
+
+UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(rx_decryptok);
+UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(rx_ccmpmic);
+UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(rx_ccmpreplay);
+UCFG_VDEV_MCAST_CP_STATS_GET_FUNCS(rx_wepfail);
+
+#define UCFG_PEER_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ ucfg_peer_cp_stats_##field##_inc(struct wlan_objmgr_peer *_peer, \
+ uint32_t _val) \
+ { \
+ struct peer_cp_stats *_peer_cs = \
+ wlan_cp_stats_get_peer_stats_obj(_peer); \
+ if (_peer_cs) { \
+ struct peer_ic_cp_stats *_peer_ics = \
+ _peer_cs->peer_stats; \
+ if (_peer_ics) { \
+ _peer_ics->cs_##field += _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_peer_cp_stats_##field##_dec(struct wlan_objmgr_peer *_peer, \
+ uint32_t _val) \
+ { \
+ struct peer_cp_stats *_peer_cs = \
+ wlan_cp_stats_get_peer_stats_obj(_peer); \
+ if (_peer_cs) { \
+ struct peer_ic_cp_stats *_peer_ics = \
+ _peer_cs->peer_stats; \
+ if (_peer_ics) { \
+ _peer_ics->cs_##field -= _val;\
+ } \
+ } \
+ } \
+ static inline void \
+ ucfg_peer_cp_stats_##field##_update(struct wlan_objmgr_peer *_peer, \
+ uint32_t _val) \
+ { \
+ struct peer_cp_stats *_peer_cs = \
+ wlan_cp_stats_get_peer_stats_obj(_peer); \
+ if (_peer_cs) { \
+ struct peer_ic_cp_stats *_peer_ics = \
+ _peer_cs->peer_stats; \
+ if (_peer_ics) { \
+ _peer_ics->cs_##field = _val;\
+ } \
+ } \
+ }
+
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_mgmt);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_mgmt);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_mgmt_rate);
+UCFG_PEER_CP_STATS_SET_FUNCS(is_tx_not_ok);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_noprivacy);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_wepfail);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_tkipicv);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_wpimic);
+UCFG_PEER_CP_STATS_SET_FUNCS(rx_ccmpmic);
+UCFG_PEER_CP_STATS_SET_FUNCS(ps_discard);
+UCFG_PEER_CP_STATS_SET_FUNCS(psq_drops);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_assoc);
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_assoc_fail);
+UCFG_PEER_CP_STATS_SET_FUNCS(is_tx_nobuf);
+#ifdef ATH_SUPPORT_IQUE
+UCFG_PEER_CP_STATS_SET_FUNCS(tx_dropblock);
+#endif
+
+static inline
+void ucfg_peer_cp_stats_rx_mgmt_rssi_update(struct wlan_objmgr_peer *peer,
+ int8_t rssi)
+{
+ struct peer_cp_stats *peer_cs;
+ struct peer_ic_cp_stats *peer_cps;
+
+ if (!peer)
+ return;
+
+ peer_cs = wlan_cp_stats_get_peer_stats_obj(peer);
+ if (!peer_cs)
+ return;
+
+ peer_cps = peer_cs->peer_stats;
+ if (peer_cps)
+ peer_cps->cs_rx_mgmt_rssi = rssi;
+}
+
+static inline
+int8_t ucfg_peer_cp_stats_rx_mgmt_rssi_get(struct wlan_objmgr_peer *peer)
+{
+ struct peer_cp_stats *peer_cs;
+ struct peer_ic_cp_stats *peer_cps;
+ int8_t val = -1;
+
+ if (!peer)
+ return val;
+
+ peer_cs = wlan_cp_stats_get_peer_stats_obj(peer);
+ if (!peer_cs)
+ return val;
+
+ peer_cps = peer_cs->peer_stats;
+ if (peer_cps)
+ val = peer_cps->cs_rx_mgmt_rssi;
+
+ return val;
+}
+
+#define UCFG_PEER_CP_STATS_GET_FUNCS(field) \
+ static inline uint32_t \
+ ucfg_peer_cp_stats_##field##_get(struct wlan_objmgr_peer *_peer) \
+ { \
+ struct peer_cp_stats *_peer_cs = \
+ wlan_cp_stats_get_peer_stats_obj(_peer); \
+ struct peer_ic_cp_stats *_peer_ics; \
+ if (_peer_cs) { \
+ _peer_ics = _peer_cs->peer_stats; \
+ if (_peer_ics) \
+ return _peer_ics->cs_##field; \
+ } \
+ return 0; \
+ }
+
+UCFG_PEER_CP_STATS_GET_FUNCS(rx_mgmt_rate);
+#ifdef ATH_SUPPORT_IQUE
+UCFG_PEER_CP_STATS_GET_FUNCS(tx_dropblock);
+#endif
+
+/**
+ * wlan_ucfg_get_peer_cp_stats() - ucfg API to get peer cp stats
+ * @peer_obj: pointer to peer object
+ * @peer_cps: pointer to peer cp stats object to populate
+ *
+ * Return: QDF_STATUS - Success or Failure
+ */
+QDF_STATUS wlan_ucfg_get_peer_cp_stats(struct wlan_objmgr_peer *peer,
+ struct peer_ic_cp_stats *peer_cps);
+
+/**
+ * wlan_ucfg_get_vdev_cp_stats() - ucfg API to get vdev cp stats
+ * @vdev_obj: pointer to vdev object
+ * @vdev_cps: pointer to vdev cp stats object to populate
+ *
+ * Return: QDF_STATUS - Success or Failure
+ */
+QDF_STATUS wlan_ucfg_get_vdev_cp_stats(struct wlan_objmgr_vdev *vdev,
+ struct vdev_ic_cp_stats *vdev_cps);
+
+/**
+ * wlan_ucfg_get_pdev_cp_stats_ref() - API to get reference to pdev cp stats
+ * @pdev_obj: pointer to pdev object
+ *
+ * Return: pdev_ic_cp_stats or NULL
+ */
+struct pdev_ic_cp_stats
+*wlan_ucfg_get_pdev_cp_stats_ref(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * wlan_ucfg_get_pdev_cp_stats() - ucfg API to get pdev cp stats
+ * @pdev_obj: pointer to pdev object
+ * @pdev_cps: pointer to pdev cp stats object to populate
+ *
+ * Return: QDF_STATUS - Success or Failure
+ */
+QDF_STATUS wlan_ucfg_get_pdev_cp_stats(struct wlan_objmgr_pdev *pdev,
+ struct pdev_ic_cp_stats *pdev_cps);
+
+/**
+ * wlan_ucfg_get_pdev_cp_stats() - ucfg API to get pdev hw stats
+ * @pdev_obj: pointer to pdev object
+ * @hw_stats: pointer to pdev hw cp stats to populate
+ *
+ * Return: QDF_STATUS - Success or Failure
+ */
+QDF_STATUS wlan_ucfg_get_pdev_hw_cp_stats(struct wlan_objmgr_pdev *pdev,
+ struct pdev_hw_stats *hw_stats);
+
+/**
+ * wlan_ucfg_set_pdev_cp_stats() - ucfg API to set pdev hw stats
+ * @pdev_obj: pointer to pdev object
+ * @hw_stats: pointer to pdev hw cp stats
+ *
+ * Return: QDF_STATUS - Success or Failure
+ */
+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
+
+/**
+ * wlan_ucfg_get_dcs_chan_stats() - ucfg API to set dcs chan stats
+ * @pdev_obj: pointer to pdev object
+ * @dcs_chan_stats: pointer to dcs chan stats structure
+ *
+ * Return: QDF_STATUS - Success or Failure
+ */
+QDF_STATUS
+wlan_ucfg_get_dcs_chan_stats(struct wlan_objmgr_pdev *pdev,
+ struct pdev_dcs_chan_stats *dcs_chan_stats);
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_IC_UCFG_API_H__ */
diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_utils_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_utils_api.h
new file mode 100644
index 0000000..ba2f897
--- /dev/null
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ic_utils_api.h
@@ -0,0 +1,445 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_ic_utils_api.h
+ *
+ * This header file provide definitions and declarations required for northbound
+ * specific to WIN
+ */
+
+#ifndef __WLAN_CP_STATS_IC_UTILS_API_H__
+#define __WLAN_CP_STATS_IC_UTILS_API_H__
+
+#ifdef QCA_SUPPORT_CP_STATS
+#include "wlan_cp_stats_ic_ucfg_api.h"
+
+#define PEER_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ peer_cp_stats_##field##_inc(struct wlan_objmgr_peer *_peer, \
+ uint64_t _val) \
+ { \
+ ucfg_peer_cp_stats_##field##_inc(_peer, _val); \
+ } \
+ static inline void \
+ peer_cp_stats_##field##_dec(struct wlan_objmgr_peer *_peer, \
+ uint64_t _val) \
+ { \
+ ucfg_peer_cp_stats_##field##_inc(_peer, _val); \
+ } \
+ static inline void \
+ peer_cp_stats_##field##_update(struct wlan_objmgr_peer *_peer, \
+ uint64_t _val) \
+ { \
+ ucfg_peer_cp_stats_##field##_update(_peer, _val); \
+ }
+
+PEER_CP_STATS_SET_FUNCS(rx_mgmt);
+PEER_CP_STATS_SET_FUNCS(tx_mgmt);
+PEER_CP_STATS_SET_FUNCS(rx_mgmt_rate);
+PEER_CP_STATS_SET_FUNCS(is_tx_not_ok);
+PEER_CP_STATS_SET_FUNCS(rx_noprivacy);
+PEER_CP_STATS_SET_FUNCS(rx_wepfail);
+PEER_CP_STATS_SET_FUNCS(rx_tkipicv);
+PEER_CP_STATS_SET_FUNCS(rx_wpimic);
+PEER_CP_STATS_SET_FUNCS(rx_ccmpmic);
+PEER_CP_STATS_SET_FUNCS(ps_discard);
+PEER_CP_STATS_SET_FUNCS(psq_drops);
+PEER_CP_STATS_SET_FUNCS(tx_assoc);
+PEER_CP_STATS_SET_FUNCS(tx_assoc_fail);
+PEER_CP_STATS_SET_FUNCS(is_tx_nobuf);
+#ifdef ATH_SUPPORT_IQUE
+PEER_CP_STATS_SET_FUNCS(tx_dropblock);
+#endif
+
+#define PEER_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ peer_cp_stats_##field##_get(struct wlan_objmgr_peer *_peer) \
+ { \
+ return ucfg_peer_cp_stats_##field##_get(_peer); \
+ }
+
+PEER_CP_STATS_GET_FUNCS(rx_mgmt_rate);
+#ifdef ATH_SUPPORT_IQUE
+PEER_CP_STATS_GET_FUNCS(tx_dropblock);
+#endif
+
+static inline void
+peer_cp_stats_rx_mgmt_rssi_update(struct wlan_objmgr_peer *peer,
+ int8_t rssi)
+{
+ ucfg_peer_cp_stats_rx_mgmt_rssi_update(peer, rssi);
+}
+
+static inline int8_t
+peer_cp_stats_rx_mgmt_rssi_get(struct wlan_objmgr_peer *peer)
+{
+ return ucfg_peer_cp_stats_rx_mgmt_rssi_get(peer);
+}
+
+#define VDEV_UCAST_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ vdev_ucast_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ ucfg_vdev_ucast_cp_stats_##field##_inc(_vdev, _val); \
+ } \
+ static inline void \
+ vdev_ucast_cp_stats_##field##_update(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ ucfg_vdev_ucast_cp_stats_##field##_update(_vdev, _val); \
+ }
+
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_badkeyid);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_decryptok);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wepfail);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipicv);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipreplay);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_tkipformat);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpmic);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpreplay);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_ccmpformat);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wpimic);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_wpireplay);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_countermeasure);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_mgmt);
+VDEV_UCAST_CP_STATS_SET_FUNCS(tx_mgmt);
+VDEV_UCAST_CP_STATS_SET_FUNCS(rx_discard);
+VDEV_UCAST_CP_STATS_SET_FUNCS(tx_discard);
+
+#define VDEV_UCAST_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ vdev_ucast_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+ { \
+ return ucfg_vdev_ucast_cp_stats_##field##_get(_vdev); \
+ }
+
+VDEV_UCAST_CP_STATS_GET_FUNCS(rx_wepfail);
+VDEV_UCAST_CP_STATS_GET_FUNCS(rx_decryptok);
+VDEV_UCAST_CP_STATS_GET_FUNCS(rx_ccmpmic);
+VDEV_UCAST_CP_STATS_GET_FUNCS(rx_ccmpreplay);
+
+#define VDEV_MCAST_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ vdev_mcast_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ ucfg_vdev_mcast_cp_stats_##field##_inc(_vdev, _val); \
+ } \
+ static inline void \
+ vdev_mcast_cp_stats_##field##_update(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ ucfg_vdev_mcast_cp_stats_##field##_update(_vdev, _val); \
+ }
+
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_badkeyid);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_decryptok);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wepfail);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipicv);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipreplay);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_tkipformat);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpmic);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpreplay);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_ccmpformat);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wpimic);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_wpireplay);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_countermeasure);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_mgmt);
+VDEV_MCAST_CP_STATS_SET_FUNCS(tx_mgmt);
+VDEV_MCAST_CP_STATS_SET_FUNCS(rx_discard);
+VDEV_MCAST_CP_STATS_SET_FUNCS(tx_discard);
+
+#define VDEV_MCAST_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ vdev_mcast_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+ { \
+ return ucfg_vdev_mcast_cp_stats_##field##_get(_vdev); \
+ }
+
+VDEV_MCAST_CP_STATS_GET_FUNCS(rx_wepfail);
+VDEV_MCAST_CP_STATS_GET_FUNCS(rx_decryptok);
+VDEV_MCAST_CP_STATS_GET_FUNCS(rx_ccmpmic);
+VDEV_MCAST_CP_STATS_GET_FUNCS(rx_ccmpreplay);
+
+#define VDEV_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ vdev_cp_stats_##field##_inc(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ ucfg_vdev_cp_stats_##field##_inc(_vdev, _val); \
+ } \
+ static inline void \
+ vdev_cp_stats_##field##_update(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ ucfg_vdev_cp_stats_##field##_update(_vdev, _val); \
+ } \
+ static inline void \
+ vdev_cp_stats_##field##_dec(struct wlan_objmgr_vdev *_vdev, \
+ uint64_t _val) \
+ { \
+ ucfg_vdev_cp_stats_##field##_dec(_vdev, _val); \
+ }
+
+VDEV_CP_STATS_SET_FUNCS(rx_wrongbss);
+VDEV_CP_STATS_SET_FUNCS(rx_tooshort);
+VDEV_CP_STATS_SET_FUNCS(rx_wrongdir);
+VDEV_CP_STATS_SET_FUNCS(rx_not_assoc);
+VDEV_CP_STATS_SET_FUNCS(rx_noprivacy);
+VDEV_CP_STATS_SET_FUNCS(rx_mgmt_discard);
+VDEV_CP_STATS_SET_FUNCS(rx_ctl);
+VDEV_CP_STATS_SET_FUNCS(rx_rs_too_big);
+VDEV_CP_STATS_SET_FUNCS(rx_elem_missing);
+VDEV_CP_STATS_SET_FUNCS(rx_elem_too_big);
+VDEV_CP_STATS_SET_FUNCS(rx_chan_err);
+VDEV_CP_STATS_SET_FUNCS(rx_node_alloc);
+VDEV_CP_STATS_SET_FUNCS(rx_ssid_mismatch);
+VDEV_CP_STATS_SET_FUNCS(rx_auth_unsupported);
+VDEV_CP_STATS_SET_FUNCS(rx_auth_fail);
+VDEV_CP_STATS_SET_FUNCS(rx_auth_countermeasures);
+VDEV_CP_STATS_SET_FUNCS(rx_assoc_bss);
+VDEV_CP_STATS_SET_FUNCS(rx_assoc_notauth);
+VDEV_CP_STATS_SET_FUNCS(rx_assoc_cap_mismatch);
+VDEV_CP_STATS_SET_FUNCS(rx_assoc_norate);
+VDEV_CP_STATS_SET_FUNCS(rx_assoc_wpaie_err);
+VDEV_CP_STATS_SET_FUNCS(rx_action);
+VDEV_CP_STATS_SET_FUNCS(rx_auth_err);
+VDEV_CP_STATS_SET_FUNCS(tx_nodefkey);
+VDEV_CP_STATS_SET_FUNCS(tx_noheadroom);
+VDEV_CP_STATS_SET_FUNCS(rx_acl);
+VDEV_CP_STATS_SET_FUNCS(rx_nowds);
+VDEV_CP_STATS_SET_FUNCS(tx_nobuf);
+VDEV_CP_STATS_SET_FUNCS(tx_nonode);
+VDEV_CP_STATS_SET_FUNCS(tx_cipher_err);
+VDEV_CP_STATS_SET_FUNCS(tx_not_ok);
+VDEV_CP_STATS_SET_FUNCS(tx_bcn_swba);
+VDEV_CP_STATS_SET_FUNCS(node_timeout);
+VDEV_CP_STATS_SET_FUNCS(crypto_nomem);
+VDEV_CP_STATS_SET_FUNCS(crypto_tkip);
+VDEV_CP_STATS_SET_FUNCS(crypto_tkipenmic);
+VDEV_CP_STATS_SET_FUNCS(crypto_tkipcm);
+VDEV_CP_STATS_SET_FUNCS(crypto_ccmp);
+VDEV_CP_STATS_SET_FUNCS(crypto_wep);
+VDEV_CP_STATS_SET_FUNCS(crypto_setkey_cipher);
+VDEV_CP_STATS_SET_FUNCS(crypto_setkey_nokey);
+VDEV_CP_STATS_SET_FUNCS(crypto_delkey);
+VDEV_CP_STATS_SET_FUNCS(crypto_cipher_err);
+VDEV_CP_STATS_SET_FUNCS(crypto_attach_fail);
+VDEV_CP_STATS_SET_FUNCS(crypto_swfallback);
+VDEV_CP_STATS_SET_FUNCS(crypto_keyfail);
+VDEV_CP_STATS_SET_FUNCS(ibss_capmismatch);
+VDEV_CP_STATS_SET_FUNCS(ps_unassoc);
+VDEV_CP_STATS_SET_FUNCS(ps_aid_err);
+VDEV_CP_STATS_SET_FUNCS(tx_offchan_mgmt);
+VDEV_CP_STATS_SET_FUNCS(tx_offchan_data);
+VDEV_CP_STATS_SET_FUNCS(tx_offchan_fail);
+VDEV_CP_STATS_SET_FUNCS(invalid_macaddr_nodealloc_fail);
+VDEV_CP_STATS_SET_FUNCS(tx_bcn_success);
+VDEV_CP_STATS_SET_FUNCS(tx_bcn_outage);
+VDEV_CP_STATS_SET_FUNCS(sta_xceed_rlim);
+VDEV_CP_STATS_SET_FUNCS(sta_xceed_vlim);
+VDEV_CP_STATS_SET_FUNCS(mlme_auth_attempt);
+VDEV_CP_STATS_SET_FUNCS(mlme_auth_success);
+VDEV_CP_STATS_SET_FUNCS(authorize_attempt);
+VDEV_CP_STATS_SET_FUNCS(authorize_success);
+
+#define VDEV_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ vdev_cp_stats_##field##_get(struct wlan_objmgr_vdev *_vdev) \
+ { \
+ return ucfg_vdev_cp_stats_##field##_get(_vdev); \
+ }
+
+VDEV_CP_STATS_GET_FUNCS(rx_wrongbss);
+VDEV_CP_STATS_GET_FUNCS(rx_wrongdir);
+VDEV_CP_STATS_GET_FUNCS(rx_ssid_mismatch);
+
+static inline void vdev_cp_stats_reset(struct wlan_objmgr_vdev *vdev)
+{
+ struct vdev_cp_stats *vdev_cps;
+ struct vdev_ic_cp_stats *vdev_cs;
+
+ if (!vdev)
+ return;
+
+ vdev_cps = wlan_cp_stats_get_vdev_stats_obj(vdev);
+ if (!vdev_cps)
+ return;
+
+ vdev_cs = vdev_cps->vdev_stats;
+ qdf_mem_set(vdev_cs, sizeof(struct vdev_ic_cp_stats), 0x0);
+}
+
+#define PDEV_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ pdev_cp_stats_##field##_inc(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ ucfg_pdev_cp_stats_##field##_inc(_pdev, _val); \
+ } \
+ static inline void \
+ pdev_cp_stats_##field##_update(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ ucfg_pdev_cp_stats_##field##_update(_pdev, _val); \
+ }
+
+PDEV_CP_STATS_SET_FUNCS(tx_beacon);
+PDEV_CP_STATS_SET_FUNCS(be_nobuf);
+PDEV_CP_STATS_SET_FUNCS(tx_buf_count);
+PDEV_CP_STATS_SET_FUNCS(tx_mgmt);
+PDEV_CP_STATS_SET_FUNCS(rx_mgmt);
+PDEV_CP_STATS_SET_FUNCS(rx_num_mgmt);
+PDEV_CP_STATS_SET_FUNCS(rx_num_ctl);
+PDEV_CP_STATS_SET_FUNCS(tx_rssi);
+PDEV_CP_STATS_SET_FUNCS(rx_rssi_comb);
+PDEV_CP_STATS_SET_FUNCS(rx_overrun);
+PDEV_CP_STATS_SET_FUNCS(rx_phy_err);
+PDEV_CP_STATS_SET_FUNCS(rx_ack_err);
+PDEV_CP_STATS_SET_FUNCS(rx_rts_err);
+PDEV_CP_STATS_SET_FUNCS(rx_rts_success);
+PDEV_CP_STATS_SET_FUNCS(no_beacons);
+PDEV_CP_STATS_SET_FUNCS(mib_int_count);
+PDEV_CP_STATS_SET_FUNCS(rx_looplimit_start);
+PDEV_CP_STATS_SET_FUNCS(rx_looplimit_end);
+PDEV_CP_STATS_SET_FUNCS(ap_stats_tx_cal_enable);
+PDEV_CP_STATS_SET_FUNCS(tgt_asserts);
+PDEV_CP_STATS_SET_FUNCS(chan_nf);
+PDEV_CP_STATS_SET_FUNCS(chan_nf_sec80);
+PDEV_CP_STATS_SET_FUNCS(wmi_tx_mgmt);
+PDEV_CP_STATS_SET_FUNCS(wmi_tx_mgmt_completions);
+PDEV_CP_STATS_SET_FUNCS(wmi_tx_mgmt_completion_err);
+PDEV_CP_STATS_SET_FUNCS(peer_delete_req);
+PDEV_CP_STATS_SET_FUNCS(peer_delete_resp);
+PDEV_CP_STATS_SET_FUNCS(rx_mgmt_rssi_drop);
+PDEV_CP_STATS_SET_FUNCS(tx_retries);
+PDEV_CP_STATS_SET_FUNCS(tx_frame_count);
+PDEV_CP_STATS_SET_FUNCS(rx_frame_count);
+PDEV_CP_STATS_SET_FUNCS(rx_clear_count);
+PDEV_CP_STATS_SET_FUNCS(cycle_count);
+PDEV_CP_STATS_SET_FUNCS(phy_err_count);
+PDEV_CP_STATS_SET_FUNCS(chan_tx_pwr);
+
+#define PDEV_CHAN_STATS_GET_FUNCS(field) \
+ static inline uint32_t \
+ pdev_chan_stats_##field##_get(struct wlan_objmgr_pdev *_pdev) \
+ { \
+ return ucfg_pdev_chan_stats_##field##_get(_pdev); \
+ }
+
+PDEV_CHAN_STATS_GET_FUNCS(self_bss_util);
+PDEV_CHAN_STATS_GET_FUNCS(obss_util);
+PDEV_CHAN_STATS_GET_FUNCS(obss_rx_util);
+PDEV_CHAN_STATS_GET_FUNCS(ap_rx_util);
+PDEV_CHAN_STATS_GET_FUNCS(ap_tx_util);
+PDEV_CHAN_STATS_GET_FUNCS(free_medium);
+PDEV_CHAN_STATS_GET_FUNCS(non_wifi_util);
+PDEV_CHAN_STATS_GET_FUNCS(ss_under_util);
+PDEV_CHAN_STATS_GET_FUNCS(sec_20_util);
+PDEV_CHAN_STATS_GET_FUNCS(sec_40_util);
+PDEV_CHAN_STATS_GET_FUNCS(sec_80_util);
+
+#define PDEV_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ pdev_cp_stats_##field##_get(struct wlan_objmgr_pdev *_pdev) \
+ { \
+ return ucfg_pdev_cp_stats_##field##_get(_pdev); \
+ }
+
+PDEV_CP_STATS_GET_FUNCS(tx_mgmt);
+PDEV_CP_STATS_GET_FUNCS(rx_num_mgmt);
+PDEV_CP_STATS_GET_FUNCS(ap_stats_tx_cal_enable);
+PDEV_CP_STATS_GET_FUNCS(wmi_tx_mgmt);
+PDEV_CP_STATS_GET_FUNCS(wmi_tx_mgmt_completions);
+PDEV_CP_STATS_GET_FUNCS(wmi_tx_mgmt_completion_err);
+PDEV_CP_STATS_GET_FUNCS(tgt_asserts);
+PDEV_CP_STATS_GET_FUNCS(rx_phy_err);
+PDEV_CP_STATS_GET_FUNCS(fcsbad);
+
+static inline void pdev_cp_stats_reset(struct wlan_objmgr_pdev *pdev)
+{
+ ucfg_pdev_cp_stats_reset(pdev);
+}
+
+#define PDEV_LMAC_CP_STATS_SET_FUNCS(field) \
+ static inline void \
+ pdev_lmac_cp_stats_##field##_inc(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ ucfg_pdev_lmac_cp_stats_##field##_inc(_pdev, _val); \
+ } \
+ static inline void \
+ pdev_lmac_cp_stats_##field##_update(struct wlan_objmgr_pdev *_pdev, \
+ uint64_t _val) \
+ { \
+ ucfg_pdev_lmac_cp_stats_##field##_update(_pdev, _val); \
+ }
+
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_reset_on_error);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_hardware);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_halresets);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_bmiss);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_brssi);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_fifoerr);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_filtered);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_noack);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_shortpre);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_altrate);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_tx_protect);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_rx_nobuf);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_rx_hal_in_progress);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_rx_num_unknown);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_per_cal);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_per_calfail);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_per_rfgain);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_ant_defswitch);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_bb_hang);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_mac_hang);
+#ifdef ATH_WOW
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_wow_wakeups);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_wow_wakeupsok);
+#endif
+#ifdef ATH_SUPPORT_CFEND
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_cfend_sched);
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_cfend_sent);
+#endif
+PDEV_LMAC_CP_STATS_SET_FUNCS(ast_noise_floor);
+
+#define PDEV_LMAC_CP_STATS_GET_FUNCS(field) \
+ static inline uint64_t \
+ pdev_lmac_cp_stats_##field##_get(struct wlan_objmgr_pdev *_pdev) \
+ { \
+ return ucfg_pdev_lmac_cp_stats_##field##_get(_pdev); \
+ }
+PDEV_LMAC_CP_STATS_GET_FUNCS(ast_tx_fifoerr);
+PDEV_LMAC_CP_STATS_GET_FUNCS(ast_tx_filtered);
+PDEV_LMAC_CP_STATS_GET_FUNCS(ast_noise_floor);
+
+/**
+ * wlan_get_pdev_cp_stats_ref() - API to reference to pdev cp stats object
+ * @pdev: pointer to pdev object
+ *
+ * Return: pdev_ic_cp_stats or NULL
+ */
+struct pdev_ic_cp_stats
+*wlan_get_pdev_cp_stats_ref(struct wlan_objmgr_pdev *pdev);
+
+#endif /* QCA_SUPPORT_CP_STATS */
+#endif /* __WLAN_CP_STATS_IC_UTILS_API_H__ */
diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_acs_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_acs_api.c
new file mode 100644
index 0000000..7e93ba9
--- /dev/null
+++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_acs_api.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_ic_acs_api.c
+ *
+ * This file holds definition for APIs of ACS specific to ic
+ */
diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_dcs_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_dcs_api.c
new file mode 100644
index 0000000..2abd733
--- /dev/null
+++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_dcs_api.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_cp_stats_ic_dcs_api.c
+ *
+ * This file provides definitions for APIs exposed to get and set DCS related
+ * control plane statistics
+ */
diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_tgt_api.c
new file mode 100644
index 0000000..1643728
--- /dev/null
+++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_tgt_api.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC:wlan_cp_stats_ic_tgt_api.c
+ *
+ * This file provide API definitions to update control plane statistics received
+ * from southbound interface
+ */
+#include <wlan_cp_stats_ic_atf_defs.h>
+#include <wlan_cp_stats_tgt_api.h>
+
+void tgt_cp_stats_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
+{
+}
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
new file mode 100644
index 0000000..5dafe91
--- /dev/null
+++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_ic_ucfg_api.c
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC:wlan_cp_stats_ic_ucfg_api.c
+ *
+ * This file provide APIs definition for registering cp stats cfg80211 command
+ * handlers
+ */
+#include <wlan_cp_stats_ic_ucfg_api.h>
+#include <wlan_cfg80211_ic_cp_stats.h>
+#ifdef WLAN_ATF_ENABLE
+#include <wlan_cp_stats_ic_atf_defs.h>
+#endif
+#include <wlan_cp_stats_ic_defs.h>
+#include <wlan_cp_stats_ic_dcs_defs.h>
+#include <umac/cp_stats/core/src/wlan_cp_stats_cmn_api_i.h>
+#include <qdf_module.h>
+
+QDF_STATUS wlan_cp_stats_psoc_cs_init(struct psoc_cp_stats *psoc_cs)
+{
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_cp_stats_psoc_cs_deinit(struct psoc_cp_stats *psoc_cs)
+{
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_cp_stats_pdev_cs_init(struct pdev_cp_stats *pdev_cs)
+{
+ pdev_cs->pdev_stats = qdf_mem_malloc(sizeof(struct pdev_ic_cp_stats));
+ if (!pdev_cs->pdev_stats) {
+ cp_stats_err("malloc failed");
+ return QDF_STATUS_E_NOMEM;
+ }
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_cp_stats_pdev_cs_deinit(struct pdev_cp_stats *pdev_cs)
+{
+ qdf_mem_free(pdev_cs->pdev_stats);
+ pdev_cs->pdev_stats = NULL;
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_cp_stats_vdev_cs_init(struct vdev_cp_stats *vdev_cs)
+{
+ vdev_cs->vdev_stats = qdf_mem_malloc(sizeof(struct vdev_ic_cp_stats));
+ if (!vdev_cs->vdev_stats) {
+ cp_stats_err("malloc failed");
+ return QDF_STATUS_E_NOMEM;
+ }
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_cp_stats_vdev_cs_deinit(struct vdev_cp_stats *vdev_cs)
+{
+ qdf_mem_free(vdev_cs->vdev_stats);
+ vdev_cs->vdev_stats = NULL;
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_cp_stats_peer_cs_init(struct peer_cp_stats *peer_cs)
+{
+ peer_cs->peer_stats = qdf_mem_malloc(sizeof(struct peer_ic_cp_stats));
+ if (!peer_cs->peer_stats) {
+ cp_stats_err("malloc failed");
+ return QDF_STATUS_E_NOMEM;
+ }
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_cp_stats_peer_cs_deinit(struct peer_cp_stats *peer_cs)
+{
+ qdf_mem_free(peer_cs->peer_stats);
+ peer_cs->peer_stats = NULL;
+ return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_ucfg_get_peer_cp_stats(struct wlan_objmgr_peer *peer,
+ struct peer_ic_cp_stats *peer_cps)
+{
+ struct peer_cp_stats *peer_cs;
+
+ if (!peer) {
+ cp_stats_err("Invalid input fields, peer obj is NULL");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (!peer_cps) {
+ cp_stats_err("Invalid input fields, peer cp obj is NULL");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ peer_cs = wlan_cp_stats_get_peer_stats_obj(peer);
+ if (peer_cs && peer_cs->peer_stats) {
+ wlan_cp_stats_peer_obj_lock(peer_cs);
+ qdf_mem_copy(peer_cps, peer_cs->peer_stats,
+ sizeof(struct peer_ic_cp_stats));
+ wlan_cp_stats_peer_obj_unlock(peer_cs);
+ return QDF_STATUS_SUCCESS;
+ }
+
+ return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wlan_ucfg_get_vdev_cp_stats(struct wlan_objmgr_vdev *vdev,
+ struct vdev_ic_cp_stats *vdev_cps)
+{
+ struct vdev_cp_stats *vdev_cs;
+
+ if (!vdev) {
+ cp_stats_err("Invalid input, vdev obj is null");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (!vdev_cps) {
+ cp_stats_err("Invalid input, vdev cp obj is null");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ vdev_cs = wlan_cp_stats_get_vdev_stats_obj(vdev);
+ if (vdev_cs && vdev_cs->vdev_stats) {
+ wlan_cp_stats_vdev_obj_lock(vdev_cs);
+ qdf_mem_copy(vdev_cps, vdev_cs->vdev_stats,
+ sizeof(*vdev_cps));
+ wlan_cp_stats_vdev_obj_unlock(vdev_cs);
+ return QDF_STATUS_SUCCESS;
+ }
+
+ return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wlan_ucfg_get_pdev_cp_stats(struct wlan_objmgr_pdev *pdev,
+ struct pdev_ic_cp_stats *pdev_cps)
+{
+ struct pdev_cp_stats *pdev_cs;
+
+ if (!pdev) {
+ cp_stats_err("Invalid input, pdev obj is null");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (!pdev_cps) {
+ cp_stats_err("Invalid input, pdev cp obj is null");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ pdev_cs = wlan_cp_stats_get_pdev_stats_obj(pdev);
+ if (pdev_cs && pdev_cs->pdev_stats) {
+ wlan_cp_stats_pdev_obj_lock(pdev_cs);
+ qdf_mem_copy(pdev_cps, pdev_cs->pdev_stats,
+ sizeof(*pdev_cps));
+ wlan_cp_stats_pdev_obj_unlock(pdev_cs);
+ return QDF_STATUS_SUCCESS;
+ }
+
+ return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wlan_ucfg_get_pdev_hw_cp_stats(struct wlan_objmgr_pdev *pdev,
+ struct pdev_hw_stats *hw_stats)
+{
+ struct pdev_cp_stats *pdev_cs;
+ struct pdev_ic_cp_stats *pdev_cps;
+
+ if (!pdev) {
+ cp_stats_err("Invalid input, pdev obj is null");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (!hw_stats) {
+ cp_stats_err("Invalid input, pdev hw_stats is null");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ pdev_cs = wlan_cp_stats_get_pdev_stats_obj(pdev);
+ if (pdev_cs && pdev_cs->pdev_stats) {
+ pdev_cps = pdev_cs->pdev_stats;
+ wlan_cp_stats_pdev_obj_lock(pdev_cs);
+ qdf_mem_copy(hw_stats, &pdev_cps->stats.hw_stats,
+ sizeof(*hw_stats));
+ wlan_cp_stats_pdev_obj_unlock(pdev_cs);
+ return QDF_STATUS_SUCCESS;
+ }
+
+ return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wlan_ucfg_set_pdev_hw_cp_stats(struct wlan_objmgr_pdev *pdev,
+ struct pdev_hw_stats *hw_stats)
+{
+ struct pdev_cp_stats *pdev_cs;
+ struct pdev_ic_cp_stats *pdev_cps;
+
+ if (!pdev) {
+ cp_stats_err("Invalid input, pdev obj is null");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (!hw_stats) {
+ cp_stats_err("Invalid input, pdev hw_stats is null");
+ return QDF_STATUS_E_INVAL;
+ }
+
+ pdev_cs = wlan_cp_stats_get_pdev_stats_obj(pdev);
+ if (pdev_cs && pdev_cs->pdev_stats) {
+ pdev_cps = pdev_cs->pdev_stats;
+ wlan_cp_stats_pdev_obj_lock(pdev_cs);
+ qdf_mem_copy(&pdev_cps->stats.hw_stats, hw_stats,
+ sizeof(*hw_stats));
+ wlan_cp_stats_pdev_obj_unlock(pdev_cs);
+ return QDF_STATUS_SUCCESS;
+ }
+
+ return QDF_STATUS_E_FAILURE;
+}
+
+struct pdev_ic_cp_stats
+*wlan_ucfg_get_pdev_cp_stats_ref(struct wlan_objmgr_pdev *pdev)
+{
+ struct pdev_cp_stats *pdev_cs = NULL;
+
+ if (!pdev) {
+ cp_stats_err("pdev is null");
+ return NULL;
+ }
+
+ pdev_cs = wlan_cp_stats_get_pdev_stats_obj(pdev);
+ if (pdev_cs && pdev_cs->pdev_stats)
+ return pdev_cs->pdev_stats;
+
+ return NULL;
+}
+
+struct pdev_ic_cp_stats
+*wlan_get_pdev_cp_stats_ref(struct wlan_objmgr_pdev *pdev)
+{
+ return wlan_ucfg_get_pdev_cp_stats_ref(pdev);
+}
+
+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
+
+QDF_STATUS
+wlan_ucfg_get_dcs_chan_stats(struct wlan_objmgr_pdev *pdev,
+ struct pdev_dcs_chan_stats *dcs_chan_stats)
+{
+ return QDF_STATUS_E_INVAL;
+}