Mt76 driver - replacement [for test]

Hi, Because of bad stability of open source drivers (mt76), and more free time, I tried to do a build of official Mediatek driver for MT7612E, with support for cfg80211 (fullmac driver)

All these was ported to OpenWRT 19.07.2, but currently I do not have free device for test. Could someone help me to test some basic things:

  • if module loads
  • if radio is detected by iw
  • if it is able to work with hostapd and start open network
  • if it is able to setup wpa2 ap
  • if it is able to run vap.

I attach a kernel module for test, it should run on 19.07.2 OpenWRT for mt7621 cpu.

link to rlt_wifi.ko https://easyupload.io/cv56ew

How to load:

modprobe cfg80211
insmod rlt_wifi.ko

1 Like

days ago I tried to compile an image for netgear r6260, with mt7603 open driver and mt7615 with mediatek drivers closed, the packages were compiled correctly but I was unable to operate the mt7615 radio. do you also have some mt7615.ko?
not sure about all the package needed for closed mediatek driver to work.

Yes, possibly. But I am currently unsure about configuration. If you test it, could you specify your configuration (what is first, second and third radio on your platform - I need the offsets for configuration for each hw, stored in flash)

i have no idea i have try with mtk plugin, uci2dat, wificonf, nothing work, i can see the radio ra0 in mtk plugin, but don't work, i remember that the mac address of the radio was 00:00:00:00:00:00 all zero, from mtk plugin the radio looks up, but my devices cannot see the ssid. mabie my problem is that the offsets, how i can check that?
device is netgear r6260.
my device have only two radio mt7603 and mt7615, mt7603 i compiled with open driver, mt7615 with closed mtk driver. i used the defaul configuration for mt7615 radio, just enabled it by clicking reload.

i also flashad an r6350 immage 19.07.1 to my r6260 because the kernel is 4,14.167, i used the nossiac .ko for kernel 4,14.167 and even that have not worked for me.

/usr/lib/lua/luci/template.lua:97: Failed to execute template 'admin_mtk/mtk_wifi_dev_cfg'.
A runtime error occurred: /usr/lib/lua/mtkwifi.lua:491: Interrupted system call
stack traceback:
	[C]: in function '(for generator)'
	/usr/lib/lua/mtkwifi.lua:491: in function 'search_dev_and_profile_orig'
	/usr/lib/lua/mtkwifi.lua:553: in function 'search_dev_and_profile'
	/usr/lib/lua/mtkwifi.lua:674: in function 'get_all_devs'
	[string "/usr/lib/lua/luci/view/admin_mtk/mtk_wifi_d..."]:7: in main chunk
stack traceback:
	[C]: in function 'error'
	/usr/lib/lua/luci/template.lua:97: in function 
	(tail call): ?
	/usr/lib/lua/luci/dispatcher.lua:924: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:441: in function 

some help with this? i do not understand

Hi again,

My idea is to use just raw OpenWRT without mediatek modifications (luci); my work is to use existing 802.11 stack, but with mediatek driver.

I post driver to mt7603, to tests:
https://easyupload.io/bzuwtf

Instructions:

  • use OpenWRT 19.07.2 - module is compiled for only 19.07.2 release
  • unload existing drivers and erase wireless configurations
  • load only cfg80211 module
  • load this module from link
  • OpenWRT should detect mt7603 and I wait for tests

this is really drive me crazy i cannot make it work, i cannot test it on 19.07.2 no immag3e for my device. i wan try to make mt7615 to work.

@bricco1981 Please try it: https://easyupload.io/dhyuaw

I should have mt7615 router within 1-2 month

is that for current snapshot kernel?

No, only for 19.07.2 official images.

i cannot test it, no 19.07.2 immage for my device, only snapshot or selfcompile

How did you compile that, which sources?
I would really like to compile it for Linux-5.4 if possible.

mt7615 has simple option to enable cfg80211 support. Just a few patches are needed to make it work.

mt7603 is much harder, anyway one old branch https://github.com/atvcaptain/mt7603u has support for cfg80211. This requires heavier patching, but manages to compile.

I will try to port newer mt7603 (4.1.2.0) in case of such modification works.

thanks @lukasz92! I briefly looked over the ´Makefile, how did you manage to build the mt7615 module?

Hello, I am ready to help here, unfortunately I cannot download the files, the link is down...

https://filebin.net/c4rwpefg6xd3xaf5 - only for 19.07.2

Hi lukasz92

After reading some of your posts about mediatek drivers
Can you help me clarify some things, if I have understood correctly:

There is source published by mediatek itself for mt7603, mt7615 drivers.
But the drivers used in openwrt are not the official ones but open source drivers recreated from scratch with the released sourcecode?

So these drivers here https://github.com/Nossiac/mtk-openwrt-feeds, are built from official sources but need special scripts (uci2dat, wificonf) to be used with openwrt, but the ones you posted (also built from official source) come with special patches to enable cfg80211 support so that these drivers can be loaded directly without the helper scripts?

Hi,

Nossiac has built mediatek drivers (similar to official), with some differences. They can be driven by some config files and IOCTL calls. They are not compatible with cfg80211/mac80211 subsystem, that's why they need custom scripts on OpenWRT.

Some of these sources leaked, you can find them on github. I am not sure about license status.

Almost all of official Mediatek drivers do not support cfg80211, but some of them have included headers and source code referencing to cfg80211 subsystem. As cfg80211 subsystem changes often, some effort is needed (especially with mt7603 driver) to successfully compile.

Anyway enabling this source code (flags in Kconfig), makes driver dependent of cfg80211 kernel module and allows hardware to be controlled by cfg80211 subsystem.

In theory, OpenWRT fully works with such drivers (one example is brcmfmac, other is mwlwifi). mt7603 driver registers as a FullMAC driver, with mac actually implemented inside driver. mt7615 driver registers as a FullMAC driver, but I am not sure how much is done on hardware/firmware.

First, I want to check if the driver works - that's why I uploaded my compilation. If it works, I could share a source code. If not, I will know that the source code is useless (and could explain why Mediatek never included support for cfg80211).

Drivers used in OpenWRT are written from scratch. I see that nbd168 even tried to modify official driver (mt76x2), there is a repo here https://github.com/openwrt/mtk-wifi-gpl/commits/master .
In theory these drivers (https://github.com/openwrt/mt76) have much better source code, are less complicated and developed for many years. But they are also bugged, and developers prefer to include crappy support for newer devices than provide at least one stable hardware support. Even MT7612 chipsets have problems with mt76 driver, while it is being developed for more than 5 years - just look https://github.com/openwrt/mt76/issues here.

hi i unloaded the two kmod for mt7603 and mt7615, and loaded your modules, the module load but the radios are not working. where the 'wireless' setting are stored? still the same under /etc/config/wireless? also in luci no config are present for channel, txporer, the basic config are missing.
if i delete wireless config, in luci no wireless setting are present at all.
this is on 19.07.2
some help?

Coukd you show output of command:
iw phy