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

[PKT_SCHED]: HFSC: Use dump_stats for class statistics dumping

Makes HFSC use dump_stats to dump class statistics, i.e.
moves the statistics dump code from hfsc_dump_class to
hfsc_dump_class_stats.
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cd99a79a
...@@ -1404,36 +1404,6 @@ hfsc_dump_curves(struct sk_buff *skb, struct hfsc_class *cl) ...@@ -1404,36 +1404,6 @@ hfsc_dump_curves(struct sk_buff *skb, struct hfsc_class *cl)
return -1; return -1;
} }
static inline int
hfsc_dump_stats(struct sk_buff *skb, struct hfsc_class *cl)
{
cl->stats.qlen = cl->qdisc->q.qlen;
if (qdisc_copy_stats(skb, &cl->stats, cl->stats_lock) < 0)
goto rtattr_failure;
return skb->len;
rtattr_failure:
return -1;
}
static inline int
hfsc_dump_xstats(struct sk_buff *skb, struct hfsc_class *cl)
{
struct tc_hfsc_stats xstats;
xstats.level = cl->level;
xstats.period = cl->cl_vtperiod;
xstats.work = cl->cl_total;
xstats.rtwork = cl->cl_cumul;
RTA_PUT(skb, TCA_XSTATS, sizeof(xstats), &xstats);
return skb->len;
rtattr_failure:
return -1;
}
static int static int
hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
struct tcmsg *tcm) struct tcmsg *tcm)
...@@ -1451,11 +1421,6 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, ...@@ -1451,11 +1421,6 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
if (hfsc_dump_curves(skb, cl) < 0) if (hfsc_dump_curves(skb, cl) < 0)
goto rtattr_failure; goto rtattr_failure;
rta->rta_len = skb->tail - b; rta->rta_len = skb->tail - b;
if ((hfsc_dump_stats(skb, cl) < 0) ||
(hfsc_dump_xstats(skb, cl) < 0))
goto rtattr_failure;
return skb->len; return skb->len;
rtattr_failure: rtattr_failure:
...@@ -1463,6 +1428,31 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb, ...@@ -1463,6 +1428,31 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
return -1; return -1;
} }
static int
hfsc_dump_class_stats(struct Qdisc *sch, unsigned long arg,
struct gnet_dump *d)
{
struct hfsc_class *cl = (struct hfsc_class *)arg;
struct tc_hfsc_stats xstats;
cl->qstats.qlen = cl->qdisc->q.qlen;
xstats.level = cl->level;
xstats.period = cl->cl_vtperiod;
xstats.work = cl->cl_total;
xstats.rtwork = cl->cl_cumul;
if (gnet_stats_copy_basic(d, &cl->bstats) < 0 ||
#ifdef CONFIG_NET_ESTIMATOR
gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 ||
#endif
gnet_stats_copy_queue(d, &cl->qstats) < 0)
return -1;
return gnet_stats_copy_app(d, &xstats, sizeof(xstats));
}
static void static void
hfsc_walk(struct Qdisc *sch, struct qdisc_walker *arg) hfsc_walk(struct Qdisc *sch, struct qdisc_walker *arg)
{ {
...@@ -1819,6 +1809,7 @@ static struct Qdisc_class_ops hfsc_class_ops = { ...@@ -1819,6 +1809,7 @@ static struct Qdisc_class_ops hfsc_class_ops = {
.unbind_tcf = hfsc_unbind_tcf, .unbind_tcf = hfsc_unbind_tcf,
.tcf_chain = hfsc_tcf_chain, .tcf_chain = hfsc_tcf_chain,
.dump = hfsc_dump_class, .dump = hfsc_dump_class,
.dump_stats = hfsc_dump_class_stats,
.walk = hfsc_walk .walk = hfsc_walk
}; };
......
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