Adding OpenWrt support for Xiaomi AX3600 (Part 1)

Yes i notice that while diffing dts... so the idea is to restore id back to a sane value and just assign a correct label correct?

Yeah, no reason to this stupid overriding.
Also, qcom,mactype = <1>; is completely incorrectly put on DP5 which is DP1 actually, this is invalid.
Stock DTS defines it for index 6 which makes more sense, but why do they need 10G MAC mode for QCA8081 I dont know

love how they swapped the reg and override them but not for dp3 AHAHAHHA

Cause, its reversed ordering, so DP3 matches.
The node I posted is after I cleaned it up in OpenWrt, QSDK just defines everything in each DP node as there is no inheritance for them

Ok, but please be aware this is not a vlan thread.

I've added an example config but collapsed it to make it less bothersome for other users.

network config root@YourRouterName:~# cat /etc/config/network
config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'ffff:ffff:ffff::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        option stp '1'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'

config interface 'wan'
        option device 'wan'
        option proto 'dhcp'

config interface 'wan6'
        option device 'wan'
        option proto 'dhcpv6'

config bridge-vlan
        option device 'br-lan'
        option vlan '101'
        list ports 'lan1:t*'
        list ports 'lan2:t*'
        list ports 'lan3:t*'

config bridge-vlan
        option device 'br-lan'
        option vlan '102'
        list ports 'lan1:t'
        list ports 'lan2:t'
        list ports 'lan3:t'

config bridge-vlan
        option device 'br-lan'
        option vlan '103'
        list ports 'lan1:t'
        list ports 'lan2:t'
        list ports 'lan3:t'

config interface 'GUEST'
        option device 'br-lan.103'
        option type 'bridge'
        option proto 'none'

config interface 'INT'
        option proto 'none'
        option device 'br-lan.101'

config interface 'MGMT'
        option proto 'dhcp'
        option device 'br-lan.101'
wireless config root@YourRouterName:~# cat /etc/config/wireless
config wifi-device 'radio0'
        option type 'mac80211'
        option path 'YourDevicePath'
        option cell_density '0'
        option country 'YourCountry'
        option htmode 'HT20'
        option band '2g'
        option channel 'YourChannel'
        option disabled '1'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option mode 'ap'
        option encryption 'sae-mixed'
        option key 'XXXXXXX'
        option ieee80211r '1'
        option ft_psk_generate_local '1'
        option network 'INT'
        option ft_over_ds '0'
        option ssid 'YourRouterNamebck'
        option mobility_domain '12EF'
        option disabled '1'

config wifi-device 'radio1'
        option type 'mac80211'
        option path 'YourDevicePath'
        option band '5g'
        option cell_density '0'
        option htmode 'HE80'
        option country 'YourCountry'
        option channel 'YourChannel'
        option txpower '24'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option mode 'ap'
        option ssid 'YourRouterNamenacax'
        option encryption 'sae-mixed'
        option key 'XXXXXXX'
        option network 'INT'
        option ieee80211r '1'
        option ft_psk_generate_local '1'
        option ft_over_ds '0'
        option mobility_domain '12EF'

config wifi-device 'radio2'
        option type 'mac80211'
        option path 'YourDevicePath'
        option band '2g'
        option cell_density '0'
        option htmode 'HE20'
        option country 'YourCountry'
        option channel 'YourChannel'

config wifi-iface 'default_radio2'
        option device 'radio2'
        option mode 'ap'
        option ssid 'YourRouterNamebgnax'
        option encryption 'sae-mixed'
        option key 'XXXXXXX'
        option network 'INT'
        option ieee80211r '1'
        option ft_psk_generate_local '1'
        option ft_over_ds '0'
        option mobility_domain '12EF'

config wifi-iface 'wifinet4'
        option device 'radio1'
        option mode 'ap'
        option ssid 'YourRouterNameGuestNacax'
        option network 'GUEST'
        option encryption 'sae-mixed'
        option key 'XXXXXXX'
        option ieee80211r '1'
        option mobility_domain '12EF'
        option ft_psk_generate_local '1'
        option ft_over_ds '0'

