Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x
@ 2026-07-28 10:35 Georgi Valkov
  2026-07-30  2:16 ` Jeff Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Georgi Valkov @ 2026-07-28 10:35 UTC (permalink / raw)
  To: briannorris
  Cc: francesco, johannes.berg, kees, miriam.rachel.korenblit, wenst,
	rafael.beims, avraham.stern, peddolla.reddy, error27, s.kerkmann,
	linux-wireless, linux-kernel, stable, gvalkov

WRT3200ACM and WRT32x routers always report a fixed US regulatory domain
from the mwifiex ROM, which conflicts with the platform regulatory
configuration on units sold outside the US market. For example:
- phy0 mwlwifi 5 GHz, hard-coded region 98 EU mapped to FR
- phy1 mwlwifi 2.4 GHz, hard-coded region 98 EU mapped to FR
- phy2 mwifiex 2.4 and 5 GHz, hard-coded region US

When the system boots, it detects a conflict between the user selected
region and the radios, e.g. BG FR US, and applies extreme restrictions,
preventing use of 5 GHz and DFS channels. This also affects phy0.

Ignore the incorrect regulatory hint in the ROM of these devices, so
userspace can set the correct platform regulatory domain. These radios
are locked to the hard-coded configuration for which they are certified,
so the only impact is that the region conflict is avoided and the 5 GHz
radios can be used.

The change affects only WRT3200ACM and WRT32x routers, and helps
overcome the incorrect behaviour of proprietary radio firmware.

[1] https://github.com/kaloz/mwlwifi/issues/173#issuecomment-307879699
[2] https://github.com/openwrt/openwrt/issues/9956

Tested-on: WRT3200ACM, OpenWrt
Cc: stable@vger.kernel.org
Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
---
Please backport to 6.18, which is used by OpenWrt.
And let me know if there is a better approach to address this.

 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index abc703441c5d..04f7f58cc7d0 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4899,7 +4899,15 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 				country_code =
 					mwifiex_11d_code_2_region(
 						adapter->region_code);
+
+				/* WRT3200ACM/WRT32x ROM always reports US, which
+				 * conflicts with routers sold outside the US.
+				 * Ignore this hint so userspace can
+				 * set the correct regulatory domain.
+				 */
 				if (country_code &&
+				    !of_machine_is_compatible("linksys,wrt3200acm") &&
+				    !of_machine_is_compatible("linksys,wrt32x") &&
 				    regulatory_hint(wiphy, country_code))
 					mwifiex_dbg(priv->adapter, ERROR,
 						    "regulatory_hint() failed\n");
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x
  2026-07-28 10:35 [PATCH] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x Georgi Valkov
@ 2026-07-30  2:16 ` Jeff Chen
  2026-07-30  3:06   ` George Valkov
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Chen @ 2026-07-30  2:16 UTC (permalink / raw)
  To: Georgi Valkov
  Cc: briannorris, francesco, johannes.berg, kees,
	miriam.rachel.korenblit, wenst, rafael.beims, avraham.stern,
	peddolla.reddy, error27, s.kerkmann, linux-wireless, linux-kernel,
	stable

On Tue, Jul 28, 2026 at 01:35:36 PM +0300, Georgi Valkov wrote:
> WRT3200ACM and WRT32x routers always report a fixed US regulatory domain
> from the mwifiex ROM, which conflicts with the platform regulatory
> configuration on units sold outside the US market. For example:
> - phy0 mwlwifi 5 GHz, hard-coded region 98 EU mapped to FR
> - phy1 mwlwifi 2.4 GHz, hard-coded region 98 EU mapped to FR
> - phy2 mwifiex 2.4 and 5 GHz, hard-coded region US

Hi Georgi,

Thanks for the patch. I have a question about these compatible strings:

>  				if (country_code &&
> +				    !of_machine_is_compatible("linksys,wrt3200acm") &&
> +				    !of_machine_is_compatible("linksys,wrt32x") &&

I checked the mainline kernel source, but these names are not found
in the DTS files under arch/arm/boot/dts/marvell/. Instead, mainline uses
"linksys,rango" and "linksys,venom".

As a result, this machine check will always fail on a pure mainline kernel,
making the quirk ineffective.

Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x
  2026-07-30  2:16 ` Jeff Chen
@ 2026-07-30  3:06   ` George Valkov
  2026-07-30  3:24     ` George Valkov
  0 siblings, 1 reply; 5+ messages in thread
From: George Valkov @ 2026-07-30  3:06 UTC (permalink / raw)
  To: Jeff Chen
  Cc: briannorris, francesco, johannes.berg, kees,
	miriam.rachel.korenblit, wenst, rafael.beims, avraham.stern,
	peddolla.reddy, error27, s.kerkmann, linux-wireless, linux-kernel,
	stable

