{
struct net_device *dev = arg;
struct net_bridge_port *p;
+ struct net_bridge *br;
rtnl_lock();
p = dev->br_port;
if (!p)
goto done;
-
- if (netif_carrier_ok(p->dev)) {
- u32 cost = port_cost(p->dev);
-
- spin_lock_bh(&p->br->lock);
- if (p->state == BR_STATE_DISABLED) {
- p->path_cost = cost;
- br_stp_enable_port(p);
+ br = p->br;
+
+ if (netif_carrier_ok(dev))
+ p->path_cost = port_cost(dev);
+
+ if (br->dev->flags & IFF_UP) {
+ spin_lock_bh(&br->lock);
+ if (netif_carrier_ok(dev)) {
+ if (p->state == BR_STATE_DISABLED)
+ br_stp_enable_port(p);
+ } else {
+ if (p->state != BR_STATE_DISABLED)
+ br_stp_disable_port(p);
}
- spin_unlock_bh(&p->br->lock);
- } else {
- spin_lock_bh(&p->br->lock);
- if (p->state != BR_STATE_DISABLED)
- br_stp_disable_port(p);
- spin_unlock_bh(&p->br->lock);
+ spin_unlock_bh(&br->lock);
}
done:
rtnl_unlock();