Skip to content

Commit c0054b2

Browse files
vladimirolteanPaolo Abeni
authored andcommitted
net: dsa: lantiq_gswip: move gswip_add_single_port_br() call to port_setup()
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>
1 parent b7e32ae commit c0054b2

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

drivers/net/dsa/lantiq_gswip.c

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

688-
static int gswip_port_enable(struct dsa_switch *ds, int port,
689-
struct phy_device *phydev)
688+
static int gswip_port_setup(struct dsa_switch *ds, int port)
690689
{
691690
struct gswip_priv *priv = ds->priv;
692691
int err;
693692

694693
if (!dsa_is_cpu_port(ds, port)) {
695-
u32 mdio_phy = 0;
696-
697694
err = gswip_add_single_port_br(priv, port, true);
698695
if (err)
699696
return err;
697+
}
698+
699+
return 0;
700+
}
701+
702+
static int gswip_port_enable(struct dsa_switch *ds, int port,
703+
struct phy_device *phydev)
704+
{
705+
struct gswip_priv *priv = ds->priv;
706+
707+
if (!dsa_is_cpu_port(ds, port)) {
708+
u32 mdio_phy = 0;
700709

701710
if (phydev)
702711
mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK;
@@ -1829,6 +1838,7 @@ static const struct phylink_mac_ops gswip_phylink_mac_ops = {
18291838
static const struct dsa_switch_ops gswip_xrx200_switch_ops = {
18301839
.get_tag_protocol = gswip_get_tag_protocol,
18311840
.setup = gswip_setup,
1841+
.port_setup = gswip_port_setup,
18321842
.port_enable = gswip_port_enable,
18331843
.port_disable = gswip_port_disable,
18341844
.port_bridge_join = gswip_port_bridge_join,

0 commit comments

Comments
 (0)