Adding OpenWrt support for Xiaomi AX3600 (Part 1)

Deleted posts were off topic: Not specific to this device.

I can confirm there are unscheduled restarts happening, sometimes they don't even appear to be full restarts.

Testcase: Unexpected Reboots
Description: Reboots should only happen when executed by user or scheduled in "cron"
Cause: User reported reboots without user intervention or timed execution
Expected result: No reboots
Observed results:

  • Reboots without user intervention
  • Unscheduled reboots
  • Unexpected behaviour of "uptime" command indicates reboots without init calls

Scenario:

I disabled all cron tasks.

This is how I track scheduled and manual restarts:

root@############:~# cat /etc/init.d/log_reboots 
#!/bin/sh /etc/rc.common
# Log reboots
 
START=99
STOP=1

reboot_log_file=/root/log_reboots.log
 
start() {        
    echo start
    # commands to launch application
}                 
 
stop() {          
    echo stop
    # commands to kill application 
}

boot() {
    echo "Booted at: "$(date +%Y-%m-%dT%H:%M:%S.%3N%z) >>$reboot_log_file
}

shutdown() {
    touch /etc/timestapForClockReinit
    echo "Shutdown at: "$(date +%Y-%m-%dT%H:%M:%S.%3N%z) >>$reboot_log_file
}

I checked this a couple of minutes ago:

root@############:~# date
Mon Dec 13 00:44:41 CET 2021
root@############:~# uptime
 00:44:44 up 28 min,  load average: 0.04, 0.01, 0.00

These are the data on restarts that init was aware of:

root@############:~# cat log_reboots.log 
Booted at: 2021-12-12T22:48:03.
Booted at: 2021-12-12T22:48:08.
root@############:~# date
Mon Dec 13 00:45:28 CET 2021
root@############:~# ll /etc/timestapForClockReinit 
-rw-r--r--    1 root     root             0 Dec 12 22:16 /etc/timestapForClockReinit

Notice there never was any manual or scheduled reboot, these would have created a "Shutdown at" entry in "/root/log_reboots.log".

In conclusion both reboots after 22:48 were unscheduled and not manually executed. The reboot (or whatever it was) at around 00:00 that appears to have happened according to the "uptime" command didn't even trigger init's "boot" method.

OK, so you just wrote half a page about your router randomly reboots? In this case, we need logs, not half a page nonsense about how you not scheduled it. Connect a TTL serial adapter to your router and log the terminal output on another PC, as that is pretty much the only way to get some meaningful data we can look at.

Instead of this half page, you could have wrote the exact version you are running, plus some details about your usecase, as a lot of us are running the latest Robi version yet we have not seen such a behavior. So if you suspect this is a SW bug, a possible difference in the usecase can shed some light about why this happens.

2 Likes

sorry, I don't have a serial adapter.... But I did point out what the differences were (since I have a working and a non-working router)

You refer to this? Anyhow, not sure if you can do anything without a serial adapter. Maybe try failsafe mode, as that wont apply VLAN and you can factory reset the router. Or you can use TFTPD and bootloader to reinstall Robi's OWRT.

I would order a TTL serial adapter Ű(1.8V compatible) yesterday, if I were you. We cannot really help without logs.

@robimarko have you seen this?

[PATCH v2] ath11k: Change qcn9074 fw to operate in mode-2

In mode-2 QCN9074 firmware uses 15MB of host memory and firmware
request 1MB size segements in QMI, whereas in mode-0 firmware
uses 45MB of host memory and each segment is of 2MB size.
In mode-2 firmware operates with reduced number of vdevs and peers.

I am fairly sure this will come to 807x as well. Maybe we can see some further reduction of memory usage...

This won't come to IPQ807x, its strictly for PCI-based cards, in this case QCN9074 as it takes a lot of RAM in the full mode.
So they just restricted a lot of stuff to make it work with 15 instead of 45MB.

This is mostly for backwards compatibility with older boards.
With ath11k you cant have low RAM usage and all of the features, the client count needs to be really restricted.

I honestly dont know how they made QSDK to work on the 256MB boards

1 Like

You mention that you're running the -restart branch code.
I can't imagine anyone spending time helping you if you're not on the right branch. You should be running the -backports branch.

