瀏覽代碼

qcacld-3.0: Get netdev stats from DP interface

While requesting sta stats, tx/rx netdev stats update are
happening from adapter. But as part of latest code change
these stats are moved from adapter to dp interface, because
of which some of stats values are displayed as 0.

To Fix the issue get tx/rx netdev stats from dp interface,
Also add calls to clear netdev stats

Change-Id: I64523b035c1d902ccc4a45d82f7508751e518150
CRs-Fixed: 3247540
Amit Mehta 2 年之前
父節點
當前提交
f0dd63a14e

+ 25 - 0
components/dp/core/inc/wlan_dp_main.h

@@ -622,4 +622,29 @@ dp_is_low_tput_gro_enable(struct wlan_dp_psoc_context *dp_ctx)
  */
  */
 bool dp_is_data_stall_event_enabled(uint32_t evt);
 bool dp_is_data_stall_event_enabled(uint32_t evt);
 
 
+/*
+ * dp_get_net_dev_stats(): Get netdev stats
+ * @dp_intf: DP interface handle
+ * @stats: To hold netdev stats
+ *
+ * Return: None
+ */
+static inline void
+dp_get_net_dev_stats(struct wlan_dp_intf *dp_intf, qdf_net_dev_stats *stats)
+{
+	qdf_mem_copy(stats, &dp_intf->stats, sizeof(dp_intf->stats));
+}
+
+/*
+ * dp_clear_net_dev_stats(): Clear netdev stats
+ * @dp_intf: DP interface handle
+ *
+ * Return: None
+ */
+static inline
+void dp_clear_net_dev_stats(struct wlan_dp_intf *dp_intf)
+{
+	qdf_mem_set(&dp_intf->stats, sizeof(dp_intf->stats), 0);
+}
+
 #endif
 #endif

+ 19 - 1
components/dp/dispatcher/inc/wlan_dp_ucfg_api.h

@@ -1059,7 +1059,7 @@ uint32_t ucfg_dp_get_bus_bw_compute_interval(struct wlan_objmgr_psoc *psoc);
 int ucfg_dp_get_current_throughput_level(struct wlan_objmgr_psoc *psoc);
 int ucfg_dp_get_current_throughput_level(struct wlan_objmgr_psoc *psoc);
 
 
 /**
 /**
- * ucfg_dp_get_txrx_stats() - get current bandwidth level
+ * ucfg_dp_get_txrx_stats() - get dp txrx stats
  * @vdev: vdev handle
  * @vdev: vdev handle
  * @dp_stats : dp_stats pointer
  * @dp_stats : dp_stats pointer
  *
  *
@@ -1070,6 +1070,24 @@ int ucfg_dp_get_current_throughput_level(struct wlan_objmgr_psoc *psoc);
 QDF_STATUS ucfg_dp_get_txrx_stats(struct wlan_objmgr_vdev *vdev,
 QDF_STATUS ucfg_dp_get_txrx_stats(struct wlan_objmgr_vdev *vdev,
 				  struct dp_tx_rx_stats *dp_stats);
 				  struct dp_tx_rx_stats *dp_stats);
 
 
+/*
+ * ucfg_dp_get_net_dev_stats(): Get netdev stats
+ * @vdev: vdev handle
+ * @stats: To hold netdev stats
+ *
+ * Return: None
+ */
+void ucfg_dp_get_net_dev_stats(struct wlan_objmgr_vdev *vdev,
+			       qdf_net_dev_stats *stats);
+
+/*
+ * ucfg_dp_clear_net_dev_stats(): Clear netdev stats
+ * @dev: Pointer to netdev
+ *
+ * Return: None
+ */
+void ucfg_dp_clear_net_dev_stats(qdf_netdev_t dev);
+
 /**
 /**
  * ucfg_dp_reset_cont_txtimeout_cnt() - Reset Tx Timeout count
  * ucfg_dp_reset_cont_txtimeout_cnt() - Reset Tx Timeout count
  * @vdev: vdev handle
  * @vdev: vdev handle

+ 34 - 0
components/dp/dispatcher/src/wlan_dp_ucfg_api.c

@@ -1969,6 +1969,40 @@ QDF_STATUS ucfg_dp_get_txrx_stats(struct wlan_objmgr_vdev *vdev,
 	return QDF_STATUS_SUCCESS;
 	return QDF_STATUS_SUCCESS;
 }
 }
 
 
+void ucfg_dp_get_net_dev_stats(struct wlan_objmgr_vdev *vdev,
+			       qdf_net_dev_stats *stats)
+{
+	struct wlan_dp_intf *dp_intf;
+
+	dp_intf = dp_get_vdev_priv_obj(vdev);
+	if (unlikely(!dp_intf)) {
+		dp_err_rl("DP interface not found");
+		return;
+	}
+
+	dp_get_net_dev_stats(dp_intf, stats);
+}
+
+void ucfg_dp_clear_net_dev_stats(qdf_netdev_t dev)
+{
+	struct wlan_dp_intf *dp_intf;
+	struct wlan_dp_psoc_context *dp_ctx;
+
+	dp_ctx =  dp_get_context();
+	if (qdf_unlikely(!dp_ctx)) {
+		dp_err_rl("DP context not found");
+		return;
+	}
+
+	dp_intf = dp_get_intf_by_netdev(dp_ctx, dev);
+	if (qdf_unlikely(!dp_intf)) {
+		dp_err_rl("DP interface not found");
+		return;
+	}
+
+	dp_clear_net_dev_stats(dp_intf);
+}
+
 void ucfg_dp_reset_cont_txtimeout_cnt(struct wlan_objmgr_vdev *vdev)
 void ucfg_dp_reset_cont_txtimeout_cnt(struct wlan_objmgr_vdev *vdev)
 {
 {
 	struct wlan_dp_intf *dp_intf = dp_get_vdev_priv_obj(vdev);
 	struct wlan_dp_intf *dp_intf = dp_get_vdev_priv_obj(vdev);

+ 0 - 2
core/hdd/inc/wlan_hdd_main.h

@@ -1070,8 +1070,6 @@ struct hdd_adapter {
 
 
 	unsigned long event_flags;
 	unsigned long event_flags;
 
 
-	/**Device TX/RX statistics*/
-	struct net_device_stats stats;
 	/** HDD statistics*/
 	/** HDD statistics*/
 	struct hdd_stats hdd_stats;
 	struct hdd_stats hdd_stats;
 
 

