xref: /openbmc/linux/include/uapi/linux/gen_stats.h (revision 5e111210a44301304f9054e995bf33f69b6de76f)
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,
15*5e111210SEelco Chaudron 	TCA_STATS_BASIC_HW,
16607ca46eSDavid Howells 	__TCA_STATS_MAX,
17607ca46eSDavid Howells };
18607ca46eSDavid Howells #define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
19607ca46eSDavid Howells 
20607ca46eSDavid Howells /**
21607ca46eSDavid Howells  * struct gnet_stats_basic - byte/packet throughput statistics
22607ca46eSDavid Howells  * @bytes: number of seen bytes
23607ca46eSDavid Howells  * @packets: number of seen packets
24607ca46eSDavid Howells  */
25607ca46eSDavid Howells struct gnet_stats_basic {
26607ca46eSDavid Howells 	__u64	bytes;
27607ca46eSDavid Howells 	__u32	packets;
28607ca46eSDavid Howells };
29607ca46eSDavid Howells struct gnet_stats_basic_packed {
30607ca46eSDavid Howells 	__u64	bytes;
31607ca46eSDavid Howells 	__u32	packets;
32607ca46eSDavid Howells } __attribute__ ((packed));
33607ca46eSDavid Howells 
34607ca46eSDavid Howells /**
35607ca46eSDavid Howells  * struct gnet_stats_rate_est - rate estimator
36607ca46eSDavid Howells  * @bps: current byte rate
37607ca46eSDavid Howells  * @pps: current packet rate
38607ca46eSDavid Howells  */
39607ca46eSDavid Howells struct gnet_stats_rate_est {
40607ca46eSDavid Howells 	__u32	bps;
41607ca46eSDavid Howells 	__u32	pps;
42607ca46eSDavid Howells };
43607ca46eSDavid Howells 
44607ca46eSDavid Howells /**
4545203a3bSEric Dumazet  * struct gnet_stats_rate_est64 - rate estimator
4645203a3bSEric Dumazet  * @bps: current byte rate
4745203a3bSEric Dumazet  * @pps: current packet rate
4845203a3bSEric Dumazet  */
4945203a3bSEric Dumazet struct gnet_stats_rate_est64 {
5045203a3bSEric Dumazet 	__u64	bps;
5145203a3bSEric Dumazet 	__u64	pps;
5245203a3bSEric Dumazet };
5345203a3bSEric Dumazet 
5445203a3bSEric Dumazet /**
55607ca46eSDavid Howells  * struct gnet_stats_queue - queuing statistics
56607ca46eSDavid Howells  * @qlen: queue length
57607ca46eSDavid Howells  * @backlog: backlog size of queue
58607ca46eSDavid Howells  * @drops: number of dropped packets
59607ca46eSDavid Howells  * @requeues: number of requeues
60607ca46eSDavid Howells  * @overlimits: number of enqueues over the limit
61607ca46eSDavid Howells  */
62607ca46eSDavid Howells struct gnet_stats_queue {
63607ca46eSDavid Howells 	__u32	qlen;
64607ca46eSDavid Howells 	__u32	backlog;
65607ca46eSDavid Howells 	__u32	drops;
66607ca46eSDavid Howells 	__u32	requeues;
67607ca46eSDavid Howells 	__u32	overlimits;
68607ca46eSDavid Howells };
69607ca46eSDavid Howells 
70607ca46eSDavid Howells /**
71607ca46eSDavid Howells  * struct gnet_estimator - rate estimator configuration
72607ca46eSDavid Howells  * @interval: sampling period
73607ca46eSDavid Howells  * @ewma_log: the log of measurement window weight
74607ca46eSDavid Howells  */
75607ca46eSDavid Howells struct gnet_estimator {
76607ca46eSDavid Howells 	signed char	interval;
77607ca46eSDavid Howells 	unsigned char	ewma_log;
78607ca46eSDavid Howells };
79607ca46eSDavid Howells 
80607ca46eSDavid Howells 
81607ca46eSDavid Howells #endif /* __LINUX_GEN_STATS_H */
82