Commit 176b40a3 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[PKT_SCHED]: Add dump_stats qdisc op

Adds a new qdisc operation dump_stats which qdiscs can use
to dump statistics. The op is invoked between gnet_stats_start_copy
and gnet_stats_finish_copy and therefore stats_lock is already
held. This is required to ensure proper locking throughout the
whole statistic dumping procedure.
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ede264af
...@@ -64,6 +64,7 @@ struct Qdisc_ops ...@@ -64,6 +64,7 @@ struct Qdisc_ops
int (*change)(struct Qdisc *, struct rtattr *arg); int (*change)(struct Qdisc *, struct rtattr *arg);
int (*dump)(struct Qdisc *, struct sk_buff *); int (*dump)(struct Qdisc *, struct sk_buff *);
int (*dump_stats)(struct Qdisc *, struct gnet_dump *);
struct module *owner; struct module *owner;
}; };
......
...@@ -767,6 +767,9 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, ...@@ -767,6 +767,9 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
TCA_XSTATS, q->stats_lock, &d) < 0) TCA_XSTATS, q->stats_lock, &d) < 0)
goto rtattr_failure; goto rtattr_failure;
if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0)
goto rtattr_failure;
if (gnet_stats_copy_basic(&d, &q->bstats) < 0 || if (gnet_stats_copy_basic(&d, &q->bstats) < 0 ||
#ifdef CONFIG_NET_ESTIMATOR #ifdef CONFIG_NET_ESTIMATOR
gnet_stats_copy_rate_est(&d, &q->rate_est) < 0 || gnet_stats_copy_rate_est(&d, &q->rate_est) < 0 ||
......
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