]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain
authorLeon Yen <leon.yen@mediatek.com>
Fri, 12 Apr 2024 08:53:57 +0000 (16:53 +0800)
committerFelix Fietkau <nbd@nbd.name>
Tue, 14 Jan 2025 12:42:30 +0000 (13:42 +0100)
Some countries have strict RF restrictions where changing the regulatory
domain dynamically based on the connected AP is not acceptable.
This patch disables Beacon country IE hinting when a valid country code
is set from usersland (e.g., by system using iw or CRDA).

Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Tested-by: David Ruth <druth@chromium.org>
Link: https://patch.msgid.link/20240412085357.13756-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7921/init.c

index cdcb002b3094692492d0faf62c5fa3b5950e8f4e..14e17dc902566878c8ca7768607d2dd1eb3ac862 100644 (file)
@@ -137,6 +137,13 @@ mt7921_regd_notifier(struct wiphy *wiphy,
        dev->mt76.region = request->dfs_region;
        dev->country_ie_env = request->country_ie_env;
 
+       if (request->initiator == NL80211_REGDOM_SET_BY_USER) {
+               if (dev->mt76.alpha2[0] == '0' && dev->mt76.alpha2[1] == '0')
+                       wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE;
+               else
+                       wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;
+       }
+
        if (pm->suspended)
                return;