Prechádzať zdrojové kódy

qcacmn: Add API to configure scheduler watchdog timeout

The scheduler watchdog timeout is currently fixed at 10secs.
There are few customer use cases, where the CPU is busy for
sometime and the scheduler message processing is taking longer than
the coinfigured watchdog timeout value.

Add a new API to be able to configure this value different than the
default as per the requirement.

CRs-Fixed: 2834194
Change-Id: I976f1f0ad17f09cf3960f99ad80226d775b8b2f2
Vivek 4 rokov pred
rodič
commit
97f44cd39e

+ 10 - 0
scheduler/inc/scheduler_api.h

@@ -219,6 +219,16 @@ QDF_STATUS scheduler_post_message_debug(QDF_MODULE_ID src_id,
  */
 void scheduler_resume(void);
 
+/**
+ * scheduler_set_timeout() - set scheduler timeout for msg processing
+ *
+ * Configure the timeout for triggering the scheduler watchdog timer
+ * in milliseconds
+ *
+ * Return: none
+ */
+void scheduler_set_watchdog_timeout(uint32_t timeout);
+
 /**
  * scheduler_register_hdd_suspend_callback() - suspend callback to hdd
  * @callback: hdd callback to be called when controllred thread is suspended

+ 2 - 0
scheduler/inc/scheduler_core.h

@@ -99,6 +99,7 @@ struct scheduler_mq_ctx {
  * @hdd_callback: os if suspend callback
  * @legacy_wma_handler: legacy wma message handler
  * @legacy_sys_handler: legacy sys message handler
+ * @timeout: timeout value for scheduler watchdog timer
  * @watchdog_timer: timer for triggering a scheduler watchdog bite
  * @watchdog_callback: the callback of the current msg being processed
  */
@@ -116,6 +117,7 @@ struct scheduler_ctx {
 	hdd_suspend_callback hdd_callback;
 	scheduler_msg_process_fn_t legacy_wma_handler;
 	scheduler_msg_process_fn_t legacy_sys_handler;
+	uint32_t timeout;
 	qdf_timer_t watchdog_timer;
 	void *watchdog_callback;
 };

+ 12 - 0
scheduler/src/scheduler_api.c

@@ -169,6 +169,7 @@ QDF_STATUS scheduler_init(void)
 	qdf_spinlock_create(&sched_ctx->sch_thread_lock);
 	qdf_init_waitqueue_head(&sched_ctx->sch_wait_queue);
 	sched_ctx->sch_event_flag = 0;
+	sched_ctx->timeout = SCHEDULER_WATCHDOG_TIMEOUT;
 	qdf_timer_init(NULL,
 		       &sched_ctx->watchdog_timer,
 		       &scheduler_watchdog_timeout,
@@ -520,6 +521,17 @@ QDF_STATUS scheduler_scan_mq_handler(struct scheduler_msg *msg)
 	return QDF_STATUS_SUCCESS;
 }
 
+void scheduler_set_watchdog_timeout(uint32_t timeout)
+{
+	struct scheduler_ctx *sched_ctx = scheduler_get_context();
+
+	QDF_BUG(sched_ctx);
+	if (!sched_ctx)
+		return;
+
+	sched_ctx->timeout = timeout;
+}
+
 QDF_STATUS scheduler_register_wma_legacy_handler(scheduler_msg_process_fn_t
 						wma_callback)
 {

+ 1 - 1
scheduler/src/scheduler_core.c

@@ -392,7 +392,7 @@ static void scheduler_thread_process_queues(struct scheduler_ctx *sch_ctx,
 
 			sched_history_start(msg);
 			qdf_timer_start(&sch_ctx->watchdog_timer,
-					SCHEDULER_WATCHDOG_TIMEOUT);
+					sch_ctx->timeout);
 			status = sch_ctx->queue_ctx.
 					scheduler_msg_process_fn[i](msg);
 			qdf_timer_stop(&sch_ctx->watchdog_timer);