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

Nicolas Escande nico.escande at gmail.com
Mon Apr 15 03:26:44 PDT 2024


On Mon Apr 15, 2024 at 7:53 AM CEST, Mingyen Hsieh (謝明諺) wrote:
> On Fri, 2024-04-12 at 11:27 +0200, Nicolas Escande wrote:
> >  	 
> > External email : Please do not click links or open attachments until
> > you have verified the sender or the content.
> >  On Fri Apr 12, 2024 at 10:53 AM CEST, 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).
> > 
> > I always had trouble fully understanding the regulation but isn't the
> > country
> > code IE sole purpose to adapt the regulatory of the client ? 
> > 
> Hi Nicolas,
>
> Yes, it is. However, if the users have set the specific country code
> based on their region to the driver, they do not expect the country
> setting to be changed by the country code IE as the AP cannot be
> entirely trusted.

Hi,

In AP mode, I understand that the hardware/firmware (and so user mode to some
extend) is the source of truth about which country/market the product has passed
certification and what not. Thus the country code of an AP should be trusted.
If you put an AP from another market at some place, you are responsible for that

But in STA mode the end user should not need to know which regulation follow,
right ? The AP's Country code IE is where the sta gets the final info. So no,
the AP should be trusted, and the user should not (and not the other way around)

Of course, I am no an expert on this. I just want to check if there was some
though behind this change. You guys make Wifi chips, you know what you are doing

Thanks
>
> Best Regards,
> Yen.
>
> > >
> > > 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;
> > > +}
> > > +
> > >  if (pm->suspended)
> > >  return;
> > >  
> > 




More information about the Linux-mediatek mailing list