the -restart branch precedes the -backports one (it's older)

The correct branch is "IPQ807x-5.10-backports" These are the precompiled images: link

Everyone should use those, I doubt anyone would help if someone is not using these (latest) versions.

yeah i know. that's the one that is not working. the working one is from the -restart branch

You said that. Then it is not the only difference, if they are running different versions. So they are not running the same version, nor using the same basic config as one of them has VLAN tagging, the other don't. (???)

This is another brilliant example of how not to report a problem.

1 Like

Either I'm confusing things, or you guys are. It's not working when using the same version (-backports), only difference being VLAN tagging. If the one with VLAN tagging runs the -restart branch, it works fine. This is what I said the first time, so, nothing new here.

Hi @robimarko, regarding to my prev questions.
since ssdk was failing to enable ether rx clock, is that possible qca8075 switch ic was simply broken ?
this morning tried to turn on my router and everything works with no ssdk crash,
tried to reboot it but again ssdk crash.
there also u-boot, when i run dhcp or tftpboot some eth port was on up 10mb state but i didnt plug any cable on them.
also yeah, i can see some people buy those ic on some online market here

I doubt it's the QCA8075 as the clock is generated internally by the SoC, and those 10Mb half-duplex just means that there is nothing connected as that is the lowest that PHY can report.
You can buy the QCA8072/5 PHY-s on the open market for a long time, heck even Arrow sells them (But the lead time is rather high now)

@dchard I went digging a bit, and it seems like IPQ807x FW supports 3 memory modes.
Mode 0 (The ath11k default) uses 97MB of reserved memory (I assume this is for the 1GB devices).
Mode 1 uses 57MB of reserved memory (I assume this is for the 512MB devices).
Mode 2 uses 42MB of reserved memory (I assume this is for the 256MB devices).

It appears that all of the ath11k devices support these 3 modes with varying memory usage, but mode 2 goes as far as not storing the calibration data in memory at all and thus saving a whopping 4.5MB.

I find it weird that even the QCA 512MB profile for ath11k doesn't actually change the FW mode at all and uses the default mode 0.

Scratch the last part, it does use mode 1 for 512MB but its a bit hidden and will conflict with the method that QCN patch provides as its now part of the struct and much easier to set.

if it SoC was broken then well, im done xD
idk if ah11k requires qca-ssdk to make it run but im going to failsafe mode:

root@(none):/# insmod compat
root@(none):/# insmod hwmon
root@(none):/# insmod cfg80211
root@(none):/# insmod mac80211
root@(none):/# insmod ath11k
root@(none):/# insmod ath11k_ahb
[  272.027112] ath11k c000000.wifi: ipq8074 hw2.0
[  272.027419] remoteproc remoteproc0: powering up cd00000.q6v5_wcss
[  272.048207] remoteproc remoteproc0: Booting fw image IPQ8074/q6_fw.mdt, size 668
[  273.320474] remoteproc remoteproc0: remote processor cd00000.q6v5_wcss is now up

i do ip link but still, nothing there
thanks for the hints btw

I dont understand what are you trying?

SSDK and NSS-DP are required if you want wired networking

OK, that is interesting. But if between the 512 and 256 modes are only a few MB, then how the hell it fits? By the time my router boots with wifi (and nothing else except luci), the used ram is already almost at 256MB RAM. Saving a few megs wont allow them to fit it on a 256 device...

Because that's only the WLAN memory, they cut all of the reserved memory nodes as well as features.
So then SSDK and all of the NSS stuff will be built in the LOWMEM profile.

/*            256 MB Profile
	 * +=========+==============+========================+
	 * |        |              |                         |
	 * | Region | Start Offset |          Size           |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |        |              |                         |
	 * |  NSS   |  0x40000000  |          8MB            |
	 * |        |              |                         |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * | Linux  |  0x40800000  | Depends on total memory |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * | TZ APP |  0x4A400000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * | uboot  |  0x4A600000  |           4MB           |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |  SBL   |  0x4AA00000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * |  smem  |  0x4AB00000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |   TZ   |  0x4AC00000  |           4MB           |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |   Q6   |  0x4B000000  |          40MB           |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |  QDSS  |  0x4D800000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * | M3 Dump|  0x4D900000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * |                                                 |
	 * |      Rest of the memory for Linux               |
	 * |                                                 |
	 * +=================================================+
	 */
/*                      512 MB Profile
	 * +=========+==============+========================+
	 * |        |              |                         |
	 * | Region | Start Offset |          Size           |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |        |              |                         |
	 * |  NSS   |  0x40000000  |          16MB           |
	 * |        |              |                         |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * | Linux  |  0x41000000  | Depends on total memory |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * | TZ APP |  0x4A400000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * | uboot  |  0x4A600000  |           4MB           |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |  SBL   |  0x4AA00000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * |  smem  |  0x4AB00000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |   TZ   |  0x4AC00000  |           4MB           |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |   Q6   |  0x4B000000  |          55MB           |
	 * |        |              |                         |
	 * |        |              |                         |
	 * |        |              |                         |
	 * +--------+--------------+-------------------------+
	 * |  QDSS  |  0x4E700000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * | M3 Dump|  0x4E800000  |           1MB           |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |  Pine  |  0x4E900000  |          30MB           |
	 * |        |              |   (on HK10 RDPs only)   |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |  Pine  |  0x50700000  |          30MB           |
	 * |        |              |   (on HK10 RDPs only)   |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |  MHI0  |  0x52500000  |          16MB           |
	 * |        |              |   (on HK10 RDPs only)   |
	 * +--------+--------------+-------------------------+
	 * |        |              |                         |
	 * |  MHI1  |  0x53500000  |          16MB           |
	 * |        |              |   (on HK10 RDPs only)   |
	 * +--------+--------------+-------------------------+
	 * |                                                 |
	 * |      Rest of the memory for Linux               |
	 * |                                                 |
	 * +=================================================+
	 */