Skip to contentSkip to conversation

wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x

PATCH Superseded Georgi Valkov 8 participants 40 messages Jul 28 – Aug 20

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x

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

---
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(+)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +8 -0
index abc703441c5d..04f7f58cc7d0 100644
@@ -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");
Signature · 1 line
2.55.0
#1 lore raw
Quoted 6 lines · Georgi Valkov

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:

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4910

Quoted 3 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +2 -0
 				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

#2 lore raw

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

Quoted 25 lines · Jeff Chen
Quoted 6 lines · Georgi Valkov

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:

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4910

Quoted 3 lines
                              if (country_code &&
drivers/net/wireless/marvell/mwifiex/cfg80211.c +2 -0
+                                 !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

#3 lore raw

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

Quoted 51 lines · George Valkov

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

Quoted 25 lines · Jeff Chen
Quoted 6 lines · Georgi Valkov

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:

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4910

Quoted 3 lines
                              if (country_code &&
drivers/net/wireless/marvell/mwifiex/cfg80211.c +2 -0
+                                 !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

#4 lore raw
Quoted 5 lines · George Valkov

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

Quoted 31 lines

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

Georgi

Quoted 25 lines · George Valkov

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

#5 lore raw

PATCH v2 1/1 wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x

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

---
The dts files on Linux use only board names. A patch in OpenWrt adds device names which are easier to understand. If we want to be compatible with both, we can either use board names or accept this patch in Linux:
https://github.com/openwrt/openwrt/blob/main/target/linux/mvebu/patches-6.18/
311-adjust-compatible-for-linksys.patch

I implemented and tested a better approach with no board specific code:
- check for a device-tree flag in mwifiex_register_cfg80211in() !of_property_read_bool(of_root, "marvell,ignore-regulatory-hint")
- add this flag to the root device tree of each affected board Currently this affects only armada-385-linksys-rango.dts, because Linux has no dts for venom. OpenWrt will take care of that. This approach is more flexible and scalable, because the flag can also be used in other drivers, e.g. mwlwifi (not part of Linux). Any help is welcome!

v2:
Replace the compatible device names, which are currently only available on OpenWrt with board names which are available on both Linux and OpenWrt.

 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +8 -0
index abc703441c5d..ff6a22237a0f 100644
@@ -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,rango") &&
+				    !of_machine_is_compatible("linksys,venom") &&
 				    regulatory_hint(wiphy, country_code))
 					mwifiex_dbg(priv->adapter, ERROR,
 						    "regulatory_hint() failed\n");
Signature · 1 line
2.55.0
#6 lore raw
Quoted 20 lines · Georgi Valkov

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.

Quoted 7 lines

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

Tested-on: WRT3200ACM, OpenWrt

---

Hi Georgi,

Thanks for the V2. The updated strings now match both environments.

However, checking board-specific DT strings inside a generic peripheral driver is still not a good idea.

Since you asked about a better approach, why not consider the solution mentioned by openwrt-ai using the "reg_alpha2" module parameter?

If OpenWrt injects "reg_alpha2=00" via a modprobe conf file under target/linux/mvebu/, the ROM regulatory hint can be overridden from userspace without needing any hardcoded logic inside the upstream driver.

Best regards,

Jeff

#7 lore raw

PATCH v3 1/2 wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x

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.

Implement a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint in the ROM, so userspace can set the correct platform regulatory domain. The radios in WRT3200ACM/WRT32x 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 platforms which explicitly define this flag, 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

---
Hi Jeff,
I did not consider the idea suggested by openwrt-ai, because I do not understand it and I do not know how to implement it.
Any help is welcome!

v3:
I implemented and tested a better approach with no board specific code:
1. check for a device-tree flag in mwifiex_register_cfg80211in() !of_property_read_bool(of_root, "marvell,ignore-regulatory-hint")
2. add this flag to the root device tree of each affected board Currently this affects only armada-385-linksys-rango.dts, because Linux has no dts for venom. OpenWrt will take care of that. This approach is more flexible and scalable, because the flag can also be used in other drivers, e.g. mwlwifi (not part of Linux).

v2:
Replace the compatible device names, which are currently only available on OpenWrt with board names which are available on both Linux and OpenWrt.

 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +7 -0
index abc703441c5d..0239b1c9214b 100644
@@ -4899,7 +4899,14 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 				country_code =
 					mwifiex_11d_code_2_region(
 						adapter->region_code);
+
+				/* Allow platforms to ignore an incorrect
+				 * regulatory hint from ROM, so userspace
+				 * can set the correct regulatory domain.
+				 */
 				if (country_code &&
+				    !of_property_read_bool(of_root,
+							   "marvell,ignore-regulatory-hint") &&
 				    regulatory_hint(wiphy, country_code))
 					mwifiex_dbg(priv->adapter, ERROR,
 						    "regulatory_hint() failed\n");
Signature · 1 line
2.55.0
#8 lore raw

PATCH v3 2/2 ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

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.

Add a device-tree flag marvell,ignore-regulatory-hint to the WRT3200ACM device-tree, which signals mwifiex to ignore an incorrect regulatory hint in the ROM, so userspace can set the correct platform regulatory domain. The radios in WRT3200ACM/WRT32x 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 Linux kernel sources do not have support for WRT32x. An equivalent patch for these routers has to be sent to OpenWrt.

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

Tested-on: WRT3200ACM, OpenWrt

---
 arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts +1 -0
index 4ab45f294de2..6e283e223ca4 100644
@@ -14,6 +14,7 @@ / {
 	model = "Linksys WRT3200ACM";
 	compatible = "linksys,rango", "linksys,armada385", "marvell,armada385",
 		     "marvell,armada380";
+	marvell,ignore-regulatory-hint;
 };
 
 &expander0 {
Signature · 1 line
2.55.0
#9 lore raw

Re: [PATCH v3 2/2] ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The device-specific property `marvell,ignore-regulatory-hint` is incorrectly placed in the global…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The device-specific property marvell,ignore-regulatory-hint is incorrectly placed in the global root node (/), lacking binding documentation and causing the quirk to erroneously apply to all mwifiex devices.
- [Medium] The mwifiex driver directly accesses the global of_root variable, which is undefined when CONFIG_OF is disabled, violating the driver model and risking linker errors. --

--- Patch [2]: [PATCH v3 2/2] ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint --- commit 7033e1a77e69407f0088e5cd43fbc6b4fc03d549
Author: Georgi Valkov <[email protected]>

ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

This patch adds the marvell,ignore-regulatory-hint flag to the WRT3200ACM device tree. It prevents the system from applying extreme restrictions due to conflicts between the user-selected region and the radios' hard-coded US region.

arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts / { · line 17

Quoted 9 lines
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts +1 -0
index 4ab45f294de22..6e283e223ca4c 100644
@@ -14,6 +14,7 @@ / {
 	model = "Linksys WRT3200ACM";
 	compatible = "linksys,rango", "linksys,armada385", "marvell,armada385",
 		     "marvell,armada380";
+	marvell,ignore-regulatory-hint;

[Severity: High]
Does adding this device-specific property to the global root node (/) instead of a dedicated device node cause a regression where it applies universally?

Because the driver in drivers/net/wireless/marvell/mwifiex/cfg80211.c queries this property from the root node:

mwifiex_register_cfg80211():

                if (country_code &&
                    !of_property_read_bool(of_root,
                                           "marvell,ignore-regulatory-hint") &&
                    regulatory_hint(wiphy, country_code))

this board quirk will be broadcast globally across the system.

If a user connects a generic USB mwifiex Wi-Fi adapter to this router, it appears the driver would incorrectly apply the board quirk to the external adapter, potentially causing a regression in regulatory compliance by ignoring its valid regulatory hint.

Would it be safer to use of_machine_is_compatible() for this platform quirk?

[Severity: Medium]
Will querying of_root directly in the mwifiex driver cause a compilation regression when CONFIG_OF is disabled?

Since of_root is only defined in drivers/of/base.c, and the mwifiex driver does not depend on CONFIG_OF, this relies entirely on the compiler's dead-code elimination to drop the of_root symbol reference when of_property_read_bool() expands to an inline dummy.

Relying on dead code elimination for undefined symbols can be brittle.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#10 lore raw
In reply to Georgi Valkov
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] A vendor/device-specific workaround property (`marvell,ignore-regulatory-hint`) is incorrectly…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] A vendor/device-specific workaround property (marvell,ignore-regulatory-hint) is incorrectly read from the global root device tree node (of_root) rather than the device's own OF node. Device Tree must correctly model hardware topology by placing device-specific properties in the node representing that physical device. Placing a vendor-specific property in the root node applies it globally to the entire system. If a system contains multiple Marvell Wi-Fi adapters (e.g., one built-in and one plugged in via USB or PCIe) and only one requires the regulatory hint to be ignored, this global flag will incorrectly apply the quirk to all of them. The driver should read this property from its own device node (e.g., adapter->dev->of_node or adapter->dt_node). --

--- Patch [1]: [PATCH v3 1/2] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x --- commit 3a34f3fd7103c1109fdfbb027f11821961b37978
Author: Georgi Valkov <[email protected]>

wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x

This commit introduces a device-tree flag to allow affected platforms to ignore incorrect regulatory hints hardcoded in the mwifiex ROM. This enables userspace to set the correct platform regulatory domain and prevents extreme restrictions on 5 GHz and DFS channels.

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

Quoted 5 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +0 -0
@@ -4899,7 +4899,14 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 				country_code =

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4909

Quoted 10 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +7 -0
 					mwifiex_11d_code_2_region(
 						adapter->region_code);
+
+				/* Allow platforms to ignore an incorrect
+				 * regulatory hint from ROM, so userspace
+				 * can set the correct regulatory domain.
+				 */
 				if (country_code &&
+				    !of_property_read_bool(of_root,
+							   "marvell,ignore-regulatory-hint") &&

[Severity: Medium]
Is it intentional to read the device-specific property from the global of_root node rather than the adapter's own device node (e.g., adapter->dev->of_node or adapter->dt_node)?

If a system contains multiple Marvell Wi-Fi adapters and only one requires this workaround, reading from the root node will globally apply the quirk to all adapters in the system.

Would it be better to adhere to device tree architectural principles by placing and reading this property in the node representing the specific physical device?

Quoted 3 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +0 -0
 				    regulatory_hint(wiphy, country_code))
 					mwifiex_dbg(priv->adapter, ERROR,
 						    "regulatory_hint() failed\n");
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer
#11 lore raw
In reply to Georgi Valkov

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4910

Quoted 9 lines · Georgi Valkov
drivers/net/wireless/marvell/mwifiex/cfg80211.c +6 -0
+				/* Allow platforms to ignore an incorrect
+				 * regulatory hint from ROM, so userspace
+				 * can set the correct regulatory domain.
+				 */
 				if (country_code &&
+				    !of_property_read_bool(of_root,
+							   "marvell,ignore-regulatory-hint") &&
 				    regulatory_hint(wiphy, country_code))

You're supposed to always update bindings first, no?

johannes

#12 lore raw

Hello Johannes, and thank you for your quick reply!

Quoted 1 line

You're supposed to always update bindings first, no?

To me the logical order is to implement the feature in the driver and then enable it in each board which needs it. For Linux just WRT3200ACM. A separate patch for WRT32x should be sent to OpenWrt.

Please let me know if I should reverse the order.

Hello Sashiko AI,
Yes, I intentionally implemented the flag as a root node. This way the new device-tree property can be reused for the other radios, which use mwlwifi, and also require this fix.

It would be inefficient and impractical to define a separate device-tree property for each radio, where it is actually the board that is affected, so it should be a per-board setting.

Also my attempts to use per device nodes or the parent always return false so they are not usable.

I do not understand the part about dependence on CONFIG_OF. of_property_read_bool() returns false when the flag is not defined. This preserves the original behaviour as if it is set to false, so the feature is disabled.
External radios which do not implement support for this flag are not affected.

v2 of this PR used of_machine_is_compatible, but there was an objection that this adds platform code to the driver.

How can I add binding documentation and where?

Quoted 15 lines · Johannes Berg

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4910

Quoted 9 lines · Georgi Valkov
drivers/net/wireless/marvell/mwifiex/cfg80211.c +6 -0
+                             /* Allow platforms to ignore an incorrect
+                              * regulatory hint from ROM, so userspace
+                              * can set the correct regulatory domain.
+                              */
                              if (country_code &&
+                                 !of_property_read_bool(of_root,
+                                                        "marvell,ignore-regulatory-hint") &&
                                  regulatory_hint(wiphy, country_code))

You're supposed to always update bindings first, no?

johannes

maintainer
#13 lore raw
Quoted 8 lines · George Valkov

Hello Johannes, and thank you for your quick reply!

Quoted 1 line

You're supposed to always update bindings first, no?

To me the logical order is to implement the feature in the driver and then enable it in each board which needs it. For Linux just WRT3200ACM. A separate patch for WRT32x should be sent to OpenWrt.

Please let me know if I should reverse the order.

Johannes is asking about the binding documentation (.txt or .yaml), not the .c (driver) or .dts/.dtsi files. You haven't included "marvell,ignore-regulatory-hint" in any valid binding document, so it's not a valid property to use in this driver.

See Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml for the correct binding file relevant to this driver.

Quoted 8 lines

Hello Sashiko AI,
Yes, I intentionally implemented the flag as a root node. This way the new device-tree property can be reused for the other radios, which use mwlwifi, and also require this fix.

It would be inefficient and impractical to define a separate device-tree property for each radio, where it is actually the board that is affected, so it should be a per-board setting.

I'm not sure what you're saying here. Device Tree Blobs are inherently a per-board object. The question here is simply where within the Device Tree we want to add a property.

I believe that you're describing problems with the radio, and so you should add DT properties to the node for the radio(s) in question, not the root node.

Quoted 2 lines

Also my attempts to use per device nodes or the parent always return false so they are not usable.

That seems like something you need to figure out. Just because you found it difficult doesn't mean we should accept the wrong approach.

IIUC, you're using a PCIe-based WiFi card, and that's enabled in arch/arm/boot/dts/marvell/armada-385-linksys.dtsi:

&pcie1 {
        /* Marvell 88W8864, 5GHz-only */
        status = "okay";
};
&pcie2 {
        /* Marvell 88W8864, 2GHz-only */
        status = "okay";
};

I think those are the "port" nodes, and there currently is no node that actually represents the PCIe endpoint device (i.e., your wifi cards). You need to add those as children, like:

&pcie1 {
...

	wifi@0 {
		compatible = "pciXXXX,YYYY"; /* figure out the appropriate IDs here */
		marvell,ignore-regulatory-hint;
		...
	};
};

...

Quoted 6 lines

I do not understand the part about dependence on CONFIG_OF. of_property_read_bool() returns false when the flag is not defined. This preserves the original behaviour as if it is set to false, so the feature is disabled.
External radios which do not implement support for this flag are not affected.

I think if you stop using 'of_root', you'll dodge this problem. And you should not be looking at of_root.

Quoted 4 lines

v2 of this PR used of_machine_is_compatible, but there was an objection that this adds platform code to the driver.

How can I add binding documentation and where?

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml. See the other hints above too.

Side question: did you consider Jeff's suggestion from v2, to try the 'reg_alpha2' module param? It might already do what you need, and it only requires you configure your OpenWrt builds properly, I think.

Brian

Quoted 16 lines · Johannes Berg
Quoted 15 lines · Georgi Valkov

drivers/net/wireless/marvell/mwifiex/cfg80211.c int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) · line 4910

Quoted 9 lines
drivers/net/wireless/marvell/mwifiex/cfg80211.c +6 -0
+                             /* Allow platforms to ignore an incorrect
+                              * regulatory hint from ROM, so userspace
+                              * can set the correct regulatory domain.
+                              */
                              if (country_code &&
+                                 !of_property_read_bool(of_root,
+                                                        "marvell,ignore-regulatory-hint") &&
                                  regulatory_hint(wiphy, country_code))

You're supposed to always update bindings first, no?

johannes

#14 lore raw

PATCH 1/3 dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

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.

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

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

Tested-on: WRT3200ACM, OpenWrt

---
Thank you Brian and Johannes!

Quoted 2 lines

Just because you found it difficult doesn't mean we should accept the wrong approach.

I agree. Guidance and careful inspection helps reach a good solution.

Quoted 8 lines

IIUC, you're using a PCIe-based WiFi card, and that's enabled in arch/arm/boot/dts/marvell/armada-385-linksys.dtsi:

&pcie1 {
        /* Marvell 88W8864, 5GHz-only */
        status = "okay";
};
Quoted 4 lines
&pcie2 {
        /* Marvell 88W8864, 2GHz-only */
        status = "okay";
};

No, you are referring to the main radios, which are not part of these patch series. Would you allow me to also add the flag to them? Their driver is not part of Linux so only dt bindings need to be added.

The changes here target the third radio:
- phy2: Marvell 88W8887 802.11ac/b/g/n 2.4 / 5 GHz, region US
- compatible = marvell,sd8897 works

I cannot confirm if any other devices from the family need the fix or not, so I intentionally target the board dts, and not the include:
armada-385-linksys.dtsi

Quoted 3 lines

Side question: did you consider Jeff's suggestion from v2, to try the 'reg_alpha2' module param? It might already do what you need, and it only requires you configure your OpenWrt builds properly, I think.

A universal solution is better than targeting OpenWrt only. And unfortunately I have no idea how to implement this.

Quoted 1 line

I'm not sure what you're saying here

In v3 I wanted to reuse a flag for both drivers. Using a root flag was objected, so in v4 I added a flag for mwifiex, and I would like to add the same flag to mwlwifi later.

- driver
dev_name(adapter->dev) = mmc0:0001:1
dev_fwnode(adapter->dev) = wifi@1
marvell,ignore-regulatory-hint = 1

- procfs /proc/device-tree/soc/internal-regs/sdhci@d8000/wifi@1 compatible = marvell,sd8897 marvell,ignore-regulatory-hint
name = wifi
reg

v4:
1. Add binding documentation for flag marvell,ignore-regulatory-hint
2. Add dt for sd8897 and move the flag there, I used sample from docs
3. Use device_property_read_bool in the driver

v3:
I implemented and tested a better approach with no board specific code:
1. check for a device-tree flag in mwifiex_register_cfg80211in() !of_property_read_bool(of_root, "marvell,ignore-regulatory-hint")
2. add this flag to the root device tree of each affected board Currently this affects only armada-385-linksys-rango.dts, because Linux has no dts for venom. OpenWrt will take care of that. This approach is more flexible and scalable, because the flag can also be used in other drivers, e.g. mwlwifi (not part of Linux).

v2:
Replace the compatible device names, which are currently only available on OpenWrt with board names which are available on both Linux and OpenWrt.

 .../devicetree/bindings/net/wireless/marvell,sd8787.yaml    | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
index 930b700b73d0..5f235cb9f3e5 100644
@@ -59,6 +59,12 @@ properties:
     description: Calibration data for sub-band 3 in the 5GHz band.
     maxItems: 502
 
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+
   marvell,wakeup-pin:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
Signature · 1 line
2.55.0
#15 lore raw

PATCH 2/3 ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

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.

Add a flag marvell,ignore-regulatory-hint to the WRT3200ACM device-tree, which signals mwifiex to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain. The radios in WRT3200ACM/WRT32x 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 Linux kernel sources do not have support for WRT32x. An equivalent patch for these routers has to be sent to OpenWrt.

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

Tested-on: WRT3200ACM, OpenWrt, make dt_binding_check: pass

---
 arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts +6 -0
index 4ab45f294de2..c5f94463ef71 100644
@@ -165,6 +165,12 @@ &sdhci {
 	wp-inverted;
 	bus-width = <8>;
 	status = "okay";
+
+	wifi@1 {
+		compatible = "marvell,sd8897";
+		reg = <1>;
+		marvell,ignore-regulatory-hint;
+	};
 };
 
 &usb3_1_vbus {
Signature · 1 line
2.55.0
#16 lore raw

Re: [PATCH 2/3] ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Missing `#address-cells` and `#size-cells` in the `&sdhci` node causes the `wifi@1` child node's…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing #address-cells and #size-cells in the &sdhci node causes the wifi@1 child node's reg property to be malformed, triggering dtc compilation warnings. --

--- Patch [2]: [PATCH 2/3] ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint --- commit 28267c9e17b352aed9318b01c48207c391929954
Author: Georgi Valkov <[email protected]>

ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

This commit adds the marvell,ignore-regulatory-hint flag to the WRT3200ACM device tree. It creates a new wifi@1 child node within the sdhci node to instruct mwifiex to ignore incorrect regulatory hints from ROM.

arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts &sdhci { · line 171

Quoted 12 lines
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts +4 -0
index 4ab45f294de22..c5f94463ef710 100644
@@ -165,6 +165,12 @@ &sdhci {
 	wp-inverted;
 	bus-width = <8>;
 	status = "okay";
+
+	wifi@1 {
+		compatible = "marvell,sd8897";
+		reg = <1>;

[Severity: Low]
Does the parent &sdhci node need #address-cells = <1>; and #size-cells = <0>; defined so the dtc compiler can correctly parse the reg = <1>; property?

Without these, dtc falls back to default cell sizes, which can cause compilation warnings about invalid property lengths.

Quoted 3 lines
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts +2 -0
+		marvell,ignore-regulatory-hint;
+	};
 };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#17 lore raw

PATCH 3/3 wifi: mwifiex: add dt flag to ignore incorrect ROM regulatory hint

In reply to Georgi Valkov

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.

Implement a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain. This avoids the region conflict and allows the 5 GHz radios to be used.

The change affects only platforms which explicitly define this flag, 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

---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +7 -0
index abc703441c5d..26978158a0ad 100644
@@ -4899,7 +4899,14 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 				country_code =
 					mwifiex_11d_code_2_region(
 						adapter->region_code);
+
+				/* Allow platforms to ignore an incorrect
+				 * regulatory hint from ROM, so userspace
+				 * can set the correct regulatory domain.
+				 */
 				if (country_code &&
+				    !device_property_read_bool(adapter->dev,
+							       "marvell,ignore-regulatory-hint") &&
 				    regulatory_hint(wiphy, country_code))
 					mwifiex_dbg(priv->adapter, ERROR,
 						    "regulatory_hint() failed\n");
Signature · 1 line
2.55.0
#18 lore raw

Re: [PATCH 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

In reply to Georgi Valkov
Quoted 6 lines · Georgi Valkov

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

v1 as reply to v3 in big thread. How tools can parse that?

Does b4 diff work?

b4 diff '[email protected]'

Quoted 5 lines

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.

Quoted 8 lines

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

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

Tested-on: WRT3200ACM, OpenWrt

Not a valid tag, drop. And you cannot even do that, otherwise explain me how did your device execute THIS (exactly THIS) code?

Quoted 1 line

Drop, what is the bug being fixed here?

Anyway, property looks like SW choice. You must describe hardware instead.

Best regards,
Krzysztof

#19 lore raw

Re: [PATCH 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 10 lines · Krzysztof Kozlowski
Quoted 6 lines · Georgi Valkov

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

v1 as reply to v3 in big thread. How tools can parse that?

Hello Krzysztof,
I apologise, I forgot to add the v4 tag to the subject. I have documented the changes between each revision. I saw my mistake after sending the mail. But I wasn't sure what to do? I will make sure to add v5 to my next revision.

Quoted 3 lines

Does b4 diff work?

b4 diff '[email protected]'

What is b4?

Quoted 8 lines
Quoted 8 lines

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.

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

Quoted 6 lines
Quoted 4 lines

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

Tested-on: WRT3200ACM, OpenWrt

Not a valid tag, drop.

I believe the tag is helpful because it describes that my changes have been tested on a certain device and platform. It's a common practice in OpenWrt contributions. My last two accepted patches have this tag. Should I still remove it?

Quoted 2 lines

And you cannot even do that, otherwise explain me how did your device execute THIS (exactly THIS) code?

I am not used to your terminology and this gets me completely confused. You have not quoted any particular code change, so I'm not sure what you are referring to. Here is a summary of the patch series:

Patch 1 documents a new flag: marvell,ignore-regulatory-hint. Patch 2 adds a device-tree node with the radio and the flag. Patch 3 skips the regulatory_hint() call when the flag is set.

Quoted 3 lines
Quoted 1 line

Drop, what is the bug being fixed here?

Without these patch series:
- all 5 GHz radios are unusable and DFS channels do not work

With the fix applied:
- all 5 GHz radios work correctly, the platform is allowed to use the correct regulatory domain for which the device is certified

So this is indeed a bug fix and a very important one too.
I thought the commit description and forum links make this clear enough. I can send more links if you wish, or just search: WRT3200ACM DFS. There are endless conversations and many people looking for a fix.

Quoted 2 lines

Anyway, property looks like SW choice. You must describe hardware instead.

I am sorry, I do not understand what you want me to do? Can you please send a diff or a clear description suitable for people who have way less experience than you?

Georgi Valkov

#20 lore raw

Re: [PATCH 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 18 lines · George Valkov
Quoted 10 lines · Krzysztof Kozlowski
Quoted 6 lines · Georgi Valkov

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

v1 as reply to v3 in big thread. How tools can parse that?

Hello Krzysztof,
I apologise, I forgot to add the v4 tag to the subject. I have documented the changes between each revision. I saw my mistake after sending the mail. But I wasn't sure what to do? I will make sure to add v5 to my next revision.

Quoted 5 lines
Quoted 3 lines

Does b4 diff work?

b4 diff '[email protected]'

What is b4?

Tool used by maintainers and contributors to handle/send patches. See korg docs (or just google "What is b4 Linux kernel").

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

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.

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

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

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Tested-on: WRT3200ACM, OpenWrt

Not a valid tag, drop.

I believe the tag is helpful because it describes that my changes have been tested on a certain device and platform. It's a common practice in OpenWrt contributions. My last two accepted patches have this tag. Should I still remove it?

Drop the tag everywhere and instead on the patches which were possible to be tested mention how did you test it.

Quoted 8 lines
Quoted 4 lines

And you cannot even do that, otherwise explain me how did your device execute THIS (exactly THIS) code?

I am not used to your terminology and this gets me completely confused. You have not quoted any particular code change, so I'm not sure what you are referring to. Here is a summary of the patch series:

Tested means executing or parsing or using the code on the device under test. How can you execute/parse/use this code on the device?

Quoted 4 lines

Patch 1 documents a new flag: marvell,ignore-regulatory-hint. Patch 2 adds a device-tree node with the radio and the flag. Patch 3 skips the regulatory_hint() call when the flag is set.

I can read your patchsets and above does not proof how can you test binding.

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Drop, what is the bug being fixed here?

Best regards,
Krzysztof

#21 lore raw

Re: [PATCH 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 20 lines · Krzysztof Kozlowski
Quoted 18 lines · George Valkov
Quoted 10 lines · Krzysztof Kozlowski
Quoted 6 lines · Georgi Valkov

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

v1 as reply to v3 in big thread. How tools can parse that?

Hello Krzysztof,
I apologise, I forgot to add the v4 tag to the subject. I have documented the changes between each revision. I saw my mistake after sending the mail. But I wasn't sure what to do? I will make sure to add v5 to my next revision.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Does b4 diff work?

b4 diff '[email protected]'

What is b4?

Tool used by maintainers and contributors to handle/send patches. See korg docs (or just google "What is b4 Linux kernel").

Thanks!

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 4 lines

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.

Quoted 8 lines

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

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

Tested-on: WRT3200ACM, OpenWrt

Not a valid tag, drop.

Quoted 7 lines
Quoted 4 lines

I believe the tag is helpful because it describes that my changes have been tested on a certain device and platform. It's a common practice in OpenWrt contributions. My last two accepted patches have this tag. Should I still remove it?

Drop the tag everywhere and instead on the patches which were possible to be tested mention how did you test it.

ok

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

And you cannot even do that, otherwise explain me how did your device execute THIS (exactly THIS) code?

I am not used to your terminology and this gets me completely confused. You have not quoted any particular code change, so I'm not sure what you are referring to. Here is a summary of the patch series:

Tested means executing or parsing or using the code on the device under test. How can you execute/parse/use this code on the device?

Test procedure:
Compile, FLASH and run OpenWrt firmware for WRT3200ACM. This compiles the Linux kernel along with all dts files and drivers.

1. Before the fix
Notice how each radio has its own country:
iw reg get
https://github.com/kaloz/mwlwifi/issues/173#issuecomment-307879699

If the user sets their correct country code, e.g. BG, then global will be set to BG. This conflicts with FR from phy0 and phy1. And also conflicts with phy2 which reports US.
Result: the main radio phy0 does not start.

2. With the fix applied
iw reg get
phy2 does not appear in the list, so there is no conflict with the US region. I can address phy0 and phy1 later in another PR. They need a similar device-tree flag in the board file. The actual driver is not part of Linux. So I'm not sure if there is any place to add documentation?
Result: phy0 and phy2 work. 5 GHz and DFS work.

I also used this test code to confirm that the flag is set:
mwifiex_dbg(adapter, ERROR,

            "[%s][%pfwP] ignore-regulatory-hint %u ++\n",
            dev_name(adapter->dev), dev_fwnode(adapter->dev),
            device_property_read_bool(adapter->dev,
                                      "marvell,ignore-regulatory-hint"));
[   19.927595] mwifiex_sdio mmc0:0001:1:

[mmc0:0001:1][wifi@1] ignore-regulatory-hint 1 ++

Quoted 5 lines
Quoted 3 lines

Patch 1 documents a new flag: marvell,ignore-regulatory-hint. Patch 2 adds a device-tree node with the radio and the flag. Patch 3 skips the regulatory_hint() call when the flag is set.

I can read your patchsets and above does not proof how can you test binding.

Ah, you mean how I tested if the device-tree changes are valid? I have almost no experience with dts. I ran this command before sending v4, and I think it seems fine. Here's a link to the output:
make dt_binding_check
https://httpstorm.com/share/.openwrt/test/2026-08-17_mwifiex/dt_binding_check-01.txt

I have not inspected the output from rebuilding the kernel yet:
make target/linux/{clean,compile} -j 1 V=s
https://httpstorm.com/share/.openwrt/test/2026-08-17_mwifiex/linux-01.txt

Sashiko AI said that #address-cells and #size-cells are missing, so I am currently looking for a way to find the correct values. The radio works without them, but I should address all issues, before sending v5. Please write a list of tests I should run! How can I confirm the values are correct?

Thanks for your help!
Georgi Valkov

#22 lore raw

Re: [PATCH 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 93 lines · George Valkov
Quoted 20 lines · Krzysztof Kozlowski
Quoted 18 lines · George Valkov
Quoted 10 lines · Krzysztof Kozlowski
Quoted 6 lines · Georgi Valkov

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

v1 as reply to v3 in big thread. How tools can parse that?

Hello Krzysztof,
I apologise, I forgot to add the v4 tag to the subject. I have documented the changes between each revision. I saw my mistake after sending the mail. But I wasn't sure what to do? I will make sure to add v5 to my next revision.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Does b4 diff work?

b4 diff '[email protected]'

What is b4?

Tool used by maintainers and contributors to handle/send patches. See korg docs (or just google "What is b4 Linux kernel").

Thanks!

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 4 lines

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.

Quoted 8 lines

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

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

Tested-on: WRT3200ACM, OpenWrt

Not a valid tag, drop.

Quoted 7 lines
Quoted 4 lines

I believe the tag is helpful because it describes that my changes have been tested on a certain device and platform. It's a common practice in OpenWrt contributions. My last two accepted patches have this tag. Should I still remove it?

Drop the tag everywhere and instead on the patches which were possible to be tested mention how did you test it.

ok

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

And you cannot even do that, otherwise explain me how did your device execute THIS (exactly THIS) code?

I am not used to your terminology and this gets me completely confused. You have not quoted any particular code change, so I'm not sure what you are referring to. Here is a summary of the patch series:

Tested means executing or parsing or using the code on the device under test. How can you execute/parse/use this code on the device?

Test procedure:
Compile, FLASH and run OpenWrt firmware for WRT3200ACM. This compiles the Linux kernel along with all dts files and drivers.

1. Before the fix
Notice how each radio has its own country:
iw reg get
https://github.com/kaloz/mwlwifi/issues/173#issuecomment-307879699

If the user sets their correct country code, e.g. BG, then global will be set to BG. This conflicts with FR from phy0 and phy1. And also conflicts with phy2 which reports US.
Result: the main radio phy0 does not start.

2. With the fix applied
iw reg get
phy2 does not appear in the list, so there is no conflict with the US region. I can address phy0 and phy1 later in another PR. They need a similar device-tree flag in the board file. The actual driver is not part of Linux. So I'm not sure if there is any place to add documentation?
Result: phy0 and phy2 work. 5 GHz and DFS work.

I also used this test code to confirm that the flag is set:
mwifiex_dbg(adapter, ERROR,

Quoted 7 lines
            "[%s][%pfwP] ignore-regulatory-hint %u ++\n",
            dev_name(adapter->dev), dev_fwnode(adapter->dev),
            device_property_read_bool(adapter->dev,
                                      "marvell,ignore-regulatory-hint"));
[   19.927595] mwifiex_sdio mmc0:0001:1:

[mmc0:0001:1][wifi@1] ignore-regulatory-hint 1 ++

You are not responding to the actual problem.

In very simple words, like one or two sentences, explain me how this YAML file affected iw reg get?

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Patch 1 documents a new flag: marvell,ignore-regulatory-hint. Patch 2 adds a device-tree node with the radio and the flag. Patch 3 skips the regulatory_hint() call when the flag is set.

Quoted 7 lines
Quoted 1 line

I can read your patchsets and above does not proof how can you test binding.

Ah, you mean how I tested if the device-tree changes are valid? I have almost no experience with dts. I ran this command before sending v4, and I think it seems fine. Here's a link to the output:
make dt_binding_check
https://httpstorm.com/share/.openwrt/test/2026-08-17_mwifiex/dt_binding_check-01.txt

This is a make process, so build stage. Nothing related to testing on DUT.

Building kernel (and running standard tools) is not testing, so I repeat
- do not introduce "tested" statements to commits which is impossible to test by the definition of "tested" in Linux kernel. We discuss all this in this very specific patch, not some other patches.

Best regards,
Krzysztof

#23 lore raw

Re: [PATCH 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 100 lines · Krzysztof Kozlowski
Quoted 98 lines · George Valkov
Quoted 20 lines · Krzysztof Kozlowski
Quoted 18 lines · George Valkov
Quoted 10 lines · Krzysztof Kozlowski
Quoted 6 lines · Georgi Valkov

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

v1 as reply to v3 in big thread. How tools can parse that?

Hello Krzysztof,
I apologise, I forgot to add the v4 tag to the subject. I have documented the changes between each revision. I saw my mistake after sending the mail. But I wasn't sure what to do? I will make sure to add v5 to my next revision.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Does b4 diff work?

b4 diff '[email protected]'

What is b4?

Tool used by maintainers and contributors to handle/send patches. See korg docs (or just google "What is b4 Linux kernel").

Thanks!

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 4 lines

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.

Quoted 8 lines

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

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

Tested-on: WRT3200ACM, OpenWrt

Not a valid tag, drop.

Quoted 7 lines
Quoted 4 lines

I believe the tag is helpful because it describes that my changes have been tested on a certain device and platform. It's a common practice in OpenWrt contributions. My last two accepted patches have this tag. Should I still remove it?

Drop the tag everywhere and instead on the patches which were possible to be tested mention how did you test it.

ok

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

And you cannot even do that, otherwise explain me how did your device execute THIS (exactly THIS) code?

I am not used to your terminology and this gets me completely confused. You have not quoted any particular code change, so I'm not sure what you are referring to. Here is a summary of the patch series:

Tested means executing or parsing or using the code on the device under test. How can you execute/parse/use this code on the device?

Test procedure:
Compile, FLASH and run OpenWrt firmware for WRT3200ACM. This compiles the Linux kernel along with all dts files and drivers.

1. Before the fix
Notice how each radio has its own country:
iw reg get
https://github.com/kaloz/mwlwifi/issues/173#issuecomment-307879699

If the user sets their correct country code, e.g. BG, then global will be set to BG. This conflicts with FR from phy0 and phy1. And also conflicts with phy2 which reports US.
Result: the main radio phy0 does not start.

2. With the fix applied
iw reg get
phy2 does not appear in the list, so there is no conflict with the US region. I can address phy0 and phy1 later in another PR. They need a similar device-tree flag in the board file. The actual driver is not part of Linux. So I'm not sure if there is any place to add documentation?
Result: phy0 and phy2 work. 5 GHz and DFS work.

I also used this test code to confirm that the flag is set:
mwifiex_dbg(adapter, ERROR,

            "[%s][%pfwP] ignore-regulatory-hint %u ++\n",
            dev_name(adapter->dev), dev_fwnode(adapter->dev),
            device_property_read_bool(adapter->dev,
                                      "marvell,ignore-regulatory-hint"));
Quoted 7 lines
Quoted 2 lines
[   19.927595] mwifiex_sdio mmc0:0001:1:

[mmc0:0001:1][wifi@1] ignore-regulatory-hint 1 ++

You are not responding to the actual problem.

In very simple words, like one or two sentences, explain me how this YAML file affected iw reg get?

It does not affect iw reg get.
I was asked to document the flag there, before I use it. Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml

Quoted 12 lines
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

Patch 1 documents a new flag: marvell,ignore-regulatory-hint. Patch 2 adds a device-tree node with the radio and the flag. Patch 3 skips the regulatory_hint() call when the flag is set.

I can read your patchsets and above does not proof how can you test binding.

Ah, you mean how I tested if the device-tree changes are valid? I have almost no experience with dts. I ran this command before sending v4, and I think it seems fine. Here's a link to the output:
make dt_binding_check
https://httpstorm.com/share/.openwrt/test/2026-08-17_mwifiex/dt_binding_check-01.txt

Quoted 6 lines

This is a make process, so build stage. Nothing related to testing on DUT.

Building kernel (and running standard tools) is not testing, so I repeat
- do not introduce "tested" statements to commits which is impossible to test by the definition of "tested" in Linux kernel. We discuss all this in this very specific patch, not some other patches.

ok, I will drop the Tested-on tag for patch 1 and 2. For patch 3, which can be tested, I need to describe how I tested the changes, e.g: iw reg get, and print the flag.

Note taken. Thank you!

Georgi Valkov

#24 lore raw

PATCH v5 1/3 dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

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.

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

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

---
v5:
1. description: remove tag Tested-on
2. add #address-cells = <1>, #size-cells = <0> to fix a warning:
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts:183.3-13:
Warning (reg_format): /soc/internal-regs/sdhci@d8000/wifi@1:reg:
property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)

3. description: add info about testing

v4:
1. Add binding documentation for flag marvell,ignore-regulatory-hint
2. Add dt for sd8897 and move the flag there, I used sample from docs
3. Use device_property_read_bool in the driver

v3:
I implemented and tested a better approach with no board specific code:
1. check for a device-tree flag in mwifiex_register_cfg80211in() !of_property_read_bool(of_root, "marvell,ignore-regulatory-hint")
2. add this flag to the root device tree of each affected board Currently this affects only armada-385-linksys-rango.dts, because Linux has no dts for venom. OpenWrt will take care of that. This approach is more flexible and scalable, because the flag can also be used in other drivers, e.g. mwlwifi (not part of Linux).

v2:
Replace the compatible device names, which are currently only available on OpenWrt with board names which are available on both Linux and OpenWrt.

 .../devicetree/bindings/net/wireless/marvell,sd8787.yaml    | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
index 930b700b73d0..5f235cb9f3e5 100644
@@ -59,6 +59,12 @@ properties:
     description: Calibration data for sub-band 3 in the 5GHz band.
     maxItems: 502
 
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+
   marvell,wakeup-pin:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
Signature · 1 line
2.55.0
#25 lore raw

PATCH v5 2/3 ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

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.

Add a flag marvell,ignore-regulatory-hint to the WRT3200ACM device-tree, which signals mwifiex to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain. The radios in WRT3200ACM/WRT32x 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 Linux kernel sources do not have support for WRT32x. An equivalent patch for these routers has to be sent to OpenWrt.

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

---
 arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts +9 -0
index 4ab45f294de2..b93c5c419962 100644
@@ -165,6 +165,15 @@ &sdhci {
 	wp-inverted;
 	bus-width = <8>;
 	status = "okay";
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	wifi@1 {
+		compatible = "marvell,sd8897";
+		reg = <1>;
+		marvell,ignore-regulatory-hint;
+	};
 };
 
 &usb3_1_vbus {
Signature · 1 line
2.55.0
#26 lore raw

Re: [PATCH v5 2/3] ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The commit adds the device tree property `marvell,ignore-regulatory-hint` to the WRT3200ACM DTS…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit adds the device tree property marvell,ignore-regulatory-hint to the WRT3200ACM DTS, but the corresponding parser and logic in the mwifiex driver is missing from the tree. --

--- Patch [2]: [PATCH v5 2/3] ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint --- commit f221d0ed898a6646fd79f05bc58d44fefe8c2296
Author: Georgi Valkov <[email protected]>

ARM: dts: armada: WRT3200ACM: add marvell,ignore-regulatory-hint

This commit adds the marvell,ignore-regulatory-hint property to the WRT3200ACM device tree. The property signals the mwifiex driver to ignore an incorrect regulatory hint from the ROM, allowing userspace to set the correct platform regulatory domain.

Quoted 6 lines
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts +0 -0
index 4ab45f294de22..b93c5c419962f 100644
@@ -165,6 +165,15 @@ &sdhci {
 	wp-inverted;

arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts &sdhci { · line 175

Quoted 10 lines
arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts +8 -0
 	bus-width = <8>;
 	status = "okay";
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	wifi@1 {
+		compatible = "marvell,sd8897";
+		reg = <1>;
+		marvell,ignore-regulatory-hint;

[Severity: Medium]
Is the corresponding parser and logic for this property missing from the kernel tree?

It doesn't appear there is any support for the marvell,ignore-regulatory-hint property added to wifi@1 in the mainline mwifiex driver. Since the property is not parsed anywhere, the regulatory conflict won't be resolved and the 5 GHz radio will remain restricted when booting with this device tree.

Are there plans to send a companion patch to the wireless tree to actually implement this feature?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#27 lore raw

PATCH v5 3/3 wifi: mwifiex: add dt flag to ignore incorrect ROM regulatory hint

In reply to Georgi Valkov

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.

Implement a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain. This avoids the region conflict and allows the 5 GHz radios to be used.

The change affects only platforms which explicitly define this flag, 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
iw reg get: no longer reports region for phy2

---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +7 -0
index abc703441c5d..26978158a0ad 100644
@@ -4899,7 +4899,14 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 				country_code =
 					mwifiex_11d_code_2_region(
 						adapter->region_code);
+
+				/* Allow platforms to ignore an incorrect
+				 * regulatory hint from ROM, so userspace
+				 * can set the correct regulatory domain.
+				 */
 				if (country_code &&
+				    !device_property_read_bool(adapter->dev,
+							       "marvell,ignore-regulatory-hint") &&
 				    regulatory_hint(wiphy, country_code))
 					mwifiex_dbg(priv->adapter, ERROR,
 						    "regulatory_hint() failed\n");
Signature · 1 line
2.55.0
maintainer
#28 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

In reply to Georgi Valkov

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml properties: · line 67

Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+

Maybe this has been discussed in a previous version of this patch...

What is Marvell specific here? I assume any vendor can mess up, and make a US only device, but ship it elsewhere.

Andrew

#29 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 8 lines · Andrew Lunn

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml properties: · line 67

Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+
Quoted 4 lines

Maybe this has been discussed in a previous version of this patch...

What is Marvell specific here? I assume any vendor can mess up, and make a US only device, but ship it elsewhere.

I don't recall any previous discussion on that topic, other than the use of a root flag in v3, which was objected to, because marvell,ignore-regulatory-hint does not belong there. I assume this is due to the marvell prefix. I guess we can have a generic flag? Implementation instructions, along with good design patterns are warmly welcomed.

I like the idea of implementing a standardised approach, which is scalable to any platform or driver that needs this quirk. I would also like to add this feature to mwlwifi (not part of Linux), because the main radios (88W8964) on WRT3200ACM have a hard-coded region of 98 (non-standard EU, translated to FR because it's the most restrictive). This way I can set my correct region: BG.

In theory it is possible for other vendors to make the same mess. I think the chances are very low, because they would violate regulations. The story with this Linksys router is special:
It was designed and marketed to be OpenWrt compatible. Likely because open-source gives a lot of power they made sure the hands of all users are well tied-up: all radios use proprietary firmware and are locked-down to their certified region in ROM. They do not allow anything related to regions to be set. A third radio 88W8887 using the mwifiex driver was added with the sole purpose to monitor for radars:
this idea was later abandoned. I do not have any information about this choice, but my educated guess is that using a US radio created a conflict and they disabled support for this radio to avoid it.

openwrt-ai:
https://github.com/openwrt/openwrt/pull/24458#pullrequestreview-4956971863
TLDR: It suggests that the compatible string should be marvell,sd8887 instead of marvell,sd8897. The string it suggested is not documented and would need more changes, which I hope to avoid. I prefer keeping things simple. The string I used works and is documented.

Sashiko-bot complained that patch 2 adds a flag to the device-tree, with no support in the driver. Patch 3 adds support in the driver. Let me know if I should reorder them?

Greetings!

Georgi Valkov

#30 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

In reply to Georgi Valkov
Quoted 15 lines · Georgi Valkov

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.

Add a device-tree flag, which allows affected platforms to ignore an incorrect regulatory hint from ROM, so userspace can set the correct platform regulatory domain.

Quoted 5 lines

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

How did you fix the threading problem I mentioned in v3?

Best regards,
Krzysztof

#31 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

In reply to Georgi Valkov
Quoted 6 lines · Georgi Valkov
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +0 -0
index 930b700b73d0..5f235cb9f3e5 100644

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml properties: · line 67

Quoted 9 lines
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
@@ -59,6 +59,12 @@ properties:
     description: Calibration data for sub-band 3 in the 5GHz band.
     maxItems: 502
 
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+

Same comments, so you just ignored entire feedback?

Again: you need to describe the hardware, in commit msg, in property name and in description. You cannot tell SW what to do, that's not the purpose of bindings.

Best regards,
Krzysztof

#32 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 11 lines · Krzysztof Kozlowski
Quoted 9 lines · Georgi Valkov
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +0 -0
index 930b700b73d0..5f235cb9f3e5 100644
@@ -59,6 +59,12 @@ properties:
     description: Calibration data for sub-band 3 in the 5GHz band.
     maxItems: 502
 
Quoted 8 lines

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml properties: · line 67

Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+

Same comments, so you just ignored entire feedback?

Do you mean this feedback? I already replied to it:

Quoted 11 lines
Quoted 2 lines

Anyway, property looks like SW choice. You must describe hardware instead.

I am sorry, I do not understand what you want me to do? Can you please send a diff or a clear description suitable for people who have way less experience than you?

Again: you need to describe the hardware, in commit msg, in property name and in description. You cannot tell SW what to do, that's not the purpose of bindings.

I still don't understand what I should do?
Can you please show me an example of the changes you want? Else I'm likely to make a wrong guess and implement it. That obviously won't help.

The commit message already describes the issue with WRT3200ACM and WRT32x.

About the description, do you want me to do something like this?
description:
Ignore an incorrect regulatory hint from ROM,
so userspace can set the correct regulatory domain.
+ WRT3200ACM and WRT32x are known to need this.

About the property name or flag, do you want me to add a separate flag for each affected hardware device?
- wrt3200acm,ignore-regulatory-hint
- wrt3200x,ignore-regulatory-hint
- the list may grow if someone decides to add other devices
- and the driver will need to support all of them
- that doesn't make sense, because it isn't scalable

Quoted 1 line

How did you fix the threading problem I mentioned in v3?

How can I fix a threading problem?
I don't really know what the correct thing to do is, once I forgot to add a version tag in v4. So I just added v5 in my next submission. I'm new to sending mails using git. So far I've learned that I can do this:
git send-email --thread --in-reply-to=<Message-ID> …
and I use the last Message-ID.

Krzysztof,
I am thankful when I receive criticism from you or anyone else, because this helps improve my PR and it helps me learn. A clear communication along with examples and links to documentation can make this process easier and more productive. Thank you!

Georgi Valkov

#33 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 47 lines · George Valkov
Quoted 11 lines · Krzysztof Kozlowski
Quoted 9 lines · Georgi Valkov
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +0 -0
index 930b700b73d0..5f235cb9f3e5 100644
@@ -59,6 +59,12 @@ properties:
     description: Calibration data for sub-band 3 in the 5GHz band.
     maxItems: 502
 
Quoted 8 lines

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml properties: · line 67

Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+

Same comments, so you just ignored entire feedback?

Do you mean this feedback? I already replied to it:

Quoted 11 lines
Quoted 2 lines

Anyway, property looks like SW choice. You must describe hardware instead.

I am sorry, I do not understand what you want me to do? Can you please send a diff or a clear description suitable for people who have way less experience than you?

Again: you need to describe the hardware, in commit msg, in property name and in description. You cannot tell SW what to do, that's not the purpose of bindings.

I still don't understand what I should do?
Can you please show me an example of the changes you want? Else I'm likely to make a wrong guess and implement it. That obviously won't help.

The commit message already describes the issue with WRT3200ACM and WRT32x.

About the description, do you want me to do something like this?
description:
Ignore an incorrect regulatory hint from ROM,
so userspace can set the correct regulatory domain.
+ WRT3200ACM and WRT32x are known to need this.

Quoted 7 lines

About the property name or flag, do you want me to add a separate flag for each affected hardware device?
- wrt3200acm,ignore-regulatory-hint
- wrt3200x,ignore-regulatory-hint
- the list may grow if someone decides to add other devices
- and the driver will need to support all of them
- that doesn't make sense, because it isn't scalable

You need to describe the actual problem in the hardware or firmware, and then name the property and description accordingly. "Ignore regulatory hint" is clear instruction to the OS what it should do - ignore the wireless-regdb package/instruction etc.

Quoted 9 lines
Quoted 2 lines

How did you fix the threading problem I mentioned in v3?

How can I fix a threading problem?
I don't really know what the correct thing to do is, once I forgot to add a version tag in v4. So I just added v5 in my next submission. I'm new to sending mails using git. So far I've learned that I can do this:
git send-email --thread --in-reply-to=<Message-ID> …
and I use the last Message-ID.

Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets. See also:
https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830

Look how correct thread looks like for v37:
https://lore.kernel.org/linux-devicetree/[email protected]/#r

Look at this v5 thread - it is one huge chain:
https://lore.kernel.org/linux-devicetree/[email protected]/#r

Best regards,
Krzysztof

#34 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 57 lines · Krzysztof Kozlowski
Quoted 47 lines · George Valkov
Quoted 11 lines · Krzysztof Kozlowski
Quoted 9 lines · Georgi Valkov
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +0 -0
index 930b700b73d0..5f235cb9f3e5 100644
@@ -59,6 +59,12 @@ properties:
     description: Calibration data for sub-band 3 in the 5GHz band.
     maxItems: 502
 
Quoted 8 lines

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml properties: · line 67

Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+

Same comments, so you just ignored entire feedback?

Do you mean this feedback? I already replied to it:

Quoted 11 lines
Quoted 2 lines

Anyway, property looks like SW choice. You must describe hardware instead.

I am sorry, I do not understand what you want me to do? Can you please send a diff or a clear description suitable for people who have way less experience than you?

Again: you need to describe the hardware, in commit msg, in property name and in description. You cannot tell SW what to do, that's not the purpose of bindings.

I still don't understand what I should do?
Can you please show me an example of the changes you want? Else I'm likely to make a wrong guess and implement it. That obviously won't help.

The commit message already describes the issue with WRT3200ACM and WRT32x.

About the description, do you want me to do something like this?
description:
Ignore an incorrect regulatory hint from ROM,
so userspace can set the correct regulatory domain.
+ WRT3200ACM and WRT32x are known to need this.

Quoted 7 lines

About the property name or flag, do you want me to add a separate flag for each affected hardware device?
- wrt3200acm,ignore-regulatory-hint
- wrt3200x,ignore-regulatory-hint
- the list may grow if someone decides to add other devices
- and the driver will need to support all of them
- that doesn't make sense, because it isn't scalable

Quoted 4 lines

You need to describe the actual problem in the hardware or firmware, and then name the property and description accordingly. "Ignore regulatory hint" is clear instruction to the OS what it should do - ignore the wireless-regdb package/instruction etc.

You probably have it backwards. The driver is taking the hint from the hardware ROM, which is fixed and thus wrong once someone carries the device to a different country. I.e. it is a quirk saying the _hardware_ region should not be used.

Whether one should override the certified settings, or be able to do that, is a whole different discussion.

ChenYu

Quoted 24 lines
Quoted 9 lines
Quoted 2 lines

How did you fix the threading problem I mentioned in v3?

How can I fix a threading problem?
I don't really know what the correct thing to do is, once I forgot to add a version tag in v4. So I just added v5 in my next submission. I'm new to sending mails using git. So far I've learned that I can do this:
git send-email --thread --in-reply-to=<Message-ID> …
and I use the last Message-ID.

Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets. See also:
https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830

Look how correct thread looks like for v37:
https://lore.kernel.org/linux-devicetree/[email protected]/#r

Look at this v5 thread - it is one huge chain:
https://lore.kernel.org/linux-devicetree/[email protected]/#r

Best regards,
Krzysztof

#35 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 63 lines · Chen-Yu Tsai
Quoted 57 lines · Krzysztof Kozlowski
Quoted 47 lines · George Valkov
Quoted 11 lines · Krzysztof Kozlowski
Quoted 9 lines · Georgi Valkov
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +0 -0
index 930b700b73d0..5f235cb9f3e5 100644
@@ -59,6 +59,12 @@ properties:
     description: Calibration data for sub-band 3 in the 5GHz band.
     maxItems: 502
 
Quoted 8 lines

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml properties: · line 67

Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+

Same comments, so you just ignored entire feedback?

Do you mean this feedback? I already replied to it:

Quoted 11 lines
Quoted 2 lines

Anyway, property looks like SW choice. You must describe hardware instead.

I am sorry, I do not understand what you want me to do? Can you please send a diff or a clear description suitable for people who have way less experience than you?

Again: you need to describe the hardware, in commit msg, in property name and in description. You cannot tell SW what to do, that's not the purpose of bindings.

I still don't understand what I should do?
Can you please show me an example of the changes you want? Else I'm likely to make a wrong guess and implement it. That obviously won't help.

The commit message already describes the issue with WRT3200ACM and WRT32x.

About the description, do you want me to do something like this?
description:
Ignore an incorrect regulatory hint from ROM,
so userspace can set the correct regulatory domain.
+ WRT3200ACM and WRT32x are known to need this.

Quoted 7 lines

About the property name or flag, do you want me to add a separate flag for each affected hardware device?
- wrt3200acm,ignore-regulatory-hint
- wrt3200x,ignore-regulatory-hint
- the list may grow if someone decides to add other devices
- and the driver will need to support all of them
- that doesn't make sense, because it isn't scalable

Quoted 4 lines

You need to describe the actual problem in the hardware or firmware, and then name the property and description accordingly. "Ignore regulatory hint" is clear instruction to the OS what it should do - ignore the wireless-regdb package/instruction etc.

Quoted 8 lines

You probably have it backwards. The driver is taking the hint from the hardware ROM, which is fixed and thus wrong once someone carries the device to a different country. I.e. it is a quirk saying the _hardware_ region should not be used.

Whether one should override the certified settings, or be able to do that, is a whole different discussion.

regulatory-hint for me means usually regdb, but even with your meaning you tell SW what to do - ignore hardware regulatory information. Property should not tell what SW should do with hardware. Property should tell what is happening here in the hardware. In this case: what is the reason behind.

IOW, why user of a board in country X, where regulatory data says X, should have the correct regulatory data ignored?

Best regards,
Krzysztof

#36 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 60 lines · Krzysztof Kozlowski
Quoted 58 lines · Chen-Yu Tsai
Quoted 57 lines · Krzysztof Kozlowski
Quoted 54 lines · George Valkov
Quoted 11 lines · Krzysztof Kozlowski
Quoted 9 lines · Georgi Valkov
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +0 -0
index 930b700b73d0..5f235cb9f3e5 100644
@@ -59,6 +59,12 @@ properties:
     description: Calibration data for sub-band 3 in the 5GHz band.
     maxItems: 502
 
Quoted 8 lines

Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml properties: · line 67

Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/marvell,sd8787.yaml +6 -0
+  marvell,ignore-regulatory-hint:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Ignore an incorrect regulatory hint from ROM,
+      so userspace can set the correct regulatory domain.
+

Same comments, so you just ignored entire feedback?

Do you mean this feedback? I already replied to it:

Quoted 11 lines
Quoted 2 lines

Anyway, property looks like SW choice. You must describe hardware instead.

I am sorry, I do not understand what you want me to do? Can you please send a diff or a clear description suitable for people who have way less experience than you?

Again: you need to describe the hardware, in commit msg, in property name and in description. You cannot tell SW what to do, that's not the purpose of bindings.

I still don't understand what I should do?
Can you please show me an example of the changes you want? Else I'm likely to make a wrong guess and implement it. That obviously won't help.

The commit message already describes the issue with WRT3200ACM and WRT32x.

About the description, do you want me to do something like this?
description:
Ignore an incorrect regulatory hint from ROM,
so userspace can set the correct regulatory domain.
+ WRT3200ACM and WRT32x are known to need this.

About the property name or flag, do you want me to add a separate flag for each affected hardware device?
- wrt3200acm,ignore-regulatory-hint
- wrt3200x,ignore-regulatory-hint
- the list may grow if someone decides to add other devices
- and the driver will need to support all of them
- that doesn't make sense, because it isn't scalable

Quoted 10 lines
Quoted 5 lines
Quoted 4 lines

You need to describe the actual problem in the hardware or firmware, and then name the property and description accordingly. "Ignore regulatory hint" is clear instruction to the OS what it should do - ignore the wireless-regdb package/instruction etc.

ChenYu:

Quoted 4 lines

You probably have it backwards. The driver is taking the hint from the hardware ROM, which is fixed and thus wrong once someone carries the device to a different country. I.e. it is a quirk saying the _hardware_ region should not be used.

Almost. I bought the router in Bulgaria and I am in Bulgaria. The ROM hint is US. More details below.

Krzysztof:

Quoted 8 lines

regulatory-hint for me means usually regdb, but even with your meaning you tell SW what to do - ignore hardware regulatory information. Property should not tell what SW should do with hardware. Property should tell what is happening here in the hardware. In this case: what is the reason behind.

IOW, why user of a board in country X, where regulatory data says X, should have the correct regulatory data ignored?

Because users in X buy a board for X and the regulatory data says U.

Indeed when the ROM regulatory hint is set to US and the driver reports this to the OS, the wireless-regdb restrictions for US are applied. This would normally be fine, however the third radio in WRT3200ACM and WRT32x, reports US on all models including those sold in the EU and other non US markets. This creates a conflict with radios 0 and 1, which report FR and also with my correct setting: BG. With the wireless-regdb restrictions for US, FR and BG applied, radio 0 refuses to start.

Would you approve any of these or suggest a better name for the flag? Should ROM be in upper or lower case?
I omitted 'in-ROM' to keep it short, because the driver check line is already longer than 80 characters.
- marvell,ignore-regulatory-hint (current)
- marvell,ignore-regulatory-hint-in-ROM
- marvell,invalid-regulatory-hint-in-ROM
- marvell,invalid-regulatory-hint
- marvell,invalid-regulatory-ROM
- marvell,invalid-reg-hint-in-ROM

Krzysztof:

Quoted 3 lines

Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets.

I used these flags to keep everything in the same conversation:
--thread --in-reply-to
The documentation states I should always start a new thread for multi-patch series. Note taken. Thank you for the links!

Kind regards,
Georgi Valkov

#37 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 14 lines · George Valkov

Krzysztof:

Quoted 8 lines

regulatory-hint for me means usually regdb, but even with your meaning you tell SW what to do - ignore hardware regulatory information. Property should not tell what SW should do with hardware. Property should tell what is happening here in the hardware. In this case: what is the reason behind.

IOW, why user of a board in country X, where regulatory data says X, should have the correct regulatory data ignored?

Because users in X buy a board for X and the regulatory data says U.

Quoted 8 lines

Indeed when the ROM regulatory hint is set to US and the driver reports this to the OS, the wireless-regdb restrictions for US are applied. This would normally be fine, however the third radio in WRT3200ACM and WRT32x, reports US on all models including those sold in the EU and other non US markets. This creates a conflict with radios 0 and 1, which report FR and also with my correct setting: BG. With the wireless-regdb restrictions for US, FR and BG applied, radio 0 refuses to start.

So if you move with your router to US, you would need to change DTB? IOW, the DTB is per user? This is obviously wrong... What if one device has correct regulatory data written and you ignore it? Why would you ignore it? If you decide to ignore correct regulatory data, then you can as well ignore it unconditionally and this property is not needed.

Quoted 11 lines

Would you approve any of these or suggest a better name for the flag? Should ROM be in upper or lower case?
I omitted 'in-ROM' to keep it short, because the driver check line is already longer than 80 characters.
- marvell,ignore-regulatory-hint (current)
- marvell,ignore-regulatory-hint-in-ROM
- marvell,invalid-regulatory-hint-in-ROM
- marvell,invalid-regulatory-hint
- marvell,invalid-regulatory-ROM
- marvell,invalid-reg-hint-in-ROM

The point is that the regulatory hint is NOT INVALID. One device was sold in US with US data, so how could it be invalid?

Best regards,
Krzysztof

#38 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 25 lines · Krzysztof Kozlowski
Quoted 14 lines · George Valkov

Krzysztof:

Quoted 8 lines

regulatory-hint for me means usually regdb, but even with your meaning you tell SW what to do - ignore hardware regulatory information. Property should not tell what SW should do with hardware. Property should tell what is happening here in the hardware. In this case: what is the reason behind.

IOW, why user of a board in country X, where regulatory data says X, should have the correct regulatory data ignored?

Because users in X buy a board for X and the regulatory data says U.

Quoted 8 lines

Indeed when the ROM regulatory hint is set to US and the driver reports this to the OS, the wireless-regdb restrictions for US are applied. This would normally be fine, however the third radio in WRT3200ACM and WRT32x, reports US on all models including those sold in the EU and other non US markets. This creates a conflict with radios 0 and 1, which report FR and also with my correct setting: BG. With the wireless-regdb restrictions for US, FR and BG applied, radio 0 refuses to start.

Quoted 5 lines

So if you move with your router to US, you would need to change DTB? IOW, the DTB is per user? This is obviously wrong... What if one device has correct regulatory data written and you ignore it? Why would you ignore it? If you decide to ignore correct regulatory data, then you can as well ignore it unconditionally and this property is not needed.

All radios on these devices operate according to their certified region. The firmware for all radios is closed source, locked-down and there is no API to change any regional settings or affect TX power. By design, the regulatory information for this platform is configured from the devinfo partition mtd3:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts?h=v7.2#n106

cat /dev/mtd3
admin1_passphrase=[...]
admin2_passphrase=[...]
cert_region=EU
default_passphrase=[...]
default_ssid=Linksys07770 deviceType=urn:home-linksys-com:device:Router:1 devinfo_version=20160121.1
hw_mac_addr=[...]
hw_revision=1
hw_version=48SAM203.0GA
manufacturer=Linksys, LLC manufacturerURL=http://www.linksys.com manufacturer_date=2017/12/26
mfg_data_version=1
modelDescription=Simultaneous Dual-Band Wireless-AC Gigabit Router modelNumber=WRT3200ACM-EU
serial_number=[...]
sw_version=v1.0.0
tc_passphrase=[...]
tc_ssid=[...]
uuid_key=[...]
wps_device_pin=[...]

The intent of these patch series is not to make the radios operate in a region other than the one they are certified for, that's obviously not possible. As described in the commit description, the goal is to allow the platform to use the correct region, which is stored in the devinfo partition. The hard-coded region in the ROM of radio 2 conflicts with the platform region and should be ignored, otherwise radio 0 and 2 won't even start. And yes this applies to the case where the user bought the device in Europe and has configured their correct country.

With routes that allow the region to be changed, a user can move from EU to US, set the region to US and use their device.
This is not the case with this model. The radios refuse region change so the user should not use it in other regions.
For models sold on the US market, all 3 radios report US. The platform also enforces the US region from the devinfo partition. Even if we ignore the ROM hint from all radios, the platform will still use US. I don't see any regression. My changes are carefully scoped to a particular device which needs them and do not affect any other devices.

Quoted 11 lines
Quoted 10 lines

Would you approve any of these or suggest a better name for the flag? Should ROM be in upper or lower case?
I omitted 'in-ROM' to keep it short, because the driver check line is already longer than 80 characters.
- marvell,ignore-regulatory-hint (current)
- marvell,ignore-regulatory-hint-in-ROM
- marvell,invalid-regulatory-hint-in-ROM
- marvell,invalid-regulatory-hint
- marvell,invalid-regulatory-ROM
- marvell,invalid-reg-hint-in-ROM

Quoted 2 lines

The point is that the regulatory hint is NOT INVALID. One device was sold in US with US data, so how could it be invalid?

US devices have no issues, because all radios report US.
I would love to ask Linksys the same question.
My router was sold in Bulgaria and radio 3 reports US. Others bought it from the UK, DE, etc - same thing. Please allow me some time to install a clean firmware and I will post the output from
iw reg get
so you can see the incorrect regulatory hint and mix of three regions. This will take some time, and I will be left without a working Wi-Fi until I recover using UART.

Georgi Valkov

#39 lore raw

Re: [PATCH v5 1/3] dt-bindings: net: wireless: add flag marvell,ignore-regulatory-hint

Quoted 99 lines · George Valkov
Quoted 25 lines · Krzysztof Kozlowski
Quoted 14 lines · George Valkov

Krzysztof:

Quoted 8 lines

regulatory-hint for me means usually regdb, but even with your meaning you tell SW what to do - ignore hardware regulatory information. Property should not tell what SW should do with hardware. Property should tell what is happening here in the hardware. In this case: what is the reason behind.

IOW, why user of a board in country X, where regulatory data says X, should have the correct regulatory data ignored?

Because users in X buy a board for X and the regulatory data says U.

Quoted 8 lines

Indeed when the ROM regulatory hint is set to US and the driver reports this to the OS, the wireless-regdb restrictions for US are applied. This would normally be fine, however the third radio in WRT3200ACM and WRT32x, reports US on all models including those sold in the EU and other non US markets. This creates a conflict with radios 0 and 1, which report FR and also with my correct setting: BG. With the wireless-regdb restrictions for US, FR and BG applied, radio 0 refuses to start.

Quoted 5 lines

So if you move with your router to US, you would need to change DTB? IOW, the DTB is per user? This is obviously wrong... What if one device has correct regulatory data written and you ignore it? Why would you ignore it? If you decide to ignore correct regulatory data, then you can as well ignore it unconditionally and this property is not needed.

All radios on these devices operate according to their certified region. The firmware for all radios is closed source, locked-down and there is no API to change any regional settings or affect TX power. By design, the regulatory information for this platform is configured from the devinfo partition mtd3:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/marvell/armada-385-linksys-rango.dts?h=v7.2#n106

cat /dev/mtd3
admin1_passphrase=[...]
admin2_passphrase=[...]
cert_region=EU
default_passphrase=[...]
default_ssid=Linksys07770 deviceType=urn:home-linksys-com:device:Router:1 devinfo_version=20160121.1
hw_mac_addr=[...]
hw_revision=1
hw_version=48SAM203.0GA
manufacturer=Linksys, LLC manufacturerURL=http://www.linksys.com manufacturer_date=2017/12/26
mfg_data_version=1
modelDescription=Simultaneous Dual-Band Wireless-AC Gigabit Router modelNumber=WRT3200ACM-EU
serial_number=[...]
sw_version=v1.0.0
tc_passphrase=[...]
tc_ssid=[...]
uuid_key=[...]
wps_device_pin=[...]

The intent of these patch series is not to make the radios operate in a region other than the one they are certified for, that's obviously not possible. As described in the commit description, the goal is to allow the platform to use the correct region, which is stored in the devinfo partition. The hard-coded region in the ROM of radio 2 conflicts with the platform region and should be ignored, otherwise radio 0 and 2 won't even start. And yes this applies to the case where the user bought the device in Europe and has configured their correct country.

With routes that allow the region to be changed, a user can move from EU to US, set the region to US and use their device.
This is not the case with this model. The radios refuse region change so the user should not use it in other regions.
For models sold on the US market, all 3 radios report US. The platform also enforces the US region from the devinfo partition. Even if we ignore the ROM hint from all radios, the platform will still use US. I don't see any regression. My changes are carefully scoped to a particular device which needs them and do not affect any other devices.

Quoted 11 lines
Quoted 10 lines

Would you approve any of these or suggest a better name for the flag? Should ROM be in upper or lower case?
I omitted 'in-ROM' to keep it short, because the driver check line is already longer than 80 characters.
- marvell,ignore-regulatory-hint (current)
- marvell,ignore-regulatory-hint-in-ROM
- marvell,invalid-regulatory-hint-in-ROM
- marvell,invalid-regulatory-hint
- marvell,invalid-regulatory-ROM
- marvell,invalid-reg-hint-in-ROM

Quoted 2 lines

The point is that the regulatory hint is NOT INVALID. One device was sold in US with US data, so how could it be invalid?

Quoted 9 lines

US devices have no issues, because all radios report US.
I would love to ask Linksys the same question.
My router was sold in Bulgaria and radio 3 reports US. Others bought it from the UK, DE, etc - same thing. Please allow me some time to install a clean firmware and I will post the output from
iw reg get
so you can see the incorrect regulatory hint and mix of three regions. This will take some time, and I will be left without a working Wi-Fi until I recover using UART.

iw reg get
global
country 98: DFS-UNSET
(2400 - 2472 @ 40), (N/A, 20), (N/A)
(5150 - 5250 @ 100), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW (5250 - 5350 @ 100), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW (5470 - 5725 @ 160), (N/A, 24), (0 ms), DFS
(5725 - 5730 @ 5), (N/A, 13), (0 ms), DFS
(5730 - 5850 @ 80), (N/A, 13), (N/A)
(5850 - 5875 @ 25), (N/A, 13), (N/A), NO-OUTDOOR, PASSIVE-SCAN (5945 - 6425 @ 320), (N/A, 12), (N/A), NO-OUTDOOR, PASSIVE-SCAN (57240 - 71000 @ 2160), (N/A, 40), (N/A)

phy#2
country US: DFS-FCC
(902 - 904 @ 2), (N/A, 30), (N/A)
(904 - 920 @ 16), (N/A, 30), (N/A)
(920 - 928 @ 8), (N/A, 30), (N/A)
(2400 - 2472 @ 40), (N/A, 30), (N/A)
(5150 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
(5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
(5470 - 5730 @ 160), (N/A, 24), (0 ms), DFS
(5730 - 5850 @ 80), (N/A, 30), (N/A), AUTO-BW
(5850 - 5895 @ 40), (N/A, 27), (N/A), NO-OUTDOOR, AUTO-BW, PASSIVE-SCAN (5925 - 7125 @ 320), (N/A, 12), (N/A), NO-OUTDOOR, PASSIVE-SCAN (57240 - 71000 @ 2160), (N/A, 40), (N/A)

phy#1
country FR: DFS-ETSI
(2400 - 2483 @ 40), (N/A, 20), (N/A)
(5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
(5725 - 5875 @ 80), (N/A, 13), (N/A)
(5945 - 6425 @ 320), (N/A, 23), (N/A), NO-OUTDOOR (57000 - 71000 @ 2160), (N/A, 40), (N/A)

phy#0
country FR: DFS-ETSI
(2400 - 2483 @ 40), (N/A, 20), (N/A)
(5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW (5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
(5725 - 5875 @ 80), (N/A, 13), (N/A)
(5945 - 6425 @ 320), (N/A, 23), (N/A), NO-OUTDOOR (57000 - 71000 @ 2160), (N/A, 40), (N/A)

global: country 98: DFS-UNSET
phy#0: country FR: DFS-ETSI
phy#1: country FR: DFS-ETSI
phy#2: country US: DFS-FCC

- phy0 does not start
- phy1 works
- phy2 works

And my country is set to BG

# /etc/config/wireless
config wifi-device 'radio0'
    option type 'mac80211'
    option path 'soc/soc:pcie/pci0000:00/0000:00:01.0/0000:01:00.0'
    option require_mode 'ac'
    option cell_density '3'
    option legacy_rates '0'
    option htmode 'VHT80'
    option hwmode '11a'
    option country 'BG'
    option channel '100'
    option disabled '0'

Other users report the same:
https://github.com/kaloz/mwlwifi/issues/173#issuecomment-307879699

You can also search: WRT3200ACM DFS, there are endless comments.

Greetings!
Georgi Valkov