* [PATCHSET] action statistics dumping fix & gnet_stats improvements
@ 2005-04-01 23:26 Thomas Graf
2005-04-01 23:27 ` [PATCH 1/3] [PKT_SCHED]: Properly return when no backward compatibility action statistics are to be dumped Thomas Graf
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Thomas Graf @ 2005-04-01 23:26 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Fixes a stupid bug I introduced in the last patchset which for some
reason didn't get caught in the testing process. The other two
patches change the behaviour of yet unused but likely use cases
to what one would expect without reading the code.
Please do a
bk pull bk://kernel.bkbits.net/tgraf/net-2.6-tcf_exts
This will update the following files:
include/net/gen_stats.h | 3 ++-
net/core/gen_stats.c | 48 +++++++++++++++++++++++++++++++-----------------
net/sched/act_api.c | 2 ++
3 files changed, 35 insertions(+), 18 deletions(-)
through these ChangeSets:
<tgraf@suug.ch> (05/04/01 1.2181.44.3)
[NET]: Improve gnet_stats_* dumping logic to be less error prone
The recent additions to make gnet_stats_* useable for action
statistics dumping in two steps introcuded a few error prone
assumptions which can easly be forgotten. This patch fixes this
up by simplifying the process of adding new fields to struct
gnet_dump or adding additional backward compatibility TLVs.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
<tgraf@suug.ch> (05/04/01 1.2181.44.2)
[NET]: Allow dumping of application specific statistics if no primary TLV is used
Although this case is hypothetical at the moment, more advanced actions are
likely to need this in the future.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
<tgraf@suug.ch> (05/04/01 1.2181.44.1)
[PKT_SCHED]: Properly return when no backward compatibility action statistics are to be dumped
Fixes a stupid bug introcuded in my "Fix action statistics dumping in
compatibility mode" patch, no clue why it actually worked without this fix.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] [PKT_SCHED]: Properly return when no backward compatibility action statistics are to be dumped
2005-04-01 23:26 [PATCHSET] action statistics dumping fix & gnet_stats improvements Thomas Graf
@ 2005-04-01 23:27 ` Thomas Graf
2005-04-01 23:28 ` [PATCH 2/3] [NET]: Allow dumping of application specific statistics if no primary TLV is used Thomas Graf
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Graf @ 2005-04-01 23:27 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/04/01 14:05:21+02:00 tgraf@suug.ch
# [PKT_SCHED]: Properly return when no backward compatibility action statistics are to be dumped
#
# Fixes a stupid bug introcuded in my "Fix action statistics dumping in
# compatibility mode" patch, no clue why it actually worked without this fix.
#
# Signed-off-by: Thomas Graf <tgraf@suug.ch>
# Signed-off-by: David S. Miller <davem@davemloft.net>
#
# net/sched/act_api.c
# 2005/04/01 14:05:09+02:00 tgraf@suug.ch +2 -0
# [PKT_SCHED]: Properly return when no backward compatibility action statistics are to be dumped
#
diff -Nru a/net/sched/act_api.c b/net/sched/act_api.c
--- a/net/sched/act_api.c 2005-04-02 01:18:40 +02:00
+++ b/net/sched/act_api.c 2005-04-02 01:18:40 +02:00
@@ -397,6 +397,8 @@
if (a->type == TCA_OLD_COMPAT)
err = gnet_stats_start_copy_compat(skb, 0,
TCA_STATS, TCA_XSTATS, h->stats_lock, &d);
+ else
+ return 0;
} else
err = gnet_stats_start_copy(skb, TCA_ACT_STATS,
h->stats_lock, &d);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] [NET]: Allow dumping of application specific statistics if no primary TLV is used
2005-04-01 23:26 [PATCHSET] action statistics dumping fix & gnet_stats improvements Thomas Graf
2005-04-01 23:27 ` [PATCH 1/3] [PKT_SCHED]: Properly return when no backward compatibility action statistics are to be dumped Thomas Graf
@ 2005-04-01 23:28 ` Thomas Graf
2005-04-01 23:28 ` [PATCH 3/3] [NET]: Improve gnet_stats_* dumping logic to be less error prone Thomas Graf
2005-04-01 23:49 ` [PATCHSET] action statistics dumping fix & gnet_stats improvements David S. Miller
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Graf @ 2005-04-01 23:28 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/04/01 14:24:14+02:00 tgraf@suug.ch
# [NET]: Allow dumping of application specific statistics if no primary TLV is used
#
# Although this case is hypothetical at the moment, more advanced actions are
# likely to need this in the future.
#
# Signed-off-by: Thomas Graf <tgraf@suug.ch>
# Signed-off-by: David S. Miller <davem@davemloft.net>
#
# net/core/gen_stats.c
# 2005/04/01 14:23:57+02:00 tgraf@suug.ch +7 -4
# [NET]: Allow dumping of application specific statistics if no primary TLV is used
#
# include/net/gen_stats.h
# 2005/04/01 14:23:57+02:00 tgraf@suug.ch +2 -1
# [NET]: Allow dumping of application specific statistics if no primary TLV is used
#
diff -Nru a/include/net/gen_stats.h b/include/net/gen_stats.h
--- a/include/net/gen_stats.h 2005-04-02 01:18:33 +02:00
+++ b/include/net/gen_stats.h 2005-04-02 01:18:33 +02:00
@@ -15,7 +15,8 @@
/* Backward compatability */
int compat_tc_stats;
int compat_xstats;
- struct rtattr * xstats;
+ void * xstats;
+ int xstats_len;
struct tc_stats tc_stats;
};
diff -Nru a/net/core/gen_stats.c b/net/core/gen_stats.c
--- a/net/core/gen_stats.c 2005-04-02 01:18:33 +02:00
+++ b/net/core/gen_stats.c 2005-04-02 01:18:33 +02:00
@@ -177,8 +177,11 @@
int
gnet_stats_copy_app(struct gnet_dump *d, void *st, int len)
{
- if (d->compat_xstats)
- d->xstats = (struct rtattr *) d->skb->tail;
+ if (d->compat_xstats) {
+ d->xstats = st;
+ d->xstats_len = len;
+ }
+
return gnet_stats_copy(d, TCA_STATS_APP, st, len);
}
@@ -206,8 +209,8 @@
return -1;
if (d->compat_xstats && d->xstats) {
- if (gnet_stats_copy(d, d->compat_xstats, RTA_DATA(d->xstats),
- RTA_PAYLOAD(d->xstats)) < 0)
+ if (gnet_stats_copy(d, d->compat_xstats, d->xstats,
+ d->xstats_len) < 0)
return -1;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] [NET]: Improve gnet_stats_* dumping logic to be less error prone
2005-04-01 23:26 [PATCHSET] action statistics dumping fix & gnet_stats improvements Thomas Graf
2005-04-01 23:27 ` [PATCH 1/3] [PKT_SCHED]: Properly return when no backward compatibility action statistics are to be dumped Thomas Graf
2005-04-01 23:28 ` [PATCH 2/3] [NET]: Allow dumping of application specific statistics if no primary TLV is used Thomas Graf
@ 2005-04-01 23:28 ` Thomas Graf
2005-04-01 23:49 ` [PATCHSET] action statistics dumping fix & gnet_stats improvements David S. Miller
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Graf @ 2005-04-01 23:28 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/04/01 15:01:24+02:00 tgraf@suug.ch
# [NET]: Improve gnet_stats_* dumping logic to be less error prone
#
# The recent additions to make gnet_stats_* useable for action
# statistics dumping in two steps introcuded a few error prone
# assumptions which can easly be forgotten. This patch fixes this
# up by simplifying the process of adding new fields to struct
# gnet_dump or adding additional backward compatibility TLVs.
#
# Signed-off-by: Thomas Graf <tgraf@suug.ch>
# Signed-off-by: David S. Miller <davem@davemloft.net>
#
# net/core/gen_stats.c
# 2005/04/01 15:01:12+02:00 tgraf@suug.ch +24 -13
# [NET]: Improve gnet_stats_* dumping logic to be less error prone
#
diff -Nru a/net/core/gen_stats.c b/net/core/gen_stats.c
--- a/net/core/gen_stats.c 2005-04-02 01:18:26 +02:00
+++ b/net/core/gen_stats.c 2005-04-02 01:18:26 +02:00
@@ -26,9 +26,7 @@
static inline int
gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size)
{
- if (type)
- RTA_PUT(d->skb, type, size, buf);
-
+ RTA_PUT(d->skb, type, size, buf);
return 0;
rtattr_failure:
@@ -58,6 +56,8 @@
gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
int xstats_type, spinlock_t *lock, struct gnet_dump *d)
{
+ memset(d, 0, sizeof(*d));
+
spin_lock_bh(lock);
d->lock = lock;
if (type)
@@ -65,12 +65,11 @@
d->skb = skb;
d->compat_tc_stats = tc_stats_type;
d->compat_xstats = xstats_type;
- d->xstats = NULL;
- if (d->compat_tc_stats)
- memset(&d->tc_stats, 0, sizeof(d->tc_stats));
+ if (d->tail)
+ return gnet_stats_copy(d, type, NULL, 0);
- return gnet_stats_copy(d, type, NULL, 0);
+ return 0;
}
/**
@@ -111,8 +110,11 @@
d->tc_stats.bytes = b->bytes;
d->tc_stats.packets = b->packets;
}
-
- return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b));
+
+ if (d->tail)
+ return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b));
+
+ return 0;
}
/**
@@ -134,7 +136,10 @@
d->tc_stats.pps = r->pps;
}
- return gnet_stats_copy(d, TCA_STATS_RATE_EST, r, sizeof(*r));
+ if (d->tail)
+ return gnet_stats_copy(d, TCA_STATS_RATE_EST, r, sizeof(*r));
+
+ return 0;
}
/**
@@ -157,8 +162,11 @@
d->tc_stats.backlog = q->backlog;
d->tc_stats.overlimits = q->overlimits;
}
-
- return gnet_stats_copy(d, TCA_STATS_QUEUE, q, sizeof(*q));
+
+ if (d->tail)
+ return gnet_stats_copy(d, TCA_STATS_QUEUE, q, sizeof(*q));
+
+ return 0;
}
/**
@@ -182,7 +190,10 @@
d->xstats_len = len;
}
- return gnet_stats_copy(d, TCA_STATS_APP, st, len);
+ if (d->tail)
+ return gnet_stats_copy(d, TCA_STATS_APP, st, len);
+
+ return 0;
}
/**
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHSET] action statistics dumping fix & gnet_stats improvements
2005-04-01 23:26 [PATCHSET] action statistics dumping fix & gnet_stats improvements Thomas Graf
` (2 preceding siblings ...)
2005-04-01 23:28 ` [PATCH 3/3] [NET]: Improve gnet_stats_* dumping logic to be less error prone Thomas Graf
@ 2005-04-01 23:49 ` David S. Miller
3 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2005-04-01 23:49 UTC (permalink / raw)
To: Thomas Graf; +Cc: netdev
On Sat, 2 Apr 2005 01:26:54 +0200
Thomas Graf <tgraf@suug.ch> wrote:
> Fixes a stupid bug I introduced in the last patchset which for some
> reason didn't get caught in the testing process. The other two
> patches change the behaviour of yet unused but likely use cases
> to what one would expect without reading the code.
>
> Please do a
>
> bk pull bk://kernel.bkbits.net/tgraf/net-2.6-tcf_exts
All looks good.
Pulled, thanks Thomas.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-01 23:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-01 23:26 [PATCHSET] action statistics dumping fix & gnet_stats improvements Thomas Graf
2005-04-01 23:27 ` [PATCH 1/3] [PKT_SCHED]: Properly return when no backward compatibility action statistics are to be dumped Thomas Graf
2005-04-01 23:28 ` [PATCH 2/3] [NET]: Allow dumping of application specific statistics if no primary TLV is used Thomas Graf
2005-04-01 23:28 ` [PATCH 3/3] [NET]: Improve gnet_stats_* dumping logic to be less error prone Thomas Graf
2005-04-01 23:49 ` [PATCHSET] action statistics dumping fix & gnet_stats improvements David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).