qcacmn: Change init-deinit sequence of scheduler & call flush callback

Provide fix such a way that scheduler's initialization happens at the end after
all components' initialization gets done. Same-way scheduler's
deinitiazation happens very first before other component's deinit gets
started.

scheduler also need to call component's provided callback to notify
that component while flushing component's message queue.

CRs-Fixed: 2034772
Change-Id: I2c46bf9e68b93ecbc2ce9659d56de2887573411e
This commit is contained in:
Krunal Soni 2017-04-18 15:12:57 -07:00 • committed by snandini
commit 1880b6f8a6
2 changed files with 31 additions and 8 deletions

View file

@ -560,9 +560,6 @@ QDF_STATUS dispatcher_init(void)
if (QDF_STATUS_SUCCESS != wlan_serialization_init())
goto serialization_init_fail;
if (QDF_STATUS_SUCCESS != scheduler_init())
goto scheduler_init_fail;
if (QDF_STATUS_SUCCESS != dispatcher_init_pmo())
goto pmo_init_fail;
@ -590,8 +587,18 @@ QDF_STATUS dispatcher_init(void)
if (QDF_STATUS_SUCCESS != dispatcher_offchan_txrx_init())
goto offchan_init_fail;
/*
* scheduler INIT has to be the last as each component's
* initialization has to happen first and then at the end
* scheduler needs to start accepting the service.
*/
if (QDF_STATUS_SUCCESS != scheduler_init())
goto scheduler_init_fail;
return QDF_STATUS_SUCCESS;
scheduler_init_fail:
dispatcher_offchan_txrx_deinit();
offchan_init_fail:
dispatcher_regulatory_deinit();
regulatory_init_fail:
@ -609,8 +616,6 @@ policy_mgr_init_fail:
crypto_init_fail:
dispatcher_deinit_pmo();
pmo_init_fail:
scheduler_deinit();
scheduler_init_fail:
wlan_serialization_deinit();
serialization_init_fail:
tdls_deinit();
@ -630,6 +635,12 @@ EXPORT_SYMBOL(dispatcher_init);
QDF_STATUS dispatcher_deinit(void)
{
/*
* schduler service should be the first one to stop offering
* services up on dispatcher deinit sequence
*/
QDF_BUG(QDF_STATUS_SUCCESS == scheduler_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_offchan_txrx_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_regulatory_deinit());
@ -648,8 +659,6 @@ QDF_STATUS dispatcher_deinit(void)
QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_pmo());
QDF_BUG(QDF_STATUS_SUCCESS == scheduler_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == wlan_serialization_deinit());
QDF_BUG(QDF_STATUS_SUCCESS == tdls_deinit());

View file

@ -423,6 +423,7 @@ int scheduler_thread(void *arg)
void scheduler_cleanup_queues(struct scheduler_ctx *sch_ctx, int idx)
{
struct scheduler_msg_wrapper *msg_wrapper = NULL;
QDF_STATUS (*scheduler_flush_callback) (struct scheduler_msg *);
if (!sch_ctx) {
QDF_ASSERT(0);
@ -437,9 +438,22 @@ void scheduler_cleanup_queues(struct scheduler_ctx *sch_ctx, int idx)
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_INFO,
"%s: Freeing MC WMA MSG message type %d",
__func__, msg_wrapper->msg_buf->type);
if (msg_wrapper->msg_buf->bodyptr)
if (msg_wrapper->msg_buf->flush_callback) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER,
QDF_TRACE_LEVEL_DEBUG,
"%s: Flush callback called for type-%x",
__func__, msg_wrapper->msg_buf->type);
scheduler_flush_callback =
msg_wrapper->msg_buf->flush_callback;
scheduler_flush_callback(msg_wrapper->msg_buf);
} else if (msg_wrapper->msg_buf->bodyptr) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER,
QDF_TRACE_LEVEL_DEBUG,
"%s: noflush cb given for type-%x",
__func__, msg_wrapper->msg_buf->type);
qdf_mem_free(
(void *)msg_wrapper->msg_buf->bodyptr);
}
msg_wrapper->msg_buf->bodyptr = NULL;
msg_wrapper->msg_buf->bodyval = 0;
msg_wrapper->msg_buf->type = 0;