aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
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 /net/core/dev.c
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>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c27
1 files changed, 21 insertions, 6 deletions
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;