aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_generic.c')
-rw-r--r--net/sched/sch_generic.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 511323e89cec..aefc1504dc88 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -324,24 +324,6 @@ void netif_carrier_off(struct net_device *dev)
324} 324}
325EXPORT_SYMBOL(netif_carrier_off); 325EXPORT_SYMBOL(netif_carrier_off);
326 326
327/**
328 * netif_notify_peers - notify network peers about existence of @dev
329 * @dev: network device
330 *
331 * Generate traffic such that interested network peers are aware of
332 * @dev, such as by generating a gratuitous ARP. This may be used when
333 * a device wants to inform the rest of the network about some sort of
334 * reconfiguration such as a failover event or virtual machine
335 * migration.
336 */
337void netif_notify_peers(struct net_device *dev)
338{
339 rtnl_lock();
340 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
341 rtnl_unlock();
342}
343EXPORT_SYMBOL(netif_notify_peers);
344
345/* "NOOP" scheduler: the best scheduler, recommended for all interfaces 327/* "NOOP" scheduler: the best scheduler, recommended for all interfaces
346 under all circumstances. It is difficult to invent anything faster or 328 under all circumstances. It is difficult to invent anything faster or
347 cheaper. 329 cheaper.
@@ -545,6 +527,8 @@ struct Qdisc_ops pfifo_fast_ops __read_mostly = {
545}; 527};
546EXPORT_SYMBOL(pfifo_fast_ops); 528EXPORT_SYMBOL(pfifo_fast_ops);
547 529
530static struct lock_class_key qdisc_tx_busylock;
531
548struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, 532struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
549 struct Qdisc_ops *ops) 533 struct Qdisc_ops *ops)
550{ 534{
@@ -552,6 +536,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
552 struct Qdisc *sch; 536 struct Qdisc *sch;
553 unsigned int size = QDISC_ALIGN(sizeof(*sch)) + ops->priv_size; 537 unsigned int size = QDISC_ALIGN(sizeof(*sch)) + ops->priv_size;
554 int err = -ENOBUFS; 538 int err = -ENOBUFS;
539 struct net_device *dev = dev_queue->dev;
555 540
556 p = kzalloc_node(size, GFP_KERNEL, 541 p = kzalloc_node(size, GFP_KERNEL,
557 netdev_queue_numa_node_read(dev_queue)); 542 netdev_queue_numa_node_read(dev_queue));
@@ -571,12 +556,16 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
571 } 556 }
572 INIT_LIST_HEAD(&sch->list); 557 INIT_LIST_HEAD(&sch->list);
573 skb_queue_head_init(&sch->q); 558 skb_queue_head_init(&sch->q);
559
574 spin_lock_init(&sch->busylock); 560 spin_lock_init(&sch->busylock);
561 lockdep_set_class(&sch->busylock,
562 dev->qdisc_tx_busylock ?: &qdisc_tx_busylock);
563
575 sch->ops = ops; 564 sch->ops = ops;
576 sch->enqueue = ops->enqueue; 565 sch->enqueue = ops->enqueue;
577 sch->dequeue = ops->dequeue; 566 sch->dequeue = ops->dequeue;
578 sch->dev_queue = dev_queue; 567 sch->dev_queue = dev_queue;
579 dev_hold(qdisc_dev(sch)); 568 dev_hold(dev);
580 atomic_set(&sch->refcnt, 1); 569 atomic_set(&sch->refcnt, 1);
581 570
582 return sch; 571 return sch;