diff options
| author | Thomas Graf <tgraf@suug.ch> | 2004-10-19 04:00:00 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2004-10-19 04:00:00 -0700 |
| commit | a5e370d536855e8aeb20a19b4aaa1970bdcf2151 (patch) | |
| tree | 432e3dff1f914fbc0e21db66635a29443b07e8e5 | |
| parent | e3ba9650890e39f1f60dbfa13c7ff2ce7ba1ffa5 (diff) | |
[PKT_SCHED]: Use gnet_stats API to copy statistics into netlink message
Adapts qdisc API to use new gnet_stats functions to copy
statistics into netlink message.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/linux/rtnetlink.h | 1 | ||||
| -rw-r--r-- | net/sched/sch_api.c | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index ac4528ead16e..9bb86160c2f2 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -698,6 +698,7 @@ enum TCA_XSTATS, TCA_RATE, TCA_FCNT, + TCA_STATS2, __TCA_MAX }; diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 5da7b7312642..3c985a58145c 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -750,6 +750,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, struct tcmsg *tcm; struct nlmsghdr *nlh; unsigned char *b = skb->tail; + struct gnet_dump d; nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*tcm)); nlh->nlmsg_flags = flags; @@ -762,9 +763,22 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, RTA_PUT(skb, TCA_KIND, IFNAMSIZ, q->ops->id); if (q->ops->dump && q->ops->dump(q, skb) < 0) goto rtattr_failure; - q->stats.qlen = q->q.qlen; - if (qdisc_copy_stats(skb, &q->stats, q->stats_lock)) + q->qstats.qlen = q->q.qlen; + + if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, + TCA_XSTATS, q->stats_lock, &d) < 0) + goto rtattr_failure; + + if (gnet_stats_copy_basic(&d, &q->bstats) < 0 || +#ifdef CONFIG_NET_ESTIMATOR + gnet_stats_copy_rate_est(&d, &q->rate_est) < 0 || +#endif + gnet_stats_copy_queue(&d, &q->qstats) < 0) + goto rtattr_failure; + + if (gnet_stats_finish_copy(&d) < 0) goto rtattr_failure; + nlh->nlmsg_len = skb->tail - b; return skb->len; |
