diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h index 3393e3cfc5d00..33487d557bfa1 100644 --- a/core/cds/inc/cds_sched.h +++ b/core/cds/inc/cds_sched.h @@ -301,6 +301,14 @@ void cds_free_ol_rx_pkt(p_cds_sched_context pSchedContext, -------------------------------------------------------------------------*/ void cds_free_ol_rx_pkt_freeq(p_cds_sched_context pSchedContext); #else +/** + * cds_set_rx_thread_cpu_mask() - Rx_thread affinity from INI + * @cpu_affinity_mask: CPU affinity bitmap + * + * Return:None + */ +static inline void cds_set_rx_thread_cpu_mask(uint8_t cpu_affinity_mask) {} + /** * cds_drop_rxpkt_by_staid() - api to drop pending rx packets for a sta * @pSchedContext: Pointer to the global CDS Sched Context diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c index 0dec9dfbd9f61..cfcb2c8870bc1 100644 --- a/core/cds/src/cds_sched.c +++ b/core/cds/src/cds_sched.c @@ -748,6 +748,19 @@ static int cds_ol_rx_thread(void *arg) return 0; } + +void cds_resume_rx_thread(void) +{ + p_cds_sched_context cds_sched_context; + + cds_sched_context = get_cds_sched_ctxt(); + if (NULL == cds_sched_context) { + cds_err("cds_sched_context is NULL"); + return; + } + + complete(&cds_sched_context->ol_resume_rx_event); +} #endif /** @@ -1106,15 +1119,3 @@ int cds_get_gfp_flags(void) return flags; } -void cds_resume_rx_thread(void) -{ - p_cds_sched_context cds_sched_context = NULL; - - cds_sched_context = get_cds_sched_ctxt(); - if (NULL == cds_sched_context) { - cds_err("cds_sched_context is NULL"); - return; - } - - complete(&cds_sched_context->ol_resume_rx_event); -} diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h index 32fb41f1529c5..764ee50d06b21 100644 --- a/core/hdd/inc/wlan_hdd_power.h +++ b/core/hdd/inc/wlan_hdd_power.h @@ -522,4 +522,33 @@ hdd_wlan_fake_apps_suspend(struct wiphy *wiphy, struct net_device *dev, } #endif /* WLAN_SUSPEND_RESUME_TEST */ +#ifdef QCA_CONFIG_SMP +/** + * wlan_hdd_rx_thread_resume() - Resume RX thread + * @hdd_ctx: HDD context + * + * Check if RX thread suspended, and resume if yes. + * + * Return: None + */ +void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx); + +/** + * wlan_hdd_rx_thread_suspend() - Suspend RX thread + * @hdd_ctx: HDD context + * + * To suspend RX thread + * + * Return: 0 for success + */ +int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx); + +#else +static inline void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx) {} +static inline int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx) +{ + return 0; +} +#endif + #endif /* __WLAN_HDD_POWER_H */ diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 8f8fa251bbd3b..7eae7ccf59821 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -87,9 +87,6 @@ #define HDD_SSR_BRING_UP_TIME 30000 #endif -/* timeout in msec to wait for RX_THREAD to suspend */ -#define HDD_RXTHREAD_SUSPEND_TIMEOUT 200 - /* Type declarations */ #ifdef FEATURE_WLAN_DIAG_SUPPORT @@ -124,6 +121,47 @@ void hdd_wlan_offload_event(uint8_t type, uint8_t state) } #endif +#ifdef QCA_CONFIG_SMP + +/* timeout in msec to wait for RX_THREAD to suspend */ +#define HDD_RXTHREAD_SUSPEND_TIMEOUT 200 + +void wlan_hdd_rx_thread_resume(struct hdd_context *hdd_ctx) +{ + if (hdd_ctx->is_ol_rx_thread_suspended) { + cds_resume_rx_thread(); + hdd_ctx->is_ol_rx_thread_suspended = false; + } +} + +int wlan_hdd_rx_thread_suspend(struct hdd_context *hdd_ctx) +{ + p_cds_sched_context cds_sched_context = get_cds_sched_ctxt(); + int rc; + + if (!cds_sched_context) + return 0; + + /* Suspend tlshim rx thread */ + set_bit(RX_SUSPEND_EVENT, &cds_sched_context->ol_rx_event_flag); + wake_up_interruptible(&cds_sched_context->ol_rx_wait_queue); + rc = wait_for_completion_timeout(&cds_sched_context-> + ol_suspend_rx_event, + msecs_to_jiffies + (HDD_RXTHREAD_SUSPEND_TIMEOUT) + ); + if (!rc) { + clear_bit(RX_SUSPEND_EVENT, + &cds_sched_context->ol_rx_event_flag); + hdd_err("Failed to stop tl_shim rx thread"); + return -EINVAL; + } + hdd_ctx->is_ol_rx_thread_suspended = true; + + return 0; +} +#endif /* QCA_CONFIG_SMP */ + /** * hdd_enable_gtk_offload() - enable GTK offload * @adapter: pointer to the adapter @@ -1216,10 +1254,7 @@ QDF_STATUS hdd_wlan_shutdown(void) hdd_ctx->is_wiphy_suspended = false; } - if (hdd_ctx->is_ol_rx_thread_suspended) { - cds_resume_rx_thread(); - hdd_ctx->is_ol_rx_thread_suspended = false; - } + wlan_hdd_rx_thread_resume(hdd_ctx); /* * After SSR, FW clear its txrx stats. In host, @@ -1543,7 +1578,6 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) struct hdd_context *hdd_ctx = wiphy_priv(wiphy); QDF_STATUS status = QDF_STATUS_SUCCESS; int exit_code; - p_cds_sched_context cds_sched_context = get_cds_sched_ctxt(); hdd_enter(); @@ -1588,10 +1622,8 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) } /* Resume tlshim Rx thread */ - if (hdd_ctx->enable_rxthread && hdd_ctx->is_ol_rx_thread_suspended) { - complete(&cds_sched_context->ol_resume_rx_event); - hdd_ctx->is_ol_rx_thread_suspended = false; - } + if (hdd_ctx->enable_rxthread) + wlan_hdd_rx_thread_resume(hdd_ctx); if (hdd_ctx->enable_dp_rx_threads) dp_txrx_resume(cds_get_context(QDF_MODULE_ID_SOC)); @@ -1647,7 +1679,6 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, struct cfg80211_wowlan *wow) { struct hdd_context *hdd_ctx = wiphy_priv(wiphy); - p_cds_sched_context cds_sched_context = get_cds_sched_ctxt(); struct hdd_adapter *adapter; struct hdd_scan_info *scan_info; mac_handle_t mac_handle; @@ -1765,21 +1796,8 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, hdd_ctx->is_scheduler_suspended = true; if (hdd_ctx->enable_rxthread) { - /* Suspend tlshim rx thread */ - set_bit(RX_SUSPEND_EVENT, &cds_sched_context->ol_rx_event_flag); - wake_up_interruptible(&cds_sched_context->ol_rx_wait_queue); - rc = wait_for_completion_timeout(&cds_sched_context-> - ol_suspend_rx_event, - msecs_to_jiffies - (HDD_RXTHREAD_SUSPEND_TIMEOUT) - ); - if (!rc) { - clear_bit(RX_SUSPEND_EVENT, - &cds_sched_context->ol_rx_event_flag); - hdd_err("Failed to stop tl_shim rx thread"); + if (wlan_hdd_rx_thread_suspend(hdd_ctx)) goto resume_ol_rx; - } - hdd_ctx->is_ol_rx_thread_suspended = true; } if (hdd_ctx->enable_dp_rx_threads) @@ -1806,10 +1824,7 @@ resume_dp_thread: resume_ol_rx: /* Resume tlshim Rx thread */ - if (hdd_ctx->is_ol_rx_thread_suspended) { - cds_resume_rx_thread(); - hdd_ctx->is_ol_rx_thread_suspended = false; - } + wlan_hdd_rx_thread_resume(hdd_ctx); scheduler_resume(); hdd_ctx->is_scheduler_suspended = false; resume_tx: