[PATCH] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain

Felix Fietkau nbd at nbd.name
Mon Dec 30 11:05:20 PST 2024


On 12.04.24 10:53, Mingyen Hsieh wrote:
> From: Leon Yen <leon.yen at mediatek.com>
> 
> 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 at mediatek.com>
> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh at mediatek.com>
> ---
>   drivers/net/wireless/mediatek/mt76/mt7921/init.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> index ef0c721d26e3..3c9a5fcd6924 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> @@ -135,6 +135,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;
> +	}
> +

Sorry for the late response, I just noticed that I completely forgot to 
review this one.

In principle, it makes sense to me to ignore the country IE in this 
case, however I don't understand why the change is done in the mt7921 
driver. Isn't this a generic issue that should be consistent across 
drivers and thus better handled in mac80211?

Thanks,

- Felix



More information about the Linux-mediatek mailing list