diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index 9b7d7dcd3e..e1984be605 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -3865,7 +3865,9 @@ static void hif_post_recv_buffers_failure(struct HIF_CE_pipe_info *pipe_info, (ce_srng_based(scn) && bufs_needed_tmp == CE_state->dest_ring->nentries - 2)) { qdf_atomic_inc(&scn->active_oom_work_cnt); - qdf_sched_work(scn->qdf_dev, &CE_state->oom_allocation_work); + if (!qdf_sched_work(scn->qdf_dev, + &CE_state->oom_allocation_work)) + qdf_atomic_dec(&scn->active_oom_work_cnt); } } diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index 16cc3e9ca0..35218e0cb9 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -1437,11 +1437,12 @@ QDF_STATUS hif_try_complete_tasks(struct hif_softc *scn) * There is chance of OOM thread getting scheduled * continuously or execution get delayed during low * memory state. So avoid panic and prevent suspend - * only if OOM thread is unable to complete pending + * if OOM thread is unable to complete pending * work. */ - if ((!tasklet) && (!grp_tasklet) && (!work) && oom_work) - hif_err("OOM thread is still pending cannot complete the work"); + if (oom_work) + hif_err("OOM thread is still pending %d tasklets %d grp tasklets %d work %d", + oom_work, tasklet, grp_tasklet, work); else QDF_DEBUG_PANIC("Complete tasks takes more than %u ms: tasklets %d grp tasklets %d work %d oom_work %d", HIF_TASK_DRAIN_WAIT_CNT * 10, diff --git a/qdf/inc/qdf_defer.h b/qdf/inc/qdf_defer.h index 565345a683..edba5f86f0 100644 --- a/qdf/inc/qdf_defer.h +++ b/qdf/inc/qdf_defer.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022,2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -166,9 +166,9 @@ QDF_STATUS qdf_create_work(qdf_handle_t hdl, qdf_work_t *work, * @hdl: OS handle * @work: pointer to work * - * Return: none + * Return: false if work was already on a queue, true otherwise */ -void qdf_sched_work(qdf_handle_t hdl, qdf_work_t *work); +bool qdf_sched_work(qdf_handle_t hdl, qdf_work_t *work); /** * qdf_queue_work - Queue the work/task @@ -379,11 +379,12 @@ static inline void qdf_destroy_workqueue(qdf_handle_t hdl, * qdf_sched_work - Schedule a deferred task on non-interrupt context * @hdl: OS handle * @work: pointer to work - * Return: none + * + * Return: false if work was already on a queue, true otherwise */ -static inline void qdf_sched_work(qdf_handle_t hdl, qdf_work_t *work) +static inline bool qdf_sched_work(qdf_handle_t hdl, qdf_work_t *work) { - __qdf_sched_work(work); + return __qdf_sched_work(work); } /** diff --git a/qdf/linux/src/i_qdf_defer.h b/qdf/linux/src/i_qdf_defer.h index 39d2e5a343..7f02491cec 100644 --- a/qdf/linux/src/i_qdf_defer.h +++ b/qdf/linux/src/i_qdf_defer.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -116,12 +116,12 @@ __qdf_queue_work(__qdf_workqueue_t *wqueue, __qdf_work_t *work) /** * __qdf_sched_work - Schedule a deferred task on non-interrupt context * @work: pointer to work - * Return: none + * + * Return: false if work was already on a global queue, true otherwise */ -static inline QDF_STATUS __qdf_sched_work(__qdf_work_t *work) +static inline bool __qdf_sched_work(__qdf_work_t *work) { - schedule_work(&work->work); - return QDF_STATUS_SUCCESS; + return schedule_work(&work->work); } /** diff --git a/qdf/linux/src/qdf_defer.c b/qdf/linux/src/qdf_defer.c index 016c1ac747..e9069f7682 100644 --- a/qdf/linux/src/qdf_defer.c +++ b/qdf/linux/src/qdf_defer.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2019,2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022,2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -138,9 +138,9 @@ QDF_STATUS qdf_create_work(qdf_handle_t hdl, qdf_work_t *work, qdf_export_symbol(qdf_create_work); -void qdf_sched_work(qdf_handle_t hdl, qdf_work_t *work) +bool qdf_sched_work(qdf_handle_t hdl, qdf_work_t *work) { - __qdf_sched_work(work); + return __qdf_sched_work(work); } qdf_export_symbol(qdf_sched_work);