qcacld-3.0: Enable converged control path scheduler
Enable converged control path scheduler for cld driver
and disable legacy cds MC thread scheduler.
Change-Id: I11ecc6a5ee930a1039ed3460b3a3d4e5f7b75ac6
CRs-Fixed: 1095867
diff --git a/Kbuild b/Kbuild
index 459a90c..f8ace11 100644
--- a/Kbuild
+++ b/Kbuild
@@ -732,8 +732,7 @@
$(CDS_SRC_DIR)/cds_regdomain.o \
$(CDS_SRC_DIR)/cds_sched.o \
$(CDS_SRC_DIR)/cds_concurrency.o \
- $(CDS_SRC_DIR)/cds_utils.o \
- $(CDS_SRC_DIR)/cds_mc_timer.o
+ $(CDS_SRC_DIR)/cds_utils.o
########### BMI ###########
@@ -1311,6 +1310,10 @@
CDEFINES += -DWLAN_FEATURE_11W
endif
+#common scheduler changes are enabled using this macro
+#This needs to be cleaned up once WIN and MCL changes ready
+CDEFINES += -DNAPIER_CODE
+
ifeq ($(CONFIG_QCA_TXDESC_SANITY_CHECKS), 1)
CDEFINES += -DQCA_SUPPORT_TXDESC_SANITY_CHECKS
endif
diff --git a/core/cds/inc/cds_mc_timer.h b/core/cds/inc/cds_mc_timer.h
deleted file mode 100644
index e01937a..0000000
--- a/core/cds/inc/cds_mc_timer.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
-
-/**
- * DOC: cds_mc_timer.h
- *
- * Connectivity driver services public API
- *
- */
-
-#if !defined(__CDS_MC_TIMER_H)
-#define __CDS_MC_TIMER_H
-
-void cds_linux_timer_callback(unsigned long data);
-
-#endif /* __CDS_MC_TIMER_H */
diff --git a/core/cds/inc/cds_mq.h b/core/cds/inc/cds_mq.h
index d114e08..220d67c 100644
--- a/core/cds/inc/cds_mq.h
+++ b/core/cds/inc/cds_mq.h
@@ -43,6 +43,7 @@
------------------------------------------------------------------------*/
#include <qdf_types.h>
#include <qdf_status.h>
+#include <scheduler_api.h>
/*--------------------------------------------------------------------------
Preprocessor definitions and constants
@@ -57,7 +58,6 @@
the cds Message Queues.
\note This is mapped directly to the tSirMsgQ for backward
compatibility with the legacy MAC code */
-
typedef struct cds_msg_s {
uint16_t type;
/*
@@ -85,28 +85,10 @@
} cds_msg_t;
-/*-------------------------------------------------------------------------
- Function declarations and documenation
- ------------------------------------------------------------------------*/
-
-/* Message Queue IDs */
-typedef enum {
- /* Message Queue ID for messages bound for SME */
- CDS_MQ_ID_SME = QDF_MODULE_ID_SME,
-
- /* Message Queue ID for messages bound for PE */
- CDS_MQ_ID_PE = QDF_MODULE_ID_PE,
-
- /* Message Queue ID for messages bound for WMA */
- CDS_MQ_ID_WMA = QDF_MODULE_ID_WMA,
-
- /* Message Queue ID for messages bound for the SYS module */
- CDS_MQ_ID_SYS = QDF_MODULE_ID_SYS,
-
-} CDS_MQ_ID;
-
#define HIGH_PRIORITY 1
#define LOW_PRIORITY 0
+
+#ifndef NAPIER_CODE
QDF_STATUS cds_mq_post_message_by_priority(CDS_MQ_ID msg_queue_id,
cds_msg_t *message,
int is_high_priority);
@@ -133,6 +115,12 @@
return cds_mq_post_message_by_priority(msg_queue_id, message,
LOW_PRIORITY);
}
+#else
+#define cds_mq_post_message_by_priority(_x, _y, _z) \
+ scheduler_post_msg_by_priority((_x), ((struct scheduler_msg *)_y), (_z))
+#define cds_mq_post_message(_x, _y) \
+ scheduler_post_msg((_x), ((struct scheduler_msg *)_y))
+#endif
/**---------------------------------------------------------------------------
diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h
index 8ed224f..7503d72 100644
--- a/core/cds/inc/cds_sched.h
+++ b/core/cds/inc/cds_sched.h
@@ -53,12 +53,16 @@
#define TX_POST_EVENT_MASK 0x001
#define TX_SUSPEND_EVENT_MASK 0x002
+#ifndef NAPIER_CODE
#define MC_POST_EVENT_MASK 0x001
#define MC_SUSPEND_EVENT_MASK 0x002
+#endif
#define RX_POST_EVENT_MASK 0x001
#define RX_SUSPEND_EVENT_MASK 0x002
#define TX_SHUTDOWN_EVENT_MASK 0x010
+#ifndef NAPIER_CODE
#define MC_SHUTDOWN_EVENT_MASK 0x010
+#endif
#define RX_SHUTDOWN_EVENT_MASK 0x010
#define WD_POST_EVENT_MASK 0x001
#define WD_SHUTDOWN_EVENT_MASK 0x002
@@ -76,7 +80,11 @@
*
* Increased to 8000 to handle more RX frames
*/
+#ifndef NAPIER_CODE
#define CDS_CORE_MAX_MESSAGES 8000
+#else
+#define CDS_CORE_MAX_MESSAGES 1000
+#endif
#ifdef QCA_CONFIG_SMP
/*
@@ -131,6 +139,7 @@
typedef struct _cds_sched_context {
/* Place holder to the CDS Context */
void *pVContext;
+#ifndef NAPIER_CODE
/* WMA Message queue on the Main thread */
cds_mq_type wmaMcMq;
@@ -161,6 +170,7 @@
/* lock to make sure that McThread suspend/resume mechanism is in sync */
spinlock_t McThreadLock;
+#endif
#ifdef QCA_CONFIG_SMP
spinlock_t ol_rx_thread_lock;
diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c
index c551388..31ea52c 100644
--- a/core/cds/src/cds_api.c
+++ b/core/cds/src/cds_api.c
@@ -74,8 +74,10 @@
static p_cds_contextType gp_cds_context;
static struct __qdf_device g_qdf_ctx;
+#ifndef NAPIER_CODE
/* Debug variable to detect MC thread stuck */
static atomic_t cds_wrapper_empty_count;
+#endif
static uint8_t cds_multicast_logging;
@@ -216,6 +218,55 @@
cdp_cfg_set_packet_log_enabled(soc, gp_cds_context->cfg_ctx,
(uint8_t)cds_is_packet_log_enabled());
}
+#ifdef NAPIER_CODE
+static QDF_STATUS cds_register_all_modules(void)
+{
+ QDF_STATUS status;
+
+ scheduler_register_wma_legacy_handler(&wma_mc_process_handler);
+ scheduler_register_sys_legacy_handler(&sys_mc_process_handler);
+
+ /* Register message queues in given order such that queue priority is
+ * intact:
+ * 1) QDF_MODULE_ID_SYS: Timer queue(legacy SYS queue)
+ * 2) QDF_MODULE_ID_TARGET_IF: Target interface queue
+ * 3) QDF_MODULE_ID_PE: Legacy PE message queue
+ * 4) QDF_MODULE_ID_SME: Legacy SME message queue
+ * 5) QDF_MODULE_ID_OS_IF: OS IF message queue for new components
+ */
+ status = scheduler_register_module(QDF_MODULE_ID_SYS,
+ &scheduler_timer_q_mq_handler);
+ status = scheduler_register_module(QDF_MODULE_ID_TARGET_IF,
+ &scheduler_target_if_mq_handler);
+ status = scheduler_register_module(QDF_MODULE_ID_PE,
+ &pe_mc_process_handler);
+ status = scheduler_register_module(QDF_MODULE_ID_SME,
+ &sme_mc_process_handler);
+ status = scheduler_register_module(QDF_MODULE_ID_OS_IF,
+ &scheduler_os_if_mq_handler);
+ return status;
+}
+
+static QDF_STATUS cds_deregister_all_modules(void)
+{
+ QDF_STATUS status;
+ status = scheduler_deregister_module(QDF_MODULE_ID_SYS);
+ status = scheduler_deregister_module(QDF_MODULE_ID_WMA);
+ status = scheduler_deregister_module(QDF_MODULE_ID_PE);
+ status = scheduler_deregister_module(QDF_MODULE_ID_SME);
+ status = scheduler_deregister_module(QDF_MODULE_ID_OS_IF);
+ return status;
+}
+#else
+static QDF_STATUS cds_register_all_modules(void)
+{
+ return QDF_STATUS_SUCCESS;
+}
+static QDF_STATUS cds_deregister_all_modules(void)
+{
+ return QDF_STATUS_SUCCESS;
+}
+#endif
/**
* cds_open() - open the CDS Module
@@ -472,6 +523,7 @@
gp_cds_context->cdp_update_mac_id = cdp_update_mac_id;
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: CDS successfully Opened", __func__);
+ cds_register_all_modules();
dispatcher_psoc_open();
@@ -970,8 +1022,9 @@
cds_deinit_ini_config();
qdf_timer_module_deinit();
- dispatcher_psoc_close();
+ cds_deregister_all_modules();
+ dispatcher_psoc_close();
return QDF_STATUS_SUCCESS;
}
@@ -1409,6 +1462,7 @@
return QDF_STATUS_SUCCESS;
} /* cds_free_context() */
+#ifndef NAPIER_CODE
/**
* cds_mq_post_message_by_priority() - posts message using priority
* to message queue
@@ -1518,6 +1572,7 @@
return QDF_STATUS_SUCCESS;
} /* cds_mq_post_message() */
+#endif
/**
* cds_sys_probe_thread_cback() - probe mc thread callback
diff --git a/core/cds/src/cds_mc_timer.c b/core/cds/src/cds_mc_timer.c
deleted file mode 100644
index f46b95e..0000000
--- a/core/cds/src/cds_mc_timer.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file was originally distributed by Qualcomm Atheros, Inc.
- * under proprietary terms before Copyright ownership was assigned
- * to the Linux Foundation.
- */
-
-/**
- * DOC: cds_mc_timer.c
- * Connectivity driver services timer APIs
- */
-
-#include <qdf_mc_timer.h>
-#include "cds_mc_timer.h"
-#include <wlan_qct_sys.h>
-#include <qdf_trace.h>
-#include "cds_mq.h"
-
-/**
- * cds_linux_timer_callback() - timer callback, gets called at time out.
- * @data: unsigned long, holds the timer object.
- *
- * Return: None
- */
-void cds_linux_timer_callback(unsigned long data)
-{
- qdf_mc_timer_t *timer = (qdf_mc_timer_t *)data;
- cds_msg_t msg;
- QDF_STATUS status;
-
- qdf_mc_timer_callback_t callback = NULL;
- void *user_data = NULL;
- QDF_TIMER_TYPE type = QDF_TIMER_TYPE_SW;
-
- QDF_ASSERT(timer);
-
- if (timer == NULL) {
- QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
- "%s Null pointer passed in!", __func__);
- return;
- }
-
- qdf_spin_lock_irqsave(&timer->platform_info.spinlock);
-
- switch (timer->state) {
- case QDF_TIMER_STATE_STARTING:
- /* we are in this state because someone just started the timer,
- * MC timer got started and expired, but the time content have
- * not been updated this is a rare race condition!
- */
- timer->state = QDF_TIMER_STATE_STOPPED;
- status = QDF_STATUS_E_ALREADY;
- break;
-
- case QDF_TIMER_STATE_STOPPED:
- status = QDF_STATUS_E_ALREADY;
- break;
-
- case QDF_TIMER_STATE_UNUSED:
- status = QDF_STATUS_E_EXISTS;
- break;
-
- case QDF_TIMER_STATE_RUNNING:
- /* need to go to stop state here because the call-back function
- * may restart timer (to emulate periodic timer)
- */
- timer->state = QDF_TIMER_STATE_STOPPED;
- /* copy the relevant timer information to local variables;
- * once we exits from this critical section, the timer content
- * may be modified by other tasks
- */
- callback = timer->callback;
- user_data = timer->user_data;
- type = timer->type;
- status = QDF_STATUS_SUCCESS;
- break;
-
- default:
- QDF_ASSERT(0);
- status = QDF_STATUS_E_FAULT;
- break;
- }
-
- qdf_spin_unlock_irqrestore(&timer->platform_info.spinlock);
-
- if (QDF_STATUS_SUCCESS != status) {
- QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
- "TIMER callback called in a wrong state=%d",
- timer->state);
- return;
- }
-
- qdf_try_allowing_sleep(type);
-
- if (callback == NULL) {
- QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
- "%s: No TIMER callback, Could not enqueue timer to any queue",
- __func__);
- QDF_ASSERT(0);
- return;
- }
-
- /* serialize to the MC thread */
- sys_build_message_header(SYS_MSG_ID_MC_TIMER, &msg);
- msg.callback = callback;
- msg.bodyptr = user_data;
- msg.bodyval = 0;
-
- if (cds_mq_post_message(CDS_MQ_ID_SYS, &msg) == QDF_STATUS_SUCCESS)
- return;
- QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
- "%s: Could not enqueue timer to any queue", __func__);
- QDF_ASSERT(0);
-}
diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c
index d352a06..0ae882e 100644
--- a/core/cds/src/cds_sched.c
+++ b/core/cds/src/cds_sched.c
@@ -88,8 +88,9 @@
static p_cds_sched_context gp_cds_sched_context;
-
+#ifndef NAPIER_CODE
static int cds_mc_thread(void *Arg);
+#endif
#ifdef QCA_CONFIG_SMP
static int cds_ol_rx_thread(void *arg);
static unsigned long affine_cpu;
@@ -469,7 +470,10 @@
p_cds_sched_context pSchedContext,
uint32_t SchedCtxSize)
{
+#ifndef NAPIER_CODE
QDF_STATUS vStatus = QDF_STATUS_SUCCESS;
+#endif
+
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: Opening the CDS Scheduler", __func__);
/* Sanity checks */
@@ -486,6 +490,7 @@
}
qdf_mem_zero(pSchedContext, sizeof(cds_sched_context));
pSchedContext->pVContext = p_cds_context;
+#ifndef NAPIER_CODE
vStatus = cds_sched_init_mqs(pSchedContext);
if (!QDF_IS_STATUS_SUCCESS(vStatus)) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
@@ -499,14 +504,11 @@
init_completion(&pSchedContext->ResumeMcEvent);
spin_lock_init(&pSchedContext->McThreadLock);
-#ifdef QCA_CONFIG_SMP
- spin_lock_init(&pSchedContext->ol_rx_thread_lock);
-#endif
-
init_waitqueue_head(&pSchedContext->mcWaitQueue);
pSchedContext->mcEventFlag = 0;
-
+#endif
#ifdef QCA_CONFIG_SMP
+ spin_lock_init(&pSchedContext->ol_rx_thread_lock);
init_waitqueue_head(&pSchedContext->ol_rx_wait_queue);
init_completion(&pSchedContext->ol_rx_start_event);
init_completion(&pSchedContext->ol_suspend_rx_event);
@@ -528,6 +530,7 @@
#endif
gp_cds_sched_context = pSchedContext;
+#ifndef NAPIER_CODE
/* Create the CDS Main Controller thread */
pSchedContext->McThread = kthread_create(cds_mc_thread, pSchedContext,
"cds_mc_thread");
@@ -540,7 +543,14 @@
wake_up_process(pSchedContext->McThread);
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: CDS Main Controller thread Created", __func__);
-
+ /*
+ * Now make sure all threads have started before we exit.
+ * Each thread should normally ACK back when it starts.
+ */
+ wait_for_completion_interruptible(&pSchedContext->McStartEvent);
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
+ "%s: CDS MC Thread has started", __func__);
+#endif
#ifdef QCA_CONFIG_SMP
pSchedContext->ol_rx_thread = kthread_create(cds_ol_rx_thread,
pSchedContext,
@@ -556,15 +566,6 @@
wake_up_process(pSchedContext->ol_rx_thread);
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
("CDS OL RX thread Created"));
-#endif
- /*
- * Now make sure all threads have started before we exit.
- * Each thread should normally ACK back when it starts.
- */
- wait_for_completion_interruptible(&pSchedContext->McStartEvent);
- QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
- "%s: CDS MC Thread has started", __func__);
-#ifdef QCA_CONFIG_SMP
wait_for_completion_interruptible(&pSchedContext->ol_rx_start_event);
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: CDS OL Rx Thread has started", __func__);
@@ -576,6 +577,7 @@
#ifdef QCA_CONFIG_SMP
OL_RX_THREAD_START_FAILURE:
+#ifndef NAPIER_CODE
/* Try and force the Main thread controller to exit */
set_bit(MC_SHUTDOWN_EVENT_MASK, &pSchedContext->mcEventFlag);
set_bit(MC_POST_EVENT_MASK, &pSchedContext->mcEventFlag);
@@ -583,21 +585,29 @@
/* Wait for MC to exit */
wait_for_completion_interruptible(&pSchedContext->McShutdown);
#endif
+#endif
+#ifndef NAPIER_CODE
MC_THREAD_START_FAILURE:
+ /* De-initialize all the message queues */
+ cds_sched_deinit_mqs(pSchedContext);
+#endif
#ifdef QCA_CONFIG_SMP
unregister_hotcpu_notifier(&cds_cpu_hotplug_notifier);
cds_free_ol_rx_pkt_freeq(gp_cds_sched_context);
pkt_freeqalloc_failure:
#endif
+#ifndef NAPIER_CODE
/* De-initialize all the message queues */
cds_sched_deinit_mqs(pSchedContext);
+#endif
return QDF_STATUS_E_RESOURCES;
} /* cds_sched_open() */
+#ifndef NAPIER_CODE
/**
* cds_mc_thread() - cds main controller thread execution handler
* @Arg: Pointer to the global CDS Sched Context
@@ -845,6 +855,7 @@
"%s: MC Thread exiting!!!!", __func__);
complete_and_exit(&pSchedContext->McShutdown, 0);
} /* cds_mc_thread() */
+#endif
#ifdef QCA_CONFIG_SMP
/**
@@ -1165,6 +1176,9 @@
"%s: gp_cds_sched_context == NULL", __func__);
return QDF_STATUS_E_FAILURE;
}
+
+#ifndef NAPIER_CODE
+
/* shut down MC Thread */
set_bit(MC_SHUTDOWN_EVENT_MASK, &gp_cds_sched_context->mcEventFlag);
set_bit(MC_POST_EVENT_MASK, &gp_cds_sched_context->mcEventFlag);
@@ -1178,6 +1192,7 @@
/* Deinit all the queues */
cds_sched_deinit_mqs(gp_cds_sched_context);
+#endif
#ifdef QCA_CONFIG_SMP
/* Shut down Tlshim Rx thread */
@@ -1194,6 +1209,8 @@
return QDF_STATUS_SUCCESS;
} /* cds_sched_close() */
+#ifndef NAPIER_CODE
+
/**
* cds_sched_init_mqs() - initialize the cds scheduler message queues
* @p_cds_sched_context: Pointer to the Scheduler Context.
@@ -1354,6 +1371,8 @@
}
} /* cds_sched_flush_mc_mqs() */
+#endif
+
/**
* get_cds_sched_ctxt() - get cds scheduler context
*
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 9ae9384..ab447b8 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -7870,9 +7870,12 @@
ret = -EINVAL;
QDF_ASSERT(0);
}
+
+#ifndef NAPIER_CODE
/* Clean up message queues of TX, RX and MC thread */
if (!cds_is_driver_recovering())
cds_sched_flush_mc_mqs(cds_sched_context);
+#endif
hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
if (!hif_ctx) {
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index 2e1db01..bbca604 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/core/hdd/src/wlan_hdd_power.c
@@ -77,6 +77,7 @@
#include "pld_common.h"
#include "wlan_hdd_driver_ops.h"
#include <wlan_logging_sock_svc.h>
+#include "scheduler_api.h"
/* Preprocessor definitions and constants */
#define HDD_SSR_BRING_UP_TIME 30000
@@ -1479,7 +1480,7 @@
/* Wakeup all driver threads */
if (true == pHddCtx->isMcThreadSuspended) {
- complete(&cds_sched_context->ResumeMcEvent);
+ scheduler_resume_complete();
pHddCtx->isMcThreadSuspended = false;
}
#ifdef QCA_CONFIG_SMP
@@ -1757,7 +1758,7 @@
/* Resume MC thread */
if (pHddCtx->isMcThreadSuspended) {
- complete(&cds_sched_context->ResumeMcEvent);
+ scheduler_resume_complete();
pHddCtx->isMcThreadSuspended = false;
}
#ifdef QCA_CONFIG_SMP
@@ -1853,6 +1854,19 @@
return ret;
}
+static void hdd_suspend_cb(void)
+{
+ hdd_context_t *hdd_ctx;
+
+ hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+ if (!hdd_ctx) {
+ cds_err("HDD context is NULL");
+ return;
+ }
+
+ complete(&hdd_ctx->mc_sus_event_var);
+}
+
/**
* __wlan_hdd_cfg80211_suspend_wlan() - cfg80211 suspend callback
* @wiphy: Pointer to wiphy
@@ -2004,15 +2018,15 @@
}
/* Suspend MC thread */
- set_bit(MC_SUSPEND_EVENT_MASK, &cds_sched_context->mcEventFlag);
- wake_up_interruptible(&cds_sched_context->mcWaitQueue);
+ scheduler_register_hdd_suspend_callback(hdd_suspend_cb);
+ scheduler_set_event_mask(MC_SUSPEND_EVENT_MASK);
+ scheduler_wake_up_controller_thread();
/* Wait for suspend confirmation from MC thread */
rc = wait_for_completion_timeout(&pHddCtx->mc_sus_event_var,
msecs_to_jiffies(WLAN_WAIT_TIME_MCTHREAD_SUSPEND));
if (!rc) {
- clear_bit(MC_SUSPEND_EVENT_MASK,
- &cds_sched_context->mcEventFlag);
+ scheduler_clear_event_mask(MC_SUSPEND_EVENT_MASK);
hdd_err("Failed to stop mc thread");
goto resume_tx;
}
@@ -2048,7 +2062,7 @@
#ifdef QCA_CONFIG_SMP
resume_all:
- complete(&cds_sched_context->ResumeMcEvent);
+ scheduler_resume_complete();
pHddCtx->isMcThreadSuspended = false;
#endif
diff --git a/core/mac/src/pe/include/lim_api.h b/core/mac/src/pe/include/lim_api.h
index c5c350e..3a4b31f 100644
--- a/core/mac/src/pe/include/lim_api.h
+++ b/core/mac/src/pe/include/lim_api.h
@@ -49,6 +49,7 @@
#include "lim_global.h"
#include "wma_if.h"
#include "wma_types.h"
+#include "scheduler_api.h"
/* Macro to count heartbeat */
#define limResetHBPktCount(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB = 0)
@@ -275,6 +276,10 @@
--------------------------------------------------------------------------*/
tSirRetStatus pe_process_messages(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
+#ifdef NAPIER_CODE
+QDF_STATUS pe_mc_process_handler(struct scheduler_msg *msg);
+#endif
+
/** -------------------------------------------------------------
\fn pe_free_msg
\brief Called by CDS scheduler (function cds_sched_flush_mc_mqs)
diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c
index 478868a..408c643 100644
--- a/core/mac/src/pe/lim/lim_api.c
+++ b/core/mac/src/pe/lim/lim_api.c
@@ -988,6 +988,23 @@
return eSIR_SUCCESS;
}
+#ifdef NAPIER_CODE
+QDF_STATUS pe_mc_process_handler(struct scheduler_msg *msg)
+{
+ tSirRetStatus status;
+ tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
+
+ if (mac_ctx == NULL)
+ return QDF_STATUS_E_FAILURE;
+
+ status = pe_process_messages((tHalHandle)mac_ctx, (tSirMsgQ *)msg);
+ if (status == eSIR_SUCCESS)
+ return QDF_STATUS_SUCCESS;
+
+ return QDF_STATUS_E_FAILURE;
+}
+#endif
+
/* --------------------------------------------------------------------------- */
/**
* pe_handle_mgmt_frame
diff --git a/core/mac/src/sys/common/inc/wlan_qct_sys.h b/core/mac/src/sys/common/inc/wlan_qct_sys.h
index 65f6ff5..f08c671 100644
--- a/core/mac/src/sys/common/inc/wlan_qct_sys.h
+++ b/core/mac/src/sys/common/inc/wlan_qct_sys.h
@@ -44,6 +44,7 @@
#include <qdf_types.h>
#include <qdf_status.h>
#include <cds_mq.h>
+#include <scheduler_api.h>
/*---------------------------------------------------------------------------
Preprocessor definitions and constants
@@ -70,16 +71,6 @@
--------------------------------------------------------------------------*/
typedef void (*sysResponseCback)(void *pUserData);
-typedef enum {
- SYS_MSG_ID_MC_START,
- SYS_MSG_ID_MC_THR_PROBE,
- SYS_MSG_ID_MC_TIMER,
- SYS_MSG_ID_MC_STOP,
- SYS_MSG_ID_FTM_RSP,
- SYS_MSG_ID_QVIT,
-
-} SYS_MSG_ID;
-
/*---------------------------------------------------------------------------
Preprocessor definitions and constants
-------------------------------------------------------------------------*/
@@ -189,6 +180,9 @@
--------------------------------------------------------------------------*/
QDF_STATUS sys_mc_process_msg(v_CONTEXT_t p_cds_context, cds_msg_t *pMsg);
+#ifdef NAPIER_CODE
+QDF_STATUS sys_mc_process_handler(struct scheduler_msg *msg);
+#endif
void wlan_sys_probe(void);
diff --git a/core/mac/src/sys/common/src/wlan_qct_sys.c b/core/mac/src/sys/common/src/wlan_qct_sys.c
index 01bb4db..c11fa6d 100644
--- a/core/mac/src/sys/common/src/wlan_qct_sys.c
+++ b/core/mac/src/sys/common/src/wlan_qct_sys.c
@@ -37,13 +37,6 @@
#include "mac_init_api.h"
#include "qdf_trace.h"
-/*
- * Cookie for SYS messages. Note that anyone posting a SYS Message
- * has to write the COOKIE in the reserved field of the message. The
- * SYS Module relies on this COOKIE
- */
-#define SYS_MSG_COOKIE 0xFACE
-
/* SYS stop timeout 30 seconds */
#define SYS_STOP_TIMEOUT (30000)
static qdf_event_t g_stop_evt;
@@ -141,7 +134,6 @@
QDF_STATUS sys_mc_process_msg(v_CONTEXT_t p_cds_context, cds_msg_t *pMsg)
{
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
- qdf_mc_timer_callback_t timerCB;
tpAniSirGlobal mac_ctx;
void *hHal;
@@ -208,12 +200,6 @@
pMsg->type, pMsg->type);
break;
- case SYS_MSG_ID_MC_TIMER:
- timerCB = pMsg->callback;
- if (NULL != timerCB)
- timerCB(pMsg->bodyptr);
- break;
-
case SYS_MSG_ID_FTM_RSP:
hHal = cds_get_context(QDF_MODULE_ID_PE);
if (NULL == hHal) {
@@ -264,6 +250,20 @@
return qdf_status;
}
+#ifdef NAPIER_CODE
+QDF_STATUS sys_mc_process_handler(struct scheduler_msg *msg)
+{
+ void *cds_ctx = cds_get_global_context();
+
+ if (cds_ctx == NULL) {
+ QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
+ "CDS context is NULL");
+ return QDF_STATUS_E_FAILURE;
+ }
+ return sys_mc_process_msg(cds_ctx, (cds_msg_t *)msg);
+}
+#endif
+
/**
* sys_process_mmh_msg() - this api to process mmh message
* @pMac: pointer to mac context
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 7ba3abe..f22dc67 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -50,6 +50,8 @@
#include "sme_rrm_internal.h"
#include "sir_types.h"
+#include "scheduler_api.h"
+
/*--------------------------------------------------------------------------
Preprocessor definitions and constants
------------------------------------------------------------------------*/
@@ -238,6 +240,9 @@
QDF_STATUS sme_set_reg_info(tHalHandle hHal, uint8_t *apCntryCode);
QDF_STATUS sme_hdd_ready_ind(tHalHandle hHal);
QDF_STATUS sme_process_msg(tHalHandle hHal, cds_msg_t *pMsg);
+#ifdef NAPIER_CODE
+QDF_STATUS sme_mc_process_handler(struct scheduler_msg *msg);
+#endif
void sme_free_msg(tHalHandle hHal, cds_msg_t *pMsg);
QDF_STATUS sme_scan_request(tHalHandle hHal, uint8_t sessionId,
tCsrScanRequest *, csr_scan_completeCallback callback,
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index d027e0e..be6f4e1 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -3098,6 +3098,20 @@
return status;
}
+#ifdef NAPIER_CODE
+QDF_STATUS sme_mc_process_handler(struct scheduler_msg *msg)
+{
+ tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_SME);
+
+ if (mac_ctx == NULL) {
+ QDF_ASSERT(0);
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ return sme_process_msg((tHalHandle)mac_ctx, (cds_msg_t *)msg);
+}
+#endif
+
/**
* sme_process_nss_update_resp() - Process nss update response
* @mac: Global MAC pointer
diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h
index 9b9ca2b..4c2209c 100644
--- a/core/wma/inc/wma_api.h
+++ b/core/wma/inc/wma_api.h
@@ -40,6 +40,7 @@
#include "lim_global.h"
#include "cds_concurrency.h"
#include "cds_utils.h"
+#include "scheduler_api.h"
typedef void *WMA_HANDLE;
@@ -107,6 +108,10 @@
QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *msg);
+#ifdef NAPIER_CODE
+QDF_STATUS wma_mc_process_handler(struct scheduler_msg *msg);
+#endif
+
QDF_STATUS wma_start(void *cds_context);
QDF_STATUS wma_stop(void *cds_context, uint8_t reason);
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index 982a8d4..77b3a7d 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -6888,6 +6888,20 @@
return qdf_status;
}
+#ifdef NAPIER_CODE
+QDF_STATUS wma_mc_process_handler(struct scheduler_msg *msg)
+{
+ void *cds_ctx = cds_get_global_context();
+
+ if (cds_ctx == NULL) {
+ QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR,
+ "CDS context is NULL");
+ return QDF_STATUS_E_FAILURE;
+ }
+ return wma_mc_process_msg(cds_ctx, (cds_msg_t *)msg);
+}
+#endif
+
/**
* wma_log_completion_timeout() - Log completion timeout
* @data: Timeout handler data