Browse Source

qcacmn: Add flag in dp_mon_soc_be to avoid double deinit

Add flag in dp_mon_soc_be to avoid double deinit

Change-Id: Ie3f5f9fe3880311b169504c8f4c9861efcf1c4d3
CRs-Fixed: 3138172
Harsh Kumar Bijlani 3 years ago
parent
commit
bd7a797898
2 changed files with 14 additions and 0 deletions
  1. 11 0
      dp/wifi3.0/monitor/2.0/dp_mon_2.0.c
  2. 3 0
      dp/wifi3.0/monitor/2.0/dp_mon_2.0.h

+ 11 - 0
dp/wifi3.0/monitor/2.0/dp_mon_2.0.c

@@ -597,6 +597,9 @@ static void dp_mon_soc_deinit_2_0(struct dp_soc *soc)
 	struct dp_mon_soc_be *mon_soc_be =
 		dp_get_be_mon_soc_from_dp_mon_soc(mon_soc);
 
+	if (!mon_soc_be->is_dp_mon_soc_initialized)
+		return;
+
 	dp_rx_mon_buffers_free(soc);
 	dp_tx_mon_buffers_free(soc);
 
@@ -605,6 +608,8 @@ static void dp_mon_soc_deinit_2_0(struct dp_soc *soc)
 
 	dp_srng_deinit(soc, &soc->rxdma_mon_buf_ring[0], RXDMA_MONITOR_BUF, 0);
 	dp_srng_deinit(soc, &mon_soc_be->tx_mon_buf_ring, TX_MONITOR_BUF, 0);
+
+	mon_soc_be->is_dp_mon_soc_initialized = false;
 }
 
 static
@@ -664,6 +669,10 @@ fail:
 static
 QDF_STATUS dp_mon_soc_init_2_0(struct dp_soc *soc)
 {
+	struct dp_mon_soc *mon_soc = soc->monitor_soc;
+	struct dp_mon_soc_be *mon_soc_be =
+		dp_get_be_mon_soc_from_dp_mon_soc(mon_soc);
+
 	if (soc->rxdma_mon_buf_ring[0].hal_srng) {
 		dp_mon_info("%pK: mon soc init is done", soc);
 		return QDF_STATUS_SUCCESS;
@@ -678,6 +687,8 @@ QDF_STATUS dp_mon_soc_init_2_0(struct dp_soc *soc)
 		dp_mon_err("%pK: " RNG_ERR "tx_mon_buf_ring", soc);
 		goto fail;
 	}
+
+	mon_soc_be->is_dp_mon_soc_initialized = true;
 	return QDF_STATUS_SUCCESS;
 fail:
 	dp_mon_soc_deinit_2_0(soc);

+ 3 - 0
dp/wifi3.0/monitor/2.0/dp_mon_2.0.h

@@ -122,6 +122,7 @@ struct dp_mon_pdev_be {
  * @tx_mon_ring_fill_level: tx mon ring refill level
  * @tx_low_thresh_intrs: number of tx mon low threshold interrupts received
  * @rx_low_thresh_intrs: number of rx mon low threshold interrupts received
+ * @is_dp_mon_soc_initialized: flag to indicate soc is initialized
  */
 struct dp_mon_soc_be {
 	struct dp_mon_soc mon_soc;
@@ -138,6 +139,8 @@ struct dp_mon_soc_be {
 	uint16_t tx_mon_ring_fill_level;
 	uint32_t tx_low_thresh_intrs;
 	uint32_t rx_low_thresh_intrs;
+
+	bool is_dp_mon_soc_initialized;
 };
 #endif