Commit 55bea115 authored by Jamal Hadi Salim's avatar Jamal Hadi Salim Committed by David S. Miller

[NET]: Make pfifo_fast actually report statistics.

parent 98921832
......@@ -7,7 +7,7 @@
* 2 of the License, or (at your option) any later version.
*
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
* Jamal Hadi Salim, <hadi@nortelnetworks.com> 990601
* Jamal Hadi Salim, <hadi@cyberus.ca> 990601
* - Ingress support
*/
......@@ -278,6 +278,8 @@ pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
if (list->qlen <= qdisc->dev->tx_queue_len) {
__skb_queue_tail(list, skb);
qdisc->q.qlen++;
qdisc->stats.bytes += skb->len;
qdisc->stats.packets++;
return 0;
}
qdisc->stats.drops++;
......@@ -326,6 +328,21 @@ pfifo_fast_reset(struct Qdisc* qdisc)
qdisc->q.qlen = 0;
}
static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
{
unsigned char *b = skb->tail;
struct tc_prio_qopt opt;
opt.bands = 3;
memcpy(&opt.priomap, prio2band, TC_PRIO_MAX+1);
RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
return skb->len;
rtattr_failure:
skb_trim(skb, b - skb->data);
return -1;
}
static int pfifo_fast_init(struct Qdisc *qdisc, struct rtattr *opt)
{
int i;
......@@ -349,6 +366,7 @@ static struct Qdisc_ops pfifo_fast_ops = {
.requeue = pfifo_fast_requeue,
.init = pfifo_fast_init,
.reset = pfifo_fast_reset,
.dump = pfifo_fast_dump,
.owner = THIS_MODULE,
};
......@@ -438,6 +456,12 @@ void dev_activate(struct net_device *dev)
printk(KERN_INFO "%s: activation failed\n", dev->name);
return;
}
write_lock(&qdisc_tree_lock);
qdisc->next = dev->qdisc_list;
dev->qdisc_list = qdisc;
write_unlock(&qdisc_tree_lock);
} else {
qdisc = &noqueue_qdisc;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment