Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121676
b: refs/heads/master
c: 2a6cf35
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Nov 2, 2008
1 parent dcdd2f9 commit 97c4d38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 89 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3f8b4b13785c2737413d3241c21c7c86a41535ef
refs/heads/master: 2a6cf35543302e9a5c807eaf13298f510fbdf8f2
93 changes: 5 additions & 88 deletions trunk/net/sched/sch_netem.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
*/
cb->time_to_send = psched_get_time();
q->counter = 0;
ret = q->qdisc->ops->requeue(skb, q->qdisc);

__skb_queue_head(&q->qdisc->q, skb);
q->qdisc->qstats.backlog += qdisc_pkt_len(skb);
q->qdisc->qstats.requeues++;
ret = NET_XMIT_SUCCESS;
}

if (likely(ret == NET_XMIT_SUCCESS)) {
Expand Down Expand Up @@ -622,95 +626,8 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
return -1;
}

static int netem_dump_class(struct Qdisc *sch, unsigned long cl,
struct sk_buff *skb, struct tcmsg *tcm)
{
struct netem_sched_data *q = qdisc_priv(sch);

if (cl != 1) /* only one class */
return -ENOENT;

tcm->tcm_handle |= TC_H_MIN(1);
tcm->tcm_info = q->qdisc->handle;

return 0;
}

static int netem_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
struct Qdisc **old)
{
struct netem_sched_data *q = qdisc_priv(sch);

if (new == NULL)
new = &noop_qdisc;

sch_tree_lock(sch);
*old = xchg(&q->qdisc, new);
qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
qdisc_reset(*old);
sch_tree_unlock(sch);

return 0;
}

static struct Qdisc *netem_leaf(struct Qdisc *sch, unsigned long arg)
{
struct netem_sched_data *q = qdisc_priv(sch);
return q->qdisc;
}

static unsigned long netem_get(struct Qdisc *sch, u32 classid)
{
return 1;
}

static void netem_put(struct Qdisc *sch, unsigned long arg)
{
}

static int netem_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
struct nlattr **tca, unsigned long *arg)
{
return -ENOSYS;
}

static int netem_delete(struct Qdisc *sch, unsigned long arg)
{
return -ENOSYS;
}

static void netem_walk(struct Qdisc *sch, struct qdisc_walker *walker)
{
if (!walker->stop) {
if (walker->count >= walker->skip)
if (walker->fn(sch, 1, walker) < 0) {
walker->stop = 1;
return;
}
walker->count++;
}
}

static struct tcf_proto **netem_find_tcf(struct Qdisc *sch, unsigned long cl)
{
return NULL;
}

static const struct Qdisc_class_ops netem_class_ops = {
.graft = netem_graft,
.leaf = netem_leaf,
.get = netem_get,
.put = netem_put,
.change = netem_change_class,
.delete = netem_delete,
.walk = netem_walk,
.tcf_chain = netem_find_tcf,
.dump = netem_dump_class,
};

static struct Qdisc_ops netem_qdisc_ops __read_mostly = {
.id = "netem",
.cl_ops = &netem_class_ops,
.priv_size = sizeof(struct netem_sched_data),
.enqueue = netem_enqueue,
.dequeue = netem_dequeue,
Expand Down

0 comments on commit 97c4d38

Please sign in to comment.