config wifi-iface 'wifinet5'
        option device 'radio2'
        option mode 'ap'
        option ssid 'YourRouterNameGuestBgnax'
        option encryption 'sae-mixed'
        option key 'XXXXXXX'
        option ieee80211r '1'
        option ft_psk_generate_local '1'
        option network 'GUEST'
        option ft_over_ds '0'
        option mobility_domain '12EF'

config wifi-iface 'wifinet6'
        option device 'radio0'
        option mode 'ap'
        option ssid 'YourRouterNameGuestBck'
        option network 'GUEST'
        option encryption 'sae-mixed'
        option key 'XXXXXXX'
        option ieee80211r '1'
        option mobility_domain '12EF'
        option ft_over_ds '1'
        option ft_psk_generate_local '1'
        option disabled '1'
Remarks Do NOT use this without any untagged ports unless you know what you are doing (e.g have another device set up with VLAN 101, connected to one of the LAN ports 1 - 3, and running a DHCP server).

I only used tagged interfaces, untagged would be "lanX:u" or "lanX:u*" instead of "lanX:t"

Keep the option ula_prefix from your config

Keep the option path from your wireless devices

option key is the shared secret in cleartext

option mobility_domain '12EF' should be set to something all your your routers share for the same ssid

3 Likes

Having done a quick check of the relevant values in my AX3600, they all currently line up with what Robi has noted above except for the sys1_failed and sys2_failed (which are 0 and 1 respectively).

boot_wait=on
uart_en=1

flag_boot_rootfs=0
flag_last_success=0
flag_boot_success=1
flag_try_sys1_failed=0
flag_try_sys2_failed=1

Looks like the values are set in /lib/upgrade/platform.sh - and Robi has updated the flag_try_sys* to 8 and 8 already in the PR. So will manually update those to 8 before next time upgrading.

@McGiverGim on your 2nd router did you update the file? Because the above two seem to get set in the platform_do_upgrade step regardless of what it's set to...

1 Like

Yes, I modified the platform.sh file to be the same than the latest changes from robi.

1 Like

