From: Thomas Graf <tgraf@suug.ch>
To: "David S. Miller" <davem@davemloft.net>
Cc: Jamal Hadi Salim <hadi@cyberus.ca>, netdev@oss.sgi.com
Subject: [PATCH 2/5] PKT_SCHED: Use gnet_stats API to copy statistics into netlink message
Date: Thu, 7 Oct 2004 03:04:31 +0200 [thread overview]
Message-ID: <20041007010431.GC18621@postel.suug.ch> (raw)
In-Reply-To: <20041007010146.GA18621@postel.suug.ch>
Adapts qdisc API to use new gnet_stats functions to copy
statistics into netlink message.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
diff -Nru linux-2.6.9-rc3-bk6.orig/include/linux/rtnetlink.h linux-2.6.9-rc3-bk6/include/linux/rtnetlink.h
--- linux-2.6.9-rc3-bk6.orig/include/linux/rtnetlink.h 2004-10-06 14:19:13.000000000 +0200
+++ linux-2.6.9-rc3-bk6/include/linux/rtnetlink.h 2004-10-06 20:24:32.000000000 +0200
@@ -698,6 +698,7 @@
TCA_XSTATS,
TCA_RATE,
TCA_FCNT,
+ TCA_STATS2,
__TCA_MAX
};
diff -Nru linux-2.6.9-rc3-bk6.orig/net/sched/sch_api.c linux-2.6.9-rc3-bk6/net/sched/sch_api.c
--- linux-2.6.9-rc3-bk6.orig/net/sched/sch_api.c 2004-10-06 14:19:49.000000000 +0200
+++ linux-2.6.9-rc3-bk6/net/sched/sch_api.c 2004-10-07 00:39:04.000000000 +0200
@@ -750,6 +750,7 @@
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 @@
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;
next prev parent reply other threads:[~2004-10-07 1:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-07 1:01 [PATCH 0/5] PKT_SCHED: Convert Qdiscs to use generic network statistics/estimator Thomas Graf
2004-10-07 1:03 ` [PATCH 1/5] PKT_SCHED: Replace tc_stats with new gnet_stats in struct Qdisc Thomas Graf
2004-10-07 1:04 ` Thomas Graf [this message]
2004-10-07 1:05 ` [PATCH 3/5] PKT_SCHED: Introduce gen_replace_estimator Thomas Graf
2004-10-07 1:07 ` [PATCH 4/5] PKT_SCHED: Use generic rate estimator Thomas Graf
2004-10-07 1:08 ` [PATCH 5/5] PKT_SCHED: Qdisc are not supposed to dump TCA_STATS themselves Thomas Graf
2004-10-09 15:48 ` jamal
2004-10-09 16:26 ` Thomas Graf
2004-10-09 16:41 ` jamal
2004-10-09 16:56 ` Thomas Graf
2004-10-20 1:19 ` [PATCH 0/5] PKT_SCHED: Convert Qdiscs to use generic network statistics/estimator David S. Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041007010431.GC18621@postel.suug.ch \
--to=tgraf@suug.ch \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.