2005-04-17 05:20:36 +07:00
|
|
|
#ifndef __NET_GEN_STATS_H
|
|
|
|
#define __NET_GEN_STATS_H
|
|
|
|
|
|
|
|
#include <linux/gen_stats.h>
|
|
|
|
#include <linux/socket.h>
|
|
|
|
#include <linux/rtnetlink.h>
|
|
|
|
#include <linux/pkt_sched.h>
|
|
|
|
|
2009-11-03 10:26:03 +07:00
|
|
|
struct gnet_dump {
|
2005-04-17 05:20:36 +07:00
|
|
|
spinlock_t * lock;
|
|
|
|
struct sk_buff * skb;
|
2008-01-23 13:11:17 +07:00
|
|
|
struct nlattr * tail;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2011-03-31 08:57:33 +07:00
|
|
|
/* Backward compatibility */
|
2005-04-17 05:20:36 +07:00
|
|
|
int compat_tc_stats;
|
|
|
|
int compat_xstats;
|
|
|
|
void * xstats;
|
|
|
|
int xstats_len;
|
|
|
|
struct tc_stats tc_stats;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int gnet_stats_start_copy(struct sk_buff *skb, int type,
|
|
|
|
spinlock_t *lock, struct gnet_dump *d);
|
|
|
|
|
|
|
|
extern int 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);
|
|
|
|
|
|
|
|
extern int gnet_stats_copy_basic(struct gnet_dump *d,
|
2009-08-16 16:36:49 +07:00
|
|
|
struct gnet_stats_basic_packed *b);
|
2005-04-17 05:20:36 +07:00
|
|
|
extern int gnet_stats_copy_rate_est(struct gnet_dump *d,
|
pkt_sched: gen_estimator: Dont report fake rate estimators
Jarek Poplawski a écrit :
>
>
> Hmm... So you made me to do some "real" work here, and guess what?:
> there is one serious checkpatch warning! ;-) Plus, this new parameter
> should be added to the function description. Otherwise:
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
>
> Thanks,
> Jarek P.
>
> PS: I guess full "Don't" would show we really mean it...
Okay :) Here is the last round, before the night !
Thanks again
[RFC] pkt_sched: gen_estimator: Don't report fake rate estimators
We currently send TCA_STATS_RATE_EST elements to netlink users, even if no estimator
is running.
# tc -s -d qdisc
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 112833764978 bytes 1495081739 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
User has no way to tell if the "rate 0bit 0pps" is a real estimation, or a fake
one (because no estimator is active)
After this patch, tc command output is :
$ tc -s -d qdisc
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 561075 bytes 1196 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
We add a parameter to gnet_stats_copy_rate_est() function so that
it can use gen_estimator_active(bstats, r), as suggested by Jarek.
This parameter can be NULL if check is not necessary, (htb for
example has a mandatory rate estimator)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-02 17:32:18 +07:00
|
|
|
const struct gnet_stats_basic_packed *b,
|
2013-06-06 22:43:22 +07:00
|
|
|
struct gnet_stats_rate_est64 *r);
|
2005-04-17 05:20:36 +07:00
|
|
|
extern int gnet_stats_copy_queue(struct gnet_dump *d,
|
|
|
|
struct gnet_stats_queue *q);
|
|
|
|
extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
|
|
|
|
|
|
|
|
extern int gnet_stats_finish_copy(struct gnet_dump *d);
|
|
|
|
|
2009-08-16 16:36:49 +07:00
|
|
|
extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
|
2013-06-06 22:43:22 +07:00
|
|
|
struct gnet_stats_rate_est64 *rate_est,
|
2008-01-23 13:11:17 +07:00
|
|
|
spinlock_t *stats_lock, struct nlattr *opt);
|
2009-08-16 16:36:49 +07:00
|
|
|
extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
|
2013-06-06 22:43:22 +07:00
|
|
|
struct gnet_stats_rate_est64 *rate_est);
|
2009-08-16 16:36:49 +07:00
|
|
|
extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
|
2013-06-06 22:43:22 +07:00
|
|
|
struct gnet_stats_rate_est64 *rate_est,
|
2008-01-23 13:11:17 +07:00
|
|
|
spinlock_t *stats_lock, struct nlattr *opt);
|
2009-08-16 16:36:49 +07:00
|
|
|
extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
|
2013-06-06 22:43:22 +07:00
|
|
|
const struct gnet_stats_rate_est64 *rate_est);
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|