cregit-Linux how code gets into the kernel

Release 4.11 net/sched/sch_generic.c

Directory: net/sched
/*
 * net/sched/sch_generic.c      Generic packet scheduler routines.
 *
 *              This program is free software; you can redistribute it and/or
 *              modify it under the terms of the GNU General Public License
 *              as published by the Free Software Foundation; either version
 *              2 of the License, or (at your option) any later version.
 *
 * Authors:     Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
 *              Jamal Hadi Salim, <hadi@cyberus.ca> 990601
 *              - Ingress support
 */

#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/init.h>
#include <linux/rcupdate.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/if_vlan.h>
#include <net/sch_generic.h>
#include <net/pkt_sched.h>
#include <net/dst.h>

/* Qdisc to use by default */

const struct Qdisc_ops *default_qdisc_ops = &pfifo_fast_ops;

EXPORT_SYMBOL(default_qdisc_ops);

/* Main transmission queue. */

/* Modifications to data participating in scheduling must be protected with
 * qdisc_lock(qdisc) spinlock.
 *
 * The idea is the following:
 * - enqueue, dequeue are serialized via qdisc root lock
 * - ingress filtering is also serialized via qdisc root lock
 * - updates to tree and tree walking are only done under the rtnl mutex.
 */


static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) { q->gso_skb = skb; q->qstats.requeues++; qdisc_qstats_backlog_inc(q, skb); q->q.qlen++; /* it's still part of the queue */ __netif_schedule(q); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Jamal Hadi Salim1935.85%111.11%
Jarek Poplawski1324.53%222.22%
Krishna Kumar916.98%222.22%
Américo Wang713.21%111.11%
David S. Miller23.77%111.11%
Linus Torvalds (pre-git)23.77%111.11%
Andi Kleen11.89%111.11%
Total53100.00%9100.00%


static void try_bulk_dequeue_skb(struct Qdisc *q, struct sk_buff *skb, const struct netdev_queue *txq, int *packets) { int bytelimit = qdisc_avail_bulklimit(txq) - skb->len; while (bytelimit > 0) { struct sk_buff *nskb = q->dequeue(q); if (!nskb) break; bytelimit -= nskb->len; /* covers GSO len */ skb->next = nskb; skb = nskb; (*packets)++; /* GSO counts as one pkt */ } skb->next = NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Jesper Dangaard Brouer6265.96%375.00%
Eric Dumazet3234.04%125.00%
Total94100.00%4100.00%

/* This variant of try_bulk_dequeue_skb() makes sure * all skbs in the chain are for the same txq */
static void try_bulk_dequeue_skb_slow(struct Qdisc *q, struct sk_buff *skb, int *packets) { int mapping = skb_get_queue_mapping(skb); struct sk_buff *nskb; int cnt = 0; do { nskb = q->dequeue(q); if (!nskb) break; if (unlikely(skb_get_queue_mapping(nskb) != mapping)) { q->skb_bad_txq = nskb; qdisc_qstats_backlog_inc(q, nskb); q->q.qlen++; break; } skb->next = nskb; skb = nskb; } while (++cnt < 8); (*packets) += cnt; skb->next = NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Eric Dumazet122100.00%1100.00%
Total122100.00%1100.00%

/* Note that dequeue_skb can possibly return a SKB list (via skb->next). * A requeued skb (via q->gso_skb) can also be a SKB list. */
static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate, int *packets) { struct sk_buff *skb = q->gso_skb; const struct netdev_queue *txq = q->dev_queue; *packets = 1; if (unlikely(skb)) { /* skb in gso_skb were already validated */ *validate = false; /* check the reason of requeuing without tx lock first */ txq = skb_get_tx_queue(txq->dev, skb); if (!netif_xmit_frozen_or_stopped(txq)) { q->gso_skb = NULL; qdisc_qstats_backlog_dec(q, skb); q->q.qlen--; } else skb = NULL; return skb; } *validate = true; skb = q->skb_bad_txq; if (unlikely(skb)) { /* check the reason of requeuing without tx lock first */ txq = skb_get_tx_queue(txq->dev, skb); if (!netif_xmit_frozen_or_stopped(txq)) { q->skb_bad_txq = NULL; qdisc_qstats_backlog_dec(q, skb); q->q.qlen--; goto bulk; } return NULL; } if (!(q->flags & TCQ_F_ONETXQUEUE) || !netif_xmit_frozen_or_stopped(txq)) skb = q->dequeue(q); if (skb) { bulk: if (qdisc_may_bulk(q)) try_bulk_dequeue_skb(q, skb, txq, packets); else try_bulk_dequeue_skb_slow(q, skb, packets); } return skb; }

Contributors

PersonTokensPropCommitsCommitProp
Eric Dumazet12852.67%320.00%
Jarek Poplawski3715.23%213.33%
Jamal Hadi Salim2911.93%16.67%
Jesper Dangaard Brouer239.47%213.33%
Krishna Kumar93.70%16.67%
David S. Miller83.29%320.00%
Américo Wang72.88%16.67%
Daniel Borkmann10.41%16.67%
Tom Herbert10.41%16.67%
Total243100.00%15100.00%

/* * Transmit possibly several skbs, and handle the return status as * required. Owning running seqcount bit guarantees that * only one CPU can execute this function. * * Returns to the caller: * 0 - queue is empty or throttled. * >0 - queue is not empty. */
int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, struct net_device *dev, struct netdev_queue *txq, spinlock_t *root_lock, bool validate) { int ret = NETDEV_TX_BUSY; /* And release qdisc */ spin_unlock(root_lock); /* Note that we validate skb (GSO, checksum, ...) outside of locks */ if (validate) skb = validate_xmit_skb_list(skb, dev); if (likely(skb)) { HARD_TX_LOCK(dev, txq, smp_processor_id()); if (!netif_xmit_frozen_or_stopped(txq)) skb = dev_hard_start_xmit(skb, dev, txq, &ret); HARD_TX_UNLOCK(dev, txq); } else { spin_lock(root_lock); return qdisc_qlen(q); } spin_lock(root_lock); if (dev_xmit_complete(ret)) { /* Driver sent out skb successfully or skb was consumed */ ret = qdisc_qlen(q); } else { /* Driver returned NETDEV_TX_BUSY - requeue skb */ if (unlikely(ret != NETDEV_TX_BUSY)) net_warn_ratelimited("BUG %s code %d qlen %d\n", dev->name, ret, q->q.qlen); ret = dev_requeue_skb(skb, q); } if (ret && netif_xmit_frozen_or_stopped(txq)) ret = 0; return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Jamal Hadi Salim4522.96%27.69%
David S. Miller3115.82%623.08%
Krishna Kumar3115.82%27.69%
Eric Dumazet2512.76%27.69%
Lars Persson168.16%13.85%
Linus Torvalds (pre-git)157.65%415.38%
Jarek Poplawski84.08%13.85%
Stephen Hemminger84.08%13.85%
Peter P. Waskiewicz Jr73.57%13.85%
Herbert Xu52.55%311.54%
Tom Herbert21.02%13.85%
Thomas Graf21.02%13.85%
Joe Perches10.51%13.85%
Total196100.00%26100.00%

/* * NOTE: Called under qdisc_lock(q) with locally disabled BH. * * running seqcount guarantees only one CPU can process * this qdisc at a time. qdisc_lock(q) serializes queue accesses for * this queue. * * netif_tx_lock serializes accesses to device driver. * * qdisc_lock(q) and netif_tx_lock are mutually exclusive, * if one is grabbed, another must be free. * * Note, that this procedure can be called by a watchdog timer * * Returns to the caller: * 0 - queue is empty or throttled. * >0 - queue is not empty. * */
static inline int qdisc_restart(struct Qdisc *q, int *packets) { struct netdev_queue *txq; struct net_device *dev; spinlock_t *root_lock; struct sk_buff *skb; bool validate; /* Dequeue packet */ skb = dequeue_skb(q, &validate, packets); if (unlikely(!skb)) return 0; root_lock = qdisc_lock(q); dev = qdisc_dev(q); txq = skb_get_tx_queue(dev, skb); return sch_direct_xmit(skb, q, dev, txq, root_lock, validate); }

Contributors

PersonTokensPropCommitsCommitProp
Krishna Kumar8685.15%125.00%
Eric Dumazet87.92%125.00%
Jesper Dangaard Brouer65.94%125.00%
Daniel Borkmann10.99%125.00%
Total101100.00%4100.00%


void __qdisc_run(struct Qdisc *q) { int quota = dev_tx_weight; int packets; while (qdisc_restart(q, &packets)) { /* * Ordered by possible occurrence: Postpone processing if * 1. we've exceeded packet quota * 2. another process needs the CPU; */ quota -= packets; if (quota <= 0 || need_resched()) { __netif_schedule(q); break; } } qdisc_run_end(q); }

Contributors

PersonTokensPropCommitsCommitProp
Herbert Xu3154.39%330.00%
Jesper Dangaard Brouer1017.54%110.00%
David S. Miller610.53%220.00%
Jamal Hadi Salim610.53%110.00%
Krishna Kumar23.51%110.00%
Matthias Tafelmeier11.75%110.00%
Eric Dumazet11.75%110.00%
Total57100.00%10100.00%


unsigned long dev_trans_start(struct net_device *dev) { unsigned long val, res; unsigned int i; if (is_vlan_dev(dev)) dev = vlan_dev_real_dev(dev); res = netdev_get_tx_queue(dev, 0)->trans_start; for (i = 1; i < dev->num_tx_queues; i++) { val = netdev_get_tx_queue(dev, i)->trans_start; if (val && time_after(val, res)) res = val; } return res; }

Contributors

PersonTokensPropCommitsCommitProp
Eric Dumazet6671.74%133.33%
Nikolay Aleksandrov2021.74%133.33%
Florian Westphal66.52%133.33%
Total92100.00%3100.00%

EXPORT_SYMBOL(dev_trans_start);
static void dev_watchdog(unsigned long arg) { struct net_device *dev = (struct net_device *)arg; netif_tx_lock(dev); if (!qdisc_tx_is_noop(dev)) { if (netif_device_present(dev) && netif_running(dev) && netif_carrier_ok(dev)) { int some_queue_timedout = 0; unsigned int i; unsigned long trans_start; for (i = 0; i < dev->num_tx_queues; i++) { struct netdev_queue *txq; txq = netdev_get_tx_queue(dev, i); trans_start = txq->trans_start; if (netif_xmit_stopped(txq) && time_after(jiffies, (trans_start + dev->watchdog_timeo))) { some_queue_timedout = 1; txq->trans_timeout++; break; } } if (some_queue_timedout) { WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n", dev->name, netdev_drivername(dev), i); dev->netdev_ops->ndo_tx_timeout(dev); } if (!mod_timer(&dev->watchdog_timer, round_jiffies(jiffies + dev->watchdog_timeo))) dev_hold(dev); } } netif_tx_unlock(dev); dev_put(dev); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)10852.17%637.50%
David S. Miller4622.22%16.25%
Eric Dumazet2612.56%16.25%
Arjan van de Ven115.31%318.75%
Stephen Hemminger83.86%212.50%
David Decotigny52.42%16.25%
Herbert Xu20.97%16.25%
Tom Herbert10.48%16.25%
Total207100.00%16100.00%


void __netdev_watchdog_up(struct net_device *dev) { if (dev->netdev_ops->ndo_tx_timeout) { if (dev->watchdog_timeo <= 0) dev->watchdog_timeo = 5*HZ; if (!mod_timer(&dev->watchdog_timer, round_jiffies(jiffies + dev->watchdog_timeo))) dev_hold(dev); } }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)5590.16%777.78%
Venkatesh Pallipadi34.92%111.11%
Stephen Hemminger34.92%111.11%
Total61100.00%9100.00%


static void dev_watchdog_up(struct net_device *dev) { __netdev_watchdog_up(dev); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)16100.00%5100.00%
Total16100.00%5100.00%


static void dev_watchdog_down(struct net_device *dev) { netif_tx_lock_bh(dev); if (del_timer(&dev->watchdog_timer)) dev_put(dev); netif_tx_unlock_bh(dev); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)3391.67%571.43%
Herbert Xu25.56%114.29%
Stephen Hemminger12.78%114.29%
Total36100.00%7100.00%

/** * netif_carrier_on - set carrier * @dev: network device * * Device has detected that carrier. */
void netif_carrier_on(struct net_device *dev) { if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) { if (dev->reg_state == NETREG_UNINITIALIZED) return; atomic_inc(&dev->carrier_changes); linkwatch_fire_event(dev); if (netif_running(dev)) __netdev_watchdog_up(dev); } }

Contributors

PersonTokensPropCommitsCommitProp
Denys Vlasenko3967.24%125.00%
David S. Miller915.52%125.00%
David Decotigny813.79%125.00%
Jeff Garzik23.45%125.00%
Total58100.00%4100.00%

EXPORT_SYMBOL(netif_carrier_on); /** * netif_carrier_off - clear carrier * @dev: network device * * Device has detected loss of carrier. */
void netif_carrier_off(struct net_device *dev) { if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state)) { if (dev->reg_state == NETREG_UNINITIALIZED) return; atomic_inc(&dev->carrier_changes); linkwatch_fire_event(dev); } }

Contributors

PersonTokensPropCommitsCommitProp
Denys Vlasenko2859.57%133.33%
David S. Miller1123.40%133.33%
David Decotigny817.02%133.33%
Total47100.00%3100.00%

EXPORT_SYMBOL(netif_carrier_off); /* "NOOP" scheduler: the best scheduler, recommended for all interfaces under all circumstances. It is difficult to invent anything faster or cheaper. */
static int noop_enqueue(struct sk_buff *skb, struct Qdisc *qdisc, struct sk_buff **to_free) { __qdisc_drop(skb, to_free); return NET_XMIT_CN; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)2371.88%266.67%
Eric Dumazet928.12%133.33%
Total32100.00%3100.00%


static struct sk_buff *noop_dequeue(struct Qdisc *qdisc) { return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)16100.00%1100.00%
Total16100.00%1100.00%

struct Qdisc_ops noop_qdisc_ops __read_mostly = { .id = "noop", .priv_size = 0, .enqueue = noop_enqueue, .dequeue = noop_dequeue, .peek = noop_dequeue, .owner = THIS_MODULE, }; static struct netdev_queue noop_netdev_queue = { .qdisc = &noop_qdisc, .qdisc_sleeping = &noop_qdisc, }; struct Qdisc noop_qdisc = { .enqueue = noop_enqueue, .dequeue = noop_dequeue, .flags = TCQ_F_BUILTIN, .ops = &noop_qdisc_ops, .q.lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.q.lock), .dev_queue = &noop_netdev_queue, .running = SEQCNT_ZERO(noop_qdisc.running), .busylock = __SPIN_LOCK_UNLOCKED(noop_qdisc.busylock), }; EXPORT_SYMBOL(noop_qdisc);
static int noqueue_init(struct Qdisc *qdisc, struct nlattr *opt) { /* register_qdisc() assigns a default of noop_enqueue if unset, * but __dev_queue_xmit() treats noqueue only as such * if this is NULL - so clear it here. */ qdisc->enqueue = NULL; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Phil Sutter26100.00%1100.00%
Total26100.00%1100.00%

struct Qdisc_ops noqueue_qdisc_ops __read_mostly = { .id = "noqueue", .priv_size = 0, .init = noqueue_init, .enqueue = noop_enqueue, .dequeue = noop_dequeue, .peek = noop_dequeue, .owner = THIS_MODULE, }; static const u8 prio2band[TC_PRIO_MAX + 1] = { 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1 }; /* 3-band FIFO queue: old style, but should be a bit faster than generic prio+fifo combination. */ #define PFIFO_FAST_BANDS 3 /* * Private data for a pfifo_fast scheduler containing: * - queues for the three band * - bitmap indicating which of the bands contain skbs */ struct pfifo_fast_priv { u32 bitmap; struct qdisc_skb_head q[PFIFO_FAST_BANDS]; }; /* * Convert a bitmap to the first band number where an skb is queued, where: * bitmap=0 means there are no skbs on any band. * bitmap=1 means there is an skb on band 0. * bitmap=7 means there are skbs on all 3 bands, etc. */ static const int bitmap2band[] = {-1, 0, 1, 0, 2, 0, 1, 0};
static inline struct qdisc_skb_head *band2list(struct pfifo_fast_priv *priv, int band) { return priv->q + band; }

Contributors

PersonTokensPropCommitsCommitProp
Krishna Kumar937.50%120.00%
David S. Miller729.17%240.00%
Thomas Graf729.17%120.00%
Florian Westphal14.17%120.00%
Total24100.00%5100.00%


static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc, struct sk_buff **to_free) { if (qdisc->q.qlen < qdisc_dev(qdisc)->tx_queue_len) { int band = prio2band[skb->priority & TC_PRIO_MAX]; struct pfifo_fast_priv *priv = qdisc_priv(qdisc); struct qdisc_skb_head *list = band2list(priv, band); priv->bitmap |= (1 << band); qdisc->q.qlen++; return __qdisc_enqueue_tail(skb, qdisc, list); } return qdisc_drop(skb, qdisc, to_free); }

Contributors

PersonTokensPropCommitsCommitProp
Krishna Kumar4944.55%220.00%
David S. Miller3027.27%110.00%
Thomas Graf1210.91%220.00%
Eric Dumazet87.27%110.00%
Linus Torvalds (pre-git)65.45%110.00%
Florian Westphal32.73%220.00%
Jamal Hadi Salim21.82%110.00%
Total110100.00%10100.00%


static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc) { struct pfifo_fast_priv *priv = qdisc_priv(qdisc); int band = bitmap2band[priv->bitmap]; if (likely(band >= 0)) { struct qdisc_skb_head *qh = band2list(priv, band); struct sk_buff *skb = __qdisc_dequeue_head(qh); if (likely(skb != NULL)) { qdisc_qstats_backlog_dec(qdisc, skb); qdisc_bstats_update(qdisc, skb); } qdisc->q.qlen--; if (qh->qlen == 0) priv->bitmap &= ~(1 << band); return skb; } return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Krishna Kumar5141.46%116.67%
Florian Westphal3326.83%233.33%
Linus Torvalds (pre-git)2419.51%116.67%
David S. Miller1310.57%116.67%
Thomas Graf21.63%116.67%
Total123100.00%6100.00%


static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc) { struct pfifo_fast_priv *priv = qdisc_priv(qdisc); int band = bitmap2band[priv->bitmap]; if (band >= 0) { struct qdisc_skb_head *qh = band2list(priv, band); return qh->head; } return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Jarek Poplawski3049.18%133.33%
Krishna Kumar2642.62%133.33%
Florian Westphal58.20%133.33%
Total61100.00%3100.00%


static void pfifo_fast_reset(struct Qdisc *qdisc) { int prio; struct pfifo_fast_priv *priv = qdisc_priv(qdisc); for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) __qdisc_reset_queue(band2list(priv, prio)); priv->bitmap = 0; qdisc->qstats.backlog = 0; qdisc->q.qlen = 0; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller3550.72%116.67%
Linus Torvalds (pre-git)1420.29%350.00%
Krishna Kumar1318.84%116.67%
Thomas Graf710.14%116.67%
Total69100.00%6100.00%


static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) { struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) goto nla_put_failure; return skb->len; nla_put_failure: return -1; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller72100.00%2100.00%
Total72100.00%2100.00%


