Skip to content

Commit b00d11c

Browse files
KanjiMonstersmb49
authored andcommitted
net: dsa: b53: do not set learning and unicast/multicast on up
BugLink: https://bugs.launchpad.net/bugs/2130277 [ Upstream commit 2e7179c ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 0babc09 commit b00d11c

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
@@ -565,6 +565,18 @@ static void b53_port_set_learning(struct b53_device *dev, int port,
565565
b53_write16(dev, B53_CTRL_PAGE, B53_DIS_LEARNING, reg);
566566
}
567567

568+
int b53_setup_port(struct dsa_switch *ds, int port)
569+
{
570+
struct b53_device *dev = ds->priv;
571+
572+
b53_port_set_ucast_flood(dev, port, true);
573+
b53_port_set_mcast_flood(dev, port, true);
574+
b53_port_set_learning(dev, port, false);
575+
576+
return 0;
577+
}
578+
EXPORT_SYMBOL(b53_setup_port);
579+
568580
int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
569581
{
570582
struct b53_device *dev = ds->priv;
@@ -577,10 +589,6 @@ int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
577589

578590
cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
579591

580-
b53_port_set_ucast_flood(dev, port, true);
581-
b53_port_set_mcast_flood(dev, port, true);
582-
b53_port_set_learning(dev, port, false);
583-
584592
if (dev->ops->irq_enable)
585593
ret = dev->ops->irq_enable(dev, port);
586594
if (ret)
@@ -711,10 +719,6 @@ static void b53_enable_cpu_port(struct b53_device *dev, int port)
711719
b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), port_ctrl);
712720

713721
b53_brcm_hdr_setup(dev->ds, port);
714-
715-
b53_port_set_ucast_flood(dev, port, true);
716-
b53_port_set_mcast_flood(dev, port, true);
717-
b53_port_set_learning(dev, port, false);
718722
}
719723

720724
static void b53_enable_mib(struct b53_device *dev)
@@ -2396,6 +2400,7 @@ static const struct dsa_switch_ops b53_switch_ops = {
23962400
.phylink_mac_config = b53_phylink_mac_config,
23972401
.phylink_mac_link_down = b53_phylink_mac_link_down,
23982402
.phylink_mac_link_up = b53_phylink_mac_link_up,
2403+
.port_setup = b53_setup_port,
23992404
.port_enable = b53_enable_port,
24002405
.port_disable = b53_disable_port,
24012406
.get_mac_eee = b53_get_mac_eee,

drivers/net/dsa/b53/b53_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
394394
enum dsa_tag_protocol mprot);
395395
void b53_mirror_del(struct dsa_switch *ds, int port,
396396
struct dsa_mall_mirror_tc_entry *mirror);
397+
int b53_setup_port(struct dsa_switch *ds, int port);
397398
int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
398399
void b53_disable_port(struct dsa_switch *ds, int port);
399400
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
@@ -1216,6 +1216,7 @@ static const struct dsa_switch_ops bcm_sf2_ops = {
12161216
.resume = bcm_sf2_sw_resume,
12171217
.get_wol = bcm_sf2_sw_get_wol,
12181218
.set_wol = bcm_sf2_sw_set_wol,
1219+
.port_setup = b53_setup_port,
12191220
.port_enable = bcm_sf2_port_setup,
12201221
.port_disable = bcm_sf2_port_disable,
12211222
.get_mac_eee = b53_get_mac_eee,

0 commit comments

Comments
 (0)