xref: /linux/include/uapi/linux/gen_stats.h (revision c95baf12f5077419db01313ab61c2aac007d40cd)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells #ifndef __LINUX_GEN_STATS_H
3607ca46eSDavid Howells #define __LINUX_GEN_STATS_H
4607ca46eSDavid Howells 
5607ca46eSDavid Howells #include <linux/types.h>
6607ca46eSDavid Howells 
7607ca46eSDavid Howells enum {
8607ca46eSDavid Howells 	TCA_STATS_UNSPEC,
9607ca46eSDavid Howells 	TCA_STATS_BASIC,
10607ca46eSDavid Howells 	TCA_STATS_RATE_EST,
11607ca46eSDavid Howells 	TCA_STATS_QUEUE,
12607ca46eSDavid Howells 	TCA_STATS_APP,
1345203a3bSEric Dumazet 	TCA_STATS_RATE_EST64,
149854518eSNicolas Dichtel 	TCA_STATS_PAD,
155e111210SEelco Chaudron 	TCA_STATS_BASIC_HW,
16*b33e699fSEric Dumazet 	TCA_STATS_PKT64,
17607ca46eSDavid Howells 	__TCA_STATS_MAX,
18607ca46eSDavid Howells };
19607ca46eSDavid Howells #define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
20607ca46eSDavid Howells 
21607ca46eSDavid Howells /**
22607ca46eSDavid Howells  * struct gnet_stats_basic - byte/packet throughput statistics
23607ca46eSDavid Howells  * @bytes: number of seen bytes
24607ca46eSDavid Howells  * @packets: number of seen packets
25607ca46eSDavid Howells  */
26607ca46eSDavid Howells struct gnet_stats_basic {
27607ca46eSDavid Howells 	__u64	bytes;
28607ca46eSDavid Howells 	__u32	packets;
29607ca46eSDavid Howells };
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 /**
4245203a3bSEric Dumazet  * struct gnet_stats_rate_est64 - rate estimator
4345203a3bSEric Dumazet  * @bps: current byte rate
4445203a3bSEric Dumazet  * @pps: current packet rate
4545203a3bSEric Dumazet  */
4645203a3bSEric Dumazet struct gnet_stats_rate_est64 {
4745203a3bSEric Dumazet 	__u64	bps;
4845203a3bSEric Dumazet 	__u64	pps;
4945203a3bSEric Dumazet };
5045203a3bSEric Dumazet 
5145203a3bSEric 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