Porting guide ar71xx to ath79?

Just download it.

https://downloads.openwrt.org/snapshots/targets/ar71xx/generic/

1 Like

Hello @hnyman and others!

I flashed recent snapshot, installed luci, enabled hw offload via luci and all looks good so far!
During speed tests I'm getting DL 151 Mbps and UL 31 Mbps so full speed of my link, like on original WDR4300 firmware (with 1 min load around 1).

I flashed OpenWrt since I have VPN issues on original firmware (10 min negotiation delay before establishing VPN tunnel) and no way of debugging it.
On OpenWrt all have been working smooth and fast so far. Thank you!

Note: I have wifi disabled on wdr4300 at all but it shouldn't matter here at all.

I tried a new ath79 build r8410-900005ee75 for my WNDR3700v2 and it can't initialize the 5 GHz radio.

One month old r8273-30cc5b0bf4 (as of 20181007) detects and inits the radios ok.

Has anybody else noticed any ath79 regressions lately?

In my WZR-HP-AG300H, 5GHz radio is detected and initialized normaly with the latest snapshot build (ath79).

[   15.820104] PCI: Enabling device 0000:00:12.0 (0000 -> 0002)
[   15.919764] ath: phy1: Ignoring endianness difference in EEPROM magic bytes.
[   15.928368] ath: EEPROM regdomain: 0x0
[   15.928373] ath: EEPROM indicates default country code should be used
[   15.928376] ath: doing EEPROM country->regdmn map search
[   15.928387] ath: country maps to regdmn code: 0x3a
[   15.928391] ath: Country alpha2 being used: US
[   15.928395] ath: Regpair used: 0x3a
[   15.944961] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[   15.946557] ieee80211 phy1: Atheros AR9280 Rev:2 mem=0xb0010000, irq=15

On my netgers radio 5GHz works very well:

BusyBox v1.29.3 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r8410-900005ee75
 -----------------------------------------------------
 | Machine: Netgear WNDR3700v2                       |
 | Uptime: 0d, 00:06:42                              |
 | Load: 0.02 0.30 0.21                              |
 | Flash: total: 7.1MB, free: 6.7MB, used: 5%        |
 | Memory: total: 58.1MB, free: 36.6MB, used: 36%    |
 | WAN: 192.168.1.11, proto: dhcp                    |
 | LAN: 192.168.0.2, leases: 0                       |
 | radio0: mode: ap, ssid:LEDE_2, channel:9,conn: 0  |
 | radio1: mode: ap, ssid:LEDE_5, channel:36,conn: 0 |
 -----------------------------------------------------
Sat Nov  3 01:36:29 2018 kern.info kernel: [   22.861763] ath: phy1: Ignoring endianness difference in EEPROM magic bytes.
Sat Nov  3 01:36:29 2018 kern.debug kernel: [   22.870385] ath: EEPROM regdomain: 0x0
Sat Nov  3 01:36:29 2018 kern.debug kernel: [   22.870389] ath: EEPROM indicates default country code should be used
Sat Nov  3 01:36:29 2018 kern.debug kernel: [   22.870392] ath: doing EEPROM country->regdmn map search
Sat Nov  3 01:36:29 2018 kern.debug kernel: [   22.870402] ath: country maps to regdmn code: 0x3a
Sat Nov  3 01:36:29 2018 kern.debug kernel: [   22.870407] ath: Country alpha2 being used: US
Sat Nov  3 01:36:29 2018 kern.debug kernel: [   22.870410] ath: Regpair used: 0x3a
Sat Nov  3 01:36:29 2018 kern.debug kernel: [   22.887049] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
Sat Nov  3 01:36:29 2018 kern.info kernel: [   22.888600] ieee80211 phy1: Atheros AR9280 Rev:2 mem=0xb0010000, irq=14

BUT I STILL I DON'T HAVE WORKING WIFI LED's !!!!!
Any ideas why ?

I saw @hnyman post some time ago about something breaking LEDs on the WNDR3x00 series. Might be mistaken though.

Yes, I know, but he does not know why. I do not think anyone is interested ...

Because nothing has changed in the last month. Nobody skillful enough has paid attention to the issue. Feel free to tackle the issue and solve it.

Like it was discussed above, @nbd intentionally removed the GPIO registration to enable unloading the driver. Dark LEDs is a side effect of that.

Ps.
I have working LEDs in my own build as I reverted the culprit patch, which I mentioned above in Porting guide ar71xx to ath79? - #809 by hnyman

This patch: https://github.com/openwrt/openwrt/commit/ccab68f2d399d2395a18d1fb3495fe7e048fe054

