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.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 48be3d5c0d92..a74e278654aa 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -30,6 +30,10 @@
30#include <net/pkt_sched.h> 30#include <net/pkt_sched.h>
31#include <net/dst.h> 31#include <net/dst.h>
32 32
33/* Qdisc to use by default */
34const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops;
35EXPORT_SYMBOL(default_qdisc_ops);
36
33/* Main transmission queue. */ 37/* Main transmission queue. */
34 38
35/* Modifications to data participating in scheduling must be protected with 39/* Modifications to data participating in scheduling must be protected with
@@ -530,12 +534,11 @@ struct Qdisc_ops pfifo_fast_ops __read_mostly = {
530 .dump = pfifo_fast_dump, 534 .dump = pfifo_fast_dump,
531 .owner = THIS_MODULE, 535 .owner = THIS_MODULE,
532}; 536};
533EXPORT_SYMBOL(pfifo_fast_ops);
534 537
535static struct lock_class_key qdisc_tx_busylock; 538static struct lock_class_key qdisc_tx_busylock;
536 539
537struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, 540struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
538 struct Qdisc_ops *ops) 541 const struct Qdisc_ops *ops)
539{ 542{
540 void *p; 543 void *p;
541 struct Qdisc *sch; 544 struct Qdisc *sch;
@@ -579,10 +582,14 @@ errout:
579} 582}
580 583
581struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, 584struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
582 struct Qdisc_ops *ops, unsigned int parentid) 585 const struct Qdisc_ops *ops,
586 unsigned int parentid)
583{ 587{
584 struct Qdisc *sch; 588 struct Qdisc *sch;
585 589
590 if (!try_module_get(ops->owner))
591 goto errout;
592
586 sch = qdisc_alloc(dev_queue, ops); 593 sch = qdisc_alloc(dev_queue, ops);
587 if (IS_ERR(sch)) 594 if (IS_ERR(sch))
588 goto errout; 595 goto errout;
@@ -686,7 +693,7 @@ static void attach_one_default_qdisc(struct net_device *dev,
686 693
687 if (dev->tx_queue_len) { 694 if (dev->tx_queue_len) {
688 qdisc = qdisc_create_dflt(dev_queue, 695 qdisc = qdisc_create_dflt(dev_queue,
689 &pfifo_fast_ops, TC_H_ROOT); 696 default_qdisc_ops, TC_H_ROOT);
690 if (!qdisc) { 697 if (!qdisc) {
691 netdev_info(dev, "activation failed\n"); 698 netdev_info(dev, "activation failed\n");
692 return; 699 return;
@@ -739,9 +746,8 @@ void dev_activate(struct net_device *dev)
739 int need_watchdog; 746 int need_watchdog;
740 747
741 /* No queueing discipline is attached to device; 748 /* No queueing discipline is attached to device;
742 create default one i.e. pfifo_fast for devices, 749 * create default one for devices, which need queueing
743 which need queueing and noqueue_qdisc for 750 * and noqueue_qdisc for virtual interfaces
744 virtual interfaces
745 */ 751 */
746 752
747 if (dev->qdisc == &noop_qdisc) 753 if (dev->qdisc == &noop_qdisc)