MT76 precompiled drivers (mediatek wifi is useless in MT7628)

this repo is a lede/openwrt feeds. you can put a new line into "feeds.conf.default":
src-git mtk https://github.com/Nossiac/mtk-openwrt-feeds;lede-17.01
then:
scripts/feeds update -f mtk
scripts/feeds install -a -p mtk
now you will be able to see the packages appear in make menuconfig -> MTK properties

1 Like

Thank you. For sure I will have a closer look at the Luci Add-on.

But sofar I noticed you build the .ko files for the 4.4.x kernel and you need to update it for every new version. The MT76xx is using kernel 4.9.x already so on newer builds it will not work.

The same is for replacing the “build-in” driver for this one. I was looking into getting the cfg80211 to work, but it conflicts with the mac80211 module. If you remove that one, it still won’t work since it needs to have the cfg80211 kernel module “inside” the kernel otherwise it was missing exported symbols.

So if you are willing to make this driver for every Lede kernel version, or at least all the stable builds, I think it could be worth it for some people.

all mtk's proprietary wifi drivers are full-mac, which means they don't use cfg80211/mac80211 at all. packets are delievered from driver to network stack directly. cfg80211 support is partially implemented in some drivers, but not well accepted.

that repo is an experimental project, intent to help geeks and small startups to use mtk's chips. i think it's reasonable to build those drivers for all stable versions.

if kernel version changes frequently, maybe an autobuild server will be setup for it.

I was actually hoping to get the cfg80211 code working or to modify that code to use mac80211 and get better integration with a “modern “ system. You are not the first to tell me I’m crazy to even look into that.

Without the cfg80211-support there are not that many patches left for the driver to compile. I would love me to have a look at your patches to compare with my own. I understand you can’t/won’t publish them, but maybe you could share them via PM for me to learn.

Those interested in a benchmark I did a few months ago with the MT76 driver at that time: Bechmark results between MT76 open source and "stock" Mediatek on MT7612e and MT7603e

I didn’t do anything testing on range, but that would be interesting to see if “coverage” is indeed different as stated in the post above.

sorry that i'm not going to publish those patches. exposing the source code is against mtk's policy. I also noticed some guy had uploaded the full source to github, hmm, that's at least not respectiful ......

long time ago, mtk do released a gpl licenced driver to openwrt developers, which was the origin of current mt76 project. cfg80211 was partially implemented in that driver, i guess. you can find it here https://github.com/openwrt/mtk-wifi-gpl.

even though the mt76 driver still suffers from stability and performance problems, we still have faith in it. i think seldom people would consider adding new feature into mtk's proprietary drivers, not just because of lacking actual motivation, but also the enormous diffculties you are going to run into ....

sorry that i’m not going to publish those patches. exposing the source code is against mtk’s policy. I also noticed some guy had uploaded the full source to github, hmm, that’s at least not respectiful

I didn’t ask for the source code just for the patches to learn how other people are doing it. I managed by myself, but I’m sure it could be better (smarter). Just trying to figure out all the changes in different kernel versions was a challenge.

As for the source code: if they don’t release a working driver under GPL but they are selling the chips, what do they expect? They can’t sell hardware without software support.

the patchwork was mainly about

  1. a package makefile to build the driver as a openwrt kmod pacakge.
  2. a config.in file to generate proper kernel config for the driver.
  3. fix some build errors due to obsoleted kernel api.
  4. replace gpl api ( especially mtd read/write ) with request_firmware.

not very smart as you expected.

if you are still interested, let's discuss it at gist.

1 Like

I am not a C developer so I am not able to improve the code, but I am interested in the patches, especially for the MT7610 chip, which is currently not supported by the MT76 module.
Thank you.

That's great! Do you have any time estimate when 7628 will be added? Thanks!

I do it in my spare time. so it may not have a stable schedule.
@numero53 yes. 7610 is included, actually full series will be covered in my plan.
@guisenges I have already build 7628 with lede. but i found an issue after some basic tests, need some more time to fix it first.

1 Like

Absolutely wonderful. The power of collaboration can't be denied. Thank you
nossiac.

I can test mt7628 on an 840v4 from Tp-link if need be.

the code was really a mess... now I can understand why mtk denied to open it.

Sheesh - they made a huge mess of things. I have 840v5 running thanks to @robimarko - it also has mt7628 and sadly the same issues as before.

Flashed, worked out of the box with TFTP on my version. Sadly, WiFi keeps presenting the dreaded issues.

Here is wireless config

config wifi-device 'radio0'
option type 'mac80211'
option channel '11'
option hwmode '11g'
option path 'platform/10300000.wmac'
option htmode 'HT20'
option country 'US'
option disabled '0'

config wifi-iface 'default_radio0'
option device 'radio0'
option network 'lan'
option mode 'ap'
option encryption 'psk2'
option key '704F5738DF8E'
option ssid 'HelloThere-TestingNow'

