kaloz / mwlwifi

mac80211 driver for the Marvell 88W8864 802.11ac chip
395 stars 119 forks source link

Keep phy2 and radio2 with Linksys WRT 3200ACM European version on 160Mhz and DTS #280

Open p3x-robot opened 6 years ago

p3x-robot commented 6 years ago

Hello @yuhhaurlin !

How are you today?

This is something, I found and this is what is weird for me, given it is the latest LEDE 17.01.4 and your latest driver: Mar 6 19:37:11 192.168.78.1 digi.router hostapd: ACS: Only VHT20/40/80 is supported now

Ok, I found, I had to change the channel instead auto to 100 or 120 as sad in https://github.com/kaloz/mwlwifi/issues/226#issuecomment-338160144 by @BrainSlayer for Europe...

But, I still have a question. :1234:

My wifi /etc/config/wireless:

config wifi-device 'radio0'
    option type 'mac80211'
    option hwmode '11a'
    option path 'soc/soc:pcie-controller/pci0000:00/0000:00:01.0/0000:01:00.0'
    option channel 'auto'
    option country 'FR'
    option htmode 'VHT80'

config wifi-iface 'default_radio0'
    option device 'radio0'
    option network 'lan'
    option mode 'ap'
    option ssid 'patrikx3-digi'
    option encryption 'psk2+ccmp'
    option key '12345678'
    option wps_pushbutton '0'

config wifi-device 'radio1'
    option type 'mac80211'
    option hwmode '11g'
    option path 'soc/soc:pcie-controller/pci0000:00/0000:00:02.0/0000:02:00.0'
    option channel '1'
    option htmode 'HT20'
    option txpower '20'

config wifi-iface 'default_radio1'
    option device 'radio1'
    option network 'lan'
    option mode 'ap'
    option ssid 'patrikx3-digi-slow'
    option key '12345678'
    option encryption 'psk2+ccmp'
    option wps_pushbutton '1'

More info

