From a2377a8de14e12cf6669c1b03b1e5483579eaf27 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Tue, 31 Jan 2023 13:08:12 +0530 Subject: [PATCH] qcacld-3.0: Use freq hint in scan for ssid When Scan db reaches max size, driver deletes the oldest node, so chances are that BSS on 1st freq scanned is removed. This lead to scan for SSID, which will do a scan again on all freqs, and thus we end up in flushing the entry again. TO fix this use freq hint to scan for ssid to quickly find the AP so that required AP remains in scan database as it will be the latest entry. Change-Id: I28849ee97ff1f492d372870c362288206c4ec9a5 CRs-Fixed: 3391899 --- core/hdd/src/wlan_hdd_cfg80211.c | 12 ++++++++++-- core/sme/inc/csr_api.h | 2 ++ core/sme/src/csr/csr_api_scan.c | 11 ++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index e6e24943ab82..1bc03e75936e 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -19750,7 +19750,8 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter, const u8 *ssid, size_t ssid_len, const u8 *bssid, const u8 *bssid_hint, uint32_t oper_freq, - enum nl80211_chan_width ch_width) + enum nl80211_chan_width ch_width, + uint32_t ch_freq_hint) { int status = 0; QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; @@ -19943,6 +19944,8 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter, roam_profile->ChannelInfo.numOfChannels = 0; } + roam_profile->freq_hint = ch_freq_hint; + if (wlan_hdd_cfg80211_check_pmf_valid(roam_profile)) { status = -EINVAL; goto conn_failure; @@ -21759,6 +21762,7 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, #endif struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev); struct hdd_context *hdd_ctx; + uint32_t ch_freq_hint = 0; hdd_enter(); @@ -21874,11 +21878,15 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, else ch_freq = 0; + if (req->channel_hint) + ch_freq_hint = req->channel_hint->center_freq; + wlan_hdd_check_ht20_ht40_ind(hdd_ctx, adapter, req); status = wlan_hdd_cfg80211_connect_start(adapter, req->ssid, req->ssid_len, req->bssid, - bssid_hint, ch_freq, 0); + bssid_hint, ch_freq, 0, + ch_freq_hint); if (status) { wlan_hdd_cfg80211_clear_privacy(adapter); hdd_err("connect failed"); diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 133896da4386..d2b522974b6b 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2023 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 @@ -662,6 +663,7 @@ struct csr_roam_profile { tCsrKeys Keys; tCsrChannelInfo ChannelInfo; uint32_t op_freq; + uint32_t freq_hint; struct ch_params ch_params; /* If this is 0, SME will fill in for caller. */ uint16_t beaconInterval; diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 2a499ca3dcaf..e98e39512c71 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 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 @@ -1395,6 +1395,15 @@ QDF_STATUS csr_scan_for_ssid(struct mac_context *mac_ctx, uint32_t session_id, req->scan_req.chan_list.num_chan = num_chan; } + /* Add freq hint for scan for ssid */ + if (!num_chan && profile->freq_hint && + csr_roam_is_valid_channel(mac_ctx, profile->freq_hint)) { + sme_debug("add freq hint %d", profile->freq_hint); + req->scan_req.chan_list.chan[0].freq = + profile->freq_hint; + req->scan_req.chan_list.num_chan = 1; + } + /* Extend it for multiple SSID */ if (profile->SSIDs.numOfSSIDs) { if (profile->SSIDs.SSIDList[0].SSID.length > WLAN_SSID_MAX_LEN) {