static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt) { int prio; struct pfifo_fast_priv *priv = qdisc_priv(qdisc); for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) qdisc_skb_head_init(band2list(priv, prio)); /* Can by-pass the queue discipline */ qdisc->flags |= TCQ_F_CAN_BYPASS; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
David S. Miller4674.19%120.00%
Krishna Kumar711.29%120.00%
Eric Dumazet711.29%120.00%
Linus Torvalds (pre-git)11.61%120.00%
Florian Westphal11.61%120.00%
Total62100.00%5100.00%

struct Qdisc_ops pfifo_fast_ops __read_mostly = { .id = "pfifo_fast", .priv_size = sizeof(struct pfifo_fast_priv), .enqueue = pfifo_fast_enqueue, .dequeue = pfifo_fast_dequeue, .peek = pfifo_fast_peek, .init = pfifo_fast_init, .reset = pfifo_fast_reset, .dump = pfifo_fast_dump, .owner = THIS_MODULE, }; EXPORT_SYMBOL(pfifo_fast_ops); static struct lock_class_key qdisc_tx_busylock; static struct lock_class_key qdisc_running_key;
struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, const struct Qdisc_ops *ops) { void *p; struct Qdisc *sch; unsigned int size = QDISC_ALIGN(sizeof(*sch)) + ops->priv_size; int err = -ENOBUFS; struct net_device *dev = dev_queue->dev; p = kzalloc_node(size, GFP_KERNEL, netdev_queue_numa_node_read(dev_queue)); if (!p) goto errout; sch = (struct Qdisc *) QDISC_ALIGN((unsigned long) p); /* if we got non aligned memory, ask more and do alignment ourself */ if (sch != p) { kfree(p); p = kzalloc_node(size + QDISC_ALIGNTO - 1, GFP_KERNEL, netdev_queue_numa_node_read(dev_queue)); if (!p) goto errout; sch = (struct Qdisc *) QDISC_ALIGN((unsigned long) p); sch->padded = (char *) sch - (char *) p; } qdisc_skb_head_init(&sch->q); spin_lock_init(&sch->q.lock); spin_lock_init(&sch->busylock); lockdep_set_class(&sch->busylock, dev->qdisc_tx_busylock ?: &qdisc_tx_busylock); seqcount_init(&sch->running); lockdep_set_class(&sch->running, dev->qdisc_running_key ?: &qdisc_running_key); sch->ops = ops; sch->enqueue = ops->enqueue; sch->dequeue = ops->dequeue; sch->dev_queue = dev_queue; dev_hold(dev); atomic_set(&sch->refcnt, 1); return sch; errout: return ERR_PTR(err); }

