[BPI-R2] Adding second gmac to 4.14

On LEDE 4.9, Banana Pi’s fork, both ports are set to trgmii so this shouldn’t be the problem…

does your patch really fix the damaged packets-issue on cpu-port0 (lan)? then it seems that trgmii is handled wrong by code (headerbytes stripped again or similar)

The packets seemed to be trimmed in Wireshark (also checksums were reported as invalid but this is because of trimmed content I believe).

I have the board now working with both lan*@eth0 and wan@eth1 used. Packets are not corrupted.

ok, i will try it…but trgmii-driver should also be ok because actual dts (here from my 4.14-main) without 2nd gmac is working with trgmii

gmac0: mac@0 {
	compatible = "mediatek,eth-mac";
	reg = <0>;
	phy-mode = "trgmii";

	fixed-link {
		speed = <1000>;
		full-duplex;
		pause;
	};
};

			port@6 {
				reg = <6>;
				label = "cpu";
				ethernet = <&gmac0>;
				phy-mode = "trgmii";

				fixed-link {
					speed = <1000>;
					full-duplex;
				};
			};

btw. have you seen my tests:

17:13:42.430047 IP truncated-ip - 6 bytes missing! 192.168.0.10 > 192.168.0.5: ICMP echo request, id 815, seq 9, length 64

tcpdump from my other router…means outgoing packets are damaged not (only) incoming

Interesting… This seems something complex – my patch definitely helped me and I can’t run more tests now but I’ll maybe try switching trgmii on and off on both ports later and see what happens.

FWIW I also have some funkiness regarding speed negotiation (with a host which works with other router) but it doesn’t seem to be related at the first glance.

Yes, you are right – I meant incoming to the other host which I tested this on. Packets incoming on R2 seemed well.

I have some news – I’ve tried to enable TRGMII on both ports instead and voila, it still works! I’ll take some time to verify that current kernel image has the modified DTB – just in case.

1 Like

i can confirm, that cpu-port0 works with this patch (changing trgmii to rgmii)

you mean the problem may be that the other port was not in trgmii-mode?

Yeah, seems so. I’ve pushed an updated patch to my branch.

1 Like

can confirm it works with wan and lan0, but currently not with lan1,2,3

i get dhcp-reply (ip set by my router), but i cannot ping it…strange

ignore it…dhcp sets same address to all tested interfaces, so i have to manually shut down the prior ports not only move cable

in my gmac-branch there is a file mt7623a-rfb-emmc.dts created by any of the patches…is that really necessary? can’t compile without it, but found nowhere it is referenced (not in mt7623.dtsi and not in bananapi-r2.dts). do you have this in your tree?

+++ b/arch/arm/boot/dts/Makefile
@@ -1061,6 +1061,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt6580-evbp1.dtb \
 	mt6589-aquaris5.dtb \
 	mt6592-evb.dtb \
+	mt7623a-rfb-emmc.dtb \

I have this one too, I think it’s a reference board for MT7623 (rfb – reference board). It comes from 0064-dts.patch. Not sure why can’t you compile without it but I didn’t try.

1 Like

I will try to comment-out in makefile when i’m at home…

works also without reference-board

see last commit in gmac-branch: https://github.com/frank-w/BPI-R2-4.14/commits/gmac

@abbradar can you push the changes to official lede and mainline?

@pkalemba now you can try hnat on top of this

created a single patch for 4.14: gmac.diff (23,6 KB) (based on 4.14.19)

created a new branch from actual 4.14 (4.14.52) and applied patch to it.

works well in my short test

root@bpi-r2-ubuntu:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group defau0
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP g0
    link/ether 0a:18:b3:77:d6:79 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::818:b3ff:fe77:d679/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP g0
    link/ether ce:96:6b:35:f5:b2 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::cc96:6bff:fe35:f5b2/64 scope link 
       valid_lft forever preferred_lft forever
4: wan@eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group defa0
    link/ether ce:96:6b:35:f5:b2 brd ff:ff:ff:ff:ff:ff
5: lan0@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group def0
    link/ether 0a:18:b3:77:d6:79 brd ff:ff:ff:ff:ff:ff
6: lan1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group def0
    link/ether 0a:18:b3:77:d6:79 brd ff:ff:ff:ff:ff:ff
7: lan2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group def0
    link/ether 0a:18:b3:77:d6:79 brd ff:ff:ff:ff:ff:ff
8: lan3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP0
    link/ether 0a:18:b3:77:d6:79 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.105/24 brd 192.168.0.255 scope global lan3
       valid_lft forever preferred_lft forever
    inet6 fe80::818:b3ff:fe77:d679/64 scope link 
       valid_lft forever preferred_lft forever

note that you have to set eth1 to up before you get wan-port up

in /etc/network/interfaces:

auto eth0
iface eth0 inet manual
  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down

auto eth1
iface eth1 inet manual
  pre-up ip link set $IFACE up
  post-down ip link set $IFACE down

i can ping my router over all ports (only 1 have to be in that subnet! the others I have set to down)

@frank-w https://github.com/openwrt/openwrt/pull/1135

1 Like

anyone else tested it?

1 Like
root@gate:/proc# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 1e:cf:eb:c5:29:96 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 26:65:86:4b:08:8a brd ff:ff:ff:ff:ff:ff
4: wan@eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state LOWERLAYERDOWN group default qlen 1000
    link/ether 02:01:02:03:04:00 brd ff:ff:ff:ff:ff:ff
    inet xx.xx.xx.xx/24 brd xx.xx.xx.xxx scope global wan
       valid_lft forever preferred_lft forever
5: lan0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 1e:cf:eb:c5:29:96 brd ff:ff:ff:ff:ff:ff
    inet 192.168.22.10/24 brd 192.168.22.255 scope global lan0
       valid_lft forever preferred_lft forever
6: lan1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 1e:cf:eb:c5:29:96 brd ff:ff:ff:ff:ff:ff
7: lan2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 1e:cf:eb:c5:29:96 brd ff:ff:ff:ff:ff:ff
8: lan3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 1e:cf:eb:c5:29:96 brd ff:ff:ff:ff:ff:ff
9: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:08:22:fa:09:fc brd ff:ff:ff:ff:ff:ff
10: ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 02:08:22:fa:09:fc brd ff:ff:ff:ff:ff:ff
    inet 192.168.25.1/24 scope global ap0
       valid_lft forever preferred_lft forever

Thank you

I’ve already merged 2nd gmac to 4.14 main because it looks stable now

That’s already from 4.14-main and debian stretch

Have you done a iperf or similar? I only tested a while for packetloss

I have tested only on packet loss