sch_generic.c (50dc9a8572aa4d7cdc56670228fcde40289ed289) sch_generic.c (29cbcd85828372333aa87542c51f2b2b0fd4380c)
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 */

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

299 }
300trace:
301 trace_qdisc_dequeue(q, txq, *packets, skb);
302 return skb;
303}
304
305/*
306 * Transmit possibly several skbs, and handle the return status as
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 */

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

299 }
300trace:
301 trace_qdisc_dequeue(q, txq, *packets, skb);
302 return skb;
303}
304
305/*
306 * Transmit possibly several skbs, and handle the return status as
307 * required. Owning running seqcount bit guarantees that
308 * only one CPU can execute this function.
307 * required. Owning qdisc running bit guarantees that only one CPU
308 * can execute this function.
309 *
310 * Returns to the caller:
311 * false - hardware queue frozen backoff
312 * true - feel free to send more pkts
313 */
314bool sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
315 struct net_device *dev, struct netdev_queue *txq,
316 spinlock_t *root_lock, bool validate)

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

601
602struct Qdisc noop_qdisc = {
603 .enqueue = noop_enqueue,
604 .dequeue = noop_dequeue,
605 .flags = TCQ_F_BUILTIN,
606 .ops = &noop_qdisc_ops,
607 .q.lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.q.lock),
608 .dev_queue = &noop_netdev_queue,
309 *
310 * Returns to the caller:
311 * false - hardware queue frozen backoff
312 * true - feel free to send more pkts
313 */
314bool sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
315 struct net_device *dev, struct netdev_queue *txq,
316 spinlock_t *root_lock, bool validate)

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

601
602struct Qdisc noop_qdisc = {
603 .enqueue = noop_enqueue,
604 .dequeue = noop_dequeue,
605 .flags = TCQ_F_BUILTIN,
606 .ops = &noop_qdisc_ops,
607 .q.lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.q.lock),
608 .dev_queue = &noop_netdev_queue,
609 .running = SEQCNT_ZERO(noop_qdisc.running),
610 .busylock = __SPIN_LOCK_UNLOCKED(noop_qdisc.busylock),
611 .gso_skb = {
612 .next = (struct sk_buff *)&noop_qdisc.gso_skb,
613 .prev = (struct sk_buff *)&noop_qdisc.gso_skb,
614 .qlen = 0,
615 .lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.gso_skb.lock),
616 },
617 .skb_bad_txq = {

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

862 .dump = pfifo_fast_dump,
863 .change_tx_queue_len = pfifo_fast_change_tx_queue_len,
864 .owner = THIS_MODULE,
865 .static_flags = TCQ_F_NOLOCK | TCQ_F_CPUSTATS,
866};
867EXPORT_SYMBOL(pfifo_fast_ops);
868
869static struct lock_class_key qdisc_tx_busylock;
609 .busylock = __SPIN_LOCK_UNLOCKED(noop_qdisc.busylock),
610 .gso_skb = {
611 .next = (struct sk_buff *)&noop_qdisc.gso_skb,
612 .prev = (struct sk_buff *)&noop_qdisc.gso_skb,
613 .qlen = 0,
614 .lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.gso_skb.lock),
615 },
616 .skb_bad_txq = {

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

861 .dump = pfifo_fast_dump,
862 .change_tx_queue_len = pfifo_fast_change_tx_queue_len,
863 .owner = THIS_MODULE,
864 .static_flags = TCQ_F_NOLOCK | TCQ_F_CPUSTATS,
865};
866EXPORT_SYMBOL(pfifo_fast_ops);
867
868static struct lock_class_key qdisc_tx_busylock;
870static struct lock_class_key qdisc_running_key;
871
872struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
873 const struct Qdisc_ops *ops,
874 struct netlink_ext_ack *extack)
875{
876 struct Qdisc *sch;
877 unsigned int size = sizeof(*sch) + ops->priv_size;
878 int err = -ENOBUFS;

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

912 lockdep_set_class(&sch->busylock,
913 dev->qdisc_tx_busylock ?: &qdisc_tx_busylock);
914
915 /* seqlock has the same scope of busylock, for NOLOCK qdisc */
916 spin_lock_init(&sch->seqlock);
917 lockdep_set_class(&sch->seqlock,
918 dev->qdisc_tx_busylock ?: &qdisc_tx_busylock);
919
869
870struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
871 const struct Qdisc_ops *ops,
872 struct netlink_ext_ack *extack)
873{
874 struct Qdisc *sch;
875 unsigned int size = sizeof(*sch) + ops->priv_size;
876 int err = -ENOBUFS;

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

910 lockdep_set_class(&sch->busylock,
911 dev->qdisc_tx_busylock ?: &qdisc_tx_busylock);
912
913 /* seqlock has the same scope of busylock, for NOLOCK qdisc */
914 spin_lock_init(&sch->seqlock);
915 lockdep_set_class(&sch->seqlock,
916 dev->qdisc_tx_busylock ?: &qdisc_tx_busylock);
917
920 seqcount_init(&sch->running);
921 lockdep_set_class(&sch->running,
922 dev->qdisc_running_key ?: &qdisc_running_key);
923
924 sch->ops = ops;
925 sch->flags = ops->static_flags;
926 sch->enqueue = ops->enqueue;
927 sch->dequeue = ops->dequeue;
928 sch->dev_queue = dev_queue;
929 dev_hold(dev);
930 refcount_set(&sch->refcnt, 1);
931

--- 623 unchanged lines hidden ---
918 sch->ops = ops;
919 sch->flags = ops->static_flags;
920 sch->enqueue = ops->enqueue;
921 sch->dequeue = ops->dequeue;
922 sch->dev_queue = dev_queue;
923 dev_hold(dev);
924 refcount_set(&sch->refcnt, 1);
925

--- 623 unchanged lines hidden ---