On 2/1/2023 3:03 PM, Wen Gong wrote:
Currently the regulatory driver does not call the regulatory callback
reg_notifier for self managed wiphys. Sometimes driver needs cfg80211
to calculate the info of ieee80211_channel such as flags and power,
and driver needs to get the info of ieee80211_channel after hint of
driver, but driver does not know when calculation of the info of
ieee80211_channel become finished, so add notify to driver in
reg_process_self_managed_hint() from cfg80211 is a good way, then
driver could get the correct info in callback of reg_notifier.
Signed-off-by: Wen Gong <quic_wgong@xxxxxxxxxxx>
---
v3: use hole for BIT(24) which delete by commit 585b6e1304dc ("wifi: cfg80211: remove support for static WEP")
Hi Johannes,
I see you have merged v2 to wireless-next.git and this v3's state is reject.
So do you mean we should not keep hole BIT 24 in enum wiphy_flags from
now as well as
hole 11/12 in commit 8e8b41f9d8c8/ca986ad9bcd3?
If that, then backport this patch will be more complex, because the
backport kernel already have
WIPHY_FLAG_HAS_STATIC_WEP= BIT(24), then firstly the backport kernel
need backport other
patch(585b6e1304dc ("wifi: cfg80211: remove support for static WEP"))
which is not really needed.
v2:
1. add flag WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER
2. change to use reg_call_notifier()
include/net/cfg80211.h | 4 ++++
net/wireless/reg.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1f8f827290a2..ef96fc5b060d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4682,6 +4682,8 @@ struct cfg80211_ops {
* in order to not have them reachable in normal drivers, until we have
* complete feature/interface combinations/etc. advertisement. No driver
* should set this flag for now.
+ * @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for
+ * NL80211_REGDOM_SET_BY_DRIVER.
*/
enum wiphy_flags {
WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
@@ -4707,6 +4709,8 @@ enum wiphy_flags {
WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
+ /* use hole at 24 */
+ WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(25),
};
/**
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 4f3f31244e8b..cb35c8e9ced7 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -3198,6 +3198,9 @@ static void reg_process_self_managed_hint(struct wiphy *wiphy)
request.alpha2[1] = regd->alpha2[1];
request.initiator = NL80211_REGDOM_SET_BY_DRIVER;
+ if (wiphy->flags & WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER)
+ reg_call_notifier(wiphy, &request);
+
nl80211_send_wiphy_reg_change_event(&request);
}
base-commit: 922932ca02191a390f7f52fb6e21c44b50e14025
prerequisite-patch-id: e365a8f3f2dda71872409315b416797c771a6c51