diff options
| author | Yingying Tang <yintang@codeaurora.org> | 2016-08-25 14:00:05 +0800 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-09-08 14:31:03 +0530 |
| commit | b970a54a4d28353681306cedaced182a6400df8a (patch) | |
| tree | dd46160c1259ff74b90f7390205fb15dd59a08dd | |
| parent | 236ae4f47f0a619448731a65e8a1237bc0899e20 (diff) | |
qcacld-2.0: Remove BTC code to reduce driver size
BTC code is only used for WCN chipset where BT COEX module was running
on host. While for Rome solution, BT COEX module is moved down to FW.
Remove it to reduce driver size.
Change-Id: I0548dd704a2a2b6bd36d01e3e3f4963b8c19d02b
CRs-Fixed: 1058780
33 files changed, 26 insertions, 3224 deletions
diff --git a/CORE/EPPING/src/epping_helper.c b/CORE/EPPING/src/epping_helper.c index 59ab7986cbb9..52e14f28ae71 100644 --- a/CORE/EPPING/src/epping_helper.c +++ b/CORE/EPPING/src/epping_helper.c @@ -46,7 +46,6 @@ #include <wlan_hdd_tx_rx.h> #include <wniApi.h> #include <wlan_nlink_srv.h> -#include <wlan_btc_svc.h> #include <wlan_hdd_cfg.h> #include <wlan_ptt_sock_svc.h> #include <wlan_hdd_wowl.h> diff --git a/CORE/EPPING/src/epping_main.c b/CORE/EPPING/src/epping_main.c index ddb466ed59d1..ccf588133873 100644 --- a/CORE/EPPING/src/epping_main.c +++ b/CORE/EPPING/src/epping_main.c @@ -45,7 +45,6 @@ #include <wlan_hdd_tx_rx.h> #include <wniApi.h> #include <wlan_nlink_srv.h> -#include <wlan_btc_svc.h> #include <wlan_hdd_cfg.h> #include <wlan_ptt_sock_svc.h> #include <wlan_hdd_wowl.h> diff --git a/CORE/EPPING/src/epping_rx.c b/CORE/EPPING/src/epping_rx.c index 679cf2502c18..c6f2d1eb9c11 100644 --- a/CORE/EPPING/src/epping_rx.c +++ b/CORE/EPPING/src/epping_rx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2014, 2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -45,7 +45,6 @@ #include <wlan_hdd_tx_rx.h> #include <wniApi.h> #include <wlan_nlink_srv.h> -#include <wlan_btc_svc.h> #include <wlan_hdd_cfg.h> #include <wlan_ptt_sock_svc.h> #include <wlan_hdd_wowl.h> diff --git a/CORE/EPPING/src/epping_tx.c b/CORE/EPPING/src/epping_tx.c index 8de0b1cb9520..6d4e838325b6 100644 --- a/CORE/EPPING/src/epping_tx.c +++ b/CORE/EPPING/src/epping_tx.c @@ -45,7 +45,6 @@ #include <wlan_hdd_tx_rx.h> #include <wniApi.h> #include <wlan_nlink_srv.h> -#include <wlan_btc_svc.h> #include <wlan_hdd_cfg.h> #include <wlan_ptt_sock_svc.h> #include <wlan_hdd_wowl.h> diff --git a/CORE/EPPING/src/epping_txrx.c b/CORE/EPPING/src/epping_txrx.c index bceba3d5329c..b2f90395b1c1 100644 --- a/CORE/EPPING/src/epping_txrx.c +++ b/CORE/EPPING/src/epping_txrx.c @@ -45,7 +45,6 @@ #include <wlan_hdd_tx_rx.h> #include <wniApi.h> #include <wlan_nlink_srv.h> -#include <wlan_btc_svc.h> #include <wlan_hdd_cfg.h> #include <wlan_ptt_sock_svc.h> #include <wlan_hdd_wowl.h> diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h index c88e5d2d49cc..ea80b08636d6 100644 --- a/CORE/HDD/inc/wlan_hdd_cfg.h +++ b/CORE/HDD/inc/wlan_hdd_cfg.h @@ -551,16 +551,6 @@ enum #define CFG_ACTIVE_MIN_CHANNEL_TIME_MAX ( 10000 ) #define CFG_ACTIVE_MIN_CHANNEL_TIME_DEFAULT ( 20 ) -#define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_NAME "gActiveMaxChannelTimeBtc" -#define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MIN ( 0 ) -#define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MAX ( 10000 ) -#define CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_DEFAULT ( 120 ) - -#define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_NAME "gActiveMinChannelTimeBtc" -#define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_MIN ( 0 ) -#define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_MAX ( 10000 ) -#define CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_DEFAULT ( 60 ) - #define CFG_RETRY_LIMIT_ZERO_NAME "gRetryLimitZero" #define CFG_RETRY_LIMIT_ZERO_MIN ( 0 ) #define CFG_RETRY_LIMIT_ZERO_MAX ( 15 ) @@ -4130,8 +4120,6 @@ struct hdd_config { v_U32_t nInitialDwellTime; //in units of milliseconds bool initial_scan_no_dfs_chnl; - v_U32_t nActiveMinChnTimeBtc; //in units of milliseconds - v_U32_t nActiveMaxChnTimeBtc; //in units of milliseconds #ifdef WLAN_AP_STA_CONCURRENCY v_U32_t nPassiveMinChnTimeConc; //in units of milliseconds v_U32_t nPassiveMaxChnTimeConc; //in units of milliseconds diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c index 10f48ce852fe..bfcb76c77384 100644 --- a/CORE/HDD/src/wlan_hdd_assoc.c +++ b/CORE/HDD/src/wlan_hdd_assoc.c @@ -51,7 +51,6 @@ #include <aniGlobal.h> #include "dot11f.h" #include "wlan_nlink_common.h" -#include "wlan_btc_svc.h" #include "wlan_hdd_power.h" #include "wlan_hdd_trace.h" #include <linux/ieee80211.h> @@ -878,7 +877,6 @@ static void hdd_SendAssociationEvent(struct net_device *dev,tCsrRoamInfo *pCsrRo } #endif } - send_btc_nlink_msg(type, 0); } static void hdd_connRemoveConnectInfo(hdd_station_ctx_t *pHddStaCtx) diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c index fb21ce63f290..9806c940298c 100644 --- a/CORE/HDD/src/wlan_hdd_cfg.c +++ b/CORE/HDD/src/wlan_hdd_cfg.c @@ -873,20 +873,6 @@ REG_TABLE_ENTRY g_registry_table[] = CFG_ACTIVE_MIN_CHANNEL_TIME_MIN, CFG_ACTIVE_MIN_CHANNEL_TIME_MAX ), - REG_VARIABLE( CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_NAME, WLAN_PARAM_Integer, - hdd_config_t, nActiveMaxChnTimeBtc, - VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, - CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_DEFAULT, - CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MIN, - CFG_ACTIVE_MAX_CHANNEL_TIME_BTC_MAX ), - - REG_VARIABLE( CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_NAME, WLAN_PARAM_Integer, - hdd_config_t, nActiveMinChnTimeBtc, - VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, - CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_DEFAULT, - CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_MIN, - CFG_ACTIVE_MIN_CHANNEL_TIME_BTC_MAX ), - REG_VARIABLE( CFG_RETRY_LIMIT_ZERO_NAME, WLAN_PARAM_Integer, hdd_config_t, retryLimitZero, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -6104,23 +6090,6 @@ eCsrPhyMode hdd_cfg_xlate_to_csr_phy_mode( eHddDot11Mode dot11Mode ) } -static void hdd_set_btc_config(hdd_context_t *pHddCtx) -{ - hdd_config_t *pConfig = pHddCtx->cfg_ini; - tSmeBtcConfig btcParams; - int i; - - sme_BtcGetConfig(pHddCtx->hHal, &btcParams); - - btcParams.btcExecutionMode = pConfig->btcExecutionMode; - - for (i = 0; i < 6; i++) { - btcParams.mwsCoexConfig[i] = pConfig->mwsCoexConfig[i]; - } - - sme_BtcSetConfig(pHddCtx->hHal, &btcParams); -} - static void hdd_set_power_save_config(hdd_context_t *pHddCtx, tSmeConfigParams *smeConfig) { hdd_config_t *pConfig = pHddCtx->cfg_ini; @@ -7203,8 +7172,6 @@ VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx ) smeConfig->csrConfig.nActiveMinChnTime = pConfig->nActiveMinChnTime; smeConfig->csrConfig.nPassiveMaxChnTime = pConfig->nPassiveMaxChnTime; smeConfig->csrConfig.nPassiveMinChnTime = pConfig->nPassiveMinChnTime; - smeConfig->csrConfig.nActiveMaxChnTimeBtc = pConfig->nActiveMaxChnTimeBtc; - smeConfig->csrConfig.nActiveMinChnTimeBtc = pConfig->nActiveMinChnTimeBtc; smeConfig->csrConfig.disableAggWithBtc = pConfig->disableAggWithBtc; #ifdef WLAN_AP_STA_CONCURRENCY smeConfig->csrConfig.nActiveMaxChnTimeConc = pConfig->nActiveMaxChnTimeConc; @@ -7319,8 +7286,6 @@ VOS_STATUS hdd_set_sme_config( hdd_context_t *pHddCtx ) hdd_set_power_save_offload_config(pHddCtx); } - hdd_set_btc_config(pHddCtx); - #ifdef WLAN_FEATURE_VOWIFI_11R smeConfig->csrConfig.csr11rConfig.IsFTResourceReqSupported = pConfig->fFTResourceReqSupported; #endif diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c index 4794f5a023b5..e5f05673de19 100644 --- a/CORE/HDD/src/wlan_hdd_early_suspend.c +++ b/CORE/HDD/src/wlan_hdd_early_suspend.c @@ -52,7 +52,6 @@ #include <vos_sched.h> #include <macInitApi.h> #include <wlan_qct_sys.h> -#include <wlan_btc_svc.h> #include <wlan_nlink_common.h> #include <wlan_hdd_main.h> #include <wlan_hdd_assoc.h> @@ -2425,7 +2424,6 @@ err_re_init: /* Unregister all Net Device Notifiers */ wlan_hdd_netdev_notifiers_cleanup(pHddCtx); /* Clean up HDD Nlink Service */ - send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0); nl_srv_exit(); hdd_runtime_suspend_deinit(pHddCtx); hdd_close_all_adapters(pHddCtx); @@ -2448,8 +2446,6 @@ err_re_init: hdd_wlan_wakelock_destroy(); return -EPERM; success: - /* Trigger replay of BTC events */ - send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0); pHddCtx->isLogpInProgress = FALSE; hdd_ssr_timer_del(); return VOS_STATUS_SUCCESS; diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c index d7ee674b5b40..35f8307ae7b6 100644 --- a/CORE/HDD/src/wlan_hdd_hostapd.c +++ b/CORE/HDD/src/wlan_hdd_hostapd.c @@ -71,7 +71,6 @@ #include <linux/netdevice.h> #include <linux/mmc/sdio_func.h> #include "wlan_nlink_common.h" -#include "wlan_btc_svc.h" #include "wlan_hdd_p2p.h" #ifdef IPA_OFFLOAD #include <wlan_hdd_ipa.h> @@ -1453,9 +1452,6 @@ VOS_STATUS hdd_hostapd_SAPEventCB( tpSap_Event pSapEvent, v_PVOID_t usrDataForCa hdd_wlan_green_ap_start_bss(pHddCtx); - // Send current operating channel of SoftAP to BTC-ES - send_btc_nlink_msg(WLAN_BTC_SOFTAP_BSS_START, 0); - /* Set default key index */ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: default key index %hu", __func__, diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index e8878a5274d7..0699aad27a8d 100644 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -69,7 +69,6 @@ #include <wlan_hdd_tx_rx.h> #include <wniApi.h> #include <wlan_nlink_srv.h> -#include <wlan_btc_svc.h> #include <wlan_hdd_cfg.h> #include <wlan_ptt_sock_svc.h> #include <dbglog_host.h> @@ -13173,9 +13172,6 @@ void hdd_wlan_exit(hdd_context_t *pHddCtx) if (pConfig && pConfig->fIsLogpEnabled) vos_watchdog_close(pVosContext); - //Clean up HDD Nlink Service - send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0); - if (VOS_FTM_MODE != hdd_get_conparam()) wlan_hdd_logging_sock_deactivate_svc(pHddCtx); @@ -15353,13 +15349,6 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) pHddCtx->kd_nl_init = 1; #endif /* WLAN_KD_READY_NOTIFIER */ - //Initialize the BTC service - if(btc_activate_service(pHddCtx) != 0) - { - hddLog(VOS_TRACE_LEVEL_FATAL,"%s: btc_activate_service failed",__func__); - goto err_reg_netdev; - } - #ifdef FEATURE_OEM_DATA_SUPPORT //Initialize the OEM service if (oem_activate_service(pHddCtx) != 0) diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c index d869e540b644..af0a0c56047b 100644 --- a/CORE/HDD/src/wlan_hdd_wext.c +++ b/CORE/HDD/src/wlan_hdd_wext.c @@ -48,7 +48,6 @@ #include <linux/wireless.h> #include <macTrace.h> #include <wlan_hdd_includes.h> -#include <wlan_btc_svc.h> #include <wlan_nlink_common.h> #include <vos_api.h> #include <net/arp.h> diff --git a/CORE/MAC/inc/aniGlobal.h b/CORE/MAC/inc/aniGlobal.h index 9ec0c282ef1d..3da692490b9a 100644 --- a/CORE/MAC/inc/aniGlobal.h +++ b/CORE/MAC/inc/aniGlobal.h @@ -74,7 +74,6 @@ typedef struct sAniSirGlobal *tpAniSirGlobal; #include "smeInternal.h" #include "sapApi.h" #include "ccmApi.h" -#include "btcApi.h" #include "csrInternal.h" #ifdef FEATURE_OEM_DATA_SUPPORT @@ -1213,7 +1212,6 @@ typedef struct sAniSirGlobal tOemDataStruct oemData; #endif tPmcInfo pmc; - tSmeBtcInfo btc; tCcm ccm; diff --git a/CORE/MAC/inc/wniApi.h b/CORE/MAC/inc/wniApi.h index ee0e37bfcddb..a07567778046 100644 --- a/CORE/MAC/inc/wniApi.h +++ b/CORE/MAC/inc/wniApi.h @@ -277,8 +277,6 @@ enum eWniMsgTypes eWNI_SME_REGISTER_MGMT_FRAME_REQ, - eWNI_SME_COEX_IND, - #ifdef FEATURE_WLAN_SCAN_PNO eWNI_SME_PREF_NETWORK_FOUND_IND, #endif // FEATURE_WLAN_SCAN_PNO diff --git a/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c b/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c index ee433aedc5b5..bd7cbfd3dbf0 100644 --- a/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c +++ b/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c @@ -570,28 +570,6 @@ limHandleCFGparamUpdate(tpAniSirGlobal pMac, tANI_U32 cfgId) pMac->lim.glim_assoc_sta_limit_ap = (tANI_U16)val1; break; - case WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC: - if (wlan_cfgGetInt - (pMac, WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC, &val1) != - eSIR_SUCCESS) - { - limLog(pMac, LOGE, - FL( "Unable to get WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC")); - break; - } - if (val1) - { - limLog(pMac, LOGW, - FL("BTC requested to disable all RX BA sessions")); - limDelPerBssBASessionsBtc(pMac); - } - else - { - limLog(pMac, LOGW, - FL("Resetting the WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC")); - } - break; - default: break; } diff --git a/CORE/MAC/src/pe/lim/limTimerUtils.c b/CORE/MAC/src/pe/lim/limTimerUtils.c index 05be3fc41a74..189ea21d43f2 100644 --- a/CORE/MAC/src/pe/lim/limTimerUtils.c +++ b/CORE/MAC/src/pe/lim/limTimerUtils.c @@ -1041,17 +1041,6 @@ limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId) if (pMac->lim.gpLimMlmScanReq) { val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime); - if (pMac->btc.btcScanCompromise) { - if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc) { - val = SYS_MS_TO_TICKS( - pMac->lim.gpLimMlmScanReq->minChannelTimeBtc); - limLog(pMac, LOG1, - FL("Using BTC Min Active Scan time")); - } else { - limLog(pMac, LOGE, - FL("BTC Active Scan Min Time is Not Set")); - } - } } else { limLog(pMac, LOGE, FL("gpLimMlmScanReq is NULL")); break; @@ -1078,17 +1067,6 @@ limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId) } val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2; - if (pMac->btc.btcScanCompromise) - { - if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc) - { - val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)/2; - } - else - { - limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set")); - } - } if (val) { if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer, @@ -1129,17 +1107,6 @@ limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId) if (pMac->lim.gpLimMlmScanReq) { val = SYS_MS_TO_TICKS( pMac->lim.gpLimMlmScanReq->maxChannelTime); - if (pMac->btc.btcScanCompromise) { - if (pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc) { - val = SYS_MS_TO_TICKS( - pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc); - limLog(pMac, LOG1, - FL("Using BTC Max Active Scan time")); - } else { - limLog(pMac, LOGE, - FL("BTC Active Scan Max Time is Not Set")); - } - } } else { limLog(pMac, LOGE, FL("gpLimMlmScanReq is NULL")); break; diff --git a/CORE/MAC/src/pe/lim/limUtils.c b/CORE/MAC/src/pe/lim/limUtils.c index 626ab4bc02bc..de5b0b22d6ec 100644 --- a/CORE/MAC/src/pe/lim/limUtils.c +++ b/CORE/MAC/src/pe/lim/limUtils.c @@ -5229,28 +5229,6 @@ void limDelAllBASessions(tpAniSirGlobal pMac) } /** ------------------------------------------------------------- -\fn limDelAllBASessionsBtc -\brief Deletes all the existing BA recipient sessions in 2.4GHz - band. -\param tpAniSirGlobal pMac -\return None --------------------------------------------------------------*/ - -void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac) -{ - tANI_U8 sessionId; - tpPESession pSessionEntry; - pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr, - &sessionId); - if (pSessionEntry) - { - PELOGW(limLog(pMac, LOGW, - "Deleting the BA for session %d as host got BTC event", sessionId);) - limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT); - } -} - -/** ------------------------------------------------------------- \fn limProcessDelTsInd \brief Handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases. Validates the request, sends the diff --git a/CORE/MAC/src/pe/lim/limUtils.h b/CORE/MAC/src/pe/lim/limUtils.h index f079173be2c3..8a0210418b52 100644 --- a/CORE/MAC/src/pe/lim/limUtils.h +++ b/CORE/MAC/src/pe/lim/limUtils.h @@ -398,7 +398,6 @@ tSirRetStatus limPostSMStateUpdate(tpAniSirGlobal pMac, void limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg); void limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg); void limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry, tANI_U32 baDirection); -void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac); void limDelAllBASessions(tpAniSirGlobal pMac); void limDeleteDialogueTokenList(tpAniSirGlobal pMac); tSirRetStatus limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid); diff --git a/CORE/SME/inc/btcApi.h b/CORE/SME/inc/btcApi.h deleted file mode 100644 index 9a06f7c715a1..000000000000 --- a/CORE/SME/inc/btcApi.h +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved. - * - * Previously licensed under the ISC license by Qualcomm Atheros, Inc. - * - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all - * copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This file was originally distributed by Qualcomm Atheros, Inc. - * under proprietary terms before Copyright ownership was assigned - * to the Linux Foundation. - */ - -/****************************************************************************** -* -* Name: btcApi.h -* -* Description: BTC Events Layer API definitions. -* - -* -******************************************************************************/ - -#ifndef __BTC_API_H__ -#define __BTC_API_H__ - -#include "vos_types.h" -#include "vos_timer.h" -#include "vos_nvitem.h" - -#define BT_INVALID_CONN_HANDLE (0xFFFF) /**< Invalid connection handle */ - -/* ACL and Sync connection attempt results */ -#define BT_CONN_STATUS_FAIL (0) /**< Connection failed */ -#define BT_CONN_STATUS_SUCCESS (1) /**< Connection successful */ -#define BT_CONN_STATUS_MAX (2) /**< This and beyond are invalid values */ - -/** ACL and Sync link types - These must match the Bluetooth Spec! -*/ -#define BT_SCO (0) /**< SCO Link */ -#define BT_ACL (1) /**< ACL Link */ -#define BT_eSCO (2) /**< eSCO Link */ -#define BT_LINK_TYPE_MAX (3) /**< This value and higher are invalid */ - -/** ACL link modes - These must match the Bluetooth Spec! -*/ -#define BT_ACL_ACTIVE (0) /**< Active mode */ -#define BT_ACL_HOLD (1) /**< Hold mode */ -#define BT_ACL_SNIFF (2) /**< Sniff mode */ -#define BT_ACL_PARK (3) /**< Park mode */ -#define BT_ACL_MODE_MAX (4) /**< This value and higher are invalid */ - -/** - * A2DP BTC max no of BT sub intervals - * - * **/ -#define BTC_MAX_NUM_ACL_BT_SUB_INTS (7) - -/** BTC Executions Modes allowed to be set by user -*/ -#define BTC_SMART_COEXISTENCE (0) /** BTC Mapping Layer decides whats best */ -#define BTC_WLAN_ONLY (1) /** WLAN takes all mode */ -#define BTC_PTA_ONLY (2) /** Allow only 3 wire protocol in H/W */ -#define BTC_SMART_MAX_WLAN (3) /** BTC Mapping Layer decides whats best, WLAN weighted */ -#define BTC_SMART_MAX_BT (4) /** BTC Mapping Layer decides whats best, BT weighted */ -#define BTC_SMART_BT_A2DP (5) /** BTC Mapping Layer decides whats best, balanced + BT A2DP weight */ -#define BT_EXEC_MODE_MAX (6) /** This and beyond are invalid values */ - -/** Bitmaps used for maintaining various BT events that requires - enough time to complete such that it might require disbling of - heartbeat monitoring to avoid WLAN link loss with the AP -*/ -#define BT_INQUIRY_STARTED (1<<0) -#define BT_PAGE_STARTED (1<<1) -#define BT_CREATE_ACL_CONNECTION_STARTED (1<<2) -#define BT_CREATE_SYNC_CONNECTION_STARTED (1<<3) - -/** Maximum time duration in milliseconds between a specific BT start event and its - respective stop event, before it can be declared timed out on receiving the stop event. -*/ -#define BT_MAX_EVENT_DONE_TIMEOUT 45000 - - -/* - To suppurt multiple SCO connections for BT+UAPSD work -*/ -#define BT_MAX_SCO_SUPPORT 3 -#define BT_MAX_ACL_SUPPORT 3 -#define BT_MAX_DISCONN_SUPPORT (BT_MAX_SCO_SUPPORT+BT_MAX_ACL_SUPPORT) -#define BT_MAX_NUM_EVENT_ACL_DEFERRED 4 //We may need to defer these many BT events for ACL -#define BT_MAX_NUM_EVENT_SCO_DEFERRED 4 //We may need to defer these many BT events for SYNC - -/* - * Number of mws coex configurations - */ -#define MWS_COEX_MAX_CONFIG 6 - -/** Enumeration of all the different kinds of BT events -*/ -typedef enum eSmeBtEventType -{ - BT_EVENT_DEVICE_SWITCHED_ON, - BT_EVENT_DEVICE_SWITCHED_OFF, - BT_EVENT_INQUIRY_STARTED, - BT_EVENT_INQUIRY_STOPPED, - BT_EVENT_INQUIRY_SCAN_STARTED, - BT_EVENT_INQUIRY_SCAN_STOPPED, - BT_EVENT_PAGE_STARTED, - BT_EVENT_PAGE_STOPPED, - BT_EVENT_PAGE_SCAN_STARTED, - BT_EVENT_PAGE_SCAN_STOPPED, - BT_EVENT_CREATE_ACL_CONNECTION, - BT_EVENT_ACL_CONNECTION_COMPLETE, - BT_EVENT_CREATE_SYNC_CONNECTION, - BT_EVENT_SYNC_CONNECTION_COMPLETE, - BT_EVENT_SYNC_CONNECTION_UPDATED, - BT_EVENT_DISCONNECTION_COMPLETE, - BT_EVENT_MODE_CHANGED, - BT_EVENT_A2DP_STREAM_START, - BT_EVENT_A2DP_STREAM_STOP, - BT_EVENT_TYPE_MAX, //This and beyond are invalid values -} tSmeBtEventType; - -/**Data structure that specifies the needed event parameters for - BT_EVENT_CREATE_ACL_CONNECTION and BT_EVENT_ACL_CONNECTION_COMPLETE -*/ -typedef struct sSmeBtAclConnectionParam -{ - v_U8_t bdAddr[6]; - v_U16_t connectionHandle; - v_U8_t status; -} tSmeBtAclConnectionParam, *tpSmeBtAclConnectionParam; - -/** Data structure that specifies the needed event parameters for - BT_EVENT_CREATE_SYNC_CONNECTION, BT_EVENT_SYNC_CONNECTION_COMPLETE - and BT_EVENT_SYNC_CONNECTION_UPDATED -*/ -typedef struct sSmeBtSyncConnectionParam -{ - v_U8_t bdAddr[6]; - v_U16_t connectionHandle; - v_U8_t status; - v_U8_t linkType; - v_U8_t scoInterval; //units in number of 625us slots - v_U8_t scoWindow; //units in number of 625us slots - v_U8_t retransmisisonWindow; //units in number of 625us slots -} tSmeBtSyncConnectionParam, *tpSmeBtSyncConnectionParam; - -typedef struct sSmeBtSyncUpdateHist -{ - tSmeBtSyncConnectionParam btSyncConnection; - v_BOOL_t fValid; -} tSmeBtSyncUpdateHist, *tpSmeBtSyncUpdateHist; - -/**Data structure that specifies the needed event parameters for - BT_EVENT_MODE_CHANGED -*/ -typedef struct sSmeBtAclModeChangeParam -{ - v_U16_t connectionHandle; - v_U8_t mode; -} tSmeBtAclModeChangeParam, *tpSmeBtAclModeChangeParam; - -/*Data structure that specifies the needed event parameters for - BT_EVENT_DISCONNECTION_COMPLETE -*/ -typedef struct sSmeBtDisconnectParam -{ - v_U16_t connectionHandle; -} tSmeBtDisconnectParam, *tpSmeBtDisconnectParam; - -/*Data structure that specifies the needed event parameters for - BT_EVENT_A2DP_STREAM_START - BT_EVENT_A2DP_STREAM_STOP -*/ -typedef struct sSmeBtA2DPParam -{ - v_U8_t bdAddr[6]; -} tSmeBtA2DPParam, *tpSmeBtA2DPParam; - - -/** Generic Bluetooth Event structure for BTC -*/ -typedef struct sSmeBtcBtEvent -{ - tSmeBtEventType btEventType; - union - { - v_U8_t bdAddr[6]; /**< For events with only a BT Addr in event_data */ - tSmeBtAclConnectionParam btAclConnection; - tSmeBtSyncConnectionParam btSyncConnection; - tSmeBtDisconnectParam btDisconnect; - tSmeBtAclModeChangeParam btAclModeChange; - }uEventParam; -} tSmeBtEvent, *tpSmeBtEvent; - - -/** Data structure that specifies the BTC Configuration parameters -*/ -typedef struct sSmeBtcConfig -{ - v_U8_t btcExecutionMode; - v_U32_t mwsCoexConfig[MWS_COEX_MAX_CONFIG]; -} tSmeBtcConfig, *tpSmeBtcConfig; - - -typedef struct sSmeBtAclModeChangeEventHist -{ - tSmeBtAclModeChangeParam btAclModeChange; - v_BOOL_t fValid; -} tSmeBtAclModeChangeEventHist, *tpSmeBtAclModeChangeEventHist; - -typedef struct sSmeBtAclEventHist -{ - //At most, cached events are COMPLETION, DISCONNECT, CREATION, COMPLETION - tSmeBtEventType btEventType[BT_MAX_NUM_EVENT_ACL_DEFERRED]; - tSmeBtAclConnectionParam btAclConnection[BT_MAX_NUM_EVENT_ACL_DEFERRED]; - //bNextEventIdx == 0 meaning no event cached here - tANI_U8 bNextEventIdx; -} tSmeBtAclEventHist, *tpSmeBtAclEventHist; - -typedef struct sSmeBtSyncEventHist -{ - //At most, cached events are COMPLETION, DISCONNECT, CREATION, COMPLETION - tSmeBtEventType btEventType[BT_MAX_NUM_EVENT_SCO_DEFERRED]; - tSmeBtSyncConnectionParam btSyncConnection[BT_MAX_NUM_EVENT_SCO_DEFERRED]; - //bNextEventIdx == 0 meaning no event cached here - tANI_U8 bNextEventIdx; -} tSmeBtSyncEventHist, *tpSmeBtSyncEventHist; - -typedef struct sSmeBtDisconnectEventHist -{ - tSmeBtDisconnectParam btDisconnect; - v_BOOL_t fValid; -} tSmeBtDisconnectEventHist, *tpSmeBtDisconnectEventHist; - - -/* - Data structure for the history of BT events -*/ -typedef struct sSmeBtcEventHist -{ - tSmeBtSyncEventHist btSyncConnectionEvent[BT_MAX_SCO_SUPPORT]; - tSmeBtAclEventHist btAclConnectionEvent[BT_MAX_ACL_SUPPORT]; - tSmeBtAclModeChangeEventHist btAclModeChangeEvent[BT_MAX_ACL_SUPPORT]; - tSmeBtDisconnectEventHist btDisconnectEvent[BT_MAX_DISCONN_SUPPORT]; - tSmeBtSyncUpdateHist btSyncUpdateEvent[BT_MAX_SCO_SUPPORT]; - int nInquiryEvent; //>0 for # of outstanding inquiriy starts - //<0 for # of outstanding inquiry stops - //0 == no inquiry event - int nPageEvent; //>0 for # of outstanding page starts - //<0 for # of outstanding page stops - //0 == no page event - v_BOOL_t fA2DPStarted; - v_BOOL_t fA2DPStopped; -} tSmeBtcEventHist, *tpSmeBtcEventHist; - -typedef struct sSmeBtcEventReplay -{ - tSmeBtcEventHist btcEventHist; - v_BOOL_t fBTSwitchOn; - v_BOOL_t fBTSwitchOff; - //This is not directly tied to BT event so leave it alone when processing BT events - v_BOOL_t fRestoreHBMonitor; -} tSmeBtcEventReplay, *tpSmeBtcEventReplay; - -typedef struct sSmeBtcInfo -{ - tSmeBtcConfig btcConfig; - v_BOOL_t btcReady; - v_U8_t btcEventState; - v_U8_t btcHBActive; /* Is HB currently active */ - v_U8_t btcHBCount; /* default HB count */ - vos_timer_t restoreHBTimer; /* Timer to restore heart beat */ - tSmeBtcEventReplay btcEventReplay; - v_BOOL_t fReplayBTEvents; - v_BOOL_t btcUapsdOk; /* Indicate whether BTC is ok with UAPSD */ - v_BOOL_t fA2DPTrafStop;/*flag to check A2DP_STOP event has come before MODE_CHANGED*/ - v_U16_t btcScoHandles[BT_MAX_SCO_SUPPORT]; /* Handles for SCO, if any*/ - v_BOOL_t fA2DPUp; /*remember whether A2DP is in session*/ - v_BOOL_t btcScanCompromise; - v_U8_t btcBssfordisableaggr[VOS_MAC_ADDRESS_LEN]; -} tSmeBtcInfo, *tpSmeBtcInfo; - - -/** Routine definitions -*/ - -#ifndef WLAN_MDM_CODE_REDUCTION_OPT -VOS_STATUS btcOpen (tHalHandle hHal); -VOS_STATUS btcClose (tHalHandle hHal); -VOS_STATUS btcReady (tHalHandle hHal); -VOS_STATUS btcSendCfgMsg(tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig); -VOS_STATUS btcSignalBTEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent); -VOS_STATUS btcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig); -VOS_STATUS btcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig); -/* - Caller can check whether BTC's current event allows UAPSD. This doesn't affect - BMPS. - return: VOS_TRUE -- BTC is ready for UAPSD - VOS_FALSE -- certain BT event is active, cannot enter UAPSD -*/ -v_BOOL_t btcIsReadyForUapsd( tHalHandle hHal ); -eHalStatus btcHandleCoexInd(tHalHandle hHal, void* pMsg); -#endif /* End of WLAN_MDM_CODE_REDUCTION_OPT */ - -#endif diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h index b8cd201bcb41..d34c81cfc8d1 100644 --- a/CORE/SME/inc/csrApi.h +++ b/CORE/SME/inc/csrApi.h @@ -1215,8 +1215,6 @@ typedef struct tagCsrConfigParam tANI_U32 nInitialDwellTime; //in units of milliseconds bool initial_scan_no_dfs_chnl; - tANI_U32 nActiveMinChnTimeBtc; //in units of milliseconds - tANI_U32 nActiveMaxChnTimeBtc; //in units of milliseconds tANI_U32 disableAggWithBtc; #ifdef WLAN_AP_STA_CONCURRENCY tANI_U32 nPassiveMinChnTimeConc; //in units of milliseconds diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h index c5f9b1e92310..b5e91a46c0b0 100644 --- a/CORE/SME/inc/csrInternal.h +++ b/CORE/SME/inc/csrInternal.h @@ -600,8 +600,6 @@ typedef struct tagCsrConfig tANI_U32 nInitialDwellTime; //in units of milliseconds bool initial_scan_no_dfs_chnl; - tANI_U32 nActiveMinChnTimeBtc; //in units of milliseconds - tANI_U32 nActiveMaxChnTimeBtc; //in units of milliseconds tANI_U8 disableAggWithBtc; #ifdef WLAN_AP_STA_CONCURRENCY tANI_U32 nPassiveMinChnTimeConc; //in units of milliseconds diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h index 5cfa9d5468e9..48062b7db452 100644 --- a/CORE/SME/inc/sme_Api.h +++ b/CORE/SME/inc/sme_Api.h @@ -50,7 +50,6 @@ #include "vos_lock.h" #include "halTypes.h" #include "sirApi.h" -#include "btcApi.h" #include "vos_nvitem.h" #include "p2p_Api.h" #include "smeInternal.h" @@ -1843,50 +1842,6 @@ eHalStatus sme_DHCPStopInd( tHalHandle hHal, tANI_U8 sessionId ); /* --------------------------------------------------------------------------- - \fn sme_BtcSignalBtEvent - \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the - BT event type and the current operating mode of Libra (full power, - BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy - would be employed. - \param hHal - The handle returned by macOpen. - \param pBtcBtEvent - Pointer to a caller allocated object of type tSmeBtEvent - Caller owns the memory and is responsible for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen - if driver has not yet been initialized or if BTC - Events Layer has been disabled. - VOS_STATUS_SUCCESS BT Event passed to HAL - ---------------------------------------------------------------------------*/ -VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtcBtEvent); - -/* --------------------------------------------------------------------------- - \fn sme_BtcSetConfig - \brief API to change the current Bluetooth Coexistence (BTC) configuration - This function should be invoked only after CFG download has completed. - Calling it after sme_HDDReadyInd is recommended. - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type - tSmeBtcConfig. Caller owns the memory and is responsible - for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE Config not passed to HAL. - VOS_STATUS_SUCCESS Config passed to HAL - ---------------------------------------------------------------------------*/ -VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig); - -/* --------------------------------------------------------------------------- - \fn sme_BtcGetConfig - \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig. - Caller owns the memory and is responsible for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE - failure - VOS_STATUS_SUCCESS success - ---------------------------------------------------------------------------*/ -VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig); - -/* --------------------------------------------------------------------------- \fn sme_SetCfgPrivacy \brief API to set configure privacy parameters \param hHal - The handle returned by macOpen. diff --git a/CORE/SME/src/QoS/sme_Qos.c b/CORE/SME/src/QoS/sme_Qos.c index 0d3e783cbddf..9546f70a9f4d 100644 --- a/CORE/SME/src/QoS/sme_Qos.c +++ b/CORE/SME/src/QoS/sme_Qos.c @@ -3386,14 +3386,7 @@ static void sme_QosCopyTspecInfo(tpAniSirGlobal pMac, sme_QosWmmTspecInfo *pTspe pTspec->suspendInterval = pTspec_Info->suspension_interval; pTspec->svcStartTime = pTspec_Info->svc_start_time; pTspec->tsinfo.traffic.direction = pTspec_Info->ts_info.direction; - - //Make sure UAPSD is allowed. BTC may want to disable UAPSD while keep QoS setup - if (pTspec_Info->ts_info.psb && btcIsReadyForUapsd(pMac)) { - pTspec->tsinfo.traffic.psb = pTspec_Info->ts_info.psb; - } else { - pTspec->tsinfo.traffic.psb = 0; - pTspec_Info->ts_info.psb = 0; - } + pTspec->tsinfo.traffic.psb = pTspec_Info->ts_info.psb; pTspec->tsinfo.traffic.tsid = pTspec_Info->ts_info.tid; pTspec->tsinfo.traffic.userPrio = pTspec_Info->ts_info.up; pTspec->tsinfo.traffic.accessPolicy = SME_QOS_ACCESS_POLICY_EDCA; @@ -3503,15 +3496,7 @@ eHalStatus sme_QosCreateTspecRICIE(tpAniSirGlobal pMac, sme_QosWmmTspecInfo *pTs ricIE.TSPEC.suspension_int = pTspec_Info->suspension_interval; ricIE.TSPEC.service_start_time = pTspec_Info->svc_start_time; ricIE.TSPEC.direction = pTspec_Info->ts_info.direction; - //Make sure UAPSD is allowed. BTC may want to disable UAPSD while keep QoS setup - if( pTspec_Info->ts_info.psb && btcIsReadyForUapsd(pMac) ) - { - ricIE.TSPEC.psb = pTspec_Info->ts_info.psb; - } - else - { - ricIE.TSPEC.psb = 0; - } + ricIE.TSPEC.psb = pTspec_Info->ts_info.psb; ricIE.TSPEC.tsid = pTspec_Info->ts_info.tid; ricIE.TSPEC.user_priority = pTspec_Info->ts_info.up; ricIE.TSPEC.access_policy = SME_QOS_ACCESS_POLICY_EDCA; @@ -3547,15 +3532,7 @@ eHalStatus sme_QosCreateTspecRICIE(tpAniSirGlobal pMac, sme_QosWmmTspecInfo *pTs ricIE.WMMTSPEC.suspension_int = pTspec_Info->suspension_interval; ricIE.WMMTSPEC.service_start_time = pTspec_Info->svc_start_time; ricIE.WMMTSPEC.direction = pTspec_Info->ts_info.direction; - //Make sure UAPSD is allowed. BTC may want to disable UAPSD while keep QoS setup - if( pTspec_Info->ts_info.psb && btcIsReadyForUapsd(pMac) ) - { - ricIE.WMMTSPEC.psb = pTspec_Info->ts_info.psb; - } - else - { - ricIE.WMMTSPEC.psb = 0; - } + ricIE.WMMTSPEC.psb = pTspec_Info->ts_info.psb; ricIE.WMMTSPEC.tsid = pTspec_Info->ts_info.tid; ricIE.WMMTSPEC.user_priority = pTspec_Info->ts_info.up; ricIE.WMMTSPEC.access_policy = SME_QOS_ACCESS_POLICY_EDCA; @@ -4126,9 +4103,7 @@ eHalStatus sme_QosAddTsReq(tpAniSirGlobal pMac, pMsg->req.tspec.svcStartTime = 0; pMsg->req.tspec.tsinfo.traffic.direction = pTspec_Info->ts_info.direction; //Make sure UAPSD is allowed. BTC may want to disable UAPSD while keep QoS setup - if( pTspec_Info->ts_info.psb - && btcIsReadyForUapsd(pMac) - ) + if( pTspec_Info->ts_info.psb) { pMsg->req.tspec.tsinfo.traffic.psb = pTspec_Info->ts_info.psb; } @@ -8371,14 +8346,7 @@ sme_QosStatusType sme_QosTriggerUapsdChange( tpAniSirGlobal pMac ) tCsrRoamModifyProfileFields modifyProfileFields; //we need to do a reassoc on these AC csrGetModifyProfileFields(pMac, sessionId, &modifyProfileFields); - if( btcIsReadyForUapsd(pMac) ) - { - modifyProfileFields.uapsd_mask = uapsd_mask; - } - else - { - modifyProfileFields.uapsd_mask = 0; - } + modifyProfileFields.uapsd_mask = uapsd_mask; //Do we need to inform HDD? if(!HAL_STATUS_SUCCESS(sme_QosRequestReassoc(pMac, sessionId, &modifyProfileFields, VOS_TRUE))) { diff --git a/CORE/SME/src/btc/btcApi.c b/CORE/SME/src/btc/btcApi.c deleted file mode 100644 index 2615d71aa77c..000000000000 --- a/CORE/SME/src/btc/btcApi.c +++ /dev/null @@ -1,2075 +0,0 @@ -/* - * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. - * - * Previously licensed under the ISC license by Qualcomm Atheros, Inc. - * - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all - * copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This file was originally distributed by Qualcomm Atheros, Inc. - * under proprietary terms before Copyright ownership was assigned - * to the Linux Foundation. - */ - -/****************************************************************************** -* -* Name: btcApi.c -* -* Description: Routines that make up the BTC API. -* - -* -******************************************************************************/ -#include "wlan_qct_wda.h" -#ifndef WLAN_MDM_CODE_REDUCTION_OPT -#include "aniGlobal.h" -#include "smsDebug.h" -#include "btcApi.h" -#include "cfgApi.h" -#include "pmc.h" -#include "smeQosInternal.h" -#include "sme_Trace.h" -#ifdef FEATURE_WLAN_DIAG_SUPPORT -#include "vos_diag_core_event.h" -#include "vos_diag_core_log.h" -#endif /* FEATURE_WLAN_DIAG_SUPPORT */ -static void btcLogEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent); -static void btcRestoreHeartBeatMonitoringHandle(void* hHal); -static void btcUapsdCheck( tpAniSirGlobal pMac, tpSmeBtEvent pBtEvent ); -VOS_STATUS btcCheckHeartBeatMonitoring(tHalHandle hHal, tpSmeBtEvent pBtEvent); -static void btcPowerStateCB( v_PVOID_t pContext, tPmcState pmcState ); -static void btcPowerOffloadStateCB(v_PVOID_t pContext, tANI_U32 sessionId, - tPmcState pmcState ); -static VOS_STATUS btcDeferEvent( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ); -static VOS_STATUS btcDeferDisconnEvent( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ); -#ifdef FEATURE_WLAN_DIAG_SUPPORT -static void btcDiagEventLog (tHalHandle hHal, tpSmeBtEvent pBtEvent); -#endif /* FEATURE_WLAN_DIAG_SUPPORT */ -/* --------------------------------------------------------------------------- - \fn btcOpen - \brief API to init the BTC Events Layer - \param hHal - The handle returned by macOpen. - \return VOS_STATUS - VOS_STATUS_E_FAILURE success - VOS_STATUS_SUCCESS failure - ---------------------------------------------------------------------------*/ -VOS_STATUS btcOpen (tHalHandle hHal) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - VOS_STATUS vosStatus; - int i; - - /* Initialize BTC configuration. */ - pMac->btc.btcConfig.btcExecutionMode = BTC_SMART_COEXISTENCE; - - pMac->btc.btcReady = VOS_FALSE; - pMac->btc.btcEventState = 0; - pMac->btc.btcHBActive = VOS_TRUE; - pMac->btc.btcScanCompromise = VOS_FALSE; - - for (i = 0; i < MWS_COEX_MAX_CONFIG; i++) - { - pMac->btc.btcConfig.mwsCoexConfig[i] = 0; - } - - vosStatus = vos_timer_init( &pMac->btc.restoreHBTimer, - VOS_TIMER_TYPE_SW, - btcRestoreHeartBeatMonitoringHandle, - (void*) hHal); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcOpen: Fail to init timer"); - return VOS_STATUS_E_FAILURE; - } - - if(!pMac->psOffloadEnabled) - { - if(!HAL_STATUS_SUCCESS(pmcRegisterDeviceStateUpdateInd(pMac, - btcPowerStateCB, pMac))) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, - "btcOpen: Fail to register PMC callback"); - return VOS_STATUS_E_FAILURE; - } - } - else - { - tANI_U32 i; - for(i = 0; i < CSR_ROAM_SESSION_MAX; i++) - { - if(!HAL_STATUS_SUCCESS(pmcOffloadRegisterDeviceStateUpdateInd(pMac, - i, btcPowerOffloadStateCB, pMac))) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, - "btcOpen: Fail to register PMC callback"); - return VOS_STATUS_E_FAILURE; - } - } - } - return VOS_STATUS_SUCCESS; -} -/* --------------------------------------------------------------------------- - \fn btcClose - \brief API to exit the BTC Events Layer - \param hHal - The handle returned by macOpen. - \return VOS_STATUS - VOS_STATUS_E_FAILURE success - VOS_STATUS_SUCCESS failure - ---------------------------------------------------------------------------*/ -VOS_STATUS btcClose (tHalHandle hHal) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - VOS_STATUS vosStatus; - pMac->btc.btcReady = VOS_FALSE; - pMac->btc.btcUapsdOk = VOS_FALSE; - vos_timer_stop(&pMac->btc.restoreHBTimer); - vosStatus = vos_timer_destroy(&pMac->btc.restoreHBTimer); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcClose: Fail to destroy timer"); - return VOS_STATUS_E_FAILURE; - } - - if(!pMac->psOffloadEnabled) - { - if(!HAL_STATUS_SUCCESS( - pmcDeregisterDeviceStateUpdateInd(pMac, btcPowerStateCB))) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, - "%s: %d: cannot deregister pmcDeregisterDeviceStateUpdateInd()", - __func__, __LINE__); - } - } - else - { - tANI_U32 i; - for(i = 0; i < CSR_ROAM_SESSION_MAX; i++) - { - if(!HAL_STATUS_SUCCESS(pmcOffloadDeregisterDeviceStateUpdateInd(pMac, - i, btcPowerOffloadStateCB))) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, - "btcOpen: Fail to deregister PMC callback"); - return VOS_STATUS_E_FAILURE; - } - } - } - return VOS_STATUS_SUCCESS; -} - -/* --------------------------------------------------------------------------- - \fn btcReady - \brief fn to inform BTC that eWNI_SME_SYS_READY_IND has been sent to PE. - This acts as a trigger to send a message to HAL to update the BTC - related config to FW. Note that if HDD configures any power BTC - related stuff before this API is invoked, BTC will buffer all the - configuration. - \param hHal - The handle returned by macOpen. - \return VOS_STATUS - ---------------------------------------------------------------------------*/ -VOS_STATUS btcReady (tHalHandle hHal) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - v_U32_t cfgVal = 0; - v_U8_t i; - pMac->btc.btcReady = VOS_TRUE; - pMac->btc.btcUapsdOk = VOS_TRUE; - for(i=0; i < BT_MAX_SCO_SUPPORT; i++) - { - pMac->btc.btcScoHandles[i] = BT_INVALID_CONN_HANDLE; - } - - // Read heartbeat threshold CFG and save it. - ccmCfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &cfgVal); - pMac->btc.btcHBCount = (v_U8_t)cfgVal; - if (btcSendCfgMsg(hHal, &(pMac->btc.btcConfig)) != VOS_STATUS_SUCCESS) - { - return VOS_STATUS_E_FAILURE; - } - return VOS_STATUS_SUCCESS; -} - -static VOS_STATUS btcSendBTEvent(tpAniSirGlobal pMac, tpSmeBtEvent pBtEvent) -{ - vos_msg_t msg; - tpSmeBtEvent ptrSmeBtEvent = NULL; - switch(pBtEvent->btEventType) - { - case BT_EVENT_CREATE_SYNC_CONNECTION: - case BT_EVENT_SYNC_CONNECTION_UPDATED: - if(pBtEvent->uEventParam.btSyncConnection.linkType != BT_SCO && - pBtEvent->uEventParam.btSyncConnection.linkType != BT_eSCO) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "Invalid link type %d for Sync Connection. BT event will be dropped ", - __func__, pBtEvent->uEventParam.btSyncConnection.linkType); - return VOS_STATUS_E_FAILURE; - } - break; - case BT_EVENT_SYNC_CONNECTION_COMPLETE: - if((pBtEvent->uEventParam.btSyncConnection.status == BT_CONN_STATUS_SUCCESS) && - ((pBtEvent->uEventParam.btSyncConnection.linkType != BT_SCO && pBtEvent->uEventParam.btSyncConnection.linkType != BT_eSCO) || - (pBtEvent->uEventParam.btSyncConnection.connectionHandle == BT_INVALID_CONN_HANDLE))) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "Invalid connection handle %d or link type %d for Sync Connection. BT event will be dropped ", - __func__, - pBtEvent->uEventParam.btSyncConnection.connectionHandle, - pBtEvent->uEventParam.btSyncConnection.linkType); - return VOS_STATUS_E_FAILURE; - } - break; - case BT_EVENT_MODE_CHANGED: - if(pBtEvent->uEventParam.btAclModeChange.mode >= BT_ACL_MODE_MAX) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "Invalid mode %d for ACL Connection. BT event will be dropped ", - __func__, - pBtEvent->uEventParam.btAclModeChange.mode); - return VOS_STATUS_E_FAILURE; - } - break; - case BT_EVENT_DEVICE_SWITCHED_OFF: - pMac->btc.btcEventState = 0; - break; - default: - break; - } - ptrSmeBtEvent = vos_mem_malloc(sizeof(tSmeBtEvent)); - if (NULL == ptrSmeBtEvent) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "Not able to allocate memory for BT event", __func__); - return VOS_STATUS_E_FAILURE; - } - btcLogEvent(pMac, pBtEvent); -#ifdef FEATURE_WLAN_DIAG_SUPPORT - btcDiagEventLog(pMac, pBtEvent); -#endif - vos_mem_copy(ptrSmeBtEvent, pBtEvent, sizeof(tSmeBtEvent)); - msg.type = WDA_SIGNAL_BT_EVENT; - msg.reserved = 0; - msg.bodyptr = ptrSmeBtEvent; - MTRACE(vos_trace(VOS_MODULE_ID_SME, TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, - msg.type)); - if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "Not able to post WDA_SIGNAL_BT_EVENT message to WDA", __func__); - vos_mem_free( ptrSmeBtEvent ); - return VOS_STATUS_E_FAILURE; - } - // After successfully posting the message, check if heart beat - // monitoring needs to be turned off - (void)btcCheckHeartBeatMonitoring(pMac, pBtEvent); - //Check whether BTC and UAPSD can co-exist - btcUapsdCheck( pMac, pBtEvent ); - return VOS_STATUS_SUCCESS; - } - -#ifndef WLAN_MDM_CODE_REDUCTION_OPT -/* --------------------------------------------------------------------------- - \fn btcSignalBTEvent - \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the - BT event type and the current operating mode of Libra (full power, - BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy - would be employed. - \param hHal - The handle returned by macOpen. - \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent. - Caller owns the memory and is responsible for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE – BT Event not passed to HAL. This can happen - if driver has not yet been initialized or if BTC - Events Layer has been disabled. - VOS_STATUS_SUCCESS – BT Event passed to HAL - ---------------------------------------------------------------------------*/ -VOS_STATUS btcSignalBTEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent) -{ - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - VOS_STATUS vosStatus; - if( NULL == pBtEvent ) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "Null pointer for SME BT Event", __func__); - return VOS_STATUS_E_FAILURE; - } - if(( BTC_WLAN_ONLY == pMac->btc.btcConfig.btcExecutionMode ) || - ( BTC_PTA_ONLY == pMac->btc.btcConfig.btcExecutionMode )) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "BTC execution mode not set to BTC_SMART_COEXISTENCE. BT event will be dropped", __func__); - return VOS_STATUS_E_FAILURE; - } - if( pBtEvent->btEventType < 0 || pBtEvent->btEventType >= BT_EVENT_TYPE_MAX ) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "Invalid BT event %d being passed. BT event will be dropped", - __func__, pBtEvent->btEventType); - return VOS_STATUS_E_FAILURE; - } - //Check PMC state to make sure whether we need to defer - //If we already have deferred events, defer the new one as well, in case PMC is in transition state - if( pMac->btc.fReplayBTEvents || !PMC_IS_CHIP_ACCESSIBLE(pmcGetPmcState( pMac )) ) - { - //We need to defer the event - vosStatus = btcDeferEvent(pMac, pBtEvent); - if( VOS_IS_STATUS_SUCCESS(vosStatus) ) - { - pMac->btc.fReplayBTEvents = VOS_TRUE; - return VOS_STATUS_SUCCESS; - } - else - { - return vosStatus; - } - } - btcSendBTEvent(pMac, pBtEvent); - return VOS_STATUS_SUCCESS; -} -#endif -/* --------------------------------------------------------------------------- - \fn btcCheckHeartBeatMonitoring - \brief API to check whether heartbeat monitoring is required to be disabled - for specific BT start events which takes significant time to complete - during which WLAN misses beacons. To avoid WLAN-MAC from disconnecting - for the not enough beacons received we stop the heartbeat timer during - this start BT event till the stop of that BT event. - \param hHal - The handle returned by macOpen. - \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent. - Caller owns the memory and is responsible for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE Config not passed to HAL. - VOS_STATUS_SUCCESS Config passed to HAL - ---------------------------------------------------------------------------*/ -VOS_STATUS btcCheckHeartBeatMonitoring(tHalHandle hHal, tpSmeBtEvent pBtEvent) -{ - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - VOS_STATUS vosStatus; - switch(pBtEvent->btEventType) - { - // Start events which requires heartbeat monitoring be disabled. - case BT_EVENT_INQUIRY_STARTED: - pMac->btc.btcEventState |= BT_INQUIRY_STARTED; - break; - case BT_EVENT_PAGE_STARTED: - pMac->btc.btcEventState |= BT_PAGE_STARTED; - break; - case BT_EVENT_CREATE_ACL_CONNECTION: - pMac->btc.btcEventState |= BT_CREATE_ACL_CONNECTION_STARTED; - break; - case BT_EVENT_CREATE_SYNC_CONNECTION: - pMac->btc.btcEventState |= BT_CREATE_SYNC_CONNECTION_STARTED; - break; - // Stop/done events which indicates heartbeat monitoring can be enabled - case BT_EVENT_INQUIRY_STOPPED: - pMac->btc.btcEventState &= ~(BT_INQUIRY_STARTED); - break; - case BT_EVENT_PAGE_STOPPED: - pMac->btc.btcEventState &= ~(BT_PAGE_STARTED); - break; - case BT_EVENT_ACL_CONNECTION_COMPLETE: - pMac->btc.btcEventState &= ~(BT_CREATE_ACL_CONNECTION_STARTED); - break; - case BT_EVENT_SYNC_CONNECTION_COMPLETE: - pMac->btc.btcEventState &= ~(BT_CREATE_SYNC_CONNECTION_STARTED); - break; - default: - // Ignore other events - return VOS_STATUS_SUCCESS; - } - // Check if any of the BT start events are active - if (pMac->btc.btcEventState) { - if (pMac->btc.btcHBActive) { - // set heartbeat threshold CFG to zero - ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); - pMac->btc.btcHBActive = VOS_FALSE; - } - // Deactivate and active the restore HB timer - vos_timer_stop( &pMac->btc.restoreHBTimer); - vosStatus= vos_timer_start( &pMac->btc.restoreHBTimer, BT_MAX_EVENT_DONE_TIMEOUT ); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcCheckHeartBeatMonitoring: Fail to start timer"); - return VOS_STATUS_E_FAILURE; - } - } else { - // Restore CFG back to the original value only if it was disabled - if (!pMac->btc.btcHBActive) { - ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->btc.btcHBCount, NULL, eANI_BOOLEAN_FALSE); - pMac->btc.btcHBActive = VOS_TRUE; - } - // Deactivate the timer - vosStatus = vos_timer_stop( &pMac->btc.restoreHBTimer); - if (!VOS_IS_STATUS_SUCCESS(vosStatus)) { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcCheckHeartBeatMonitoring: Fail to stop timer"); - return VOS_STATUS_E_FAILURE; - } - } - return VOS_STATUS_SUCCESS; -} -/* --------------------------------------------------------------------------- - \fn btcRestoreHeartBeatMonitoringHandle - \brief Timer handler to handle the timeout condition when a specific BT - stop event does not come back, in which case to restore back the - heartbeat timer. - \param hHal - The handle returned by macOpen. - \return VOID - ---------------------------------------------------------------------------*/ -void btcRestoreHeartBeatMonitoringHandle(tHalHandle hHal) -{ - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - if( !pMac->btc.btcHBActive ) - { - tPmcState pmcState; - //Check PMC state to make sure whether we need to defer - pmcState = pmcGetPmcState( pMac ); - if( PMC_IS_CHIP_ACCESSIBLE(pmcState) ) - { - // Restore CFG back to the original value - ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->btc.btcHBCount, NULL, eANI_BOOLEAN_FALSE); - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "BT event timeout, restoring back HeartBeat timer"); - } - else - { - //defer it - pMac->btc.btcEventReplay.fRestoreHBMonitor = VOS_TRUE; - } - } -} - - -/* --------------------------------------------------------------------------- - \fn btcSetConfig - \brief API to change the current Bluetooth Coexistence (BTC) configuration - This function should be invoked only after CFG download has completed. - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type - tSmeBtcConfig. Caller owns the memory and is responsible - for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE Config not passed to HAL. - VOS_STATUS_SUCCESS Config passed to HAL - ---------------------------------------------------------------------------*/ -VOS_STATUS btcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) -{ - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - //Save a copy in the global BTC config - vos_mem_copy(&(pMac->btc.btcConfig), pSmeBtcConfig, sizeof(tSmeBtcConfig)); - //Send the config down only if SME_HddReady has been invoked. If not ready, - //BTC config will plumbed down when btcReady is eventually invoked. - if(pMac->btc.btcReady) - { - if(VOS_STATUS_SUCCESS != btcSendCfgMsg(hHal, pSmeBtcConfig)) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, - "Failure to send BTC config down"); - return VOS_STATUS_E_FAILURE; - } - } - return VOS_STATUS_SUCCESS; -} -/* --------------------------------------------------------------------------- - \fn btcPostBtcCfgMsg - \brief Private API to post BTC config message to HAL - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type - tSmeBtcConfig. Caller owns the memory and is responsible - for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE Config not passed to HAL. - VOS_STATUS_SUCCESS Config passed to HAL - ---------------------------------------------------------------------------*/ -VOS_STATUS btcSendCfgMsg(tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) -{ - tpSmeBtcConfig ptrSmeBtcConfig = NULL; - vos_msg_t msg; - if( NULL == pSmeBtcConfig ) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: " - "Null pointer for BTC Config"); - return VOS_STATUS_E_FAILURE; - } - if( pSmeBtcConfig->btcExecutionMode >= BT_EXEC_MODE_MAX ) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: " - "Invalid BT execution mode %d being set", - pSmeBtcConfig->btcExecutionMode); - return VOS_STATUS_E_FAILURE; - } - ptrSmeBtcConfig = vos_mem_malloc(sizeof(tSmeBtcConfig)); - if (NULL == ptrSmeBtcConfig) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: " - "Not able to allocate memory for SME BTC Config"); - return VOS_STATUS_E_FAILURE; - } - vos_mem_copy(ptrSmeBtcConfig, pSmeBtcConfig, sizeof(tSmeBtcConfig)); - msg.type = WDA_BTC_SET_CFG; - msg.reserved = 0; - msg.bodyptr = ptrSmeBtcConfig; - MTRACE(vos_trace(VOS_MODULE_ID_SME, TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, - msg.type)); - if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcSendCfgMsg: " - "Not able to post WDA_BTC_SET_CFG message to WDA"); - vos_mem_free( ptrSmeBtcConfig ); - return VOS_STATUS_E_FAILURE; - } - return VOS_STATUS_SUCCESS; -} -/* --------------------------------------------------------------------------- - \fn btcGetConfig - \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type - tSmeBtcConfig. Caller owns the memory and is responsible - for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE - failure - VOS_STATUS_SUCCESS success - ---------------------------------------------------------------------------*/ -VOS_STATUS btcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) -{ - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - if( NULL == pSmeBtcConfig ) - { - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "btcGetConfig: " - "Null pointer for BTC Config"); - return VOS_STATUS_E_FAILURE; - } - vos_mem_copy(pSmeBtcConfig, &(pMac->btc.btcConfig), sizeof(tSmeBtcConfig)); - return VOS_STATUS_SUCCESS; -} -/* - btcFindAclEventHist find a suited ACL event buffer - Param: bdAddr - NULL meaning not care. - pointer to caller allocated buffer containing the BD - address to find a match - handle - BT_INVALID_CONN_HANDLE == not care - otherwise, a handle to match - NOPTE: Either bdAddr or handle can be valid, if both of them are valid, use bdAddr only. If neither - bdAddr nor handle is valid, return the next free slot. -*/ -static tpSmeBtAclEventHist btcFindAclEventHist( tpAniSirGlobal pMac, v_U8_t *bdAddr, v_U16_t handle ) -{ - int i, j; - tpSmeBtAclEventHist pRet = NULL; - tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay; - for( i = 0; (i < BT_MAX_ACL_SUPPORT) && (NULL == pRet); i++ ) - { - if( NULL != bdAddr ) - { - //try to match addr - if( pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx ) - { - for(j = 0; j < pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx; j++) - { - if( vos_mem_compare(pReplay->btcEventHist.btAclConnectionEvent[i].btAclConnection[j].bdAddr, - bdAddr, 6) ) - { - //found it - pRet = &pReplay->btcEventHist.btAclConnectionEvent[i]; - break; - } - } - } - } - else if( BT_INVALID_CONN_HANDLE != handle ) - { - //try to match handle - if( pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx ) - { - for(j = 0; j < pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx; j++) - { - if( pReplay->btcEventHist.btAclConnectionEvent[i].btAclConnection[j].connectionHandle == - handle ) - { - //found it - pRet = &pReplay->btcEventHist.btAclConnectionEvent[i]; - break; - } - } - } - } - else if( 0 == pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx ) - { - pRet = &pReplay->btcEventHist.btAclConnectionEvent[i]; - break; - } - } - return (pRet); -} - -/* - btcFindSyncEventHist find a suited SYNC event buffer - Param: bdAddr - NULL meaning not care. - pointer to caller allocated buffer containing the - BD address to find a match - handle - BT_INVALID_CONN_HANDLE == not care - otherwise, a handle to match - NOPTE: Either bdAddr or handle can be valid, if both of them are valid, use bdAddr only. If neither - bdAddr nor handle is valid, return the next free slot. -*/ -static tpSmeBtSyncEventHist btcFindSyncEventHist( tpAniSirGlobal pMac, v_U8_t *bdAddr, v_U16_t handle ) -{ - int i, j; - tpSmeBtSyncEventHist pRet = NULL; - tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay; - for( i = 0; (i < BT_MAX_SCO_SUPPORT) && (NULL == pRet); i++ ) - { - if( NULL != bdAddr ) - { - //try to match addr - if( pReplay->btcEventHist.btSyncConnectionEvent[i].bNextEventIdx ) - { - for(j = 0; j < pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx; j++) - { - if( vos_mem_compare(pReplay->btcEventHist.btSyncConnectionEvent[i].btSyncConnection[j].bdAddr, - bdAddr, 6) ) - { - //found it - pRet = &pReplay->btcEventHist.btSyncConnectionEvent[i]; - break; - } - } - } - } - else if( BT_INVALID_CONN_HANDLE != handle ) - { - //try to match handle - if( pReplay->btcEventHist.btSyncConnectionEvent[i].bNextEventIdx ) - { - for(j = 0; j < pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx; j++) - { - if( pReplay->btcEventHist.btSyncConnectionEvent[i].btSyncConnection[j].connectionHandle == - handle ) - { - //found it - pRet = &pReplay->btcEventHist.btSyncConnectionEvent[i]; - break; - } - } - } - } - else if( !pReplay->btcEventHist.btSyncConnectionEvent[i].bNextEventIdx ) - { - pRet = &pReplay->btcEventHist.btSyncConnectionEvent[i]; - break; - } - } - return (pRet); -} - -/* - btcFindDisconnEventHist find a slot for the deferred disconnect event - If handle is invalid, it returns a free slot, if any. - If handle is valid, it tries to find a match first in case same disconnect event comes down again. -*/ -static tpSmeBtDisconnectEventHist btcFindDisconnEventHist( tpAniSirGlobal pMac, v_U16_t handle ) -{ - tpSmeBtDisconnectEventHist pRet = NULL; - tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay; - int i; - if( BT_INVALID_CONN_HANDLE != handle ) - { - for(i = 0; i < BT_MAX_DISCONN_SUPPORT; i++) - { - if( pReplay->btcEventHist.btDisconnectEvent[i].fValid && - (handle == pReplay->btcEventHist.btDisconnectEvent[i].btDisconnect.connectionHandle) ) - { - pRet = &pReplay->btcEventHist.btDisconnectEvent[i]; - break; - } - } - } - if( NULL == pRet ) - { - //Find a free slot - for(i = 0; i < BT_MAX_DISCONN_SUPPORT; i++) - { - if( !pReplay->btcEventHist.btDisconnectEvent[i].fValid ) - { - pRet = &pReplay->btcEventHist.btDisconnectEvent[i]; - break; - } - } - } - return (pRet); -} - -/* - btcFindModeChangeEventHist find a slot for the deferred mode change event - If handle is invalid, it returns a free slot, if any. - If handle is valid, it tries to find a match first in case same disconnect event comes down again. -*/ -tpSmeBtAclModeChangeEventHist btcFindModeChangeEventHist( tpAniSirGlobal pMac, v_U16_t handle ) -{ - tpSmeBtAclModeChangeEventHist pRet = NULL; - tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay; - int i; - if( BT_INVALID_CONN_HANDLE != handle ) - { - for(i = 0; i < BT_MAX_ACL_SUPPORT; i++) - { - if( pReplay->btcEventHist.btAclModeChangeEvent[i].fValid && - (handle == pReplay->btcEventHist.btAclModeChangeEvent[i].btAclModeChange.connectionHandle) ) - { - pRet = &pReplay->btcEventHist.btAclModeChangeEvent[i]; - break; - } - } - } - if( NULL == pRet ) - { - //Find a free slot - for(i = 0; i < BT_MAX_ACL_SUPPORT; i++) - { - if( !pReplay->btcEventHist.btAclModeChangeEvent[i].fValid ) - { - pRet = &pReplay->btcEventHist.btAclModeChangeEvent[i]; - break; - } - } - } - return (pRet); -} - -/* - btcFindSyncUpdateEventHist find a slot for the deferred SYNC_UPDATE event - If handle is invalid, it returns a free slot, if any. - If handle is valid, it tries to find a match first in case same disconnect event comes down again. -*/ -tpSmeBtSyncUpdateHist btcFindSyncUpdateEventHist( tpAniSirGlobal pMac, v_U16_t handle ) -{ - tpSmeBtSyncUpdateHist pRet = NULL; - tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay; - int i; - if( BT_INVALID_CONN_HANDLE != handle ) - { - for(i = 0; i < BT_MAX_SCO_SUPPORT; i++) - { - if( pReplay->btcEventHist.btSyncUpdateEvent[i].fValid && - (handle == pReplay->btcEventHist.btSyncUpdateEvent[i].btSyncConnection.connectionHandle) ) - { - pRet = &pReplay->btcEventHist.btSyncUpdateEvent[i]; - break; - } - } - } - if( NULL == pRet ) - { - //Find a free slot - for(i = 0; i < BT_MAX_SCO_SUPPORT; i++) - { - if( !pReplay->btcEventHist.btSyncUpdateEvent[i].fValid ) - { - pRet = &pReplay->btcEventHist.btSyncUpdateEvent[i]; - break; - } - } - } - return (pRet); -} - -/* - Call must validate pAclEventHist -*/ -static void btcReleaseAclEventHist( tpAniSirGlobal pMac, tpSmeBtAclEventHist pAclEventHist ) -{ - vos_mem_zero( pAclEventHist, sizeof(tSmeBtAclEventHist) ); -} - -/* - Call must validate pSyncEventHist -*/ -static void btcReleaseSyncEventHist( tpAniSirGlobal pMac, tpSmeBtSyncEventHist pSyncEventHist ) -{ - vos_mem_zero( pSyncEventHist, sizeof(tSmeBtSyncEventHist) ); -} - -/*To defer a ACL creation event - We only support one ACL per BD address. - If the last cached event another ACL create event, replace that event with the new event - If a completion event with success status code, and the new ACL creation - on same address, defer a new disconnect event(fake one), then cache this ACL creation event. - Otherwise, save this create event. -*/ -static VOS_STATUS btcDeferAclCreate( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ) -{ - VOS_STATUS status = VOS_STATUS_SUCCESS; - tpSmeBtAclEventHist pAclEventHist; - tSmeBtAclConnectionParam *pAclEvent = NULL; - do - { - //Find a match - pAclEventHist = btcFindAclEventHist( pMac, pEvent->uEventParam.btAclConnection.bdAddr, - BT_INVALID_CONN_HANDLE ); - if( NULL == pAclEventHist ) - { - //No cached ACL event on this address - //Find a free slot and save it - pAclEventHist = btcFindAclEventHist( pMac, NULL, BT_INVALID_CONN_HANDLE ); - if( NULL != pAclEventHist ) - { - vos_mem_copy(&pAclEventHist->btAclConnection[0], &pEvent->uEventParam.btAclConnection, - sizeof(tSmeBtAclConnectionParam)); - pAclEventHist->btEventType[0] = BT_EVENT_CREATE_ACL_CONNECTION; - pAclEventHist->bNextEventIdx = 1; - } - else - { - smsLog(pMac, LOGE, FL(" failed to find ACL event slot")); - status = VOS_STATUS_E_RESOURCES; - } - //done - break; - } - else - { - //There is history on this BD address - if ((pAclEventHist->bNextEventIdx <= 0) || - (pAclEventHist->bNextEventIdx > BT_MAX_NUM_EVENT_ACL_DEFERRED)) - { - VOS_ASSERT(0); - status = VOS_STATUS_E_FAILURE; - break; - } - pAclEvent = &pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx - 1]; - if(BT_EVENT_CREATE_ACL_CONNECTION == pAclEventHist->btEventType[pAclEventHist->bNextEventIdx - 1]) - { - //The last cached event is creation, replace it with the new one - if (pAclEvent) - { - vos_mem_copy(pAclEvent, - &pEvent->uEventParam.btAclConnection, - sizeof(tSmeBtAclConnectionParam)); - } - //done - break; - } - else if(BT_EVENT_ACL_CONNECTION_COMPLETE == - pAclEventHist->btEventType[pAclEventHist->bNextEventIdx - 1]) - { - //The last cached event is completion, check the status. - if(BT_CONN_STATUS_SUCCESS == pAclEvent->status) - { - tSmeBtEvent btEvent; - //The last event we have is success completion event. - //Should not get a creation event before creation. - smsLog(pMac, LOGE, FL(" Missing disconnect event on handle %d"), pAclEvent->connectionHandle); - //Fake a disconnect event - btEvent.btEventType = BT_EVENT_DISCONNECTION_COMPLETE; - btEvent.uEventParam.btDisconnect.connectionHandle = pAclEvent->connectionHandle; - btcDeferDisconnEvent(pMac, &btEvent); - } - } - //Need to save the new event - if(pAclEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_ACL_DEFERRED) - { - pAclEventHist->btEventType[pAclEventHist->bNextEventIdx] = BT_EVENT_CREATE_ACL_CONNECTION; - vos_mem_copy(&pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx], - &pEvent->uEventParam.btAclConnection, - sizeof(tSmeBtAclConnectionParam)); - pAclEventHist->bNextEventIdx++; - } - else - { - smsLog(pMac, LOGE, FL(" ACL event overflow")); - VOS_ASSERT(0); - } - } - }while(0); - return status; -} - -/*Defer a ACL completion event - If there is cached event on this BD address, check completion status. - If status is fail and last cached event is creation, remove the creation event and drop - this completion event. Otherwise, cache this completion event as the latest one. -*/ -static VOS_STATUS btcDeferAclComplete( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ) -{ - VOS_STATUS status = VOS_STATUS_SUCCESS; - tpSmeBtAclEventHist pAclEventHist; - do - { - //Find a match - pAclEventHist = btcFindAclEventHist( pMac, pEvent->uEventParam.btAclConnection.bdAddr, - BT_INVALID_CONN_HANDLE ); - if(pAclEventHist) - { - if (pAclEventHist->bNextEventIdx <= 0) - { - VOS_ASSERT(pAclEventHist->bNextEventIdx >0); - return VOS_STATUS_E_EMPTY; - } - //Found one - if(BT_CONN_STATUS_SUCCESS != pEvent->uEventParam.btAclConnection.status) - { - //If completion fails, and the last one is creation, remove the creation event - if(BT_EVENT_CREATE_ACL_CONNECTION == pAclEventHist->btEventType[pAclEventHist->bNextEventIdx-1]) - { - vos_mem_zero(&pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx-1], - sizeof(tSmeBtAclConnectionParam)); - pAclEventHist->bNextEventIdx--; - //Done with this event - break; - } - else - { - smsLog(pMac, LOGE, FL(" ACL completion fail but last event(%d) not creation"), - pAclEventHist->btEventType[pAclEventHist->bNextEventIdx-1]); - } - } - } - if( NULL == pAclEventHist ) - { - pAclEventHist = btcFindAclEventHist( pMac, NULL, BT_INVALID_CONN_HANDLE ); - } - if(pAclEventHist) - { - if(pAclEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_ACL_DEFERRED) - { - //Save this event - pAclEventHist->btEventType[pAclEventHist->bNextEventIdx] = BT_EVENT_ACL_CONNECTION_COMPLETE; - vos_mem_copy(&pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx], - &pEvent->uEventParam.btAclConnection, - sizeof(tSmeBtAclConnectionParam)); - pAclEventHist->bNextEventIdx++; - } - else - { - smsLog(pMac, LOGE, FL(" ACL event overflow")); - VOS_ASSERT(0); - } - } - else - { - smsLog(pMac, LOGE, FL(" cannot find match for failed " - "BT_EVENT_ACL_CONNECTION_COMPLETE of bdAddr " - MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(pEvent->uEventParam.btAclConnection.bdAddr)); - status = VOS_STATUS_E_EMPTY; - } - }while(0); - return (status); -} - -/*To defer a SYNC creation event - If the last cached event is another SYNC create event, replace - that event with the new event. - If there is a completion event with success status code, cache a new - disconnect event(fake) first, then cache this SYNC creation event. - Otherwise, cache this create event. -*/ -static VOS_STATUS btcDeferSyncCreate( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ) -{ - VOS_STATUS status = VOS_STATUS_SUCCESS; - tpSmeBtSyncEventHist pSyncEventHist; - tSmeBtSyncConnectionParam *pSyncEvent = NULL; - do - { - //Find a match - pSyncEventHist = btcFindSyncEventHist( pMac, pEvent->uEventParam.btSyncConnection.bdAddr, - BT_INVALID_CONN_HANDLE ); - if( NULL == pSyncEventHist ) - { - //No cached ACL event on this address - //Find a free slot and save it - pSyncEventHist = btcFindSyncEventHist( pMac, NULL, BT_INVALID_CONN_HANDLE ); - if( NULL != pSyncEventHist ) - { - vos_mem_copy(&pSyncEventHist->btSyncConnection[0], &pEvent->uEventParam.btSyncConnection, - sizeof(tSmeBtSyncConnectionParam)); - pSyncEventHist->btEventType[0] = BT_EVENT_CREATE_SYNC_CONNECTION; - pSyncEventHist->bNextEventIdx = 1; - } - else - { - smsLog(pMac, LOGE, FL(" failed to find SYNC event slot")); - status = VOS_STATUS_E_RESOURCES; - } - //done - break; - } - else - { - //There is history on this BD address - if ((pSyncEventHist->bNextEventIdx <= 0) || - (pSyncEventHist->bNextEventIdx > BT_MAX_NUM_EVENT_SCO_DEFERRED)) - { - VOS_ASSERT(0); - status = VOS_STATUS_E_FAILURE; - return status; - } - pSyncEvent = &pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx - 1]; - if(BT_EVENT_CREATE_SYNC_CONNECTION == - pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx - 1]) - { - //The last cached event is creation, replace it with the new one - if(pSyncEvent) - { - vos_mem_copy(pSyncEvent, - &pEvent->uEventParam.btSyncConnection, - sizeof(tSmeBtSyncConnectionParam)); - } - //done - break; - } - else if(BT_EVENT_SYNC_CONNECTION_COMPLETE == - pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx - 1]) - { - //The last cached event is completion, check the status. - if(BT_CONN_STATUS_SUCCESS == pSyncEvent->status) - { - tSmeBtEvent btEvent; - //The last event we have is success completion event. - //Should not get a creation event before creation. - smsLog(pMac, LOGE, FL(" Missing disconnect event on handle %d"), pSyncEvent->connectionHandle); - //Fake a disconnect event - btEvent.btEventType = BT_EVENT_DISCONNECTION_COMPLETE; - btEvent.uEventParam.btDisconnect.connectionHandle = pSyncEvent->connectionHandle; - btcDeferDisconnEvent(pMac, &btEvent); - } - } - //Need to save the new event - if(pSyncEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_SCO_DEFERRED) - { - pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx] = BT_EVENT_CREATE_SYNC_CONNECTION; - vos_mem_copy(&pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx], - &pEvent->uEventParam.btSyncConnection, - sizeof(tSmeBtSyncConnectionParam)); - pSyncEventHist->bNextEventIdx++; - } - else - { - smsLog(pMac, LOGE, FL(" SYNC event overflow")); - } - } - }while(0); - return status; -} - -/* - * Defer a SYNC completion event - * If there is cached event on this BD address, check completion status. - * If status is fail and last cached event is creation, remove the - * creation event and drop this completion event. - * Otherwise, cache this completion event as the latest one. - */ -static VOS_STATUS btcDeferSyncComplete( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ) -{ - VOS_STATUS status = VOS_STATUS_SUCCESS; - tpSmeBtSyncEventHist pSyncEventHist; - do - { - //Find a match - pSyncEventHist = btcFindSyncEventHist( pMac, pEvent->uEventParam.btSyncConnection.bdAddr, - BT_INVALID_CONN_HANDLE ); - if(pSyncEventHist) - { - if (pSyncEventHist->bNextEventIdx <= 0) - { - VOS_ASSERT(pSyncEventHist->bNextEventIdx >0); - return VOS_STATUS_E_EMPTY; - } - //Found one - if(BT_CONN_STATUS_SUCCESS != pEvent->uEventParam.btSyncConnection.status) - { - //If completion fails, and the last one is creation, remove the creation event - if(BT_EVENT_CREATE_SYNC_CONNECTION == pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx-1]) - { - vos_mem_zero(&pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx-1], - sizeof(tSmeBtSyncConnectionParam)); - pSyncEventHist->bNextEventIdx--; - //Done with this event - break; - } - else - { - smsLog(pMac, LOGE, FL(" SYNC completion fail but last event(%d) not creation"), - pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx-1]); - } - } - } - if(NULL == pSyncEventHist) - { - //In case we don't defer the creation event - pSyncEventHist = btcFindSyncEventHist( pMac, NULL, BT_INVALID_CONN_HANDLE ); - } - if(pSyncEventHist) - { - if(pSyncEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_ACL_DEFERRED) - { - //Save this event - pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx] = BT_EVENT_SYNC_CONNECTION_COMPLETE; - vos_mem_copy(&pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx], - &pEvent->uEventParam.btSyncConnection, - sizeof(tSmeBtSyncConnectionParam)); - pSyncEventHist->bNextEventIdx++; - } - else - { - smsLog(pMac, LOGE, FL(" SYNC event overflow")); - } - } - else - { - smsLog(pMac, LOGE, FL(" cannot find match for " - "BT_EVENT_SYNC_CONNECTION_COMPLETE of bdAddr " - MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(pEvent->uEventParam.btSyncConnection.bdAddr)); - status = VOS_STATUS_E_EMPTY; - } - }while(0); - return (status); -} - -//return VOS_STATUS_E_EXISTS if the event handle cannot be found -//VOS_STATUS_SUCCESS if the event is processed -//Other error status meaning it cannot continue due to other errors -/* - Defer a disconnect event for ACL - Check if any history on this event handle. - If both ACL_CREATION and ACL_COMPLETION is cached, remove both those events and drop - this disconnect event. - Otherwise save disconnect event in this ACL's bin. - If not ACL match on this handle, not to do anything. - Either way, remove any cached MODE_CHANGE event matches this disconnect event's handle. -*/ -static VOS_STATUS btcDeferDisconnectEventForACL( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ) -{ - VOS_STATUS status = VOS_STATUS_SUCCESS; - tpSmeBtAclEventHist pAclEventHist; - tpSmeBtAclModeChangeEventHist pModeChangeEventHist; - v_BOOL_t fDone = VOS_FALSE; - int i; - pAclEventHist = btcFindAclEventHist( pMac, NULL, - pEvent->uEventParam.btDisconnect.connectionHandle ); - if(pAclEventHist) - { - if( pAclEventHist->bNextEventIdx > BT_MAX_NUM_EVENT_ACL_DEFERRED) - { - smsLog(pMac, LOGE, FL(" ACL event history index:%d overflow, resetting to BT_MAX_NUM_EVENT_ACL_DEFERRED"), pAclEventHist->bNextEventIdx); - pAclEventHist->bNextEventIdx = BT_MAX_NUM_EVENT_ACL_DEFERRED; - } - /* Looking back-words */ - for(i = pAclEventHist->bNextEventIdx - 1; i >= 0; i--) - { - if( BT_EVENT_ACL_CONNECTION_COMPLETE == pAclEventHist->btEventType[i] ) - { - //make sure we can cancel the link - if( (i > 0) && (BT_EVENT_CREATE_ACL_CONNECTION == pAclEventHist->btEventType[i - 1]) ) - { - fDone = VOS_TRUE; - if(i == 1) - { - //All events can be wiped off - btcReleaseAclEventHist(pMac, pAclEventHist); - break; - } - //we have both ACL creation and completion, wipe out all of them - pAclEventHist->bNextEventIdx = (tANI_U8)(i - 1); - vos_mem_zero(&pAclEventHist->btAclConnection[i-1], sizeof(tSmeBtAclConnectionParam)); - vos_mem_zero(&pAclEventHist->btAclConnection[i], sizeof(tSmeBtAclConnectionParam)); - break; - } - } - }//for loop - if(!fDone) - { - //Save this disconnect event - if(pAclEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_ACL_DEFERRED) - { - pAclEventHist->btEventType[pAclEventHist->bNextEventIdx] = - BT_EVENT_DISCONNECTION_COMPLETE; - pAclEventHist->btAclConnection[pAclEventHist->bNextEventIdx].connectionHandle = - pEvent->uEventParam.btDisconnect.connectionHandle; - pAclEventHist->bNextEventIdx++; - } - else - { - smsLog(pMac, LOGE, FL(" ACL event overflow")); - status = VOS_STATUS_E_FAILURE; - } - } - } - else - { - status = VOS_STATUS_E_EXISTS; - } - //Wipe out the related mode change event if it is there - pModeChangeEventHist = btcFindModeChangeEventHist( pMac, - pEvent->uEventParam.btDisconnect.connectionHandle ); - if( pModeChangeEventHist && pModeChangeEventHist->fValid ) - { - pModeChangeEventHist->fValid = VOS_FALSE; - } - return status; -} - -/* - * This function works the same as btcDeferDisconnectEventForACL except it - * handles SYNC events return VOS_STATUS_E_EXISTS if the event handle cannot be - * found VOS_STATUS_SUCCESS if the event is processed. - * Other error status meaning it cannot continue due to other errors - */ -/* - Defer a disconnect event for SYNC - Check if any SYNC history on this event handle. - If yes and if both SYNC_CREATION and SYNC_COMPLETION is cached, remove both those events and drop - this disconnect event. - Otherwise save disconnect event in this SYNC's bin. - If no match found, not to save this event here. - Either way, remove any cached SYNC_UPDATE event matches this disconnect event's handle. -*/ -static VOS_STATUS btcDeferDisconnectEventForSync( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ) -{ - VOS_STATUS status = VOS_STATUS_SUCCESS; - tpSmeBtSyncEventHist pSyncEventHist; - tpSmeBtSyncUpdateHist pSyncUpdateHist; - v_BOOL_t fDone = VOS_FALSE; - int i; - pSyncEventHist = btcFindSyncEventHist( pMac, NULL, - pEvent->uEventParam.btDisconnect.connectionHandle ); - if(pSyncEventHist) - { - if( pSyncEventHist->bNextEventIdx > BT_MAX_NUM_EVENT_SCO_DEFERRED) - { - smsLog(pMac, LOGE, FL(" SYNC event history index:%d overflow, resetting to BT_MAX_NUM_EVENT_SCO_DEFERRED"), pSyncEventHist->bNextEventIdx); - pSyncEventHist->bNextEventIdx = BT_MAX_NUM_EVENT_SCO_DEFERRED; - } - /* Looking back-words */ - for(i = pSyncEventHist->bNextEventIdx - 1; i >= 0; i--) - { - //if a mode change event exists, drop it - if( BT_EVENT_SYNC_CONNECTION_COMPLETE == pSyncEventHist->btEventType[i] ) - { - //make sure we can cancel the link - if( (i > 0) && (BT_EVENT_CREATE_SYNC_CONNECTION == pSyncEventHist->btEventType[i - 1]) ) - { - fDone = VOS_TRUE; - if(i == 1) - { - //All events can be wiped off - btcReleaseSyncEventHist(pMac, pSyncEventHist); - break; - } - //we have both ACL creation and completion, wipe out all of them - pSyncEventHist->bNextEventIdx = (tANI_U8)(i - 1); - vos_mem_zero(&pSyncEventHist->btSyncConnection[i-1], sizeof(tSmeBtSyncConnectionParam)); - vos_mem_zero(&pSyncEventHist->btSyncConnection[i], sizeof(tSmeBtSyncConnectionParam)); - break; - } - } - }//for loop - if(!fDone) - { - //Save this disconnect event - if(pSyncEventHist->bNextEventIdx < BT_MAX_NUM_EVENT_SCO_DEFERRED) - { - pSyncEventHist->btEventType[pSyncEventHist->bNextEventIdx] = - BT_EVENT_DISCONNECTION_COMPLETE; - pSyncEventHist->btSyncConnection[pSyncEventHist->bNextEventIdx].connectionHandle = - pEvent->uEventParam.btDisconnect.connectionHandle; - pSyncEventHist->bNextEventIdx++; - } - else - { - smsLog(pMac, LOGE, FL(" SYNC event overflow")); - status = VOS_STATUS_E_FAILURE; - } - } - } - else - { - status = VOS_STATUS_E_EXISTS; - } - //Wipe out the related mode change event if it is there - pSyncUpdateHist = btcFindSyncUpdateEventHist( pMac, - pEvent->uEventParam.btDisconnect.connectionHandle ); - if( pSyncUpdateHist && pSyncUpdateHist->fValid ) - { - pSyncUpdateHist->fValid = VOS_FALSE; - } - return status; -} - -/* - Defer a disconnect event. - Try to defer it as part of the ACL event first. - If no match is found, try SYNC. - If still no match found, defer it at DISCONNECT event bin. -*/ -static VOS_STATUS btcDeferDisconnEvent( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ) -{ - VOS_STATUS status = VOS_STATUS_SUCCESS; - tpSmeBtDisconnectEventHist pDisconnEventHist; - if( BT_INVALID_CONN_HANDLE == pEvent->uEventParam.btDisconnect.connectionHandle ) - { - smsLog( pMac, LOGE, FL(" invalid handle") ); - return (VOS_STATUS_E_INVAL); - } - //Check ACL first - status = btcDeferDisconnectEventForACL(pMac, pEvent); - if(!VOS_IS_STATUS_SUCCESS(status)) - { - status = btcDeferDisconnectEventForSync(pMac, pEvent); - } - if( !VOS_IS_STATUS_SUCCESS(status) ) - { - //Save the disconnect event - pDisconnEventHist = btcFindDisconnEventHist( pMac, - pEvent->uEventParam.btDisconnect.connectionHandle ); - if( pDisconnEventHist ) - { - pDisconnEventHist->fValid = VOS_TRUE; - vos_mem_copy( &pDisconnEventHist->btDisconnect, &pEvent->uEventParam.btDisconnect, - sizeof(tSmeBtDisconnectParam) ); - status = VOS_STATUS_SUCCESS; - } - else - { - smsLog( pMac, LOGE, FL(" cannot find match for BT_EVENT_DISCONNECTION_COMPLETE of handle (%d)"), - pEvent->uEventParam.btDisconnect.connectionHandle); - status = VOS_STATUS_E_EMPTY; - } - } - return (status); -} - -/* - btcDeferEvent save the event for possible replay when chip can be accessed - This function is called only when in IMPS/Standby state -*/ -static VOS_STATUS btcDeferEvent( tpAniSirGlobal pMac, tpSmeBtEvent pEvent ) -{ - VOS_STATUS status = VOS_STATUS_SUCCESS; - tpSmeBtSyncUpdateHist pSyncUpdateHist; - tpSmeBtAclModeChangeEventHist pModeChangeEventHist; - tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay; - switch(pEvent->btEventType) - { - case BT_EVENT_DEVICE_SWITCHED_ON: - //Clear all events first - vos_mem_zero( &pReplay->btcEventHist, sizeof(tSmeBtcEventHist) ); - pReplay->fBTSwitchOn = VOS_TRUE; - pReplay->fBTSwitchOff = VOS_FALSE; - break; - case BT_EVENT_DEVICE_SWITCHED_OFF: - //Clear all events first - vos_mem_zero( &pReplay->btcEventHist, sizeof(tSmeBtcEventHist) ); - pReplay->fBTSwitchOff = VOS_TRUE; - pReplay->fBTSwitchOn = VOS_FALSE; - break; - case BT_EVENT_INQUIRY_STARTED: - pReplay->btcEventHist.nInquiryEvent++; - break; - case BT_EVENT_INQUIRY_STOPPED: - pReplay->btcEventHist.nInquiryEvent--; - break; - case BT_EVENT_PAGE_STARTED: - pReplay->btcEventHist.nPageEvent++; - break; - case BT_EVENT_PAGE_STOPPED: - pReplay->btcEventHist.nPageEvent--; - break; - case BT_EVENT_CREATE_ACL_CONNECTION: - status = btcDeferAclCreate(pMac, pEvent); - break; - case BT_EVENT_ACL_CONNECTION_COMPLETE: - status = btcDeferAclComplete( pMac, pEvent ); - break; - case BT_EVENT_CREATE_SYNC_CONNECTION: - status = btcDeferSyncCreate(pMac, pEvent); - break; - case BT_EVENT_SYNC_CONNECTION_COMPLETE: - status = btcDeferSyncComplete( pMac, pEvent ); - break; - case BT_EVENT_SYNC_CONNECTION_UPDATED: - if( BT_INVALID_CONN_HANDLE == pEvent->uEventParam.btDisconnect.connectionHandle ) - { - smsLog( pMac, LOGE, FL(" invalid handle") ); - status = VOS_STATUS_E_INVAL; - break; - } - //Find a match on handle. If not found, get a free slot. - pSyncUpdateHist = btcFindSyncUpdateEventHist( pMac, - pEvent->uEventParam.btSyncConnection.connectionHandle ); - if(pSyncUpdateHist) - { - pSyncUpdateHist->fValid = VOS_TRUE; - vos_mem_copy(&pSyncUpdateHist->btSyncConnection, &pEvent->uEventParam.btSyncConnection, - sizeof(tSmeBtSyncConnectionParam)); - } - else - { - smsLog( pMac, LOGE, FL(" cannot find match for BT_EVENT_SYNC_CONNECTION_UPDATED of handle (%d)"), - pEvent->uEventParam.btSyncConnection.connectionHandle ); - status = VOS_STATUS_E_EMPTY; - } - break; - case BT_EVENT_DISCONNECTION_COMPLETE: - status = btcDeferDisconnEvent( pMac, pEvent ); - break; - case BT_EVENT_MODE_CHANGED: - if( BT_INVALID_CONN_HANDLE == pEvent->uEventParam.btDisconnect.connectionHandle ) - { - smsLog( pMac, LOGE, FL(" invalid handle") ); - status = VOS_STATUS_E_INVAL; - break; - } - //Find a match on handle, If not found, return a free slot - pModeChangeEventHist = btcFindModeChangeEventHist( pMac, - pEvent->uEventParam.btAclModeChange.connectionHandle ); - if(pModeChangeEventHist) - { - pModeChangeEventHist->fValid = VOS_TRUE; - vos_mem_copy( &pModeChangeEventHist->btAclModeChange, - &pEvent->uEventParam.btAclModeChange, sizeof(tSmeBtAclModeChangeParam) ); - } - else - { - smsLog( pMac, LOGE, FL(" cannot find match for BT_EVENT_MODE_CHANGED of handle (%d)"), - pEvent->uEventParam.btAclModeChange.connectionHandle); - status = VOS_STATUS_E_EMPTY; - } - break; - case BT_EVENT_A2DP_STREAM_START: - pReplay->btcEventHist.fA2DPStarted = VOS_TRUE; - pReplay->btcEventHist.fA2DPStopped = VOS_FALSE; - break; - case BT_EVENT_A2DP_STREAM_STOP: - pReplay->btcEventHist.fA2DPStopped = VOS_TRUE; - pReplay->btcEventHist.fA2DPStarted = VOS_FALSE; - break; - default: - smsLog( pMac, LOGE, FL(" event (%d) is not deferred"), pEvent->btEventType ); - status = VOS_STATUS_E_NOSUPPORT; - break; - } - return (status); -} - -/* - Replay all cached events in the following order - 1. If BT_SWITCH_OFF event, send it. - 2. Send INQUIRY event (START or STOP),if available - 3. Send PAGE event (START or STOP), if available - 4. Send DISCONNECT events, these DISCONNECT events are not tied to - any ACL/SYNC event that we have cached - 5. Send ACL events (possible events, CREATION, COMPLETION, DISCONNECT) - 6. Send MODE_CHANGE events, if available - 7. Send A2DP event(START or STOP), if available - 8. Send SYNC events (possible events, CREATION, COMPLETION, DISCONNECT) - 9. Send SYNC_UPDATE events, if available -*/ -static void btcReplayEvents( tpAniSirGlobal pMac ) -{ - int i, j; - tSmeBtEvent btEvent; - tpSmeBtAclEventHist pAclHist; - tpSmeBtSyncEventHist pSyncHist; - tSmeBtcEventReplay *pReplay = &pMac->btc.btcEventReplay; - //Always turn on HB monitor first. - //It is independent of BT events even though BT event causes this - if( pReplay->fRestoreHBMonitor ) - { - pReplay->fRestoreHBMonitor = VOS_FALSE; - //Only do it when needed - if( !pMac->btc.btcHBActive ) - { - ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->btc.btcHBCount, NULL, eANI_BOOLEAN_FALSE); - pMac->btc.btcHBActive = VOS_TRUE; - } - } - if( pMac->btc.fReplayBTEvents ) - { - /*Set the flag to false here so btcSignalBTEvent won't defer any further. - This works because SME has it global lock*/ - pMac->btc.fReplayBTEvents = VOS_FALSE; - if( pReplay->fBTSwitchOff ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_DEVICE_SWITCHED_OFF; - btcSendBTEvent( pMac, &btEvent ); - pReplay->fBTSwitchOff = VOS_FALSE; - } - else if( pReplay->fBTSwitchOn ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_DEVICE_SWITCHED_ON; - btcSendBTEvent( pMac, &btEvent ); - pReplay->fBTSwitchOn = VOS_FALSE; - } - //Do inquire first - if( pReplay->btcEventHist.nInquiryEvent > 0 ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_INQUIRY_STARTED; - i = pReplay->btcEventHist.nInquiryEvent; - while(i--) - { - btcSendBTEvent( pMac, &btEvent ); - } - } - else if( pReplay->btcEventHist.nInquiryEvent < 0 ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_INQUIRY_STOPPED; - i = pReplay->btcEventHist.nInquiryEvent; - while(i++) - { - btcSendBTEvent( pMac, &btEvent ); - } - } - //Page - if( pReplay->btcEventHist.nPageEvent > 0 ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_PAGE_STARTED; - i = pReplay->btcEventHist.nPageEvent; - while(i--) - { - btcSendBTEvent( pMac, &btEvent ); - } - } - else if( pReplay->btcEventHist.nPageEvent < 0 ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_PAGE_STOPPED; - i = pReplay->btcEventHist.nPageEvent; - while(i++) - { - btcSendBTEvent( pMac, &btEvent ); - } - } - //Replay non-completion disconnect events first - //Disconnect - for( i = 0; i < BT_MAX_DISCONN_SUPPORT; i++ ) - { - if( pReplay->btcEventHist.btDisconnectEvent[i].fValid ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_DISCONNECTION_COMPLETE; - vos_mem_copy( &btEvent.uEventParam.btDisconnect, - &pReplay->btcEventHist.btDisconnectEvent[i].btDisconnect, sizeof(tSmeBtDisconnectParam) ); - btcSendBTEvent( pMac, &btEvent ); - } - } - //ACL - for( i = 0; i < BT_MAX_ACL_SUPPORT; i++ ) - { - if( pReplay->btcEventHist.btAclConnectionEvent[i].bNextEventIdx ) - { - pAclHist = &pReplay->btcEventHist.btAclConnectionEvent[i]; - //Replay all ACL events for this BD address/handle - for(j = 0; j < pAclHist->bNextEventIdx; j++) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = pAclHist->btEventType[j]; - if(BT_EVENT_DISCONNECTION_COMPLETE != btEvent.btEventType) - { - //It must be CREATE or CONNECTION_COMPLETE - vos_mem_copy( &btEvent.uEventParam.btAclConnection, - &pAclHist->btAclConnection[j], sizeof(tSmeBtAclConnectionParam) ); - } - else - { - btEvent.uEventParam.btDisconnect.connectionHandle = pAclHist->btAclConnection[j].connectionHandle; - } - btcSendBTEvent( pMac, &btEvent ); - } - } - } - //Mode change - for( i = 0; i < BT_MAX_ACL_SUPPORT; i++ ) - { - if( pReplay->btcEventHist.btAclModeChangeEvent[i].fValid ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_MODE_CHANGED; - vos_mem_copy( &btEvent.uEventParam.btAclModeChange, - &pReplay->btcEventHist.btAclModeChangeEvent[i].btAclModeChange, sizeof(tSmeBtAclModeChangeParam) ); - btcSendBTEvent( pMac, &btEvent ); - } - } - //A2DP - if( pReplay->btcEventHist.fA2DPStarted ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_A2DP_STREAM_START; - btcSendBTEvent( pMac, &btEvent ); - } - else if( pReplay->btcEventHist.fA2DPStopped ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_A2DP_STREAM_STOP; - btcSendBTEvent( pMac, &btEvent ); - } - //SCO - for( i = 0; i < BT_MAX_SCO_SUPPORT; i++ ) - { - if( pReplay->btcEventHist.btSyncConnectionEvent[i].bNextEventIdx ) - { - pSyncHist = &pReplay->btcEventHist.btSyncConnectionEvent[i]; - //Replay all SYNC events for this BD address/handle - for(j = 0; j < pSyncHist->bNextEventIdx; j++) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = pSyncHist->btEventType[j]; - if(BT_EVENT_DISCONNECTION_COMPLETE != btEvent.btEventType) - { - //Must be CREATION or CONNECTION_COMPLETE - vos_mem_copy( &btEvent.uEventParam.btSyncConnection, - &pSyncHist->btSyncConnection[j], sizeof(tSmeBtSyncConnectionParam) ); - } - else - { - btEvent.uEventParam.btDisconnect.connectionHandle = pSyncHist->btSyncConnection[j].connectionHandle; - } - btcSendBTEvent( pMac, &btEvent ); - } - } - } - //SYNC update - for( i = 0; i < BT_MAX_SCO_SUPPORT; i++ ) - { - if( pReplay->btcEventHist.btSyncUpdateEvent[i].fValid ) - { - vos_mem_zero( &btEvent, sizeof(tSmeBtEvent) ); - btEvent.btEventType = BT_EVENT_SYNC_CONNECTION_UPDATED; - vos_mem_copy( &btEvent.uEventParam.btSyncConnection, - &pReplay->btcEventHist.btSyncUpdateEvent[i].btSyncConnection, - sizeof(tSmeBtSyncConnectionParam) ); - btcSendBTEvent( pMac, &btEvent ); - } - } - //Clear all events - vos_mem_zero( &pReplay->btcEventHist, sizeof(tSmeBtcEventHist) ); - } -} - -static void btcPowerStateCB( v_PVOID_t pContext, tPmcState pmcState ) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(pContext); - if( FULL_POWER == pmcState ) - { - btcReplayEvents( pMac ); - } -} - -static void btcPowerOffloadStateCB(v_PVOID_t pContext, tANI_U32 sessionId, - tPmcState pmcState ) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(pContext); - if(FULL_POWER == pmcState) - { - btcReplayEvents(pMac); - } -} - - -/* --------------------------------------------------------------------------- - \fn btcLogEvent - \brief API to log the the current Bluetooth event - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type - tSmeBtEvent. Caller owns the memory and is responsible - for freeing it. - \return None - ---------------------------------------------------------------------------*/ -static void btcLogEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent) -{ - v_U8_t bdAddrRev[6]; - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " - "Bluetooth Event %d received", __func__, pBtEvent->btEventType); - switch(pBtEvent->btEventType) - { - case BT_EVENT_CREATE_SYNC_CONNECTION: - case BT_EVENT_SYNC_CONNECTION_COMPLETE: - case BT_EVENT_SYNC_CONNECTION_UPDATED: - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "SCO Connection: " - "connectionHandle = %d status = %d linkType %d " - "scoInterval %d scoWindow %d retransmisisonWindow = %d ", - pBtEvent->uEventParam.btSyncConnection.connectionHandle, - pBtEvent->uEventParam.btSyncConnection.status, - pBtEvent->uEventParam.btSyncConnection.linkType, - pBtEvent->uEventParam.btSyncConnection.scoInterval, - pBtEvent->uEventParam.btSyncConnection.scoWindow, - pBtEvent->uEventParam.btSyncConnection.retransmisisonWindow); - - bdAddrRev[0] = pBtEvent->uEventParam.btSyncConnection.bdAddr[5]; - bdAddrRev[1] = pBtEvent->uEventParam.btSyncConnection.bdAddr[4]; - bdAddrRev[2] = pBtEvent->uEventParam.btSyncConnection.bdAddr[3]; - bdAddrRev[3] = pBtEvent->uEventParam.btSyncConnection.bdAddr[2]; - bdAddrRev[4] = pBtEvent->uEventParam.btSyncConnection.bdAddr[1]; - bdAddrRev[5] = pBtEvent->uEventParam.btSyncConnection.bdAddr[0]; - - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "BD ADDR = " - MAC_ADDRESS_STR, MAC_ADDR_ARRAY(bdAddrRev)); - break; - case BT_EVENT_CREATE_ACL_CONNECTION: - case BT_EVENT_ACL_CONNECTION_COMPLETE: - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "ACL Connection: " - "connectionHandle = %d status = %d ", - pBtEvent->uEventParam.btAclConnection.connectionHandle, - pBtEvent->uEventParam.btAclConnection.status); - - bdAddrRev[0] = pBtEvent->uEventParam.btAclConnection.bdAddr[5]; - bdAddrRev[1] = pBtEvent->uEventParam.btAclConnection.bdAddr[4]; - bdAddrRev[2] = pBtEvent->uEventParam.btAclConnection.bdAddr[3]; - bdAddrRev[3] = pBtEvent->uEventParam.btAclConnection.bdAddr[2]; - bdAddrRev[4] = pBtEvent->uEventParam.btAclConnection.bdAddr[1]; - bdAddrRev[5] = pBtEvent->uEventParam.btAclConnection.bdAddr[0]; - - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "BD ADDR = " - MAC_ADDRESS_STR, MAC_ADDR_ARRAY(bdAddrRev)); - break; - case BT_EVENT_MODE_CHANGED: - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "ACL Mode change : " - "connectionHandle %d mode %d ", - pBtEvent->uEventParam.btAclModeChange.connectionHandle, - pBtEvent->uEventParam.btAclModeChange.mode); - break; - case BT_EVENT_DISCONNECTION_COMPLETE: - VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "Disconnect Event : " - "connectionHandle %d ", pBtEvent->uEventParam.btAclModeChange.connectionHandle); - break; - default: - break; - } - } - -/* - Caller can check whether BTC's current event allows UAPSD. This doesn't affect - BMPS. - return: VOS_TRUE -- BTC is ready for UAPSD - VOS_FALSE -- certain BT event is active, cannot enter UAPSD -*/ -v_BOOL_t btcIsReadyForUapsd( tHalHandle hHal ) -{ - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - return( pMac->btc.btcUapsdOk ); -} - -/* - Base on the BT event, this function sets the flag on whether to allow UAPSD - At this time, we are only interested in SCO and A2DP. - A2DP tracking is through BT_EVENT_A2DP_STREAM_START and BT_EVENT_A2DP_STREAM_STOP - SCO is through BT_EVENT_SYNC_CONNECTION_COMPLETE and BT_EVENT_DISCONNECTION_COMPLETE - BT_EVENT_DEVICE_SWITCHED_OFF overwrites them all -*/ -void btcUapsdCheck( tpAniSirGlobal pMac, tpSmeBtEvent pBtEvent ) -{ - v_U8_t i; - v_BOOL_t fLastUapsdState = pMac->btc.btcUapsdOk, fMoreSCO = VOS_FALSE; - switch( pBtEvent->btEventType ) - { - case BT_EVENT_DISCONNECTION_COMPLETE: - if( (VOS_FALSE == pMac->btc.btcUapsdOk) && - BT_INVALID_CONN_HANDLE != pBtEvent->uEventParam.btDisconnect.connectionHandle ) - { - //Check whether all SCO connections are gone - for(i=0; i < BT_MAX_SCO_SUPPORT; i++) - { - if( (BT_INVALID_CONN_HANDLE != pMac->btc.btcScoHandles[i]) && - (pMac->btc.btcScoHandles[i] != pBtEvent->uEventParam.btDisconnect.connectionHandle) ) - { - //We still have outstanding SCO connection - fMoreSCO = VOS_TRUE; - } - else if( pMac->btc.btcScoHandles[i] == pBtEvent->uEventParam.btDisconnect.connectionHandle ) - { - pMac->btc.btcScoHandles[i] = BT_INVALID_CONN_HANDLE; - } - } - if( !fMoreSCO && !pMac->btc.fA2DPUp ) - { - //All SCO is disconnected - smsLog( pMac, LOGE, "BT event (DISCONNECTION) happens, UAPSD-allowed flag (%d) change to TRUE", - pMac->btc.btcUapsdOk ); - pMac->btc.btcUapsdOk = VOS_TRUE; - } - } - break; - case BT_EVENT_DEVICE_SWITCHED_OFF: - smsLog( pMac, LOGE, "BT event (DEVICE_OFF) happens, UAPSD-allowed flag (%d) change to TRUE", - pMac->btc.btcUapsdOk ); - //Clean up SCO - for(i=0; i < BT_MAX_SCO_SUPPORT; i++) - { - pMac->btc.btcScoHandles[i] = BT_INVALID_CONN_HANDLE; - } - pMac->btc.fA2DPUp = VOS_FALSE; - pMac->btc.btcUapsdOk = VOS_TRUE; - break; - case BT_EVENT_A2DP_STREAM_STOP: - smsLog( pMac, LOGE, "BT event (A2DP_STREAM_STOP) happens, UAPSD-allowed flag (%d)", - pMac->btc.btcUapsdOk ); - pMac->btc.fA2DPUp = VOS_FALSE; - //Check whether SCO is on - for(i=0; i < BT_MAX_SCO_SUPPORT; i++) - { - if(pMac->btc.btcScoHandles[i] != BT_INVALID_CONN_HANDLE) - { - break; - } - } - if( BT_MAX_SCO_SUPPORT == i ) - { - pMac->btc.fA2DPTrafStop = VOS_TRUE; - smsLog( pMac, LOGE, "BT_EVENT_A2DP_STREAM_STOP: UAPSD-allowed flag is now %d", - pMac->btc.btcUapsdOk ); - } - break; - - case BT_EVENT_MODE_CHANGED: - smsLog( pMac, LOGE, "BT event (BT_EVENT_MODE_CHANGED) happens, Mode (%d) UAPSD-allowed flag (%d)", - pBtEvent->uEventParam.btAclModeChange.mode, pMac->btc.btcUapsdOk ); - if(pBtEvent->uEventParam.btAclModeChange.mode == BT_ACL_SNIFF) - { - //Check whether SCO is on - for(i=0; i < BT_MAX_SCO_SUPPORT; i++) - { - if(pMac->btc.btcScoHandles[i] != BT_INVALID_CONN_HANDLE) - { - break; - } - } - if( BT_MAX_SCO_SUPPORT == i ) - { - if(VOS_TRUE == pMac->btc.fA2DPTrafStop) - { - pMac->btc.btcUapsdOk = VOS_TRUE; - pMac->btc.fA2DPTrafStop = VOS_FALSE; - } - smsLog( pMac, LOGE, "BT_EVENT_MODE_CHANGED with Mode:%d UAPSD-allowed flag is now %d", - pBtEvent->uEventParam.btAclModeChange.mode,pMac->btc.btcUapsdOk ); - } - } - break; - case BT_EVENT_CREATE_SYNC_CONNECTION: - { - pMac->btc.btcUapsdOk = VOS_FALSE; - smsLog( pMac, LOGE, "BT_EVENT_CREATE_SYNC_CONNECTION (%d) happens, UAPSD-allowed flag (%d) change to FALSE", - pBtEvent->btEventType, pMac->btc.btcUapsdOk ); - } - break; - case BT_EVENT_SYNC_CONNECTION_COMPLETE: - //Make sure it is a success - if( BT_CONN_STATUS_FAIL != pBtEvent->uEventParam.btSyncConnection.status ) - { - /* Save the handle for later use */ - for( i = 0; i < BT_MAX_SCO_SUPPORT; i++) - { - VOS_ASSERT(BT_INVALID_CONN_HANDLE != pBtEvent->uEventParam.btSyncConnection.connectionHandle); - if( (BT_INVALID_CONN_HANDLE == pMac->btc.btcScoHandles[i]) && - (BT_INVALID_CONN_HANDLE != pBtEvent->uEventParam.btSyncConnection.connectionHandle)) - { - pMac->btc.btcScoHandles[i] = pBtEvent->uEventParam.btSyncConnection.connectionHandle; - break; - } - } - - if( i >= BT_MAX_SCO_SUPPORT ) - { - smsLog(pMac, LOGE, FL("Too many SCO, ignore this one")); - } - } - else - { - //Check whether SCO is on - for(i=0; i < BT_MAX_SCO_SUPPORT; i++) - { - if(pMac->btc.btcScoHandles[i] != BT_INVALID_CONN_HANDLE) - { - break; - } - } - /*If No Other Sco/A2DP is ON reenable UAPSD*/ - if( (BT_MAX_SCO_SUPPORT == i) && !pMac->btc.fA2DPUp) - { - pMac->btc.btcUapsdOk = VOS_TRUE; - } - smsLog(pMac, LOGE, FL("TSYNC complete failed")); - } - break; - case BT_EVENT_A2DP_STREAM_START: - smsLog( pMac, LOGE, "BT_EVENT_A2DP_STREAM_START (%d) happens, UAPSD-allowed flag (%d) change to FALSE", - pBtEvent->btEventType, pMac->btc.btcUapsdOk ); - pMac->btc.fA2DPTrafStop = VOS_FALSE; - pMac->btc.btcUapsdOk = VOS_FALSE; - pMac->btc.fA2DPUp = VOS_TRUE; - break; - default: - //No change for these events - smsLog( pMac, LOGE, "BT event (%d) happens, UAPSD-allowed flag (%d) no change", - pBtEvent->btEventType, pMac->btc.btcUapsdOk ); - break; - } - if(fLastUapsdState != pMac->btc.btcUapsdOk) - { - sme_QosTriggerUapsdChange( pMac ); - } -} - -/* --------------------------------------------------------------------------- - \fn btcHandleCoexInd - \brief API to handle Coex indication from WDI - \param pMac - The handle returned by macOpen. - \return eHalStatus - eHAL_STATUS_FAILURE success - eHAL_STATUS_SUCCESS failure - ---------------------------------------------------------------------------*/ -eHalStatus btcHandleCoexInd(tHalHandle hHal, void* pMsg) -{ - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - eHalStatus status = eHAL_STATUS_SUCCESS; - tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg; - - if (NULL == pMsg) - { - smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); - status = eHAL_STATUS_FAILURE; - } - else - { - // DEBUG - smsLog(pMac, LOG1, "Coex indication in %s(), type %d", - __func__, pSmeCoexInd->coexIndType); - - // suspend heartbeat monitoring - if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_HB_MONITOR) - { - // set heartbeat threshold CFG to zero - ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); - pMac->btc.btcHBActive = VOS_FALSE; - } - - // resume heartbeat monitoring - else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_HB_MONITOR) - { - if (!pMac->btc.btcHBActive) - { - ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->btc.btcHBCount, NULL, eANI_BOOLEAN_FALSE); - pMac->btc.btcHBActive = VOS_TRUE; - } - } - else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_SCAN_COMPROMISED) - { - pMac->btc.btcScanCompromise = VOS_TRUE; - smsLog(pMac, LOGW, "Coex indication in %s(), type - SIR_COEX_IND_TYPE_SCAN_COMPROMISED", - __func__); - } - else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_SCAN_NOT_COMPROMISED) - { - pMac->btc.btcScanCompromise = VOS_FALSE; - smsLog(pMac, LOGW, "Coex indication in %s(), type - SIR_COEX_IND_TYPE_SCAN_NOT_COMPROMISED", - __func__); - } - else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4) - { - if (pMac->roam.configParam.disableAggWithBtc) - { - ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC, 1, - NULL, eANI_BOOLEAN_FALSE); - pMac->btc.btcBssfordisableaggr[0] = pSmeCoexInd->coexIndData[0] & 0xFF; - pMac->btc.btcBssfordisableaggr[1] = pSmeCoexInd->coexIndData[0] >> 8; - pMac->btc.btcBssfordisableaggr[2] = pSmeCoexInd->coexIndData[1] & 0xFF; - pMac->btc.btcBssfordisableaggr[3] = pSmeCoexInd->coexIndData[1] >> 8; - pMac->btc.btcBssfordisableaggr[4] = pSmeCoexInd->coexIndData[2] & 0xFF; - pMac->btc.btcBssfordisableaggr[5] = pSmeCoexInd->coexIndData[2] >> 8; - smsLog(pMac, LOGW, "Coex indication in %s(), " - "type - SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4 " - "for BSSID "MAC_ADDRESS_STR,__func__, - MAC_ADDR_ARRAY(pMac->btc.btcBssfordisableaggr)); - } - } - else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4) - { - if (pMac->roam.configParam.disableAggWithBtc) - { - ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_BA_SESSIONS_2_4_G_BTC, 0, - NULL, eANI_BOOLEAN_FALSE); - smsLog(pMac, LOGW, - "Coex indication in %s(), type - SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4", - __func__); - } - } - // unknown indication type - else - { - smsLog(pMac, LOGE, "unknown Coex indication type in %s()", __func__); - } - } - - return(status); -} - -#ifdef FEATURE_WLAN_DIAG_SUPPORT -/* --------------------------------------------------------------------------- - \fn btcDiagEventLog - \brief API to log the the current Bluetooth event - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type - tSmeBtEvent. Caller owns the memory and is responsible - for freeing it. - \return None - ---------------------------------------------------------------------------*/ -static void btcDiagEventLog (tHalHandle hHal, tpSmeBtEvent pBtEvent) -{ - //vos_event_wlan_btc_type *log_ptr = NULL; - WLAN_VOS_DIAG_EVENT_DEF(btDiagEvent, vos_event_wlan_btc_type); - { - btDiagEvent.eventId = pBtEvent->btEventType; - switch(pBtEvent->btEventType) - { - case BT_EVENT_CREATE_SYNC_CONNECTION: - case BT_EVENT_SYNC_CONNECTION_COMPLETE: - case BT_EVENT_SYNC_CONNECTION_UPDATED: - btDiagEvent.connHandle = pBtEvent->uEventParam.btSyncConnection.connectionHandle; - btDiagEvent.connStatus = pBtEvent->uEventParam.btSyncConnection.status; - btDiagEvent.linkType = pBtEvent->uEventParam.btSyncConnection.linkType; - btDiagEvent.scoInterval = pBtEvent->uEventParam.btSyncConnection.scoInterval; - btDiagEvent.scoWindow = pBtEvent->uEventParam.btSyncConnection.scoWindow; - btDiagEvent.retransWindow = pBtEvent->uEventParam.btSyncConnection.retransmisisonWindow; - vos_mem_copy(btDiagEvent.btAddr, pBtEvent->uEventParam.btSyncConnection.bdAddr, - sizeof(btDiagEvent.btAddr)); - break; - case BT_EVENT_CREATE_ACL_CONNECTION: - case BT_EVENT_ACL_CONNECTION_COMPLETE: - btDiagEvent.connHandle = pBtEvent->uEventParam.btAclConnection.connectionHandle; - btDiagEvent.connStatus = pBtEvent->uEventParam.btAclConnection.status; - vos_mem_copy(btDiagEvent.btAddr, pBtEvent->uEventParam.btAclConnection.bdAddr, - sizeof(btDiagEvent.btAddr)); - break; - case BT_EVENT_MODE_CHANGED: - btDiagEvent.connHandle = pBtEvent->uEventParam.btAclModeChange.connectionHandle; - btDiagEvent.mode = pBtEvent->uEventParam.btAclModeChange.mode; - break; - case BT_EVENT_DISCONNECTION_COMPLETE: - btDiagEvent.connHandle = pBtEvent->uEventParam.btAclModeChange.connectionHandle; - break; - default: - break; - } - } - WLAN_VOS_DIAG_EVENT_REPORT(&btDiagEvent, EVENT_WLAN_BTC); -} -#endif /* FEATURE_WLAN_DIAG_SUPPORT */ -#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index 9c325f3cf5f7..c82bbf1dee6b 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -1257,8 +1257,6 @@ static void initConfigParam(tpAniSirGlobal pMac) pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; - pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC; - pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC; pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE; #ifdef WLAN_AP_STA_CONCURRENCY pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; @@ -1863,14 +1861,6 @@ eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pPa cfgSetInt(pMac, WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME, pParam->nPassiveMinChnTime); } - if (pParam->nActiveMaxChnTimeBtc) - { - pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc; - } - if (pParam->nActiveMinChnTimeBtc) - { - pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc; - } #ifdef WLAN_AP_STA_CONCURRENCY if (pParam->nActiveMaxChnTimeConc) { @@ -2162,8 +2152,6 @@ eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; - pParam->nActiveMaxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pParam->nActiveMinChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc; #ifdef WLAN_AP_STA_CONCURRENCY pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; @@ -13680,20 +13668,8 @@ static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, smsLog(pMac, LOGE, FL("can not find any valid channel")); *pBuf++ = 0; //tSirSupChnl->numChnl } - //Check whether it is ok to enter UAPSD -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - if( btcIsReadyForUapsd(pMac) ) -#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ - { - *pBuf++ = uapsdMask; - } -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - else - { - smsLog(pMac, LOGE, FL(" BTC doesn't allow UAPSD for uapsd_mask(0x%X)"), uapsdMask); - *pBuf++ = 0; - } -#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ + + *pBuf++ = uapsdMask; // move the entire BssDescription into the join request. vos_mem_copy(pBuf, pBssDescription, diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c index 5513a346f4d9..e9cde54e3dc1 100644 --- a/CORE/SME/src/csr/csrApiScan.c +++ b/CORE/SME/src/csr/csrApiScan.c @@ -274,8 +274,6 @@ static void csrSetDefaultScanTiming( tpAniSirGlobal pMac, tSirScanType scanType, pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTimeConc; pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTimeConc; } - pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; pScanRequest->restTime = pMac->roam.configParam.nRestTimeConc; pScanRequest->min_rest_time = pMac->roam.configParam.min_rest_time_conc; @@ -303,8 +301,6 @@ static void csrSetDefaultScanTiming( tpAniSirGlobal pMac, tSirScanType scanType, pScanRequest->maxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTime; } - pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; #ifdef WLAN_AP_STA_CONCURRENCY /* No rest time/Idle time if no sessions are connected. */ @@ -718,7 +714,6 @@ eHalStatus csrScanRequest(tpAniSirGlobal pMac, tANI_U16 sessionId, */ status = csrRoamGetConnectState(pMac,sessionId,&ConnectState); if (HAL_STATUS_SUCCESS(status) && - pMac->btc.fA2DPUp && (eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED != ConnectState) && (eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED != ConnectState)) { @@ -730,8 +725,6 @@ eHalStatus csrScanRequest(tpAniSirGlobal pMac, tANI_U16 sessionId, pScanRequest->minChnTime); } - pScanRequest->maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pScanRequest->minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; //Need to make the following atomic pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around @@ -796,9 +789,6 @@ eHalStatus csrScanRequest(tpAniSirGlobal pMac, tANI_U16 sessionId, p11dScanCmd->u.scanCmd.reason = eCsrScanIdleScan; scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - - scanReq.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - scanReq.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; } if (pMac->roam.configParam.nInitialDwellTime) { @@ -1049,8 +1039,6 @@ eHalStatus csrScanAllChannels(tpAniSirGlobal pMac, eCsrRequestType reqType) scanReq.requestType = reqType; scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - scanReq.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - scanReq.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; //Scan with invalid sessionId. //This results in SME using the first available session to scan. status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq, @@ -1338,8 +1326,6 @@ eHalStatus csrScanRequestLostLink1( tpAniSirGlobal pMac, tANI_U32 sessionId ) pCommand->u.scanCmd.pContext = NULL; pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN; if(pSession->connectedProfile.SSID.length) { @@ -1515,8 +1501,6 @@ eHalStatus csrScanRequestLostLink2( tpAniSirGlobal pMac, tANI_U32 sessionId ) pCommand->u.scanCmd.pContext = NULL; pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN; if(pSession->pCurRoamProfile) { @@ -1629,8 +1613,6 @@ eHalStatus csrScanRequestLostLink3( tpAniSirGlobal pMac, tANI_U32 sessionId ) pCommand->u.scanCmd.pContext = NULL; pCommand->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime; pCommand->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime; - pCommand->u.scanCmd.u.scanRequest.maxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; - pCommand->u.scanCmd.u.scanRequest.minChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; pCommand->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN; vos_mem_copy(&pCommand->u.scanCmd.u.scanRequest.bssid, bAddr, sizeof(tCsrBssid)); //Put to the head of pending queue @@ -5897,8 +5879,7 @@ eHalStatus csrSendMBScanReq( tpAniSirGlobal pMac, tANI_U16 sessionId, pMsg->minChannelTime = pal_cpu_to_be32(minChnTime); pMsg->maxChannelTime = pal_cpu_to_be32(maxChnTime); - pMsg->minChannelTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; - pMsg->maxChannelTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; + //hidden SSID option pMsg->hiddenSsid = pScanReqParam->hiddenSsid; /* maximum rest time */ @@ -7656,10 +7637,6 @@ eHalStatus csrScanForSSID(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfi pScanCmd->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime; } - pScanCmd->u.scanCmd.u.scanRequest.maxChnTimeBtc = - pMac->roam.configParam.nActiveMaxChnTimeBtc; - pScanCmd->u.scanCmd.u.scanRequest.minChnTimeBtc = - pMac->roam.configParam.nActiveMinChnTimeBtc; if(pProfile->BSSIDs.numOfBSSIDs == 1) { vos_mem_copy(pScanCmd->u.scanCmd.u.scanRequest.bssid, diff --git a/CORE/SME/src/csr/csrLogDump.c b/CORE/SME/src/csr/csrLogDump.c index 0a64afd38235..3bdfc0dca31a 100644 --- a/CORE/SME/src/csr/csrLogDump.c +++ b/CORE/SME/src/csr/csrLogDump.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 The Linux Foundation. All rights reserved. + * Copyright (c) 2013, 2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -31,7 +31,6 @@ Implements the dump commands specific to the csr module. ============================================================================*/ #include "aniGlobal.h" #include "csrApi.h" -#include "btcApi.h" #include "logDump.h" #include "smsDebug.h" #include "smeInside.h" @@ -55,50 +54,7 @@ dump_csr( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI } return p; } -static char *dump_btcSetEvent( tpAniSirGlobal pMac, tANI_U32 arg1, - tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p ) -{ - tSmeBtEvent btEvent; - if( arg1 < BT_EVENT_TYPE_MAX ) - { - smsLog(pMac, LOGE, FL(" signal BT event (%d) handle (%d) 3rd param(%d)"), arg1, arg2, arg3); - vos_mem_zero(&btEvent, sizeof(tSmeBtEvent)); - btEvent.btEventType = arg1; - switch( arg1 ) - { - case BT_EVENT_SYNC_CONNECTION_COMPLETE: - case BT_EVENT_SYNC_CONNECTION_UPDATED: - btEvent.uEventParam.btSyncConnection.connectionHandle = (v_U16_t)arg2; - btEvent.uEventParam.btSyncConnection.status = (v_U8_t)arg3; - break; - case BT_EVENT_DISCONNECTION_COMPLETE: - btEvent.uEventParam.btDisconnect.connectionHandle = (v_U16_t)arg2; - break; - case BT_EVENT_CREATE_ACL_CONNECTION: - case BT_EVENT_ACL_CONNECTION_COMPLETE: - btEvent.uEventParam.btAclConnection.connectionHandle = (v_U16_t)arg2; - btEvent.uEventParam.btAclConnection.status = (v_U8_t)arg3; - break; - case BT_EVENT_MODE_CHANGED: - btEvent.uEventParam.btAclModeChange.connectionHandle = (v_U16_t)arg2; - break; - default: - break; - } -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - if(HAL_STATUS_SUCCESS(sme_AcquireGlobalLock( &pMac->sme ))) - { - btcSignalBTEvent(pMac, &btEvent); - sme_ReleaseGlobalLock( &pMac->sme ); - } -#endif - } - else - { - smsLog(pMac, LOGE, FL(" invalid event (%d)"), arg1); - } - return p; -} + static char* dump_csrApConcScanParams( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p ) { @@ -123,7 +79,6 @@ static char* dump_csrApConcScanParams( tpAniSirGlobal pMac, tANI_U32 arg1, static tDumpFuncEntry csrMenuDumpTable[] = { {0, "CSR (850-860)", NULL}, {851, "CSR: CSR testing connection to AniNet", dump_csr}, - {852, "BTC: Fake BT events (event, handle)", dump_btcSetEvent}, {853, "CSR: Split Scan related params", dump_csrApConcScanParams}, }; diff --git a/CORE/SME/src/pmc/pmc.c b/CORE/SME/src/pmc/pmc.c index 4b99b5dd91d7..ac04c8e30ee3 100644 --- a/CORE/SME/src/pmc/pmc.c +++ b/CORE/SME/src/pmc/pmc.c @@ -1193,77 +1193,36 @@ eHalStatus pmcEnterRequestStartUapsdState (tHalHandle hHal) else { pMac->pmc.uapsdSessionRequired = TRUE; - //Check BTC state -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - if( btcIsReadyForUapsd( pMac ) ) -#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ - { - /* Put device in BMPS mode first. This step should NEVER fail. - That is why no need to buffer the UAPSD request*/ - if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS) - { - pmcLog(pMac, LOGE, "PMC: Device in Full Power. Enter Request Bmps failed. " - "UAPSD request will be dropped "); - return eHAL_STATUS_FAILURE; - } - } -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - else + + /* Put device in BMPS mode first. This step should NEVER fail. + That is why no need to buffer the UAPSD request*/ + if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS) { - (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod); + pmcLog(pMac, LOGE, "PMC: Device in Full Power. Enter Request Bmps failed. " + "UAPSD request will be dropped "); + return eHAL_STATUS_FAILURE; } -#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ } break; case BMPS: - //It is already in BMPS mode, check BTC state -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - if( btcIsReadyForUapsd(pMac) ) -#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ - { /* Tell MAC to have device enter UAPSD mode. */ - if (pmcIssueCommand(hHal, 0, eSmeCommandEnterUapsd, NULL, 0, FALSE) - != eHAL_STATUS_SUCCESS) - { - pmcLog(pMac, LOGE, "PMC: failure to send message " - "eWNI_PMC_ENTER_BMPS_REQ"); - return eHAL_STATUS_FAILURE; - } - } -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - else + if (pmcIssueCommand(hHal, 0, eSmeCommandEnterUapsd, NULL, 0, FALSE) + != eHAL_STATUS_SUCCESS) { - //Not ready for UAPSD at this time, save it first and wake up the chip - pmcLog(pMac, LOGE, " PMC state = %d",pMac->pmc.pmcState); - pMac->pmc.uapsdSessionRequired = TRUE; - /* While BTC traffic is going on, STA can be in BMPS - * and need not go to Full Power */ - //fFullPower = VOS_TRUE; + pmcLog(pMac, LOGE, "PMC: failure to send message " + "eWNI_PMC_ENTER_BMPS_REQ"); + return eHAL_STATUS_FAILURE; } -#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ break; case REQUEST_START_UAPSD: -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - if( !btcIsReadyForUapsd(pMac) ) - { - //BTC rejects UAPSD, bring it back to full power - fFullPower = VOS_TRUE; - } -#endif + break; case REQUEST_BMPS: /* Buffer request for UAPSD mode. */ pMac->pmc.uapsdSessionRequired = TRUE; -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - if( !btcIsReadyForUapsd(pMac) ) - { - //BTC rejects UAPSD, bring it back to full power - fFullPower = VOS_TRUE; - } -#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ break; default: diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c index b33c61eff070..d1e40ce314f3 100644 --- a/CORE/SME/src/sme_common/sme_Api.c +++ b/CORE/SME/src/sme_common/sme_Api.c @@ -1503,12 +1503,6 @@ eHalStatus sme_Open(tHalHandle hHal) break; } - status = btcOpen(pMac); - if ( ! HAL_STATUS_SUCCESS( status ) ) { - smsLog( pMac, LOGE, - "btcOpen open failed during initialization with status=%d", status ); - break; - } #endif #ifdef FEATURE_OEM_DATA_SUPPORT status = oemData_OemDataReqOpen(pMac); @@ -2176,14 +2170,6 @@ eHalStatus sme_HDDReadyInd(tHalHandle hHal) smsLog( pMac, LOGE, "pmcReady failed with status=%d", status ); break; } -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - if(VOS_STATUS_SUCCESS != btcReady(hHal)) - { - status = eHAL_STATUS_FAILURE; - smsLog( pMac, LOGE, "btcReady failed"); - break; - } -#endif #if defined WLAN_FEATURE_VOWIFI if(VOS_STATUS_SUCCESS != rrmReady(hHal)) @@ -2203,14 +2189,6 @@ eHalStatus sme_HDDReadyInd(tHalHandle hHal) smsLog( pMac, LOGE, "csrReady failed with status=%d", status ); break; } -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - if(VOS_STATUS_SUCCESS != btcReady(hHal)) - { - status = eHAL_STATUS_FAILURE; - smsLog( pMac, LOGE, "btcReady failed"); - break; - } -#endif #if defined WLAN_FEATURE_VOWIFI if(VOS_STATUS_SUCCESS != rrmReady(hHal)) @@ -2899,19 +2877,6 @@ eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg) smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RDY_IND), nothing to process"); } break; - case eWNI_SME_COEX_IND: - MTRACE(vos_trace(VOS_MODULE_ID_SME, TRACE_CODE_SME_RX_WDA_MSG, - NO_SESSION, pMsg->type)); - if(pMsg->bodyptr) - { - status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr); - vos_mem_free(pMsg->bodyptr); - } - else - { - smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process"); - } - break; #ifdef FEATURE_WLAN_SCAN_PNO case eWNI_SME_PREF_NETWORK_FOUND_IND: @@ -3599,13 +3564,6 @@ eHalStatus sme_Close(tHalHandle hHal) } #ifndef WLAN_MDM_CODE_REDUCTION_OPT - status = btcClose(hHal); - if ( ! HAL_STATUS_SUCCESS( status ) ) { - smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d", - status ); - fail_status = status; - } - status = sme_QosClose(pMac); if ( ! HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d", @@ -6897,94 +6855,6 @@ eHalStatus sme_TXFailMonitorStartStopInd(tHalHandle hHal, tANI_U8 tx_fail_count, } /* --------------------------------------------------------------------------- - \fn sme_BtcSignalBtEvent - \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the - BT event type and the current operating mode of Libra (full power, - BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy - would be employed. - \param hHal - The handle returned by macOpen. - \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent - Caller owns the memory and is responsible for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen - if BTC execution mode is set to BTC_WLAN_ONLY - or BTC_PTA_ONLY. - VOS_STATUS_SUCCESS BT Event passed to HAL - ---------------------------------------------------------------------------*/ -VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent) -{ - VOS_STATUS status = VOS_STATUS_E_FAILURE; - -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - - MTRACE(vos_trace(VOS_MODULE_ID_SME, - TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0)); - if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) - { - status = btcSignalBTEvent (hHal, pBtEvent); - sme_ReleaseGlobalLock( &pMac->sme ); - } -#endif - return (status); -} - -/* --------------------------------------------------------------------------- - \fn sme_BtcSetConfig - \brief API to change the current Bluetooth Coexistence (BTC) configuration - This function should be invoked only after CFG download has completed. - Calling it after sme_HDDReadyInd is recommended. - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig. - Caller owns the memory and is responsible for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE Config not passed to HAL. - VOS_STATUS_SUCCESS Config passed to HAL - ---------------------------------------------------------------------------*/ -VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) -{ - VOS_STATUS status = VOS_STATUS_E_FAILURE; -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - MTRACE(vos_trace(VOS_MODULE_ID_SME, - TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0)); - if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) - { - status = btcSetConfig (hHal, pSmeBtcConfig); - sme_ReleaseGlobalLock( &pMac->sme ); - } -#endif - return (status); -} - -/* --------------------------------------------------------------------------- - \fn sme_BtcGetConfig - \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration - \param hHal - The handle returned by macOpen. - \param pSmeBtcConfig - Pointer to a caller allocated object of type - tSmeBtcConfig. Caller owns the memory and is responsible - for freeing it. - \return VOS_STATUS - VOS_STATUS_E_FAILURE - failure - VOS_STATUS_SUCCESS success - ---------------------------------------------------------------------------*/ -VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) -{ - VOS_STATUS status = VOS_STATUS_E_FAILURE; -#ifndef WLAN_MDM_CODE_REDUCTION_OPT - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - - MTRACE(vos_trace(VOS_MODULE_ID_SME, - TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0)); - if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) - { - status = btcGetConfig (hHal, pSmeBtcConfig); - sme_ReleaseGlobalLock( &pMac->sme ); - } -#endif - return (status); -} -/* --------------------------------------------------------------------------- \fn sme_SetCfgPrivacy \brief API to set configure privacy parameters \param hHal - The handle returned by macOpen. diff --git a/CORE/SVC/inc/wlan_btc_svc.h b/CORE/SVC/inc/wlan_btc_svc.h deleted file mode 100644 index 7eee2dec2527..000000000000 --- a/CORE/SVC/inc/wlan_btc_svc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2012 The Linux Foundation. All rights reserved. - * - * Previously licensed under the ISC license by Qualcomm Atheros, Inc. - * - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all - * copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This file was originally distributed by Qualcomm Atheros, Inc. - * under proprietary terms before Copyright ownership was assigned - * to the Linux Foundation. - */ - -/****************************************************************************** - * wlan_btc_svc.h - * - ******************************************************************************/ - -#ifndef WLAN_BTC_SVC_H -#define WLAN_BTC_SVC_H - -void send_btc_nlink_msg (int type, int dest_pid); -int btc_activate_service(void *pAdapter); - -#endif diff --git a/CORE/SVC/src/btc/wlan_btc_svc.c b/CORE/SVC/src/btc/wlan_btc_svc.c deleted file mode 100644 index 7d4aeaf7538f..000000000000 --- a/CORE/SVC/src/btc/wlan_btc_svc.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2013 The Linux Foundation. All rights reserved. - * - * Previously licensed under the ISC license by Qualcomm Atheros, Inc. - * - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all - * copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This file was originally distributed by Qualcomm Atheros, Inc. - * under proprietary terms before Copyright ownership was assigned - * to the Linux Foundation. - */ - - -/****************************************************************************** - * wlan_btc_svc.c - * - ******************************************************************************/ -#include <wlan_nlink_srv.h> -#include <wlan_btc_svc.h> -#include <halTypes.h> -#include <vos_status.h> -#include <btcApi.h> -#include <wlan_hdd_includes.h> -#include <vos_trace.h> -// Global variables -static struct hdd_context_s *pHddCtx; - -static int gWiFiChannel; /* WiFi associated channel 1-13, or 0 (none) */ -static int gAmpChannel; /* AMP associated channel 1-13, or 0 (none) */ -static int gBtcDriverMode = WLAN_HDD_INFRA_STATION; /* Driver mode in BTC */ - - -// Forward declrarion -static int btc_msg_callback (struct sk_buff * skb); -/* - * Send a netlink message to the user space. - * Destination pid as zero implies broadcast - */ -void send_btc_nlink_msg (int type, int dest_pid) -{ - struct sk_buff *skb; - struct nlmsghdr *nlh; - tAniMsgHdr *aniHdr; - tWlanAssocData *assocData; - skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL); - if(skb == NULL) { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "BTC: alloc_skb failed\n"); - return; - } - nlh = (struct nlmsghdr *)skb->data; - nlh->nlmsg_pid = 0; /* from kernel */ - nlh->nlmsg_flags = 0; - nlh->nlmsg_seq = 0; - nlh->nlmsg_type = WLAN_NL_MSG_BTC; - aniHdr = NLMSG_DATA(nlh); - aniHdr->type = type; - - /* Set BTC driver mode correctly based on received events type */ - if(type == WLAN_BTC_SOFTAP_BSS_START) - { - /* Event is SoftAP BSS Start set BTC driver mode to SoftAP */ - gBtcDriverMode = WLAN_HDD_SOFTAP; - } - if(type == WLAN_STA_ASSOC_DONE_IND) - { - /* Event is STA Assoc done set BTC driver mode to INFRA STA*/ - gBtcDriverMode = WLAN_HDD_INFRA_STATION; - } - - switch( type ) - { - case WLAN_STA_DISASSOC_DONE_IND: - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW, - "WiFi unassociated; gAmpChannel %d gWiFiChannel %d", gAmpChannel, gWiFiChannel); - - /* If AMP is using a channel (non-zero), no message sent. - Or, if WiFi wasn't using a channel before, no message sent. - Logic presumes same channel has to be used for WiFi and AMP if both are active. - In any case, track the WiFi channel in use (none) */ - if((gAmpChannel != 0) || (gWiFiChannel == 0)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW, - "No msg for AFH will be sent"); - gWiFiChannel = 0; - kfree_skb(skb); - return; - } - gWiFiChannel = 0; - - /* No Break: Fall into next cases */ - - case WLAN_MODULE_UP_IND: - case WLAN_MODULE_DOWN_IND: - aniHdr->length = 0; - nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr))); - skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr))); - break; - case WLAN_BTC_SOFTAP_BSS_START: - case WLAN_BTC_QUERY_STATE_RSP: - case WLAN_STA_ASSOC_DONE_IND: - aniHdr->length = sizeof(tWlanAssocData); - nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + sizeof(tWlanAssocData))); - assocData = ( tWlanAssocData *)((char*)aniHdr + sizeof(tAniMsgHdr)); - - assocData->channel = hdd_get_operating_channel( pHddCtx, gBtcDriverMode ); - - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW, - "New WiFi channel %d gAmpChannel %d gWiFiChannel %d", - assocData->channel, gAmpChannel, gWiFiChannel); - - /* If WiFi has finished associating */ - if(type == WLAN_STA_ASSOC_DONE_IND) - { - /* If AMP is using a channel (non-zero), no message sent. - Or, if the WiFi channel did not change, no message sent. - Logic presumes same channel has to be used for WiFi and AMP if both are active. - In any case, track the WiFi channel in use (1-13 or none, in assocData->channel) */ - if((gAmpChannel != 0) || (assocData->channel == gWiFiChannel)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW, - "No msg for AFH will be sent"); - gWiFiChannel = assocData->channel; - kfree_skb(skb); - return; - } - } - if(type == WLAN_BTC_SOFTAP_BSS_START) - { - /*Replace WLAN_BTC_SOFTAP_BSS_START by WLAN_STA_ASSOC_DONE_IND*/ - aniHdr->type = WLAN_STA_ASSOC_DONE_IND; - } - gWiFiChannel = assocData->channel; - skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr)+ sizeof(tWlanAssocData)))); - break; - - case WLAN_AMP_ASSOC_DONE_IND: - - /* This is an overloaded type. It means that AMP is connected (dest_pid is channel 1-13), - or it means AMP is now disconnected (dest_pid is 0) */ - - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW, - "New AMP channel %d gAmpChannel %d gWiFiChannel %d", dest_pid, gAmpChannel, gWiFiChannel); - /* If WiFi is using a channel (non-zero), no message sent. - Or, if the AMP channel did not change, no message sent. - Logic presumes same channel has to be used for WiFi and AMP if both are active. - In any case, track the AMP channel in use (1-13 or none, in dest_pid) */ - if((gWiFiChannel != 0) || (dest_pid == gAmpChannel)) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_LOW, - "No msg for AFH will be sent"); - gAmpChannel = dest_pid; - kfree_skb(skb); - return; - } - - gAmpChannel = dest_pid; - - /* Fix overloaded parameters and finish message formatting */ - if(dest_pid != 0) - { - aniHdr->type = WLAN_STA_ASSOC_DONE_IND; - aniHdr->length = sizeof(tWlanAssocData); - nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + sizeof(tWlanAssocData))); - assocData = ( tWlanAssocData *)((char*)aniHdr + sizeof(tAniMsgHdr)); - assocData->channel = dest_pid; - skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr)+ sizeof(tWlanAssocData)))); - } - else - { - aniHdr->type = WLAN_STA_DISASSOC_DONE_IND; - aniHdr->length = 0; - nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr))); - skb_put(skb, NLMSG_SPACE(sizeof(tAniMsgHdr))); - } - dest_pid = 0; - break; - - default: - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "BTC: Attempt to send unknown nlink message %d\n", type); - kfree_skb(skb); - return; - } - if(dest_pid == 0) - (void)nl_srv_bcast(skb); - else - (void)nl_srv_ucast(skb, dest_pid, MSG_DONTWAIT); -} -/* - * Activate BTC handler. This will register a handler to receive - * netlink messages addressed to WLAN_NL_MSG_BTC from user space - */ -int btc_activate_service(void *pAdapter) -{ - pHddCtx = (struct hdd_context_s*)pAdapter; - - //Register the msg handler for msgs addressed to ANI_NL_MSG_BTC - nl_srv_register(WLAN_NL_MSG_BTC, btc_msg_callback); - return 0; -} -/* - * Callback function invoked by Netlink service for all netlink - * messages (from user space) addressed to WLAN_NL_MSG_BTC - */ -int btc_msg_callback (struct sk_buff * skb) -{ - struct nlmsghdr *nlh; - tAniMsgHdr *msg_hdr; - tSmeBtEvent *btEvent = NULL; - nlh = (struct nlmsghdr *)skb->data; - msg_hdr = NLMSG_DATA(nlh); - - /* Continue with parsing payload. */ - switch(msg_hdr->type) - { - case WLAN_BTC_QUERY_STATE_REQ: - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, - "BTC: Received probe from BTC Service\n"); - send_btc_nlink_msg(WLAN_BTC_QUERY_STATE_RSP, nlh->nlmsg_pid); - break; - case WLAN_BTC_BT_EVENT_IND: - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, - "BTC: Received Bluetooth event indication\n"); - if(msg_hdr->length != sizeof(tSmeBtEvent)) { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "BTC: Size mismatch in BT event data\n"); - break; - } - btEvent = (tSmeBtEvent*)((char*)msg_hdr + sizeof(tAniMsgHdr)); - (void)sme_BtcSignalBtEvent(pHddCtx->hHal, btEvent); - break; - default: - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "BTC: Received Invalid Msg type [%d]\n", msg_hdr->type); - break; - } - return 0; -} diff --git a/CORE/SYS/legacy/src/utils/src/macTrace.c b/CORE/SYS/legacy/src/utils/src/macTrace.c index c0a74f28e5bb..f03b3d703028 100644 --- a/CORE/SYS/legacy/src/utils/src/macTrace.c +++ b/CORE/SYS/legacy/src/utils/src/macTrace.c @@ -498,7 +498,6 @@ tANI_U8* macTraceGetSmeMsgString(tANI_U16 smeMsg) CASE_RETURN_STRING(eWNI_SME_ESE_ADJACENT_AP_REPORT); #endif CASE_RETURN_STRING(eWNI_SME_REGISTER_MGMT_FRAME_REQ); - CASE_RETURN_STRING(eWNI_SME_COEX_IND); #ifdef FEATURE_WLAN_SCAN_PNO CASE_RETURN_STRING(eWNI_SME_PREF_NETWORK_FOUND_IND); #endif // FEATURE_WLAN_SCAN_PNO @@ -631,7 +631,6 @@ SME_CMN_OBJS := $(SME_SRC_DIR)/sme_common/sme_Api.o \ $(SME_SRC_DIR)/sme_common/sme_FTApi.o \ $(SME_SRC_DIR)/sme_common/sme_Trace.o -SME_BTC_OBJS := $(SME_SRC_DIR)/btc/btcApi.o SME_OEM_DATA_OBJS := $(SME_SRC_DIR)/oemData/oemDataApi.o @@ -647,8 +646,7 @@ ifeq ($(CONFIG_WLAN_FEATURE_NAN_DATAPATH),y) SME_NDP_OBJS += $(SME_SRC_DIR)/nan/nan_datapath_api.o endif -SME_OBJS := $(SME_BTC_OBJS) \ - $(SME_CCM_OBJS) \ +SME_OBJS := $(SME_CCM_OBJS) \ $(SME_CMN_OBJS) \ $(SME_CSR_OBJS) \ $(SME_OEM_DATA_OBJS) \ @@ -667,9 +665,6 @@ SVC_SRC_DIR := $(SVC_DIR)/src SVC_INC := -I$(WLAN_ROOT)/$(SVC_INC_DIR) \ -I$(WLAN_ROOT)/$(SVC_DIR)/external -BTC_SRC_DIR := $(SVC_SRC_DIR)/btc -BTC_OBJS := $(BTC_SRC_DIR)/wlan_btc_svc.o - NLINK_SRC_DIR := $(SVC_SRC_DIR)/nlink NLINK_OBJS := $(NLINK_SRC_DIR)/wlan_nlink_srv.o @@ -679,8 +674,7 @@ PTT_OBJS := $(PTT_SRC_DIR)/wlan_ptt_sock_svc.o WLAN_LOGGING_SRC_DIR := $(SVC_SRC_DIR)/logging WLAN_LOGGING_OBJS := $(WLAN_LOGGING_SRC_DIR)/wlan_logging_sock_svc.o -SVC_OBJS := $(BTC_OBJS) \ - $(NLINK_OBJS) \ +SVC_OBJS := $(NLINK_OBJS) \ $(PTT_OBJS) \ $(WLAN_LOGGING_OBJS) |
