summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDustin Brown <dustinb@codeaurora.org>2017-09-19 12:19:00 -0700
committersnandini <snandini@codeaurora.org>2017-10-02 15:43:50 -0700
commitf76233dc3b4f70f6bde10d518f8efd3eecb0b290 (patch)
tree7b925acdd28deede18c1592d10fcd724c54f34a5
parent2dbd144d93f8b0577c6c1c0340d77b62eab22dac (diff)
qcacld-3.0: Use delayed work instead of qdf_mc_timer for iface change
Currently, the interface idle (aka interface change) timeout uses a qdf_mc_timer. This dependency on the MC thread means the MC thread cannot be shutdown as part of the interface idle timeout work. This wastes resources, and leads to the init/deinit paths to be out of sync with respect to starting and stopping the MC thread. To address these issues, use a delayed work to schedule the interface idle work instead of a qdf_mc_timer. Change-Id: I7570081112fa236a15d823e2a3857d252567f041 CRs-Fixed: 2112696
-rw-r--r--core/hdd/inc/wlan_hdd_main.h4
-rw-r--r--core/hdd/src/wlan_hdd_driver_ops.c5
-rw-r--r--core/hdd/src/wlan_hdd_main.c36
-rw-r--r--core/hdd/src/wlan_hdd_p2p.c4
4 files changed, 16 insertions, 33 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index 1a3d454cb0cf..3b3328955a19 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -1958,8 +1958,8 @@ struct hdd_context_s {
#endif
/* Present state of driver cds modules */
enum driver_modules_status driver_status;
- /* MC timer interface change */
- qdf_mc_timer_t iface_change_timer;
+ /* interface idle work */
+ qdf_delayed_work_t iface_idle_work;
/* Interface change lock */
struct mutex iface_change_lock;
bool rps;
diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c
index 45ced4b8c1eb..3a61a4a7c3d4 100644
--- a/core/hdd/src/wlan_hdd_driver_ops.c
+++ b/core/hdd/src/wlan_hdd_driver_ops.c
@@ -1291,10 +1291,7 @@ static void wlan_hdd_purge_notifier(void)
}
mutex_lock(&hdd_ctx->iface_change_lock);
- if (QDF_TIMER_STATE_RUNNING ==
- qdf_mc_timer_get_current_state(&hdd_ctx->iface_change_timer)) {
- qdf_mc_timer_stop(&hdd_ctx->iface_change_timer);
- }
+ qdf_cancel_delayed_work(&hdd_ctx->iface_idle_work);
cds_shutdown_notifier_call();
cds_shutdown_notifier_purge();
mutex_unlock(&hdd_ctx->iface_change_lock);
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 7213a1a577a7..b63c007db520 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -2050,12 +2050,7 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
mutex_lock(&hdd_ctx->iface_change_lock);
hdd_ctx->start_modules_in_progress = true;
- if (QDF_TIMER_STATE_RUNNING ==
- qdf_mc_timer_get_current_state(&hdd_ctx->iface_change_timer)) {
-
- hdd_debug("Interface change Timer running Stop timer");
- qdf_mc_timer_stop(&hdd_ctx->iface_change_timer);
- }
+ qdf_cancel_delayed_work(&hdd_ctx->iface_idle_work);
switch (hdd_ctx->driver_status) {
case DRIVER_MODULES_UNINITIALIZED:
@@ -2380,8 +2375,8 @@ static int __hdd_stop(struct net_device *dev)
*/
if (hdd_check_for_opened_interfaces(hdd_ctx)) {
hdd_debug("Closing all modules from the hdd_stop");
- qdf_mc_timer_start(&hdd_ctx->iface_change_timer,
- hdd_ctx->config->iface_change_wait_time);
+ qdf_sched_delayed_work(&hdd_ctx->iface_idle_work,
+ hdd_ctx->config->iface_change_wait_time);
hdd_prevent_suspend_timeout(
hdd_ctx->config->iface_change_wait_time,
WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER);
@@ -5812,16 +5807,7 @@ static void hdd_wlan_exit(hdd_context_t *hdd_ctx)
ENTER();
- if (QDF_TIMER_STATE_RUNNING ==
- qdf_mc_timer_get_current_state(&hdd_ctx->iface_change_timer)) {
- hdd_debug("Stop interface change timer");
- qdf_mc_timer_stop(&hdd_ctx->iface_change_timer);
- }
-
- if (!QDF_IS_STATUS_SUCCESS
- (qdf_mc_timer_destroy(&hdd_ctx->iface_change_timer)))
- hdd_err("Cannot delete interface change timer");
-
+ qdf_cancel_delayed_work(&hdd_ctx->iface_idle_work);
hdd_unregister_notifiers(hdd_ctx);
@@ -9577,8 +9563,8 @@ int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool ftm_mode)
if (is_idle_stop && !ftm_mode) {
mutex_unlock(&hdd_ctx->iface_change_lock);
- qdf_mc_timer_start(&hdd_ctx->iface_change_timer,
- hdd_ctx->config->iface_change_wait_time);
+ qdf_sched_delayed_work(&hdd_ctx->iface_idle_work,
+ hdd_ctx->config->iface_change_wait_time);
hdd_prevent_suspend_timeout(
hdd_ctx->config->iface_change_wait_time,
WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER);
@@ -9866,8 +9852,9 @@ int hdd_wlan_startup(struct device *dev)
if (IS_ERR(hdd_ctx))
return PTR_ERR(hdd_ctx);
- qdf_mc_timer_init(&hdd_ctx->iface_change_timer, QDF_TIMER_TYPE_SW,
- hdd_iface_change_callback, (void *)hdd_ctx);
+ qdf_create_delayed_work(&hdd_ctx->iface_idle_work,
+ hdd_iface_change_callback,
+ (void *)hdd_ctx);
qdf_nbuf_init_replenish_timer();
@@ -9968,8 +9955,8 @@ int hdd_wlan_startup(struct device *dev)
if (hdd_ctx->config->fIsImpsEnabled)
hdd_set_idle_ps_config(hdd_ctx, true);
- qdf_mc_timer_start(&hdd_ctx->iface_change_timer,
- hdd_ctx->config->iface_change_wait_time);
+ qdf_sched_delayed_work(&hdd_ctx->iface_idle_work,
+ hdd_ctx->config->iface_change_wait_time);
hdd_prevent_suspend_timeout(
hdd_ctx->config->iface_change_wait_time,
WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER);
@@ -10015,7 +10002,6 @@ err_hdd_free_context:
hdd_start_complete(ret);
qdf_nbuf_deinit_replenish_timer();
- qdf_mc_timer_destroy(&hdd_ctx->iface_change_timer);
mutex_destroy(&hdd_ctx->iface_change_lock);
hdd_context_destroy(hdd_ctx);
return -EIO;
diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c
index d051c6546e2b..1b617b5ad8b9 100644
--- a/core/hdd/src/wlan_hdd_p2p.c
+++ b/core/hdd/src/wlan_hdd_p2p.c
@@ -2786,8 +2786,8 @@ stop_modules:
*/
if (hdd_check_for_opened_interfaces(pHddCtx)) {
hdd_debug("Closing all modules from the add_virt_iface");
- qdf_mc_timer_start(&pHddCtx->iface_change_timer,
- pHddCtx->config->iface_change_wait_time);
+ qdf_sched_delayed_work(&pHddCtx->iface_idle_work,
+ pHddCtx->config->iface_change_wait_time);
hdd_prevent_suspend_timeout(
pHddCtx->config->iface_change_wait_time,
WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER);