Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions board/aarch64/microchip-ev23x71a/Config.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config BR2_PACKAGE_MICROCHIP_EV23X71A
bool "Microchip EV23X71A (Laguna)"
depends on BR2_aarch64
select BR2_PACKAGE_SYMREG
help
Support for the Microchip EV23X71A evaluation board, based on
the LAN969x (Laguna) family of TSN capable switches. 24 GbE
Expand Down
12 changes: 12 additions & 0 deletions board/aarch64/microchip-ev23x71a/dts/microchip/infix.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@
};
};
};

/* Register access by name for the symreg tool, debugfs only */
&axi {
symreg@e00c0000 {
compatible = "microchip,sparx5-symreg";
reg = <0xe00c0000 0x10000>,
<0xe2000000 0x2000000>;
reg-names = "cpu", "dev";
microchip,symreg = <0xe00c0000 0x10000>,
<0xe2000000 0x2000000>;
};
};
72 changes: 72 additions & 0 deletions board/aarch64/microchip-lan969x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Microchip LAN969x (Laguna)

Files shared by the boards built on the LAN969x switch family:

| Board | Package |
|-------------------------------------------------|------------------------------------|
| [Microchip EV23X71A](../microchip-ev23x71a) | `BR2_PACKAGE_MICROCHIP_EV23X71A` |
| [Novarq Tactical 1000](../novarq-tactical-1000) | `BR2_PACKAGE_NOVARQ_TACTICAL_1000` |

`uboot/` holds the U-Boot config fragment and environment used by the
`*_boot_defconfig` of each board. Kernel device tree and configuration
fixups stay with each board, see its `dts/` directory and `.mk` file.

A new Laguna board should select `BR2_PACKAGE_SYMREG` in its `Config.in`
and carry the `microchip,sparx5-symreg` node in its `dts/microchip/infix.dtsi`,
copied from one of the boards above, so the tool below works on it too.

## Debugging

### Register access by name

Every Laguna board ships `symreg`, Microchip's tool for reading and
writing switch registers by their datasheet names. It talks to the
`symreg` debugfs driver, which maps the register space the device tree
node describes and exposes it as `/sys/kernel/debug/symreg/mem`. Root
only, since debugfs is.

```
symreg --help # options and the register syntax
symreg -m # MAC table
symreg -v # VLAN table
symreg -c 0 # VCAP instance 0
symreg -s # stream table

symreg 'DEV2G5[29]*' # all registers of port 29's device block
symreg 'ASM*[29]*' # ingress side of the same port
symreg -a 'DSM*[29]*' # same, with the physical addresses

symreg REG[idx] # read one register
symreg REG[idx].FIELD # read one field
symreg REG[idx].FIELD 1 # write one field, add -f for wildcards
```

Register and field names follow the LAN969x datasheet. Quote the
wildcards or the shell expands them. The dispatcher `symreg` picks the
SoC from `/proc/device-tree/compatible` and runs `symreg_lan969x`, which
can also be called directly.

The tool reads live hardware, so the useful pattern for an intermittent
fault is a snapshot while the port works, another once it has failed,
and a diff of the two. For the management port, which is switch port 29
on both boards:

```bash
for blk in 'DEV2G5[29]*' 'ASM*[29]*' 'DSM*[29]*' 'QSYS*[29]*'; do
symreg "$blk"
done >/tmp/port29-$(date +%s).txt
```

