From 413aa5ef82badb017966321c82fd6967d2cd7c33 Mon Sep 17 00:00:00 2001 From: Rahul Gusain Date: Mon, 18 Jul 2022 16:20:29 +0530 Subject: [PATCH] qcacld-3.0: Make NAN high priority than TDLS in legacy platforms Firmware handles all NAN concurrencies in the platforms which don't advertise the WMI service cabability WMI_SERVICE_NAN_DISABLE_SUPPORT. Host takes care of the NAN concurrency if the capability is advertised by firmware. But there can be some legacy targets where firmware wants to offload NAN+TDLS concurrency alone to the host and it takes care of rest of the concurrencies. This is to make NAN of higher priority and disable TDLS when NAN is active. Currently, TDLS is of more priority than NAN and it can't change the order as it can't disable TDLS to change the priority. Currently, driver doesn't parse the NAN messages(even NAN enable request) in such platforms. Parse the NAN messages and disable TDLS upon NAN enable request. Rely on NAN state machine to allow/disallow new TDLS requests. This needs NAN enable status. Change-Id: Ie9c7c1cc2f1ed6328a31b93077c2928940fc3450 CRs-Fixed: 3263730 --- components/nan/core/src/nan_main.c | 11 +++++++++-- components/nan/dispatcher/src/nan_ucfg_api.c | 15 ++++++++++++--- os_if/nan/src/os_if_nan.c | 15 ++++++++------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/components/nan/core/src/nan_main.c b/components/nan/core/src/nan_main.c index 26bfcce48b7d..738cd08a1a07 100644 --- a/components/nan/core/src/nan_main.c +++ b/components/nan/core/src/nan_main.c @@ -885,7 +885,15 @@ fail: psoc_nan_obj->nan_social_ch_2g_freq = 0; psoc_nan_obj->nan_social_ch_5g_freq = 0; nan_set_discovery_state(psoc, NAN_DISC_DISABLED); - policy_mgr_check_n_start_opportunistic_timer(psoc); + if (ucfg_is_nan_dbs_supported(psoc)) + policy_mgr_check_n_start_opportunistic_timer(psoc); + + /* + * If FW respond with NAN enable failure, then TDLS should be enable + * again if there is TDLS connection exist earlier. + * decrement the active TDLS session. + */ + ucfg_tdls_notify_connect_failure(psoc); done: nan_conc_callback = psoc_nan_obj->cb_obj.nan_concurrency_update; @@ -1113,7 +1121,6 @@ bool nan_is_enable_allowed(struct wlan_objmgr_psoc *psoc, uint32_t nan_ch_freq) } return (NAN_DISC_DISABLED == nan_get_discovery_state(psoc) && - ucfg_is_nan_conc_control_supported(psoc) && policy_mgr_allow_concurrency(psoc, PM_NAN_DISC_MODE, nan_ch_freq, HW_MODE_20_MHZ)); } diff --git a/components/nan/dispatcher/src/nan_ucfg_api.c b/components/nan/dispatcher/src/nan_ucfg_api.c index 7b23364a52a8..f32734f19919 100644 --- a/components/nan/dispatcher/src/nan_ucfg_api.c +++ b/components/nan/dispatcher/src/nan_ucfg_api.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -35,6 +35,7 @@ #include "cfg_nan.h" #include "wlan_mlme_api.h" #include "cfg_nan_api.h" +#include "wlan_tdls_ucfg_api.h" struct wlan_objmgr_psoc; struct wlan_objmgr_vdev; @@ -876,8 +877,16 @@ post_msg: if (req_type == NAN_ENABLE_REQ) { nan_set_discovery_state(psoc, NAN_DISC_DISABLED); - policy_mgr_check_n_start_opportunistic_timer( - psoc); + if (ucfg_is_nan_dbs_supported(psoc)) + policy_mgr_check_n_start_opportunistic_timer(psoc); + + /* + * If FW respond with NAN enable failure, then + * TDLS should be enable again if there is TDLS + * connection exist earlier. + * decrement the active TDLS session. + */ + ucfg_tdls_notify_connect_failure(psoc); } else if (req_type == NAN_DISABLE_REQ) { nan_disable_cleanup(psoc); } diff --git a/os_if/nan/src/os_if_nan.c b/os_if/nan/src/os_if_nan.c index a703a6730218..9a5996463cbd 100644 --- a/os_if/nan/src/os_if_nan.c +++ b/os_if/nan/src/os_if_nan.c @@ -37,6 +37,7 @@ #include "wlan_utility.h" #include "wlan_osif_request_manager.h" #include "wlan_mlme_ucfg_api.h" +#include "wlan_tdls_ucfg_api.h" #define NAN_CMD_MAX_SIZE 2048 @@ -2624,15 +2625,15 @@ int os_if_process_nan_req(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, } /* - * If target does not support NAN DBS, send request with type GENERIC. - * These will be treated as passthrough by the driver. This is to make - * sure that HW mode is not set to DBS by NAN Enable request. NAN state - * machine will remain unaffected in this case. + * If target does not support NAN DBS, stop the opportunistic timer. + * Opportunistic timer gets triggered as soon as a DBS use case is + * completed and hw_mode would be set to SMM when the timer(5 seconds) + * expires. + * This is to make sure that HW mode is not set to DBS by NAN Enable + * request. NAN state machine will remain unaffected in this case. */ - if (!NAN_CONCURRENCY_SUPPORTED(psoc)) { + if (!NAN_CONCURRENCY_SUPPORTED(psoc)) policy_mgr_check_and_stop_opportunistic_timer(psoc, vdev_id); - return os_if_nan_generic_req(psoc, tb); - } /* * Send all requests other than Enable/Disable as type GENERIC.