From a9a53ee19c6fd5a0819bbe2ba76f45c1a9b056f1 Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Thu, 3 Dec 2020 00:30:46 +0530 Subject: [PATCH] qcacld-3.0: Handle NAN+STA reconnect concurrency Currently, STA reconnect (e.g. reconnect to same BSSID) is handled as STA+STA as part of NAN concurrency checks. This results in NAN disable when reconnect is issued. Check if the current incoming connection is on same vdev as previous sta connection instance and disable NAN only if it's different. Handle NAN+SAP reenable in similar way. Also, remove the redundant usage of NDI cleanup API ucfg_nan_check_and_disable_unsupported_ndi in if_mgr_connect_start. Change-Id: Ia063a69bb2efdf1d51c6988b8905ceac0f454dab CRs-Fixed: 2821352 --- .../interface_mgr/src/wlan_if_mgr_sta.c | 28 ++++++++++--------- .../src/wlan_policy_mgr_get_set_utils.c | 11 +++++--- core/hdd/src/wlan_hdd_cfg80211.c | 18 ++++++++---- core/hdd/src/wlan_hdd_hostapd.c | 19 +++++++++---- 4 files changed, 48 insertions(+), 28 deletions(-) diff --git a/components/cmn_services/interface_mgr/src/wlan_if_mgr_sta.c b/components/cmn_services/interface_mgr/src/wlan_if_mgr_sta.c index abdc582b1b..bbf0e49021 100644 --- a/components/cmn_services/interface_mgr/src/wlan_if_mgr_sta.c +++ b/components/cmn_services/interface_mgr/src/wlan_if_mgr_sta.c @@ -36,6 +36,8 @@ QDF_STATUS if_mgr_connect_start(struct wlan_objmgr_vdev *vdev, struct wlan_objmgr_pdev *pdev; struct wlan_objmgr_psoc *psoc; enum QDF_OPMODE op_mode; + uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS], i; + bool disable_nan = true; pdev = wlan_vdev_get_pdev(vdev); if (!pdev) @@ -50,20 +52,20 @@ QDF_STATUS if_mgr_connect_start(struct wlan_objmgr_vdev *vdev, * connection already exists and if this is a case of STA+STA * or SAP+STA concurrency */ - sta_cnt = policy_mgr_mode_specific_connection_count(psoc, - PM_STA_MODE, - NULL); - sap_cnt = policy_mgr_mode_specific_connection_count(psoc, - PM_SAP_MODE, - NULL); + sta_cnt = policy_mgr_get_mode_specific_conn_info(psoc, NULL, + vdev_id_list, + PM_STA_MODE); + sap_cnt = policy_mgr_get_mode_specific_conn_info(psoc, NULL, + &vdev_id_list[sta_cnt], + PM_SAP_MODE); op_mode = wlan_vdev_mlme_get_opmode(vdev); - if (op_mode == QDF_P2P_CLIENT_MODE || sap_cnt || sta_cnt) - ucfg_nan_disable_concurrency(psoc); - - /* STA+NDI concurrency gets preference over NDI+NDI. Disable - * first NDI in case an NDI+NDI concurrency exists. - */ - ucfg_nan_check_and_disable_unsupported_ndi(psoc, false); + if (op_mode == QDF_P2P_CLIENT_MODE || sap_cnt || sta_cnt) { + for (i = 0; i < sta_cnt + sap_cnt; i++) + if (vdev_id_list[i] == wlan_vdev_get_id(vdev)) + disable_nan = false; + if (disable_nan) + ucfg_nan_disable_concurrency(psoc); + } /* * STA+NDI concurrency gets preference over NDI+NDI. Disable diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index 83659d7d8f..eba864b4ad 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -2166,7 +2166,7 @@ uint32_t policy_mgr_get_mode_specific_conn_info( policy_mgr_err("Invalid Context"); return count; } - if (!ch_freq_list || !vdev_id) { + if (!vdev_id) { policy_mgr_err("Null pointer error"); return count; } @@ -2175,13 +2175,16 @@ uint32_t policy_mgr_get_mode_specific_conn_info( psoc, mode, list); qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); if (count == 1) { - *ch_freq_list = pm_conc_connection_list[list[index]].freq; + if (ch_freq_list) + *ch_freq_list = + pm_conc_connection_list[list[index]].freq; *vdev_id = pm_conc_connection_list[list[index]].vdev_id; } else { for (index = 0; index < count; index++) { - ch_freq_list[index] = pm_conc_connection_list[ - list[index]].freq; + if (ch_freq_list) + ch_freq_list[index] = + pm_conc_connection_list[list[index]].freq; vdev_id[index] = pm_conc_connection_list[list[index]].vdev_id; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 3405bdaca6..65daaec200 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -20779,6 +20779,8 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, */ #ifndef WLAN_FEATURE_INTERFACE_MGR uint32_t sap_cnt, sta_cnt; + uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS], i; + bool disable_nan = true; #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) @@ -20847,16 +20849,22 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, * connection already exists and if this is a case of STA+STA * or SAP+STA concurrency */ - sta_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, - PM_STA_MODE, NULL); - sap_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, - PM_SAP_MODE, NULL); + sta_cnt = policy_mgr_get_mode_specific_conn_info(hdd_ctx->psoc, NULL, + vdev_id_list, + PM_STA_MODE); + sap_cnt = policy_mgr_get_mode_specific_conn_info(hdd_ctx->psoc, NULL, + &vdev_id_list[sta_cnt], + PM_SAP_MODE); if (adapter->device_mode == QDF_P2P_CLIENT_MODE || sap_cnt || sta_cnt) { hdd_debug("Invalid NAN concurrency. SAP: %d STA: %d P2P: %d", sap_cnt, sta_cnt, (adapter->device_mode == QDF_P2P_CLIENT_MODE)); - ucfg_nan_disable_concurrency(hdd_ctx->psoc); + for (i = 0; i < sta_cnt + sap_cnt; i++) + if (vdev_id_list[i] == vdev_id) + disable_nan = false; + if (disable_nan) + ucfg_nan_disable_concurrency(hdd_ctx->psoc); } /* * STA+NDI concurrency gets preference over NDI+NDI. Disable diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index a3a7d2f6c4..e70e465063 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -6514,8 +6514,9 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, struct cfg80211_chan_def new_chandef; struct cfg80211_chan_def *chandef; uint16_t sap_ch; - bool srd_channel_allowed; + bool srd_channel_allowed, disable_nan = true; enum QDF_OPMODE vdev_opmode; + uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS], i; hdd_enter(); @@ -6652,17 +6653,23 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, sap_cfg->SapHw_mode = eCSR_DOT11_MODE_abg; } - sta_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, - PM_STA_MODE, NULL); - sap_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, - PM_SAP_MODE, NULL); + sta_cnt = policy_mgr_get_mode_specific_conn_info(hdd_ctx->psoc, NULL, + vdev_id_list, + PM_STA_MODE); + sap_cnt = policy_mgr_get_mode_specific_conn_info(hdd_ctx->psoc, NULL, + &vdev_id_list[sta_cnt], + PM_SAP_MODE); /* Disable NAN Disc before starting P2P GO or STA+SAP or SAP+SAP */ if (adapter->device_mode == QDF_P2P_GO_MODE || sta_cnt || (sap_cnt > (MAX_SAP_NUM_CONCURRENCY_WITH_NAN - 1))) { hdd_debug("Invalid NAN concurrency. SAP: %d STA: %d P2P_GO: %d", sap_cnt, sta_cnt, (adapter->device_mode == QDF_P2P_GO_MODE)); - ucfg_nan_disable_concurrency(hdd_ctx->psoc); + for (i = 0; i < sta_cnt + sap_cnt; i++) + if (vdev_id_list[i] == adapter->vdev_id) + disable_nan = false; + if (disable_nan) + ucfg_nan_disable_concurrency(hdd_ctx->psoc); } /* NDI + SAP conditional supported */