Check the PHY as well. The management PHY sits on the GCB MDIO bus and
shares one level triggered interrupt line with the copper PHYs, so a
stale link state can come from a missed PHY interrupt as well as from
the switch. Read it with `mdio` from mdio-tools, see the
[EV23X71A README](../microchip-ev23x71a/README.md#debug-and-analysis),
which also covers the VCAP debugfs and `ethtool` counters; both apply to
either board.

### Writing registers

Writes take effect immediately and bypass the driver, which keeps no
record of them. Expect the driver's own view to disagree afterwards,
and reboot before trusting any behaviour again.
1 change: 1 addition & 0 deletions board/aarch64/novarq-tactical-1000/Config.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config BR2_PACKAGE_NOVARQ_TACTICAL_1000
bool "Novarq Tactical 1000 (Laguna)"
depends on BR2_aarch64
select BR2_PACKAGE_SYMREG
help
Support for the Novarq Tactical 1000, based on the LAN969x
(Laguna) family of TSN capable switches. 24 GbE copper ports,
Expand Down
12 changes: 12 additions & 0 deletions board/aarch64/novarq-tactical-1000/dts/microchip/infix.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@
};
};
};

/* Register access by name for the symreg tool, debugfs only */
&axi {
symreg@e00c0000 {
compatible = "microchip,sparx5-symreg";
reg = <0xe00c0000 0x10000>,
<0xe2000000 0x2000000>;
reg-names = "cpu", "dev";
microchip,symreg = <0xe00c0000 0x10000>,
<0xe2000000 0x2000000>;
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,17 @@ if ask "Create aux, primary ${imgsize}, secondary ${imgsize}, cfg ${cfgsize}, an
mkfs.ext4 -qF -L aux -m 0 -i 4096 -O ^metadata_csum,^metadata_csum_seed,uninit_bg "${disk}p4"
mkfs.ext4 -qF -L cfg -m 0 -i 4096 -O uninit_bg "${disk}p7"
mkfs.ext4 -qF -L var -m 0 -i 4096 -O uninit_bg "${disk}p8"
#
# RAUC tracks slot boot state in uboot.env, seed it as prod/provision does.
mnt=$(mktemp -d)
mount -t ext4 "${disk}p4" "$mnt"
echo 1 >"$mnt"/resized
mkenvimage -s 0x4000 -o "$mnt"/uboot.env - <<EOF
BOOT_ORDER=primary secondary net
BOOT_primary_LEFT=1
BOOT_secondary_LEFT=1
BOOT_net_LEFT=1
EOF
umount "$mnt"
rmdir "$mnt"
fi
Expand Down
16 changes: 1 addition & 15 deletions board/common/rootfs/etc/bash.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,7 @@ bind "set show-all-if-ambiguous on"

export LANG=C.UTF-8

log()
{
local fn="/var/log/syslog"
[ -n "$1" ] && fn="/var/log/$1"
less +G -r "$fn"
}

follow ()
{
local fn="/var/log/syslog"
[ -n "$1" ] && fn="/var/log/$1"

tail -F -n +1 "$fn"
}

# log and follow are defined in /etc/profile.d/log.sh
_logfile_completions()
{
local cur=${COMP_WORDS[COMP_CWORD]}
Expand Down
15 changes: 15 additions & 0 deletions board/common/rootfs/etc/profile.d/log.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Page or follow a log file, default syslog. Plain sh, so BusyBox ash
# and bash both get it; the bash completions live in /etc/bash.bashrc.
log()
{
local fn="/var/log/syslog"
[ -n "$1" ] && fn="/var/log/$1"
less +G -r "$fn"
}

follow()
{
local fn="/var/log/syslog"
[ -n "$1" ] && fn="/var/log/$1"
tail -F -n +1 "$fn"
}
3 changes: 3 additions & 0 deletions configs/aarch64_minimal_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,16 @@ BR2_PACKAGE_HOST_GENEXT2FS=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FDT_ADD_PUBKEY=y
BR2_PACKAGE_ACER_CONNECT_VERO_W6M=y
BR2_PACKAGE_ALDER_ALDER=y
BR2_PACKAGE_BANANAPI_BPI_R3=y
BR2_PACKAGE_BANANAPI_BPI_R4=y
BR2_PACKAGE_BANANAPI_BPI_R64=y
BR2_PACKAGE_FRIENDLYARM_NANOPI_R2S=y
BR2_PACKAGE_MARVELL_CN9130_CRB=y
BR2_PACKAGE_MARVELL_ESPRESSOBIN=y
BR2_PACKAGE_MICROCHIP_EV23X71A=y
BR2_PACKAGE_NOVARQ_TACTICAL_1000=y
BR2_PACKAGE_RASPBERRYPI_RPI64=y
BR2_PACKAGE_STYX_DCP_SC_28P=y
IX_VENDOR_HOME="https://www.kernelkit.org"
Expand Down
28 changes: 28 additions & 0 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ All notable changes to the project are documented in this file.
the keystore. Its default route and DNS servers are used like those from
a DHCP server, and the TCP MSS of forwarded connections is clamped to the
session MTU, see [PPPoE Client][pppoe]
- LAN969x boards ship `symreg`, which reads and writes switch registers by
name and dumps the MAC, VLAN and VCAP tables, for debugging the switch
core, see `board/aarch64/microchip-lan969x/README.md`

### Fixes

Expand All @@ -59,6 +62,31 @@ All notable changes to the project are documented in this file.
- Fix #1423: the default route from a DHCPv6 client, learned from router
advertisements, is now a static route with the DHCPv6 route preference,
like a DHCPv4 route. Before, the route preference setting was ignored
- LAN969x: a port outside any bridge stopped receiving multicast, including
IPv6 neighbour discovery and mDNS, when another port outside a bridge went
down or joined a bridge. The port looked dead on the LAN until it was
taken down and up again, which is how the Tactical 1000 management port
kept dropping out of the test rig
- LAN969x: kernel BUG "scheduling while atomic" when a multicast address was
added to or removed from a port outside any bridge
- LAN969x: the IP address of a bridge was unreachable from its ports, while
forwarding between the ports worked. Broadcast from a bridge port never
reached the CPU, so ARP went unanswered, and the bridge's own MAC address
was missing from the switch MAC table, so unicast to the bridge was
flooded to the ports instead of delivered
- LAN969x: disabling the first port of a bridge, whose MAC address the
bridge uses, cut the bridge IP address off until the port was enabled
again
- LAN969x: taking down one port of a link aggregate stopped unicast to the
aggregate on the remaining ports, and removing the aggregate cut off the
port whose address it had used until that port was disabled and enabled
again
- PTP ports with PHY timestamping, e.g. the copper ports on LAN969x boards,
kept dropping to the faulty state because the transmit timestamp arrived
later than the 10 ms the PTP daemon waited for it, or never at all
- PTP now time stamps with the clock of the switch core when the kernel
would have picked a PHY's, so all ports of a switch share one clock, which
boundary and transparent clocks and TSN schedules depend on

[pppoe]: https://www.kernelkit.org/infix/latest/pppoe/

Expand Down
1 change: 1 addition & 0 deletions package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ source "$BR2_EXTERNAL_INFIX_PATH/package/python-spy/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/python-libyang/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/python-yangdoc/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/skeleton-init-finit/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/symreg/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/tetris/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/libyang-cpp/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/sysrepo-cpp/Config.in"
Expand Down
10 changes: 10 additions & 0 deletions package/symreg/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
config BR2_PACKAGE_SYMREG
bool "symreg - Microchip switch registers by name"
depends on BR2_aarch64
help
Read and write Microchip LAN969x switch registers by symbolic
name, and dump the MAC, VLAN, VCAP and stream tables, through
the symreg debugfs driver. Debug aid, root only. Selected by
the Laguna boards, see board/aarch64/microchip-lan969x/README.md

https://github.com/microchip-ung/symreg-tool
3 changes: 3 additions & 0 deletions package/symreg/symreg.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Locally calculated
sha256 0d7eee2dbdd8e79bb91103d06ee057cb477764a046c5d6d8045e978166a70490 symreg-cb96993eeb34558926a8f5851a945ad4cd674690.tar.gz
sha256 d620d728cc1c0efebe173f8840dd957a56d9ff40867c062d0571b4110ea15f1e LICENSE
11 changes: 11 additions & 0 deletions package/symreg/symreg.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SYMREG_VERSION = cb96993eeb34558926a8f5851a945ad4cd674690
SYMREG_SITE = $(call github,microchip-ung,symreg-tool,$(SYMREG_VERSION))
SYMREG_LICENSE = MIT
SYMREG_LICENSE_FILES = LICENSE
SYMREG_CONF_OPTS = -DBUILD_LAN969X=ON

define SYMREG_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_SPARX5_SYMREG)
endef

$(eval $(cmake-package))
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 1bdc682ca8860bb8299b6c25cc91ebf032a23cfa Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 19 Sep 2023 18:38:10 +0200
Subject: [PATCH 01/78] net: phy: marvell10g: Support firmware loading on
Subject: [PATCH 01/85] net: phy: marvell10g: Support firmware loading on
88X3310

When probing, if a device is waiting for firmware to be loaded into
Expand All @@ -15,7 +15,7 @@ fall back.
1 file changed, 161 insertions(+)

diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 8fd42131cdbf..44294519231e 100644
index 8fd42131cdbf9..44294519231ed 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -25,6 +25,7 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 920227e8923cf970730a4bed22bd2aa55dc9387e Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 21 Nov 2023 20:15:24 +0100
Subject: [PATCH 02/78] net: phy: marvell10g: Fix power-up when strapped to
Subject: [PATCH 02/85] net: phy: marvell10g: Fix power-up when strapped to
start powered down

On devices which are hardware strapped to start powered down (PDSTATE
Expand All @@ -12,7 +12,7 @@ affected by this setting.
1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 44294519231e..40439db49601 100644
index 44294519231ed..40439db49601d 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -322,11 +322,23 @@ static int mv3310_power_down(struct phy_device *phydev)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From c473017acbed8a778f07f9f1ce55028e85a9ad62 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 15 Nov 2023 20:58:42 +0100
Subject: [PATCH 03/78] net: phy: marvell10g: Add LED support for 88X3310
Subject: [PATCH 03/85] net: phy: marvell10g: Add LED support for 88X3310

Pickup the LEDs from the state in which the hardware reset or
bootloader left them, but also support further configuration via
Expand All @@ -21,7 +21,7 @@ Trigger support:
1 file changed, 422 insertions(+)

diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 40439db49601..7ae4744f147b 100644
index 40439db49601d..7ae4744f147bb 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -28,6 +28,7 @@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 7ad37cfa715d86cc20f29432f106cedd457e4f26 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 12 Dec 2023 09:51:05 +0100
Subject: [PATCH 04/78] net: phy: marvell10g: Support LEDs tied to a single
Subject: [PATCH 04/85] net: phy: marvell10g: Support LEDs tied to a single
media side

In a combo-port setup, i.e. where both the copper and fiber interface
Expand All @@ -18,7 +18,7 @@ versa for the SFP cage.
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 7ae4744f147b..5e48355ffcef 100644
index 7ae4744f147bb..5e48355ffcef4 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -192,6 +192,9 @@ struct mv3310_chip {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 5f95f31c7e48087019db7d673ff32a31f4e06619 Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Wed, 27 Mar 2024 10:10:19 +0100
Subject: [PATCH 05/78] net: phy: Do not resume PHY when attaching
Subject: [PATCH 05/85] net: phy: Do not resume PHY when attaching

The PHY should not start negotiating with its link-partner until
explicitly instructed to do so.
Expand All @@ -19,7 +19,7 @@ administratively down.
1 file changed, 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 26b08e3dbd1d..7597308534a0 100644
index 26b08e3dbd1de..7597308534a0a 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1753,7 +1753,6 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
Expand Down
Loading
Loading