aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/batman-adv/soft-interface.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index b9a28d2dd3e8..948860a2a576 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -347,7 +347,51 @@ out:
347 return; 347 return;
348} 348}
349 349
350/* batman-adv network devices have devices nesting below it and are a special
351 * "super class" of normal network devices; split their locks off into a
352 * separate class since they always nest.
353 */
354static struct lock_class_key batadv_netdev_xmit_lock_key;
355static struct lock_class_key batadv_netdev_addr_lock_key;
356
357/**
358 * batadv_set_lockdep_class_one - Set lockdep class for a single tx queue
359 * @dev: device which owns the tx queue
360 * @txq: tx queue to modify
361 * @_unused: always NULL
362 */
363static void batadv_set_lockdep_class_one(struct net_device *dev,
364 struct netdev_queue *txq,
365 void *_unused)
366{
367 lockdep_set_class(&txq->_xmit_lock, &batadv_netdev_xmit_lock_key);
368}
369
370/**
371 * batadv_set_lockdep_class - Set txq and addr_list lockdep class
372 * @dev: network device to modify
373 */
374static void batadv_set_lockdep_class(struct net_device *dev)
375{
376 lockdep_set_class(&dev->addr_list_lock, &batadv_netdev_addr_lock_key);
377 netdev_for_each_tx_queue(dev, batadv_set_lockdep_class_one, NULL);
378}
379
380/**
381 * batadv_softif_init - Late stage initialization of soft interface
382 * @dev: registered network device to modify
383 *
384 * Returns error code on failures
385 */
386static int batadv_softif_init(struct net_device *dev)
387{
388 batadv_set_lockdep_class(dev);
389
390 return 0;
391}
392
350static const struct net_device_ops batadv_netdev_ops = { 393static const struct net_device_ops batadv_netdev_ops = {
394 .ndo_init = batadv_softif_init,
351 .ndo_open = batadv_interface_open, 395 .ndo_open = batadv_interface_open,
352 .ndo_stop = batadv_interface_release, 396 .ndo_stop = batadv_interface_release,
353 .ndo_get_stats = batadv_interface_stats, 397 .ndo_get_stats = batadv_interface_stats,