Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dario Alcocer <dalcocer@helixd.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org
Subject: Re: Marvell switch port shows LOWERLAYERDOWN, ping fails
Date: Wed, 28 Jul 2021 11:07:37 -0700	[thread overview]
Message-ID: <fb7ced72-384c-9908-0a35-5f425ec52748@helixd.com> (raw)
In-Reply-To: <527bcc43-d99c-f86e-29b0-2b4773226e38@helixd.com>

It appears the port link-state issue is caused by the mv88e6xxx switch 
driver. The function mv88e6xxx_mac_config identifies the PHY as internal 
and skips the call to mv88e6xxx_port_setup_mac.

It does not make sense to me why internal PHY configuration should be 
skipped.

During boot, the 5.4.114 kernel successfully probes both switch chips, 
and the SERDES link appears to be brought up successfully:

[    2.782024] libphy: Fixed MDIO Bus: probed
[    2.800458] socfpga-dwmac ff700000.ethernet: IRQ eth_wake_irq not found
[    2.807070] socfpga-dwmac ff700000.ethernet: IRQ eth_lpi not found
[    2.813367] socfpga-dwmac ff700000.ethernet: PTP uses main clock
[    2.819537] socfpga-dwmac ff700000.ethernet: Version ID not available
[    2.825978] socfpga-dwmac ff700000.ethernet:         DWMAC1000
[    2.831186] socfpga-dwmac ff700000.ethernet: DMA HW capability 
register supported
[    2.838647] socfpga-dwmac ff700000.ethernet: RX Checksum Offload 
Engine supported
[    2.846108] socfpga-dwmac ff700000.ethernet: COE Type 2
[    2.851312] socfpga-dwmac ff700000.ethernet: TX Checksum insertion 
supported
[    2.858338] socfpga-dwmac ff700000.ethernet: Enhanced/Alternate 
descriptors
[    2.865279] socfpga-dwmac ff700000.ethernet: Extended descriptors not 
supported
[    2.872557] socfpga-dwmac ff700000.ethernet: Ring mode enabled
[    2.878382] socfpga-dwmac ff700000.ethernet: device MAC address 
fa:8b:6f:1f:4b:83
[    2.886010] libphy: stmmac: probed
[    2.890027] mv88e6085 stmmac-0:1a: switch 0x1760 detected: Marvell 
88E6176, revision 1
[    3.085696] libphy: mv88e6xxx SMI: probed
[    3.090416] mv88e6085 stmmac-0:1e: switch 0x1760 detected: Marvell 
88E6176, revision 1
[    3.281274] libphy: mv88e6xxx SMI: probed
[    3.626689] mv88e6085 stmmac-0:1e: switch 0x1760 detected: Marvell 
88E6176, revision 1
[    3.824809] libphy: mv88e6xxx SMI: probed
[    4.983937] mv88e6085 stmmac-0:1a lan1 (uninitialized): PHY 
[mv88e6xxx-0:00] driver [Marvell 88E1540]
[    4.999891] mv88e6085 stmmac-0:1a lan2 (uninitialized): PHY 
[mv88e6xxx-0:01] driver [Marvell 88E1540]
[    5.016620] mv88e6085 stmmac-0:1a lan3 (uninitialized): PHY 
[mv88e6xxx-0:02] driver [Marvell 88E1540]
[    5.032460] mv88e6085 stmmac-0:1a: configuring for fixed/1000base-x 
link mode
[    5.039594] mv88e6xxx_mac_config: switch=0, port=4, mode=0x1
[    5.045245] mv88e6xxx_mac_config: mode==MLO_AN_FIXED, force link up, 
speed=1000, duplex=1
[    5.053875] mv88e6xxx_mac_config: switch=0, port=4, mode=0x1
[    5.059522] mv88e6xxx_mac_config: mode==MLO_AN_FIXED, force link up, 
speed=1000, duplex=1
[    5.084915] mv88e6085 stmmac-0:1a: Link is Up - 1Gbps/Full - flow 
control off
[    6.253481] mv88e6085 stmmac-0:1e lan4 (uninitialized): PHY 
[mv88e6xxx-2:00] driver [Marvell 88E1540]
[    6.273714] mv88e6085 stmmac-0:1e dmz (uninitialized): PHY 
[mv88e6xxx-2:01] driver [Marvell 88E1540]
[    6.290369] mv88e6085 stmmac-0:1e: configuring for fixed/1000base-x 
link mode
[    6.297503] mv88e6xxx_mac_config: switch=1, port=4, mode=0x1
[    6.303152] mv88e6xxx_mac_config: mode==MLO_AN_FIXED, force link up, 
speed=1000, duplex=1
[    6.311774] mv88e6xxx_mac_config: switch=1, port=4, mode=0x1
[    6.317435] mv88e6xxx_mac_config: mode==MLO_AN_FIXED, force link up, 
speed=1000, duplex=1
[    6.340344] mv88e6085 stmmac-0:1e: Link is Up - 1Gbps/Full - flow 
control off
[    6.348972] debugfs: Directory 'switch0' with parent 'dsa' already 
present!
[    6.355938] DSA: failed to create debugfs interface for switch 0 (-14)
[    6.362692] DSA: tree 0 setup

