pkt_sched: sch_generic: Add generic qdisc->ops->peek() implementation.
With feedback from Patrick McHardy. Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
48a8f519e0
commit
99c0db2679
@@ -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,
|
||||
};
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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++;
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user