Hi Jeff,
Initially I wanted to keep changes easy to read and as simple as possible,
hence my current patch is based on device names.

Indeed out openwrt-ai also caught this:
https://github.com/openwrt/openwrt/pull/24458#pullrequestreview-4803923901

I've been thinking about possible options:
1. Use board names "linksys,rango" and "linksys,venom", where
   rango is WRT3200ACM, and venom is WRT32x. But a venom dts
   is also not available in Linux. We do have it in OpenWrt:
   https://github.com/openwrt/openwrt/blob/main/target/linux/mvebu/files
   /arch/arm/boot/dts/marvell/armada-385-linksys-venom.dts
2. We could either ignore this or
3. Have another PR with venom board support files, but that will require
   much more research and work. I don't have WRT32x hardware, and I'm
   uncomfortable doing this without supervision.
4. We can also implement a dts flag, e.g. ignore_reg_hint, which can be
   set in the board dts. This might be the best and most flexible option.
   My experience with dts is almost zero and I will need help to implement
   it.

Georgi

On Thu, 30 Jul 2026 at 05:17, Jeff Chen <chunfan.chen@gmail.com> wrote:
>
> On Tue, Jul 28, 2026 at 01:35:36 PM +0300, Georgi Valkov wrote:
> > WRT3200ACM and WRT32x routers always report a fixed US regulatory domain
> > from the mwifiex ROM, which conflicts with the platform regulatory
> > configuration on units sold outside the US market. For example:
> > - phy0 mwlwifi 5 GHz, hard-coded region 98 EU mapped to FR
> > - phy1 mwlwifi 2.4 GHz, hard-coded region 98 EU mapped to FR
> > - phy2 mwifiex 2.4 and 5 GHz, hard-coded region US
>
> Hi Georgi,
>
> Thanks for the patch. I have a question about these compatible strings:
>
> >                               if (country_code &&
> > +                                 !of_machine_is_compatible("linksys,wrt3200acm") &&
> > +                                 !of_machine_is_compatible("linksys,wrt32x") &&
>
> I checked the mainline kernel source, but these names are not found
> in the DTS files under arch/arm/boot/dts/marvell/. Instead, mainline uses
> "linksys,rango" and "linksys,venom".
>
> As a result, this machine check will always fail on a pure mainline kernel,
> making the quirk ineffective.
>
> Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x
  2026-07-30  3:06   ` George Valkov
@ 2026-07-30  3:24     ` George Valkov
  2026-07-30  7:47       ` Jeff Chen
  0 siblings, 1 reply; 5+ messages in thread
From: George Valkov @ 2026-07-30  3:24 UTC (permalink / raw)
  To: Jeff Chen
  Cc: briannorris, francesco, johannes.berg, kees,
	miriam.rachel.korenblit, wenst, rafael.beims, avraham.stern,
	peddolla.reddy, error27, s.kerkmann, linux-wireless, linux-kernel,
	stable

Hi Jeff, I forgot to mention:
The compatibile strings are added by this OpenWrt patch:
https://github.com/openwrt/openwrt/blob/main/target/linux/mvebu/patches-6.18/
311-adjust-compatible-for-linksys.patch

So unless we also upstream this patch, using device names will work
only on OpenWrt, which would make the current patch ineffective.

Georgi

On Thu, 30 Jul 2026 at 06:06, George Valkov <gvalkov@gmail.com> wrote:
>
> Hi Jeff,
> Initially I wanted to keep changes easy to read and as simple as possible,
> hence my current patch is based on device names.
>
> Indeed out openwrt-ai also caught this:
> https://github.com/openwrt/openwrt/pull/24458#pullrequestreview-4803923901
>
> I've been thinking about possible options:
> 1. Use board names "linksys,rango" and "linksys,venom", where
>    rango is WRT3200ACM, and venom is WRT32x. But a venom dts
>    is also not available in Linux. We do have it in OpenWrt:
>    https://github.com/openwrt/openwrt/blob/main/target/linux/mvebu/files
>    /arch/arm/boot/dts/marvell/armada-385-linksys-venom.dts
> 2. We could either ignore this or
> 3. Have another PR with venom board support files, but that will require
>    much more research and work. I don't have WRT32x hardware, and I'm
>    uncomfortable doing this without supervision.
> 4. We can also implement a dts flag, e.g. ignore_reg_hint, which can be
>    set in the board dts. This might be the best and most flexible option.
>    My experience with dts is almost zero and I will need help to implement
>    it.
>
> Georgi
>
> On Thu, 30 Jul 2026 at 05:17, Jeff Chen <chunfan.chen@gmail.com> wrote:
> >
> > On Tue, Jul 28, 2026 at 01:35:36 PM +0300, Georgi Valkov wrote:
> > > WRT3200ACM and WRT32x routers always report a fixed US regulatory domain
> > > from the mwifiex ROM, which conflicts with the platform regulatory
> > > configuration on units sold outside the US market. For example:
> > > - phy0 mwlwifi 5 GHz, hard-coded region 98 EU mapped to FR
> > > - phy1 mwlwifi 2.4 GHz, hard-coded region 98 EU mapped to FR
> > > - phy2 mwifiex 2.4 and 5 GHz, hard-coded region US
> >
> > Hi Georgi,
> >
> > Thanks for the patch. I have a question about these compatible strings:
> >
> > >                               if (country_code &&
> > > +                                 !of_machine_is_compatible("linksys,wrt3200acm") &&
> > > +                                 !of_machine_is_compatible("linksys,wrt32x") &&
> >
> > I checked the mainline kernel source, but these names are not found
> > in the DTS files under arch/arm/boot/dts/marvell/. Instead, mainline uses
> > "linksys,rango" and "linksys,venom".
> >
> > As a result, this machine check will always fail on a pure mainline kernel,
> > making the quirk ineffective.
> >
> > Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x
  2026-07-30  3:24     ` George Valkov
@ 2026-07-30  7:47       ` Jeff Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Chen @ 2026-07-30  7:47 UTC (permalink / raw)
  To: George Valkov
  Cc: Jeff Chen, briannorris, francesco, johannes.berg, kees,
	miriam.rachel.korenblit, wenst, rafael.beims, avraham.stern,
	peddolla.reddy, error27, s.kerkmann, linux-wireless, linux-kernel,
	stable

On Thu, Jul 30, 2026 at 06:24:15 AM +0300, George Valkov wrote:
> Hi Jeff, I forgot to mention:
> The compatibile strings are added by this OpenWrt patch:
> https://github.com/openwrt/openwrt/blob/main/target/linux/mvebu/patches-6.18/
> 311-adjust-compatible-for-linksys.patch
> 
> So unless we also upstream this patch, using device names will work
> only on OpenWrt, which would make the current patch ineffective.
> 
> Georgi
> 
> On Thu, 30 Jul 2026 at 06:06, George Valkov <gvalkov@gmail.com> wrote:
> >
> > Hi Jeff,
> > Initially I wanted to keep changes easy to read and as simple as possible,
> > hence my current patch is based on device names.
> >
> > Indeed out openwrt-ai also caught this:
> > https://github.com/openwrt/openwrt/pull/24458#pullrequestreview-4803923901
> >
> > I've been thinking about possible options:
> > 1. Use board names "linksys,rango" and "linksys,venom", where
> >    rango is WRT3200ACM, and venom is WRT32x. But a venom dts
> >    is also not available in Linux. We do have it in OpenWrt:
> >    https://github.com/openwrt/openwrt/blob/main/target/linux/mvebu/files
> >    /arch/arm/boot/dts/marvell/armada-385-linksys-venom.dts
> > 2. We could either ignore this or
> > 3. Have another PR with venom board support files, but that will require
> >    much more research and work. I don't have WRT32x hardware, and I'm
> >    uncomfortable doing this without supervision.
> > 4. We can also implement a dts flag, e.g. ignore_reg_hint, which can be
> >    set in the board dts. This might be the best and most flexible option.
> >    My experience with dts is almost zero and I will need help to implement
> >    it.
> >
> > Georgi
> >

Hi Georgi,

Thanks for the update. My recommendation aligns with openwrt-ai's suggestion.

In general, checking board-specific DT strings inside a generic driver is 
not a good idea. However, since implementing a new DT flag or module parameter
requires deeper driver architectural changes, expanding the list of compatible
strings is a more pragmatic way considering these are legacy devices.

You can update the check to include all four strings for V2:

	if (country_code &&
	    !of_machine_is_compatible("linksys,rango") &&
	    !of_machine_is_compatible("linksys,wrt3200acm") &&
	    !of_machine_is_compatible("linksys,venom") &&
	    !of_machine_is_compatible("linksys,wrt32x") &&
	    regulatory_hint(wiphy, country_code))

Combining these four strings ensures the patch works in both pure mainline and
OpenWrt environments. 

We should still wait for feedback from the maintainers or other reviewers 
to see if they prefer this hardcoded approach or a proper module/DT property.

Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-30  7:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 10:35 [PATCH] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x Georgi Valkov
2026-07-30  2:16 ` Jeff Chen
2026-07-30  3:06   ` George Valkov
2026-07-30  3:24     ` George Valkov
2026-07-30  7:47       ` Jeff Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox