Jelajahi Sumber

qcacmn: skip monitor reap timer if irq is enabled

For CFR test, monitor reap timer will start, meanwhile
irq for monitor status ring is also enabled, these two will
conflict and access mon_pdev->rx_status_q in the same time,
skb double free issue is reported.

If irq for monitor status ring has been enabled, skip to start
monitor reap timer which is unnecessary.

Change-Id: Ic015d370cb80604d7e4c261054ad529b64edca25
CRs-Fixed: 3614097
Jinwei Chen 1 tahun lalu
induk
melakukan
65fdbbce9a
2 mengubah file dengan 41 tambahan dan 2 penghapusan
  1. 22 2
      dp/wifi3.0/monitor/1.0/dp_mon_1.0.c
  2. 19 0
      hal/wifi3.0/hal_api.h

+ 22 - 2
dp/wifi3.0/monitor/1.0/dp_mon_1.0.c

@@ -604,6 +604,25 @@ static void dp_mon_reap_timer_deinit(struct dp_soc *soc)
         }
 }
 
+/**
+ * dp_mon_is_irq_enabled() - check if DP monitor status srng irq enabled
+ * @soc: point to soc
+ *
+ * Return: true if irq enabled, false if not.
+ */
+static bool
+dp_mon_is_irq_enabled(struct dp_soc *soc)
+{
+	void *mon_status_srng;
+
+	mon_status_srng = soc->rxdma_mon_status_ring[0].hal_srng;
+
+	if (!mon_status_srng)
+		return false;
+
+	return hal_srng_batch_threshold_irq_enabled(mon_status_srng);
+}
+
 /**
  * dp_mon_reap_timer_start() - start reap timer of monitor status ring
  * @soc: point to soc
@@ -621,7 +640,8 @@ dp_mon_reap_timer_start(struct dp_soc *soc, enum cdp_mon_reap_source source)
 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
 	bool do_start;
 
-	if (!mon_soc->reap_timer_init)
+	/* if monitor status ring irq enabled, no need to start timer */
+	if (!mon_soc->reap_timer_init || dp_mon_is_irq_enabled(soc))
 		return false;
 
 	qdf_spin_lock_bh(&mon_soc->reap_timer_lock);
@@ -656,7 +676,7 @@ dp_mon_reap_timer_stop(struct dp_soc *soc, enum cdp_mon_reap_source source)
 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
 	bool do_stop;
 
-	if (!mon_soc->reap_timer_init)
+	if (!mon_soc->reap_timer_init || dp_mon_is_irq_enabled(soc))
 		return false;
 
 	qdf_spin_lock_bh(&mon_soc->reap_timer_lock);

+ 19 - 0
hal/wifi3.0/hal_api.h

@@ -3507,6 +3507,25 @@ uint16_t hal_srng_dst_get_hpidx(hal_ring_handle_t hal_ring_hdl)
 	return hp / srng->entry_size;
 }
 
+/**
+ * hal_srng_batch_threshold_irq_enabled() - check if srng batch count
+ *                                          threshold irq enabled
+ * @hal_ring_hdl: srng handle
+ *
+ * Return: true if enabled, false if not.
+ */
+static inline
+bool hal_srng_batch_threshold_irq_enabled(hal_ring_handle_t hal_ring_hdl)
+{
+	struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
+
+	if (srng->intr_batch_cntr_thres_entries &&
+	    srng->flags & HAL_SRNG_MSI_INTR)
+		return true;
+	else
+		return false;
+}
+
 #ifdef FEATURE_DIRECT_LINK
 /**
  * hal_srng_set_msi_irq_config() - Set the MSI irq configuration for srng