1 Like

I understand that @bbd has broken down a well-functioning target (because I do not know why he did it and for what purpose) and now no one wants to improve it - that does not bother anyone that the wifi diodes are working? Seriously ? How do you know if the radios work?
I do not understand this approach to the matter.

For me, this is a serious problem. And I'm surprised that nobody took care of it.
I will not deal with this because it's not my level of developer

It maybe gives you some perspective that nbd has been the chief ath9k wifi driver developer at Openwrt for the last decade.

Reading his commit message from the commit that I linked, could give you some insight. Having the GPIO registered at ath9k driver apparently prevents unloading the driver, e.g. for testing purposes while developing stuff. So that registration was removed to ease development work.

If you would read even more from the early part of this thread, you could find out that having a working ath9k wifi LED in ath79 was a struggle by itself in the first place.

ath79 is still heavily under development, and for that reason it was not part of the 18.06 release and will likely not be in 19.01, either. You are living on the bleeding edge here.

1 Like

I said yesterday that I had trouble with WNDR3700v2 radios with a new build.

I have rebuilt the same current version, and radios work ok.

Thinking back to yesterday, I noticed then that the two firmware files in /lib/firmware had different size, which is wrong. they should have the same size in WNDR3700v2. That is apparently the reason why one of the radios did not work.

So, it seems possible that the "copy firmware from eeprom" routine at the boot may fail partially, leaving an invalid firmware file to /lib/firmware.

Thank you for explaining the problem.
However, I do not know what to do to turn on the wifi diodes in the next builds - you know it, and you do not subdue that knowledge.
I have changed the indicated patches to the older versions but the leds still do not work.

Hmmm?
I thought that I gave a pretty clear explanation what to do:

Either

  • use git revert (which can naturally lead to merge work at later git pulls):
    git revert ccab68f2d

or

  • unpatch it manually. Download patch, edit filenames inside the patch a bit, and then reverse-apply the patch.
    Note: all filenames inside the patch need slight editing, as "ath" has been added in to the path by commit d9eefa7a in the meanwhile. Edit like this:

    a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
    -->
    a/package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch

    wget https://github.com/openwrt/openwrt/commit/ccab68f2d399d2395a18d1fb3495fe7e048fe054.patch
    gedit ccab68f2d399d2395a18d1fb3495fe7e048fe054.patch
    patch -R -p 1 -i ccab68f2d399d2395a18d1fb3495fe7e048fe054.patch

Normal git patch work. Nothing special.

Both ways below:

perus@ub1810:/tmp$ cd openwrt/
perus@ub1810:/tmp/openwrt$ git revert ccab68f2d
[master 40dbeac940] Revert "ath9k: fix unloading the module"
 2 files changed, 15 insertions(+), 10 deletions(-)
perus@ub1810:/tmp/openwrt$ git log --oneline
40dbeac940 (HEAD -> master) Revert "ath9k: fix unloading the module"
900005ee75 (origin/master, origin/HEAD) iperf: allow non-ipv6 builds

Manual way:


perus@ub1810:/tmp/openwrt$ wget https://github.com/openwrt/openwrt/commit/ccab68f2d399d2395a18d1fb3495fe7e048fe054.patch
--2018-11-04 14:46:33--  https://github.com/openwrt/openwrt/commit/ccab68f2d399d2395a18d1fb3495fe7e048fe054.patch
...

perus@ub1810:/tmp/openwrt$ gedit ccab68f2d399d2395a18d1fb3495fe7e048fe054.patch
  (EDIT the filenames inside patch)

perus@ub1810:/tmp/openwrt$ patch -R -p 1 -i ccab68f2d399d2395a18d1fb3495fe7e048fe054.patch
patching file package/kernel/mac80211/patches/ath/548-ath9k_enable_gpio_chip.patch
patching file package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch
2 Likes

Thank you for the description and for your patience with me.
The first method is faster, and now wifi leds works !!

1 Like

Great that you got it working.
Working with patches is not that hard, once you get hang of the various ways of working with others' patches.

Note that in future updating the source with "git pull" may (will) lead into need of merge commits, as you now have that revert commit. In a private repo that does not hurt much, but may still look untidy in the long run.

You should likely use "git pull --rebase" for updating, so that your revert commit stays in the top and merge commits are avoided, if possible. And even then, you may need to do conflict fixing at some point.

I think a compromise solution for the LEDs issue would be to register the ath9k gpio controller sparately, not under ath9k. That's very easy to do.
There is no reason to have that gpio as a child of the wireless adapter.

