Commit 1ced208c authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[PKT_SCHED]: ATM: Use gnet_stats for class statistics and dump them

Makes ATM qdisc use gnet_stats for class statistic counters and
adds dumping bits to actually dump those. Althought the counters
were updated they never got dumped to userspace.
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ab892cf9
...@@ -69,7 +69,8 @@ struct atm_flow_data { ...@@ -69,7 +69,8 @@ struct atm_flow_data {
struct socket *sock; /* for closing */ struct socket *sock; /* for closing */
u32 classid; /* x:y type ID */ u32 classid; /* x:y type ID */
int ref; /* reference count */ int ref; /* reference count */
struct tc_stats stats; struct gnet_stats_basic bstats;
struct gnet_stats_queue qstats;
spinlock_t *stats_lock; spinlock_t *stats_lock;
struct atm_flow_data *next; struct atm_flow_data *next;
struct atm_flow_data *excess; /* flow for excess traffic; struct atm_flow_data *excess; /* flow for excess traffic;
...@@ -450,13 +451,13 @@ static int atm_tc_enqueue(struct sk_buff *skb,struct Qdisc *sch) ...@@ -450,13 +451,13 @@ static int atm_tc_enqueue(struct sk_buff *skb,struct Qdisc *sch)
#endif #endif
(ret = flow->q->enqueue(skb,flow->q)) != 0) { (ret = flow->q->enqueue(skb,flow->q)) != 0) {
sch->qstats.drops++; sch->qstats.drops++;
if (flow) flow->stats.drops++; if (flow) flow->qstats.drops++;
return ret; return ret;
} }
sch->bstats.bytes += skb->len; sch->bstats.bytes += skb->len;
sch->bstats.packets++; sch->bstats.packets++;
flow->stats.bytes += skb->len; flow->bstats.bytes += skb->len;
flow->stats.packets++; flow->bstats.packets++;
/* /*
* Okay, this may seem weird. We pretend we've dropped the packet if * Okay, this may seem weird. We pretend we've dropped the packet if
* it goes via ATM. The reason for this is that the outer qdisc * it goes via ATM. The reason for this is that the outer qdisc
...@@ -550,7 +551,7 @@ static int atm_tc_requeue(struct sk_buff *skb,struct Qdisc *sch) ...@@ -550,7 +551,7 @@ static int atm_tc_requeue(struct sk_buff *skb,struct Qdisc *sch)
sch->qstats.requeues++; sch->qstats.requeues++;
} else { } else {
sch->qstats.drops++; sch->qstats.drops++;
p->link.stats.drops++; p->link.qstats.drops++;
} }
return ret; return ret;
} }
...@@ -666,6 +667,20 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, ...@@ -666,6 +667,20 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
skb_trim(skb,b-skb->data); skb_trim(skb,b-skb->data);
return -1; return -1;
} }
static int
atm_tc_dump_class_stats(struct Qdisc *sch, unsigned long arg,
struct gnet_dump *d)
{
struct atm_flow_data *flow = (struct atm_flow_data *) arg;
flow->qstats.qlen = flow->q->q.qlen;
if (gnet_stats_copy_basic(d, &flow->bstats) < 0 ||
gnet_stats_copy_queue(d, &flow->qstats) < 0)
return -1;
return 0;
}
static int atm_tc_dump(struct Qdisc *sch, struct sk_buff *skb) static int atm_tc_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
...@@ -684,6 +699,7 @@ static struct Qdisc_class_ops atm_class_ops = { ...@@ -684,6 +699,7 @@ static struct Qdisc_class_ops atm_class_ops = {
.bind_tcf = atm_tc_bind_filter, .bind_tcf = atm_tc_bind_filter,
.unbind_tcf = atm_tc_put, .unbind_tcf = atm_tc_put,
.dump = atm_tc_dump_class, .dump = atm_tc_dump_class,
.dump_stats = atm_tc_dump_class_stats,
}; };
static struct Qdisc_ops atm_qdisc_ops = { static struct Qdisc_ops atm_qdisc_ops = {
......
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