Contributors

PersonTokensPropCommitsCommitProp
Eric Dumazet12442.91%535.71%
Linus Torvalds (pre-git)7124.57%321.43%
Stephen Hemminger4013.84%214.29%
Thomas Graf3010.38%17.14%
Florian Westphal113.81%17.14%
David S. Miller93.11%17.14%
Patrick McHardy41.38%17.14%
Total289100.00%14100.00%


struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, const struct Qdisc_ops *ops, unsigned int parentid) { struct Qdisc *sch; if (!try_module_get(ops->owner)) return NULL; sch = qdisc_alloc(dev_queue, ops); if (IS_ERR(sch)) { module_put(ops->owner); return NULL; } sch->parent = parentid; if (!ops->init || ops->init(sch, NULL) == 0) return sch; qdisc_destroy(sch); return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Thomas Graf3533.98%220.00%
Linus Torvalds (pre-git)2524.27%330.00%
Eric Dumazet1514.56%110.00%
Stephen Hemminger1110.68%220.00%
Patrick McHardy109.71%110.00%
David S. Miller76.80%110.00%
Total103100.00%10100.00%

EXPORT_SYMBOL(qdisc_create_dflt); /* Under qdisc_lock(qdisc) and BH! */
void qdisc_reset(struct Qdisc *qdisc) { const struct Qdisc_ops *ops = qdisc->ops; if (ops->reset) ops->reset(qdisc); kfree_skb(qdisc->skb_bad_txq); qdisc->skb_bad_txq = NULL; if (qdisc->gso_skb) { kfree_skb_list(qdisc->gso_skb); qdisc->gso_skb = NULL; } qdisc->q.qlen = 0; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)3141.33%116.67%
Krishna Kumar1621.33%116.67%
Eric Dumazet1520.00%233.33%
Jarek Poplawski1216.00%116.67%
Jesper Dangaard Brouer11.33%116.67%
Total75100.00%6100.00%

EXPORT_SYMBOL(qdisc_reset);
static void qdisc_rcu_free(struct rcu_head *head) { struct Qdisc *qdisc = container_of(head, struct Qdisc, rcu_head); if (qdisc_is_percpu_stats(qdisc)) { free_percpu(qdisc->cpu_bstats); free_percpu(qdisc->cpu_qstats); } kfree((char *) qdisc - qdisc->padded); }

Contributors

PersonTokensPropCommitsCommitProp