1 Like

Any chance 1043N V5 can be added to ath79 ?

Other sister routers like V4 already seem to have builds available, but not V5. I have a unit to test, if that is necessery.

post a dmesg with current firmware, it should be the same as v4, if you know how to use tft recovery maybe you can try the v4 image, but first, post the dmesg, maybe I'll have time for it

edit:
looked into tplink-safeloader.c and it will not work with v4 image, the flash layout is different
maybe a cat /proc/mtd is also needed

1 Like

Here is my dmesg

[    0.000000] Linux version 4.9.120 (buildbot@builds-03.infra.lede-project.org) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7102-3f3a2c9) ) #0 Thu Aug 16 07:51:15 2018
[    0.000000] MyLoader: sysp=0d33d2d9, boardp=91ae65ac, parts=57f0380d
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019750 (MIPS 74Kc)
[    0.000000] SoC: Qualcomm Atheros QCA956X ver 1 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 80442044, node_mem_map 81000020
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  board=TL-WR1043N-v5 mtdparts=spi0.0:128k(factory-uboot)ro,128k(u-boot)ro,15104k(firmware),128k(product-info)ro,640k(config)ro,64k(partition-table)ro,128k(logs)ro,64k(art)ro console=ttyS0,115200 rootfstype=squashfs noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 60020K/65536K available (3363K kernel code, 172K rwdata, 444K rodata, 300K init, 219K bss, 5516K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:775.000MHz, DDR:650.000MHz, AHB:258.333MHz, Ref:25.000MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 4932285024 ns
[    0.000007] sched_clock: 32 bits at 387MHz, resolution 2ns, wraps every 5541893118ns
[    0.008222] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.071035] pid_max: default: 32768 minimum: 301
[    0.075987] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.082968] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.092724] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.103126] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.110600] NET: Registered protocol family 16
[    0.116624] MIPS: machine is TP-LINK TL-WR1043N v5
[    0.355563] Can't analyze schedule() prologue at 803a5594
[    0.372119] clocksource: Switched to clocksource MIPS
[    0.378382] NET: Registered protocol family 2
[    0.383772] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.391128] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.397876] TCP: Hash tables configured (established 1024 bind 1024)
[    0.404662] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.410826] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.417696] NET: Registered protocol family 1
[    0.422343] PCI: CLS 0 bytes, default 32
[    0.425438] Crashlog allocated RAM at address 0x3f00000
[    0.431863] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.444553] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.450696] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.469219] io scheduler noop registered
[    0.473392] io scheduler deadline registered (default)
[    0.479149] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.488055] console [ttyS0] disabled
[    0.511896] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
[    0.520992] console [ttyS0] enabled
[    0.528541] bootconsole [early0] disabled
[    0.542411] m25p80 spi0.0: found w25q128, expected m25p80
[    0.558428] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.563341] 8 cmdlinepart partitions found on MTD device spi0.0
[    0.569452] Creating 8 MTD partitions on "spi0.0":
[    0.574418] 0x000000000000-0x000000020000 : "factory-uboot"
[    0.581773] 0x000000020000-0x000000040000 : "u-boot"
[    0.588663] 0x000000040000-0x000000f00000 : "firmware"
[    0.619596] 2 uimage-fw partitions found on MTD device firmware
[    0.625750] 0x000000040000-0x0000001c0000 : "kernel"
[    0.632046] 0x0000001c0000-0x000000f00000 : "rootfs"
[    0.638642] mtd: device 4 (rootfs) set to be root filesystem
[    0.644572] 1 squashfs-split partitions found on MTD device rootfs
[    0.650963] 0x0000003f0000-0x000000f00000 : "rootfs_data"
[    0.658328] 0x000000f00000-0x000000f20000 : "product-info"
[    0.665764] 0x000000f20000-0x000000fc0000 : "config"
[    0.672661] 0x000000fc0000-0x000000fd0000 : "partition-table"
[    0.680262] 0x000000fd0000-0x000000ff0000 : "logs"
[    0.686938] 0x000000ff0000-0x000001000000 : "art"
[    0.694374] libphy: Fixed MDIO Bus: probed
[    0.709903] switch0: Atheros AR8337 rev. 2 switch registered on ag71xx-mdio.0
[    1.400093] libphy: ag71xx_mdio: probed
[    2.033580] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:00 [uid=004dd036, driver=Atheros AR8216/AR8236/AR8316]
[    2.045145] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:SGMII
[    2.053297] NET: Registered protocol family 10
[    2.061572] NET: Registered protocol family 17
[    2.066260] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    2.079731] 8021q: 802.1Q VLAN Support v1.8
[    2.085588] hctosys: unable to open rtc device (rtc0)
[    2.095777] VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
[    2.104728] Freeing unused kernel memory: 300K
[    2.109317] This architecture does not have kernel memory protection.
[    2.552131] random: fast init done
[    2.763649] init: Console is alive
[    2.767350] init: - watchdog -
[    3.550858] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.596415] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.605251] init: - preinit -
[    4.223579] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    4.246758] random: procd: uninitialized urandom read (4 bytes read)
[    5.303593] eth0: link up (1000Mbps/Full duplex)
[    5.308497] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    7.489864] jffs2: notice: (445) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[    7.507179] mount_root: switching to jffs2 overlay
[    7.534663] urandom-seed: Seeding with /etc/urandom.seed
[    7.686182] eth0: link down
[    7.698663] procd: - early -
[    7.701724] procd: - watchdog -
[    8.328223] procd: - watchdog -
[    8.331702] procd: - ubus -
[    8.431776] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.440700] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.448142] random: ubusd: uninitialized urandom read (4 bytes read)
[    8.455689] procd: - init -
[    8.766781] kmodloader: loading kernel modules from /etc/modules.d/*
[    8.776917] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    8.791600] Loading modules backported from Linux version wt-2017-11-01-0-gfe248fc2c180
[    8.799919] Backport generated by backports.git v4.14-rc2-1-31-g86cf0e5d
[    8.809292] ip_tables: (C) 2000-2006 Netfilter Core Team
[    8.821386] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[    8.869359] xt_time: kernel timezone is -0000
[    8.916524] PPP generic driver version 2.4.2
[    8.923036] NET: Registered protocol family 24
[    8.962192] ath: EEPROM regdomain: 0x0
[    8.962199] ath: EEPROM indicates default country code should be used
[    8.962202] ath: doing EEPROM country->regdmn map search
[    8.962214] ath: country maps to regdmn code: 0x3a
[    8.962218] ath: Country alpha2 being used: US
[    8.962221] ath: Regpair used: 0x3a
[    8.972915] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[    8.976508] ieee80211 phy0: Atheros AR9561 Rev:0 mem=0xb8100000, irq=47
[    9.069548] kmodloader: done loading kernel modules from /etc/modules.d/*
[    9.924384] urandom_read: 5 callbacks suppressed
[    9.924390] random: jshn: uninitialized urandom read (4 bytes read)
[   15.955644] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   15.963207] eth0: link up (1000Mbps/Full duplex)
[   15.972202] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   15.993857] br-lan: port 1(eth0.1) entered blocking state
[   15.999448] br-lan: port 1(eth0.1) entered disabled state
[   16.005514] device eth0.1 entered promiscuous mode
[   16.010464] device eth0 entered promiscuous mode
[   16.052242] br-lan: port 1(eth0.1) entered blocking state
[   16.057832] br-lan: port 1(eth0.1) entered forwarding state
[   16.063742] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   16.982325] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   18.169273] ath: EEPROM regdomain: 0x82c1
[   18.173456] ath: EEPROM indicates we should expect a country code
[   18.179743] ath: doing EEPROM country->regdmn map search
[   18.185242] ath: country maps to regdmn code: 0x37
[   18.190180] ath: Country alpha2 being used: SI
[   18.194776] ath: Regpair used: 0x37
[   18.198370] ath: regdomain 0x82c1 dynamically updated by user
[   20.357545] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   20.387992] br-lan: port 2(wlan0) entered blocking state
[   20.393539] br-lan: port 2(wlan0) entered disabled state
[   20.399364] device wlan0 entered promiscuous mode
[   21.040421] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   21.047186] br-lan: port 2(wlan0) entered blocking state
[   21.052705] br-lan: port 2(wlan0) entered forwarding state
[   72.572158] random: crng init done

And here is cat /proc/mtd


dev:    size   erasesize  name
mtd0: 00020000 00010000 "factory-uboot"
mtd1: 00020000 00010000 "u-boot"
mtd2: 00ec0000 00010000 "firmware"
mtd3: 00180000 00010000 "kernel"
mtd4: 00d40000 00010000 "rootfs"
mtd5: 00b10000 00010000 "rootfs_data"
mtd6: 00020000 00010000 "product-info"
mtd7: 000a0000 00010000 "config"
mtd8: 00010000 00010000 "partition-table"
mtd9: 00020000 00010000 "logs"
mtd10: 00010000 00010000 "art"

Unit is running 18.06.1 if thats of any significance.