After booting, I logged in and set up dynamic tracing for the relevant 
kernel routines:

dali login: root
Password:
root@dali:~# echo 'file drivers/net/phy/marvell.c +p' > 
/sys/kernel/debug/dynamic_debug/control
root@dali:~# echo 'file drivers/net/phy/phy_device.c +p' > 
/sys/kernel/debug/dynamic_debug/control
root@dali:~# echo 'file drivers/net/phy/phylink.c +p' > 
/sys/kernel/debug/dynamic_debug/control
root@dali:~# echo 'file drivers/net/phy/phy.c +p' > 
/sys/kernel/debug/dynamic_debug/control
root@dali:~# echo 'file net/dsa/port.c +p' > 
/sys/kernel/debug/dynamic_debug/control
root@dali:~# echo 'file net/dsa/slave.c +p' > 
/sys/kernel/debug/dynamic_debug/control
root@dali:~# echo 'file drivers/net/dsa/mv88e6xxx/chip.c +p' > 
/sys/kernel/debug/dynamic_debug/control
root@dali:~# echo 'func mv88e6xxx_read -p' > 
/sys/kernel/debug/dynamic_debug/control
root@dali:~# echo 'func mv88e6xxx_write -p' > 
/sys/kernel/debug/dynamic_debug/control

I then attempted to bring up the lan1 port and duplicated the 
LOWERLAYERDOWN issue. I inserted begin/end markers in the system log to 
locate the PHY traces:

root@dali:~# logger -t adhoc begin: bring up lan1 port
root@dali:~# ip addr add 192.0.2.1/24 dev lan1
root@dali:~# ip link set lan1 up
[   64.087971] mv88e6085 stmmac-0:1a lan1: configuring for phy/gmii link 
mode
[   64.094929] mv88e6xxx_mac_config: switch=0, port=0, mode=0x0
[   64.100563] mv88e6xxx_mac_config: skip MAC config for internal PHY
[   64.109285] 8021q: adding VLAN 0 to HW filter on device lan1
root@dali:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode 
DEFAULT group default qlen 1000
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group 
default qlen 10
     link/can
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1508 qdisc mq state UP 
mode DEFAULT group default qlen 1000
     link/ether fa:8b:6f:1f:4b:83 brd ff:ff:ff:ff:ff:ff
4: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group 
default qlen 1000
     link/sit 0.0.0.0 brd 0.0.0.0
5: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue 
state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
     link/ether fa:8b:6f:1f:4b:83 brd ff:ff:ff:ff:ff:ff
6: lan2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode 
DEFAULT group default qlen 1000
     link/ether fa:8b:6f:1f:4b:83 brd ff:ff:ff:ff:ff:ff
7: lan3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode 
DEFAULT group default qlen 1000
     link/ether fa:8b:6f:1f:4b:83 brd ff:ff:ff:ff:ff:ff
8: lan4@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode 
DEFAULT group default qlen 1000
     link/ether fa:8b:6f:1f:4b:83 brd ff:ff:ff:ff:ff:ff
9: dmz@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode 
DEFAULT group default qlen 1000
     link/ether fa:8b:6f:1f:4b:83 brd ff:ff:ff:ff:ff:ff
