diff --git a/scheduler/inc/scheduler_api.h b/scheduler/inc/scheduler_api.h index 934c9e42fea7..9624edf0ad17 100644 --- a/scheduler/inc/scheduler_api.h +++ b/scheduler/inc/scheduler_api.h @@ -41,9 +41,11 @@ */ #define SYS_MSG_COOKIE 0xFACE -#define scheduler_get_src_id(qid) ((qid) >> 16) -#define scheduler_get_dest_id(qid) ((qid) & 0xFFFF) -#define scheduler_get_qid(src, dest) ((dest) | ((src) << 16)) +#define scheduler_get_src_id(qid) (((qid) >> 20) & 0x3FF) +#define scheduler_get_dest_id(qid) (((qid) >> 10) & 0x3FF) +#define scheduler_get_que_id(qid) ((qid) & 0x3FF) +#define scheduler_get_qid(src, dest, que_id) ((que_id) | ((dest) << 10) |\ + ((src) << 20)) typedef enum { SYS_MSG_ID_MC_TIMER, @@ -171,6 +173,7 @@ static inline QDF_STATUS scheduler_post_msg(uint32_t qid, * scheduler_post_message() - post normal messages(no priority) * @src_id: Source module of the message * @dest_id: Destination module of the message + * @que_id: Queue to which the message has to posted. * @msg: message pointer * * This function will mask the src_id, and destination id to qid of @@ -179,9 +182,11 @@ static inline QDF_STATUS scheduler_post_msg(uint32_t qid, */ static inline QDF_STATUS scheduler_post_message(QDF_MODULE_ID src_id, QDF_MODULE_ID dest_id, + QDF_MODULE_ID que_id, struct scheduler_msg *msg) { - return scheduler_post_msg(scheduler_get_qid(src_id, dest_id), msg); + return scheduler_post_msg(scheduler_get_qid(src_id, dest_id, que_id), + msg); } /** diff --git a/scheduler/src/scheduler_api.c b/scheduler/src/scheduler_api.c index fe003c81d87a..ee4633dcc778 100644 --- a/scheduler/src/scheduler_api.c +++ b/scheduler/src/scheduler_api.c @@ -226,6 +226,7 @@ QDF_STATUS scheduler_post_msg_by_priority(uint32_t qid, struct scheduler_ctx *sched_ctx; uint16_t src_id; uint16_t dest_id; + uint16_t que_id; QDF_BUG(msg); if (!msg) @@ -248,8 +249,10 @@ QDF_STATUS scheduler_post_msg_by_priority(uint32_t qid, dest_id = scheduler_get_dest_id(qid); src_id = scheduler_get_src_id(qid); + que_id = scheduler_get_que_id(qid); - if (dest_id >= QDF_MODULE_ID_MAX || src_id >= QDF_MODULE_ID_MAX) { + if (que_id >= QDF_MODULE_ID_MAX || src_id >= QDF_MODULE_ID_MAX || + dest_id >= QDF_MODULE_ID_MAX) { sched_err("Src_id/Dest_id invalid, cannot post message"); return QDF_STATUS_E_FAILURE; } @@ -264,20 +267,20 @@ QDF_STATUS scheduler_post_msg_by_priority(uint32_t qid, * legacy WMA message queue id to target_if queue such that its always * handled in right order. */ - if (QDF_MODULE_ID_WMA == dest_id) { + if (QDF_MODULE_ID_WMA == que_id) { msg->callback = NULL; /* change legacy WMA message id to new target_if mq id */ - dest_id = QDF_MODULE_ID_TARGET_IF; + que_id = QDF_MODULE_ID_TARGET_IF; } - qidx = sched_ctx->queue_ctx.scheduler_msg_qid_to_qidx[dest_id]; + qidx = sched_ctx->queue_ctx.scheduler_msg_qid_to_qidx[que_id]; if (qidx >= SCHEDULER_NUMBER_OF_MSG_QUEUE) { sched_err("Scheduler is deinitialized ignore msg"); return QDF_STATUS_E_FAILURE; } if (!sched_ctx->queue_ctx.scheduler_msg_process_fn[qidx]) { - QDF_DEBUG_PANIC("callback not registered for qid[%d]", dest_id); + QDF_DEBUG_PANIC("callback not registered for qid[%d]", que_id); return QDF_STATUS_E_FAILURE; }