From 6ca9848fe7e503320ce2d791de1f67538adadd24 Mon Sep 17 00:00:00 2001 From: Kabilan Kannan Date: Tue, 14 Feb 2017 13:26:15 -0800 Subject: [PATCH] qcacld-3.0: Change TDLS API to provide abstraction to other modules TDLS timer related API is directly exposed to other modules, and it induces code portability and compilation problem. Change the API implementation and provide only abstraction to other modules. Change-Id: I8cec34558366ab500a66d4c9f4d36e042490a6bf CRs-Fixed: 2006815 --- core/hdd/inc/wlan_hdd_tdls.h | 32 ++++++++++++++++++++++++++++---- core/hdd/src/wlan_hdd_p2p.c | 4 ++-- core/hdd/src/wlan_hdd_tdls.c | 31 +++++++++++-------------------- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_tdls.h b/core/hdd/inc/wlan_hdd_tdls.h index f54d3ff6a70b..acb90cd70a2f 100644 --- a/core/hdd/inc/wlan_hdd_tdls.h +++ b/core/hdd/inc/wlan_hdd_tdls.h @@ -51,6 +51,16 @@ typedef enum { eTDLS_SUPPORT_EXTERNAL_CONTROL, } eTDLSSupportMode; +/** + * enum tdls_concerned_external_events - External events that affect TDLS + * @P2P_ROC_START: P2P remain on channel starts + * @P2P_ROC_END: P2P remain on channel ends + */ +enum tdls_concerned_external_events { + P2P_ROC_START, + P2P_ROC_END, +}; + #ifdef FEATURE_WLAN_TDLS /* @@ -754,8 +764,22 @@ void wlan_hdd_tdls_notify_connect(hdd_adapter_t *adapter, */ void wlan_hdd_tdls_notify_disconnect(hdd_adapter_t *adapter, bool lfr_roam); void wlan_hdd_change_tdls_mode(void *hdd_ctx); -void hdd_restart_tdls_source_timer(hdd_context_t *pHddCtx, - eTDLSSupportMode tdls_mode); + +/** + * hdd_tdls_notify_p2p_roc() - Notify p2p roc event to TDLS + * @hdd_ctx: ptr to hdd context. + * @event: P2P roc event that affect TDLS + * + * P2P roc events notified to TDLS to avoid overlap between P2P listen + * and TDLS operation. + * Based on P2P remain on channel event, TDLS mode will be + * updated and TDLS source timer started with timer period + * equivalent to P2P ROC interval to revert the TDLS mode. + * + * Return: None + */ +void hdd_tdls_notify_p2p_roc(hdd_context_t *hdd_ctx, + enum tdls_concerned_external_events event); /** * wlan_hdd_cfg80211_configure_tdls_mode() - configure tdls mode @@ -826,8 +850,8 @@ static inline void wlan_hdd_change_tdls_mode(void *hdd_ctx) { } static inline void -hdd_restart_tdls_source_timer(hdd_context_t *pHddCtx, - eTDLSSupportMode tdls_mode) +hdd_tdls_notify_p2p_roc(hdd_context_t *hdd_ctx, + enum tdls_concerned_external_events event) { } #endif /* End of FEATURE_WLAN_TDLS */ diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 4de2bfe791d9..7f39d458b92a 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -535,7 +535,7 @@ static void wlan_hdd_remain_on_chan_timeout(void *data) roc_scan_id); } - hdd_restart_tdls_source_timer(hdd_ctx, hdd_ctx->tdls_mode_last); + hdd_tdls_notify_p2p_roc(hdd_ctx, P2P_ROC_END); qdf_runtime_pm_allow_suspend(hdd_ctx->runtime_context.roc); hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); } @@ -697,7 +697,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, } } - hdd_restart_tdls_source_timer(pHddCtx, eTDLS_SUPPORT_DISABLED); + hdd_tdls_notify_p2p_roc(pHddCtx, P2P_ROC_START); return 0; } diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c index b6edbad92492..2def73966be9 100644 --- a/core/hdd/src/wlan_hdd_tdls.c +++ b/core/hdd/src/wlan_hdd_tdls.c @@ -6056,31 +6056,22 @@ void wlan_hdd_change_tdls_mode(void *data) HDD_SET_TDLS_MODE_SOURCE_P2P); } -/** - * hdd_restart_tdls_source_timer - Restart TDLS source timer - * @pHddCtx: ptr to hdd context. - * @tdls_mode: value for TDLS support mode. - * - * This timer is the handler for avoiding overlapping for P2P listen - * and TDLS operation. This handler will start the source timer for - * the duration of tdls_enable_defer_time after P2P listen ends and - * before enabling TDLS again. - * - * Return: None - */ -void hdd_restart_tdls_source_timer(hdd_context_t *pHddCtx, - eTDLSSupportMode tdls_mode) +void hdd_tdls_notify_p2p_roc(hdd_context_t *hdd_ctx, + enum tdls_concerned_external_events event) { - qdf_mc_timer_stop(&pHddCtx->tdls_source_timer); + eTDLSSupportMode tdls_mode; - if (tdls_mode == eTDLS_SUPPORT_DISABLED) { - wlan_hdd_tdls_set_mode(pHddCtx, tdls_mode, false, + qdf_mc_timer_stop(&hdd_ctx->tdls_source_timer); + + if (event == P2P_ROC_START) { + tdls_mode = eTDLS_SUPPORT_DISABLED; + wlan_hdd_tdls_set_mode(hdd_ctx, tdls_mode, false, HDD_SET_TDLS_MODE_SOURCE_P2P); - wlan_hdd_tdls_disable_offchan_and_teardown_links(pHddCtx); + wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_ctx); } - qdf_mc_timer_start(&pHddCtx->tdls_source_timer, - pHddCtx->config->tdls_enable_defer_time); + qdf_mc_timer_start(&hdd_ctx->tdls_source_timer, + hdd_ctx->config->tdls_enable_defer_time); return; }