From 74a97d4adad3f93ceccc0c3e48a5ec13f6b2e7da Mon Sep 17 00:00:00 2001 From: Hanumanth Reddy Pothula Date: Mon, 20 Nov 2017 21:43:54 +0530 Subject: [PATCH] qcacld-3.0: Handle SAP turn-off gracefully during SSR There is a possibility of user to turn-off SAP while SSR is in progress, leading framework to show SAP as turn-off though SAP is still beaconning, after succsessful SSR. Changes are done to make sure driver and framework are in sync. Change-Id: Ic3cd1eebb23482e9cebf04683533face178698b4 CRs-Fixed: 2137646 --- core/hdd/src/wlan_hdd_p2p.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 5fab34bd8b5f..7123ffd66072 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -605,6 +605,23 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy, } } + if (session_type == QDF_SAP_MODE) { + adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE); + if (adapter && test_bit(NET_DEVICE_REGISTERED, + &adapter->event_flags)) { + hdd_debug("iface already registered"); + if (adapter->session.ap.beacon) { + qdf_mem_free(adapter->session.ap.beacon); + adapter->session.ap.beacon = NULL; + } + if (adapter->dev && adapter->dev->ieee80211_ptr) + return adapter->dev->ieee80211_ptr; + + hdd_err("ieee80211_ptr points to NULL"); + return ERR_PTR(-EINVAL); + } + } + adapter = NULL; if (hdd_ctx->config->isP2pDeviceAddrAdministrated && ((NL80211_IFTYPE_P2P_GO == type) || @@ -773,6 +790,12 @@ int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) return -EINVAL; } + /* + * Clear SOFTAP_INIT_DONE flag to mark SAP unload, so that we do + * not restart SAP after SSR as SAP is already stopped from user space. + */ + clear_bit(SOFTAP_INIT_DONE, &pVirtAdapter->event_flags); + MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_DEL_VIRTUAL_INTF, pVirtAdapter->session_id, pVirtAdapter->device_mode));