Porting guide ar71xx to ath79?

/rom is the flashed firmware. Files are not flashed separately.

I know. So it is a mystery.

I built a fresh build r7862-ae9c3105a3-20180815 for WNDR3800 from the current main source and wan fails with the error below.

I tested the previous 20180813 build only standalone, as the focus was on the wifi changes. I suspect that the two merged commits from PR 1271 mixup the WNDR3700 series in some case. (but not all, as borromini got his working just before the last led changes ???)


[   50.112908] ------------[ cut here ]------------
[   50.117556] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:320 dev_watchdog+0x164/0x274
[   50.125830] NETDEV WATCHDOG: eth1 (ag71xx): transmit queue 0 timed out
[   50.132339] Modules linked in: ath9k ath9k_common pppoe ppp_async ath9k_hw ath pptp pppox ppp_mppe ppp_generic mac80211 iptable_nat ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_tcpmss xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_helper xt_esp xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_FLOWOFFLOAD xt_DSCP xt_CLASSIFY usbserial slhc owl_loader nf_reject_ipv4 nf_nat_rtsp nf_nat_redirect nf_nat_masquerade_ipv4 nf_conntrack_ipv4 nf_nat_ipv4 nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_defrag_ipv4 nf_conntrack_rtsp nf_conntrack_rtcache nf_conntrack_netlink iptable_mangle iptable_filter ipt_ah ipt_ECN ip_tables crc_ccitt compat sch_cake act_skbedit act_mirred em_u32 cls_u32
[   50.203048]  cls_tcindex cls_flow cls_route cls_fw sch_tbf sch_htb sch_hfsc sch_ingress ledtrig_usbport xt_set ip_set_list_set ip_set_hash_netiface ip_set_hash_netport ip_set_hash_netnet ip_set_hash_net ip_set_hash_netportnet ip_set_hash_mac ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport ip_set_hash_ipmark ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap_ipmac ip_set_bitmap_ip ip_set nfnetlink ip6t_NPT ip6t_MASQUERADE nf_nat_masquerade_ipv6 ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 nf_nat nf_conntrack ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables x_tables msdos ip_gre gre ifb sit tunnel4 ip_tunnel tun vfat fat ntfs hfsplus cifs nls_utf8 nls_iso8859_15 nls_iso8859_1 nls_cp850 nls_cp437 nls_cp1250 sha256_generic sha1_generic
[   50.273981]  md5 md4 hmac ecb des_generic usb_storage ohci_platform ohci_hcd ehci_platform sd_mod scsi_mod ehci_hcd gpio_button_hotplug ext4 jbd2 mbcache usbcore nls_base usb_common crc16 aead crypto_null cryptomgr crc32c_generic crypto_hash
[   50.295368] CPU: 0 PID: 0 Comm: swapper Not tainted 4.14.62 #0
[   50.301179] Stack : 00000000 00000000 80647522 00000032 804edce4 804ed907 80497054 00000000
[   50.309532]         80643670 00000140 804f8d14 804f8cd4 804f8cc0 00000001 87c09db8 199761a5
[   50.317887]         00000000 00000000 80640000 000051f8 00000000 00000000 00000007 00000000
[   50.326234]         00000106 5d8fdad2 00000105 00000000 00000000 00000000 804be1a0 8030faac
[   50.334580]         00000009 00000140 804f8d14 804f8cd4 00000001 8025ebc4 00000000 80640000
[   50.342928]         ...
[   50.345373] Call Trace:
[   50.347825] [<8006a90c>] show_stack+0x58/0x100
[   50.352275] [<80080900>] __warn+0xe4/0x118
[   50.356378] [<80080964>] warn_slowpath_fmt+0x30/0x3c
[   50.361341] [<8030faac>] dev_watchdog+0x164/0x274
[   50.366058] [<800b99e0>] call_timer_fn.isra.4+0x24/0x84
[   50.371269] [<800b9bb0>] run_timer_softirq+0x170/0x1e8
[   50.376403] [<804039c8>] __do_softirq+0xe8/0x2bc
[   50.381021] [<8020ed20>] plat_irq_dispatch+0xc0/0x120
[   50.386070] [<800658f8>] handle_int+0x138/0x144
[   50.390593] [<80065780>] __r4k_wait+0x20/0x40
[   50.394951] [<800a8690>] do_idle+0x78/0xe4
[   50.399037] [<800a88e8>] cpu_startup_entry+0x18/0x20
[   50.404000] [<8050cbc0>] start_kernel+0x454/0x474
[   50.408693] ---[ end trace 33aa403c699333fa ]---
[   50.413302] eth1: tx timeout
[   81.095851] random: crng init done
[   81.099259] random: 1 urandom warning(s) missed due to ratelimiting
[   81.152898] eth1: tx timeout
[  122.433735] eth1: link down
[  135.954212] eth1: link up (1000Mbps/Full duplex)
[  146.112904] eth1: tx timeout

I suspect that the third commit from PR 1271 from @981213 may also be needed for WNDR3700 series.

@Nague already reported the same error yesterday

So, this confirm my error report :slight_smile:

So which one did work. Those two commits fixed the eth1 timout issue for me.
So what was your build that did work?

Also it depends on what link is connected to eth1: 1000 or 100 Mbit.
It used to work on 1000 without any patches, but crashed on 100.
Maybe now it is reversed :slight_smile: But the code looks correct.

If anyone can give me devmem output, it will be possible to discover the problem.

20180810 before those two first patches from the PR got merged.

I have 1000 Mbit link to wan.

So, they worked for you and me on 1000 and didn't for me on 100.
Now they work for me on 100 and don't for you in 1000.
Can you test it on 100 and provide some reads by devmem?

And also devmem can write to registers. If it's related to mii speed, we can fix it right away.

What are the exact settings for devmem builds? a few items for kernel config but also something for busybox?

Two items in Openwrt .config:

CONFIG_KERNEL_DEVMEM=y
CONFIG_BUSYBOX_CONFIG_DEVMEM=y

1 Like

When you have the build, provide output of

devmem 0x18050014
devmem 0x18070004

with eth1 connected to 1000Mbit link.

This is posted by using my WNDR3800 :slight_smile:

The third patch fixed things for me, at least with 1000 Mbit/s wan.

I made a minimal build with devmem and the third patch.
ath79-kernel4.14-master-test-20180815
r7862-ae9c3105a3

the devmem output:

root@OpenWrt:~# devmem 0x18050014
0x11110000
root@OpenWrt:~# devmem 0x18070004
0x00000020
root@OpenWrt:~# cat /sys/class/net/eth1/speed
1000

EDIT:
just for reference, the third patch that fixed 1000Mbit connection for me is:
https://github.com/openwrt/openwrt/pull/1271/commits/7416bf615074c093a0aa7c7919cb49229ca45d4e

Now run
devmem 0x18070004 32 0x22
and check if eth1 works.

Don't do anything else. After the crash just run the command.

It won't work. 0x22 is invalid for the second gmac.

It's not invalid. It's mii speed. Just try it.
I did in on two devices now and it fixed right away.

1 Like

OK, I see now. 20 is correct.

@hnyman Can you test it with a 100Mbit link? You can connect it anywhere, just set there 100 by ethtool.

I didn't see this. Now it's clear what happens. But it's not so easy to solve in some good manner.

can you clarify that?