Эх сурвалжийг харах

qcacmn: Allocate memory dynamically in mgmt Rx REO module

Allocate memory dynamically for management Rx reorder data structures.

CRs-Fixed: 3260284
Change-Id: I5aee3c5a3c861f5fc99bf8ad41bcbbe3305ef172
Edayilliam Jayadev 2 жил өмнө
parent
commit
de3d501003

+ 434 - 58
umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_rx_reo.c

@@ -26,9 +26,10 @@
 #include <qdf_util.h>
 #include <wlan_mlo_mgr_cmn.h>
 
-static struct mgmt_rx_reo_context g_rx_reo_ctx;
+static struct mgmt_rx_reo_context *g_rx_reo_ctx;
 
-#define mgmt_rx_reo_get_context()        (&g_rx_reo_ctx)
+#define mgmt_rx_reo_get_context()        (g_rx_reo_ctx)
+#define mgmt_rx_reo_set_context(c)       (g_rx_reo_ctx = c)
 
 #define MGMT_RX_REO_PKT_CTR_HALF_RANGE (0x8000)
 #define MGMT_RX_REO_PKT_CTR_FULL_RANGE (MGMT_RX_REO_PKT_CTR_HALF_RANGE << 1)
@@ -1446,6 +1447,20 @@ mgmt_rx_reo_list_display(struct mgmt_rx_reo_list *reo_list)
 }
 
 #ifdef WLAN_MGMT_RX_REO_DEBUG_SUPPORT
