2024-06-10 08:52:57

by Veerendranath Jakkam

[permalink] [raw]
Subject: [PATCH 0/4] wifi: cfg80211: fix per-STA profile BSS entry issues

This patch set contains bugfixes and cleanups related to per-STA
profile BSS entries.

Veerendranath Jakkam (4):
wifi: cfg80211: make BSS source types public
wifi: cfg80211: skip indicating signal for per-STA profile BSSs
wifi: cfg80211: skip overriding direct/MBSSID BSS with per-STA profile
BSS
wifi: cfg80211: make sure to process all per-STA profiles

net/wireless/core.h | 8 ++++++++
net/wireless/nl80211.c | 26 +++++++++++++++-----------
net/wireless/scan.c | 14 ++++++++------
3 files changed, 31 insertions(+), 17 deletions(-)

base-commit: a46300b1b09ba260c2c2b00f06f6e34482a8ec01
--
2.7.4



2024-06-10 08:52:59

by Veerendranath Jakkam

[permalink] [raw]
Subject: [PATCH 1/4] wifi: cfg80211: make BSS source types public

Define public enum with BSS source types in core.h. Upcoming patches
need this to store BSS source type in struct cfg80211_internal_bss.

Signed-off-by: Veerendranath Jakkam <[email protected]>
---
net/wireless/core.h | 6 ++++++
net/wireless/scan.c | 6 +-----
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/wireless/core.h b/net/wireless/core.h
index 118f2f6..a48df7cf 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -170,6 +170,12 @@ static inline int for_each_rdev_check_rtnl(void)
if (for_each_rdev_check_rtnl()) {} else \
list_for_each_entry(rdev, &cfg80211_rdev_list, list)

+enum bss_source_type {
+ BSS_SOURCE_DIRECT = 0,
+ BSS_SOURCE_MBSSID,
+ BSS_SOURCE_STA_PROFILE,
+};
+
struct cfg80211_internal_bss {
struct list_head list;
struct list_head hidden_list;
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 1278538..1fad019 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2107,11 +2107,7 @@ struct cfg80211_inform_single_bss_data {
const u8 *ie;
size_t ielen;

- enum {
- BSS_SOURCE_DIRECT = 0,
- BSS_SOURCE_MBSSID,
- BSS_SOURCE_STA_PROFILE,
- } bss_source;
+ enum bss_source_type bss_source;
/* Set if reporting bss_source != BSS_SOURCE_DIRECT */
struct cfg80211_bss *source_bss;
u8 max_bssid_indicator;
--
2.7.4


2024-06-10 08:53:02

by Veerendranath Jakkam

[permalink] [raw]
Subject: [PATCH 2/4] wifi: cfg80211: skip indicating signal for per-STA profile BSSs

Currently signal of the BSS entry generated from the per-STA profile
indicated as zero, but userspace may consider it as high signal
strength since 0 dBm is a valid RSSI value.

To avoid this don't report the signal to userspace when the BSS entry
created from a per-STA profile.

Signed-off-by: Veerendranath Jakkam <[email protected]>
---
net/wireless/core.h | 2 ++
net/wireless/nl80211.c | 26 +++++++++++++++-----------
net/wireless/scan.c | 2 ++
3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/net/wireless/core.h b/net/wireless/core.h
index a48df7cf..4281f85 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -197,6 +197,8 @@ struct cfg80211_internal_bss {
*/
u8 parent_bssid[ETH_ALEN] __aligned(2);

+ enum bss_source_type bss_source;
+
/* must be last because of priv member */
struct cfg80211_bss pub;
};
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8ff5f79..c0a8b35 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10373,17 +10373,21 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
NL80211_BSS_CHAIN_SIGNAL))
goto nla_put_failure;

- switch (rdev->wiphy.signal_type) {
- case CFG80211_SIGNAL_TYPE_MBM:
- if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal))
- goto nla_put_failure;
- break;
- case CFG80211_SIGNAL_TYPE_UNSPEC:
- if (nla_put_u8(msg, NL80211_BSS_SIGNAL_UNSPEC, res->signal))
- goto nla_put_failure;
- break;
- default:
- break;
+ if (intbss->bss_source != BSS_SOURCE_STA_PROFILE) {
+ switch (rdev->wiphy.signal_type) {
+ case CFG80211_SIGNAL_TYPE_MBM:
+ if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM,
+ res->signal))
+ goto nla_put_failure;
+ break;
+ case CFG80211_SIGNAL_TYPE_UNSPEC:
+ if (nla_put_u8(msg, NL80211_BSS_SIGNAL_UNSPEC,
+ res->signal))
+ goto nla_put_failure;
+ break;
+ default:
+ break;
+ }
}

switch (wdev->iftype) {
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 1fad019..2850718 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -1866,6 +1866,7 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev,
known->pub.bssid_index = new->pub.bssid_index;
known->pub.use_for &= new->pub.use_for;
known->pub.cannot_use_reasons = new->pub.cannot_use_reasons;
+ known->bss_source = new->bss_source;

return true;
}
@@ -2206,6 +2207,7 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
IEEE80211_MAX_CHAINS);
tmp.pub.use_for = data->use_for;
tmp.pub.cannot_use_reasons = data->cannot_use_reasons;
+ tmp.bss_source = data->bss_source;

switch (data->bss_source) {
case BSS_SOURCE_MBSSID:
--
2.7.4


2024-06-10 08:53:08

by Veerendranath Jakkam

[permalink] [raw]
Subject: [PATCH 4/4] wifi: cfg80211: make sure to process all per-STA profiles

Currently if BSS entry can't be created from any per-STA profile all
subsequent per-STA profiles in the multi-link element are ignored,
though they can generate valid BSS entries. To avoid this continue
processing the remaining per-STA profiles in the multi-link element
even if BSS entry not created from current per-STA profile.

Signed-off-by: Veerendranath Jakkam <[email protected]>
---
net/wireless/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 37ebe5a..546758c 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -3046,7 +3046,7 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,

bss = cfg80211_inform_single_bss_data(wiphy, &data, gfp);
if (!bss)
- break;
+ continue;
cfg80211_put_bss(wiphy, bss);
}

--
2.7.4


2024-06-12 11:06:23

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 0/4] wifi: cfg80211: fix per-STA profile BSS entry issues

On Mon, 2024-06-10 at 14:22 +0530, Veerendranath Jakkam wrote:
> This patch set contains bugfixes and cleanups related to per-STA
> profile BSS entries.
>

It also has RCU bugs (per warnings in the hwsim tests).

johannes