summaryrefslogtreecommitdiff
path: root/hif/src/ce
diff options
context:
space:
mode:
authorDustin Brown <dustinb@codeaurora.org>2016-08-30 12:29:10 -0700
committerqcabuildsw <qcabuildsw@localhost>2016-09-02 02:08:08 -0700
commit973abe89e42d7a8e0919465bbba10bfb7b7b4900 (patch)
tree72cff247e470636912a35c5997e25743e566e907 /hif/src/ce
parentb019e0da84e78eb723f9d64e46dfd0b0fc23bffd (diff)
qcacmn: fake apps ensures correct ce_id before resume
Currently, the interrupt handler does not check for the correct ce_id before triggering a fake apps resume. This check is added to hif_fake_apps_resume(). Change-Id: I810c59bb8536356bd87a394c815a294755aa5161 CRs-Fixed: 1061287
Diffstat (limited to 'hif/src/ce')
-rw-r--r--hif/src/ce/ce_tasklet.c57
1 files changed, 41 insertions, 16 deletions
diff --git a/hif/src/ce/ce_tasklet.c b/hif/src/ce/ce_tasklet.c
index 2f6809fa4935..958efdba090a 100644
--- a/hif/src/ce/ce_tasklet.c
+++ b/hif/src/ce/ce_tasklet.c
@@ -271,11 +271,11 @@ int hif_drain_tasklets(struct hif_softc *scn)
#ifdef WLAN_SUSPEND_RESUME_TEST
static bool g_hif_apps_fake_suspended;
-static hdd_fake_resume_callback hdd_fake_aps_resume;
+static hdd_fake_resume_callback hdd_fake_apps_resume;
static void hif_wlan_resume_work_handler(struct work_struct *work)
{
- hdd_fake_aps_resume(0);
+ hdd_fake_apps_resume(0);
}
static DECLARE_WORK(hif_resume_work, hif_wlan_resume_work_handler);
@@ -284,41 +284,66 @@ static DECLARE_WORK(hif_resume_work, hif_wlan_resume_work_handler);
* hif_fake_apps_suspend(): Suspend WLAN
*
* Set the fake suspend flag such that hif knows that it will need
- * to fake the aps resume process using the hdd_fake_aps_resume
+ * to fake the apps resume process using the hdd_fake_apps_resume
*
* Return: none
*/
void hif_fake_apps_suspend(hdd_fake_resume_callback callback)
{
- hdd_fake_aps_resume = callback;
+ hdd_fake_apps_resume = callback;
g_hif_apps_fake_suspended = true;
}
/**
- * hif_fake_aps_resume(): check if WLAN resume is needed
+ * hif_fake_apps_resume(): trigger WLAN resume if needed
+ * @fid_hdl: hif context
+ * @ce_id: copy engine Id
*
- * Return: true if a fake apps resume has been been triggered
- * returns false if regular interrupt processing is needed
+ * Return: True if a fake apps resume has been been triggered,
+ * returns false if regular interrupt processing is needed.
+ * Ensures copy engine Id matches mapped Irq
*/
-static bool hif_fake_aps_resume(void)
+static bool hif_fake_apps_resume(struct hif_opaque_softc *hif_hdl, int ce_id)
{
- if (g_hif_apps_fake_suspended) {
- g_hif_apps_fake_suspended = false;
- schedule_work(&hif_resume_work);
- return true;
- } else {
+ uint8_t ul_pipe, dl_pipe;
+ int ul_is_polled, dl_is_polled;
+ QDF_STATUS status;
+
+ /* can't resume if not already suspended */
+ if (!g_hif_apps_fake_suspended)
+ return false;
+
+ /* ensure passed copy engine Id matches Id from irq map */
+
+ status = hif_map_service_to_pipe(hif_hdl, HTC_CTRL_RSVD_SVC,
+ &ul_pipe, &dl_pipe,
+ &ul_is_polled, &dl_is_polled);
+
+ if (status) {
+ HIF_ERROR("%s: pipe_mapping failure", __func__);
return false;
}
+
+ /* dl_pipe is equivalent to a copy engine Id at this point */
+ if (ce_id != dl_pipe)
+ return false;
+
+ /* trigger fake apps resume */
+ g_hif_apps_fake_suspended = false;
+ schedule_work(&hif_resume_work);
+ return true;
}
#else
/**
- * hif_fake_aps_resume(): check if WLAN resume is needed
+ * hif_fake_apps_resume(): trigger WLAN resume if needed
+ * @hif_hdl: hif context
+ * @ce_id: copy engine Id
*
* Return: always false if WLAN_SUSPEND_RESUME_TEST is not defined
*/
-static bool hif_fake_aps_resume(void)
+static bool hif_fake_apps_resume(struct hif_opaque_softc *hif_hdl, int ce_id)
{
return false;
}
@@ -426,7 +451,7 @@ irqreturn_t ce_dispatch_interrupt(int ce_id,
hif_record_ce_desc_event(scn, ce_id, HIF_IRQ_EVENT, NULL, NULL, 0);
hif_ce_increment_interrupt_count(hif_ce_state, ce_id);
- if (unlikely(hif_fake_aps_resume())) {
+ if (unlikely(hif_fake_apps_resume(hif_hdl, ce_id))) {
HIF_ERROR("received resume interrupt");
hif_irq_enable(scn, ce_id);
return IRQ_HANDLED;