sch_generic.c (112d6212c80a1c560757520bd822a41c0ad15c2c) | sch_generic.c (ab92d68fc22f9afab480153bd82a20f6e2533769) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * net/sched/sch_generic.c Generic packet scheduler routines. 4 * 5 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 6 * Jamal Hadi Salim, <hadi@cyberus.ca> 990601 7 * - Ingress support 8 */ --- 785 unchanged lines hidden (view full) --- 794 .reset = pfifo_fast_reset, 795 .dump = pfifo_fast_dump, 796 .change_tx_queue_len = pfifo_fast_change_tx_queue_len, 797 .owner = THIS_MODULE, 798 .static_flags = TCQ_F_NOLOCK | TCQ_F_CPUSTATS, 799}; 800EXPORT_SYMBOL(pfifo_fast_ops); 801 | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * net/sched/sch_generic.c Generic packet scheduler routines. 4 * 5 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 6 * Jamal Hadi Salim, <hadi@cyberus.ca> 990601 7 * - Ingress support 8 */ --- 785 unchanged lines hidden (view full) --- 794 .reset = pfifo_fast_reset, 795 .dump = pfifo_fast_dump, 796 .change_tx_queue_len = pfifo_fast_change_tx_queue_len, 797 .owner = THIS_MODULE, 798 .static_flags = TCQ_F_NOLOCK | TCQ_F_CPUSTATS, 799}; 800EXPORT_SYMBOL(pfifo_fast_ops); 801 |
802static struct lock_class_key qdisc_tx_busylock; 803static struct lock_class_key qdisc_running_key; 804 | |
805struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, 806 const struct Qdisc_ops *ops, 807 struct netlink_ext_ack *extack) 808{ 809 void *p; 810 struct Qdisc *sch; 811 unsigned int size = QDISC_ALIGN(sizeof(*sch)) + ops->priv_size; 812 int err = -ENOBUFS; --- 36 unchanged lines hidden (view full) --- 849 sch->cpu_qstats = alloc_percpu(struct gnet_stats_queue); 850 if (!sch->cpu_qstats) { 851 free_percpu(sch->cpu_bstats); 852 goto errout1; 853 } 854 } 855 856 spin_lock_init(&sch->busylock); | 802struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, 803 const struct Qdisc_ops *ops, 804 struct netlink_ext_ack *extack) 805{ 806 void *p; 807 struct Qdisc *sch; 808 unsigned int size = QDISC_ALIGN(sizeof(*sch)) + ops->priv_size; 809 int err = -ENOBUFS; --- 36 unchanged lines hidden (view full) --- 846 sch->cpu_qstats = alloc_percpu(struct gnet_stats_queue); 847 if (!sch->cpu_qstats) { 848 free_percpu(sch->cpu_bstats); 849 goto errout1; 850 } 851 } 852 853 spin_lock_init(&sch->busylock); |
857 lockdep_set_class(&sch->busylock, 858 dev->qdisc_tx_busylock ?: &qdisc_tx_busylock); 859 | |
860 /* seqlock has the same scope of busylock, for NOLOCK qdisc */ 861 spin_lock_init(&sch->seqlock); | 854 /* seqlock has the same scope of busylock, for NOLOCK qdisc */ 855 spin_lock_init(&sch->seqlock); |
862 lockdep_set_class(&sch->busylock, 863 dev->qdisc_tx_busylock ?: &qdisc_tx_busylock); 864 | |
865 seqcount_init(&sch->running); | 856 seqcount_init(&sch->running); |
866 lockdep_set_class(&sch->running, 867 dev->qdisc_running_key ?: &qdisc_running_key); | |
868 869 sch->ops = ops; 870 sch->flags = ops->static_flags; 871 sch->enqueue = ops->enqueue; 872 sch->dequeue = ops->dequeue; 873 sch->dev_queue = dev_queue; 874 sch->empty = true; 875 dev_hold(dev); 876 refcount_set(&sch->refcnt, 1); 877 | 857 858 sch->ops = ops; 859 sch->flags = ops->static_flags; 860 sch->enqueue = ops->enqueue; 861 sch->dequeue = ops->dequeue; 862 sch->dev_queue = dev_queue; 863 sch->empty = true; 864 dev_hold(dev); 865 refcount_set(&sch->refcnt, 1); 866 |
867 if (sch != &noop_qdisc) { 868 lockdep_set_class(&sch->busylock, &dev->qdisc_tx_busylock_key); 869 lockdep_set_class(&sch->seqlock, &dev->qdisc_tx_busylock_key); 870 lockdep_set_class(&sch->running, &dev->qdisc_running_key); 871 } 872 |
|
878 return sch; 879errout1: 880 kfree(p); 881errout: 882 return ERR_PTR(err); 883} 884 885struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, --- 521 unchanged lines hidden --- | 873 return sch; 874errout1: 875 kfree(p); 876errout: 877 return ERR_PTR(err); 878} 879 880struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, --- 521 unchanged lines hidden --- |