qcacmn: Move peer_adv_stats to MC specific peer_mc_cp_stats struct

Currently peer_adv_stats is present in peer_cp_stats structure
which is shared between WIN and MCL and only common features
should be part of this structure as peer_cp_stats is an
abstraction structure for WIN and MCL for cp stats component.
Since peer_adv_stats is MCL specific structure, this should be
moved to peer_mc_cp_stats which is MCL specific feature for
cp stats component.

Change-Id: Id46cdd153aa6b8137c24fdca30365221d2646d3f
CRs-Fixed: 2480147
diff --git a/umac/cp_stats/core/src/wlan_cp_stats_defs.h b/umac/cp_stats/core/src/wlan_cp_stats_defs.h
index dcad1b2..621c36b 100644
--- a/umac/cp_stats/core/src/wlan_cp_stats_defs.h
+++ b/umac/cp_stats/core/src/wlan_cp_stats_defs.h
@@ -87,14 +87,12 @@
  * struct peer_cp_stats - defines cp stats at peer object
  * @peer_obj: pointer to peer
  * @peer_stats: pointer to ic/mc specific stats
- * @peer_adv_stats: pointer to peer adv stats
  * @peer_comp_priv_obj[]: component's private object pointers
  * @peer_cp_stats_lock:	lock to protect object
  */
 struct peer_cp_stats {
 	struct wlan_objmgr_peer  *peer_obj;
 	void                     *peer_stats;
-	void                     *peer_adv_stats;
 	void *peer_comp_priv_obj[WLAN_CP_STATS_MAX_COMPONENTS];
 	qdf_spinlock_t peer_cp_stats_lock;
 };
diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h
index f584309..770e0b1 100644
--- a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h
+++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h
@@ -267,7 +267,8 @@
  * @rx_rate: rx rate
  * @peer_rssi: rssi
  * @peer_macaddr: mac address
- * @peer_extd_stats: Pointer to peer extended stats
+ * @extd_stats: Pointer to peer extended stats
+ * @adv_stats: Pointer to peer adv (extd2) stats
  */
 struct peer_mc_cp_stats {
 	uint32_t tx_rate;
@@ -275,6 +276,7 @@
 	int8_t peer_rssi;
 	uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE];
 	struct peer_extd_stats *extd_stats;
+	struct peer_adv_mc_cp_stats *adv_stats;
 };
 
 /**
diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c
index 848419e..a77494c 100644
--- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c
+++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c
@@ -256,6 +256,7 @@
 {
 	uint8_t *peer_mac_addr;
 	struct wlan_objmgr_peer *peer;
+	struct peer_mc_cp_stats *peer_mc_stats;
 	struct peer_adv_mc_cp_stats *peer_adv_mc_stats;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	struct peer_cp_stats *peer_cp_stats_priv;
@@ -277,7 +278,8 @@
 		goto end;
 	}
 	wlan_cp_stats_peer_obj_lock(peer_cp_stats_priv);
-	peer_adv_mc_stats = peer_cp_stats_priv->peer_adv_stats;
+	peer_mc_stats = peer_cp_stats_priv->peer_stats;
+	peer_adv_mc_stats = peer_mc_stats->adv_stats;
 
 	qdf_mem_copy(peer_adv_mc_stats->peer_macaddr,
 		     peer_adv_stats->peer_macaddr,
@@ -794,11 +796,11 @@
 	info.tx_rate = peer_mc_stats->tx_rate / 100;
 	info.rx_rate = peer_mc_stats->rx_rate / 100;
 
-	if (peer_cp_stats_priv->peer_adv_stats) {
+	if (peer_mc_stats->adv_stats) {
 		info.num_peer_adv_stats = 1;
 		qdf_mem_copy(info.peer_adv_stats,
-			     peer_cp_stats_priv->peer_adv_stats,
-			     sizeof(peer_cp_stats_priv->peer_adv_stats));
+			     peer_mc_stats->adv_stats,
+			     sizeof(peer_mc_stats->adv_stats));
 	}
 
 	wlan_cp_stats_peer_obj_unlock(peer_cp_stats_priv);
diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c
index 30bdbdc..97779ef 100644
--- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c
+++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c
@@ -90,18 +90,21 @@
 	if (!peer_mc_stats)
 		return QDF_STATUS_E_NOMEM;
 
-	peer_cs->peer_adv_stats = qdf_mem_malloc(sizeof
-						 (struct peer_adv_mc_cp_stats));
-	if (!peer_cs->peer_adv_stats) {
+	peer_mc_stats->adv_stats =
+			qdf_mem_malloc(sizeof(struct peer_adv_mc_cp_stats));
+
+	if (!peer_mc_stats->adv_stats) {
 		qdf_mem_free(peer_mc_stats);
+		peer_mc_stats = NULL;
 		return QDF_STATUS_E_NOMEM;
 	}
 
 	peer_mc_stats->extd_stats =
 			qdf_mem_malloc(sizeof(struct peer_extd_stats));
+
 	if (!peer_mc_stats->extd_stats) {
-		qdf_mem_free(peer_cs->peer_adv_stats);
-		peer_cs->peer_adv_stats = NULL;
+		qdf_mem_free(peer_mc_stats->adv_stats);
+		peer_mc_stats->adv_stats = NULL;
 		qdf_mem_free(peer_mc_stats);
 		peer_mc_stats = NULL;
 		return QDF_STATUS_E_NOMEM;
@@ -115,8 +118,8 @@
 {
 	struct peer_mc_cp_stats *peer_mc_stats = peer_cs->peer_stats;
 
-	qdf_mem_free(peer_cs->peer_adv_stats);
-	peer_cs->peer_adv_stats = NULL;
+	qdf_mem_free(peer_mc_stats->adv_stats);
+	peer_mc_stats->adv_stats = NULL;
 	qdf_mem_free(peer_mc_stats->extd_stats);
 	peer_mc_stats->extd_stats = NULL;
 	qdf_mem_free(peer_cs->peer_stats);