xref: /openbmc/linux/include/uapi/linux/gen_stats.h (revision 45203a3b380cee28f570475c0d28c169f908c209)
1607ca46eSDavid Howells #ifndef __LINUX_GEN_STATS_H
2607ca46eSDavid Howells #define __LINUX_GEN_STATS_H
3607ca46eSDavid Howells 
4607ca46eSDavid Howells #include <linux/types.h>
5607ca46eSDavid Howells 
6607ca46eSDavid Howells enum {
7607ca46eSDavid Howells 	TCA_STATS_UNSPEC,
8607ca46eSDavid Howells 	TCA_STATS_BASIC,
9607ca46eSDavid Howells 	TCA_STATS_RATE_EST,
10607ca46eSDavid Howells 	TCA_STATS_QUEUE,
11607ca46eSDavid Howells 	TCA_STATS_APP,
12*45203a3bSEric Dumazet 	TCA_STATS_RATE_EST64,
13607ca46eSDavid Howells 	__TCA_STATS_MAX,
14607ca46eSDavid Howells };
15607ca46eSDavid Howells #define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
16607ca46eSDavid Howells 
17607ca46eSDavid Howells /**
18607ca46eSDavid Howells  * struct gnet_stats_basic - byte/packet throughput statistics
19607ca46eSDavid Howells  * @bytes: number of seen bytes
20607ca46eSDavid Howells  * @packets: number of seen packets
21607ca46eSDavid Howells  */
22607ca46eSDavid Howells struct gnet_stats_basic {
23607ca46eSDavid Howells 	__u64	bytes;
24607ca46eSDavid Howells 	__u32	packets;
25607ca46eSDavid Howells };
26607ca46eSDavid Howells struct gnet_stats_basic_packed {
27607ca46eSDavid Howells 	__u64	bytes;
28607ca46eSDavid Howells 	__u32	packets;
29607ca46eSDavid Howells } __attribute__ ((packed));
30607ca46eSDavid Howells 
31607ca46eSDavid Howells /**
32607ca46eSDavid Howells  * struct gnet_stats_rate_est - rate estimator
33607ca46eSDavid Howells  * @bps: current byte rate
34607ca46eSDavid Howells  * @pps: current packet rate
35607ca46eSDavid Howells  */
36607ca46eSDavid Howells struct gnet_stats_rate_est {
37607ca46eSDavid Howells 	__u32	bps;
38607ca46eSDavid Howells 	__u32	pps;
39607ca46eSDavid Howells };
40607ca46eSDavid Howells 
41607ca46eSDavid Howells /**
42*45203a3bSEric Dumazet  * struct gnet_stats_rate_est64 - rate estimator
43*45203a3bSEric Dumazet  * @bps: current byte rate
44*45203a3bSEric Dumazet  * @pps: current packet rate
45*45203a3bSEric Dumazet  */
46*45203a3bSEric Dumazet struct gnet_stats_rate_est64 {
47*45203a3bSEric Dumazet 	__u64	bps;
48*45203a3bSEric Dumazet 	__u64	pps;
49*45203a3bSEric Dumazet };
50*45203a3bSEric Dumazet 
51*45203a3bSEric Dumazet /**
52607ca46eSDavid Howells  * struct gnet_stats_queue - queuing statistics
53607ca46eSDavid Howells  * @qlen: queue length
54607ca46eSDavid Howells  * @backlog: backlog size of queue
55607ca46eSDavid Howells  * @drops: number of dropped packets
56607ca46eSDavid Howells  * @requeues: number of requeues
57607ca46eSDavid Howells  * @overlimits: number of enqueues over the limit
58607ca46eSDavid Howells  */
59607ca46eSDavid Howells struct gnet_stats_queue {
60607ca46eSDavid Howells 	__u32	qlen;
61607ca46eSDavid Howells 	__u32	backlog;
62607ca46eSDavid Howells 	__u32	drops;
63607ca46eSDavid Howells 	__u32	requeues;
64607ca46eSDavid Howells 	__u32	overlimits;
65607ca46eSDavid Howells };
66607ca46eSDavid Howells 
67607ca46eSDavid Howells /**
68607ca46eSDavid Howells  * struct gnet_estimator - rate estimator configuration
69607ca46eSDavid Howells  * @interval: sampling period
70607ca46eSDavid Howells  * @ewma_log: the log of measurement window weight
71607ca46eSDavid Howells  */
72607ca46eSDavid Howells struct gnet_estimator {
73607ca46eSDavid Howells 	signed char	interval;
74607ca46eSDavid Howells 	unsigned char	ewma_log;
75607ca46eSDavid Howells };
76607ca46eSDavid Howells 
77607ca46eSDavid Howells 
78607ca46eSDavid Howells #endif /* __LINUX_GEN_STATS_H */
79