Skip to content

Commit 2e7179c

Browse files
KanjiMonsterkuba-moo
authored andcommitted
net: dsa: b53: do not set learning and unicast/multicast on up
When a port gets set up, b53 disables learning and enables the port for flooding. This can undo any bridge configuration on the port. E.g. the following flow would disable learning on a port: $ ip link add br0 type bridge $ ip link set sw1p1 master br0 <- enables learning for sw1p1 $ ip link set br0 up $ ip link set sw1p1 up <- disables learning again Fix this by populating dsa_switch_ops::port_setup(), and set up initial config there. Fixes: f9b3827 ("net: dsa: b53: Support setting learning on port") Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://patch.msgid.link/20250429201710.330937-12-jonas.gorski@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 9f34ad8 commit 2e7179c

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,18 @@ static void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable)
578578
b53_write16(dev, B53_EEE_PAGE, B53_EEE_EN_CTRL, reg);
579579
}
580580

581+
int b53_setup_port(struct dsa_switch *ds, int port)
582+
{
583+
struct b53_device *dev = ds->priv;
584+
585+
b53_port_set_ucast_flood(dev, port, true);
586+
b53_port_set_mcast_flood(dev, port, true);
587+
b53_port_set_learning(dev, port, false);
588+
589+
return 0;
590+
}
591+
EXPORT_SYMBOL(b53_setup_port);
592+
581593
int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
582594
{
583595
struct b53_device *dev = ds->priv;
@@ -590,10 +602,6 @@ int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
590602

591603
cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
592604

593-
b53_port_set_ucast_flood(dev, port, true);
594-
b53_port_set_mcast_flood(dev, port, true);
595-
b53_port_set_learning(dev, port, false);
596-
597605
if (dev->ops->irq_enable)
598606
ret = dev->ops->irq_enable(dev, port);
599607
if (ret)
@@ -724,10 +732,6 @@ static void b53_enable_cpu_port(struct b53_device *dev, int port)
724732
b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), port_ctrl);
725733

726734
b53_brcm_hdr_setup(dev->ds, port);
727-
728-
b53_port_set_ucast_flood(dev, port, true);
729-
b53_port_set_mcast_flood(dev, port, true);
730-
b53_port_set_learning(dev, port, false);
731735
}
732736

733737
static void b53_enable_mib(struct b53_device *dev)
@@ -2387,6 +2391,7 @@ static const struct dsa_switch_ops b53_switch_ops = {
23872391
.phy_read = b53_phy_read16,
23882392
.phy_write = b53_phy_write16,
23892393
.phylink_get_caps = b53_phylink_get_caps,
2394+
.port_setup = b53_setup_port,
23902395
.port_enable = b53_enable_port,
23912396
.port_disable = b53_disable_port,
23922397
.support_eee = b53_support_eee,

drivers/net/dsa/b53/b53_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
384384
enum dsa_tag_protocol mprot);
385385
void b53_mirror_del(struct dsa_switch *ds, int port,
386386
struct dsa_mall_mirror_tc_entry *mirror);
387+
int b53_setup_port(struct dsa_switch *ds, int port);
387388
int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
388389
void b53_disable_port(struct dsa_switch *ds, int port);
389390
void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);

drivers/net/dsa/bcm_sf2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,7 @@ static const struct dsa_switch_ops bcm_sf2_ops = {
12301230
.resume = bcm_sf2_sw_resume,
12311231
.get_wol = bcm_sf2_sw_get_wol,
12321232
.set_wol = bcm_sf2_sw_set_wol,
1233+
.port_setup = b53_setup_port,
12331234
.port_enable = bcm_sf2_port_setup,
12341235
.port_disable = bcm_sf2_port_disable,
12351236
.support_eee = b53_support_eee,

0 commit comments

Comments
 (0)