[PATCH v2 1/2] wifi: cfg80211: Add beacon hint notifier support

From: Youghandhar Chintala
Date: Thu Mar 02 2023 - 04:57:38 EST


There are connection failures in hidden SSID case when the device is
with default reg domain WW.
For WW reg domain most of the 5 GHz channels are passive. When device
listens to the beacon on that channel, the driver is updating its
channel flag but firmware is not aware of it and firmware is not
sending probes on that channels.
Due to this, we are seeing connection failures when the device is trying
to connect with hidden SSID AP.

In the case of devices using the ath10k driver, it is required to update
the change in channel flags to firmware as well. Therefore, we need a
mechanism to notify the driver from the regulatory core regarding the
channel flag changes.
Adding a beacon hint notifier logic, so that drivers can register
callbacks to get notified whenever there is a change in channel flags.

Signed-off-by: Youghandhar Chintala <quic_youghand@xxxxxxxxxxx>
---
include/net/cfg80211.h | 7 +++++++
net/wireless/reg.c | 5 ++++-
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 11a370e64143..7a00f5317e1f 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5096,6 +5096,10 @@ struct wiphy_iftype_akm_suites {
* @reg_notifier: the driver's regulatory notification callback,
* note that if your driver uses wiphy_apply_custom_regulatory()
* the reg_notifier's request can be passed as NULL
+ * @beacon_hint_notifier: the driver's beacon hint notification callback,
+ * which will trigger when there is channel flag updates seen in
+ * beacon hints. The beacon_hint_notifier's request can be passed
+ * with chan context.
* @regd: the driver's regulatory domain, if one was requested via
* the regulatory_hint() API. This can be used by the driver
* on the reg_notifier() if it chooses to ignore future
@@ -5386,6 +5390,9 @@ struct wiphy {
void (*reg_notifier)(struct wiphy *wiphy,
struct regulatory_request *request);

+ void (*beacon_hint_notifier)(struct wiphy *wiphy,
+ struct ieee80211_channel *chan);
+
/* fields below are read-only, assigned by cfg80211 */

const struct ieee80211_regdomain __rcu *regd;
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index c3d950d29432..2dc6880a28c5 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2219,8 +2219,11 @@ static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx,
channel_changed = true;
}

- if (channel_changed)
+ if (channel_changed) {
nl80211_send_beacon_hint_event(wiphy, &chan_before, chan);
+ if (wiphy->beacon_hint_notifier)
+ wiphy->beacon_hint_notifier(wiphy, chan);
+ }
}

/*
--
2.38.0