+ 1 - 2
core/hdd/src/wlan_hdd_hostapd_wext.c

@@ -956,8 +956,7 @@ static __iw_softap_setparam(struct net_device *dev,
 		hdd_debug("QCASAP_CLEAR_STATS val %d", set_value);
 		hdd_debug("QCASAP_CLEAR_STATS val %d", set_value);
 		switch (set_value) {
 		switch (set_value) {
 		case CDP_HDD_STATS:
 		case CDP_HDD_STATS:
-			memset(&adapter->stats, 0,
-						sizeof(adapter->stats));
+			ucfg_dp_clear_net_dev_stats(adapter->dev);
 			memset(&adapter->hdd_stats, 0,
 			memset(&adapter->hdd_stats, 0,
 					sizeof(adapter->hdd_stats));
 					sizeof(adapter->hdd_stats));
 			break;
 			break;

+ 1 - 1
core/hdd/src/wlan_hdd_main.c

@@ -10677,7 +10677,7 @@ int hdd_wlan_clear_stats(struct hdd_adapter *adapter, int stats_id)
 
 
 	switch (stats_id) {
 	switch (stats_id) {
 	case CDP_HDD_STATS:
 	case CDP_HDD_STATS:
-		memset(&adapter->stats, 0, sizeof(adapter->stats));
+		ucfg_dp_clear_net_dev_stats(adapter->dev);
 		memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
 		memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
 		break;
 		break;
 	case CDP_TXRX_HIST_STATS:
 	case CDP_TXRX_HIST_STATS:

+ 17 - 10
core/hdd/src/wlan_hdd_stats.c

@@ -5968,6 +5968,7 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
 	int link_speed_rssi_low = 0;
 	int link_speed_rssi_low = 0;
 	uint32_t link_speed_rssi_report = 0;
 	uint32_t link_speed_rssi_report = 0;
 	struct wlan_objmgr_vdev *vdev;
 	struct wlan_objmgr_vdev *vdev;
+	qdf_net_dev_stats stats = {0};
 
 
 	qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD,
 	qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD,
 		   TRACE_CODE_HDD_CFG80211_GET_STA,
 		   TRACE_CODE_HDD_CFG80211_GET_STA,
@@ -6097,15 +6098,16 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
 		  (int)rx_mcs_index, (int)tx_nss, (int)rx_nss,
 		  (int)rx_mcs_index, (int)tx_nss, (int)rx_nss,
 		  (int)tx_dcm, (int)rx_dcm, (int)tx_gi, (int)rx_gi);
 		  (int)tx_dcm, (int)rx_dcm, (int)tx_gi, (int)rx_gi);
 
 
+	vdev = hdd_objmgr_get_vdev_by_user(adapter,
+					   WLAN_OSIF_STATS_ID);
+	if (!vdev)
+		/* Keep GUI happy */
+		return 0;
+
 	if (!ucfg_mlme_stats_is_link_speed_report_actual(hdd_ctx->psoc)) {
 	if (!ucfg_mlme_stats_is_link_speed_report_actual(hdd_ctx->psoc)) {
 		bool tx_rate_calc, rx_rate_calc;
 		bool tx_rate_calc, rx_rate_calc;
 		uint8_t tx_nss_max, rx_nss_max;
 		uint8_t tx_nss_max, rx_nss_max;
 
 
-		vdev = hdd_objmgr_get_vdev_by_user(adapter,
-						   WLAN_OSIF_STATS_ID);
-		if (!vdev)
-			/* Keep GUI happy */
-			return 0;
 		/*
 		/*
 		 * Take static NSS for reporting max rates. NSS from the FW
 		 * Take static NSS for reporting max rates. NSS from the FW
 		 * is not reliable as it changes as per the environment
 		 * is not reliable as it changes as per the environment
@@ -6113,7 +6115,6 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
 		 */
 		 */
 		tx_nss_max = wlan_vdev_mlme_get_nss(vdev);
 		tx_nss_max = wlan_vdev_mlme_get_nss(vdev);
 		rx_nss_max = wlan_vdev_mlme_get_nss(vdev);
 		rx_nss_max = wlan_vdev_mlme_get_nss(vdev);
-		hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_STATS_ID);
 
 
 		hdd_check_and_update_nss(hdd_ctx, &tx_nss_max, &rx_nss_max);
 		hdd_check_and_update_nss(hdd_ctx, &tx_nss_max, &rx_nss_max);
 
 
@@ -6133,9 +6134,11 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
 						   my_rx_rate,
 						   my_rx_rate,
 						   rx_nss_max);
 						   rx_nss_max);
 
 
-		if (!tx_rate_calc || !rx_rate_calc)
+		if (!tx_rate_calc || !rx_rate_calc) {
+			hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_STATS_ID);
 			/* Keep GUI happy */
 			/* Keep GUI happy */
 			return 0;
 			return 0;
+		}
 	} else {
 	} else {
 
 
 		/* Fill TX stats */
 		/* Fill TX stats */
@@ -6153,9 +6156,13 @@ static int wlan_hdd_get_sta_stats(struct wiphy *wiphy,
 	wlan_hdd_fill_summary_stats(&adapter->hdd_stats.summary_stat,
 	wlan_hdd_fill_summary_stats(&adapter->hdd_stats.summary_stat,
 				    sinfo,
 				    sinfo,
 				    adapter->vdev_id);
 				    adapter->vdev_id);
-	sinfo->tx_bytes = adapter->stats.tx_bytes;
-	sinfo->rx_bytes = adapter->stats.rx_bytes;
-	sinfo->rx_packets = adapter->stats.rx_packets;
+
+	ucfg_dp_get_net_dev_stats(vdev, &stats);
+	sinfo->tx_bytes = stats.tx_bytes;
+	sinfo->rx_bytes = stats.rx_bytes;
+	sinfo->rx_packets = stats.rx_packets;
+
+	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_STATS_ID);
 
 
 	hdd_fill_fcs_and_mpdu_count(adapter, sinfo);
 	hdd_fill_fcs_and_mpdu_count(adapter, sinfo);