[BPI-R2] internal Wifi/BT (MT6625L) - Kernel

i don’t think so as it is not enabled in my tree after running importconfig…

Yes, I copied and added the sch_fq module for autoloading. And it not work…

Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 4.19.138-bpi-r2 armv7l)
 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

Last login: Wed Sep  9 00:24:54 2020 from 192.168.0.13
root@bpi-r2-ubuntu:~# lsmod
Module                  Size  Used by
ipt_MASQUERADE         16384  5
iptable_nat            16384  1
nf_nat_ipv4            16384  2 ipt_MASQUERADE,iptable_nat
nf_nat                 36864  1 nf_nat_ipv4
nf_conntrack          147456  3 ipt_MASQUERADE,nf_nat_ipv4,nf_nat
nf_defrag_ipv6         20480  1 nf_conntrack
nf_defrag_ipv4         16384  1 nf_conntrack
mtk_thermal            16384  0
thermal_sys            61440  1 mtk_thermal
spi_mt65xx             20480  0
pwm_mediatek           16384  0
mt6577_auxadc          16384  0
mtk_pmic_keys          16384  0
nvmem_mtk_efuse        16384  0
sch_fq_codel           24576  7
sch_fq                 20480  0
ip_tables              24576  1 iptable_nat
x_tables               32768  2 ip_tables,ipt_MASQUERADE
root@bpi-r2-ubuntu:~# tc qdisc show dev ap0
qdisc mq 0: root 
qdisc fq_codel 0: parent :4 limit 3068542532p flows 3068542532 quantum 3068542532 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
qdisc fq_codel 0: parent :3 limit 3068542532p flows 3068542532 quantum 3068542532 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
qdisc fq_codel 0: parent :2 limit 3068542532p flows 3068542532 quantum 3068542532 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
qdisc fq_codel 0: parent :1 limit 3068542532p flows 3068542532 quantum 3068542532 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
root@bpi-r2-ubuntu:~#

You should disable it…it is known to break ap

Oh, I’m sorry, I misunderstood you. Initially, the module sch_fq was disabled, missing from the root, and not loaded into the kernel. Only be sch_fq_codel

You have issues without sch_fq and sch_fq_codel ?

Could you please try only with my defconfig (no additional options)? There i have no problems in 5.4. How much clients are connected and which signal strength? Do you have issues only with much traffic or also in idle?

You should disable both this modules. Fastest and rudest way to see if it works - delete (move) them from your /lib/modules/<your_kernel>/… and reboot

In my case the sch_fq was the root of problem. in this case:

the sch_fq_codel was the reason.

So you shouldn’t use both of them.

I don’t insist :slight_smile: as i said i use my own config for a long time, so i might enable it by myself. I don’t remember.

BTW, you may to add this information to your R2 wiki, at least for me it’s quite useful :slight_smile:

what exactily was the issue? no traffic after a while (how long) or dropping client, no reconnection, …

Yes.

Totally depends on traffic amount, but not so much (e.g. it can work for minutes with ping only, but just a couple of seconds on heavy traffic, like file download. Usually not enought to download a web page) after this traffic “limit” there is no even ping packets seen on ap0 (using tcpdump)

clients drops after a while, no reconnection at least because no dhcp pakets passes throught wlan. I didn’t tested if it works with static ip.

My thought is: there is some traffic shaping/policing mechanism (or very similar) in these schedulers, which depends on some timer, which should reset the I/O packets or bytes counter, but it’s buggy or not implemented (by driver? somwhere else? idk :man_shrugging:) I’m not proficient enought with linux netfilter/tc schedulers, to find it out. May be some long-term project, but i’m absolutely with no deadlines :slight_smile:

P.S. Another question is why these schedulers used by default?

and why they didn’t loaded in your case?

that was in january…if i make importconfig the module is not set

NET_SCH_FQ [=n]

and for driver-support/bug…idk too…driver-code is huge, and i have not seen all, not talking about understanding whats going on there :smiley:

There are also some anomalies, according to fq_codel man pages the default values for limit, flows, and quantum are: 10240, 1024, and 1514 . In previous example the numbers are equal and incredibly large.

@Frorip, any progress on your problem?

P.S. at least two timers seems to be used here: target and interval

Some days ago i’ve enabled a lot of network/tc/netfilter/iptables/nf_tables/etc stuff in my config (r2 is a router, it needs a network related stuff :wink: ) for my actual needs and experimental purposes, so these schedulers (in my kerel) probably was enabled by me :slight_smile:. And i have no idea why they are in kernels of other users (all my R2 kernels compiled my myself). So probably the best advice for all users is to use the latest precompiled kernel (i suppose these schedulers should be disabled). Or to compile it by themselves after double-checking CONFIG_NET_SCH_FQ_CODEL and CONFIG_NET_SCH_FQ options :slight_smile:

and it’s an other person’s code :wink:

I wish i had anyone who knows what the driver does and do a rewrite to a much smaller codebase. But there is nobody…and no documentation. I can only port by compile errors…

Dear @frank-w, @DeadMeat I remove sch_fq_codel module and it works as it should! :smile:

for the same reason, there was no outgoing traffic (I thought the problem was in iptables rules :man_facepalming:)

root@bpi-r2-ubuntu:~# tc qdisc show dev ap0
qdisc mq 0: root 
qdisc pfifo_fast 0: parent :4 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent :3 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent :2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent :1 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
root@bpi-r2-ubuntu:~# lsmod
Module                  Size  Used by
ipt_MASQUERADE         16384  5
iptable_nat            16384  1
nf_nat_ipv4            16384  2 ipt_MASQUERADE,iptable_nat
nf_nat                 36864  1 nf_nat_ipv4
nf_conntrack          147456  3 ipt_MASQUERADE,nf_nat_ipv4,nf_nat
nf_defrag_ipv6         20480  1 nf_conntrack
nf_defrag_ipv4         16384  1 nf_conntrack
mtk_pmic_keys          16384  0
mtk_thermal            16384  0
spi_mt65xx             20480  0
pwm_mediatek           16384  0
nvmem_mtk_efuse        16384  0
thermal_sys            61440  1 mtk_thermal
mt6577_auxadc          16384  0
ip_tables              24576  1 iptable_nat
x_tables               32768  2 ip_tables,ipt_MASQUERADE

But fq_codel is not an extra module, so now you need to configure it correctly…

Without ap0 (ethernet only)? Then it will be interesting if same problem is still in 5.9-rc4

What do you mean with configure correctly? Should do fq_codel it for you?

I didn’t test LAN, Ap0 only. banana Pi has Internet access via WAN.

To work with the module sch_fq_codel :nerd_face:

You have dropped it and it works right? Then it is problem with it. We need to know if it only affects ap0 (so it is wifi-driver incompatibility/bug) or network generic (then problem is in sch_fq_*)

@DeadMeat https://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:wlan#known_issues last subtopic

Hi! The sch_fq_codel module only causes problems with WiFi. The wired connection works fine.

sch_fq_codel Enable

Last login: Fri Sep 11 22:43:51 2020 from 192.168.0.13
root@bpi-r2-ubuntu:~# lsmod
Module                  Size  Used by
ipt_MASQUERADE         16384  7
iptable_nat            16384  1
nf_nat_ipv4            16384  2 ipt_MASQUERADE,iptable_nat
nf_nat                 36864  1 nf_nat_ipv4
nf_conntrack          147456  3 ipt_MASQUERADE,nf_nat_ipv4,nf_nat
nf_defrag_ipv6         20480  1 nf_conntrack
nf_defrag_ipv4         16384  1 nf_conntrack
mtk_thermal            16384  0
thermal_sys            61440  1 mtk_thermal
mt6577_auxadc          16384  0
mtk_pmic_keys          16384  0
spi_mt65xx             20480  0
pwm_mediatek           16384  0
nvmem_mtk_efuse        16384  0
sch_fq_codel           24576  7
ip_tables              24576  1 iptable_nat
x_tables               32768  2 ip_tables,ipt_MASQUERADE
root@bpi-r2-ubuntu:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::2:2ff:fe02:202/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:03:03:03:03:03 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::3:3ff:fe03:303/64 scope link 
       valid_lft forever preferred_lft forever