Been doing some perf measurements, and like expected.
1G NAT masquerade is achieved, but there is quite huge overhead on checksum calc and one function directly in NSS-DP, I assume its gonna be the NAPI callback but its not named as its out of tree module.

  10,57%  ksoftirqd/0      [kernel.kallsyms]     [k] do_csum
  10,20%  ksoftirqd/0      [qca_nss_dp]          [k] 0x0000000000003338
   5,64%  ksoftirqd/0      [kernel.kallsyms]     [k] rcu_qs
   4,64%  ksoftirqd/0      [kernel.kallsyms]     [k] dcache_clean_poc
   2,35%  ksoftirqd/0      [qca_nss_dp]          [k] 0x00000000000041f0
   2,18%  ksoftirqd/0      [kernel.kallsyms]     [k] memmove
   2,02%  ksoftirqd/0      [kernel.kallsyms]     [k] dev_gro_receive
   1,51%  ksoftirqd/0      [kernel.kallsyms]     [k] eth_type_trans
   1,46%  ksoftirqd/0      [qca_nss_dp]          [k] 0x0000000000003aac
   1,38%  ksoftirqd/0      [qca_nss_dp]          [k] 0x0000000000003cd4
   1,38%  ksoftirqd/0      [qca_nss_dp]          [k] 0x0000000000003cb8
   1,32%  ksoftirqd/0      [qca_nss_dp]          [k] 0x00000000000041a4
   1,23%  ksoftirqd/0      [qca_nss_dp]          [k] 0x0000000000003d00
   1,15%  ksoftirqd/0      [kernel.kallsyms]     [k] kmem_cache_alloc
   1,09%  ksoftirqd/0      [kernel.kallsyms]     [k] fib_table_lookup
   0,92%  ksoftirqd/0      [kernel.kallsyms]     [k] memset
   0,90%  ksoftirqd/0      [kernel.kallsyms]     [k] dcache_inval_poc
   0,85%  ksoftirqd/0      [kernel.kallsyms]     [k] ___slab_alloc.constprop.0
   0,82%  ksoftirqd/0      [kernel.kallsyms]     [k] __dev_queue_xmit
   0,81%  ksoftirqd/0      [kernel.kallsyms]     [k] inet_gro_receive
   0,79%  ksoftirqd/0      [qca_nss_dp]          [k] 0x00000000000041c8
   0,79%  ksoftirqd/0      [kernel.kallsyms]     [k] __netif_receive_skb_core.constprop.0
   0,77%  ksoftirqd/0      [kernel.kallsyms]     [k] tcp_gro_receive
   0,70%  ksoftirqd/0      [kernel.kallsyms]     [k] ip_route_input_slow
   0,68%  ksoftirqd/0      [kernel.kallsyms]     [k] skb_segment
   0,68%  ksoftirqd/0      [kernel.kallsyms]     [k] dma_map_page_attrs
   0,67%  ksoftirqd/0      [kernel.kallsyms]     [k] skb_pull
   0,63%  ksoftirqd/0      [kernel.kallsyms]     [k] ip_forward
   0,62%  ksoftirqd/0      [kernel.kallsyms]     [k] fib_rules_lookup
   0,58%  ksoftirqd/0      [kernel.kallsyms]     [k] dma_unmap_page_attrs
   0,58%  ksoftirqd/0      [kernel.kallsyms]     [k] dev_hard_start_xmit
   0,57%  ksoftirqd/0      [kernel.kallsyms]     [k] skb_release_data
   0,57%  ksoftirqd/0      [kernel.kallsyms]     [k] strncpy
   0,56%  ksoftirqd/0      [kernel.kallsyms]     [k] __kmalloc_track_caller
   0,56%  ksoftirqd/0      [kernel.kallsyms]     [k] __slab_free.constprop.0
   0,54%  ksoftirqd/0      [kernel.kallsyms]     [k] nf_hook_slow
   0,53%  ksoftirqd/0      [kernel.kallsyms]     [k] kmem_cache_free
   0,53%  ksoftirqd/0      [kernel.kallsyms]     [k] skb_gro_receive
   0,52%  ksoftirqd/0      [kernel.kallsyms]     [k] __local_bh_enable_ip

If I had 2 10G clients true bottleneck would probably show up, but just basic checksum offloading would do wonders.

1 Like

did you manage ti create that good graph?

Nope, perf script refuses to work with:

[robimarko@fedora ipq807x-5.15]$ perf script build_dir/target-*/linux-*/vmlinux.debug --kallsyms build_dir/target-*/linux-*/linux-*/System.map > out.perf
  Error: Couldn't find script `build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/vmlinux.debug'

I am probably doing something wrong, but my first time using perf

mhh you need to check the real path of vmlinux.debug

perf script build_dir/target-*/linux-*/linux-*/vmlinux.debug --kallsyms build_dir/target-*/linux-*/linux-*/System.map > out.perf

ok no vmlinux.debug should be in the linux directory...

vmlinux.debug doesn't seem to be needed at all, and I have the SVG.
But where to host the damn thing?

oh wow is not a plain html page?

No, its a SVG

Just open it in a web browser, though all of the NSS-DP symbols are missing as I have no idea how to include that as well

we have the symvers directory in linux with the additional symbol

Yeah, but how to point perf to it?

--symfs=<directory>
           Look for files with symbols relative to this directory.

think this should be passed to perf script

Doesnt work in perf report

No, its an XML with JS and everything, you can download and just view it in browser

Compiled a local build and flashed successfully - having set flag_try_sys1 and 2_failed to 8 in platform_do_upgrade before flashing (AX3600).

1 Like