summaryrefslogtreecommitdiff
path: root/net/bridge
diff options
context:
space:
mode:
authorHoratiu Vultur <horatiu.vultur@microchip.com>2020-05-21 23:19:07 +0000
committerDavid S. Miller <davem@davemloft.net>2020-05-22 16:17:15 -0700
commit4fb13499d3a0cc74cf9820c052481f0ccda2bb23 (patch)
treef127f0ca4b86898b7528b157e7bd397b41dafe30 /net/bridge
parent89c1e111cb4860b51efef50474cd259c2702edc6 (diff)
downloadlinux-riscv-4fb13499d3a0cc74cf9820c052481f0ccda2bb23.tar.gz
linux-riscv-4fb13499d3a0cc74cf9820c052481f0ccda2bb23.tar.bz2
linux-riscv-4fb13499d3a0cc74cf9820c052481f0ccda2bb23.zip
bridge: mrp: Restore port state when deleting MRP instance
When a MRP instance is deleted, then restore the port according to the bridge state. If the bridge is up then the ports will be in forwarding state otherwise will be in disabled state. Fixes: 9a9f26e8f7ea ("bridge: mrp: Connect MRP API with the switchdev API") Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_mrp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/bridge/br_mrp.c b/net/bridge/br_mrp.c
index 854e31bf0151..528d767eb026 100644
--- a/net/bridge/br_mrp.c
+++ b/net/bridge/br_mrp.c
@@ -223,6 +223,7 @@ out:
static void br_mrp_del_impl(struct net_bridge *br, struct br_mrp *mrp)
{
struct net_bridge_port *p;
+ u8 state;
/* Stop sending MRP_Test frames */
cancel_delayed_work_sync(&mrp->test_work);
@@ -234,20 +235,24 @@ static void br_mrp_del_impl(struct net_bridge *br, struct br_mrp *mrp)
p = rtnl_dereference(mrp->p_port);
if (p) {
spin_lock_bh(&br->lock);
- p->state = BR_STATE_FORWARDING;
+ state = netif_running(br->dev) ?
+ BR_STATE_FORWARDING : BR_STATE_DISABLED;
+ p->state = state;
p->flags &= ~BR_MRP_AWARE;
spin_unlock_bh(&br->lock);
- br_mrp_port_switchdev_set_state(p, BR_STATE_FORWARDING);
+ br_mrp_port_switchdev_set_state(p, state);
rcu_assign_pointer(mrp->p_port, NULL);
}
p = rtnl_dereference(mrp->s_port);
if (p) {
spin_lock_bh(&br->lock);
- p->state = BR_STATE_FORWARDING;
+ state = netif_running(br->dev) ?
+ BR_STATE_FORWARDING : BR_STATE_DISABLED;
+ p->state = state;
p->flags &= ~BR_MRP_AWARE;
spin_unlock_bh(&br->lock);
- br_mrp_port_switchdev_set_state(p, BR_STATE_FORWARDING);
+ br_mrp_port_switchdev_set_state(p, state);
rcu_assign_pointer(mrp->s_port, NULL);
}