Răsfoiți Sursa

qcacld-3.0: Move hdd_stats to per link struct

To save stats for each link separately, move the
hdd_stats member from adapter to per link data
structure.
Existing user moved to deflink pointer.

Change-Id: I35c6e4a0e95ccf77d28a8768444d702a56f23383
CRs-Fixed: 3452115
Vinod Kumar Pirla 2 ani în urmă
părinte
comite
0f7b4484f7

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

@@ -1017,6 +1017,7 @@ enum udp_qos_upgrade {
  * @rssi_send: Notify RSSI over lpass
  * @is_mlo_vdev_active: is the mlo vdev currently active
  * @estimated_linkspeed: estimated link speed
+ * @hdd_stats: HDD statistics
  */
 struct wlan_hdd_link_info {
 	struct hdd_adapter *adapter;
@@ -1038,6 +1039,7 @@ struct wlan_hdd_link_info {
 #endif
 	bool is_mlo_vdev_active;
 	uint32_t estimated_linkspeed;
+	struct hdd_stats hdd_stats;
 };
 
 /**
@@ -1073,7 +1075,6 @@ struct wlan_hdd_tx_power {
  * @mld_addr: MLD address for adapter
  * @event_flags: a bitmap of hdd_adapter_flags
  * @active_links: a bitmap of active links in @link_info array
- * @hdd_stats: HDD statistics
  * @is_ll_stats_req_pending: atomic variable to check active stats req
  * @sta_stats_cached_timestamp: last updated stats timestamp
  * @qdf_monitor_mode_vdev_up_event: QDF event for monitor mode vdev up
@@ -1205,7 +1206,6 @@ struct hdd_adapter {
 	unsigned long event_flags;
 	unsigned long active_links;
 
-	struct hdd_stats hdd_stats;
 	qdf_atomic_t is_ll_stats_req_pending;
 
 #ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION

+ 4 - 2
core/hdd/src/wlan_hdd_assoc.c

@@ -1760,6 +1760,7 @@ hdd_indicate_unprot_mgmt_frame(struct hdd_adapter *adapter,
 			       uint8_t *frame, uint8_t frame_type)
 {
 	uint8_t type, subtype;
+	struct hdd_stats *hdd_stats;
 
 	hdd_debug("Frame Type = %d Frame Length = %d",
 		  frame_type, frame_length);
@@ -1783,15 +1784,16 @@ hdd_indicate_unprot_mgmt_frame(struct hdd_adapter *adapter,
 		return;
 	}
 
+	hdd_stats = &adapter->deflink->hdd_stats;
 	subtype = WLAN_HDD_GET_SUBTYPE_FRM_FC(frame[0]);
 	switch (subtype) {
 	case SIR_MAC_MGMT_DISASSOC:
 		hdd_rx_unprot_disassoc(adapter->dev, frame, frame_length);
-		adapter->hdd_stats.hdd_pmf_stats.num_unprot_disassoc_rx++;
+		hdd_stats->hdd_pmf_stats.num_unprot_disassoc_rx++;
 		break;
 	case SIR_MAC_MGMT_DEAUTH:
 		hdd_rx_unprot_deauth(adapter->dev, frame, frame_length);
-		adapter->hdd_stats.hdd_pmf_stats.num_unprot_deauth_rx++;
+		hdd_stats->hdd_pmf_stats.num_unprot_deauth_rx++;
 		break;
 	default:
 		hdd_warn("Unexpected frame subtype %d", subtype);

+ 2 - 2
core/hdd/src/wlan_hdd_cm_connect.c

@@ -300,8 +300,8 @@ void hdd_cm_netif_queue_enable(struct hdd_adapter *adapter)
 
 void hdd_cm_clear_pmf_stats(struct hdd_adapter *adapter)
 {
-	qdf_mem_zero(&adapter->hdd_stats.hdd_pmf_stats,
-		     sizeof(adapter->hdd_stats.hdd_pmf_stats));
+	qdf_mem_zero(&adapter->deflink->hdd_stats.hdd_pmf_stats,
+		     sizeof(adapter->deflink->hdd_stats.hdd_pmf_stats));
 }
 
 void hdd_cm_save_connect_status(struct hdd_adapter *adapter,

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

@@ -979,8 +979,8 @@ static __iw_softap_setparam(struct net_device *dev,
 		switch (set_value) {
 		case CDP_HDD_STATS:
 			ucfg_dp_clear_net_dev_stats(adapter->dev);
-			memset(&adapter->hdd_stats, 0,
-					sizeof(adapter->hdd_stats));
+			memset(&adapter->deflink->hdd_stats, 0,
+			       sizeof(adapter->deflink->hdd_stats));
 			break;
 		case CDP_TXRX_HIST_STATS:
 			ucfg_wlan_dp_clear_tx_rx_histogram(hdd_ctx->psoc);

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

@@ -185,7 +185,7 @@ void hdd_ipa_send_nbuf_to_network(qdf_nbuf_t nbuf, qdf_netdev_t dev)
 		return;
 	}
 
-	stats = &adapter->hdd_stats.tx_rx_stats;
+	stats = &adapter->deflink->hdd_stats.tx_rx_stats;
 	hdd_ipa_update_rx_mcbc_stats(adapter, nbuf);
 
 	if ((adapter->device_mode == QDF_SAP_MODE) &&

+ 14 - 10
core/hdd/src/wlan_hdd_main.c

@@ -587,13 +587,16 @@ void wlan_hdd_lpc_del_monitor_interface(struct hdd_context *hdd_ctx)
 void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
 			   enum netif_action_type action)
 {
+	struct hdd_stats *hdd_stats;
+
 	if (!adapter->tx_flow_timer_initialized)
 		return;
 
+	hdd_stats = &adapter->deflink->hdd_stats;
 	if (action == WLAN_WAKE_NON_PRIORITY_QUEUE) {
 		qdf_mc_timer_stop(&adapter->tx_flow_control_timer);
-		adapter->hdd_stats.tx_rx_stats.is_txflow_paused = false;
-		adapter->hdd_stats.tx_rx_stats.txflow_unpause_cnt++;
+		hdd_stats->tx_rx_stats.is_txflow_paused = false;
+		hdd_stats->tx_rx_stats.txflow_unpause_cnt++;
 	} else if (action == WLAN_STOP_NON_PRIORITY_QUEUE) {
 		QDF_STATUS status =
 		qdf_mc_timer_start(&adapter->tx_flow_control_timer,
@@ -602,11 +605,10 @@ void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
 		if (!QDF_IS_STATUS_SUCCESS(status))
 			hdd_err("Failed to start tx_flow_control_timer");
 		else
-			adapter->
-			hdd_stats.tx_rx_stats.txflow_timer_cnt++;
+			hdd_stats->tx_rx_stats.txflow_timer_cnt++;
 
-		adapter->hdd_stats.tx_rx_stats.txflow_pause_cnt++;
-		adapter->hdd_stats.tx_rx_stats.is_txflow_paused = true;
+		hdd_stats->tx_rx_stats.txflow_pause_cnt++;
+		hdd_stats->tx_rx_stats.is_txflow_paused = true;
 	}
 }
 #endif /* QCA_HL_NETDEV_FLOW_CONTROL */
@@ -9020,8 +9022,8 @@ static void hdd_reset_scan_operation(struct hdd_context *hdd_ctx,
  */
 static void hdd_adapter_abort_tx_flow(struct hdd_adapter *adapter)
 {
-	if (adapter->hdd_stats.tx_rx_stats.is_txflow_paused &&
-		QDF_TIMER_STATE_RUNNING ==
+	if (adapter->deflink->hdd_stats.tx_rx_stats.is_txflow_paused &&
+	    QDF_TIMER_STATE_RUNNING ==
 		qdf_mc_timer_get_current_state(
 			&adapter->tx_flow_control_timer)) {
 		hdd_tx_resume_timer_expired_handler(adapter);
@@ -10897,7 +10899,8 @@ void hdd_send_mscs_action_frame(struct hdd_context *hdd_ctx,
 	uint64_t mscs_vo_pkt_delta;
 	unsigned long tx_vo_pkts = 0;
 	unsigned int cpu;
-	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
+	struct hdd_tx_rx_stats *stats =
+				&adapter->deflink->hdd_stats.tx_rx_stats;
 	uint32_t bus_bw_compute_interval;
 
 	/*
@@ -11613,7 +11616,8 @@ int hdd_wlan_clear_stats(struct hdd_adapter *adapter, int stats_id)
 	switch (stats_id) {
 	case CDP_HDD_STATS:
 		ucfg_dp_clear_net_dev_stats(adapter->dev);
-		memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
+		memset(&adapter->deflink->hdd_stats, 0,
+		       sizeof(adapter->deflink->hdd_stats));
 		break;
 	case CDP_TXRX_HIST_STATS:
 		ucfg_wlan_dp_clear_tx_rx_histogram(adapter->hdd_ctx->psoc);

+ 14 - 12
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -102,6 +102,9 @@ void hdd_softap_tx_resume_timer_expired_handler(void *adapter_context)
 static void
 hdd_softap_tx_resume_false(struct hdd_adapter *adapter, bool tx_resume)
 {
+	QDF_STATUS status;
+	qdf_mc_timer_t *fc_timer;
+
 	if (true == tx_resume)
 		return;
 
@@ -109,19 +112,17 @@ hdd_softap_tx_resume_false(struct hdd_adapter *adapter, bool tx_resume)
 	wlan_hdd_netif_queue_control(adapter, WLAN_STOP_ALL_NETIF_QUEUE,
 				     WLAN_DATA_FLOW_CONTROL);
 
-	if (QDF_TIMER_STATE_STOPPED ==
-			qdf_mc_timer_get_current_state(&adapter->
-						       tx_flow_control_timer)) {
-		QDF_STATUS status;
+	fc_timer = &adapter->tx_flow_control_timer;
+	if (QDF_TIMER_STATE_STOPPED != qdf_mc_timer_get_current_state(fc_timer))
+		return;
 
-		status = qdf_mc_timer_start(&adapter->tx_flow_control_timer,
-				WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME);
+	status = qdf_mc_timer_start(fc_timer,
+				    WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME);
 
-		if (!QDF_IS_STATUS_SUCCESS(status))
-			hdd_err("Failed to start tx_flow_control_timer");
-		else
-			adapter->hdd_stats.tx_rx_stats.txflow_timer_cnt++;
-	}
+	if (QDF_IS_STATUS_ERROR(status))
+		hdd_err("Failed to start tx_flow_control_timer");
+	else
+		adapter->deflink->hdd_stats.tx_rx_stats.txflow_timer_cnt++;
 }
 
 void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume)
@@ -203,7 +204,8 @@ static void __hdd_softap_hard_start_xmit(struct sk_buff *skb,
 	sme_ac_enum_type ac = SME_AC_BE;
 	struct hdd_adapter *adapter = (struct hdd_adapter *)netdev_priv(dev);
 	struct hdd_context *hdd_ctx = adapter->hdd_ctx;
-	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
+	struct hdd_tx_rx_stats *stats =
+				&adapter->deflink->hdd_stats.tx_rx_stats;
 	int cpu = qdf_get_smp_processor_id();
 	QDF_STATUS status;
 

+ 9 - 7
core/hdd/src/wlan_hdd_station_info.c

@@ -1918,7 +1918,7 @@ hdd_add_peer_stats_get_len(struct hdd_station_info *stainfo)
 static uint32_t
 hdd_get_pmf_bcn_protect_stats_len(struct hdd_adapter *adapter)
 {
-	if (!adapter->hdd_stats.bcn_protect_stats.pmf_bcn_stats_valid)
+	if (!adapter->deflink->hdd_stats.bcn_protect_stats.pmf_bcn_stats_valid)
 		return 0;
 
 	/* 4 pmf becon protect counters each of 32 bit */
@@ -1946,18 +1946,20 @@ hdd_get_connect_fail_reason_code_len(struct hdd_adapter *adapter)
 static int hdd_add_pmf_bcn_protect_stats(struct sk_buff *skb,
 					 struct hdd_adapter *adapter)
 {
-	if (!adapter->hdd_stats.bcn_protect_stats.pmf_bcn_stats_valid)
+	struct hdd_stats *hdd_stats = &adapter->deflink->hdd_stats;
+
+	if (!hdd_stats->bcn_protect_stats.pmf_bcn_stats_valid)
 		return 0;
 
-	adapter->hdd_stats.bcn_protect_stats.pmf_bcn_stats_valid = 0;
+	hdd_stats->bcn_protect_stats.pmf_bcn_stats_valid = 0;
 	if (nla_put_u32(skb, STA_INFO_BIP_MIC_ERROR_COUNT,
-			adapter->hdd_stats.bcn_protect_stats.igtk_mic_fail_cnt) ||
+			hdd_stats->bcn_protect_stats.igtk_mic_fail_cnt) ||
 	    nla_put_u32(skb, STA_INFO_BIP_REPLAY_COUNT,
-			adapter->hdd_stats.bcn_protect_stats.igtk_replay_cnt) ||
+			hdd_stats->bcn_protect_stats.igtk_replay_cnt) ||
 	    nla_put_u32(skb, STA_INFO_BEACON_MIC_ERROR_COUNT,
-			adapter->hdd_stats.bcn_protect_stats.bcn_mic_fail_cnt) ||
+			hdd_stats->bcn_protect_stats.bcn_mic_fail_cnt) ||
 	    nla_put_u32(skb, STA_INFO_BEACON_REPLAY_COUNT,
-			adapter->hdd_stats.bcn_protect_stats.bcn_replay_cnt)) {
+			hdd_stats->bcn_protect_stats.bcn_replay_cnt)) {
 		hdd_err("put fail");
 		return -EINVAL;
 	}

+ 99 - 103
core/hdd/src/wlan_hdd_stats.c

@@ -227,50 +227,46 @@ static int copy_station_stats_to_adapter(struct hdd_adapter *adapter,
 	struct wlan_objmgr_vdev *vdev;
 	uint16_t he_mcs_12_13_map;
 	bool is_he_mcs_12_13_supported;
+	struct hdd_stats *hdd_stats;
 
 	vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink,
 					   WLAN_OSIF_STATS_ID);
 	if (!vdev)
 		return -EINVAL;
 
+	hdd_stats = &adapter->deflink->hdd_stats;
 	/* save summary stats to legacy location */
-	qdf_mem_copy(adapter->hdd_stats.summary_stat.retry_cnt,
+	qdf_mem_copy(hdd_stats->summary_stat.retry_cnt,
 		     stats->vdev_summary_stats[0].stats.retry_cnt,
-		     sizeof(adapter->hdd_stats.summary_stat.retry_cnt));
-	qdf_mem_copy(
-		adapter->hdd_stats.summary_stat.multiple_retry_cnt,
-		stats->vdev_summary_stats[0].stats.multiple_retry_cnt,
-		sizeof(adapter->hdd_stats.summary_stat.multiple_retry_cnt));
-	qdf_mem_copy(adapter->hdd_stats.summary_stat.tx_frm_cnt,
+		     sizeof(hdd_stats->summary_stat.retry_cnt));
+	qdf_mem_copy(hdd_stats->summary_stat.multiple_retry_cnt,
+		     stats->vdev_summary_stats[0].stats.multiple_retry_cnt,
+		     sizeof(hdd_stats->summary_stat.multiple_retry_cnt));
+	qdf_mem_copy(hdd_stats->summary_stat.tx_frm_cnt,
 		     stats->vdev_summary_stats[0].stats.tx_frm_cnt,
-		     sizeof(adapter->hdd_stats.summary_stat.tx_frm_cnt));
-	qdf_mem_copy(adapter->hdd_stats.summary_stat.fail_cnt,
+		     sizeof(hdd_stats->summary_stat.tx_frm_cnt));
+	qdf_mem_copy(hdd_stats->summary_stat.fail_cnt,
 		     stats->vdev_summary_stats[0].stats.fail_cnt,
-		     sizeof(adapter->hdd_stats.summary_stat.fail_cnt));
-	adapter->hdd_stats.summary_stat.snr =
-			stats->vdev_summary_stats[0].stats.snr;
-	adapter->hdd_stats.summary_stat.rssi =
-			stats->vdev_summary_stats[0].stats.rssi;
-	adapter->hdd_stats.summary_stat.rx_frm_cnt =
+		     sizeof(hdd_stats->summary_stat.fail_cnt));
+	hdd_stats->summary_stat.snr = stats->vdev_summary_stats[0].stats.snr;
+	hdd_stats->summary_stat.rssi = stats->vdev_summary_stats[0].stats.rssi;
+	hdd_stats->summary_stat.rx_frm_cnt =
 			stats->vdev_summary_stats[0].stats.rx_frm_cnt;
-	adapter->hdd_stats.summary_stat.frm_dup_cnt =
+	hdd_stats->summary_stat.frm_dup_cnt =
 			stats->vdev_summary_stats[0].stats.frm_dup_cnt;
-	adapter->hdd_stats.summary_stat.rts_fail_cnt =
+	hdd_stats->summary_stat.rts_fail_cnt =
 			stats->vdev_summary_stats[0].stats.rts_fail_cnt;
-	adapter->hdd_stats.summary_stat.ack_fail_cnt =
+	hdd_stats->summary_stat.ack_fail_cnt =
 			stats->vdev_summary_stats[0].stats.ack_fail_cnt;
-	adapter->hdd_stats.summary_stat.rts_succ_cnt =
+	hdd_stats->summary_stat.rts_succ_cnt =
 			stats->vdev_summary_stats[0].stats.rts_succ_cnt;
-	adapter->hdd_stats.summary_stat.rx_discard_cnt =
+	hdd_stats->summary_stat.rx_discard_cnt =
 			stats->vdev_summary_stats[0].stats.rx_discard_cnt;
-	adapter->hdd_stats.summary_stat.rx_error_cnt =
+	hdd_stats->summary_stat.rx_error_cnt =
 			stats->vdev_summary_stats[0].stats.rx_error_cnt;
-	adapter->hdd_stats.peer_stats.rx_count =
-			stats->peer_adv_stats->rx_count;
-	adapter->hdd_stats.peer_stats.rx_bytes =
-			stats->peer_adv_stats->rx_bytes;
-	adapter->hdd_stats.peer_stats.fcs_count =
-			stats->peer_adv_stats->fcs_count;
+	hdd_stats->peer_stats.rx_count = stats->peer_adv_stats->rx_count;
+	hdd_stats->peer_stats.rx_bytes = stats->peer_adv_stats->rx_bytes;
+	hdd_stats->peer_stats.fcs_count = stats->peer_adv_stats->fcs_count;
 	adapter->tx_power.tx_pwr = stats->pdev_stats->max_pwr;
 	adapter->tx_power.tx_pwr_cached_timestamp =
 			qdf_system_ticks_to_msecs(qdf_system_ticks());
@@ -308,37 +304,35 @@ static int copy_station_stats_to_adapter(struct hdd_adapter *adapter,
 		rx_nss = wlan_vdev_mlme_get_nss(vdev);
 
 	/* save class a stats to legacy location */
-	adapter->hdd_stats.class_a_stat.tx_nss = tx_nss;
-	adapter->hdd_stats.class_a_stat.rx_nss = rx_nss;
-	adapter->hdd_stats.class_a_stat.tx_rate = stats->tx_rate;
-	adapter->hdd_stats.class_a_stat.rx_rate = stats->rx_rate;
-	adapter->hdd_stats.class_a_stat.tx_rx_rate_flags = stats->tx_rate_flags;
+	hdd_stats->class_a_stat.tx_nss = tx_nss;
+	hdd_stats->class_a_stat.rx_nss = rx_nss;
+	hdd_stats->class_a_stat.tx_rate = stats->tx_rate;
+	hdd_stats->class_a_stat.rx_rate = stats->rx_rate;
+	hdd_stats->class_a_stat.tx_rx_rate_flags = stats->tx_rate_flags;
 
 	he_mcs_12_13_map = wlan_vdev_mlme_get_he_mcs_12_13_map(vdev);
 	is_he_mcs_12_13_supported =
 			wlan_hdd_is_he_mcs_12_13_supported(he_mcs_12_13_map);
-	adapter->hdd_stats.class_a_stat.tx_mcs_index =
+	hdd_stats->class_a_stat.tx_mcs_index =
 		sme_get_mcs_idx(stats->tx_rate, stats->tx_rate_flags,
 				is_he_mcs_12_13_supported,
-				&adapter->hdd_stats.class_a_stat.tx_nss,
-				&adapter->hdd_stats.class_a_stat.tx_dcm,
-				&adapter->hdd_stats.class_a_stat.tx_gi,
-				&adapter->hdd_stats.class_a_stat.
-				tx_mcs_rate_flags);
-	adapter->hdd_stats.class_a_stat.rx_mcs_index =
+				&hdd_stats->class_a_stat.tx_nss,
+				&hdd_stats->class_a_stat.tx_dcm,
+				&hdd_stats->class_a_stat.tx_gi,
+				&hdd_stats->class_a_stat.tx_mcs_rate_flags);
+	hdd_stats->class_a_stat.rx_mcs_index =
 		sme_get_mcs_idx(stats->rx_rate, stats->tx_rate_flags,
 				is_he_mcs_12_13_supported,
-				&adapter->hdd_stats.class_a_stat.rx_nss,
-				&adapter->hdd_stats.class_a_stat.rx_dcm,
-				&adapter->hdd_stats.class_a_stat.rx_gi,
-				&adapter->hdd_stats.class_a_stat.
-				rx_mcs_rate_flags);
+				&hdd_stats->class_a_stat.rx_nss,
+				&hdd_stats->class_a_stat.rx_dcm,
+				&hdd_stats->class_a_stat.rx_gi,
+				&hdd_stats->class_a_stat.rx_mcs_rate_flags);
 
 	/* save per chain rssi to legacy location */
-	qdf_mem_copy(adapter->hdd_stats.per_chain_rssi_stats.rssi,
+	qdf_mem_copy(hdd_stats->per_chain_rssi_stats.rssi,
 		     stats->vdev_chain_rssi[0].chain_rssi,
 		     sizeof(stats->vdev_chain_rssi[0].chain_rssi));
-	adapter->hdd_stats.bcn_protect_stats = stats->bcn_protect_stats;
+	hdd_stats->bcn_protect_stats = stats->bcn_protect_stats;
 out:
 	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_STATS_ID);
 	return ret;
@@ -4647,9 +4641,8 @@ wlan_hdd_get_sap_stats(struct hdd_adapter *adapter, struct station_info *info)
 		return ret;
 	}
 
-	wlan_hdd_fill_summary_stats(&adapter->hdd_stats.summary_stat,
-				    info,
-				    adapter->deflink->vdev_id);
+	wlan_hdd_fill_summary_stats(&adapter->deflink->hdd_stats.summary_stat,
+				    info, adapter->deflink->vdev_id);
 
 	return 0;
 }
@@ -5714,15 +5707,17 @@ void hdd_get_max_tx_bitrate(struct hdd_context *hdd_ctx,
 	uint16_t my_tx_rate;
 	struct hdd_station_ctx *hdd_sta_ctx;
 	struct wlan_objmgr_vdev *vdev;
+	struct hdd_stats *hdd_stats;
 
 	hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
 
 	qdf_mem_zero(&sinfo, sizeof(struct station_info));
 
+	hdd_stats = &adapter->deflink->hdd_stats;
 	sinfo.signal = adapter->deflink->rssi;
-	tx_rate_flags = adapter->hdd_stats.class_a_stat.tx_rx_rate_flags;
-	tx_mcs_index = adapter->hdd_stats.class_a_stat.tx_mcs_index;
-	my_tx_rate = adapter->hdd_stats.class_a_stat.tx_rate;
+	tx_mcs_index = hdd_stats->class_a_stat.tx_mcs_index;
+	my_tx_rate = hdd_stats->class_a_stat.tx_rate;
+	tx_rate_flags = hdd_stats->class_a_stat.tx_rx_rate_flags;
 
 	if (!(tx_rate_flags & TX_RATE_LEGACY)) {
 		vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink,
@@ -5736,7 +5731,7 @@ void hdd_get_max_tx_bitrate(struct hdd_context *hdd_ctx,
 			tx_nss = wlan_vdev_mlme_get_nss(vdev);
 			hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_STATS_ID);
 		} else {
-			tx_nss = adapter->hdd_stats.class_a_stat.tx_nss;
+			tx_nss = hdd_stats->class_a_stat.tx_nss;
 		}
 		hdd_check_and_update_nss(hdd_ctx, &tx_nss, NULL);
 
@@ -6051,7 +6046,7 @@ void hdd_wlan_fill_per_chain_rssi_stats(struct station_info *sinfo,
 	sinfo->signal_avg = WLAN_HDD_TGT_NOISE_FLOOR_DBM;
 	for (i = 0; i < NUM_CHAINS_MAX; i++) {
 		sinfo->chain_signal_avg[i] =
-			   adapter->hdd_stats.per_chain_rssi_stats.rssi[i];
+		    adapter->deflink->hdd_stats.per_chain_rssi_stats.rssi[i];
 		sinfo->chains |= 1 << i;
 		if (sinfo->chain_signal_avg[i] > sinfo->signal_avg &&
 		    sinfo->chain_signal_avg[i] != 0)
@@ -6083,8 +6078,8 @@ void hdd_wlan_fill_per_chain_rssi_stats(struct station_info *sinfo,
 static void hdd_fill_fcs_and_mpdu_count(struct hdd_adapter *adapter,
 					struct station_info *sinfo)
 {
-	sinfo->rx_mpdu_count = adapter->hdd_stats.peer_stats.rx_count;
-	sinfo->fcs_err_count = adapter->hdd_stats.peer_stats.fcs_count;
+	sinfo->rx_mpdu_count = adapter->deflink->hdd_stats.peer_stats.rx_count;
+	sinfo->fcs_err_count = adapter->deflink->hdd_stats.peer_stats.fcs_count;
 	hdd_debug("RX mpdu count %d fcs_err_count %d",
 		  sinfo->rx_mpdu_count, sinfo->fcs_err_count);
 	sinfo->filled |= HDD_INFO_FCS_ERROR_COUNT | HDD_INFO_RX_MPDUS;
@@ -6164,12 +6159,12 @@ wlan_hdd_refill_actual_rate(struct rate_info *os_rate,
 	uint8_t preamble, mcs_index, nss;
 
 	soc = cds_get_context(QDF_MODULE_ID_SOC);
-	rate = adapter->hdd_stats.class_a_stat.rx_rate;
-	guard_interval = adapter->hdd_stats.class_a_stat.rx_gi;
-	preamble = adapter->hdd_stats.class_a_stat.rx_preamble;
-	bw = adapter->hdd_stats.class_a_stat.rx_bw;
-	mcs_index = adapter->hdd_stats.class_a_stat.rx_mcs_index;
-	nss = adapter->hdd_stats.class_a_stat.rx_nss;
+	rate = adapter->deflink->hdd_stats.class_a_stat.rx_rate;
+	guard_interval = adapter->deflink->hdd_stats.class_a_stat.rx_gi;
+	preamble = adapter->deflink->hdd_stats.class_a_stat.rx_preamble;
+	bw = adapter->deflink->hdd_stats.class_a_stat.rx_bw;
+	mcs_index = adapter->deflink->hdd_stats.class_a_stat.rx_mcs_index;
+	nss = adapter->deflink->hdd_stats.class_a_stat.rx_nss;
 
 	os_rate->nss = nss;
 	if (preamble == DOT11_A || preamble == DOT11_B) {
@@ -6229,8 +6224,8 @@ static inline void wlan_hdd_mlo_update_stats_info(struct hdd_adapter *adapter)
 	else
 		ml_adapter = adapter;
 
-	rssi = &ml_adapter->hdd_stats.summary_stat.rssi;
-	snr = &ml_adapter->hdd_stats.summary_stat.snr;
+	rssi = &ml_adapter->deflink->hdd_stats.summary_stat.rssi;
+	snr = &ml_adapter->deflink->hdd_stats.summary_stat.snr;
 
 	vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink,
 					   WLAN_OSIF_STATS_ID);
@@ -6255,10 +6250,10 @@ static inline void wlan_hdd_mlo_update_stats_info(struct hdd_adapter *adapter)
 		    hdd_adapter_is_associated_with_ml_adapter(link_adapter))
 			continue;
 
-		link_rssi = &link_adapter->hdd_stats.summary_stat.rssi;
+		link_rssi = &link_adapter->deflink->hdd_stats.summary_stat.rssi;
 		wlan_hdd_populate_mlo_rssi(rssi, link_rssi);
 
-		link_snr = &link_adapter->hdd_stats.summary_stat.snr;
+		link_snr = &link_adapter->deflink->hdd_stats.summary_stat.snr;
 		wlan_hdd_populate_mlo_snr(snr, link_snr);
 		hdd_debug("Partner Link: RSSI: %d, SNR: %d",
 			  *link_rssi, *link_snr);
@@ -6271,8 +6266,8 @@ stat_update:
 #else
 static inline void wlan_hdd_mlo_update_stats_info(struct hdd_adapter *adapter)
 {
-	adapter->deflink->rssi = adapter->hdd_stats.summary_stat.rssi;
-	adapter->deflink->snr = adapter->hdd_stats.summary_stat.snr;
+	adapter->deflink->rssi = adapter->deflink->hdd_stats.summary_stat.rssi;
+	adapter->deflink->snr = adapter->deflink->hdd_stats.summary_stat.snr;
 }
 #endif
 
@@ -6296,13 +6291,13 @@ static void wlan_hdd_update_rssi(struct hdd_adapter *adapter,
 	if (adapter->deflink->rssi > 0) {
 		hdd_debug_rl("RSSI invalid %d", adapter->deflink->rssi);
 		adapter->deflink->rssi = 0;
-		adapter->hdd_stats.summary_stat.rssi = 0;
+		adapter->deflink->hdd_stats.summary_stat.rssi = 0;
 	}
 
 	sinfo->signal = adapter->deflink->rssi;
 	hdd_debug("snr: %d, rssi: %d",
-		adapter->hdd_stats.summary_stat.snr,
-		adapter->hdd_stats.summary_stat.rssi);
+		adapter->deflink->hdd_stats.summary_stat.snr,
+		adapter->deflink->hdd_stats.summary_stat.rssi);
 	sta_ctx->conn_info.signal = sinfo->signal;
 	sta_ctx->conn_info.noise = sta_ctx->conn_info.signal - snr;
 	sta_ctx->cache_conn_info.signal = sinfo->signal;
@@ -6327,6 +6322,7 @@ static int wlan_hdd_update_rate_info(struct hdd_adapter *adapter,
 	uint8_t tx_mcs_index, rx_mcs_index;
 	uint8_t tx_nss = 1, rx_nss = 1, tx_dcm, rx_dcm;
 	qdf_net_dev_stats stats = {0};
+	struct hdd_stats *hdd_stats;
 
 	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
 	ucfg_mlme_stats_get_cfg_values(hdd_ctx->psoc,
@@ -6335,25 +6331,26 @@ static int wlan_hdd_update_rate_info(struct hdd_adapter *adapter,
 				       &link_speed_rssi_low,
 				       &link_speed_rssi_report);
 
-	rate_flags = adapter->hdd_stats.class_a_stat.tx_rx_rate_flags;
+	hdd_stats = &adapter->deflink->hdd_stats;
+	rate_flags = hdd_stats->class_a_stat.tx_rx_rate_flags;
 	tx_rate_flags = rx_rate_flags = rate_flags;
 
-	tx_mcs_index = adapter->hdd_stats.class_a_stat.tx_mcs_index;
-	rx_mcs_index = adapter->hdd_stats.class_a_stat.rx_mcs_index;
+	tx_mcs_index = hdd_stats->class_a_stat.tx_mcs_index;
+	rx_mcs_index = hdd_stats->class_a_stat.rx_mcs_index;
 	mac_handle = hdd_ctx->mac_handle;
 
 	/* convert to the UI units of 100kbps */
-	my_tx_rate = adapter->hdd_stats.class_a_stat.tx_rate;
-	my_rx_rate = adapter->hdd_stats.class_a_stat.rx_rate;
+	my_tx_rate = hdd_stats->class_a_stat.tx_rate;
+	my_rx_rate = hdd_stats->class_a_stat.rx_rate;
 
-	tx_dcm = adapter->hdd_stats.class_a_stat.tx_dcm;
-	rx_dcm = adapter->hdd_stats.class_a_stat.rx_dcm;
-	tx_gi = adapter->hdd_stats.class_a_stat.tx_gi;
-	rx_gi = adapter->hdd_stats.class_a_stat.rx_gi;
+	tx_dcm = hdd_stats->class_a_stat.tx_dcm;
+	rx_dcm = hdd_stats->class_a_stat.rx_dcm;
+	tx_gi = hdd_stats->class_a_stat.tx_gi;
+	rx_gi = hdd_stats->class_a_stat.rx_gi;
 
 	if (!(rate_flags & TX_RATE_LEGACY)) {
-		tx_nss = adapter->hdd_stats.class_a_stat.tx_nss;
-		rx_nss = adapter->hdd_stats.class_a_stat.rx_nss;
+		tx_nss = hdd_stats->class_a_stat.tx_nss;
+		rx_nss = hdd_stats->class_a_stat.rx_nss;
 
 		hdd_check_and_update_nss(hdd_ctx, &tx_nss, &rx_nss);
 
@@ -6365,13 +6362,13 @@ static int wlan_hdd_update_rate_info(struct hdd_adapter *adapter,
 				tx_rate_flags = TX_RATE_LEGACY;
 			else
 				tx_rate_flags =
-			      adapter->hdd_stats.class_a_stat.tx_mcs_rate_flags;
+				    hdd_stats->class_a_stat.tx_mcs_rate_flags;
 
 			if (rx_mcs_index == INVALID_MCS_IDX && my_rx_rate)
 				rx_rate_flags = TX_RATE_LEGACY;
 			else
 				rx_rate_flags =
-			      adapter->hdd_stats.class_a_stat.rx_mcs_rate_flags;
+				    hdd_stats->class_a_stat.rx_mcs_rate_flags;
 		}
 
 		if (tx_mcs_index == INVALID_MCS_IDX)
@@ -6448,7 +6445,7 @@ static int wlan_hdd_update_rate_info(struct hdd_adapter *adapter,
 
 		/* Fill RX stats */
 		rx_nss_max = wlan_vdev_mlme_get_nss(vdev);
-		rx_preamble = adapter->hdd_stats.class_a_stat.rx_preamble;
+		rx_preamble = hdd_stats->class_a_stat.rx_preamble;
 
 		/*
 		 * If rx_preamble has been marked invalid, it means that DP
@@ -6467,7 +6464,7 @@ static int wlan_hdd_update_rate_info(struct hdd_adapter *adapter,
 			wlan_hdd_refill_actual_rate(&sinfo->rxrate, adapter);
 	}
 
-	wlan_hdd_fill_summary_stats(&adapter->hdd_stats.summary_stat,
+	wlan_hdd_fill_summary_stats(&hdd_stats->summary_stat,
 				    sinfo, adapter->deflink->vdev_id);
 
 	ucfg_dp_get_net_dev_stats(vdev, &stats);
@@ -7650,6 +7647,7 @@ void wlan_hdd_get_peer_rx_rate_stats(struct hdd_adapter *adapter)
 	ol_txrx_soc_handle soc;
 	uint8_t *peer_mac_addr;
 	struct wlan_objmgr_psoc *psoc;
+	struct hdd_stats *hdd_stats = &adapter->deflink->hdd_stats;
 
 	psoc = adapter->hdd_ctx->psoc;
 	if (!ucfg_mlme_stats_is_link_speed_report_actual(psoc))
@@ -7676,14 +7674,13 @@ void wlan_hdd_get_peer_rx_rate_stats(struct hdd_adapter *adapter)
 	if (qdf_unlikely(QDF_IS_STATUS_ERROR(status)) ||
 	    qdf_unlikely(peer_stats->rx.last_rx_rate == 0)) {
 		hdd_debug("No rates, reporting max rate, rx mcs=%d, status=%d",
-			  adapter->hdd_stats.class_a_stat.rx_mcs_index, status);
-		adapter->hdd_stats.class_a_stat.rx_preamble = INVALID_PREAMBLE;
-		if (adapter->hdd_stats.class_a_stat.rx_mcs_index ==
-			INVALID_MCS_IDX) {
-			adapter->hdd_stats.class_a_stat.rx_rate =
-				adapter->hdd_stats.class_a_stat.tx_rate;
-			adapter->hdd_stats.class_a_stat.rx_mcs_index =
-				adapter->hdd_stats.class_a_stat.tx_mcs_index;
+			  hdd_stats->class_a_stat.rx_mcs_index, status);
+		hdd_stats->class_a_stat.rx_preamble = INVALID_PREAMBLE;
+		if (hdd_stats->class_a_stat.rx_mcs_index == INVALID_MCS_IDX) {
+			hdd_stats->class_a_stat.rx_rate =
+				hdd_stats->class_a_stat.tx_rate;
+			hdd_stats->class_a_stat.rx_mcs_index =
+				hdd_stats->class_a_stat.tx_mcs_index;
 		}
 		qdf_mem_free(peer_stats);
 		return;
@@ -7693,14 +7690,12 @@ void wlan_hdd_get_peer_rx_rate_stats(struct hdd_adapter *adapter)
 	 * The linkspeed calculated by driver is in kbps so we
 	 * convert it in units of 100 kbps expected by userspace
 	 */
-	adapter->hdd_stats.class_a_stat.rx_rate =
-		peer_stats->rx.last_rx_rate / 100;
-	adapter->hdd_stats.class_a_stat.rx_mcs_index = peer_stats->rx.mcs_info;
-	adapter->hdd_stats.class_a_stat.rx_nss = peer_stats->rx.nss_info;
-	adapter->hdd_stats.class_a_stat.rx_gi = peer_stats->rx.gi_info;
-	adapter->hdd_stats.class_a_stat.rx_preamble =
-		peer_stats->rx.preamble_info;
-	adapter->hdd_stats.class_a_stat.rx_bw = peer_stats->rx.bw_info;
+	hdd_stats->class_a_stat.rx_rate = peer_stats->rx.last_rx_rate / 100;
+	hdd_stats->class_a_stat.rx_mcs_index = peer_stats->rx.mcs_info;
+	hdd_stats->class_a_stat.rx_nss = peer_stats->rx.nss_info;
+	hdd_stats->class_a_stat.rx_gi = peer_stats->rx.gi_info;
+	hdd_stats->class_a_stat.rx_preamble = peer_stats->rx.preamble_info;
+	hdd_stats->class_a_stat.rx_bw = peer_stats->rx.bw_info;
 
 	qdf_mem_free(peer_stats);
 }
@@ -7891,7 +7886,8 @@ void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context, uint8_t vdev_id)
 		hdd_err("Invalid vdev");
 		return;
 	}
-	stats = &link_info->adapter->hdd_stats.tx_rx_stats;
+
+	stats = &link_info->hdd_stats.tx_rx_stats;
 
 	for (i = 0; i < NUM_CPUS; i++) {
 		total_inv_sk_and_skb_hash +=

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

@@ -38,7 +38,8 @@ static int stats_id = -1;
 static void hdd_sysfs_get_stats(struct hdd_adapter *adapter, ssize_t *length,
 				char *buffer, size_t buf_len)
 {
-	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
+	struct hdd_tx_rx_stats *stats =
+				&adapter->deflink->hdd_stats.tx_rx_stats;
 	struct dp_tx_rx_stats *dp_stats;
 	uint32_t len = 0;
 	uint32_t total_rx_pkt = 0, total_rx_dropped = 0;

+ 41 - 36
core/hdd/src/wlan_hdd_tx_rx.c

@@ -245,6 +245,9 @@ void hdd_tx_resume_timer_expired_handler(void *adapter_context)
 static void
 hdd_tx_resume_false(struct hdd_adapter *adapter, bool tx_resume)
 {
+	QDF_STATUS status;
+	qdf_mc_timer_t *fc_timer;
+
 	if (true == tx_resume)
 		return;
 
@@ -253,22 +256,22 @@ hdd_tx_resume_false(struct hdd_adapter *adapter, bool tx_resume)
 	wlan_hdd_netif_queue_control(adapter, WLAN_STOP_ALL_NETIF_QUEUE,
 				     WLAN_DATA_FLOW_CONTROL);
 
-	if (QDF_TIMER_STATE_STOPPED ==
-			qdf_mc_timer_get_current_state(&adapter->
-						       tx_flow_control_timer)) {
-		QDF_STATUS status;
+	fc_timer = &adapter->tx_flow_control_timer;
+	if (QDF_TIMER_STATE_STOPPED != qdf_mc_timer_get_current_state(fc_timer))
+		goto update_stats;
 
-		status = qdf_mc_timer_start(&adapter->tx_flow_control_timer,
-				WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME);
 
-		if (!QDF_IS_STATUS_SUCCESS(status))
-			hdd_err("Failed to start tx_flow_control_timer");
-		else
-			adapter->hdd_stats.tx_rx_stats.txflow_timer_cnt++;
-	}
+	status = qdf_mc_timer_start(fc_timer,
+				    WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME);
 
-	adapter->hdd_stats.tx_rx_stats.txflow_pause_cnt++;
-	adapter->hdd_stats.tx_rx_stats.is_txflow_paused = true;
+	if (QDF_IS_STATUS_ERROR(status))
+		hdd_err("Failed to start tx_flow_control_timer");
+	else
+		adapter->deflink->hdd_stats.tx_rx_stats.txflow_timer_cnt++;
+
+update_stats:
+	adapter->deflink->hdd_stats.tx_rx_stats.txflow_pause_cnt++;
+	adapter->deflink->hdd_stats.tx_rx_stats.is_txflow_paused = true;
 }
 
 /**
@@ -303,8 +306,9 @@ void hdd_tx_resume_cb(void *adapter_context, bool tx_resume)
 		wlan_hdd_netif_queue_control(adapter,
 					     WLAN_WAKE_ALL_NETIF_QUEUE,
 					     WLAN_DATA_FLOW_CONTROL);
-		adapter->hdd_stats.tx_rx_stats.is_txflow_paused = false;
-		adapter->hdd_stats.tx_rx_stats.txflow_unpause_cnt++;
+		adapter->deflink->hdd_stats.tx_rx_stats.is_txflow_paused =
+									false;
+		adapter->deflink->hdd_stats.tx_rx_stats.txflow_unpause_cnt++;
 	}
 	hdd_tx_resume_false(adapter, tx_resume);
 }
@@ -363,6 +367,7 @@ void hdd_get_tx_resource(uint8_t vdev_id,
 	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	uint16_t timer_value = WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME;
 	struct wlan_hdd_link_info *link_info;
+	qdf_mc_timer_t *fc_timer;
 
 	link_info = hdd_get_link_info_by_vdev(hdd_ctx, vdev_id);
 	if (!link_info)
@@ -373,27 +378,26 @@ void hdd_get_tx_resource(uint8_t vdev_id,
 	    adapter->device_mode == QDF_SAP_MODE)
 		timer_value = WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME;
 
-	if (false ==
-	    cdp_fc_get_tx_resource(cds_get_context(QDF_MODULE_ID_SOC),
-				   OL_TXRX_PDEV_ID,
-				   *mac_addr,
+	if (cdp_fc_get_tx_resource(cds_get_context(QDF_MODULE_ID_SOC),
+				   OL_TXRX_PDEV_ID, *mac_addr,
 				   adapter->tx_flow_low_watermark,
-				   adapter->tx_flow_hi_watermark_offset)) {
-		hdd_debug("Disabling queues lwm %d hwm offset %d",
-			 adapter->tx_flow_low_watermark,
-			 adapter->tx_flow_hi_watermark_offset);
-		wlan_hdd_netif_queue_control(adapter, WLAN_STOP_ALL_NETIF_QUEUE,
-					     WLAN_DATA_FLOW_CONTROL);
-		if ((adapter->tx_flow_timer_initialized == true) &&
-		    (QDF_TIMER_STATE_STOPPED ==
-		    qdf_mc_timer_get_current_state(&adapter->
-						    tx_flow_control_timer))) {
-			qdf_mc_timer_start(&adapter->tx_flow_control_timer,
-					   timer_value);
-			adapter->hdd_stats.tx_rx_stats.txflow_timer_cnt++;
-			adapter->hdd_stats.tx_rx_stats.txflow_pause_cnt++;
-			adapter->hdd_stats.tx_rx_stats.is_txflow_paused = true;
-		}
+				   adapter->tx_flow_hi_watermark_offset))
+		return;
+
+	hdd_debug("Disabling queues lwm %d hwm offset %d",
+		  adapter->tx_flow_low_watermark,
+		  adapter->tx_flow_hi_watermark_offset);
+	wlan_hdd_netif_queue_control(adapter, WLAN_STOP_ALL_NETIF_QUEUE,
+				     WLAN_DATA_FLOW_CONTROL);
+
+	fc_timer = &adapter->tx_flow_control_timer;
+	if ((adapter->tx_flow_timer_initialized == true) &&
+	    (QDF_TIMER_STATE_STOPPED ==
+	     qdf_mc_timer_get_current_state(fc_timer))) {
+		qdf_mc_timer_start(fc_timer, timer_value);
+		link_info->hdd_stats.tx_rx_stats.txflow_timer_cnt++;
+		link_info->hdd_stats.tx_rx_stats.txflow_pause_cnt++;
+		link_info->hdd_stats.tx_rx_stats.is_txflow_paused = true;
 	}
 }
 
@@ -502,7 +506,8 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 				  struct net_device *dev)
 {
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
+	struct hdd_tx_rx_stats *stats =
+				&adapter->deflink->hdd_stats.tx_rx_stats;
 	struct hdd_station_ctx *sta_ctx = &adapter->deflink->session.station;
 	int cpu = qdf_get_smp_processor_id();
 	bool granted;

+ 7 - 6
core/hdd/src/wlan_hdd_wext.c

@@ -2777,7 +2777,8 @@ int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
 void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
 			char *buffer, uint16_t buf_len)
 {
-	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
+	struct hdd_tx_rx_stats *stats =
+				&adapter->deflink->hdd_stats.tx_rx_stats;
 	struct dp_tx_rx_stats *dp_stats;
 	uint32_t len = 0;
 	uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
@@ -6222,9 +6223,9 @@ static int __iw_get_char_setnone(struct net_device *dev,
 			 connected_bssid.bytes[3],
 			 connected_bssid.bytes[4],
 			 connected_bssid.bytes[5],
-			 adapter->hdd_stats.hdd_pmf_stats.
+			 adapter->deflink->hdd_stats.hdd_pmf_stats.
 			 num_unprot_disassoc_rx,
-			 adapter->hdd_stats.hdd_pmf_stats.
+			 adapter->deflink->hdd_stats.hdd_pmf_stats.
 			 num_unprot_deauth_rx);
 
 		wrqu->data.length = strlen(extra) + 1;
@@ -7939,9 +7940,9 @@ static int __iw_get_statistics(struct net_device *dev,
 
 	hdd_get_wlan_stats(adapter);
 
-	summary_stats = &(adapter->hdd_stats.summary_stat);
-	class_a_stats = &(adapter->hdd_stats.class_a_stat);
-	class_d_stats = &(adapter->hdd_stats.class_d_stat);
+	summary_stats = &adapter->deflink->hdd_stats.summary_stat;
+	class_a_stats = &adapter->deflink->hdd_stats.class_a_stat;
+	class_d_stats = &adapter->deflink->hdd_stats.class_d_stat;
 
 	p = extra;
 	tlen = 0;

+ 11 - 7
core/hdd/src/wlan_hdd_wmm.c

@@ -391,6 +391,7 @@ static void hdd_wmm_inactivity_timer_cb(void *user_data)
 	uint32_t traffic_count = 0;
 	sme_ac_enum_type ac_type;
 	unsigned int cpu;
+	struct hdd_tx_rx_stats *tx_rx_stats;
 
 	if (!qos_context) {
 		hdd_err("invalid user data");
@@ -406,11 +407,11 @@ static void hdd_wmm_inactivity_timer_cb(void *user_data)
 	}
 
 	ac = &adapter->hdd_wmm_status.ac_status[ac_type];
-
+	tx_rx_stats = &adapter->deflink->hdd_stats.tx_rx_stats;
 	/* Get the Tx stats for this AC. */
 	for (cpu = 0; cpu < NUM_CPUS; cpu++)
-		traffic_count += adapter->hdd_stats.tx_rx_stats.per_cpu[cpu].
-					 tx_classified_ac[qos_context->ac_type];
+		traffic_count +=
+		tx_rx_stats->per_cpu[cpu].tx_classified_ac[qos_context->ac_type];
 
 	hdd_warn("WMM inactivity check for AC=%d, count=%u, last=%u",
 		 ac_type, traffic_count, ac->last_traffic_count);
@@ -460,6 +461,7 @@ hdd_wmm_enable_inactivity_timer(struct hdd_wmm_qos_context *qos_context,
 	sme_ac_enum_type ac_type = qos_context->ac_type;
 	struct hdd_wmm_ac_status *ac;
 	unsigned int cpu;
+	struct hdd_tx_rx_stats *tx_rx_stats;
 
 	adapter = qos_context->adapter;
 	ac = &adapter->hdd_wmm_status.ac_status[ac_type];
@@ -489,10 +491,11 @@ hdd_wmm_enable_inactivity_timer(struct hdd_wmm_qos_context *qos_context,
 
 	ac->last_traffic_count = 0;
 	/* Initialize the current tx traffic count on this AC */
-	for (cpu = 0; cpu < NUM_CPUS; cpu++)
+	tx_rx_stats = &adapter->deflink->hdd_stats.tx_rx_stats;
+	for (cpu = 0; cpu < NUM_CPUS; cpu++) {
 		ac->last_traffic_count +=
-			adapter->hdd_stats.tx_rx_stats.per_cpu[cpu].
-					 tx_classified_ac[qos_context->ac_type];
+		tx_rx_stats->per_cpu[cpu].tx_classified_ac[qos_context->ac_type];
+	}
 	qos_context->is_inactivity_timer_running = true;
 	return qdf_status;
 }
@@ -2087,7 +2090,8 @@ uint16_t hdd_get_tx_queue_for_ac(struct hdd_adapter *adapter,
 	struct sock *sk = skb->sk;
 	int new_index;
 	int cpu = qdf_get_smp_processor_id();
-	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
+	struct hdd_tx_rx_stats *stats =
+				&adapter->deflink->hdd_stats.tx_rx_stats;
 
 	if (qdf_unlikely(ac == HDD_LINUX_AC_HI_PRIO))
 		return TX_GET_QUEUE_IDX(HDD_LINUX_AC_HI_PRIO, 0);