+/**
+ * mgmt_rx_reo_egress_frame_debug_info_enabled() - API to check whether egress
+ * frame info debug feaure is enabled
+ * @egress_frame_debug_info: Pointer to egress frame debug info object
+ *
+ * Return: true or false
+ */
+static bool
+mgmt_rx_reo_egress_frame_debug_info_enabled
+			(struct reo_egress_debug_info *egress_frame_debug_info)
+{
+	return egress_frame_debug_info->frame_list_size;
+}
+
 /**
  * mgmt_rx_reo_debug_print_egress_frame_stats() - API to print the stats
  * related to frames going out of the reorder module
@@ -1585,11 +1600,20 @@ mgmt_rx_reo_log_egress_frame_before_delivery(
 
 	egress_frame_debug_info = &reo_ctx->egress_frame_debug_info;
 
+	stats = &egress_frame_debug_info->stats;
+	link_id = mgmt_rx_reo_get_link_id(entry->rx_params);
+	stats->delivery_attempts_count[link_id]++;
+	if (entry->is_premature_delivery)
+		stats->premature_delivery_count[link_id]++;
+
+	if (!mgmt_rx_reo_egress_frame_debug_info_enabled
+						(egress_frame_debug_info))
+		return QDF_STATUS_SUCCESS;
+
 	cur_frame_debug_info = &egress_frame_debug_info->frame_list
 			[egress_frame_debug_info->next_index];
 
-	cur_frame_debug_info->link_id =
-				mgmt_rx_reo_get_link_id(entry->rx_params);
+	cur_frame_debug_info->link_id = link_id;
 	cur_frame_debug_info->mgmt_pkt_ctr =
 				mgmt_rx_reo_get_pkt_counter(entry->rx_params);
 	cur_frame_debug_info->global_timestamp =
@@ -1612,12 +1636,6 @@ mgmt_rx_reo_log_egress_frame_before_delivery(
 						entry->is_premature_delivery;
 	cur_frame_debug_info->cpu_id = qdf_get_smp_processor_id();
 
-	stats = &egress_frame_debug_info->stats;
-	link_id = cur_frame_debug_info->link_id;
-	stats->delivery_attempts_count[link_id]++;
-	if (entry->is_premature_delivery)
-		stats->premature_delivery_count[link_id]++;
-
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -1633,17 +1651,30 @@ mgmt_rx_reo_log_egress_frame_before_delivery(
 static QDF_STATUS
 mgmt_rx_reo_log_egress_frame_after_delivery(
 					struct mgmt_rx_reo_context *reo_ctx,
-					struct mgmt_rx_reo_list_entry *entry)
+					struct mgmt_rx_reo_list_entry *entry,
+					uint8_t link_id)
 {
 	struct reo_egress_debug_info *egress_frame_debug_info;
 	struct reo_egress_debug_frame_info *cur_frame_debug_info;
 	struct reo_egress_frame_stats *stats;
 
-	if (!reo_ctx)
+	if (!reo_ctx || !entry)
 		return QDF_STATUS_E_NULL_VALUE;
 
 	egress_frame_debug_info = &reo_ctx->egress_frame_debug_info;
 
+	stats = &egress_frame_debug_info->stats;
+	if (entry->is_delivered) {
+		uint8_t release_reason = entry->release_reason;
+
+		stats->delivery_count[link_id][release_reason]++;
+		stats->delivery_success_count[link_id]++;
+	}
+
+	if (!mgmt_rx_reo_egress_frame_debug_info_enabled
+						(egress_frame_debug_info))
+		return QDF_STATUS_SUCCESS;
+
 	cur_frame_debug_info = &egress_frame_debug_info->frame_list
 			[egress_frame_debug_info->next_index];
 
@@ -1653,19 +1684,10 @@ mgmt_rx_reo_log_egress_frame_after_delivery(
 
 	egress_frame_debug_info->next_index++;
 	egress_frame_debug_info->next_index %=
-				MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX;
+				egress_frame_debug_info->frame_list_size;
 	if (egress_frame_debug_info->next_index == 0)
 		egress_frame_debug_info->wrap_aroud = true;
 
-	stats = &egress_frame_debug_info->stats;
-	if (entry->is_delivered) {
-		uint8_t link_id = cur_frame_debug_info->link_id;
-		uint8_t release_reason = cur_frame_debug_info->release_reason;
-
-		stats->delivery_count[link_id][release_reason]++;
-		stats->delivery_success_count[link_id]++;
-	}
-
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -1697,7 +1719,7 @@ mgmt_rx_reo_debug_print_egress_frame_info(struct mgmt_rx_reo_context *reo_ctx,
 	egress_frame_debug_info = &reo_ctx->egress_frame_debug_info;
 
 	if (egress_frame_debug_info->wrap_aroud)
-		num_valid_entries = MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX;
+		num_valid_entries = egress_frame_debug_info->frame_list_size;
 	else
 		num_valid_entries = egress_frame_debug_info->next_index;
 
@@ -1713,11 +1735,11 @@ mgmt_rx_reo_debug_print_egress_frame_info(struct mgmt_rx_reo_context *reo_ctx,
 
 		start_index = (egress_frame_debug_info->next_index -
 			       num_entries_to_print +
-			       MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX)
-			      % MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX;
+			       egress_frame_debug_info->frame_list_size)
+			      % egress_frame_debug_info->frame_list_size;
 
 		qdf_assert_always(start_index >= 0 &&
-				  start_index < MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX);
+				  start_index < egress_frame_debug_info->frame_list_size);
 	}
 
 	mgmt_rx_reo_alert_no_fl("Egress Frame Info:-");
@@ -1841,7 +1863,7 @@ mgmt_rx_reo_debug_print_egress_frame_info(struct mgmt_rx_reo_context *reo_ctx,
 		mgmt_rx_reo_alert_no_fl("%s", boarder);
 
 		index++;
-		index %= MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX;
+		index %= egress_frame_debug_info->frame_list_size;
 	}
 
 	return QDF_STATUS_SUCCESS;
@@ -2018,7 +2040,8 @@ mgmt_rx_reo_list_entry_send_up(struct mgmt_rx_reo_list *reo_list,
 	status = QDF_STATUS_SUCCESS;
 
 exit_log:
-	temp = mgmt_rx_reo_log_egress_frame_after_delivery(reo_context, entry);
+	temp = mgmt_rx_reo_log_egress_frame_after_delivery(reo_context, entry,
+							   link_id);
 	if (QDF_IS_STATUS_ERROR(temp))
 		status = temp;
 exit:
@@ -2767,6 +2790,20 @@ failure_debug:
 }
 
 #ifdef WLAN_MGMT_RX_REO_DEBUG_SUPPORT
+/**
+ * mgmt_rx_reo_ingress_frame_debug_info_enabled() - API to check whether ingress
+ * frame info debug feaure is enabled
+ * @ingress_frame_debug_info: Pointer to ingress frame debug info object
+ *
+ * Return: true or false
+ */
+static bool
+mgmt_rx_reo_ingress_frame_debug_info_enabled
+		(struct reo_ingress_debug_info *ingress_frame_debug_info)
+{
+	return ingress_frame_debug_info->frame_list_size;
+}
+
 /**
  * mgmt_rx_reo_debug_print_ingress_frame_stats() - API to print the stats
  * related to frames going into the reorder module
@@ -2945,11 +2982,28 @@ mgmt_rx_reo_log_ingress_frame(struct mgmt_rx_reo_context *reo_ctx,
 
 	ingress_frame_debug_info = &reo_ctx->ingress_frame_debug_info;
 
+	stats = &ingress_frame_debug_info->stats;
+	link_id = mgmt_rx_reo_get_link_id(desc->rx_params);
+	stats->ingress_count[link_id][desc->type]++;
+	if (is_queued)
+		stats->queued_count[link_id]++;
+	if (desc->zero_wait_count_rx)
+		stats->zero_wait_count_rx_count[link_id]++;
+	if (desc->immediate_delivery)
+		stats->immediate_delivery_count[link_id]++;
+	if (is_error)
+		stats->error_count[link_id][desc->type]++;
+	if (desc->is_stale)
+		stats->stale_count[link_id][desc->type]++;
+
+	if (!mgmt_rx_reo_ingress_frame_debug_info_enabled
+						(ingress_frame_debug_info))
+		return QDF_STATUS_SUCCESS;
+
 	cur_frame_debug_info = &ingress_frame_debug_info->frame_list
 			[ingress_frame_debug_info->next_index];
 
-	cur_frame_debug_info->link_id =
-				mgmt_rx_reo_get_link_id(desc->rx_params);
+	cur_frame_debug_info->link_id = link_id;
 	cur_frame_debug_info->mgmt_pkt_ctr =
 				mgmt_rx_reo_get_pkt_counter(desc->rx_params);
 	cur_frame_debug_info->global_timestamp =
@@ -2989,24 +3043,10 @@ mgmt_rx_reo_log_ingress_frame(struct mgmt_rx_reo_context *reo_ctx,
 
 	ingress_frame_debug_info->next_index++;
 	ingress_frame_debug_info->next_index %=
-				MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX;
+				ingress_frame_debug_info->frame_list_size;
 	if (ingress_frame_debug_info->next_index == 0)
 		ingress_frame_debug_info->wrap_aroud = true;
 
-	stats = &ingress_frame_debug_info->stats;
-	link_id = cur_frame_debug_info->link_id;
-	stats->ingress_count[link_id][desc->type]++;
-	if (is_queued)
-		stats->queued_count[link_id]++;
-	if (desc->zero_wait_count_rx)
-		stats->zero_wait_count_rx_count[link_id]++;
-	if (desc->immediate_delivery)
-		stats->immediate_delivery_count[link_id]++;
-	if (is_error)
-		stats->error_count[link_id][desc->type]++;
-	if (desc->is_stale)
-		stats->stale_count[link_id][desc->type]++;
-
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -3038,7 +3078,7 @@ mgmt_rx_reo_debug_print_ingress_frame_info(struct mgmt_rx_reo_context *reo_ctx,
 	ingress_frame_debug_info = &reo_ctx->ingress_frame_debug_info;
 
 	if (ingress_frame_debug_info->wrap_aroud)
-		num_valid_entries = MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX;
+		num_valid_entries = ingress_frame_debug_info->frame_list_size;
 	else
 		num_valid_entries = ingress_frame_debug_info->next_index;
 
@@ -3054,11 +3094,11 @@ mgmt_rx_reo_debug_print_ingress_frame_info(struct mgmt_rx_reo_context *reo_ctx,
 
 		start_index = (ingress_frame_debug_info->next_index -
 			       num_entries_to_print +
-			       MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX)
-			      % MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX;
+			       ingress_frame_debug_info->frame_list_size)
+			      % ingress_frame_debug_info->frame_list_size;
 
 		qdf_assert_always(start_index >= 0 &&
-				  start_index < MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX);
+				  start_index < ingress_frame_debug_info->frame_list_size);
 	}
 
 	mgmt_rx_reo_alert_no_fl("Ingress Frame Info:-");
@@ -3203,7 +3243,7 @@ mgmt_rx_reo_debug_print_ingress_frame_info(struct mgmt_rx_reo_context *reo_ctx,
 		mgmt_rx_reo_alert_no_fl("%s", boarder);
 
 		index++;
-		index %= MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX;
+		index %= ingress_frame_debug_info->frame_list_size;
 	}
 
 	return QDF_STATUS_SUCCESS;
@@ -4904,6 +4944,318 @@ mgmt_rx_reo_sim_get_snapshot_address(
 }
 #endif /* WLAN_MGMT_RX_REO_SIM_SUPPORT */
 
