mv88e6xxx fixed link fixes
Subsystems (4)
Andrew Lunn
maintainerv2 cover mv88e6xxx fixed link fixes
Recent changes for how the MAC is configured broke fixed links, as used by CPU/DSA ports, and for SFPs when phylink cannot be used. The first fix is unchanged from v1. The second fix takes a different solution than v1. If a CPU or DSA port is known to have a PHYLINK instance, configure the port down before instantiating the PHYLINK, so it is in the down state as expected by PHYLINK.
Andrew Lunn (2):
net: dsa: mv88e6xxx: Configure MAC when using fixed link
net: dsa: Down cpu/dsa ports phylink will control
drivers/net/dsa/mv88e6xxx/chip.c | 5 +++-- net/dsa/port.c | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.26.0
Andrew Lunn
maintainerPATCH v2 1/2 net: dsa: mv88e6xxx: Configure MAC when using fixed link
The 88e6185 is reporting it has detected a PHY, when a port is connected to an SFP. As a result, the fixed-phy configuration is not being applied. That then breaks packet transfer, since the port is reported as being down.
Add additional conditions to check the interface mode, and if it is fixed always configure the port on link up/down, independent of the PPU status.
--- drivers/net/dsa/mv88e6xxx/chip.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +3 -2
@@ -709,7 +709,8 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, ops = chip->info->ops;mv88e6xxx_reg_lock (chip); -if (!mv88e6xxx_port_ppu_updates (chip, port) && ops->port_set_link) +if ((!mv88e6xxx_port_ppu_updates (chip, port) || + mode ==MLO_AN_FIXED ) && ops->port_set_link) err = ops->port_set_link (chip, port,LINK_FORCED_DOWN );mv88e6xxx_reg_unlock (chip);
@@ -731,7 +732,7 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, ops = chip->info->ops;mv88e6xxx_reg_lock (chip); -if (!mv88e6xxx_port_ppu_updates (chip, port)) { +if (!mv88e6xxx_port_ppu_updates (chip, port) || mode ==MLO_AN_FIXED ) {/* FIXME: for an automedia port, should we force the link * down here - what if the link comes up due to "other" media * while we're bringing the port up, how is the exclusivity
Signature · 1 line
2.26.0
Andrew Lunn
maintainerPATCH v2 2/2 net: dsa: Down cpu/dsa ports phylink will control
In reply to Andrew LunnDSA and CPU ports can be configured in two ways. By default, the driver should configure such ports to there maximum bandwidth. For most use cases, this is suficient. When this default is insufficient, a phylink instance can be bound to such ports, and phylink will configure the port, e.g. based on fixed-link properties. phylink assumes the port is initially down. Given that the driver should of already configured it to its maximum speed, ask the driver to down the port before instantiating the phylink instance.
--- net/dsa/port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/dsa/port.c +6 -1
@@ -670,11 +670,16 @@ int dsa_port_link_register_of(struct dsa_port *dp) {struct dsa_switch *ds = dp->ds;struct device_node *phy_np; +int port = dp->index;if (!ds->ops->adjust_link) { phy_np =of_parse_phandle (dp->dn,"phy-handle" ,0 ); -if (of_phy_is_fixed_link (dp->dn) || phy_np) +if (of_phy_is_fixed_link (dp->dn) || phy_np) { +if (ds->ops->phylink_mac_link_down) + ds->ops->phylink_mac_link_down (ds, port, +MLO_AN_FIXED ,PHY_INTERFACE_MODE_NA );return dsa_port_phylink_register (dp); + }return 0 ; }
Signature · 1 line
2.26.0
Re: [PATCH net v2 2/2] net: dsa: Down cpu/dsa ports phylink will control
Hello!
Only a couple grammar bugs... :-)
Quoted 3 lines · Andrew Lunn
DSA and CPU ports can be configured in two ways. By default, the driver should configure such ports to there maximum bandwidth. For most use cases, this is suficient. When this default is insufficient,
Sufficient.
Quoted 3 lines
a phylink instance can be bound to such ports, and phylink will configure the port, e.g. based on fixed-link properties. phylink assumes the port is initially down. Given that the driver should of
Should have?
Quoted 5 lines
already configured it to its maximum speed, ask the driver to down the port before instantiating the phylink instance.
Fixes 30c4a5b0aad8 ("net: mv88e6xxx: use resolved link config in mac_link_up()")Signed-off-by Andrew Lunn <[email protected]>
[...]
MBR, Sergei
David Miller
maintainerFrom: Andrew Lunn <[email protected]>
Date: Tue, 14 Apr 2020 02:34:37 +0200
Quoted 6 lines
Recent changes for how the MAC is configured broke fixed links, as used by CPU/DSA ports, and for SFPs when phylink cannot be used. The first fix is unchanged from v1. The second fix takes a different solution than v1. If a CPU or DSA port is known to have a PHYLINK instance, configure the port down before instantiating the PHYLINK, so it is in the down state as expected by PHYLINK.
Series applied with Sergei's grammar fixes to the commit message of patch #2.
Thanks!