Selaa lähdekoodia

qcacld-3.0: Process partner link stats for MLO connection

Send connected links bitmap to FW via a command:
WMI_REQUEST_STATS_EXT_CMDID in case of MLO connection.

Host receives partner link stats via WMI_STATS_EXT_EVENTID
event and sends information of partner links to upper layer.

Change-Id: Iddd617f1acb5e29e4ba6d52baae0b421c4886063
CRs-Fixed: 3148451
Arun Kumar Khandavalli 3 vuotta sitten
vanhempi
sitoutus
c0c9d4a1bb
2 muutettua tiedostoa jossa 101 lisäystä ja 2 poistoa
  1. 57 0
      core/wma/src/wma_features.c
  2. 44 2
      core/wma/src/wma_utils.c

+ 57 - 0
core/wma/src/wma_features.c

@@ -73,6 +73,7 @@
 #include <wlan_crypto_global_api.h>
 #include "cdp_txrx_host_stats.h"
 #include "target_if_cm_roam_event.h"
+#include <wlan_mlo_mgr_cmn.h>
 
 /**
  * WMA_SET_VDEV_IE_SOURCE_HOST - Flag to identify the source of VDEV SET IE
@@ -3267,6 +3268,59 @@ QDF_STATUS wma_process_del_periodic_tx_ptrn_ind(WMA_HANDLE handle,
 }
 
 #ifdef WLAN_FEATURE_STATS_EXT
+#ifdef WLAN_FEATURE_11BE_MLO
+/*
+ * wma_stats_ext_req_vdev_id_bitmap() -API to calculate connected links bitmap
+ * in case of MLO.
+ * psoc: psoc common object
+ * vdev_id: vdev_id for the stats ext request
+ * bitmap: connected links bitmap
+ *
+ * Return None
+ */
+static void wma_stats_ext_req_vdev_id_bitmap(struct wlan_objmgr_psoc *psoc,
+					     uint32_t vdev_id, uint32_t *bitmap)
+{
+	struct wlan_objmgr_vdev *vdev, *link_vdev;
+	struct wlan_mlo_dev_context *mlo_dev_ctx;
+	uint32_t i, connected_links_bitmap = 0;
+	uint8_t connected_vdev_id;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_LEGACY_WMA_ID);
+	if (!vdev) {
+		wma_err("vdev object is NULL for vdev_id %d", vdev_id);
+		return;
+	}
+
+	mlo_dev_ctx = vdev->mlo_dev_ctx;
+	if (!mlo_dev_ctx)
+		goto end;
+
+	for (i = 0; i < WLAN_UMAC_MLO_MAX_VDEVS; i++) {
+		link_vdev = mlo_dev_ctx->wlan_vdev_list[i];
+		if (!link_vdev)
+			continue;
+
+		connected_vdev_id = wlan_vdev_get_id(link_vdev);
+		if (wlan_cm_is_vdev_connected(link_vdev))
+			connected_links_bitmap |= BIT(connected_vdev_id);
+	}
+
+	wma_debug("mlo connected links bitmap[0x%x]", connected_links_bitmap);
+	*bitmap = connected_links_bitmap;
+
+end:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID);
+}
+#else
+static void wma_stats_ext_req_vdev_id_bitmap(struct wlan_objmgr_psoc *psoc,
+					     uint32_t vdev_id, uint32_t *bitmap)
+{
+	*bitmap = 0;
+}
+#endif
+
 QDF_STATUS wma_stats_ext_req(void *wma_ptr, tpStatsExtRequest preq)
 {
 	tp_wma_handle wma = (tp_wma_handle) wma_ptr;
@@ -3290,6 +3344,9 @@ QDF_STATUS wma_stats_ext_req(void *wma_ptr, tpStatsExtRequest preq)
 		qdf_mem_copy(params->request_data, preq->request_data,
 			     params->request_data_len);
 
+	wma_stats_ext_req_vdev_id_bitmap(wma->psoc, params->vdev_id,
+					 &params->vdev_id_bitmap);
+
 	status = wmi_unified_stats_ext_req_cmd(wma->wmi_handle, params);
 	qdf_mem_free(params);
 

+ 44 - 2
core/wma/src/wma_utils.c

@@ -695,9 +695,10 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf,
 	QDF_STATUS status;
 	struct scheduler_msg cds_msg = {0};
 	uint8_t *buf_ptr;
-	uint32_t alloc_len;
+	uint32_t alloc_len = 0, i, partner_links_data_len = 0;
 	struct cdp_txrx_ext_stats ext_stats = {0};
 	struct cdp_soc_t *soc_hdl = cds_get_context(QDF_MODULE_ID_SOC);
+	wmi_partner_link_stats *link_stats;
 
 	wma_debug("Posting stats ext event to SME");
 
@@ -707,13 +708,30 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf,
 		return -EINVAL;
 	}
 
+	if (param_buf->num_partner_link_stats)
+		wma_debug("number of partner link stats:%d",
+			  param_buf->num_partner_link_stats);
+
 	stats_ext_info = param_buf->fixed_param;
 	buf_ptr = (uint8_t *)stats_ext_info;
 
-	alloc_len = sizeof(tSirStatsExtEvent);
+	alloc_len += sizeof(tSirStatsExtEvent);
 	alloc_len += stats_ext_info->data_len;
 	alloc_len += sizeof(struct cdp_txrx_ext_stats);
 
+	if (param_buf->num_partner_link_stats) {
+		link_stats = param_buf->partner_link_stats;
+		if (link_stats) {
+			for (i = 0; i < param_buf->num_partner_link_stats; i++) {
+				partner_links_data_len += link_stats->data_length;
+				link_stats++;
+			}
+		alloc_len += partner_links_data_len;
+		alloc_len += param_buf->num_partner_link_stats *
+			     sizeof(struct cdp_txrx_ext_stats);
+		}
+	}
+
 	if (stats_ext_info->data_len > (WMI_SVC_MSG_MAX_SIZE -
 	    WMI_TLV_HDR_SIZE - sizeof(*stats_ext_info)) ||
 	    stats_ext_info->data_len > param_buf->num_data) {
@@ -739,6 +757,30 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf,
 
 	stats_ext_event->event_data_len += sizeof(struct cdp_txrx_ext_stats);
 
+	if (param_buf->num_partner_link_stats) {
+		link_stats = param_buf->partner_link_stats;
+		if (link_stats) {
+			for (i = 0; i < param_buf->num_partner_link_stats; i++) {
+				qdf_mem_copy(((uint8_t *)stats_ext_event->event_data) +
+					     stats_ext_event->event_data_len,
+					     param_buf->partner_link_data +
+					     link_stats->offset,
+					     link_stats->data_length);
+
+				stats_ext_event->event_data_len +=
+							link_stats->data_length;
+
+				qdf_mem_copy(stats_ext_event->event_data +
+						stats_ext_event->event_data_len,
+						&ext_stats,
+						sizeof(struct cdp_txrx_ext_stats));
+				stats_ext_event->event_data_len +=
+					sizeof(struct cdp_txrx_ext_stats);
+				link_stats++;
+			}
+		}
+	}
+
 	cds_msg.type = eWNI_SME_STATS_EXT_EVENT;
 	cds_msg.bodyptr = (void *)stats_ext_event;
 	cds_msg.bodyval = 0;