diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-03-11 13:35:31 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-11 13:35:31 -0500 |
commit | 749dfc70554f2c9e6624ac843d66571265ed9338 (patch) | |
tree | bf591255b3f158222f90852d53c4279e6e7e9ced /net/bridge/br_if.c | |
parent | 74f5ec29ae93aa42c49f4285c20c457afe937881 (diff) | |
parent | 0992a5d029181421877a716eaf99145828ff7eae (diff) |
Merge branch 'upstream-fixes'
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r-- | net/bridge/br_if.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 7fa3a5a9971f..f36b35edd60c 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -81,26 +81,27 @@ static void port_carrier_check(void *arg) | |||
81 | { | 81 | { |
82 | struct net_device *dev = arg; | 82 | struct net_device *dev = arg; |
83 | struct net_bridge_port *p; | 83 | struct net_bridge_port *p; |
84 | struct net_bridge *br; | ||
84 | 85 | ||
85 | rtnl_lock(); | 86 | rtnl_lock(); |
86 | p = dev->br_port; | 87 | p = dev->br_port; |
87 | if (!p) | 88 | if (!p) |
88 | goto done; | 89 | goto done; |
89 | 90 | br = p->br; | |
90 | if (netif_carrier_ok(p->dev)) { | 91 | |
91 | u32 cost = port_cost(p->dev); | 92 | if (netif_carrier_ok(dev)) |
92 | 93 | p->path_cost = port_cost(dev); | |
93 | spin_lock_bh(&p->br->lock); | 94 | |
94 | if (p->state == BR_STATE_DISABLED) { | 95 | if (br->dev->flags & IFF_UP) { |
95 | p->path_cost = cost; | 96 | spin_lock_bh(&br->lock); |
96 | br_stp_enable_port(p); | 97 | if (netif_carrier_ok(dev)) { |
98 | if (p->state == BR_STATE_DISABLED) | ||
99 | br_stp_enable_port(p); | ||
100 | } else { | ||
101 | if (p->state != BR_STATE_DISABLED) | ||
102 | br_stp_disable_port(p); | ||
97 | } | 103 | } |
98 | spin_unlock_bh(&p->br->lock); | 104 | spin_unlock_bh(&br->lock); |
99 | } else { | ||
100 | spin_lock_bh(&p->br->lock); | ||
101 | if (p->state != BR_STATE_DISABLED) | ||
102 | br_stp_disable_port(p); | ||
103 | spin_unlock_bh(&p->br->lock); | ||
104 | } | 105 | } |
105 | done: | 106 | done: |
106 | rtnl_unlock(); | 107 | rtnl_unlock(); |
@@ -168,6 +169,7 @@ static void del_nbp(struct net_bridge_port *p) | |||
168 | 169 | ||
169 | rcu_assign_pointer(dev->br_port, NULL); | 170 | rcu_assign_pointer(dev->br_port, NULL); |
170 | 171 | ||
172 | kobject_uevent(&p->kobj, KOBJ_REMOVE); | ||
171 | kobject_del(&p->kobj); | 173 | kobject_del(&p->kobj); |
172 | 174 | ||
173 | call_rcu(&p->rcu, destroy_nbp_rcu); | 175 | call_rcu(&p->rcu, destroy_nbp_rcu); |
@@ -276,8 +278,9 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br, | |||
276 | br_init_port(p); | 278 | br_init_port(p); |
277 | p->state = BR_STATE_DISABLED; | 279 | p->state = BR_STATE_DISABLED; |
278 | INIT_WORK(&p->carrier_check, port_carrier_check, dev); | 280 | INIT_WORK(&p->carrier_check, port_carrier_check, dev); |
279 | kobject_init(&p->kobj); | 281 | br_stp_port_timer_init(p); |
280 | 282 | ||
283 | kobject_init(&p->kobj); | ||
281 | kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); | 284 | kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); |
282 | p->kobj.ktype = &brport_ktype; | 285 | p->kobj.ktype = &brport_ktype; |
283 | p->kobj.parent = &(dev->class_dev.kobj); | 286 | p->kobj.parent = &(dev->class_dev.kobj); |