Skip to content

Commit e8687ab

Browse files
vladimirolteangregkh
authored andcommitted
net: dsa: lantiq_gswip: move gswip_add_single_port_br() call to port_setup()
[ Upstream commit c0054b2 ] A port added to a "single port bridge" operates as standalone, and this is mutually exclusive to being part of a Linux bridge. In fact, gswip_port_bridge_join() calls gswip_add_single_port_br() with add=false, i.e. removes the port from the "single port bridge" to enable autonomous forwarding. The blamed commit seems to have incorrectly thought that ds->ops->port_enable() is called one time per port, during the setup phase of the switch. However, it is actually called during the ndo_open() implementation of DSA user ports, which is to say that this sequence of events: 1. ip link set swp0 down 2. ip link add br0 type bridge 3. ip link set swp0 master br0 4. ip link set swp0 up would cause swp0 to join back the "single port bridge" which step 3 had just removed it from. The correct DSA hook for one-time actions per port at switch init time is ds->ops->port_setup(). This is what seems to match the coder's intention; also see the comment at the beginning of the file: * At the initialization the driver allocates one bridge table entry for ~~~~~~~~~~~~~~~~~~~~~ * each switch port which is used when the port is used without an * explicit bridge. Fixes: 8206e0c ("net: dsa: lantiq: Add VLAN unaware bridge offloading") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://patch.msgid.link/20250918072142.894692-2-vladimir.oltean@nxp.com Tested-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b9010db commit e8687ab

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

drivers/net/dsa/lantiq_gswip.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,18 +655,27 @@ static int gswip_add_single_port_br(struct gswip_priv *priv, int port, bool add)
655655
return 0;
656656
}
657657

658-
static int gswip_port_enable(struct dsa_switch *ds, int port,
659-
struct phy_device *phydev)
658+
static int gswip_port_setup(struct dsa_switch *ds, int port)
660659
{
661660
struct gswip_priv *priv = ds->priv;
662661
int err;
663662

664663
if (!dsa_is_cpu_port(ds, port)) {
665-
u32 mdio_phy = 0;
666-
667664
err = gswip_add_single_port_br(priv, port, true);
668665
if (err)
669666
return err;
667+
}
668+
669+
return 0;
670+
}
671+
672+
static int gswip_port_enable(struct dsa_switch *ds, int port,
673+
struct phy_device *phydev)
674+
{
675+
struct gswip_priv *priv = ds->priv;
676+
677+
if (!dsa_is_cpu_port(ds, port)) {
678+
u32 mdio_phy = 0;
670679

671680
if (phydev)
672681
mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK;
@@ -1794,6 +1803,7 @@ static int gswip_get_sset_count(struct dsa_switch *ds, int port, int sset)
17941803
static const struct dsa_switch_ops gswip_xrx200_switch_ops = {
17951804
.get_tag_protocol = gswip_get_tag_protocol,
17961805
.setup = gswip_setup,
1806+
.port_setup = gswip_port_setup,
17971807
.port_enable = gswip_port_enable,
17981808
.port_disable = gswip_port_disable,
17991809
.port_bridge_join = gswip_port_bridge_join,

0 commit comments

Comments
 (0)