FROMGIT: wifi: cfg80211: avoid overriding direct/MBSSID BSS with per-STA profile BSS

Avoid overriding BSS information generated from MBSSID or direct source
with BSS information generated from per-STA profile source to avoid
losing actual signal strength and information elements such as RNR and
Basic ML elements.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://patch.msgid.link/20240904030917.3602369-4-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 338006731
(cherry picked from commit 450732abad
 https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main)
Change-Id: I556803e40c89d3cfee5405796235252bf2896a6f
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
This commit is contained in:
Veerendranath Jakkam 2024-09-04 08:39:17 +05:30 committed by T.J. Mercier
parent 931c124949
commit e15d57b7fd

View File

@ -2839,6 +2839,9 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,
struct element *reporter_rnr = NULL;
struct ieee80211_multi_link_elem *ml_elem;
struct cfg80211_mle *mle;
const struct element *ssid_elem;
const u8 *ssid = NULL;
size_t ssid_len = 0;
u16 control;
u8 ml_common_len;
u8 *new_ie = NULL;
@ -2893,6 +2896,13 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,
bss_change_count,
gfp);
ssid_elem = cfg80211_find_elem(WLAN_EID_SSID, tx_data->ie,
tx_data->ielen);
if (ssid_elem) {
ssid = ssid_elem->data;
ssid_len = ssid_elem->datalen;
}
for (i = 0; i < ARRAY_SIZE(mle->sta_prof) && mle->sta_prof[i]; i++) {
const struct ieee80211_neighbor_ap_info *ap_info;
enum nl80211_band band;
@ -2974,6 +2984,23 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,
freq = ieee80211_channel_to_freq_khz(ap_info->channel, band);
data.channel = ieee80211_get_channel_khz(wiphy, freq);
/* Skip if BSS entry generated from MBSSID or DIRECT source
* frame data available already.
*/
bss = cfg80211_get_bss(wiphy, data.channel, data.bssid, ssid,
ssid_len, IEEE80211_BSS_TYPE_ANY,
IEEE80211_PRIVACY_ANY);
if (bss) {
struct cfg80211_internal_bss *ibss = bss_from_pub(bss);
if (data.capability == bss->capability &&
ibss->bss_source != BSS_SOURCE_STA_PROFILE) {
cfg80211_put_bss(wiphy, bss);
continue;
}
cfg80211_put_bss(wiphy, bss);
}
if (use_for == NL80211_BSS_USE_FOR_MLD_LINK &&
!(wiphy->flags & WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY)) {
use_for = 0;