Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121546
b: refs/heads/master
c: 99c0db2
h: refs/heads/master
v: v3
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Oct 31, 2008
1 parent c147045 commit 66b381f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 48a8f519e0fe22a5c98523286b2a120841a11dd5
refs/heads/master: 99c0db26797edb39cf83c8c5f8972067f5426b4e
12 changes: 12 additions & 0 deletions trunk/net/sched/sch_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ static int tclass_notify(struct sk_buff *oskb, struct nlmsghdr *n,
requeues once dequeued packet. It is used for non-standard or
just buggy devices, which can defer output even if netif_queue_stopped()=0.
---peek
like dequeue but without removing a packet from the queue
---reset
returns qdisc to initial state: purge all buffers, clear all
Expand Down Expand Up @@ -149,6 +153,14 @@ int register_qdisc(struct Qdisc_ops *qops)
qops->enqueue = noop_qdisc_ops.enqueue;
if (qops->requeue == NULL)
qops->requeue = noop_qdisc_ops.requeue;
if (qops->peek == NULL) {
if (qops->dequeue == NULL) {
qops->peek = noop_qdisc_ops.peek;
} else {
rc = -EINVAL;
goto out;
}
}
if (qops->dequeue == NULL)
qops->dequeue = noop_qdisc_ops.dequeue;

Expand Down
16 changes: 16 additions & 0 deletions trunk/net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ struct Qdisc_ops noop_qdisc_ops __read_mostly = {
.priv_size = 0,
.enqueue = noop_enqueue,
.dequeue = noop_dequeue,
.peek = noop_dequeue,
.requeue = noop_requeue,
.owner = THIS_MODULE,
};
Expand All @@ -346,6 +347,7 @@ static struct Qdisc_ops noqueue_qdisc_ops __read_mostly = {
.priv_size = 0,
.enqueue = noop_enqueue,
.dequeue = noop_dequeue,
.peek = noop_dequeue,
.requeue = noop_requeue,
.owner = THIS_MODULE,
};
Expand Down Expand Up @@ -411,6 +413,19 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc)
return NULL;
}

static struct sk_buff *pfifo_fast_peek(struct Qdisc* qdisc)
{
int prio;
struct sk_buff_head *list = qdisc_priv(qdisc);

for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
if (!skb_queue_empty(list + prio))
return skb_peek(list + prio);
}

return NULL;
}

static int pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc)
{
qdisc->q.qlen++;
Expand Down Expand Up @@ -457,6 +472,7 @@ static struct Qdisc_ops pfifo_fast_ops __read_mostly = {
.priv_size = PFIFO_FAST_BANDS * sizeof(struct sk_buff_head),
.enqueue = pfifo_fast_enqueue,
.dequeue = pfifo_fast_dequeue,
.peek = pfifo_fast_peek,
.requeue = pfifo_fast_requeue,
.init = pfifo_fast_init,
.reset = pfifo_fast_reset,
Expand Down

0 comments on commit 66b381f

Please sign in to comment.