From 6cc76d41abd71fe17a2c485d9f1925960f28a24e Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Thu, 10 Sep 2020 19:59:09 +0530 Subject: [PATCH] qcacld-3.0: Cleanup all NDPs as part of NAN disable NDPs can exist on an NDI only when the NAN discovery is active. Currently, firmware sends NDP_END indication for all NDPs when NAN is disabled. Host driver removes the NDI entry from the policy mgr based on these NDP_END indications. But firmware might miss to send the NDP_END indication in some cases though the NDPs are deleted in firmware. This leads to stale NDI entries in the policy mgr and it prevents STA connections as NDI+STA without NAN discovery is not a valid concurrency. Host driver can remove all NDPs before sending NAN disable request to firmware to avoid this. This is a blocking call in driver and wait for the NDP_HOST_UPDATE event from firmware. Cleanup the policy mgr entries in timeout case as well to avoid further failures due to unsupported concurrency. Change-Id: I8df905b7ae4cfe5dfb5affe5b6a3fd478851a453 CRs-Fixed: 2774329 --- components/nan/dispatcher/src/nan_ucfg_api.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/nan/dispatcher/src/nan_ucfg_api.c b/components/nan/dispatcher/src/nan_ucfg_api.c index 3dda88bfe9c4..35abaf83b953 100644 --- a/components/nan/dispatcher/src/nan_ucfg_api.c +++ b/components/nan/dispatcher/src/nan_ucfg_api.c @@ -1130,12 +1130,30 @@ ucfg_nan_is_vdev_creation_supp_by_host(struct nan_psoc_priv_obj *nan_obj) return nan_obj->cfg_param.nan_separate_iface_support; } +static void ucfg_nan_cleanup_all_ndps(struct wlan_objmgr_psoc *psoc) +{ + QDF_STATUS status; + uint32_t ndi_count, vdev_id, i; + + ndi_count = policy_mgr_mode_specific_connection_count(psoc, PM_NDI_MODE, + NULL); + for (i = 0; i < ndi_count; i++) { + vdev_id = policy_mgr_mode_specific_vdev_id(psoc, PM_NDI_MODE); + status = ucfg_nan_disable_ndi(psoc, vdev_id); + if (status == QDF_STATUS_E_TIMEOUT) + policy_mgr_decr_session_set_pcl(psoc, QDF_NDI_MODE, + vdev_id); + } +} + QDF_STATUS ucfg_disable_nan_discovery(struct wlan_objmgr_psoc *psoc, uint8_t *data, uint32_t data_len) { struct nan_disable_req *nan_req; QDF_STATUS status; + ucfg_nan_cleanup_all_ndps(psoc); + nan_req = qdf_mem_malloc(sizeof(*nan_req) + data_len); if (!nan_req) return -ENOMEM;