diff options
| author | Hanumanth Reddy Pothula <c_hpothu@codeaurora.org> | 2017-02-02 16:48:12 +0530 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2017-02-09 15:48:18 -0800 |
| commit | 6f48319a69171c47f3ca87701e93d6ce2d478a15 (patch) | |
| tree | 9e27ca411d266ce57a6293c34a9042aaf539ea27 | |
| parent | 4019881d981a4514d676a5ba78fabb5b1d52d76e (diff) | |
qcacld-3.0: Open SAP session during interface up
On SAP interface down, Host receives stop_ap indication,
on which it closes SAP session. But on interface up, upper
layer used to invoke add_virtual_intf on which Host opens
SAP session. But due to a race condition, upper layer is
not invoking add_virtual_intf, leading Host not to open sap
session and thereby sap fails to come-up.
To mitigate this, open sap session as part of interface up.
Also, as part of interface down in stop adapter clear SAP
session if its opened.
Change-Id: Ica1c83edade1e1e4ebeafb516939554b4c410de2
CRs-Fixed: 2001555
| -rw-r--r-- | core/hdd/src/wlan_hdd_hostapd.c | 37 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_hostapd.h | 2 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 11 | ||||
| -rw-r--r-- | core/sap/inc/sap_api.h | 1 | ||||
| -rw-r--r-- | core/sap/src/sap_fsm.c | 4 | ||||
| -rw-r--r-- | core/sap/src/sap_module.c | 3 |
6 files changed, 52 insertions, 6 deletions
diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 081c0eae2f3e..876387fd05fd 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -249,12 +249,20 @@ static int __hdd_hostapd_open(struct net_device *dev) * Check statemachine state and also stop iface change timer if running */ ret = hdd_wlan_start_modules(hdd_ctx, pAdapter, false); - if (ret) { hdd_err("Failed to start WLAN modules return"); return ret; } + if (!test_bit(SME_SESSION_OPENED, &pAdapter->event_flags)) { + ret = hdd_start_adapter(pAdapter); + if (ret) { + hdd_err("Failed to start adapter :%d", + pAdapter->device_mode); + return ret; + } + } + set_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags); /* Enable all Tx queues */ hdd_notice("Enabling queues"); @@ -293,9 +301,28 @@ static int hdd_hostapd_open(struct net_device *dev) static int __hdd_hostapd_stop(struct net_device *dev) { hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + ptSapContext sap_ctx = adapter->sessionCtx.ap.sapContext; ENTER_DEV(dev); + if (NULL == hdd_ctx) { + hdd_info("%pS HDD context is Null", (void *)_RET_IP_); + return -ENODEV; + } + + if (!test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) { + hdd_info("iface is not in open state, flags: %lu", + adapter->event_flags); + return 0; + } + if (!sap_ctx) { + hdd_err("invalid sap ctx : %p", sap_ctx); + return -ENODEV; + } + + hdd_stop_adapter(hdd_ctx, adapter, true); + clear_bit(DEVICE_IFACE_OPENED, &adapter->event_flags); /* Stop all tx queues */ hdd_notice("Disabling queues"); @@ -1319,6 +1346,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, pSapEvent->sapevt.sapStopBssCompleteEvent. status ? "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS"); + clear_bit(SME_SESSION_OPENED, &pHostapdAdapter->event_flags); hdd_hostapd_channel_allow_suspend(pHostapdAdapter, pHddApCtx->operatingChannel); @@ -5815,6 +5843,7 @@ QDF_STATUS hdd_init_ap_mode(hdd_adapter_t *pAdapter, bool reinit) return status; } pAdapter->sessionId = session_id; + set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); /* Allocate the Wireless Extensions state structure */ phostapdBuf = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); @@ -6044,7 +6073,7 @@ QDF_STATUS hdd_register_hostapd(hdd_adapter_t *pAdapter, * * Return: QDF_STATUS enumaration */ -QDF_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter, bool rtnl_held) +int hdd_unregister_hostapd(hdd_adapter_t *pAdapter, bool rtnl_held) { QDF_STATUS status; void *sapContext = WLAN_HDD_GET_SAP_CTX_PTR(pAdapter); @@ -6053,6 +6082,10 @@ QDF_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter, bool rtnl_held) hdd_softap_deinit_tx_rx(pAdapter); + if (!test_bit(DEVICE_IFACE_OPENED, &pAdapter->event_flags)) { + hdd_info("iface is not opened"); + return 0; + } /* if we are being called during driver unload, * then the dev has already been invalidated. * if we are being called at other times, then we can diff --git a/core/hdd/src/wlan_hdd_hostapd.h b/core/hdd/src/wlan_hdd_hostapd.h index bf697b19b0fc..7e65d498528e 100644 --- a/core/hdd/src/wlan_hdd_hostapd.h +++ b/core/hdd/src/wlan_hdd_hostapd.h @@ -54,7 +54,7 @@ hdd_adapter_t *hdd_wlan_create_ap_dev(hdd_context_t *pHddCtx, QDF_STATUS hdd_register_hostapd(hdd_adapter_t *pAdapter, uint8_t rtnl_held); -QDF_STATUS hdd_unregister_hostapd(hdd_adapter_t *pAdapter, bool rtnl_held); +int hdd_unregister_hostapd(hdd_adapter_t *pAdapter, bool rtnl_held); eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 6327723362aa..fea410724f68 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3557,6 +3557,7 @@ QDF_STATUS hdd_stop_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, tSirUpdateIE updateIE; unsigned long rc; hdd_scaninfo_t *scan_info = NULL; + void *sap_ctx; ENTER(); @@ -3717,6 +3718,16 @@ QDF_STATUS hdd_stop_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, mutex_unlock(&hdd_ctx->sap_lock); if (true == bCloseSession) hdd_wait_for_sme_close_sesion(hdd_ctx, adapter); + + sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter); + if (wlansap_stop(sap_ctx) != QDF_STATUS_SUCCESS) + hdd_err("Failed:wlansap_stop"); + + if (wlansap_close(sap_ctx) != QDF_STATUS_SUCCESS) + hdd_err("Failed:WLANSAP_close"); + + adapter->sessionCtx.ap.sapContext = NULL; + break; case QDF_OCB_MODE: ol_txrx_clear_peer(WLAN_HDD_GET_STATION_CTX_PTR(adapter)-> diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index de258a55a63d..c6b0ae4b0404 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -981,6 +981,7 @@ QDF_STATUS wlansap_set_tx_leakage_threshold(tHalHandle hal, uint16_t tx_leakage_threshold); QDF_STATUS wlansap_set_invalid_session(void *cds_ctx); +QDF_STATUS sap_roam_session_close_callback(void *pContext); #ifdef __cplusplus } diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 62b0594e5d8e..f10686159cce 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -2665,7 +2665,7 @@ static QDF_STATUS sap_goto_disconnecting(ptSapContext sapContext) return QDF_STATUS_SUCCESS; } -static QDF_STATUS sap_roam_session_close_callback(void *pContext) +QDF_STATUS sap_roam_session_close_callback(void *pContext) { ptSapContext sapContext = (ptSapContext) pContext; QDF_STATUS status; diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index b5c0944c5996..e640e747f2f9 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -507,7 +507,8 @@ QDF_STATUS wlansap_clean_cb(ptSapContext pSapCtx, uint32_t freeFlag /* 0 / if (eSAP_TRUE == pSapCtx->isSapSessionOpen && hal) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, "close existing SAP session"); - sap_close_session(hal, pSapCtx, NULL, false); + sap_close_session(hal, pSapCtx, sap_roam_session_close_callback, + pSapCtx); } qdf_mem_zero(pSapCtx, sizeof(tSapContext)); |
