From 14ec97f448621b119ec83ae07bee9f648aa206d1 Mon Sep 17 00:00:00 2001 From: Kabilan Kannan Date: Mon, 16 May 2016 23:48:25 -0700 Subject: [PATCH] qcacld-3.0: Stop connection tracker during TDLS UAPSD and btcoex Connection tracker should not run, when the events TDLS UAPSD and btcoex happens in the system. Add changes in the host driver to stop connection tracker for the aforementioned events. Change-Id: Ib631dc986826339a4c191328f187e46f4e0392d9 CRs-Fixed: 1025613 --- core/hdd/src/wlan_hdd_assoc.c | 65 +++++++++++++++++++ core/mac/inc/wni_api.h | 15 +++++ core/mac/src/include/sir_params.h | 5 ++ .../src/pe/lim/lim_send_sme_rsp_messages.c | 3 + core/sme/inc/csr_api.h | 1 + core/sme/src/csr/csr_tdls_process.c | 12 ++++ core/wma/inc/wma_types.h | 1 + core/wma/src/wma_features.c | 20 +++++- 8 files changed, 120 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 28a98c5db86e..f0bd3a3f6c73 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -2982,6 +2982,64 @@ static QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, return qdf_status; } +/** + * hdd_tdls_connection_tracker_update() - update connection tracker state + * @adapter: pointer to adapter + * @roam_info: pointer to roam info + * @hdd_tdls_ctx: tdls context + * + * Return: QDF_STATUS enumeration + */ +static QDF_STATUS hdd_tdls_connection_tracker_update(hdd_adapter_t *adapter, + tCsrRoamInfo *roam_info, + tdlsCtx_t *hdd_tdls_ctx) +{ + hddTdlsPeer_t *curr_peer; + hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + + curr_peer = wlan_hdd_tdls_find_peer(adapter, + roam_info->peerMac.bytes, true); + + if (!curr_peer) { + hdd_err("curr_peer is null"); + return QDF_STATUS_E_FAILURE; + } + + mutex_lock(&hdd_ctx->tdls_lock); + + if (eTDLS_LINK_CONNECTED == + curr_peer->link_status) { + hdd_err("Received CONNECTION_TRACKER_NOTIFICATION " + MAC_ADDRESS_STR + " staId: %d, reason: %d", + MAC_ADDR_ARRAY(roam_info->peerMac.bytes), + roam_info->staId, + roam_info->reasonCode); + + if (roam_info->reasonCode == + eWNI_TDLS_PEER_ENTER_BUF_STA || + roam_info->reasonCode == + eWNI_TDLS_ENTER_BT_BUSY_MODE) + hdd_ctx->enable_tdls_connection_tracker = true; + else if (roam_info->reasonCode == + eWNI_TDLS_PEER_EXIT_BUF_STA || + roam_info->reasonCode == + eWNI_TDLS_EXIT_BT_BUSY_MODE) + hdd_ctx->enable_tdls_connection_tracker = false; + + } else { + hdd_err("TDLS not connected, ignore notification, reason: %d", + roam_info->reasonCode); + } + + mutex_unlock(&hdd_ctx->tdls_lock); + + return QDF_STATUS_SUCCESS; +} + + + + /** * hdd_roam_tdls_status_update_handler() - TDLS status update handler * @pAdapter: pointer to adapter @@ -3454,6 +3512,13 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, } break; } + + case eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION: + status = hdd_tdls_connection_tracker_update(pAdapter, + pRoamInfo, + pHddTdlsCtx); + break; + default: { break; diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h index 160ada158e40..76eb1c21bddc 100644 --- a/core/mac/inc/wni_api.h +++ b/core/mac/inc/wni_api.h @@ -160,6 +160,7 @@ enum eWniMsgTypes { eWNI_SME_TDLS_SHOULD_DISCOVER, eWNI_SME_TDLS_SHOULD_TEARDOWN, eWNI_SME_TDLS_PEER_DISCONNECTED, + eWNI_SME_TDLS_CONNECTION_TRACKER_NOTIFICATION, #endif /* NOTE: If you are planning to add more mesages, please make sure that */ /* SIR_LIM_ITC_MSG_TYPES_BEGIN is moved appropriately. It is set as */ @@ -264,6 +265,20 @@ typedef enum { eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE, } eWniTdlsTeardownReason; +/** + * enum ewni_tdls_connection_tracker_notification - connection tracker events + * @eWNI_TDLS_PEER_ENTER_BUF_STA: TDLS peer enters buff sta + * @eWNI_TDLS_PEER_EXIT_BUF_STA: TDLS peer exit buff sta + * @eWNI_TDLS_ENTER_BT_BUSY_MODE: Enter BT busy event + * @eWNI_TDLS_EXIT_BT_BUSY_MODE: Exit BT busy event + */ +enum ewni_tdls_connection_tracker_notification { + eWNI_TDLS_PEER_ENTER_BUF_STA, + eWNI_TDLS_PEER_EXIT_BUF_STA, + eWNI_TDLS_ENTER_BT_BUSY_MODE, + eWNI_TDLS_EXIT_BT_BUSY_MODE, +}; + #define WNI_CFG_MSG_TYPES_BEGIN 0x1200 /*---------------------------------------------------------------------*/ diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index 26910c801fb4..a871bc618357 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -612,6 +612,11 @@ typedef struct sSirMbMsgP2p { #define SIR_HAL_SET_WISA_PARAMS (SIR_HAL_ITC_MSG_TYPES_BEGIN + 343) #define SIR_HAL_SET_ADAPT_DWELLTIME_PARAMS (SIR_HAL_ITC_MSG_TYPES_BEGIN + 344) #define SIR_HAL_SET_PDEV_IE_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 345) + +#ifdef FEATURE_WLAN_TDLS +#define SIR_HAL_TDLS_CONNECTION_TRACKER_NOTIFICATION (SIR_HAL_ITC_MSG_TYPES_BEGIN + 346) +#endif + #define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF) /* CFG message types */ diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index 0308f01cc0dd..f5f7f5f4c183 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -1319,6 +1319,9 @@ void lim_send_sme_tdls_event_notify(tpAniSirGlobal pMac, uint16_t msgType, case SIR_HAL_TDLS_PEER_DISCONNECTED: mmhMsg.type = eWNI_SME_TDLS_PEER_DISCONNECTED; break; + case SIR_HAL_TDLS_CONNECTION_TRACKER_NOTIFICATION: + mmhMsg.type = eWNI_SME_TDLS_CONNECTION_TRACKER_NOTIFICATION; + break; } mmhMsg.bodyptr = events; diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index ce4587162425..2c3b8068d73a 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -588,6 +588,7 @@ typedef enum { eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER, eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN, eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED, + eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION, #endif eCSR_ROAM_RESULT_IBSS_PEER_INFO_SUCCESS, diff --git a/core/sme/src/csr/csr_tdls_process.c b/core/sme/src/csr/csr_tdls_process.c index bfd589fb4b6d..28b8856000f4 100644 --- a/core/sme/src/csr/csr_tdls_process.c +++ b/core/sme/src/csr/csr_tdls_process.c @@ -815,6 +815,18 @@ QDF_STATUS tdls_msg_processor(tpAniSirGlobal pMac, uint16_t msgType, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED); break; + case eWNI_SME_TDLS_CONNECTION_TRACKER_NOTIFICATION: + qdf_copy_macaddr(&roamInfo.peerMac, &tevent->peermac); + roamInfo.reasonCode = tevent->peer_reason; + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, + "%s: eWNI_SME_TDLS_CONNECTION_TRACKER_NOTIFICATION for peer mac: " + MAC_ADDRESS_STR " peer_reason: %d", + __func__, MAC_ADDR_ARRAY(tevent->peermac.bytes), + tevent->peer_reason); + csr_roam_call_callback(pMac, tevent->sessionId, &roamInfo, + 0, eCSR_ROAM_TDLS_STATUS_UPDATE, + eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION); + break; default: break; } diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index 3b2120ed9ee6..d5ababa095fd 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -378,6 +378,7 @@ #define WMA_TDLS_SHOULD_TEARDOWN_CMD SIR_HAL_TDLS_SHOULD_TEARDOWN #define WMA_TDLS_PEER_DISCONNECTED_CMD SIR_HAL_TDLS_PEER_DISCONNECTED #define WMA_TDLS_SET_OFFCHAN_MODE SIR_HAL_TDLS_SET_OFFCHAN_MODE +#define WMA_TDLS_CONNECTION_TRACKER_NOTIFICATION_CMD SIR_HAL_TDLS_CONNECTION_TRACKER_NOTIFICATION #endif #define WMA_SET_SAP_INTRABSS_DIS SIR_HAL_SET_SAP_INTRABSS_DIS diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 6d96bf91e3de..32d64857daf0 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -6275,6 +6275,10 @@ int wma_tdls_event_handler(void *handle, uint8_t *event, uint32_t len) case WMI_TDLS_PEER_DISCONNECTED: tdls_event->messageType = WMA_TDLS_PEER_DISCONNECTED_CMD; break; + case WMI_TDLS_CONNECTION_TRACKER_NOTIFICATION: + tdls_event->messageType = + WMA_TDLS_CONNECTION_TRACKER_NOTIFICATION_CMD; + break; default: WMA_LOGE("%s: Discarding unknown tdls event(%d) from target", __func__, peer_event->peer_status); @@ -6304,6 +6308,18 @@ int wma_tdls_event_handler(void *handle, uint8_t *event, uint32_t len) case WMI_TDLS_TEARDOWN_REASON_NO_RESPONSE: tdls_event->peer_reason = eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE; break; + case WMI_TDLS_ENTER_BUF_STA: + tdls_event->peer_reason = eWNI_TDLS_PEER_ENTER_BUF_STA; + break; + case WMI_TDLS_EXIT_BUF_STA: + tdls_event->peer_reason = eWNI_TDLS_PEER_EXIT_BUF_STA; + break; + case WMI_TDLS_ENTER_BT_BUSY_MODE: + tdls_event->peer_reason = eWNI_TDLS_ENTER_BT_BUSY_MODE; + break; + case WMI_TDLS_EXIT_BT_BUSY_MODE: + tdls_event->peer_reason = eWNI_TDLS_EXIT_BT_BUSY_MODE; + break; default: WMA_LOGE("%s: unknown reason(%d) in tdls event(%d) from target", __func__, peer_event->peer_reason, @@ -6392,9 +6408,9 @@ QDF_STATUS wma_update_fw_tdls_state(WMA_HANDLE handle, void *pwmaTdlsparams) if (WMA_TDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == tdls_mode) { tdls_state = WMI_TDLS_ENABLE_PASSIVE; } else if (WMA_TDLS_SUPPORT_ENABLED == tdls_mode) { - tdls_state = WMI_TDLS_ENABLE_ACTIVE; + tdls_state = WMI_TDLS_ENABLE_CONNECTION_TRACKER_IN_HOST; } else if (WMA_TDLS_SUPPORT_ACTIVE_EXTERNAL_CONTROL == tdls_mode) { - tdls_state = WMI_TDLS_ENABLE_ACTIVE_EXTERNAL_CONTROL; + tdls_state = WMI_TDLS_ENABLE_CONNECTION_TRACKER_IN_HOST; } else { tdls_state = WMI_TDLS_DISABLE; }