From e635975954cd5b1532416d82129ff966e5082ee9 Mon Sep 17 00:00:00 2001 From: Nitesh Shah Date: Thu, 23 Feb 2017 19:57:50 +0530 Subject: [PATCH] qcacld-3.0: Teardown TDLS connection when TDLS not allowed When TDLS exists and new virtual interface is added, then TDLS gets teardown. But TDLS connection tracker is disabled only when new connection comes up successfully. When STA interface is present and TDLS is running and SAP is started, TDLS gets teardown while adding new virtual interface. But TDLS gets formed again if there is delay in starting BSS. Thus, TDLS gets formed, but TDLS connection tracker gets disabled. The change is to teardown TDLS links if TDLS connection tracker is disabled in cds_incr_active_session(). Change-Id: I0ae6526ad0aa321b666e62d09c2ca5b1be8f9157 CRs-Fixed: 2010694 --- core/cds/src/cds_concurrency.c | 3 +-- core/hdd/inc/wlan_hdd_tdls.h | 6 ++---- core/hdd/src/wlan_hdd_cfg80211.c | 3 +-- core/hdd/src/wlan_hdd_p2p.c | 2 -- core/hdd/src/wlan_hdd_tdls.c | 20 +++++++------------- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index bbdcd03b9da3..12b61d4bc639 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -1964,8 +1964,7 @@ void cds_incr_active_session(enum tQDF_ADAPTER_MODE mode, qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock); } - /* set tdls connection tracker state */ - cds_set_tdls_ct_mode(hdd_ctx); + hdd_update_tdls_ct_and_teardown_links(hdd_ctx); cds_dump_current_concurrency(); qdf_mutex_release(&cds_ctx->qdf_conc_list_lock); diff --git a/core/hdd/inc/wlan_hdd_tdls.h b/core/hdd/inc/wlan_hdd_tdls.h index 0bad4a40c9b4..7fed1ef50092 100644 --- a/core/hdd/inc/wlan_hdd_tdls.h +++ b/core/hdd/inc/wlan_hdd_tdls.h @@ -713,8 +713,7 @@ int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, #endif #endif -void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter, - hdd_context_t *hddctx); +void hdd_update_tdls_ct_and_teardown_links(hdd_context_t *hdd_ctx); void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx); hddTdlsPeer_t *wlan_hdd_tdls_find_first_connected_peer(hdd_adapter_t *adapter); @@ -792,8 +791,7 @@ int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy, int data_len); #else -static inline void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter, - hdd_context_t *hddctx) +static inline void hdd_update_tdls_ct_and_teardown_links(hdd_context_t *hdd_ctx) { } static inline void diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 0b814c8bfd44..b0358c628bc2 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11050,8 +11050,7 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, /* Reset the current device mode bit mask */ cds_clear_concurrency_mode(pAdapter->device_mode); - hdd_tdls_notify_mode_change(pAdapter, pHddCtx); - + hdd_update_tdls_ct_and_teardown_links(pHddCtx); if ((pAdapter->device_mode == QDF_STA_MODE) || (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) || (pAdapter->device_mode == QDF_P2P_DEVICE_MODE) || diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 4c34b8072f08..c8d652867f43 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -2089,8 +2089,6 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy, return ERR_PTR(-EINVAL); } - wlan_hdd_tdls_disable_offchan_and_teardown_links(pHddCtx); - pAdapter = hdd_get_adapter(pHddCtx, QDF_STA_MODE); if ((pAdapter != NULL) && !(wlan_hdd_validate_session_id(pAdapter->sessionId))) { diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c index e0a96937c6c0..3b78af1efe6a 100644 --- a/core/hdd/src/wlan_hdd_tdls.c +++ b/core/hdd/src/wlan_hdd_tdls.c @@ -278,23 +278,17 @@ void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx) } /** - * hdd_tdls_notify_mode_change - Notify mode change - * @adapter: pointer to hdd adapter - * @hddCtx : pointer to hdd context + * hdd_update_tdls_ct_and_teardown_links - Update TDLS connection tracker and + * teardown links. + * @hdd_ctx : pointer to hdd context * * Return: None */ -void hdd_tdls_notify_mode_change(hdd_adapter_t *adapter, hdd_context_t *hddctx) +void hdd_update_tdls_ct_and_teardown_links(hdd_context_t *hdd_ctx) { - /* - * Disable tdls connection tracker, when interface - * change happens in the system. - */ - mutex_lock(&hddctx->tdls_lock); - hddctx->enable_tdls_connection_tracker = false; - mutex_unlock(&hddctx->tdls_lock); - hdd_info("hdd_ctx->enable_tdls_connection_tracker: 0"); - wlan_hdd_tdls_disable_offchan_and_teardown_links(hddctx); + /* set tdls connection tracker state */ + cds_set_tdls_ct_mode(hdd_ctx); + wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_ctx); } /**