xref: /openbmc/linux/include/uapi/linux/gen_stats.h (revision 607ca46e97a1b6594b29647d98a32d545c24bdff)
1*607ca46eSDavid Howells #ifndef __LINUX_GEN_STATS_H
2*607ca46eSDavid Howells #define __LINUX_GEN_STATS_H
3*607ca46eSDavid Howells 
4*607ca46eSDavid Howells #include <linux/types.h>
5*607ca46eSDavid Howells 
6*607ca46eSDavid Howells enum {
7*607ca46eSDavid Howells 	TCA_STATS_UNSPEC,
8*607ca46eSDavid Howells 	TCA_STATS_BASIC,
9*607ca46eSDavid Howells 	TCA_STATS_RATE_EST,
10*607ca46eSDavid Howells 	TCA_STATS_QUEUE,
11*607ca46eSDavid Howells 	TCA_STATS_APP,
12*607ca46eSDavid Howells 	__TCA_STATS_MAX,
13*607ca46eSDavid Howells };
14*607ca46eSDavid Howells #define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
15*607ca46eSDavid Howells 
16*607ca46eSDavid Howells /**
17*607ca46eSDavid Howells  * struct gnet_stats_basic - byte/packet throughput statistics
18*607ca46eSDavid Howells  * @bytes: number of seen bytes
19*607ca46eSDavid Howells  * @packets: number of seen packets
20*607ca46eSDavid Howells  */
21*607ca46eSDavid Howells struct gnet_stats_basic {
22*607ca46eSDavid Howells 	__u64	bytes;
23*607ca46eSDavid Howells 	__u32	packets;
24*607ca46eSDavid Howells };
25*607ca46eSDavid Howells struct gnet_stats_basic_packed {
26*607ca46eSDavid Howells 	__u64	bytes;
27*607ca46eSDavid Howells 	__u32	packets;
28*607ca46eSDavid Howells } __attribute__ ((packed));
29*607ca46eSDavid Howells 
30*607ca46eSDavid Howells /**
31*607ca46eSDavid Howells  * struct gnet_stats_rate_est - rate estimator
32*607ca46eSDavid Howells  * @bps: current byte rate
33*607ca46eSDavid Howells  * @pps: current packet rate
34*607ca46eSDavid Howells  */
35*607ca46eSDavid Howells struct gnet_stats_rate_est {
36*607ca46eSDavid Howells 	__u32	bps;
37*607ca46eSDavid Howells 	__u32	pps;
38*607ca46eSDavid Howells };
39*607ca46eSDavid Howells 
40*607ca46eSDavid Howells /**
41*607ca46eSDavid Howells  * struct gnet_stats_queue - queuing statistics
42*607ca46eSDavid Howells  * @qlen: queue length
43*607ca46eSDavid Howells  * @backlog: backlog size of queue
44*607ca46eSDavid Howells  * @drops: number of dropped packets
45*607ca46eSDavid Howells  * @requeues: number of requeues
46*607ca46eSDavid Howells  * @overlimits: number of enqueues over the limit
47*607ca46eSDavid Howells  */
48*607ca46eSDavid Howells struct gnet_stats_queue {
49*607ca46eSDavid Howells 	__u32	qlen;
50*607ca46eSDavid Howells 	__u32	backlog;
51*607ca46eSDavid Howells 	__u32	drops;
52*607ca46eSDavid Howells 	__u32	requeues;
53*607ca46eSDavid Howells 	__u32	overlimits;
54*607ca46eSDavid Howells };
55*607ca46eSDavid Howells 
56*607ca46eSDavid Howells /**
57*607ca46eSDavid Howells  * struct gnet_estimator - rate estimator configuration
58*607ca46eSDavid Howells  * @interval: sampling period
59*607ca46eSDavid Howells  * @ewma_log: the log of measurement window weight
60*607ca46eSDavid Howells  */
61*607ca46eSDavid Howells struct gnet_estimator {
62*607ca46eSDavid Howells 	signed char	interval;
63*607ca46eSDavid Howells 	unsigned char	ewma_log;
64*607ca46eSDavid Howells };
65*607ca46eSDavid Howells 
66*607ca46eSDavid Howells 
67*607ca46eSDavid Howells #endif /* __LINUX_GEN_STATS_H */
68