sch_generic.c (589983cd21f4a2e4ed74a958805a90fa676845c5) sch_generic.c (6ec1c69a8f6492fd25722f4762721921da074c12)
1/*
2 * net/sched/sch_generic.c Generic packet scheduler routines.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 500 unchanged lines hidden (view full) ---

509 struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
510
511 for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
512 skb_queue_head_init(band2list(priv, prio));
513
514 return 0;
515}
516
1/*
2 * net/sched/sch_generic.c Generic packet scheduler routines.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 500 unchanged lines hidden (view full) ---

509 struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
510
511 for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
512 skb_queue_head_init(band2list(priv, prio));
513
514 return 0;
515}
516
517static struct Qdisc_ops pfifo_fast_ops __read_mostly = {
517struct Qdisc_ops pfifo_fast_ops __read_mostly = {
518 .id = "pfifo_fast",
519 .priv_size = sizeof(struct pfifo_fast_priv),
520 .enqueue = pfifo_fast_enqueue,
521 .dequeue = pfifo_fast_dequeue,
522 .peek = pfifo_fast_peek,
523 .init = pfifo_fast_init,
524 .reset = pfifo_fast_reset,
525 .dump = pfifo_fast_dump,

--- 139 unchanged lines hidden (view full) ---

665 /* Can by-pass the queue discipline for default qdisc */
666 qdisc->flags |= TCQ_F_CAN_BYPASS;
667 } else {
668 qdisc = &noqueue_qdisc;
669 }
670 dev_queue->qdisc_sleeping = qdisc;
671}
672
518 .id = "pfifo_fast",
519 .priv_size = sizeof(struct pfifo_fast_priv),
520 .enqueue = pfifo_fast_enqueue,
521 .dequeue = pfifo_fast_dequeue,
522 .peek = pfifo_fast_peek,
523 .init = pfifo_fast_init,
524 .reset = pfifo_fast_reset,
525 .dump = pfifo_fast_dump,

--- 139 unchanged lines hidden (view full) ---

665 /* Can by-pass the queue discipline for default qdisc */
666 qdisc->flags |= TCQ_F_CAN_BYPASS;
667 } else {
668 qdisc = &noqueue_qdisc;
669 }
670 dev_queue->qdisc_sleeping = qdisc;
671}
672
673static void attach_default_qdiscs(struct net_device *dev)
674{
675 struct netdev_queue *txq;
676 struct Qdisc *qdisc;
677
678 txq = netdev_get_tx_queue(dev, 0);
679
680 if (!netif_is_multiqueue(dev) || dev->tx_queue_len == 0) {
681 netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL);
682 dev->qdisc = txq->qdisc_sleeping;
683 atomic_inc(&dev->qdisc->refcnt);
684 } else {
685 qdisc = qdisc_create_dflt(dev, txq, &mq_qdisc_ops, TC_H_ROOT);
686 if (qdisc) {
687 qdisc->ops->attach(qdisc);
688 dev->qdisc = qdisc;
689 }
690 }
691}
692
673static void transition_one_qdisc(struct net_device *dev,
674 struct netdev_queue *dev_queue,
675 void *_need_watchdog)
676{
677 struct Qdisc *new_qdisc = dev_queue->qdisc_sleeping;
678 int *need_watchdog_p = _need_watchdog;
679
680 if (!(new_qdisc->flags & TCQ_F_BUILTIN))
681 clear_bit(__QDISC_STATE_DEACTIVATED, &new_qdisc->state);
682
683 rcu_assign_pointer(dev_queue->qdisc, new_qdisc);
684 if (need_watchdog_p && new_qdisc != &noqueue_qdisc) {
685 dev_queue->trans_start = 0;
686 *need_watchdog_p = 1;
687 }
688}
689
690void dev_activate(struct net_device *dev)
691{
693static void transition_one_qdisc(struct net_device *dev,
694 struct netdev_queue *dev_queue,
695 void *_need_watchdog)
696{
697 struct Qdisc *new_qdisc = dev_queue->qdisc_sleeping;
698 int *need_watchdog_p = _need_watchdog;
699
700 if (!(new_qdisc->flags & TCQ_F_BUILTIN))
701 clear_bit(__QDISC_STATE_DEACTIVATED, &new_qdisc->state);
702
703 rcu_assign_pointer(dev_queue->qdisc, new_qdisc);
704 if (need_watchdog_p && new_qdisc != &noqueue_qdisc) {
705 dev_queue->trans_start = 0;
706 *need_watchdog_p = 1;
707 }
708}
709
710void dev_activate(struct net_device *dev)
711{
692 struct netdev_queue *txq;
693 int need_watchdog;
694
695 /* No queueing discipline is attached to device;
696 create default one i.e. pfifo_fast for devices,
697 which need queueing and noqueue_qdisc for
698 virtual interfaces
699 */
700
712 int need_watchdog;
713
714 /* No queueing discipline is attached to device;
715 create default one i.e. pfifo_fast for devices,
716 which need queueing and noqueue_qdisc for
717 virtual interfaces
718 */
719
701 if (dev->qdisc == &noop_qdisc) {
702 netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL);
720 if (dev->qdisc == &noop_qdisc)
721 attach_default_qdiscs(dev);
703
722
704 txq = netdev_get_tx_queue(dev, 0);
705 dev->qdisc = txq->qdisc_sleeping;
706 atomic_inc(&dev->qdisc->refcnt);
707 }
708
709 if (!netif_carrier_ok(dev))
710 /* Delay activation until next carrier-on event */
711 return;
712
713 need_watchdog = 0;
714 netdev_for_each_tx_queue(dev, transition_one_qdisc, &need_watchdog);
715 transition_one_qdisc(dev, &dev->rx_queue, NULL);
716

--- 112 unchanged lines hidden ---
723 if (!netif_carrier_ok(dev))
724 /* Delay activation until next carrier-on event */
725 return;
726
727 need_watchdog = 0;
728 netdev_for_each_tx_queue(dev, transition_one_qdisc, &need_watchdog);
729 transition_one_qdisc(dev, &dev->rx_queue, NULL);
730

--- 112 unchanged lines hidden ---