Merge "qca-wifi: Add srng history for monitor mode"
diff --git a/dp/wifi3.0/dp_full_mon.c b/dp/wifi3.0/dp_full_mon.c
index ba6965e..94f059d 100644
--- a/dp/wifi3.0/dp_full_mon.c
+++ b/dp/wifi3.0/dp_full_mon.c
@@ -31,6 +31,7 @@
 
 uint32_t
 dp_rx_mon_status_process(struct dp_soc *soc,
+			 struct dp_intr *int_ctx,
 			 uint32_t mac_id,
 			 uint32_t quota);
 
@@ -39,12 +40,15 @@
  * against status buf addr given in monitor destination ring
  *
  * @pdev: DP pdev handle
+ * @int_ctx: Interrupt context
  * @mac_id: lmac id
  *
  * Return: QDF_STATUS
  */
 static inline enum dp_mon_reap_status
-dp_rx_mon_status_buf_validate(struct dp_pdev *pdev, uint32_t mac_id)
+dp_rx_mon_status_buf_validate(struct dp_pdev *pdev,
+			      struct dp_intr *int_ctx,
+			      uint32_t mac_id)
 {
 	struct dp_soc *soc = pdev->soc;
 	hal_soc_handle_t hal_soc;
@@ -304,12 +308,14 @@
  * status ring.
  *
  * @soc: DP soc handle
+ * @int_ctx: interrupt context
  * @mac_id: mac id on which interrupt is received
  * @quota: number of status ring entries to be reaped
  * @desc_info: Rx ppdu desc info
  */
 static inline uint32_t
 dp_rx_mon_reap_status_ring(struct dp_soc *soc,
+			   struct dp_intr *int_ctx,
 			   uint32_t mac_id,
 			   uint32_t quota,
 			   struct hal_rx_mon_desc_info *desc_info)
@@ -322,7 +328,7 @@
 	status_buf_count = desc_info->status_buf_count;
 	desc_info->drop_ppdu = false;
 
-	status = dp_rx_mon_status_buf_validate(pdev, mac_id);
+	status = dp_rx_mon_status_buf_validate(pdev, int_ctx, mac_id);
 	switch (status) {
 		case dp_mon_status_no_dma:
 			/* If DMA is not done for status ring entry,
@@ -357,7 +363,7 @@
 			break;
 		case dp_mon_status_replenish:
 			/* If status ring hp entry is NULL, replenish it */
-			work_done = dp_rx_mon_status_process(soc, mac_id, 1);
+			work_done = dp_rx_mon_status_process(soc,  int_ctx, mac_id, 1);
 			break;
 		case dp_mon_status_match:
 			/* If status ppdu id matches with destnation,
@@ -378,6 +384,7 @@
 	if (status == dp_mon_status_lag ||
 	    status == dp_mon_status_match) {
 		work_done = dp_rx_mon_status_process(soc,
+						     int_ctx,
 						     mac_id,
 						     status_buf_count);
 	}
@@ -588,6 +595,7 @@
  * dp_rx_mon_deliver_prev_ppdu () - Deliver previous PPDU
  *
  * @pdev: DP pdev handle
+ * @int_ctx: interrupt context
  * @mac_id: lmac id
  * @quota: quota
  *
@@ -595,6 +603,7 @@
  */
 static inline uint32_t
 dp_rx_mon_deliver_prev_ppdu(struct dp_pdev *pdev,
+			    struct dp_intr *int_ctx,
 			    uint32_t mac_id,
 			    uint32_t quota)
 {
@@ -606,7 +615,7 @@
 	enum dp_mon_reap_status status;
 
 	while (pdev->hold_mon_dest_ring) {
-		status = dp_rx_mon_status_buf_validate(pdev, mac_id);
+		status = dp_rx_mon_status_buf_validate(pdev, int_ctx, mac_id);
 
 		switch (status) {
 			case dp_mon_status_no_dma:
@@ -642,7 +651,7 @@
 			break;
 			case dp_mon_status_replenish:
 			/* If status ring hp entry is NULL, replenish it */
-			work = dp_rx_mon_status_process(soc, mac_id, 1);
+			work = dp_rx_mon_status_process(soc, int_ctx, mac_id, 1);
 			break;
 			case dp_mon_status_match:
 			/* If status ppdu id matches with destnation,
@@ -665,7 +674,7 @@
 		}
 
 		if (status == dp_mon_status_lag) {
-			work = dp_rx_mon_status_process(soc, mac_id, 1);
+			work = dp_rx_mon_status_process(soc, int_ctx, mac_id, 1);
 
 			if (!work)
 				return 0;
@@ -681,7 +690,7 @@
 			return work_done;
 		}
 
-		work_done += dp_rx_mon_status_process(soc, mac_id,
+		work_done += dp_rx_mon_status_process(soc, int_ctx, mac_id,
 				desc_info->status_buf_count);
 		dp_rx_monitor_deliver_ppdu(soc, mac_id);
 	}
@@ -696,12 +705,14 @@
  * Called from bottom half (tasklet/NET_RX_SOFTIRQ)
  *
  * @soc: datapath soc context
+ * @int_ctx: interrupt context
  * @mac_id: mac_id on which interrupt is received
  * @quota: Number of status ring entry that can be serviced in one shot.
  *
  * @Return: Number of reaped status ring entries
  */
-uint32_t dp_rx_mon_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota)
+uint32_t dp_rx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
+			   uint32_t mac_id, uint32_t quota)
 {
 	struct dp_pdev *pdev = dp_get_pdev_for_lmac_id(soc, mac_id);
 	union dp_rx_desc_list_elem_t *head_desc = NULL;
@@ -727,7 +738,8 @@
 
 	qdf_spin_lock_bh(&pdev->mon_lock);
 	if (qdf_unlikely(!dp_soc_is_full_mon_enable(pdev))) {
-		work_done += dp_rx_mon_status_process(soc, mac_id, quota);
+		work_done += dp_rx_mon_status_process(soc, int_ctx,
+						      mac_id, quota);
 		qdf_spin_unlock_bh(&pdev->mon_lock);
 		return work_done;
 	}
@@ -736,7 +748,7 @@
 
 	rx_mon_stats = &pdev->rx_mon_stats;
 
-	work_done = dp_rx_mon_deliver_prev_ppdu(pdev, mac_id, quota);
+	work_done = dp_rx_mon_deliver_prev_ppdu(pdev, int_ctx, mac_id, quota);
 
 	/* Do not proceed if work_done zero */
 	if (!work_done && pdev->hold_mon_dest_ring) {
@@ -758,8 +770,7 @@
 
 	qdf_assert_always(hal_soc && pdev);
 
-
-	if (qdf_unlikely(hal_srng_access_start(hal_soc, mon_dest_srng))) {
+	if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, mon_dest_srng))) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
 			  FL("HAL Monitor Destination Ring access Failed -- %pK"),
 			  mon_dest_srng);
@@ -880,7 +891,7 @@
 		 */
 		rx_mon_stats->dest_ppdu_done++;
 
-		work_done += dp_rx_mon_reap_status_ring(soc, mac_id,
+		work_done += dp_rx_mon_reap_status_ring(soc, int_ctx, mac_id,
 							quota, desc_info);
 		/* Deliver all MPDUs for a PPDU */
 		if (desc_info->drop_ppdu)
@@ -893,7 +904,7 @@
 		break;
 	}
 
-	hal_srng_access_end(hal_soc, mon_dest_srng);
+	dp_srng_access_end(int_ctx, soc, mon_dest_srng);
 
 done1:
 	qdf_spin_unlock_bh(&pdev->mon_lock);