+#ifdef WLAN_MGMT_RX_REO_DEBUG_SUPPORT
+/**
+ * mgmt_rx_reo_ingress_debug_info_init() - Initialize the management rx-reorder
+ * ingress frame debug info
+ * @psoc: Pointer to psoc
+ * @ingress_debug_info_init_count: Initialization count
+ * @ingress_frame_debug_info: Ingress frame debug info object
+ *
+ * API to initialize the management rx-reorder ingress frame debug info.
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+mgmt_rx_reo_ingress_debug_info_init
+		(struct wlan_objmgr_psoc *psoc,
+		 qdf_atomic_t *ingress_debug_info_init_count,
+		 struct reo_ingress_debug_info *ingress_frame_debug_info)
+{
+	if (!psoc) {
+		mgmt_rx_reo_err("psoc is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!ingress_frame_debug_info) {
+		mgmt_rx_reo_err("Ingress frame debug info is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	/* We need to initialize only for the first invocation */
+	if (qdf_atomic_read(ingress_debug_info_init_count))
+		goto success;
+
+	ingress_frame_debug_info->frame_list_size =
+		wlan_mgmt_rx_reo_get_ingress_frame_debug_list_size(psoc);
+
+	if (ingress_frame_debug_info->frame_list_size) {
+		ingress_frame_debug_info->frame_list = qdf_mem_malloc
+			(ingress_frame_debug_info->frame_list_size *
+			 sizeof(*ingress_frame_debug_info->frame_list));
+
+		if (!ingress_frame_debug_info->frame_list) {
+			mgmt_rx_reo_err("Failed to allocate debug info");
+			return QDF_STATUS_E_NOMEM;
+		}
+	}
+
+	/* Initialize the string for storing the debug info table boarder */
+	qdf_mem_set(ingress_frame_debug_info->boarder,
+		    MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE, '-');
+
+success:
+	qdf_atomic_inc(ingress_debug_info_init_count);
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * mgmt_rx_reo_egress_debug_info_init() - Initialize the management rx-reorder
+ * egress frame debug info
+ * @psoc: Pointer to psoc
+ * @egress_debug_info_init_count: Initialization count
+ * @egress_frame_debug_info: Egress frame debug info object
+ *
+ * API to initialize the management rx-reorder egress frame debug info.
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+mgmt_rx_reo_egress_debug_info_init
+		(struct wlan_objmgr_psoc *psoc,
+		 qdf_atomic_t *egress_debug_info_init_count,
+		 struct reo_egress_debug_info *egress_frame_debug_info)
+{
+	if (!psoc) {
+		mgmt_rx_reo_err("psoc is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!egress_frame_debug_info) {
+		mgmt_rx_reo_err("Egress frame debug info is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	/* We need to initialize only for the first invocation */
+	if (qdf_atomic_read(egress_debug_info_init_count))
+		goto success;
+
+	egress_frame_debug_info->frame_list_size =
+		wlan_mgmt_rx_reo_get_egress_frame_debug_list_size(psoc);
+
+	if (egress_frame_debug_info->frame_list_size) {
+		egress_frame_debug_info->frame_list = qdf_mem_malloc
+				(egress_frame_debug_info->frame_list_size *
+				 sizeof(*egress_frame_debug_info->frame_list));
+
+		if (!egress_frame_debug_info->frame_list) {
+			mgmt_rx_reo_err("Failed to allocate debug info");
+			return QDF_STATUS_E_NOMEM;
+		}
+	}
+
+	/* Initialize the string for storing the debug info table boarder */
+	qdf_mem_set(egress_frame_debug_info->boarder,
+		    MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE, '-');
+
+success:
+	qdf_atomic_inc(egress_debug_info_init_count);
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * mgmt_rx_reo_debug_info_init() - Initialize the management rx-reorder debug
+ * info
+ * @pdev: pointer to pdev object
+ *
+ * API to initialize the management rx-reorder debug info.
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+mgmt_rx_reo_debug_info_init(struct wlan_objmgr_pdev *pdev)
+{
+	struct mgmt_rx_reo_context *reo_context;
+	QDF_STATUS status;
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+
+	if (!wlan_mgmt_rx_reo_is_feature_enabled_at_psoc(psoc))
+		return QDF_STATUS_SUCCESS;
+
+	reo_context = mgmt_rx_reo_get_context();
+	if (!reo_context) {
+		mgmt_rx_reo_err("reo context is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	status = mgmt_rx_reo_ingress_debug_info_init
+			(psoc, &reo_context->ingress_debug_info_init_count,
+			 &reo_context->ingress_frame_debug_info);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mgmt_rx_reo_err("Failed to initialize ingress debug info");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	status = mgmt_rx_reo_egress_debug_info_init
+			(psoc, &reo_context->egress_debug_info_init_count,
+			 &reo_context->egress_frame_debug_info);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mgmt_rx_reo_err("Failed to initialize egress debug info");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * mgmt_rx_reo_ingress_debug_info_deinit() - De initialize the management
+ * rx-reorder ingress frame debug info
+ * @psoc: Pointer to psoc
+ * @ingress_debug_info_init_count: Initialization count
+ * @ingress_frame_debug_info: Ingress frame debug info object
+ *
+ * API to de initialize the management rx-reorder ingress frame debug info.
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+mgmt_rx_reo_ingress_debug_info_deinit
+		(struct wlan_objmgr_psoc *psoc,
+		 qdf_atomic_t *ingress_debug_info_init_count,
+		 struct reo_ingress_debug_info *ingress_frame_debug_info)
+{
+	if (!psoc) {
+		mgmt_rx_reo_err("psoc is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!ingress_frame_debug_info) {
+		mgmt_rx_reo_err("Ingress frame debug info is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!qdf_atomic_read(ingress_debug_info_init_count)) {
+		mgmt_rx_reo_err("Ingress debug info ref cnt is 0");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	/* We need to de-initialize only for the last invocation */
+	if (qdf_atomic_dec_and_test(ingress_debug_info_init_count))
+		goto success;
+
+	if (ingress_frame_debug_info->frame_list) {
+		qdf_mem_free(ingress_frame_debug_info->frame_list);
+		ingress_frame_debug_info->frame_list = NULL;
+	}
+	ingress_frame_debug_info->frame_list_size = 0;
+
+	qdf_mem_zero(ingress_frame_debug_info->boarder,
+		     MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE + 1);
+
+success:
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * mgmt_rx_reo_egress_debug_info_deinit() - De initialize the management
+ * rx-reorder egress frame debug info
+ * @psoc: Pointer to psoc
+ * @egress_debug_info_init_count: Initialization count
+ * @egress_frame_debug_info: Egress frame debug info object
+ *
+ * API to de initialize the management rx-reorder egress frame debug info.
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+mgmt_rx_reo_egress_debug_info_deinit
+		(struct wlan_objmgr_psoc *psoc,
+		 qdf_atomic_t *egress_debug_info_init_count,
+		 struct reo_egress_debug_info *egress_frame_debug_info)
+{
+	if (!psoc) {
+		mgmt_rx_reo_err("psoc is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!egress_frame_debug_info) {
+		mgmt_rx_reo_err("Egress frame debug info is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!qdf_atomic_read(egress_debug_info_init_count)) {
+		mgmt_rx_reo_err("Egress debug info ref cnt is 0");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	/* We need to de-initialize only for the last invocation */
+	if (qdf_atomic_dec_and_test(egress_debug_info_init_count))
+		goto success;
+
+	if (egress_frame_debug_info->frame_list) {
+		qdf_mem_free(egress_frame_debug_info->frame_list);
+		egress_frame_debug_info->frame_list = NULL;
+	}
+	egress_frame_debug_info->frame_list_size = 0;
+
+	qdf_mem_zero(egress_frame_debug_info->boarder,
+		     MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE + 1);
+
+success:
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * mgmt_rx_reo_debug_info_deinit() - De initialize the management rx-reorder
+ * debug info
+ * @pdev: Pointer to pdev object
+ *
+ * API to de initialize the management rx-reorder debug info.
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+mgmt_rx_reo_debug_info_deinit(struct wlan_objmgr_pdev *pdev)
+{
+	struct mgmt_rx_reo_context *reo_context;
+	QDF_STATUS status;
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+
+	if (!wlan_mgmt_rx_reo_is_feature_enabled_at_psoc(psoc))
+		return QDF_STATUS_SUCCESS;
+
+	reo_context = mgmt_rx_reo_get_context();
+	if (!reo_context) {
+		mgmt_rx_reo_err("reo context is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	status = mgmt_rx_reo_ingress_debug_info_deinit
+			(psoc, &reo_context->ingress_debug_info_init_count,
+			 &reo_context->ingress_frame_debug_info);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mgmt_rx_reo_err("Failed to deinitialize ingress debug info");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	status = mgmt_rx_reo_egress_debug_info_deinit
+			(psoc, &reo_context->egress_debug_info_init_count,
+			 &reo_context->egress_frame_debug_info);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mgmt_rx_reo_err("Failed to deinitialize egress debug info");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static QDF_STATUS
+mgmt_rx_reo_debug_info_init(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS
+mgmt_rx_reo_debug_info_deinit(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* WLAN_MGMT_RX_REO_DEBUG_SUPPORT */
+
 /**
  * mgmt_rx_reo_flush_reorder_list() - Flush all entries in the reorder list
  * @reo_list: Pointer to reorder list
@@ -4992,15 +5344,19 @@ mgmt_rx_reo_deinit_context(void)
 	status = mgmt_rx_reo_sim_deinit(reo_context);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		mgmt_rx_reo_err("Failed to de initialize reo sim context");
+		qdf_mem_free(reo_context);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	status = mgmt_rx_reo_list_deinit(&reo_context->reo_list);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		mgmt_rx_reo_err("Failed to de-initialize mgmt Rx reo list");
+		qdf_mem_free(reo_context);
 		return status;
 	}
 
+	qdf_mem_free(reo_context);
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -5011,12 +5367,12 @@ mgmt_rx_reo_init_context(void)
 	QDF_STATUS temp;
 	struct mgmt_rx_reo_context *reo_context;
 
-	reo_context = mgmt_rx_reo_get_context();
+	reo_context = qdf_mem_malloc(sizeof(*reo_context));
 	if (!reo_context) {
-		mgmt_rx_reo_err("reo context is null");
+		mgmt_rx_reo_err("Failed to allocate reo context");
 		return QDF_STATUS_E_NULL_VALUE;
 	}
-	qdf_mem_zero(reo_context, sizeof(*reo_context));
+	mgmt_rx_reo_set_context(reo_context);
 
 	status = mgmt_rx_reo_list_init(&reo_context->reo_list);
 	if (QDF_IS_STATUS_ERROR(status)) {
@@ -5035,11 +5391,6 @@ mgmt_rx_reo_init_context(void)
 	qdf_timer_mod(&reo_context->reo_list.ageout_timer,
 		      MGMT_RX_REO_AGEOUT_TIMER_PERIOD_MS);
 
-	qdf_mem_set(reo_context->ingress_frame_debug_info.boarder,
-		    MGMT_RX_REO_INGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE, '-');
-	qdf_mem_set(reo_context->egress_frame_debug_info.boarder,
-		    MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE, '-');
-
 	return QDF_STATUS_SUCCESS;
 
 error_reo_list_deinit:
@@ -5318,6 +5669,13 @@ mgmt_rx_reo_pdev_obj_create_notification(
 
 	mgmt_txrx_pdev_ctx->mgmt_rx_reo_pdev_ctx = mgmt_rx_reo_pdev_ctx;
 
+	status = mgmt_rx_reo_debug_info_init(pdev);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mgmt_rx_reo_err("Failed to initialize debug info");
+		status = QDF_STATUS_E_NOMEM;
+		goto failure;
+	}
+
 	return QDF_STATUS_SUCCESS;
 
 failure:
@@ -5339,6 +5697,12 @@ mgmt_rx_reo_pdev_obj_destroy_notification(
 	if (!wlan_mgmt_rx_reo_is_feature_enabled_at_pdev(pdev))
 		return QDF_STATUS_SUCCESS;
 
+	status = mgmt_rx_reo_debug_info_deinit(pdev);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mgmt_rx_reo_err("Failed to de-initialize debug info");
+		return status;
+	}
+
 	qdf_mem_free(mgmt_txrx_pdev_ctx->mgmt_rx_reo_pdev_ctx);
 	mgmt_txrx_pdev_ctx->mgmt_rx_reo_pdev_ctx = NULL;
 
@@ -5351,6 +5715,18 @@ mgmt_rx_reo_pdev_obj_destroy_notification(
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+mgmt_rx_reo_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+mgmt_rx_reo_psoc_obj_destroy_notification(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
 bool
 mgmt_rx_reo_is_simulation_in_progress(void)
 {

+ 37 - 8
umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_rx_reo_i.h

@@ -65,9 +65,6 @@
 	((entry)->status & MGMT_RX_REO_STATUS_LIST_MAX_SIZE_EXCEEDED)
 
 #ifdef WLAN_MGMT_RX_REO_DEBUG_SUPPORT
-#define MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX             (1000)
-#define MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX              (1000)
-
 #define MGMT_RX_REO_EGRESS_FRAME_DEBUG_INFO_BOARDER_MAX_SIZE   (816)
 #define MGMT_RX_REO_EGRESS_FRAME_DELIVERY_REASON_STATS_BOARDER_A_MAX_SIZE  (66)
 #define MGMT_RX_REO_EGRESS_FRAME_DELIVERY_REASON_STATS_BOARDER_B_MAX_SIZE  (73)
@@ -162,6 +159,30 @@ mgmt_rx_reo_pdev_obj_destroy_notification(
 	struct wlan_objmgr_pdev *pdev,
 	struct mgmt_txrx_priv_pdev_context *mgmt_txrx_pdev_ctx);
 
+/**
+ * mgmt_rx_reo_psoc_obj_create_notification() - psoc create handler for
+ * management rx-reorder module
+ * @psoc: pointer to psoc object
+ *
+ * This function gets called from object manager when psoc is being created.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+mgmt_rx_reo_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * mgmt_rx_reo_psoc_obj_destroy_notification() - psoc destroy handler for
+ * management rx-reorder feature
+ * @psoc: pointer to psoc object
+ *
+ * This function gets called from object manager when psoc is being destroyed.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+mgmt_rx_reo_psoc_obj_destroy_notification(struct wlan_objmgr_psoc *psoc);
+
 /**
  * enum mgmt_rx_reo_frame_descriptor_type - Enumeration for management frame
  * descriptor type.
@@ -604,6 +625,7 @@ struct reo_egress_frame_stats {
  * struct reo_ingress_debug_info - Circular array to store the
  * debug information about the frames entering the reorder algorithm.
  * @frame_list: Circular array to store the debug info about frames
+ * @frame_list_size: Size of circular array @frame_list
  * @next_index: The index at which information about next frame will be logged
  * @wrap_aroud: Flag to indicate whether wrap around occurred when logging
  * debug information to @frame_list
@@ -611,8 +633,8 @@ struct reo_egress_frame_stats {
  * @boarder: boarder string
  */
 struct reo_ingress_debug_info {
-	struct reo_ingress_debug_frame_info
-			frame_list[MGMT_RX_REO_INGRESS_FRAME_DEBUG_ENTRIES_MAX];
+	struct reo_ingress_debug_frame_info *frame_list;
+	uint16_t frame_list_size;
 	int next_index;
 	bool wrap_aroud;
 	struct reo_ingress_frame_stats stats;
@@ -622,7 +644,8 @@ struct reo_ingress_debug_info {
 /**
  * struct reo_egress_debug_info - Circular array to store the
  * debug information about the frames leaving the reorder module.
- * @debug_info: Circular array to store the debug info
+ * @frame_list: Circular array to store the debug info
+ * @frame_list_size: Size of circular array @frame_list
  * @next_index: The index at which information about next frame will be logged
  * @wrap_aroud: Flag to indicate whether wrap around occurred when logging
  * debug information to @frame_list
@@ -630,8 +653,8 @@ struct reo_ingress_debug_info {
  * @boarder: boarder string
  */
 struct reo_egress_debug_info {
-	struct reo_egress_debug_frame_info
-			frame_list[MGMT_RX_REO_EGRESS_FRAME_DEBUG_ENTRIES_MAX];
+	struct reo_egress_debug_frame_info *frame_list;
+	uint16_t frame_list_size;
 	int next_index;
 	bool wrap_aroud;
 	struct reo_egress_frame_stats stats;
@@ -659,8 +682,12 @@ struct reo_egress_debug_info {
  * of management frames to upper layers in the strict order of MLO
  * global time stamp.
  * @sim_context: Management rx-reorder simulation context
+ * @ingress_debug_info_init_count: Initialization count of
+ * object @ingress_frame_debug_info
  * @ingress_frame_debug_info: Debug object to log incoming frames
  * @egress_frame_debug_info: Debug object to log outgoing frames
+ * @egress_debug_info_init_count: Initialization count of
+ * object @egress_frame_debug_info
  * @simulation_in_progress: Flag to indicate whether simulation is
  * in progress
  */
@@ -672,7 +699,9 @@ struct mgmt_rx_reo_context {
 	struct mgmt_rx_reo_sim_context sim_context;
 #endif /* WLAN_MGMT_RX_REO_SIM_SUPPORT */
 #ifdef WLAN_MGMT_RX_REO_DEBUG_SUPPORT
+	qdf_atomic_t ingress_debug_info_init_count;
 	struct  reo_ingress_debug_info ingress_frame_debug_info;
+	qdf_atomic_t egress_debug_info_init_count;
 	struct  reo_egress_debug_info egress_frame_debug_info;
 #endif /* WLAN_MGMT_RX_REO_DEBUG_SUPPORT */
 	bool simulation_in_progress;

+ 53 - 1
umac/cmn_services/mgmt_txrx/dispatcher/inc/cfg_mgmt_rx_reo.h

@@ -72,9 +72,61 @@
 		0, 0xFFFF, 0,\
 		CFG_VALUE_OR_DEFAULT, "Packet counter delta threshold")
 
+/*
+ * <ini>
+ * mgmt_rx_reo_ingress_frame_debug_list_size - Size of the list which logs the
+ * incoming management frames
+ * @Min: 0
+ * @Max: WLAN_MGMT_RX_REO_INGRESS_FRAME_DEBUG_LIST_SIZE_MAX
+ * @Default: WLAN_MGMT_RX_REO_INGRESS_FRAME_DEBUG_LIST_SIZE_DEFAULT
+ *
+ * This ini is used to configure the size of the list which logs the incoming
+ * management frames.
+ *
+ * Related: None
+ *
+ * Supported Feature: MGMT Rx REO
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_MGMT_RX_REO_INGRESS_FRAME_DEBUG_LIST_SIZE CFG_INI_UINT(\
+		"mgmt_rx_reo_ingress_frame_debug_list_size",\
+		0, WLAN_MGMT_RX_REO_INGRESS_FRAME_DEBUG_LIST_SIZE_MAX,\
+		WLAN_MGMT_RX_REO_INGRESS_FRAME_DEBUG_LIST_SIZE_DEFAULT,\
+		CFG_VALUE_OR_CLAMP, "Size of ingress frame debug list")
+
+/*
+ * <ini>
+ * mgmt_rx_reo_egress_frame_debug_list_size - Size of the list which logs the
+ * outgoing management frames
+ * @Min: 0
+ * @Max: WLAN_MGMT_RX_REO_EGRESS_FRAME_DEBUG_LIST_SIZE_MAX
+ * @Default: WLAN_MGMT_RX_REO_EGRESS_FRAME_DEBUG_LIST_SIZE_DEFAULT
+ *
+ * This ini is used to configure the size of the list which logs the outgoing
+ * management frames.
+ *
+ * Related: None
+ *
+ * Supported Feature: MGMT Rx REO
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_MGMT_RX_REO_EGRESS_FRAME_DEBUG_LIST_SIZE CFG_INI_UINT(\
+		"mgmt_rx_reo_egress_frame_debug_list_size",\
+		0, WLAN_MGMT_RX_REO_EGRESS_FRAME_DEBUG_LIST_SIZE_MAX,\
+		WLAN_MGMT_RX_REO_EGRESS_FRAME_DEBUG_LIST_SIZE_DEFAULT,\
+		CFG_VALUE_OR_CLAMP, "Size of egress frame debug list")
+
 #define CFG_MGMT_RX_REO_ALL \
 	CFG(CFG_MGMT_RX_REO_ENABLE) \
-	CFG(CFG_MGMT_RX_REO_PKT_CTR_DELTA_THRESH)
+	CFG(CFG_MGMT_RX_REO_PKT_CTR_DELTA_THRESH) \
+	CFG(CFG_MGMT_RX_REO_INGRESS_FRAME_DEBUG_LIST_SIZE) \
+	CFG(CFG_MGMT_RX_REO_EGRESS_FRAME_DEBUG_LIST_SIZE)
 #else
 
 #define CFG_MGMT_RX_REO_ALL

+ 76 - 0
umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_rx_reo_utils_api.h

@@ -256,6 +256,30 @@ wlan_mgmt_rx_reo_pdev_obj_destroy_notification(
 			struct wlan_objmgr_pdev *pdev,
 			struct mgmt_txrx_priv_pdev_context *mgmt_txrx_pdev_ctx);
 
+/**
+ * wlan_mgmt_rx_reo_psoc_obj_create_notification() - psoc create handler for
+ * management rx-reorder module
+ * @psoc: pointer to psoc object
+ *
+ * This function gets called from object manager when psoc is being created.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_mgmt_rx_reo_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * wlan_mgmt_rx_reo_psoc_obj_destroy_notification() - psoc destroy handler for
+ * management rx-reorder feature
+ * @psoc: pointer to psoc object
+ *
+ * This function gets called from object manager when psoc is being destroyed.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_mgmt_rx_reo_psoc_obj_destroy_notification(struct wlan_objmgr_psoc *psoc);
+
 /**
  * wlan_mgmt_rx_reo_attach() - Initializes the per pdev data structures related
  * to management rx-reorder module
@@ -306,6 +330,28 @@ wlan_mgmt_rx_reo_is_feature_enabled_at_pdev(struct wlan_objmgr_pdev *pdev);
 uint16_t
 wlan_mgmt_rx_reo_get_pkt_ctr_delta_thresh(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * wlan_mgmt_rx_reo_get_ingress_frame_debug_list_size() - Get the size of
+ * ingress  frame debug list
+ * @psoc: pointer to psoc object
+ *
+ * Return: Size of ingress frame debug list
+ */
+uint16_t
+wlan_mgmt_rx_reo_get_ingress_frame_debug_list_size
+					(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * wlan_mgmt_rx_reo_get_egress_frame_debug_list_size() - Get the size of
+ * egress  frame debug list
+ * @psoc: pointer to psoc object
+ *
+ * Return: Size of egress frame debug list
+ */
+uint16_t
+wlan_mgmt_rx_reo_get_egress_frame_debug_list_size
+					(struct wlan_objmgr_psoc *psoc);
+
 /**
  * wlan_mgmt_rx_reo_is_simulation_in_progress() - API to check whether
  * simulation is in progress
@@ -407,6 +453,36 @@ wlan_mgmt_rx_reo_pdev_obj_destroy_notification(
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * wlan_mgmt_rx_reo_psoc_obj_create_notification() - psoc create handler for
+ * management rx-reorder module
+ * @psoc: pointer to psoc object
+ *
+ * This function gets called from object manager when psoc is being created.
+ *
+ * Return: QDF_STATUS
+ */
+static inline QDF_STATUS
+wlan_mgmt_rx_reo_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * wlan_mgmt_rx_reo_psoc_obj_destroy_notification() - psoc destroy handler for
+ * management rx-reorder feature
+ * @psoc: pointer to psoc object
+ *
+ * This function gets called from object manager when psoc is being destroyed.
+ *
+ * Return: QDF_STATUS
+ */
+static inline QDF_STATUS
+wlan_mgmt_rx_reo_psoc_obj_destroy_notification(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * wlan_mgmt_rx_reo_attach() - Initializes the per pdev data structures related
  * to management rx-reorder module

+ 34 - 0
umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_rx_reo_utils_api.c

@@ -189,6 +189,18 @@ wlan_mgmt_rx_reo_pdev_obj_destroy_notification(
 							 mgmt_txrx_pdev_ctx);
 }
 
+QDF_STATUS
+wlan_mgmt_rx_reo_psoc_obj_create_notification(struct wlan_objmgr_psoc *psoc)
+{
+	return mgmt_rx_reo_psoc_obj_create_notification(psoc);
+}
+
+QDF_STATUS
+wlan_mgmt_rx_reo_psoc_obj_destroy_notification(struct wlan_objmgr_psoc *psoc)
+{
+	return mgmt_rx_reo_psoc_obj_destroy_notification(psoc);
+}
+
 QDF_STATUS
 wlan_mgmt_rx_reo_attach(struct wlan_objmgr_pdev *pdev)
 {
@@ -211,6 +223,28 @@ wlan_mgmt_rx_reo_get_pkt_ctr_delta_thresh(struct wlan_objmgr_psoc *psoc)
 	return cfg_get(psoc, CFG_MGMT_RX_REO_PKT_CTR_DELTA_THRESH);
 }
 
+uint16_t
+wlan_mgmt_rx_reo_get_ingress_frame_debug_list_size(struct wlan_objmgr_psoc *psoc)
+{
+	if (!psoc) {
+		mgmt_rx_reo_err("psoc is NULL!");
+		return 0;
+	}
+
+	return cfg_get(psoc, CFG_MGMT_RX_REO_INGRESS_FRAME_DEBUG_LIST_SIZE);
+}
+
+uint16_t
+wlan_mgmt_rx_reo_get_egress_frame_debug_list_size(struct wlan_objmgr_psoc *psoc)
+{
+	if (!psoc) {
+		mgmt_rx_reo_err("psoc is NULL!");
+		return 0;
+	}
+
+	return cfg_get(psoc, CFG_MGMT_RX_REO_EGRESS_FRAME_DEBUG_LIST_SIZE);
+}
+
 #ifndef WLAN_MGMT_RX_REO_SIM_SUPPORT
 bool
 wlan_mgmt_rx_reo_is_feature_enabled_at_psoc(struct wlan_objmgr_psoc *psoc)

+ 13 - 0
umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c

@@ -69,6 +69,12 @@ static QDF_STATUS wlan_mgmt_txrx_psoc_obj_create_notification(
 
 	qdf_spinlock_create(&mgmt_txrx_psoc_ctx->mgmt_txrx_psoc_ctx_lock);
 
+	status = wlan_mgmt_rx_reo_psoc_obj_create_notification(psoc);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mgmt_txrx_err("Failed to run mgmt Rx REO psoc create handler");
+		goto err_psoc_attach;
+	}
+
 	if (wlan_objmgr_psoc_component_obj_attach(psoc,
 				WLAN_UMAC_COMP_MGMT_TXRX,
 				mgmt_txrx_psoc_ctx, QDF_STATUS_SUCCESS)
@@ -106,6 +112,7 @@ static QDF_STATUS wlan_mgmt_txrx_psoc_obj_destroy_notification(
 			void *arg)
 {
 	struct mgmt_txrx_priv_psoc_context *mgmt_txrx_psoc_ctx;
+	QDF_STATUS status;
 
 	if (!psoc) {
 		mgmt_txrx_err("psoc context passed is NULL");
@@ -128,6 +135,12 @@ static QDF_STATUS wlan_mgmt_txrx_psoc_obj_destroy_notification(
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	status = wlan_mgmt_rx_reo_psoc_obj_destroy_notification(psoc);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mgmt_txrx_err("Failed to run mgmt Rx REO psoc destroy handler");
+		return status;
+	}
+
 	qdf_spinlock_destroy(&mgmt_txrx_psoc_ctx->mgmt_txrx_psoc_ctx_lock);
 	qdf_mem_free(mgmt_txrx_psoc_ctx);