diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 5142074fdf27..affa3c5d8237 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -114,6 +114,7 @@ #include "wifi_pos_api.h" #include "wlan_hdd_spectralscan.h" #include "wlan_ipa_ucfg_api.h" +#include "wlan_cfg80211_mc_cp_stats.h" #define g_mode_rates_size (12) #define a_mode_rates_size (8) @@ -10942,6 +10943,7 @@ static int wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy, #undef BPF_PROGRAM #undef BPF_MAX +#ifndef QCA_SUPPORT_CP_STATS /** * define short names for the global vendor params * used by wlan_hdd_cfg80211_wakelock_stats_rsp_callback() @@ -10993,8 +10995,6 @@ static int wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy, #define PARAM_PNO_MATCH_CNT \ QCA_WLAN_VENDOR_ATTR_PNO_MATCH_CNT - - /** * hdd_send_wakelock_stats() - API to send wakelock stats * @ctx: context to be passed to callback @@ -11122,6 +11122,41 @@ nla_put_failure: kfree_skb(skb); return -EINVAL; } +#endif + +#ifdef QCA_SUPPORT_CP_STATS +static int wlan_hdd_process_wake_lock_stats(struct hdd_context *hdd_ctx) +{ + return wlan_cfg80211_mc_cp_stats_get_wakelock_stats(hdd_ctx->hdd_psoc, + hdd_ctx->wiphy); +} +#else +/** + * wlan_hdd_process_wake_lock_stats() - wrapper function to absract cp_stats + * or legacy get_wake_lock_stats API. + * @hdd_ctx: pointer to hdd_ctx + * + * Return: 0 on success; error number otherwise. + */ +static int wlan_hdd_process_wake_lock_stats(struct hdd_context *hdd_ctx) +{ + int ret; + QDF_STATUS qdf_status; + struct sir_wake_lock_stats wake_lock_stats = {0}; + + qdf_status = wma_get_wakelock_stats(&wake_lock_stats); + if (qdf_status != QDF_STATUS_SUCCESS) { + hdd_err("failed to get wakelock stats(err=%d)", qdf_status); + return -EINVAL; + } + + ret = hdd_send_wakelock_stats(hdd_ctx, &wake_lock_stats); + if (ret) + hdd_err("Failed to post wake lock stats"); + + return ret; +} +#endif /** * __wlan_hdd_cfg80211_get_wakelock_stats() - gets wake lock stats @@ -11142,10 +11177,8 @@ static int __wlan_hdd_cfg80211_get_wakelock_stats(struct wiphy *wiphy, const void *data, int data_len) { + int ret; struct hdd_context *hdd_ctx = wiphy_priv(wiphy); - int status, ret; - struct sir_wake_lock_stats wake_lock_stats; - QDF_STATUS qdf_status; hdd_enter(); @@ -11154,21 +11187,11 @@ static int __wlan_hdd_cfg80211_get_wakelock_stats(struct wiphy *wiphy, return -EINVAL; } - status = wlan_hdd_validate_context(hdd_ctx); - if (0 != status) + ret = wlan_hdd_validate_context(hdd_ctx); + if (0 != ret) return -EINVAL; - qdf_status = wma_get_wakelock_stats(&wake_lock_stats); - if (qdf_status != QDF_STATUS_SUCCESS) { - hdd_err("failed to get wakelock stats(err=%d)", qdf_status); - return -EINVAL; - } - - ret = hdd_send_wakelock_stats(hdd_ctx, - &wake_lock_stats); - if (ret) - hdd_err("Failed to post wake lock stats"); - + ret = wlan_hdd_process_wake_lock_stats(hdd_ctx); hdd_exit(); return ret; } diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 13c44219bab9..d0b3166de5bc 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -104,6 +104,7 @@ #include "wlan_hdd_regulatory.h" #include "wlan_reg_ucfg_api.h" #include "wlan_hdd_packet_filter_api.h" +#include "wlan_cp_stats_mc_ucfg_api.h" #define HDD_FINISH_ULA_TIME_OUT 800 #define HDD_SET_MCBC_FILTERS_TO_FW 1 @@ -3108,6 +3109,45 @@ void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length, * * Return - length of written content, negative number on error */ +#ifdef QCA_SUPPORT_CP_STATS +static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx, + char *buffer, uint16_t max_len) +{ + int ret; + QDF_STATUS status; + struct suspend_resume_stats *sr_stats; + + sr_stats = &hdd_ctx->suspend_resume_stats; + ret = scnprintf(buffer, max_len, + "\n" + "Suspends: %u\n" + "Resumes: %u\n" + "\n" + "Suspend Fail Reasons\n" + "\tIPA: %u\n" + "\tRadar: %u\n" + "\tRoam: %u\n" + "\tScan: %u\n" + "\tInitial Wakeup: %u\n" + "\n", + sr_stats->suspends, sr_stats->resumes, + sr_stats->suspend_fail[SUSPEND_FAIL_IPA], + sr_stats->suspend_fail[SUSPEND_FAIL_RADAR], + sr_stats->suspend_fail[SUSPEND_FAIL_ROAM], + sr_stats->suspend_fail[SUSPEND_FAIL_SCAN], + sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]); + + status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->hdd_psoc, + &buffer[ret], max_len - ret, + &ret); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to get WoW stats"); + return qdf_status_to_os_return(status); + } + + return ret; +} +#else static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx, char *buffer, uint16_t max_len) { @@ -3172,7 +3212,7 @@ static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx, wow_stats.wow_pno_complete_wake_up_count, wow_stats.wow_pno_match_wake_up_count); } - +#endif /** * hdd_wlan_list_fw_profile() - Get fw profiling points * @length: Size of the data copied diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 5d8a75e9b8b6..32ada43d7855 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -6205,6 +6205,7 @@ struct sir_bpf_get_offload { uint32_t remaining_bytes_for_bpf_inst; }; +#ifndef QCA_SUPPORT_CP_STATS /** * struct sir_wake_lock_stats - wake lock stats structure * @wow_unspecified_wake_up_count: number of non-wow related wake ups @@ -6283,6 +6284,7 @@ struct sir_vdev_wow_stats { uint32_t pwr_save_fail_detected; uint32_t scan_11d; }; +#endif /** * enum ht_capability_fields - HT Capabilities bit fields diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index c989166683f6..3dcd50dab388 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -1125,7 +1125,9 @@ struct wma_txrx_node { tSirHostOffloadReq arp_offload_req; tSirHostOffloadReq ns_offload_req; bool is_vdev_valid; +#ifndef QCA_SUPPORT_CP_STATS struct sir_vdev_wow_stats wow_stats; +#endif struct sme_rcpi_req *rcpi_req; #ifdef WLAN_FEATURE_11AX bool he_capable; diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h index baef2035a653..38bed6013c67 100644 --- a/core/wma/inc/wma_api.h +++ b/core/wma/inc/wma_api.h @@ -229,7 +229,9 @@ bool wma_is_p2p_lo_capable(void); bool wma_capability_enhanced_mcast_filter(void); QDF_STATUS wma_p2p_lo_start(struct sir_p2p_lo_start *params); QDF_STATUS wma_p2p_lo_stop(u_int32_t vdev_id); +#ifndef QCA_SUPPORT_CP_STATS QDF_STATUS wma_get_wakelock_stats(struct sir_wake_lock_stats *wake_lock_stats); +#endif void wma_process_pdev_hw_mode_trans_ind(void *wma, wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param, wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry, diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 7915b3e7e7fd..6d5077b84ca4 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -73,6 +73,7 @@ #include #include "wlan_reg_services_api.h" #include "wlan_roam_debug.h" +#include #ifndef ARRAY_LENGTH #define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0])) @@ -86,7 +87,7 @@ #define WMA_SET_VDEV_IE_SOURCE_HOST 0x0 -#ifdef FEATURE_WLAN_DIAG_SUPPORT +#if defined(FEATURE_WLAN_DIAG_SUPPORT) /** * qdf_wma_wow_wakeup_stats_event()- send wow wakeup stats * @tp_wma_handle wma: WOW wakeup packet counter @@ -95,6 +96,41 @@ * * Return: void. */ +#ifdef QCA_SUPPORT_CP_STATS +static inline void qdf_wma_wow_wakeup_stats_event(tp_wma_handle wma) +{ + QDF_STATUS status; + struct wake_lock_stats stats = {0}; + + WLAN_HOST_DIAG_EVENT_DEF(wow_stats, + struct host_event_wlan_powersave_wow_stats); + + status = ucfg_mc_cp_stats_get_psoc_wake_lock_stats(wma->psoc, &stats); + if (QDF_IS_STATUS_ERROR(status)) + return; + qdf_mem_zero(&wow_stats, sizeof(wow_stats)); + + wow_stats.wow_bcast_wake_up_count = stats.bcast_wake_up_count; + wow_stats.wow_ipv4_mcast_wake_up_count = stats.ipv4_mcast_wake_up_count; + wow_stats.wow_ipv6_mcast_wake_up_count = stats.ipv6_mcast_wake_up_count; + wow_stats.wow_ipv6_mcast_ra_stats = stats.ipv6_mcast_ra_stats; + wow_stats.wow_ipv6_mcast_ns_stats = stats.ipv6_mcast_ns_stats; + wow_stats.wow_ipv6_mcast_na_stats = stats.ipv6_mcast_na_stats; + wow_stats.wow_pno_match_wake_up_count = stats.pno_match_wake_up_count; + wow_stats.wow_pno_complete_wake_up_count = + stats.pno_complete_wake_up_count; + wow_stats.wow_gscan_wake_up_count = stats.gscan_wake_up_count; + wow_stats.wow_low_rssi_wake_up_count = stats.low_rssi_wake_up_count; + wow_stats.wow_rssi_breach_wake_up_count = + stats.rssi_breach_wake_up_count; + wow_stats.wow_icmpv4_count = stats.icmpv4_count; + wow_stats.wow_icmpv6_count = stats.icmpv6_count; + wow_stats.wow_oem_response_wake_up_count = + stats.oem_response_wake_up_count; + + WLAN_HOST_DIAG_EVENT_REPORT(&wow_stats, EVENT_WLAN_POWERSAVE_WOW_STATS); +} +#else /* QCA_SUPPORT_CP_STATS*/ static inline void qdf_wma_wow_wakeup_stats_event(tp_wma_handle wma) { QDF_STATUS status; @@ -139,6 +175,7 @@ static inline void qdf_wma_wow_wakeup_stats_event(tp_wma_handle wma) WLAN_HOST_DIAG_EVENT_REPORT(&WowStats, EVENT_WLAN_POWERSAVE_WOW_STATS); } +#endif /* QCA_SUPPORT_CP_STATS */ #else static inline void qdf_wma_wow_wakeup_stats_event(tp_wma_handle wma) { @@ -1622,6 +1659,66 @@ static const u8 *wma_wow_wake_reason_str(A_INT32 wake_reason) } } +#ifdef QCA_SUPPORT_CP_STATS +static void wma_inc_wow_stats(t_wma_handle *wma, + WOW_EVENT_INFO_fixed_param *wake_info) +{ + ucfg_mc_cp_stats_inc_wake_lock_stats(wma->psoc, + wake_info->vdev_id, + wake_info->wake_reason); +} + +static void wma_wow_stats_display(struct wake_lock_stats *stats) +{ + WMA_LOGA("uc %d bc %d v4_mc %d v6_mc %d ra %d ns %d na %d pno_match %d pno_complete %d gscan %d low_rssi %d rssi_breach %d icmp %d icmpv6 %d oem %d", + stats->ucast_wake_up_count, + stats->bcast_wake_up_count, + stats->ipv4_mcast_wake_up_count, + stats->ipv6_mcast_wake_up_count, + stats->ipv6_mcast_ra_stats, + stats->ipv6_mcast_ns_stats, + stats->ipv6_mcast_na_stats, + stats->pno_match_wake_up_count, + stats->pno_complete_wake_up_count, + stats->gscan_wake_up_count, + stats->low_rssi_wake_up_count, + stats->rssi_breach_wake_up_count, + stats->icmpv4_count, + stats->icmpv6_count, + stats->oem_response_wake_up_count); +} + +static void wma_print_wow_stats(t_wma_handle *wma, + WOW_EVENT_INFO_fixed_param *wake_info) +{ + struct wlan_objmgr_vdev *vdev; + struct wake_lock_stats stats = {0}; + + switch (wake_info->wake_reason) { + case WOW_REASON_BPF_ALLOW: + case WOW_REASON_PATTERN_MATCH_FOUND: + case WOW_REASON_RA_MATCH: + case WOW_REASON_NLOD: + case WOW_REASON_NLO_SCAN_COMPLETE: + case WOW_REASON_LOW_RSSI: + case WOW_REASON_EXTSCAN: + case WOW_REASON_RSSI_BREACH_EVENT: + case WOW_REASON_OEM_RESPONSE_EVENT: + case WOW_REASON_CHIP_POWER_FAILURE_DETECT: + case WOW_REASON_11D_SCAN: + break; + default: + return; + } + + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(wma->psoc, + wake_info->vdev_id, + WLAN_LEGACY_WMA_ID); + ucfg_mc_cp_stats_get_vdev_wake_lock_stats(vdev, &stats); + wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID); + wma_wow_stats_display(&stats); +} +#else /** * wma_wow_stats_display() - display wow wake up stats * @stats: per vdev stats counters @@ -1723,6 +1820,7 @@ static void wma_inc_wow_stats(t_wma_handle *wma, break; } } +#endif #ifdef FEATURE_WLAN_EXTSCAN /** @@ -2187,36 +2285,33 @@ static void wma_log_pkt_tcpv6(uint8_t *data, uint32_t length) WMA_LOGD("TCP_seq_num: %u", qdf_cpu_to_be16(seq_num)); } -/** - * wma_wow_parse_data_pkt() - API to parse data buffer for data - * packet that resulted in WOW wakeup. - * @stats: per-vdev stats for tracking packet types - * @data: Pointer to data buffer - * @length: data buffer length - * - * This function parses the data buffer received (first few bytes of - * skb->data) to get informaton like src mac addr, dst mac addr, packet - * len, seq_num, etc. It also increments stats for different packet types. - * - * Return: void - */ -static void wma_wow_parse_data_pkt(struct sir_vdev_wow_stats *stats, - uint8_t *data, - uint32_t length) +#ifdef QCA_SUPPORT_CP_STATS +static void wma_wow_inc_wake_lock_stats_by_dst_addr(t_wma_handle *wma, + uint8_t vdev_id, + uint8_t *dest_mac) { - enum qdf_proto_subtype proto_subtype; - const char *proto_subtype_name; - uint8_t *dest_mac; - uint8_t *src_mac; + ucfg_mc_cp_stats_inc_wake_lock_stats_by_dst_addr(wma->psoc, + vdev_id, + dest_mac); +} - WMA_LOGD("packet length: %u", length); - if (length < QDF_NBUF_TRAC_IPV4_OFFSET) - return; +static void wma_wow_inc_wake_lock_stats_by_protocol(t_wma_handle *wma, + uint8_t vdev_id, enum qdf_proto_subtype proto_subtype) +{ + ucfg_mc_cp_stats_inc_wake_lock_stats_by_protocol(wma->psoc, + vdev_id, + proto_subtype); +} +#else +static void wma_wow_inc_wake_lock_stats_by_dst_addr(t_wma_handle *wma, + uint8_t vdev_id, + uint8_t *dest_mac) +{ + struct wma_txrx_node *vdev; + struct sir_vdev_wow_stats *stats; - src_mac = data + QDF_NBUF_SRC_MAC_OFFSET; - dest_mac = data + QDF_NBUF_DEST_MAC_OFFSET; - WMA_LOGD("Src_mac: " MAC_ADDRESS_STR ", Dst_mac: " MAC_ADDRESS_STR, - MAC_ADDR_ARRAY(src_mac), MAC_ADDR_ARRAY(dest_mac)); + vdev = &wma->interfaces[vdev_id]; + stats = &vdev->wow_stats; switch (*dest_mac) { case WMA_BCAST_MAC_ADDR: @@ -2232,6 +2327,76 @@ static void wma_wow_parse_data_pkt(struct sir_vdev_wow_stats *stats, stats->ucast++; break; } +} + +static void wma_wow_inc_wake_lock_stats_by_protocol(t_wma_handle *wma, + uint8_t vdev_id, enum qdf_proto_subtype proto_subtype) +{ + struct wma_txrx_node *vdev; + struct sir_vdev_wow_stats *stats; + + vdev = &wma->interfaces[vdev_id]; + stats = &vdev->wow_stats; + + switch (proto_subtype) { + case QDF_PROTO_ICMP_RES: + stats->icmpv4++; + break; + case QDF_PROTO_ICMPV6_REQ: + case QDF_PROTO_ICMPV6_RES: + case QDF_PROTO_ICMPV6_RS: + stats->icmpv6++; + break; + case QDF_PROTO_ICMPV6_RA: + stats->icmpv6++; + stats->ipv6_mcast_ra++; + break; + case QDF_PROTO_ICMPV6_NS: + stats->icmpv6++; + stats->ipv6_mcast_ns++; + break; + case QDF_PROTO_ICMPV6_NA: + stats->icmpv6++; + stats->ipv6_mcast_na++; + break; + default: + break; + } +} +#endif + +/** + * wma_wow_parse_data_pkt() - API to parse data buffer for data + * packet that resulted in WOW wakeup. + * @stats: per-vdev stats for tracking packet types + * @data: Pointer to data buffer + * @length: data buffer length + * + * This function parses the data buffer received (first few bytes of + * skb->data) to get information like src mac addr, dst mac addr, packet + * len, seq_num, etc. It also increments stats for different packet types. + * + * Return: void + */ +static void wma_wow_parse_data_pkt(t_wma_handle *wma, + uint8_t vdev_id, uint8_t *data, + uint32_t length) +{ + uint8_t *src_mac; + uint8_t *dest_mac; + const char *proto_subtype_name; + enum qdf_proto_subtype proto_subtype; + + WMA_LOGD("packet length: %u", length); + if (length < QDF_NBUF_TRAC_IPV4_OFFSET) + return; + + src_mac = data + QDF_NBUF_SRC_MAC_OFFSET; + dest_mac = data + QDF_NBUF_DEST_MAC_OFFSET; + WMA_LOGD("Src_mac: " MAC_ADDRESS_STR ", Dst_mac: " MAC_ADDRESS_STR, + MAC_ADDR_ARRAY(src_mac), MAC_ADDR_ARRAY(dest_mac)); + + wma_wow_inc_wake_lock_stats_by_dst_addr(wma, vdev_id, dest_mac); proto_subtype = wma_wow_get_pkt_proto_subtype(data, length); proto_subtype_name = wma_pkt_proto_subtype_to_string(proto_subtype); @@ -2259,29 +2424,19 @@ static void wma_wow_parse_data_pkt(struct sir_vdev_wow_stats *stats, case QDF_PROTO_ICMP_REQ: case QDF_PROTO_ICMP_RES: - stats->icmpv4++; + wma_wow_inc_wake_lock_stats_by_protocol(wma, vdev_id, + proto_subtype); wma_log_pkt_icmpv4(data, length); break; case QDF_PROTO_ICMPV6_REQ: case QDF_PROTO_ICMPV6_RES: case QDF_PROTO_ICMPV6_RS: - stats->icmpv6++; - wma_log_pkt_icmpv6(data, length); - break; case QDF_PROTO_ICMPV6_RA: - stats->icmpv6++; - stats->ipv6_mcast_ra++; - wma_log_pkt_icmpv6(data, length); - break; case QDF_PROTO_ICMPV6_NS: - stats->icmpv6++; - stats->ipv6_mcast_ns++; - wma_log_pkt_icmpv6(data, length); - break; case QDF_PROTO_ICMPV6_NA: - stats->icmpv6++; - stats->ipv6_mcast_na++; + wma_wow_inc_wake_lock_stats_by_protocol(wma, vdev_id, + proto_subtype); wma_log_pkt_icmpv6(data, length); break; @@ -2312,7 +2467,7 @@ static void wma_wow_parse_data_pkt(struct sir_vdev_wow_stats *stats, * @buf_len: length of data buffer * * This function parses the data buffer received (802.11 header) - * to get informaton like src mac addr, dst mac addr, seq_num, + * to get information like src mac addr, dst mac addr, seq_num, * frag_num, etc. * * Return: void @@ -2533,7 +2688,8 @@ static int wma_wake_event_packet( packet, packet_len); vdev = &wma->interfaces[wake_info->vdev_id]; - wma_wow_parse_data_pkt(&vdev->wow_stats, packet, packet_len); + wma_wow_parse_data_pkt(wma, wake_info->vdev_id, + packet, packet_len); break; default: @@ -2806,7 +2962,6 @@ int wma_wow_wakeup_host_event(void *handle, uint8_t *event, uint32_t len) pmo_ucfg_psoc_wakeup_host_event_received(wma->psoc); wma_print_wow_stats(wma, wake_info); - /* split based on payload type */ if (is_piggybacked_event(wake_info->wake_reason)) errno = wma_wake_event_piggybacked(wma, event_param, len); @@ -2817,7 +2972,6 @@ int wma_wow_wakeup_host_event(void *handle, uint8_t *event, uint32_t len) wma_inc_wow_stats(wma, wake_info); wma_print_wow_stats(wma, wake_info); - wma_acquire_wow_wakelock(wma, wake_info->wake_reason); return errno; @@ -4637,6 +4791,7 @@ int wma_p2p_lo_event_handler(void *handle, uint8_t *event_buf, return 0; } +#ifndef QCA_SUPPORT_CP_STATS /** * wma_get_wakelock_stats() - Populates wake lock stats * @stats: non-null wakelock structure to populate @@ -4694,6 +4849,7 @@ QDF_STATUS wma_get_wakelock_stats(struct sir_wake_lock_stats *stats) return QDF_STATUS_SUCCESS; } +#endif /** * wma_process_fw_test_cmd() - send unit test command to fw. diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 7c50edd21b53..73dec265ac83 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -97,6 +97,7 @@ #include "init_deinit_ucfg.h" #include "target_if_green_ap.h" #include "service_ready_param.h" +#include "wlan_cp_stats_mc_ucfg_api.h" #define WMA_LOG_COMPLETION_TIMER 3000 /* 3 seconds */ #define WMI_TLV_HEADROOM 128 @@ -2073,6 +2074,112 @@ struct wma_version_info g_wmi_version_info; * * Return: None */ +#ifdef QCA_SUPPORT_CP_STATS +static void wma_state_info_dump(char **buf_ptr, uint16_t *size) +{ + uint8_t vdev_id; + uint16_t len = 0; + t_wma_handle *wma; + char *buf = *buf_ptr; + struct wma_txrx_node *iface; + struct wake_lock_stats stats; + struct wlan_objmgr_vdev *vdev; + + wma = cds_get_context(QDF_MODULE_ID_WMA); + if (!wma) { + WMA_LOGE("%s: WMA context is invald!", __func__); + return; + } + + WMA_LOGE("%s: size of buffer: %d", __func__, *size); + + for (vdev_id = 0; vdev_id < wma->max_bssid; vdev_id++) { + iface = &wma->interfaces[vdev_id]; + if (!iface->handle) + continue; + + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(wma->psoc, + vdev_id, WLAN_LEGACY_WMA_ID); + ucfg_mc_cp_stats_get_vdev_wake_lock_stats(vdev, &stats); + len += qdf_scnprintf(buf + len, *size - len, + "\n" + "vdev_id %d\n" + "WoW Stats\n" + "\tpno_match %u\n" + "\tpno_complete %u\n" + "\tgscan %u\n" + "\tlow_rssi %u\n" + "\trssi_breach %u\n" + "\tucast %u\n" + "\tbcast %u\n" + "\ticmpv4 %u\n" + "\ticmpv6 %u\n" + "\tipv4_mcast %u\n" + "\tipv6_mcast %u\n" + "\tipv6_mcast_ra %u\n" + "\tipv6_mcast_ns %u\n" + "\tipv6_mcast_na %u\n" + "\toem_response %u\n" + "conn_state %d\n" + "dtimPeriod %d\n" + "chanmode %d\n" + "vht_capable %d\n" + "ht_capable %d\n" + "chan_width %d\n" + "vdev_active %d\n" + "vdev_up %d\n" + "aid %d\n" + "rate_flags %d\n" + "nss %d\n" + "tx_power %d\n" + "max_tx_power %d\n" + "nwType %d\n" + "tx_streams %d\n" + "rx_streams %d\n" + "chain_mask %d\n" + "nss_2g %d\n" + "nss_5g %d", + vdev_id, + stats.pno_match_wake_up_count, + stats.pno_complete_wake_up_count, + stats.gscan_wake_up_count, + stats.low_rssi_wake_up_count, + stats.rssi_breach_wake_up_count, + stats.ucast_wake_up_count, + stats.bcast_wake_up_count, + stats.icmpv4_count, + stats.icmpv6_count, + stats.ipv4_mcast_wake_up_count, + stats.ipv6_mcast_wake_up_count, + stats.ipv6_mcast_ra_stats, + stats.ipv6_mcast_ns_stats, + stats.ipv6_mcast_na_stats, + stats.oem_response_wake_up_count, + iface->conn_state, + iface->dtimPeriod, + iface->chanmode, + iface->vht_capable, + iface->ht_capable, + iface->chan_width, + iface->vdev_active, + wma_is_vdev_up(vdev_id), + iface->aid, + iface->rate_flags, + iface->nss, + iface->tx_power, + iface->max_tx_power, + iface->nwType, + iface->tx_streams, + iface->rx_streams, + iface->chain_mask, + iface->nss_2g, + iface->nss_5g); + } + + *size -= len; + *buf_ptr += len; +} +#else /* QCA_SUPPORT_CP_STATS */ static void wma_state_info_dump(char **buf_ptr, uint16_t *size) { t_wma_handle *wma; @@ -2174,6 +2281,7 @@ static void wma_state_info_dump(char **buf_ptr, uint16_t *size) *size -= len; *buf_ptr += len; } +#endif /* QCA_SUPPORT_CP_STATS */ /** * wma_register_debug_callback() - registration function for wma layer