Adding OpenWrt support for Xiaomi AX3600 (Part 1)

@robimarko

I found this file: board-2.bin at Kalle's repo. If you look at it, it contains a lot of board ids in that same file. I also found the one for AX3600/AX6. I wonder, is it possible that for those firmwares we need to compile a board file with the matching id from that file he published? I checked the content and it is slightly different compared to what we extracted from the devices.

Those are the generic BFD-s for reference boards, they should not be used with other boards.
That is why we pull the original one from the stock FW, doesnt matter if the board ID is the same as they reuse those all the time.

ath10k did the same thing.

Hey there!
Although I am pretty much catch up with all the new post on the thread, I was wondering what is the current state of Openwrt's support for AX3600. is there a PR waiting for approval or there is more work to be done?

If there is more work what exactly is still missing?

Thanks!

1 Like

Image can be create and works correct with some problem
WiFi leaks
We need to fix some thing and then we will start to create pr for all the required stuff.

Little time currently so the work slowed down

2 Likes

We're you aware of this repo?

I see that they're using backports but they're fairly recent, don't any of the patches help?

Those patches are pretty much the same as the ones on codeaurora repo

TIP repo for IPQ807x is simply reusing QSDK for everything including the kernel.
Its OpenWrt only on the top.

@robimarko I am testing the AX6 support, and it seems to work fine. Though I let you know. @castiel652 did a good job.

Not sure if it's helpful but the following are some commits related to patched resource leaks I noticed while browsing the QSDK git:

  • ath11k: Free skb on unsupported packet types received on ext paths
    This change is based on code review and doesn't fix any known issues.
    Also added a warn for a similar case in wifili ext vdev to warn on such
    unsupported packets.
    There is a memory leak due to kfree of skb, it is changed to
    dev_kfree_skb_any to cleanup the entire skb properly.

  • ath11k: fix authenticate resource leak
    EAPOL data frames get cloned for the tx ack status.
    In NSS offload enabled case, host will not get tx
    completion status. Then the cloned ack frames resources
    not freed, so over the long run it ended up idr_alloc
    fail due to no idr space. Data frame with no_ack=0
    (Authenticate EAPOL frames) not transmitted from AP
    and client not able to associate. Fix by avoid the
    clone skb for those frame where we will not get tx completion.

  • ath11k: fix invalid vdev id fw crash
    num_started_vdevs is incremented for vdev restart scenario also.
    Once num_started_vdevs is wrongly incremented, which is not helping
    to stop the monitor vdev in multiple VAP cases. Since monitor vap not
    stopped, deletion of virtual monitor vdev is missed. It leads to vdev id
    leaks in the free_vdev_map. In that case, when we try to create multiple
    VAPs, invalid vdev id is passed to firmware due to zero value of
    free_vdev_map. So avoid the num_started_vdevs incrementing for restart
    case. so that monitor vdev get stopped and deleted properly also vdev id
    leaks not happen. will have proper vdev id from free_vdev_map.

  • ath11k: free qmi allocated memory
    Qmi allocated dma memory needs to be freed whenever necessary,
    such as rmmod, qmi restart. Otherwise memory leak occurs.

  • bus: mhi: controller: align no of irqs to power of two
    SDX controller driver is requesting for 11 irqs. But core
    drivers changes it to 16 to align with power of two and
    allocates 16 irqs.
    In such cases, the controller driver only frees the 11 irqs
    which leads to a resource leak.
    This patch aligns the number of irqs to power of two.
    So all the irqs will be cleaned up during remove.

4 Likes

This is pure off-topic, what was the point with this Mediatek based device?

Just flashed a build of your repo on my AX6, installation worked fine - so far it runs nice! Great work - thx a lot!

1 Like

On my AX6 I created a cron script to reboot every morning, I recommend the same as due to the leak in ath11k you can loose wifi connectivity pretty soon on the router.

1 Like

Will do the same, thx for the tip! So far the wifi seems to be very stable, I made a "stress test" with 300 gig of data transferred over Wifi, no problem so far...

root@OpenWrt:~# free
total used free shared buff/cache available
Mem: 375808 207164 141144 256 27500 130192
Swap: 0 0 0

Been running almost a week:

root@OpenWrt:~# free
              total        used        free      shared  buff/cache   available
Mem:         375868      237556      105856         276       32456       97372
Swap:             0           0           0
root@OpenWrt:~# uptime
 14:55:39 up 6 days, 18:27,  load average: 0.00, 0.00, 0.00
root@OpenWrt:~#

Have probably done somewhere between a couple hundred gigs, or just above 1TB transferred inbound from internet with no problems so far. Memory is still hovering about 230-260MB used at all times.

Hello good Morning

I have tried to compile on branch AX3600-5.10-restart, but it tells me the following error

mkdir -p ./temp/;cd ./temp;cp ../build/bin/ssdk_ks_km.a ./;ar -x ssdk_ks_km.a; cp ../ko_Makefile ./Makefile;
make -C /home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.43 M=/home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/temp/ CROSS_COMPILE=aarch64-openwrt-linux-musl- modules
make[5]: Entering directory '/home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.43'
make[6]: Circular /home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/temp//qca-ssdk.o <- /home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/temp//qca-ssdk.o dependency dropped.
  LD [M]  /home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/temp//qca-ssdk.o
  MODPOST /home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/temp//Module.symvers
ERROR: modpost: "__stack_chk_guard" [/home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/temp//qca-ssdk.ko] undefined!
make[6]: *** [scripts/Makefile.modpost:124: /home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/temp//Module.symvers] Error 1
make[6]: *** Deleting file '/home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/temp//Module.symvers'
make[5]: *** [Makefile:1725: modules] Error 2
make[5]: Leaving directory '/home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/linux-5.10.43'
make[4]: *** [Makefile:17: all] Error 2
make[4]: Leaving directory '/home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3'
make[3]: *** [Makefile:96: /home/usuario/ax3600/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/qca-ssdk-2021-04-28-c9bc3bc3/.built] Error 2
make[3]: Leaving directory '/home/usuario/ax3600/feeds/nss_packages/qca/qca-ssdk'
time: package/feeds/nss_packages/qca-ssdk/compile#0.73#0.19#0.99
    ERROR: package/feeds/nss_packages/qca-ssdk failed to build.
make[2]: *** [package/Makefile:116: package/feeds/nss_packages/qca-ssdk/compile] Error 1
make[2]: Leaving directory '/home/usuario/ax3600'
make[1]: *** [package/Makefile:110: /home/usuario/ax3600/staging_dir/target-aarch64_cortex-a53_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/usuario/ax3600'
make: *** [/home/usuario/ax3600/include/toplevel.mk:230: world] Error 2

Gratitude

What was the GCC version used?

Hi thanks for answering, I use gcc 10.x

Thanks for your hard work.

Its an issue with stack protectors, SSDK explicitly requires that to be disabled.
I also saw that with GCC10, but have not had time to see how can I disable it for SSDK only.

@robimarko (sorry for ot) i'm having fun compiling ssdk for ipq806x and MY GOD wtf is wrong...
there seems to be many problem for the neon instruction... any idea about that? did you notice any error related to that?

No, nothing related to that.
Are the flags that SSDK sets being passed correctly?