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

[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: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e3ba9650
......@@ -698,6 +698,7 @@ enum
TCA_XSTATS,
TCA_RATE,
TCA_FCNT,
TCA_STATS2,
__TCA_MAX
};
......
......@@ -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;
......
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