And here is the log when Clients connect

Tue Nov  7 08:30:49 2017 daemon.notice hostapd: wlan0: AP-ENABLED 
Tue Nov  7 08:31:14 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: authenticated
Tue Nov  7 08:31:14 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: associated (aid 1)
Tue Nov  7 08:31:14 2017 daemon.notice hostapd: wlan0: AP-STA-POSSIBLE-PSK-MISMATCH 74:8d:08:1b:61:f1
Tue Nov  7 08:31:15 2017 daemon.notice hostapd: wlan0: AP-STA-POSSIBLE-PSK-MISMATCH 74:8d:08:1b:61:f1
Tue Nov  7 08:31:16 2017 daemon.notice hostapd: wlan0: AP-STA-POSSIBLE-PSK-MISMATCH 74:8d:08:1b:61:f1
Tue Nov  7 08:31:17 2017 daemon.notice hostapd: wlan0: AP-STA-POSSIBLE-PSK-MISMATCH 74:8d:08:1b:61:f1
Tue Nov  7 08:31:23 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: deauthenticated due to local deauth request
Tue Nov  7 08:31:38 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: authenticated
Tue Nov  7 08:31:38 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: associated (aid 1)
Tue Nov  7 08:31:38 2017 daemon.notice hostapd: wlan0: AP-STA-CONNECTED 74:8d:08:1b:61:f1
Tue Nov  7 08:31:38 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 WPA: pairwise key handshake completed (RSN)
Tue Nov  7 08:36:50 2017 daemon.notice hostapd: wlan0: AP-STA-DISCONNECTED 74:8d:08:1b:61:f1
Tue Nov  7 08:36:50 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: disassociated
Tue Nov  7 08:36:51 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE)
Tue Nov  7 08:36:52 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: authenticated
Tue Nov  7 08:36:52 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 IEEE 802.11: associated (aid 1)
Tue Nov  7 08:36:52 2017 daemon.notice hostapd: wlan0: AP-STA-CONNECTED 74:8d:08:1b:61:f1
Tue Nov  7 08:36:52 2017 daemon.info hostapd: wlan0: STA 74:8d:08:1b:61:f1 WPA: pairwise key handshake completed (RSN)
Tue Nov  7 10:20:12 2017 daemon.info hostapd: wlan0: STA 80:e6:50:06:03:74 IEEE 802.11: authenticated
Tue Nov  7 10:20:13 2017 daemon.info hostapd: wlan0: STA 80:e6:50:06:03:74 IEEE 802.11: associated (aid 2)

I also tried with

uci set wireless.@wifi-iface[0].disassoc_low_ack=0
uci set wireless.@wifi-iface[0].max_inactivity=86401
uci set wireless.@wifi-iface[0].skip_inactivity_poll=1
uci set wireless.@wifi-iface[0].wpa_group_rekey=0
uci commit wireless

and lowering txpower to 20 (I read somewhere it has to do with heat),

Less issues, but very very constant too.

On the other hand, stock 840v4 and 840v5 (MT7628) work fantastic.

Please do for mt7603, until it bores you ...

What is the current status of mt7628 working? not working?

I noticed that you committed about it 10 days ago.

Thanks a lot for your work!

PS: I noticed that unfortunately mt7628 was not compiled for Lede stable version (kernel 4.9.92).

PS2:

I also noticed some guy had uploaded the full source to github, hmm, that’s at least not respectiful …

It's at least not respectfull from Mediatek to use GPL software without complying to the GPL, and to sell hardware without software support so...

I've compiled lede 17.01 form source and added your mt7628 driver for 4.4.102 I get the kernel panic enclosed.

As an afterthough I think it's normal because we don't use the same toolchain (you for your module, and me for my kernel), and modules should be compiled with the exact same compiler as kernel. Isn't it?