4: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
5: wan@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 02:03:03:03:03:03 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.11/24 brd 192.168.0.255 scope global wan
       valid_lft forever preferred_lft forever
    inet6 fe80::3:3ff:fe03:303/64 scope link 
       valid_lft forever preferred_lft forever
6: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
7: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
8: lan2@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
9: lan3@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
10: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global br0
       valid_lft forever preferred_lft forever
11: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:08:22:86:c9:fb brd ff:ff:ff:ff:ff:ff
12: ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 02:08:22:86:c9:fb brd ff:ff:ff:ff:ff:ff
    inet 192.168.13.1/24 scope global ap0
       valid_lft forever preferred_lft forever
    inet6 fe80::8:22ff:fe86:c9fb/64 scope link 
       valid_lft forever preferred_lft forever
root@bpi-r2-ubuntu:~# tc qdisc show dev br0
qdisc noqueue 0: root refcnt 3069083204 
root@bpi-r2-ubuntu:~# tc qdisc show dev eth0
qdisc fq_codel 0: root refcnt 3068259908 limit 3068259908p flows 3068259908 quantum 3068259908 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
root@bpi-r2-ubuntu:~# tc qdisc show dev eth1
qdisc fq_codel 0: root refcnt 3068735044 limit 3068735044p flows 3068735044 quantum 3068735044 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
root@bpi-r2-ubuntu:~# tc qdisc show dev lan1
qdisc noqueue 0: root refcnt 3068444228 
root@bpi-r2-ubuntu:~# tc qdisc show dev ap0
qdisc mq 0: root 
qdisc fq_codel 0: parent :4 limit 3068993092p flows 3068993092 quantum 3068993092 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
qdisc fq_codel 0: parent :3 limit 3068993092p flows 3068993092 quantum 3068993092 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
qdisc fq_codel 0: parent :2 limit 3068993092p flows 3068993092 quantum 3068993092 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
qdisc fq_codel 0: parent :1 limit 3068993092p flows 3068993092 quantum 3068993092 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 

sch_fq_codel Disable

root@bpi-r2-ubuntu:~# lsmod
Module                  Size  Used by
ipt_MASQUERADE         16384  7
iptable_nat            16384  1
nf_nat_ipv4            16384  2 ipt_MASQUERADE,iptable_nat
nf_nat                 36864  1 nf_nat_ipv4
nf_conntrack          147456  3 ipt_MASQUERADE,nf_nat_ipv4,nf_nat
nf_defrag_ipv6         20480  1 nf_conntrack
nf_defrag_ipv4         16384  1 nf_conntrack
mtk_thermal            16384  0
thermal_sys            61440  1 mtk_thermal
mtk_pmic_keys          16384  0
mt6577_auxadc          16384  0
spi_mt65xx             20480  0
pwm_mediatek           16384  0
nvmem_mtk_efuse        16384  0
ip_tables              24576  1 iptable_nat
x_tables               32768  2 ip_tables,ipt_MASQUERADE
root@bpi-r2-ubuntu:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::2:2ff:fe02:202/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:03:03:03:03:03 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::3:3ff:fe03:303/64 scope link 
       valid_lft forever preferred_lft forever
4: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
5: wan@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 02:03:03:03:03:03 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.11/24 brd 192.168.0.255 scope global wan
       valid_lft forever preferred_lft forever
    inet6 fe80::3:3ff:fe03:303/64 scope link 
       valid_lft forever preferred_lft forever
6: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
7: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
8: lan2@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
9: lan3@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
10: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::2:2ff:fe02:202/64 scope link 
       valid_lft forever preferred_lft forever
