sch_api.c (589983cd21f4a2e4ed74a958805a90fa676845c5) sch_api.c (6ec1c69a8f6492fd25722f4762721921da074c12)
1/*
2 * net/sched/sch_api.c Packet scheduler API.
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 *

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

673 (new && new->flags & TCQ_F_INGRESS)) {
674 num_q = 1;
675 ingress = 1;
676 }
677
678 if (dev->flags & IFF_UP)
679 dev_deactivate(dev);
680
1/*
2 * net/sched/sch_api.c Packet scheduler API.
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 *

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

673 (new && new->flags & TCQ_F_INGRESS)) {
674 num_q = 1;
675 ingress = 1;
676 }
677
678 if (dev->flags & IFF_UP)
679 dev_deactivate(dev);
680
681 if (new && new->ops->attach) {
682 new->ops->attach(new);
683 num_q = 0;
684 }
685
681 for (i = 0; i < num_q; i++) {
682 struct netdev_queue *dev_queue = &dev->rx_queue;
683
684 if (!ingress)
685 dev_queue = netdev_get_tx_queue(dev, i);
686
687 old = dev_graft_qdisc(dev_queue, new);
688 if (new && i > 0)
689 atomic_inc(&new->refcnt);
690
691 qdisc_destroy(old);
692 }
693
694 notify_and_destroy(skb, n, classid, dev->qdisc, new);
686 for (i = 0; i < num_q; i++) {
687 struct netdev_queue *dev_queue = &dev->rx_queue;
688
689 if (!ingress)
690 dev_queue = netdev_get_tx_queue(dev, i);
691
692 old = dev_graft_qdisc(dev_queue, new);
693 if (new && i > 0)
694 atomic_inc(&new->refcnt);
695
696 qdisc_destroy(old);
697 }
698
699 notify_and_destroy(skb, n, classid, dev->qdisc, new);
695 if (new)
700 if (new && !new->ops->attach)
696 atomic_inc(&new->refcnt);
697 dev->qdisc = new ? : &noop_qdisc;
698
699 if (dev->flags & IFF_UP)
700 dev_activate(dev);
701 } else {
702 const struct Qdisc_class_ops *cops = parent->ops->cl_ops;
703

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

1090
1091create_n_graft:
1092 if (!(n->nlmsg_flags&NLM_F_CREATE))
1093 return -ENOENT;
1094 if (clid == TC_H_INGRESS)
1095 q = qdisc_create(dev, &dev->rx_queue,
1096 tcm->tcm_parent, tcm->tcm_parent,
1097 tca, &err);
701 atomic_inc(&new->refcnt);
702 dev->qdisc = new ? : &noop_qdisc;
703
704 if (dev->flags & IFF_UP)
705 dev_activate(dev);
706 } else {
707 const struct Qdisc_class_ops *cops = parent->ops->cl_ops;
708

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

1095
1096create_n_graft:
1097 if (!(n->nlmsg_flags&NLM_F_CREATE))
1098 return -ENOENT;
1099 if (clid == TC_H_INGRESS)
1100 q = qdisc_create(dev, &dev->rx_queue,
1101 tcm->tcm_parent, tcm->tcm_parent,
1102 tca, &err);
1098 else
1099 q = qdisc_create(dev, netdev_get_tx_queue(dev, 0),
1103 else {
1104 unsigned int ntx = 0;
1105
1106 if (p && p->ops->cl_ops && p->ops->cl_ops->select_queue)
1107 ntx = p->ops->cl_ops->select_queue(p, tcm);
1108
1109 q = qdisc_create(dev, netdev_get_tx_queue(dev, ntx),
1100 tcm->tcm_parent, tcm->tcm_handle,
1101 tca, &err);
1110 tcm->tcm_parent, tcm->tcm_handle,
1111 tca, &err);
1112 }
1102 if (q == NULL) {
1103 if (err == -EAGAIN)
1104 goto replay;
1105 return err;
1106 }
1107
1108graft:
1109 err = qdisc_graft(dev, p, skb, n, clid, q, NULL);

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

1669 .release = single_release,
1670};
1671#endif
1672
1673static int __init pktsched_init(void)
1674{
1675 register_qdisc(&pfifo_qdisc_ops);
1676 register_qdisc(&bfifo_qdisc_ops);
1113 if (q == NULL) {
1114 if (err == -EAGAIN)
1115 goto replay;
1116 return err;
1117 }
1118
1119graft:
1120 err = qdisc_graft(dev, p, skb, n, clid, q, NULL);

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

1680 .release = single_release,
1681};
1682#endif
1683
1684static int __init pktsched_init(void)
1685{
1686 register_qdisc(&pfifo_qdisc_ops);
1687 register_qdisc(&bfifo_qdisc_ops);
1688 register_qdisc(&mq_qdisc_ops);
1677 proc_net_fops_create(&init_net, "psched", 0, &psched_fops);
1678
1679 rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL);
1680 rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL);
1681 rtnl_register(PF_UNSPEC, RTM_GETQDISC, tc_get_qdisc, tc_dump_qdisc);
1682 rtnl_register(PF_UNSPEC, RTM_NEWTCLASS, tc_ctl_tclass, NULL);
1683 rtnl_register(PF_UNSPEC, RTM_DELTCLASS, tc_ctl_tclass, NULL);
1684 rtnl_register(PF_UNSPEC, RTM_GETTCLASS, tc_ctl_tclass, tc_dump_tclass);
1685
1686 return 0;
1687}
1688
1689subsys_initcall(pktsched_init);
1689 proc_net_fops_create(&init_net, "psched", 0, &psched_fops);
1690
1691 rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL);
1692 rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL);
1693 rtnl_register(PF_UNSPEC, RTM_GETQDISC, tc_get_qdisc, tc_dump_qdisc);
1694 rtnl_register(PF_UNSPEC, RTM_NEWTCLASS, tc_ctl_tclass, NULL);
1695 rtnl_register(PF_UNSPEC, RTM_DELTCLASS, tc_ctl_tclass, NULL);
1696 rtnl_register(PF_UNSPEC, RTM_GETTCLASS, tc_ctl_tclass, tc_dump_tclass);
1697
1698 return 0;
1699}
1700
1701subsys_initcall(pktsched_init);