rtl8812AU and/or rtl8814AU drivers

@jgrulich Well, the driver is not really new. I downloaded the SDK for armbian and copied over just the sources for the rtl8189fs driver into the openwrt build directory. The result is the same, the driver compiles just fine and then it has the same disconnect issues, there does not seem to be much difference in the the driver sources though. The problem must be somewhere else, e.g. in the mac80211 layer or kernel. Any ideas where to start searching?

$5 on ethtool :slight_smile:

"hostapd can be built with tracing code that will track and analyze memory allocations and other resource registrations and certain API uses. ... The trace code can be enabled with CONFIG_WPA_TRACE=y build option"
https://w1.fi/wpa_supplicant/devel/testing_tools.html

in OpenWrt:
build_dir/target-*/hostapd-full-openssl/hostapd-2018-12-02-c2c6c01b/hostapd/defconfig


# Enable tracing code for developer debugging
# This tracks use of memory allocations and other registrations and reports
# incorrect use with a backtrace of call (or allocation) location.
#CONFIG_WPA_TRACE=y

Update: I can't build with trace code (execinfo.h not exist in openwrt distro)

In file included from ../src/utils/trace.c:16:0:
../src/utils/trace.h:15:10: fatal error: execinfo.h: No such file or directory
 #include <execinfo.h>
          ^~~~~~~~~~~~
compilation terminated.

That only confirmed what I've already wrote before. The driver is quite old, but is not the major issue. I've updated to the latest version from the git, but no difference.
The Linux kernel is not the issue, or at least the result is the same from 4.14.25 to 4.14.101. The major issue is with the mac80211. The latest somehow working version is 2017-11-01 and when upgraded to the 4.18.5 it results into kernel panic. The same result for any 4.19. and it can't be build with the 2017 mac80211 version.
@kestrel Please look into the Armbian SDK and try the mac80211 from there for the OpenWrt compilation. Guess that the most important will be the set of patches, because it probably will use the same source kernel drivers.

@jgrulich Mmh, the interesting part is that net/mac80211 gets compiled at armbian (there are lots of .o files after completing the build), while in the openwrt folder neither in the backports nor in the kernel folder there are any .o files in net/mac80211. There is not even a mac80211.o or .ko in the whole openwrt build tree.

@kestrel exactly the mac80211.ko is not needed for rlt driver itself. It's enough to have cfg80211.ko which is loaded as dependency to 8189fs.ko.

I've tried to use both files from Armbian, but cfg80211.ko need satisfy dependency to rfkill, which is not available in OpenWrt source.
To have compatible kernel, I've tried to use the Armbian's /boot, but even the kernel starts, it halts somewhere and then reboots. But don't know what happens, because there is not output on the serial.
There is only:

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[   43.857279] reboot: Restarting system

Edit. This is the full verbosity output:

[    4.273669] sunxi-mmc 1c10000.mmc: allocated mmc-pwrseq
[    4.509368] sunxi-mmc 1c10000.mmc: initialized, max. request size: 16384 KB
[    4.534267] mmc1: new high speed SDIO card at address 0001
[    4.801465] random: fast init done
[   45.532057] reboot: Restarting system

No idea, what is random function which probably cause system halt.
The reboot is than probably caused by watchdog.

How you did the build, kernel 4.9 is assigned for RPI3 in this git version (8812au required 4.14)

I've used the Armbian kernel and most of the system works well, included the WiFi:

Hostname OpenWrt
Model Xunlong Orange Pi Zero
Architecture ARMv7 Processor rev 5 (v7l)
Firmware Version OpenWrt SNAPSHOT unknown / LuCI Master git-19.046.56017-7f791e9)
Kernel Version 4.19.20-sunxi

Exactly it's running on OPi-R1 board, not Zero.

But there are missing some OpenWrt specific kernel modules which are not available in Armbian and need to be replaced by some Armbian alternative:

root@OpenWrt:~# dmesg | grep "kmodloader: failed to load"
[    9.673861] kmodloader: failed to load rtc-sunxi
[   10.025866] kmodloader: failed to load crc-ccitt
[   10.063430] kmodloader: failed to load nf_conntrack_rtcache
[   10.063720] kmodloader: failed to load nf_flow_table_hw
[   10.068321] kmodloader: failed to load xt_FLOWOFFLOAD

Another, but not so important issue is the LED triggering which omits netdev/wlan0 status which indicates the WiFi working.

@Piorun2002 Yes you right, kernel need to be upgrade to 4.14 on that snapshot or build on master with mac80211 driver from 2017-11-01,you can take at look at my source:

@jgrulich I had a look at the kernel config in openwrt and tried to activate mac80211, after building the kernel I got duplicate symbol problems cfg80211_something during startup. So my guess is, that in armbian, parts of the cfg80211 layer from the net/mac80211 sources is used, but in openwrt the kernel builtin cfg80211 is used, which causes the differences. If I have some time, I will further research that.

Which versions / tags I should download exactly to build openwrt for RPI with 8812au?

@kestrel In fact, fully featured mac80211 is not needed, but only cfg80211, which is only part of it.
Not sure, seems that before version 2017-11-01 the source was standalone modified source inside the openwrt and from 4.18.5 it is from mainline Linux source and there is missing some openwrt compatibility patch for older versions of the drivers.

@Piorun2002 you have to build on master.I uploaded the image file for the RBP with the rtl8812au :
RPI RTL8812au

