Prechádzať zdrojové kódy

Revert "qcacld-3.0: Refactor mlo peer stats cache logic"

This reverts commit 885a5d4ce343de4e3f603688b5412489a73c7afc.

Change-Id: Ie2643859de459374bfb05d0c026ed73447628ae6
Linux Image Build Automation 1 rok pred
rodič
commit
9e93c63409
2 zmenil súbory, kde vykonal 52 pridanie a 92 odobranie
  1. 2 0
      core/hdd/inc/wlan_hdd_main.h
  2. 50 92
      core/hdd/src/wlan_hdd_stats.c

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

@@ -1974,6 +1974,7 @@ enum wlan_state_ctrl_str_id {
  * @host wakeup from fw with reason as pagefault
  * @bridgeaddr: Bridge MAC address
  * @is_mlo_per_link_stats_supported: Per link mlo stats is supported or not
+ * @mlo_peer_stats: Pointer to MLO Peer Stats
  * @num_mlo_peers: Total number of MLO peers
  * @more_peer_data: more mlo peer data in peer stats
  */
@@ -2254,6 +2255,7 @@ struct hdd_context {
 	uint8_t bridgeaddr[QDF_MAC_ADDR_SIZE];
 #ifdef WLAN_FEATURE_11BE_MLO
 	bool is_mlo_per_link_stats_supported;
+	struct wifi_peer_stat *mlo_peer_stats;
 	uint8_t num_mlo_peers;
 	uint32_t more_peer_data;
 #endif

+ 50 - 92
core/hdd/src/wlan_hdd_stats.c

@@ -781,80 +781,48 @@ wlan_hdd_put_mlo_peer_link_id(struct sk_buff *vendor_event,
 }
 
 /**
- * wlan_hdd_mlo_peer_stats() - Pointer to mlo peer stats
- * @link_info: Link info pointer in HDD adapter
- * @stats: Pointer to hdd_ll_stats
+ * hdd_cache_ll_peer_stats() - Caches mlo peer stats received from fw
+ * @hdd_ctx: Pointer to hdd_context
+ * @peer_stat: Pointer to stats data
+ * @more_data: more data in peer stats
  *
- * Cache mlo peer stats into a void pointer and return it.
+ * After receiving Link Layer Peer statistics from FW.
+ * This function caches them into wlan_hdd_link_info.
  *
- * Return: Pointer holding mlo peer stats
+ * Return: None
  */
 static void
-*wlan_hdd_mlo_peer_stats(struct wlan_hdd_link_info *link_info,
-			 struct hdd_ll_stats *stats)
+hdd_cache_ll_peer_stats(struct hdd_context *hdd_ctx,
+			struct wifi_peer_stat *peer_stat,
+			u32 more_data)
 {
-	struct hdd_context *hdd_ctx;
-	struct wifi_peer_stat *peer_stat = NULL;
-	struct wifi_peer_info *peer_info = NULL;
-	void *mlo_stats;
-	u64 num_rate = 0, peers, rates;
-	size_t stats_size = 0;
-	int i;
-
-	if (!wlan_hdd_is_mlo_connection(link_info))
-		return NULL;
-
-	hdd_ctx = link_info->adapter->hdd_ctx;
-	if (!stats) {
-		hdd_err("Invalid mlo hdd ll stats");
-		return NULL;
-	}
-
-	peer_stat = (struct wifi_peer_stat *)stats->result;
-	if (!peer_stat) {
-		hdd_err("Invalid hdd peer stats");
-		return NULL;
-	}
-
-	peer_info = (struct wifi_peer_info *)peer_stat->peer_info;
-	for (i = 1; i <= peer_stat->num_peers; i++) {
-		num_rate += peer_info->num_rate;
-		peer_info = (struct wifi_peer_info *)((uint8_t *)
-			    peer_info + sizeof(struct wifi_peer_info) +
-			    (peer_info->num_rate *
-			    sizeof(struct wifi_rate_stat)));
-	}
-
-	peers = sizeof(struct wifi_peer_info) * peer_stat->num_peers;
-	rates = sizeof(struct wifi_rate_stat) * num_rate;
-	stats_size = sizeof(struct wifi_peer_stat) + peers + rates;
+	if (!peer_stat->num_peers)
+		return;
 
-	mlo_stats = qdf_mem_malloc(stats_size);
-	if (!mlo_stats) {
-		hdd_err_rl("Failed to cache mlo peer stats");
-		return NULL;
+	if (!hdd_ctx) {
+		hdd_err("Invalid hdd_ctx");
+		return;
 	}
 
-	qdf_mem_copy(mlo_stats, stats->result, stats_size);
-	hdd_ctx->more_peer_data = stats->more_data;
+	hdd_ctx->mlo_peer_stats = peer_stat;
+	hdd_ctx->more_peer_data = more_data;
 	hdd_ctx->num_mlo_peers = peer_stat->num_peers;
-	hdd_debug_rl("Copied MLO Peer stats");
-	return mlo_stats;
+	hdd_debug("Copied mlo ll_peer stats into hdd_ctx");
 }
 #else
-static inline void
-*wlan_hdd_mlo_peer_stats(struct wlan_hdd_link_info *link_info,
-			 struct hdd_ll_stats *stats)
-{
-	return NULL;
-}
-
 static inline bool
 wlan_hdd_put_mlo_peer_link_id(struct sk_buff *vendor_event,
 			      struct qdf_mac_addr *bssid)
 {
 	return true;
 }
+
+static void
+hdd_cache_ll_peer_stats(struct hdd_context *hdd_ctx,
+			struct wifi_peer_stat *peer_stat,
+			u32 more_data)
+{
+}
 #endif
 
 /**
@@ -1217,16 +1185,19 @@ static void hdd_link_layer_process_peer_stats(struct hdd_adapter *adapter,
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct wifi_peer_info *peer_info;
 	struct sk_buff *skb;
-	int i;
+	int status, i;
 	struct nlattr *peers;
 	int num_rate;
 
-	if (wlan_hdd_validate_context(hdd_ctx))
+	status = wlan_hdd_validate_context(hdd_ctx);
+	if (status)
 		return;
 
-	if (wlan_hdd_is_mlo_connection(adapter->deflink))
+	if (wlan_hdd_is_mlo_connection(adapter->deflink)) {
+		hdd_cache_ll_peer_stats(hdd_ctx, peer_stat,
+					more_data);
 		return;
-
+	}
 	hdd_nofl_debug("LL_STATS_PEER_ALL : num_peers %u, more data = %u",
 		       peer_stat->num_peers, more_data);
 
@@ -1492,26 +1463,26 @@ wlan_hdd_update_iface_stats_info(struct wlan_hdd_link_info *link_info,
 /**
  * wlan_hdd_send_mlo_ll_peer_stats() - send mlo ll peer stats to userspace
  * @hdd_ctx: Pointer to hdd_context
- * @peer_stat: Pointer to wifi_peer_stat
  *
  * Return: none
  */
 static void
-wlan_hdd_send_mlo_ll_peer_stats(struct hdd_context *hdd_ctx,
-				struct wifi_peer_stat *peer_stat)
+wlan_hdd_send_mlo_ll_peer_stats(struct hdd_context *hdd_ctx)
 {
 	struct sk_buff *skb;
 	uint8_t i, num_rate;
-	struct wifi_peer_info *peer_info = NULL;
+	struct wifi_peer_stat *peer_stat;
+	struct wifi_peer_info *peer_info;
 	struct nlattr *peers, *peer_nest;
 
-	if (!peer_stat) {
-		hdd_err("Invalid mlo peer stats");
+	if (wlan_hdd_validate_context(hdd_ctx)) {
+		hdd_err("Invalid hdd_ctx. Failed sending mlo peer stats");
 		return;
 	}
 
-	if (wlan_hdd_validate_context(hdd_ctx)) {
-		hdd_err("Invalid hdd_ctx. Failed sending mlo peer stats");
+	peer_stat = (struct wifi_peer_stat *)hdd_ctx->mlo_peer_stats;
+	if (!peer_stat) {
+		hdd_err("Invalid mlo peer stats");
 		return;
 	}
 
@@ -1539,33 +1510,37 @@ wlan_hdd_send_mlo_ll_peer_stats(struct hdd_context *hdd_ctx,
 			peer_stat->num_peers)) {
 		hdd_err("QCA_WLAN_VENDOR_ATTR put fail");
 
-		goto exit;
+		wlan_cfg80211_vendor_free_skb(skb);
+		return;
 	}
 
 	peer_nest = nla_nest_start(skb,
 				   QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO);
 	if (!peer_nest) {
 		hdd_err("nla_nest_start failed");
-		goto exit;
+		wlan_cfg80211_vendor_free_skb(skb);
+		return;
 	}
 
 	for (i = 1; i <= peer_stat->num_peers; i++) {
 		peers = nla_nest_start(skb, i);
 		if (!peers) {
 			hdd_err("nla_nest_start failed");
-			goto exit;
+			wlan_cfg80211_vendor_free_skb(skb);
+			return;
 		}
 
 		num_rate = peer_info->num_rate;
 		if (!wlan_hdd_put_mlo_peer_link_id(skb,
 						   &peer_info->peer_macaddr)) {
 			hdd_err("QCA_WLAN_VENDOR_ATTR_LL_STATS_MLO_LINK_ID fail");
-			goto exit;
+			return;
 		}
 
 		if (!put_wifi_peer_info(peer_info, skb)) {
 			hdd_err("put_wifi_peer_info fail");
-			goto exit;
+			wlan_cfg80211_vendor_free_skb(skb);
+			return;
 		}
 
 		peer_info = (struct wifi_peer_info *)
@@ -1577,11 +1552,6 @@ wlan_hdd_send_mlo_ll_peer_stats(struct hdd_context *hdd_ctx,
 	nla_nest_end(skb, peer_nest);
 
 	wlan_cfg80211_vendor_cmd_reply(skb);
-
-	hdd_debug_rl("Sent MLO Peer stats to User Space");
-	return;
-exit:
-	wlan_cfg80211_vendor_free_skb(skb);
 }
 
 /**
@@ -1718,6 +1688,7 @@ static void wlan_hdd_send_mlo_ll_iface_stats(struct hdd_adapter *adapter)
 
 	wlan_cfg80211_vendor_cmd_reply(skb);
 	qdf_mem_free(link_if_stat);
+	wlan_hdd_send_mlo_ll_peer_stats(hdd_ctx);
 	return;
 err:
 	wlan_cfg80211_vendor_free_skb(skb);
@@ -1734,12 +1705,6 @@ static inline void
 wlan_hdd_send_mlo_ll_iface_stats(struct hdd_adapter *adapter)
 {
 }
-
-static inline void
-wlan_hdd_send_mlo_ll_peer_stats(struct hdd_context *hdd_ctx,
-				struct wifi_peer_stat *peer_stat)
-{
-}
 #endif
 
 /**
@@ -2963,7 +2928,6 @@ static int wlan_hdd_send_ll_stats_req(struct wlan_hdd_link_info *link_info,
 	struct hdd_adapter *adapter = link_info->adapter;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	void *cookie;
-	void *mlo_stats = NULL;
 	static const struct osif_request_params params = {
 		.priv_size = sizeof(*priv),
 		.timeout_ms = WLAN_WAIT_TIME_LL_STATS,
@@ -3046,9 +3010,6 @@ static int wlan_hdd_send_ll_stats_req(struct wlan_hdd_link_info *link_info,
 		stats =  qdf_container_of(ll_node, struct hdd_ll_stats,
 					  ll_stats_node);
 		wlan_hdd_handle_ll_stats(link_info, stats, ret);
-		if (stats->result_param_id == WMI_LINK_STATS_ALL_PEER)
-			mlo_stats = wlan_hdd_mlo_peer_stats(link_info,
-							    stats);
 		qdf_mem_free(stats->result);
 		qdf_mem_free(stats);
 		qdf_spin_lock(&priv->ll_stats_lock);
@@ -3057,9 +3018,6 @@ static int wlan_hdd_send_ll_stats_req(struct wlan_hdd_link_info *link_info,
 	}
 	qdf_list_destroy(&priv->ll_stats_q);
 	wlan_hdd_send_mlo_ll_iface_stats(adapter);
-	wlan_hdd_send_mlo_ll_peer_stats(hdd_ctx,
-					(struct wifi_peer_stat *)mlo_stats);
-	qdf_mem_free(mlo_stats);
 exit:
 	qdf_atomic_set(&adapter->is_ll_stats_req_pending, 0);
 	wlan_hdd_reset_station_stats_request_pending(hdd_ctx->psoc, adapter);