diff options
author | Eric Dumazet <edumazet@google.com> | 2013-06-06 11:43:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-11 05:51:03 -0400 |
commit | 45203a3b380cee28f570475c0d28c169f908c209 (patch) | |
tree | 9d9b00da9accbc0ea01c91c206cb86a2f9dd7609 /net/core/gen_estimator.c | |
parent | b41abb42bf62a85a32c41dab873220598a6ee266 (diff) |
net_sched: add 64bit rate estimators
struct gnet_stats_rate_est contains u32 fields, so the bytes per second
field can wrap at 34360Mbit.
Add a new gnet_stats_rate_est64 structure to get 64bit bps/pps fields,
and switch the kernel to use this structure natively.
This structure is dumped to user space as a new attribute :
TCA_STATS_RATE_EST64
Old tc command will now display the capped bps (to 34360Mbit), instead
of wrapped values, and updated tc command will display correct
information.
Old tc command output, after patch :
eric:~# tc -s -d qd sh dev lo
qdisc pfifo 8001: root refcnt 2 limit 1000p
Sent 80868245400 bytes 1978837 pkt (dropped 0, overlimits 0 requeues 0)
rate 34360Mbit 189696pps backlog 0b 0p requeues 0
This patch carefully reorganizes "struct Qdisc" layout to get optimal
performance on SMP.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/gen_estimator.c')
-rw-r--r-- | net/core/gen_estimator.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index d9d198aa9fed..6b5b6e7013ca 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c | |||
@@ -82,7 +82,7 @@ struct gen_estimator | |||
82 | { | 82 | { |
83 | struct list_head list; | 83 | struct list_head list; |
84 | struct gnet_stats_basic_packed *bstats; | 84 | struct gnet_stats_basic_packed *bstats; |
85 | struct gnet_stats_rate_est *rate_est; | 85 | struct gnet_stats_rate_est64 *rate_est; |
86 | spinlock_t *stats_lock; | 86 | spinlock_t *stats_lock; |
87 | int ewma_log; | 87 | int ewma_log; |
88 | u64 last_bytes; | 88 | u64 last_bytes; |
@@ -167,7 +167,7 @@ static void gen_add_node(struct gen_estimator *est) | |||
167 | 167 | ||
168 | static | 168 | static |
169 | struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats, | 169 | struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats, |
170 | const struct gnet_stats_rate_est *rate_est) | 170 | const struct gnet_stats_rate_est64 *rate_est) |
171 | { | 171 | { |
172 | struct rb_node *p = est_root.rb_node; | 172 | struct rb_node *p = est_root.rb_node; |
173 | 173 | ||
@@ -203,7 +203,7 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats | |||
203 | * | 203 | * |
204 | */ | 204 | */ |
205 | int gen_new_estimator(struct gnet_stats_basic_packed *bstats, | 205 | int gen_new_estimator(struct gnet_stats_basic_packed *bstats, |
206 | struct gnet_stats_rate_est *rate_est, | 206 | struct gnet_stats_rate_est64 *rate_est, |
207 | spinlock_t *stats_lock, | 207 | spinlock_t *stats_lock, |
208 | struct nlattr *opt) | 208 | struct nlattr *opt) |
209 | { | 209 | { |
@@ -258,7 +258,7 @@ EXPORT_SYMBOL(gen_new_estimator); | |||
258 | * Note : Caller should respect an RCU grace period before freeing stats_lock | 258 | * Note : Caller should respect an RCU grace period before freeing stats_lock |
259 | */ | 259 | */ |
260 | void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, | 260 | void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, |
261 | struct gnet_stats_rate_est *rate_est) | 261 | struct gnet_stats_rate_est64 *rate_est) |
262 | { | 262 | { |
263 | struct gen_estimator *e; | 263 | struct gen_estimator *e; |
264 | 264 | ||
@@ -290,7 +290,7 @@ EXPORT_SYMBOL(gen_kill_estimator); | |||
290 | * Returns 0 on success or a negative error code. | 290 | * Returns 0 on success or a negative error code. |
291 | */ | 291 | */ |
292 | int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, | 292 | int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, |
293 | struct gnet_stats_rate_est *rate_est, | 293 | struct gnet_stats_rate_est64 *rate_est, |
294 | spinlock_t *stats_lock, struct nlattr *opt) | 294 | spinlock_t *stats_lock, struct nlattr *opt) |
295 | { | 295 | { |
296 | gen_kill_estimator(bstats, rate_est); | 296 | gen_kill_estimator(bstats, rate_est); |
@@ -306,7 +306,7 @@ EXPORT_SYMBOL(gen_replace_estimator); | |||
306 | * Returns true if estimator is active, and false if not. | 306 | * Returns true if estimator is active, and false if not. |
307 | */ | 307 | */ |
308 | bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, | 308 | bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, |
309 | const struct gnet_stats_rate_est *rate_est) | 309 | const struct gnet_stats_rate_est64 *rate_est) |
310 | { | 310 | { |
311 | bool res; | 311 | bool res; |
312 | 312 | ||