For the next build I will wish to keep the phy2 (and the radio2 and because phy2 is fixed, I just fix it with the Europan router with this option in the radio2 and remove the option country from the radio0 and radio1:

config wifi-device 'radio1' or 'radio0'
    option country 'FR' # will remove this

Like this mwlwifi should let mwlwifi set it for you...

I found in the README.md that I can keep kmod-mwifiex-sdio and mwifiex-sdio-firmware, given I do not change the radio0, radio1 and because the phy2 is always US I could change to my router FR and it would work.

Do you have and idea what it could be or once phy2 is configured right, is it will work?

In one of your issue comment https://github.com/kaloz/mwlwifi/issues/185#issuecomment-363929704 you said, it might work with disable the option country for radio0 and radio1 and given radio2 is always US, I try to fix it with this option country 'FR' like:

config wifi-device 'radio2'
    option country 'FR'

What do you think master?

Thanks so much!

Patrik

BeNeE25 commented 3 years ago

Same for me. I just edit mwifiex-sdio according to eduperez's advice and it work fine. But normally, 160 Mhz is only working for channel 100 to 140 and channel selected is 36 (auto). I do not understand why... Somebody has an idea? Not really important because only my pc supports 160 Mhz...

FCS001FCS commented 3 years ago

iw dev phy#1 Interface wlan1-1 ifindex 32 wdev 0x100000008 addr 62:38:e0:b9:0a:d8 ssid WLAN1 type AP channel 4 (2427 MHz), width: 20 MHz, center1: 2427 MHz txpower 20.00 dBm Interface wlan1 ifindex 31 wdev 0x100000007 addr 60:38:e0:b9:0a:d9 ssid WLAN2 type AP channel 4 (2427 MHz), width: 20 MHz, center1: 2427 MHz txpower 20.00 dBm phy#0 Interface wlan0 ifindex 28 wdev 0x8 addr 60:38:e0:b9:0a:da ssid WLAN5 type AP channel 100 (5500 MHz), width: 80 MHz, center1: 5530 MHz txpower 26.00 dBm

@dr-ni - Something is still not correct with your setup. Your "iw reg get" is the same as mine but your "iw dev" is missing the "phy#2" radio. BTW - In mine the "txpower" has always been at "0.00 dbm" but it does work fine except the third radio "phy#2" will rarely stop and it needs a re-boot to get going again.

My "iw dev":


OpenWrt 19.07.6, r11278-8055e38794

root@xxxxxxxxxxxxxx:~# iw dev phy#2 Interface wlan2 ifindex 10 wdev 0x200000001 addr xx:xx:xx:xx:xx:e3 ssid N_xxxxxxxxxxxxx_2.4GHz type AP channel 11 (2462 MHz), width: 20 MHz, center1: 2462 MHz txpower 0.00 dBm phy#1 Interface wlan1 ifindex 12 wdev 0x100000002 addr xx:xx:xx:xx:xx:e1 ssid xxxxxxxxxxxxx_2.4GHz type AP channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz txpower 20.00 dBm phy#0 Interface wlan0 ifindex 11 wdev 0x2 addr xx:xx:xx:xx:xx:e2 ssid xxxxxxxxxxxxx_5GHz type AP channel 100 (5500 MHz), width: 80 MHz, center1: 5530 MHz txpower 26.00 dBm`

eduperez commented 3 years ago

Same for me. I just edit mwifiex-sdio according to eduperez's advice and it work fine. But normally, 160 Mhz is only working for channel 100 to 140 and channel selected is 36 (auto). I do not understand why... Somebody has an idea? Not really important because only my pc supports 160 Mhz...

Same here...but lower channels are more used around here, so want to use higher channels anyway.

httpstorm commented 3 years ago

I am not sure if regulations permit 160 MHz on the low channels. Technically it is possible to enable this, however db.txt does not list 160 MHz modes on lower channels.

httpstorm commented 3 years ago

I am getting 920 Mbit/s down, 820 Mbit/s up using my modifications. WRT3200 ch 100, 160 MHz. Note that my laptop MBP2019 16" only supports 80 MHz. [ 6 GB 132 MB][ 104 MB/s] 59.9 s [592-198560 16087] down, 2 connections [ 5 GB 562 MB][ 94 MB/s] 1:00.3 mm:ss [124-2097152 144728] up, 1 connection http://httpstorm.com/tools/net/g-net-speed/

httpstorm commented 3 years ago

@dr-ni In short: my changes allow you to use features allowed in you region, that would otherwise not work on WRT3200ACM. Please check and follow the local regulations! I disabled reporting of the hard-coded region for both radios, so that the user specified region is honoured. This allows you to use all radios on WRT3200ACM, and enables channels above 100. The other change in db.txt for Bulgaria allows usage of 160 MHz on most channels and also disables DFS (radar detection), but you should check with your local regulations before changing this file. With WRT3200ACM you can't go outside the regulations, because the radio does not allow getting or setting TX power. Hence the values reported in LuCI are not valid. git clone https://github.com/httpstorm/openwrt.git git checkout gvalkov

httpstorm commented 3 years ago

It's around 3 meters away in the same room. Run git log, to find the two important commits. Both have DFS in their names. Optionally reverted to network switch will let you rearrange the ports. You can git checkout a commit hash, and then git format-patch -1 to export it.

lantis1008 commented 3 years ago

Surely you could move this to a more private chat now that it is drifting away from the core topic? I am subscribed to this topic for significant movement (as hopeless as that may be).

httpstorm commented 3 years ago

@dr-ni There are only a few commits on branch gvalkov, you need these: DFS-free radio, DFS free wireless-regdb Linksys firmware source code: https://www.linksys.com/us/support-article?articleNum=114663

@lantis1008 You are right, yet as far as I know there are no private messages on Github, and I had not been invited to help over another platform. We can perhaps use Skype? With my changes to the drivers, you can keep all radios and use 160 MHz.

lantis1008 commented 3 years ago

A fools endeavour to get anything from the stock firmware in my opinion. You're swapping an open driver/closed firmware for a closed driver/closed firmware. That's a step in the wrong direction :)