root@dali:~# logger -t adhoc end: bring up lan1 port

The extracted PHY traces from the system log are below:

root@dali:~# sed -ne '/adhoc: begin:/,/adhoc: end:/p' /var/log/messages
Nov  1 12:00:54 (none) user.notice adhoc: begin: bring up lan1 port
Nov  1 12:00:54 (none) user.info kernel: [   64.087971] mv88e6085 
stmmac-0:1a lan1: configuring for phy/gmii link mode
Nov  1 12:00:54 (none) user.debug kernel: [   64.094872] mv88e6085 
stmmac-0:1a lan1: phylink_resolve_flow: link config MLO_PAUSE_AN: set
Nov  1 12:00:54 (none) user.debug kernel: [   64.094882] mv88e6085 
stmmac-0:1a lan1: phylink_resolve_flow: setting pause=10
Nov  1 12:00:54 (none) user.debug kernel: [   64.094898] mv88e6085 
stmmac-0:1a lan1: phylink_mac_config: mode=phy/gmii/Unknown/Unknown 
adv=00,00000000,000022ef pause=10 link=0 an=1
Nov  1 12:00:54 (none) user.debug kernel: [   64.094912] 
dsa_port_phylink_mac_config: config type=0, mode=0, interface="gmii", 
speed=-1, duplex=255, pause=16, link=0 an_enabled=1 an_complete=0
Nov  1 12:00:54 (none) user.debug kernel: [   64.094918] 
dsa_port_phylink_mac_config: switch=0, port=0 "lan1"
Nov  1 12:00:54 (none) user.debug kernel: [   64.094923] 
dsa_port_phylink_mac_config: calling switch op phylink_mac_config
Nov  1 12:00:54 (none) user.info kernel: [   64.094929] 
mv88e6xxx_mac_config: switch=0, port=0, mode=0x0
Nov  1 12:00:54 (none) user.info kernel: [   64.100563] 
mv88e6xxx_mac_config: skip MAC config for internal PHY
Nov  1 12:00:54 (none) user.debug kernel: [   64.106754] 
phylink_run_resolve: phylink_disable_state==false, dispatch 
system_power_efficient_wq
Nov  1 12:00:54 (none) user.debug kernel: [   64.106803] mv88e6085 
stmmac-0:1a lan1: phylink_resolve: link_an_mode=phy
Nov  1 12:00:54 (none) user.debug kernel: [   64.106814] mv88e6085 
stmmac-0:1a lan1: phylink_resolve_flow: link config MLO_PAUSE_AN: set
Nov  1 12:00:54 (none) user.debug kernel: [   64.106823] mv88e6085 
stmmac-0:1a lan1: phylink_resolve_flow: setting pause=00
Nov  1 12:00:54 (none) user.debug kernel: [   64.106832] mv88e6085 
stmmac-0:1a lan1: phylink_resolve: have netdev, link_changed=0
Nov  1 12:00:54 (none) daemon.info avahi-daemon[529]: Joining mDNS 
multicast group on interface lan1.IPv4 with address 192.0.2.1.
Nov  1 12:00:54 (none) user.debug kernel: [   64.108923] libphy: 
genphy_resume: phy_clear_bits returns 0x0
Nov  1 12:00:54 (none) user.info kernel: [   64.109285] 8021q: adding 
VLAN 0 to HW filter on device lan1
Nov  1 12:00:54 (none) daemon.info avahi-daemon[529]: New relevant 
interface lan1.IPv4 for mDNS.
Nov  1 12:00:54 (none) daemon.info avahi-daemon[529]: Registering new 
address record for 192.0.2.1 on lan1.IPv4.
Nov  1 12:00:54 (none) user.debug kernel: [   64.119685] 
marvell_read_page: id=0x1410eb1(21040817), state=UP, flags=0x0, link=0, 
suspended=0, suspended_by_mdio_bus=0, autoneg=1, autoneg_complete=0
Nov  1 12:00:54 (none) user.debug kernel: [   64.121499] 
marvell_read_page: __phy_read(phydev, 22) returns 0x0
Nov  1 12:00:54 (none) user.debug kernel: [   64.121511] 
marvell_write_page: id=0x1410eb1(21040817), state=UP, flags=0x0, link=0, 
suspended=0, suspended_by_mdio_bus=0, autoneg=1, autoneg_complete=0
Nov  1 12:00:54 (none) user.debug kernel: [   64.126302] 
marvell_write_page: __phy_write(phydev, 22, 2) returns 0x0
Nov  1 12:00:54 (none) user.debug kernel: [   64.129909] 
marvell_write_page: id=0x1410eb1(21040817), state=UP, flags=0x0, link=0, 
suspended=0, suspended_by_mdio_bus=0, autoneg=1, autoneg_complete=0
Nov  1 12:00:54 (none) user.debug kernel: [   64.131711] 
marvell_write_page: __phy_write(phydev, 22, 0) returns 0x0
Nov  1 12:00:54 (none) user.debug kernel: [   64.158548] 
m88e1510_config_aneg: set copper page
Nov  1 12:00:54 (none) user.debug kernel: [   64.160371] 
marvell_read_status: read status from copper page
Nov  1 12:00:54 (none) user.debug kernel: [   64.171227] 
phylink_run_resolve: phylink_disable_state==false, dispatch 
system_power_efficient_wq
Nov  1 12:00:54 (none) user.debug kernel: [   64.171247] mv88e6085 
stmmac-0:1a lan1: phy link down gmii/1Gbps/Half
Nov  1 12:00:54 (none) user.debug kernel: [   64.171258] Marvell 88E1540 
mv88e6xxx-0:00: PHY state change UP -> NOLINK
Nov  1 12:00:54 (none) user.debug kernel: [   64.171271] mv88e6085 
stmmac-0:1a lan1: phylink_resolve: link_an_mode=phy
Nov  1 12:00:54 (none) user.debug kernel: [   64.171281] mv88e6085 
stmmac-0:1a lan1: phylink_resolve_flow: link config MLO_PAUSE_AN: set
Nov  1 12:00:54 (none) user.debug kernel: [   64.171290] mv88e6085 
stmmac-0:1a lan1: phylink_resolve_flow: setting pause=00
Nov  1 12:00:54 (none) user.debug kernel: [   64.171298] mv88e6085 
stmmac-0:1a lan1: phylink_resolve: have netdev, link_changed=0
Nov  1 12:00:55 (none) user.notice adhoc: end: bring up lan1 port
root@dali:~#

  reply	other threads:[~2021-07-28 18:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 22:55 Dario Alcocer
2021-07-23 13:41 ` Andrew Lunn
2021-07-23 18:21   ` Dario Alcocer
2021-07-23 18:25     ` Andrew Lunn
2021-07-23 18:36       ` Dario Alcocer
2021-07-23 21:58         ` Dario Alcocer
2021-07-24 17:34           ` Andrew Lunn
2021-07-25  2:26             ` Dario Alcocer
2021-07-25  2:36               ` Dario Alcocer
2021-07-27  1:39                 ` Dario Alcocer
2021-07-28 18:07                   ` Dario Alcocer [this message]
2021-07-28 18:23                     ` Andrew Lunn
2021-07-28 18:33                       ` Dario Alcocer
2021-07-28 19:24                         ` Andrew Lunn
2021-07-28 19:37                           ` Dario Alcocer
2021-07-28 20:47                             ` Andrew Lunn
2021-07-28 20:54                               ` Dario Alcocer
2021-07-28 21:09                             ` Andrew Lunn
2021-08-05 21:44                             ` Dario Alcocer
2021-08-06 16:03                               ` Dario Alcocer
2021-08-06 23:46                                 ` Dario Alcocer
2021-08-07 18:57                                   ` Andrew Lunn
2021-08-09 16:28                                     ` Dario Alcocer
2021-08-10 20:58                                       ` Dario Alcocer
2021-08-10 22:13                                         ` Andrew Lunn
2021-08-11 13:16                                           ` Dario Alcocer
2021-08-07 17:44                               ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb7ced72-384c-9908-0a35-5f425ec52748@helixd.com \
    --to=dalcocer@helixd.com \
    --cc=andrew@lunn.ch \
    --cc=netdev@vger.kernel.org \
    --subject='Re: Marvell switch port shows LOWERLAYERDOWN, ping fails' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).