11: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:08:22:f0:cd:fb brd ff:ff:ff:ff:ff:ff
12: ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 02:08:22:f0:cd:fb brd ff:ff:ff:ff:ff:ff
    inet 192.168.13.1/24 scope global ap0
       valid_lft forever preferred_lft forever
    inet6 fe80::8:22ff:fef0:cdfb/64 scope link 
       valid_lft forever preferred_lft forever

Thanks for testing,than it seems to be a bug in wifi-driver,but the values are huge for eth0/lan1/br0 too…so this numbers do not indicating the error. I guess there is any callback function called that breaks functionality,but have no clue where to search

i tried starting ap-mode in 5.10, but it hangs (can login via ssh) and does not create the ap0 interface

root       436  0.0  0.1   6520  2368 ttyS0    Ss   11:57   0:00 /bin/login -p --
root       533  0.0  0.1   4440  2456 ttyS0    S    12:00   0:00  \_ -bash
root       538  0.0  0.1   4188  2336 ttyS0    R+   12:00   0:00      \_ /bin/bash /usr/local/sbin/wifi.sh
root       549  0.0  0.0   9764   456 ttyS0    T+   12:00   0:00          \_ /usr/bin/stp_uart_launcher -p /etc/firmware

in wifi driver-log i came till this point:

[  232.735911] [MTK-WIFI] WIFI_open: WIFI_open: major 155 minor 0 (pid 538)     
[  232.742773] [MTK-WIFI] WIFI_write: WIFI_write A                              
[  232.742773]                                                                  
[  232.791863] kalFirmwareImageMapping firmware size 225840                     
                                                                                
[  233.982856] [MTK-WIFI] register_set_p2p_mode_handler: (pid 544) register set1
[  233.992362] [MTK-WIFI] WIFI_write: WMT turn on WIFI success

i unloaded mt7615-module and it works…seems like any conflict :thinking: maybe because my mt7615 is named wlan0 and mt6625l tries also creating an wlan0 device (additional to the ap0)

correct, i rebooted, enabled dbdc on mt7615 (for other test) and renamed both interfaces

ip link set wlan0 name wlan_2g
ip link set wlan1 name wlan_5g

and then started wifi.sh for internal ap0, works and ip a show this:

9: wlan_2g: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000                                                                                  
    link/ether 00:0a:52:05:c9:e2 brd ff:ff:ff:ff:ff:ff                                                                                                                    
10: wlan_5g: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000                                                                                 
    link/ether 82:0a:52:05:c9:e2 brd ff:ff:ff:ff:ff:ff                                                                                                                    
11: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000                                                                                   
    link/ether 00:08:22:18:bc:03 brd ff:ff:ff:ff:ff:ff                                                                                                                    
12: ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000                                                                             
    link/ether 02:08:22:18:bc:03 brd ff:ff:ff:ff:ff:ff                                                                                                                    
    inet 192.168.18.1/24 scope global ap0                                                                                                                                 
       valid_lft forever preferred_lft forever                                                                                                                            
    inet6 fe80::8:22ff:fe18:bc03/64 scope link                                                                                                                            
       valid_lft forever preferred_lft forever    

so it looks like driver tries to create wlan0 (which failes if interface exists) and/or wait for its creation/driver own…

so if you want to use the internal wifi on r2 (like me), make sure, there is no wlan0 before starting wifi.sh

debugged so far…

rootcause is adding a handler to wrong netdev searched with hardcoded wlan0 in drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/wmt_chrdev_wifi.c

#define WLAN_IFACE_NAME "wlan0"
static INT8 *ifname = WLAN_IFACE_NAME;
netdev = dev_get_by_name(&init_net, ifname);
pf_set_p2p_mode(netdev, p2pmode);

Currently i have no idea how to pass the wifi-devicename created in gl_init.c to wmt_chrdev_wifi.c

I tried to write a get_netdev function which tries wifi9 down to 0,but i get still an error which i need to solve…maybe because i try to set ifname which is a int8 * and no char*