Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121549
b: refs/heads/master
c: 77be155
h: refs/heads/master
i:
  121547: fc365f8
v: v3
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Oct 31, 2008
1 parent dfa6ddc commit 653c866
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 7 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: 03c05f0d4bb0c267edf12d614025a40e33c5a6f9
refs/heads/master: 77be155cba4e163e8bba9fd27222a8b6189ec4f7
23 changes: 23 additions & 0 deletions trunk/include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,29 @@ static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch)
return skb_peek(&sch->q);
}

/* generic pseudo peek method for non-work-conserving qdisc */
static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch)
{
/* we can reuse ->gso_skb because peek isn't called for root qdiscs */
if (!sch->gso_skb)
sch->gso_skb = sch->dequeue(sch);

return sch->gso_skb;
}

/* use instead of qdisc->dequeue() for all qdiscs queried with ->peek() */
static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch)
{
struct sk_buff *skb = sch->gso_skb;

if (skb)
sch->gso_skb = NULL;
else
skb = sch->dequeue(sch);

return skb;
}

static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch,
struct sk_buff_head *list)
{
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/sched/sch_atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ static void sch_atm_dequeue(unsigned long data)
if (!atm_may_send(flow->vcc, skb->truesize))
break;

skb = flow->q->dequeue(flow->q);
skb = qdisc_dequeue_peeked(flow->q);
if (unlikely(!skb))
break;

Expand Down Expand Up @@ -519,7 +519,7 @@ static struct sk_buff *atm_tc_dequeue(struct Qdisc *sch)

pr_debug("atm_tc_dequeue(sch %p,[qdisc %p])\n", sch, p);
tasklet_schedule(&p->task);
skb = p->link.q->dequeue(p->link.q);
skb = qdisc_dequeue_peeked(p->link.q);
if (skb)
sch->q.qlen--;
return skb;
Expand Down
1 change: 1 addition & 0 deletions trunk/net/sched/sch_cbq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,7 @@ static struct Qdisc_ops cbq_qdisc_ops __read_mostly = {
.priv_size = sizeof(struct cbq_sched_data),
.enqueue = cbq_enqueue,
.dequeue = cbq_dequeue,
.peek = qdisc_peek_dequeued,
.requeue = cbq_requeue,
.drop = cbq_drop,
.init = cbq_init,
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/sched/sch_hfsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ hfsc_dequeue(struct Qdisc *sch)
}
}

skb = cl->qdisc->dequeue(cl->qdisc);
skb = qdisc_dequeue_peeked(cl->qdisc);
if (skb == NULL) {
if (net_ratelimit())
printk("HFSC: Non-work-conserving qdisc ?\n");
Expand Down Expand Up @@ -1727,6 +1727,7 @@ static struct Qdisc_ops hfsc_qdisc_ops __read_mostly = {
.dump = hfsc_dump_qdisc,
.enqueue = hfsc_enqueue,
.dequeue = hfsc_dequeue,
.peek = qdisc_peek_dequeued,
.requeue = hfsc_requeue,
.drop = hfsc_drop,
.cl_ops = &hfsc_class_ops,
Expand Down
1 change: 1 addition & 0 deletions trunk/net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,7 @@ static struct Qdisc_ops htb_qdisc_ops __read_mostly = {
.priv_size = sizeof(struct htb_sched),
.enqueue = htb_enqueue,
.dequeue = htb_dequeue,
.peek = qdisc_peek_dequeued,
.requeue = htb_requeue,
.drop = htb_drop,
.init = htb_init,
Expand Down
5 changes: 3 additions & 2 deletions trunk/net/sched/sch_netem.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)

/* if more time remaining? */
if (cb->time_to_send <= now) {
skb = q->qdisc->dequeue(q->qdisc);
if (!skb)
skb = qdisc_dequeue_peeked(q->qdisc);
if (unlikely(!skb))
return NULL;

pr_debug("netem_dequeue: return skb=%p\n", skb);
Expand Down Expand Up @@ -714,6 +714,7 @@ static struct Qdisc_ops netem_qdisc_ops __read_mostly = {
.priv_size = sizeof(struct netem_sched_data),
.enqueue = netem_enqueue,
.dequeue = netem_dequeue,
.peek = qdisc_peek_dequeued,
.requeue = netem_requeue,
.drop = netem_drop,
.init = netem_init,
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/sched/sch_tbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
toks -= L2T(q, len);

if ((toks|ptoks) >= 0) {
skb = q->qdisc->dequeue(q->qdisc);
skb = qdisc_dequeue_peeked(q->qdisc);
if (unlikely(!skb))
return NULL;

Expand Down Expand Up @@ -467,6 +467,7 @@ static struct Qdisc_ops tbf_qdisc_ops __read_mostly = {
.priv_size = sizeof(struct tbf_sched_data),
.enqueue = tbf_enqueue,
.dequeue = tbf_dequeue,
.peek = qdisc_peek_dequeued,
.requeue = tbf_requeue,
.drop = tbf_drop,
.init = tbf_init,
Expand Down

0 comments on commit 653c866

Please sign in to comment.