Discussions on the patches and how to make radio2 work and country codes play nice is on topic. How fast does your perform? Was your laptop upside down and was the moon shining when you did the test is not. That's performance questions and wand waving. Thats my point. Take it or leave it I don't care, but Im just getting tired of the email updates that mean nothing to me. That's my problem, but I'm asking if you guys would take it elsewhere. I'm not directing anything, I have no power here, just asking :) If the topic circles back to some radical discovery, would be glad to get another email.

Anyway, carry on.

httpstorm commented 3 years ago

Analysing the OpenWRT driver took me a few days. I figured that TX power cannot be changed and the easiest way to fix the country restrictions is to return an error when asked about the hard-coded region. Here is how it works:

  1. OpenWRT queries all drivers for a hard coded region.
  2. In theory they should return the same region and the router should work happily preventing the user from setting anything else.
  3. Linksys did something very bad: radio 0 and 1 are set to EU, which a driver hack reports as FR, since EU is not defined in db.txt. Radio 2 returns US.
  4. OpenWRT doesn't like mixing regions and to be on the safe side permits only the common minimum allowed by all regions, and further disallows usage of DFS channels, so 100+ do not work, and no 160 MHz.
  5. After my changes to the drivers, querying the region returns an error, so OpenWRT thinks the hardware is region free and honours the user specified setting. Usage of these changes is fine, as longs as the correct region is selected.
  6. Changes to db.txt are grey matter. With WRT3200ACM it is not possible to go outside regulations, since TX power cannot be set. So there is the benefit of not waiting 5 minutes for DFS scanning, and the radio starts instantly. Metrological stations have long since abandoned the 5 GHz band, and not updating the regulations to remove DFS only hurts users. Still users must make sure local regulations are followed.

About the Linksys source code: I have not checked the implementation, but there are three possible options (pure guess):

  1. The system allows the user to override the region.
  2. Drivers do not report region.
  3. Radio 2 was designed to perform background scans for radars, but later remained unused. Makes me wonder if they disabled it after realising that mixing radios from different regions won't work.

With the original firmware, there is a 5 minute delay before starting radio on a DFS channel for the first time. Then if I remember correctly, the router remembers the scan result and starts without a delay.

I hope this shines some light as to why WRT3200ACM does not work as users would expect, and why people remove radio 2 to get things working. You can thank Linksys for mixing radios designed for different regions in the same device. One could argue that having a US region radio operating in EU would be illegal. To my knowledge, the only way users can set their valid region is by hacking the driver.

@dr-ni @lantis1008 I think his idea is to understand how and why things work in the official firmware. This might bring important light on the topic. That's the reason I don't use e-mail notifications. I check GitHub periodically and it tells me if updates are available. I know your pain, and I'm sorry!

httpstorm commented 3 years ago

@dr-ni

dr-ni commented 3 years ago

I've removed now everything from this issue so that everybody can be happy here waiting for improvements without any noise. However, don't forget that github is an open source development platform. Issues should be used for reporting problems and discussions - not for silent version tracking :-(

AcThPaU commented 3 years ago

@httpstorm

Nice work ! Your patch is amazing and by all right should be included in the official build. However I lack the experience for building image. Could you please provide a short instruction on how to include your patch when building from official repo ?

httpstorm commented 3 years ago

Hello @AcThPaU !

You can build my fork:

git clone https://github.com/httpstorm/openwrt.git
cd openwrt
git checkout gvalkov
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make menuconfig
make -j 16

Or you can export the patch and then import it on top of the official sources

# list commits
git log

# export a patch
git format-patch commit-hash
# integrate a patch on top of the official sources
git clone https://github.com/openwrt/openwrt.git
cd openwrt

# create a branch
git checkout -b gvalkov

# apply a patch
git am --signoff < patch_name.patch
httpstorm commented 3 years ago

Indeed my patch https://github.com/httpstorm/openwrt/commit/677fef0ffb9971993d1cc11c10469bf777a26771 is necessary for the radios on WRT3200 to work properly on 5 GHz. So you are more than welcome to bring it to the attention of @kaloz @nbd @hauke or the rest of the OpenWRT maintainers. If they accept it, we can integrate my changes to master. The reason I have not attempted to make a pull request is because I am not sure if it will be accepted.