Careful here, the whole wireless subsystem in OpenWrt is not provided by the kernel (where these Kconfig symbols are disabled), but by an external backports (mac80211) package - third party wireless drivers need to be build against these backports (roughly 4.14 based for 18.06.x (including for targets running kernel 4.9), currently 4.19.x based for master).

Yes, that's correct. The cfg80211 is derived from the backport drivers, the latest is this one:

https://mirrors.edge.kernel.org/pub/linux/kernel/projects/backports/stable/v4.19.23/

The version 2017-11-01 comes from 4.14 backports from here:

https://mirrors.edge.kernel.org/pub/linux/kernel/projects/backports/stable/v4.14-rc2/

and is working for all 4.14 OpenWrt versions included the latest master, but 4.19 is not supported at all by this backport version and OpenWrt patch set need to be updated to bring the latest backports to work with the new drivers.

BTW, what are advantages of backported drivers compared with the mainline sunxi-kernel with all it's patches? As confirmed, wifi is working much better there.

Thx :slight_smile: kernel is 4.14.101 and the 8812au works fine (sta and ap).
How to setup 802.11ac mode or only hwmodes '11a' and '11g' are supported?

root@gw:/# iwinfo wlan0 info
wlan0     ESSID: "XX"
          Access Point: 00:0F:00:xx:xx:xx
          Mode: Master  Channel: 3 (2.422 GHz)
          Tx-Power: 12 dBm  Link Quality: unknown/70
          Signal: unknown  Noise: unknown
          Bit Rate: unknown
          Encryption: WPA2 PSK (CCMP)
          Type: nl80211  HW Mode(s): 802.11abgn
          Hardware: unknown [Generic MAC80211]
          TX power offset: unknown
          Frequency offset: unknown
          Supports VAPs: no  PHY name: phy0
root@gw:/# iwinfo wlan0 htmodelist
HT20 HT40

/etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
#       option channel '36'
#       option hwmode '11a'
       option channel '3'
       option hwmode '11g'
       option htmode 'VHT20'

Update: compilation of TOR client failed, however after upgrade to 3.5.8 is ok

The ac mode is not supported by the backported Generic mac80211 driver now as you see it in your post: HW Mode(s): 802.11abgn

Yesterday I've received important information about the driver support from Hauke Mehrtens: "Hi Jan, I do not plan to invest any more time into the Realtek drivers, they are in the reposetory just to have a backup."
Means that for now the Realtek drivers are working only fro 4.14 kernel and there is no support for 4.19, or 5.00 kernels.

I have now managed to get the rtl8812 driver compiled and running on x86 4.19 and 4.14 kernels only by updating the driver from abperiasamy repo latest commit, so not all issues are related to the mac80211 backports.
here an iperf test:

root@OpenWrt:~# uname -a
Linux OpenWrt 4.19.24 #0 SMP Sat Feb 23 23:58:20 2019 x86_64 GNU/Linux
root@OpenWrt:~# opkg list-installed | grep kmod-rtl8812au-ct
kmod-rtl8812au-ct - 4.19.24+2019-02-21-42f148ce-1
root@OpenWrt:~# opkg list-installed | grep mac80211
kmod-mac80211 - 4.19.24+4.19.23-1-3
root@OpenWrt:~# iwinfo phy0 info
phy0      ESSID: unknown
          Access Point: 18:EB:97:ZF:41:YX
          Mode: Master  Channel: 161 (5.805 GHz)
          Tx-Power: 12 dBm  Link Quality: unknown/70
          Signal: unknown  Noise: unknown
          Bit Rate: unknown
          Encryption: unknown
          Type: nl80211  HW Mode(s): 802.11abgn
          Hardware: unknown [Generic MAC80211]
          TX power offset: unknown
          Frequency offset: unknown
          Supports VAPs: no  PHY name: phy0

root@OpenWrt:~# iperf3 -c 192.168.1.151
Connecting to host 192.168.1.151, port 5201
[  5] local 192.168.1.1 port 60576 connected to 192.168.1.151 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  11.9 MBytes   100 Mbits/sec    0    468 KBytes       
[  5]   1.00-2.00   sec  10.3 MBytes  86.5 Mbits/sec    0    494 KBytes       
[  5]   2.00-3.00   sec  10.4 MBytes  87.6 Mbits/sec    0    519 KBytes       
[  5]   3.00-4.00   sec  10.7 MBytes  89.7 Mbits/sec    0    547 KBytes       
[  5]   4.00-5.00   sec  10.4 MBytes  87.6 Mbits/sec    0    581 KBytes       
[  5]   5.00-6.00   sec  9.63 MBytes  80.8 Mbits/sec    0    581 KBytes       
[  5]   6.00-7.00   sec  9.82 MBytes  82.4 Mbits/sec    0    581 KBytes       
[  5]   7.00-8.00   sec  10.8 MBytes  90.6 Mbits/sec    0    581 KBytes       
[  5]   8.00-9.00   sec  9.77 MBytes  82.1 Mbits/sec    0    819 KBytes       
[  5]   9.00-10.00  sec  10.0 MBytes  83.9 Mbits/sec    0    819 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   104 MBytes  87.1 Mbits/sec    0             sender
[  5]   0.00-10.00  sec   101 MBytes  84.9 Mbits/sec                  receiver

iperf Done.

1 Like

Did you try driver 5.2.20.2 https://github.com/gordboy/rtl8812au

Works fine with 5.0-rc2 kernel. Source now builds with no warnings or errors.

Greatly improved stability due to huge rewrite of phydm - "4 second glitch" seems to have been fixed, or at least vastly reduced, in driver version 5.2.20.2.