[   44.944869] === pAd = c080c000, size = 1292832 ===
[   44.944869] 
[   44.954404] <-- RTMPAllocTxRxRingMemory, Status=0, ErrorValue=0x
[   44.961754] <-- RTMPAllocAdapterBlock, Status=0
[   44.966390] RtmpChipOpsHook(492): Not support for HIF_MT yet!
[   44.972215] mt7628_init()-->
[   44.975148] mt7628_init(FW(8a00), HW(8a01), CHIPID(7628))
[   44.980623] e2.bin mt7628_init(1135)::(2), pChipCap->fw_len(63888)
[   44.986908] mt_bcn_buf_init(218): Not support for HIF_MT yet!
[   44.992733] <--mt7628_init()
[   52.578182] Unhandled kernel unaligned access[#1]:
[   52.583068] CPU: 0 PID: 2200 Comm: dnsmasq Tainted: P                4.4.102 #0
[   52.590485] task: 8297c000 ti: 830d6000 task.ti: 830d6000
[   52.595955] $ 0   : 00000000 7fe461c8 fffffdc9 00000094
[   52.601275] $ 4   : 8028a6d8 00000000 00000000 00000000
[   52.606582] $ 8   : 00000080 830ad1f8 00000000 00000ec9
[   52.611892] $12   : 7fe46108 7fe461a8 00000000 774bc2c0
[   52.617204] $16   : 82801900 81da81ec 00000000 00000001
[   52.622515] $20   : 00000000 833c698c 00000000 00000025
[   52.627821] $24   : 00000000 77421000                  
[   52.633130] $28   : 830d6000 830d7c40 00000014 8028a6e4
[   52.638442] Hi    : 00000000
[   52.641359] Lo    : 00000ec9
[   52.644311] epc   : 8028a388 inet6_dump_addr+0x10c/0x4f0
[   52.649701] ra    : 8028a6e4 inet6_dump_addr+0x468/0x4f0
[   52.655082] Status: 1100a403    KERNEL EXL IE 
[   52.659335] Cause : 00800010 (ExcCode 04)
[   52.663396] BadVA : ffffffa9
[   52.666315] PrId  : 00019655 (MIPS 24KEc)
[   52.670373] Modules linked in: mt7628(P) pppoe ppp_async iptable_nat pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4 ipt_REJECT ipt_MASQUERADE xt_time xt_tcpudp xt_tcpmss xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CLASSIFY slhc nf_reject_ipv4 nf_nat_redirect nf_nat_masquerade_ipv4 nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_rtcache iptable_mangle iptable_filter ipt_ECN ip_tables crc_ccitt sch_fq sch_teql em_nbyte sch_dsmark sch_pie act_ipt sch_gred em_cmp cls_basic sch_prio sch_codel em_text em_meta sch_sfq act_police sch_red act_connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow cls_route cls_fw sch_tbf sch_htb sch_hfsc sch_ingress ledtrig_usbport mac80211 cfg80211 compat ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables x_tables ifb tun leds_gpio ohci_platform ohci_hcd ehci_platform ehci_hcd gpio_button_hotplug usbcore nls_base usb_common [last unloaded: mt76]
[   52.774244] Process dnsmasq (pid: 2200, threadinfo=830d6000, task=8297c000, tls=774bdd48)
[   52.782529] Stack : 8285b2ec 82801900 024000c0 801eb8b8 00000014 00000002 fffffdc9 00000000
      00000000 00000094 8035635c 833c6a04 83802780 00000000 803a4810 00000001
      8028a6d8 00000001 81da8000 82801900 00000f40 81da81ec 00000000 00000000
      00000008 774b6d8c 00000000 80224bec 0a2900c0 800b3d28 00000000 800c01f4
      830d7e90 8348b198 81da8000 830d7d1c 81da8064 82801480 8333c100 802252f8
      ...
[   52.818650] Call Trace:
[   52.821137] [<8028a388>] inet6_dump_addr+0x10c/0x4f0
[   52.826183] [<80224bec>] netlink_dump+0x110/0x2bc
[   52.830957] [<802252f8>] __netlink_dump_start+0xdc/0x188
[   52.836354] [<8020f248>] rtnetlink_rcv_msg+0x160/0x1fc
[   52.841567] [<802272ec>] netlink_rcv_skb+0x7c/0xf8
[   52.846427] [<8020cd88>] rtnetlink_rcv+0x24/0x34
[   52.851112] [<80226b50>] netlink_unicast+0x158/0x240
[   52.856149] [<802270b8>] netlink_sendmsg+0x388/0x3cc
[   52.861194] [<801e1da4>] sock_sendmsg+0x18/0x30
[   52.865795] [<801e3cd8>] SyS_sendto+0xcc/0x120
[   52.870316] [<8000686c>] syscall_common+0x30/0x54
[   52.875081] 
[   52.876588] 
Code: 0002b00b  0000b021  8fa20018 <8c4201e0> 104000d9  00009021  8f830010  24630200  af830010 
[   52.886787] ---[ end trace 17702c6472f69e92 ]---
[   52.894492] Fatal exception: panic in 5 seconds
[   57.904803] Kernel panic - not syncing: Fatal exception
[   57.912051] Rebooting in 3 seconds..

@nossiac: Thanks for these drivers! I use them for a Linkit Smart 7688 device and they seem to perform better than the opensource mt76 driver. I successfully used the ap and station modes, but only using wpa2. I would now like to connect to an EAP network, but I don't understand how to configure this in the .dat configuration file. Do you know if it that's possible using this driver?

Could someone have mt7628 driver working on lede 17.01.4? I get instant kernel panic, with precompiled drivers.

If someone had it working, please explain how.

1 Like