Browse Source

qcacld-3.0: Report tim bcn/tim err bcn to userapce

Such statistics are used for power saving feature.
Report to userspace by
QCA_WLAN_VENDOR_ATTR_LL_STATS_TOT_TIM_BCN
QCA_WLAN_VENDOR_ATTR_LL_STATS_TOT_ERR_TIM_BCN

Change-Id: Idc447a53a74429336f5e2d25971a5ac9390fb9f7
CRs-Fixed: 3221119
Jingxiang Ge 2 years ago
parent
commit
8a365296f2

+ 10 - 0
core/hdd/src/wlan_hdd_debugfs_llstat.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -46,6 +47,7 @@ void hdd_debugfs_process_iface_stats(struct hdd_adapter *adapter,
 	wmi_iface_link_stats *link_stats;
 	wmi_wmm_ac_stats *ac_stats;
 	wmi_iface_offload_stats *offload_stats;
+	wmi_iface_powersave_stats *powersave_stats;
 	uint64_t average_tsf_offset;
 	int i;
 	ssize_t len = 0;
@@ -147,6 +149,14 @@ void hdd_debugfs_process_iface_stats(struct hdd_adapter *adapter,
 				offload_stats->fwd_count);
 	}
 
+	powersave_stats = &iface_stat->powersave_stats;
+	buffer += len;
+	ll_stats.len += len;
+	len = scnprintf(buffer, DEBUGFS_LLSTATS_BUF_SIZE - ll_stats.len,
+			"\ntot_tim_bcn: %u tot_err_tim_bcn: %u",
+			powersave_stats->tot_tim_bcn,
+			powersave_stats->tot_err_tim_bcn);
+
 	ll_stats.len += len;
 	mutex_unlock(&llstats_mutex);
 	hdd_exit();

+ 11 - 0
core/hdd/src/wlan_hdd_stats.c

@@ -819,6 +819,17 @@ static bool put_wifi_iface_stats(struct wifi_interface_stats *if_stat,
 		nla_nest_end(vendor_event, wmm_stats);
 	}
 	nla_nest_end(vendor_event, wmm_info);
+
+	if (nla_put_u32(vendor_event,
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_TIM_BEACON,
+			if_stat->powersave_stats.tot_tim_bcn) ||
+	    nla_put_u32(vendor_event,
+			QCA_WLAN_VENDOR_ATTR_LL_STATS_TIM_BEACON_ERR,
+			if_stat->powersave_stats.tot_err_tim_bcn)) {
+		hdd_err("QCA_WLAN_VENDOR_ATTR put powersave_stat fail");
+		return false;
+	}
+
 	return true;
 }
 

+ 2 - 0
core/mac/inc/sir_api.h

@@ -3144,6 +3144,7 @@ struct wifi_peer_info {
  * @ac_stats: per-Access Category statistics
  * @num_offload_stats: @offload_stats record count
  * @offload_stats: per-offload statistics
+ * @powersave_stats: powersave statistics
  * @vdev_id: vdev id
  *
  * Statistics corresponding to 2nd most LSB in wifi statistics bitmap
@@ -3159,6 +3160,7 @@ struct wifi_interface_stats {
 	wmi_wmm_ac_stats ac_stats[WIFI_AC_MAX];
 	uint32_t num_offload_stats;
 	wmi_iface_offload_stats offload_stats[WMI_OFFLOAD_STATS_TYPE_MAX];
+	wmi_iface_powersave_stats powersave_stats;
 	uint8_t vdev_id;
 };
 

+ 5 - 0
core/wma/src/wma_utils.c

@@ -2755,6 +2755,7 @@ int wma_unified_link_iface_stats_event_handler(void *handle,
 	wmi_iface_link_stats *link_stats, *iface_link_stats;
 	wmi_wmm_ac_stats *ac_stats, *iface_ac_stats;
 	wmi_iface_offload_stats *offload_stats, *iface_offload_stats;
+	wmi_iface_powersave_stats *powersave_stats;
 	tSirLLStatsResults *link_stats_results;
 	struct wifi_interface_stats *iface_stat;
 	uint32_t count;
@@ -2888,6 +2889,10 @@ int wma_unified_link_iface_stats_event_handler(void *handle,
 		iface_offload_stats++;
 	}
 
+	powersave_stats = param_tlvs->iface_powersave_stats;
+	if (powersave_stats)
+		iface_stat->powersave_stats = *powersave_stats;
+
 	/* Copying vdev_id info into the iface_stat for MLO*/
 	iface_stat->vdev_id = fixed_param->vdev_id;