aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-22 17:16:42 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-22 17:16:42 -0400
commitcf508b1211dbe576778ff445ea1b4b0bcfa5c4ea (patch)
tree4774838c2db17db71662a625fea25def8823341a
parentd29f749e252bcdbfe7a75a58f0ee92da16f127c0 (diff)
netdev: Handle ->addr_list_lock just like ->_xmit_lock for lockdep.
The new address list lock needs to handle the same device layering issues that the _xmit_lock one does. This integrates work done by Patrick McHardy. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bonding/bond_main.c3
-rw-r--r--drivers/net/hamradio/bpqether.c2
-rw-r--r--drivers/net/macvlan.c3
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c3
-rw-r--r--net/8021q/vlan_dev.c4
-rw-r--r--net/core/dev.c27
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/rose/af_rose.c2
8 files changed, 40 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9737c06045d6..a641eeaa2a2f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5041,6 +5041,7 @@ static int bond_check_params(struct bond_params *params)
5041} 5041}
5042 5042
5043static struct lock_class_key bonding_netdev_xmit_lock_key; 5043static struct lock_class_key bonding_netdev_xmit_lock_key;
5044static struct lock_class_key bonding_netdev_addr_lock_key;
5044 5045
5045static void bond_set_lockdep_class_one(struct net_device *dev, 5046static void bond_set_lockdep_class_one(struct net_device *dev,
5046 struct netdev_queue *txq, 5047 struct netdev_queue *txq,
@@ -5052,6 +5053,8 @@ static void bond_set_lockdep_class_one(struct net_device *dev,
5052 5053
5053static void bond_set_lockdep_class(struct net_device *dev) 5054static void bond_set_lockdep_class(struct net_device *dev)
5054{ 5055{
5056 lockdep_set_class(&dev->addr_list_lock,
5057 &bonding_netdev_addr_lock_key);
5055 netdev_for_each_tx_queue(dev, bond_set_lockdep_class_one, NULL); 5058 netdev_for_each_tx_queue(dev, bond_set_lockdep_class_one, NULL);
5056} 5059}
5057 5060
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index b6500b2aacf2..58f4b1d7bf1f 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -123,6 +123,7 @@ static LIST_HEAD(bpq_devices);
123 * off into a separate class since they always nest. 123 * off into a separate class since they always nest.
124 */ 124 */
125static struct lock_class_key bpq_netdev_xmit_lock_key; 125static struct lock_class_key bpq_netdev_xmit_lock_key;
126static struct lock_class_key bpq_netdev_addr_lock_key;
126 127
127static void bpq_set_lockdep_class_one(struct net_device *dev, 128static void bpq_set_lockdep_class_one(struct net_device *dev,
128 struct netdev_queue *txq, 129 struct netdev_queue *txq,
@@ -133,6 +134,7 @@ static void bpq_set_lockdep_class_one(struct net_device *dev,
133 134
134static void bpq_set_lockdep_class(struct net_device *dev) 135static void bpq_set_lockdep_class(struct net_device *dev)
135{ 136{
137 lockdep_set_class(&dev->addr_list_lock, &bpq_netdev_addr_lock_key);
136 netdev_for_each_tx_queue(dev, bpq_set_lockdep_class_one, NULL); 138 netdev_for_each_tx_queue(dev, bpq_set_lockdep_class_one, NULL);
137} 139}
138 140
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index efbc15567dd3..42394505bb50 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -276,6 +276,7 @@ static int macvlan_change_mtu(struct net_device *dev, int new_mtu)
276 * separate class since they always nest. 276 * separate class since they always nest.
277 */ 277 */
278static struct lock_class_key macvlan_netdev_xmit_lock_key; 278static struct lock_class_key macvlan_netdev_xmit_lock_key;
279static struct lock_class_key macvlan_netdev_addr_lock_key;
279 280
280#define MACVLAN_FEATURES \ 281#define MACVLAN_FEATURES \
281 (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ 282 (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
@@ -295,6 +296,8 @@ static void macvlan_set_lockdep_class_one(struct net_device *dev,
295 296
296static void macvlan_set_lockdep_class(struct net_device *dev) 297static void macvlan_set_lockdep_class(struct net_device *dev)
297{ 298{
299 lockdep_set_class(&dev->addr_list_lock,
300 &macvlan_netdev_addr_lock_key);
298 netdev_for_each_tx_queue(dev, macvlan_set_lockdep_class_one, NULL); 301 netdev_for_each_tx_queue(dev, macvlan_set_lockdep_class_one, NULL);
299} 302}
300 303
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 13d5882f1f21..3153fe9d7ce0 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -3101,6 +3101,7 @@ static void prism2_clear_set_tim_queue(local_info_t *local)
3101 * This is a natural nesting, which needs a split lock type. 3101 * This is a natural nesting, which needs a split lock type.
3102 */ 3102 */
3103static struct lock_class_key hostap_netdev_xmit_lock_key; 3103static struct lock_class_key hostap_netdev_xmit_lock_key;
3104static struct lock_class_key hostap_netdev_addr_lock_key;
3104 3105
3105static void prism2_set_lockdep_class_one(struct net_device *dev, 3106static void prism2_set_lockdep_class_one(struct net_device *dev,
3106 struct netdev_queue *txq, 3107 struct netdev_queue *txq,
@@ -3112,6 +3113,8 @@ static void prism2_set_lockdep_class_one(struct net_device *dev,
3112 3113
3113static void prism2_set_lockdep_class(struct net_device *dev) 3114static void prism2_set_lockdep_class(struct net_device *dev)
3114{ 3115{
3116 lockdep_set_class(&dev->addr_list_lock,
3117 &hostap_netdev_addr_lock_key);
3115 netdev_for_each_tx_queue(dev, prism2_set_lockdep_class_one, NULL); 3118 netdev_for_each_tx_queue(dev, prism2_set_lockdep_class_one, NULL);
3116} 3119}
3117 3120
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index f42bc2b26b85..4bf014e51f8c 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -569,6 +569,7 @@ static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
569 * separate class since they always nest. 569 * separate class since they always nest.
570 */ 570 */
571static struct lock_class_key vlan_netdev_xmit_lock_key; 571static struct lock_class_key vlan_netdev_xmit_lock_key;
572static struct lock_class_key vlan_netdev_addr_lock_key;
572 573
573static void vlan_dev_set_lockdep_one(struct net_device *dev, 574static void vlan_dev_set_lockdep_one(struct net_device *dev,
574 struct netdev_queue *txq, 575 struct netdev_queue *txq,
@@ -581,6 +582,9 @@ static void vlan_dev_set_lockdep_one(struct net_device *dev,
581 582
582static void vlan_dev_set_lockdep_class(struct net_device *dev, int subclass) 583static void vlan_dev_set_lockdep_class(struct net_device *dev, int subclass)
583{ 584{
585 lockdep_set_class_and_subclass(&dev->addr_list_lock,
586 &vlan_netdev_addr_lock_key,
587 subclass);
584 netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, &subclass); 588 netdev_for_each_tx_queue(dev, vlan_dev_set_lockdep_one, &subclass);
585} 589}
586 590
diff --git a/net/core/dev.c b/net/core/dev.c
index 65eea83613ef..6bf217da9d8f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -261,7 +261,7 @@ static RAW_NOTIFIER_HEAD(netdev_chain);
261 261
262DEFINE_PER_CPU(struct softnet_data, softnet_data); 262DEFINE_PER_CPU(struct softnet_data, softnet_data);
263 263
264#ifdef CONFIG_DEBUG_LOCK_ALLOC 264#ifdef CONFIG_LOCKDEP
265/* 265/*
266 * register_netdevice() inits txq->_xmit_lock and sets lockdep class 266 * register_netdevice() inits txq->_xmit_lock and sets lockdep class
267 * according to dev->type 267 * according to dev->type
@@ -301,6 +301,7 @@ static const char *netdev_lock_name[] =
301 "_xmit_NONE"}; 301 "_xmit_NONE"};
302 302
303static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)]; 303static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)];
304static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)];
304 305
305static inline unsigned short netdev_lock_pos(unsigned short dev_type) 306static inline unsigned short netdev_lock_pos(unsigned short dev_type)
306{ 307{
@@ -313,8 +314,8 @@ static inline unsigned short netdev_lock_pos(unsigned short dev_type)
313 return ARRAY_SIZE(netdev_lock_type) - 1; 314 return ARRAY_SIZE(netdev_lock_type) - 1;
314} 315}
315 316
316static inline void netdev_set_lockdep_class(spinlock_t *lock, 317static inline void netdev_set_xmit_lockdep_class(spinlock_t *lock,
317 unsigned short dev_type) 318 unsigned short dev_type)
318{ 319{
319 int i; 320 int i;
320 321
@@ -322,9 +323,22 @@ static inline void netdev_set_lockdep_class(spinlock_t *lock,
322 lockdep_set_class_and_name(lock, &netdev_xmit_lock_key[i], 323 lockdep_set_class_and_name(lock, &netdev_xmit_lock_key[i],
323 netdev_lock_name[i]); 324 netdev_lock_name[i]);
324} 325}
326
327static inline void netdev_set_addr_lockdep_class(struct net_device *dev)
328{
329 int i;
330
331 i = netdev_lock_pos(dev->type);
332 lockdep_set_class_and_name(&dev->addr_list_lock,
333 &netdev_addr_lock_key[i],
334 netdev_lock_name[i]);
335}
325#else 336#else
326static inline void netdev_set_lockdep_class(spinlock_t *lock, 337static inline void netdev_set_xmit_lockdep_class(spinlock_t *lock,
327 unsigned short dev_type) 338 unsigned short dev_type)
339{
340}
341static inline void netdev_set_addr_lockdep_class(struct net_device *dev)
328{ 342{
329} 343}
330#endif 344#endif
@@ -3851,7 +3865,7 @@ static void __netdev_init_queue_locks_one(struct net_device *dev,
3851 void *_unused) 3865 void *_unused)
3852{ 3866{
3853 spin_lock_init(&dev_queue->_xmit_lock); 3867 spin_lock_init(&dev_queue->_xmit_lock);
3854 netdev_set_lockdep_class(&dev_queue->_xmit_lock, dev->type); 3868 netdev_set_xmit_lockdep_class(&dev_queue->_xmit_lock, dev->type);
3855 dev_queue->xmit_lock_owner = -1; 3869 dev_queue->xmit_lock_owner = -1;
3856} 3870}
3857 3871
@@ -3896,6 +3910,7 @@ int register_netdevice(struct net_device *dev)
3896 net = dev_net(dev); 3910 net = dev_net(dev);
3897 3911
3898 spin_lock_init(&dev->addr_list_lock); 3912 spin_lock_init(&dev->addr_list_lock);
3913 netdev_set_addr_lockdep_class(dev);
3899 netdev_init_queue_locks(dev); 3914 netdev_init_queue_locks(dev);
3900 3915
3901 dev->iflink = -1; 3916 dev->iflink = -1;
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index fccc250f95f5..532e4faa29f7 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -73,6 +73,7 @@ static const struct proto_ops nr_proto_ops;
73 * separate class since they always nest. 73 * separate class since they always nest.
74 */ 74 */
75static struct lock_class_key nr_netdev_xmit_lock_key; 75static struct lock_class_key nr_netdev_xmit_lock_key;
76static struct lock_class_key nr_netdev_addr_lock_key;
76 77
77static void nr_set_lockdep_one(struct net_device *dev, 78static void nr_set_lockdep_one(struct net_device *dev,
78 struct netdev_queue *txq, 79 struct netdev_queue *txq,
@@ -83,6 +84,7 @@ static void nr_set_lockdep_one(struct net_device *dev,
83 84
84static void nr_set_lockdep_key(struct net_device *dev) 85static void nr_set_lockdep_key(struct net_device *dev)
85{ 86{
87 lockdep_set_class(&dev->addr_list_lock, &nr_netdev_addr_lock_key);
86 netdev_for_each_tx_queue(dev, nr_set_lockdep_one, NULL); 88 netdev_for_each_tx_queue(dev, nr_set_lockdep_one, NULL);
87} 89}
88 90
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index dbc963b4f5fb..a7f1ce11bc22 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -74,6 +74,7 @@ ax25_address rose_callsign;
74 * separate class since they always nest. 74 * separate class since they always nest.
75 */ 75 */
76static struct lock_class_key rose_netdev_xmit_lock_key; 76static struct lock_class_key rose_netdev_xmit_lock_key;
77static struct lock_class_key rose_netdev_addr_lock_key;
77 78
78static void rose_set_lockdep_one(struct net_device *dev, 79static void rose_set_lockdep_one(struct net_device *dev,
79 struct netdev_queue *txq, 80 struct netdev_queue *txq,
@@ -84,6 +85,7 @@ static void rose_set_lockdep_one(struct net_device *dev,
84 85
85static void rose_set_lockdep_key(struct net_device *dev) 86static void rose_set_lockdep_key(struct net_device *dev)
86{ 87{
88 lockdep_set_class(&dev->addr_list_lock, &rose_netdev_addr_lock_key);
87 netdev_for_each_tx_queue(dev, rose_set_lockdep_one, NULL); 89 netdev_for_each_tx_queue(dev, rose_set_lockdep_one, NULL);
88} 90}
89 91