aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_notify.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-02-22 04:10:18 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-26 14:42:59 -0500
commit269def7c505b4d229f9ad49bf88543d1e605533e (patch)
tree341377271f16c0def001a876217a8e6f430d75b4 /net/bridge/br_notify.c
parentac062e84d0c177c43549e7fb608152fec218e7fc (diff)
[BRIDGE]: eliminate workqueue for carrier check
Having a work queue for checking carrier leads to lots of race issues. Simpler to just get the cost when data structure is created and update on change. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_notify.c')
-rw-r--r--net/bridge/br_notify.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index 3311c4e30829..37357ed2149b 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -42,51 +42,48 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
42 42
43 br = p->br; 43 br = p->br;
44 44
45 spin_lock_bh(&br->lock);
46 switch (event) { 45 switch (event) {
47 case NETDEV_CHANGEMTU: 46 case NETDEV_CHANGEMTU:
48 dev_set_mtu(br->dev, br_min_mtu(br)); 47 dev_set_mtu(br->dev, br_min_mtu(br));
49 break; 48 break;
50 49
51 case NETDEV_CHANGEADDR: 50 case NETDEV_CHANGEADDR:
51 spin_lock_bh(&br->lock);
52 br_fdb_changeaddr(p, dev->dev_addr); 52 br_fdb_changeaddr(p, dev->dev_addr);
53 br_ifinfo_notify(RTM_NEWLINK, p); 53 br_ifinfo_notify(RTM_NEWLINK, p);
54 br_stp_recalculate_bridge_id(br); 54 br_stp_recalculate_bridge_id(br);
55 spin_unlock_bh(&br->lock);
55 break; 56 break;
56 57
57 case NETDEV_CHANGE: 58 case NETDEV_CHANGE:
58 if (br->dev->flags & IFF_UP) 59 br_port_carrier_check(p);
59 if (schedule_delayed_work(&p->carrier_check,
60 BR_PORT_DEBOUNCE))
61 dev_hold(dev);
62 break; 60 break;
63 61
64 case NETDEV_FEAT_CHANGE: 62 case NETDEV_FEAT_CHANGE:
65 if (br->dev->flags & IFF_UP) 63 spin_lock_bh(&br->lock);
64 if (netif_running(br->dev))
66 br_features_recompute(br); 65 br_features_recompute(br);
67 66 spin_unlock_bh(&br->lock);
68 /* could do recursive feature change notification
69 * but who would care??
70 */
71 break; 67 break;
72 68
73 case NETDEV_DOWN: 69 case NETDEV_DOWN:
70 spin_lock_bh(&br->lock);
74 if (br->dev->flags & IFF_UP) 71 if (br->dev->flags & IFF_UP)
75 br_stp_disable_port(p); 72 br_stp_disable_port(p);
73 spin_unlock_bh(&br->lock);
76 break; 74 break;
77 75
78 case NETDEV_UP: 76 case NETDEV_UP:
77 spin_lock_bh(&br->lock);
79 if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) 78 if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP))
80 br_stp_enable_port(p); 79 br_stp_enable_port(p);
80 spin_unlock_bh(&br->lock);
81 break; 81 break;
82 82
83 case NETDEV_UNREGISTER: 83 case NETDEV_UNREGISTER:
84 spin_unlock_bh(&br->lock);
85 br_del_if(br, dev); 84 br_del_if(br, dev);
86 goto done; 85 break;
87 } 86 }
88 spin_unlock_bh(&br->lock);
89 87
90 done:
91 return NOTIFY_DONE; 88 return NOTIFY_DONE;
92} 89}