cregit-Linux how code gets into the kernel

Release 4.8 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 salimjamal hadi salim1935.85%111.11%
jarek poplawskijarek poplawski1324.53%222.22%
krishna kumarkrishna kumar916.98%222.22%
americo wangamerico wang713.21%111.11%
pre-gitpre-git23.77%111.11%
david s. millerdavid s. miller23.77%111.11%
andi kleenandi 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 brouerjesper dangaard brouer6265.96%375.00%
eric dumazeteric 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 dumazeteric 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 dumazeteric dumazet12852.67%320.00%
jarek poplawskijarek poplawski3715.23%213.33%
jamal hadi salimjamal hadi salim2911.93%16.67%
jesper dangaard brouerjesper dangaard brouer239.47%213.33%
krishna kumarkrishna kumar93.70%16.67%
david s. millerdavid s. miller83.29%320.00%
americo wangamerico wang72.88%16.67%
daniel borkmanndaniel borkmann10.41%16.67%
tom herberttom 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 salimjamal hadi salim4522.96%27.69%
david s. millerdavid s. miller3115.82%623.08%
krishna kumarkrishna kumar3115.82%27.69%
eric dumazeteric dumazet2512.76%27.69%
lars perssonlars persson168.16%13.85%
pre-gitpre-git157.65%415.38%
stephen hemmingerstephen hemminger84.08%13.85%
jarek poplawskijarek poplawski84.08%13.85%
peter p waskiewiczpeter p waskiewicz73.57%13.85%
herbert xuherbert xu52.55%311.54%
thomas grafthomas graf21.02%13.85%
tom herberttom herbert21.02%13.85%
joe perchesjoe 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 kumarkrishna kumar8685.15%125.00%
eric dumazeteric dumazet87.92%125.00%
jesper dangaard brouerjesper dangaard brouer65.94%125.00%
daniel borkmanndaniel borkmann10.99%125.00%
Total101100.00%4100.00%


void __qdisc_run(struct Qdisc *q) { int quota = weight_p; 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 xuherbert xu3154.39%333.33%
jesper dangaard brouerjesper dangaard brouer1017.54%111.11%
jamal hadi salimjamal hadi salim712.28%111.11%
david s. millerdavid s. miller610.53%222.22%
krishna kumarkrishna kumar23.51%111.11%
eric dumazeteric dumazet11.75%111.11%
Total57100.00%9100.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 dumazeteric dumazet6671.74%133.33%
nikolay aleksandrovnikolay aleksandrov2021.74%133.33%
florian westphalflorian 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
pre-gitpre-git10852.17%637.50%
david s. millerdavid s. miller4622.22%16.25%
eric dumazeteric dumazet2612.56%16.25%
arjan van de venarjan van de ven115.31%318.75%
stephen hemmingerstephen hemminger83.86%212.50%
david decotignydavid decotigny52.42%16.25%
herbert xuherbert xu20.97%16.25%
tom herberttom 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
pre-gitpre-git5590.16%777.78%
venkatesh pallipadivenkatesh pallipadi34.92%111.11%
stephen hemmingerstephen hemminger34.92%111.11%
Total61100.00%9100.00%


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

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git16100.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
pre-gitpre-git3391.67%571.43%
herbert xuherbert xu25.56%114.29%
stephen hemmingerstephen 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 vlasenkodenys vlasenko3967.24%125.00%
david s. millerdavid s. miller915.52%125.00%
david decotignydavid decotigny813.79%125.00%
jeff garzikjeff 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 vlasenkodenys vlasenko2859.57%133.33%
david s. millerdavid s. miller1123.40%133.33%
david decotignydavid 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
pre-gitpre-git2371.88%266.67%
eric dumazeteric dumazet928.12%133.33%
Total32100.00%3100.00%


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

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git16100.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, .list = LIST_HEAD_INIT(noop_qdisc.list), .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 sutterphil 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 sk_buff_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 sk_buff_head *band2list(struct pfifo_fast_priv *priv, int band) { return priv->q + band; }

Contributors

PersonTokensPropCommitsCommitProp
krishna kumarkrishna kumar937.50%125.00%
david s. millerdavid s. miller833.33%250.00%
thomas grafthomas graf729.17%125.00%
Total24100.00%4100.00%


static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc, struct sk_buff **to_free) { if (skb_queue_len(&qdisc->q) < qdisc_dev(qdisc)->tx_queue_len) { int band = prio2band[skb->priority & TC_PRIO_MAX]; struct pfifo_fast_priv *priv = qdisc_priv(qdisc); struct sk_buff_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 kumarkrishna kumar5347.32%225.00%
david s. millerdavid s. miller3127.68%112.50%
thomas grafthomas graf1210.71%225.00%
eric dumazeteric dumazet87.14%112.50%
pre-gitpre-git65.36%112.50%
jamal hadi salimjamal hadi salim21.79%112.50%
Total112100.00%8100.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 sk_buff_head *list = band2list(priv, band); struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list); qdisc->q.qlen--; if (skb_queue_empty(list)) priv->bitmap &= ~(1 << band); return skb; } return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
krishna kumarkrishna kumar5757.58%125.00%
pre-gitpre-git2424.24%125.00%
david s. millerdavid s. miller1313.13%125.00%
thomas grafthomas graf55.05%125.00%
Total99100.00%4100.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 sk_buff_head *list = band2list(priv, band); return skb_peek(list); } return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
jarek poplawskijarek poplawski3556.45%150.00%
krishna kumarkrishna kumar2743.55%150.00%
Total62100.00%2100.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. millerdavid s. miller3550.72%116.67%
pre-gitpre-git1420.29%350.00%
krishna kumarkrishna kumar1318.84%116.67%
thomas grafthomas 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. millerdavid 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++) __skb_queue_head_init(band2list(priv, prio)); /* Can by-pass the queue discipline */ qdisc->flags |= TCQ_F_CAN_BYPASS; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
david s. millerdavid s. miller4674.19%120.00%
eric dumazeteric dumazet812.90%240.00%
krishna kumarkrishna kumar711.29%120.00%
pre-gitpre-git11.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; } INIT_LIST_HEAD(&sch->list); skb_queue_head_init(&sch->q); 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 dumazeteric dumazet12443.21%535.71%
pre-gitpre-git7225.09%321.43%
stephen hemmingerstephen hemminger4013.94%214.29%
thomas grafthomas graf3010.45%17.14%
patrick mchardypatrick mchardy124.18%214.29%
david s. millerdavid s. miller93.14%17.14%
Total287100.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 grafthomas graf3533.98%220.00%
pre-gitpre-git2524.27%330.00%
eric dumazeteric dumazet1514.56%110.00%
stephen hemmingerstephen hemminger1110.68%220.00%
patrick mchardypatrick mchardy109.71%110.00%
david s. millerdavid 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
pre-gitpre-git3141.33%116.67%
krishna kumarkrishna kumar1621.33%116.67%
eric dumazeteric dumazet1520.00%233.33%
jarek poplawskijarek poplawski1216.00%116.67%
jesper dangaard brouerjesper dangaard brouer11.33%116.67%
Total75100.00%6100.00%

EXPORT_SYMBOL(qdisc_reset);
static void qdisc_rcu_free(struct