summaryrefslogtreecommitdiff
path: root/hif/src/ce
diff options
context:
space:
mode:
authorHouston Hoffman <hhoffman@codeaurora.org>2016-08-08 21:08:04 -0700
committerVishwajith Upendra <vishwaji@codeaurora.org>2016-08-13 14:49:04 -0700
commit6f60b107c5749c50d03e55a28618ea93d0044dc6 (patch)
tree2b36ac0337f85ba5460b902a179864c40c410adf /hif/src/ce
parentcb9bc6333d4409a41c640e2ff6958ab7ef567872 (diff)
qcacmn: Move tasklet flush up to ce
Wish to reuse this logic for snoc Change-Id: Ibd678feec9fe0ee583d32d055d4cb4a4885991ab CRs-Fixed: 1051968
Diffstat (limited to 'hif/src/ce')
-rw-r--r--hif/src/ce/ce_tasklet.c29
-rw-r--r--hif/src/ce/ce_tasklet.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/hif/src/ce/ce_tasklet.c b/hif/src/ce/ce_tasklet.c
index 43d21a04744a..2f6809fa4935 100644
--- a/hif/src/ce/ce_tasklet.c
+++ b/hif/src/ce/ce_tasklet.c
@@ -240,6 +240,35 @@ void ce_tasklet_kill(struct hif_softc *scn)
qdf_atomic_set(&scn->active_tasklet_cnt, 0);
}
+#define HIF_CE_DRAIN_WAIT_CNT 20
+/**
+ * hif_drain_tasklets(): wait untill no tasklet is pending
+ * @scn: hif context
+ *
+ * Let running tasklets clear pending trafic.
+ *
+ * Return: 0 if no bottom half is in progress when it returns.
+ * -EFAULT if it times out.
+ */
+int hif_drain_tasklets(struct hif_softc *scn)
+{
+ uint32_t ce_drain_wait_cnt = 0;
+
+ while (qdf_atomic_read(&scn->active_tasklet_cnt)) {
+ if (++ce_drain_wait_cnt > HIF_CE_DRAIN_WAIT_CNT) {
+ HIF_ERROR("%s: CE still not done with access",
+ __func__);
+
+ return -EFAULT;
+ }
+ HIF_INFO("%s: Waiting for CE to finish access", __func__);
+ msleep(10);
+ }
+ return 0;
+}
+
+
+
#ifdef WLAN_SUSPEND_RESUME_TEST
static bool g_hif_apps_fake_suspended;
static hdd_fake_resume_callback hdd_fake_aps_resume;
diff --git a/hif/src/ce/ce_tasklet.h b/hif/src/ce/ce_tasklet.h
index 1b158aedfde7..a6fbdfd84856 100644
--- a/hif/src/ce/ce_tasklet.h
+++ b/hif/src/ce/ce_tasklet.h
@@ -31,6 +31,7 @@
void init_tasklet_workers(struct hif_opaque_softc *scn);
void ce_tasklet_init(struct HIF_CE_state *hif_ce_state, uint32_t mask);
void ce_tasklet_kill(struct hif_softc *scn);
+int hif_drain_tasklets(struct hif_softc *scn);
QDF_STATUS ce_register_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask);
QDF_STATUS ce_unregister_irq(struct HIF_CE_state *hif_ce_state, uint32_t mask);
irqreturn_t ce_dispatch_interrupt(int irq,