Subject: Re: net: phylink: dsa: mv88e6xxx: flaky link detection on switch ports with internal PHYs

From: Andrew Lunn <[email-masked]>
Date: Wed, 23 Jan 2019 00:12:01 +0100

On Tue, Jan 22, 2019 at 02:16:09PM -0500, John David Anglin wrote:
> I've been hacking on a espressobin board to try to improve ptp support,
> etc.  However, I have
> a big problem with link detection on the wan, lan0 and lan1 ports.

Hi John

I just booted my espressobin with net-next. It is running Debian, and
i have the following in /etc/network/interfaces

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug wan
iface wan inet dhcp
  pre-up ip link set eth0 up

allow-hotplug lan0
iface lan0 inet static
  pre-up ip link set eth0 up
  address 10.42.42.42
  netmask 255.255.255.0

my wan port got its IP address from DHCP.

root@espressobin:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group defaul
t 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
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1508 qdisc mq state UP group defa
ult qlen 1024
    link/ether f0:ad:4e:03:69:9c brd ff:ff:ff:ff:ff:ff
    inet6 fe80::f2ad:4eff:fe03:699c/64 scope link 
       valid_lft forever preferred_lft forever
3: wan@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP g
roup default qlen 1000
    link/ether f0:ad:4e:03:69:9c brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.11/24 brd 10.0.0.255 scope global wan
       valid_lft forever preferred_lft forever
    inet6 fe80::f2ad:4eff:fe03:699c/64 scope link 
       valid_lft forever preferred_lft forever
4: lan0@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state L
OWERLAYERDOWN group default qlen 1000
    link/ether f0:ad:4e:03:69:9c brd ff:ff:ff:ff:ff:ff
    inet 10.42.42.42/24 brd 10.42.42.255 scope global lan0
       valid_lft forever preferred_lft forever
5: lan1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default
 qlen 1000
    link/ether f0:ad:4e:03:69:9c brd ff:ff:ff:ff:ff:ff

lan0 is correctly down, because the machine on the other end is down.

I then manually configured lan1 up and powered on the peer. I then
see:

[  543.113227] IPv6: ADDRCONF(NETDEV_UP): lan1: link is not ready
[  546.680276] mv88e6085 d0032004.mdio-mii:01 lan1: Link is Up - 1Gbps/Full - fl
ow control off
[  546.686106] IPv6: ADDRCONF(NETDEV_CHANGE): lan1: link becomes ready

So for me, everything is working as it should.

I would suggest you manually configure your networking, just to
test. I would suspect systemd is not doing things correctly.

	Andrew