xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_hist_struct.h (revision 45a38684b07295822dc8eba39e293408f203eec8)
1 /*
2  * Copyright (c) 2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * @file cdp_txrx_hist_struct.h
21  * @brief Define the host data path histogram data types
22  */
23 #ifndef _CDP_TXRX_HIST_STRUCT_H_
24 #define _CDP_TXRX_HIST_STRUCT_H_
25 
26 /*
27  * cdp_hist_bucket_index : Histogram Bucket
28  * @CDP_HIST_BUCKET_0: Bucket Index 0
29  * @CDP_HIST_BUCKET_1: Bucket Index 1
30  * @CDP_HIST_BUCKET_2: Bucket Index 2
31  * @CDP_HIST_BUCKET_3: Bucket Index 3
32  * @CDP_HIST_BUCKET_4: Bucket Index 4
33  * @CDP_HIST_BUCKET_5: Bucket Index 5
34  * @CDP_HIST_BUCKET_6: Bucket Index 6
35  * @CDP_HIST_BUCKET_7: Bucket Index 7
36  * @CDP_HIST_BUCKET_8: Bucket Index 8
37  * @CDP_HIST_BUCKET_9: Bucket Index 9
38  */
39 enum cdp_hist_bucket_index {
40 	CDP_HIST_BUCKET_0,
41 	CDP_HIST_BUCKET_1,
42 	CDP_HIST_BUCKET_2,
43 	CDP_HIST_BUCKET_3,
44 	CDP_HIST_BUCKET_4,
45 	CDP_HIST_BUCKET_5,
46 	CDP_HIST_BUCKET_6,
47 	CDP_HIST_BUCKET_7,
48 	CDP_HIST_BUCKET_8,
49 	CDP_HIST_BUCKET_9,
50 	CDP_HIST_BUCKET_MAX,
51 };
52 
53 /*
54  * cdp_hist_types: Histogram Types
55  * @CDP_HIST_TYPE_SW_ENQEUE_DELAY: From stack to HW enqueue delay
56  * @CDP_HIST_TYPE_HW_COMP_DELAY: From HW enqueue to completion delay
57  * @CDP_HIST_TYPE_REAP_STACK: Rx HW reap to stack deliver delay
58  */
59 enum cdp_hist_types {
60 	CDP_HIST_TYPE_SW_ENQEUE_DELAY,
61 	CDP_HIST_TYPE_HW_COMP_DELAY,
62 	CDP_HIST_TYPE_REAP_STACK,
63 	CDP_HIST_TYPE_MAX,
64 };
65 
66 /*
67  * cdp_hist_bucket: Histogram Bucket
68  * @hist_type: Histogram type
69  * @freq: Frequency
70  */
71 struct cdp_hist_bucket {
72 	enum cdp_hist_types hist_type;
73 	uint64_t freq[CDP_HIST_BUCKET_MAX];
74 };
75 
76 /*
77  * cdp_hist_stats : Histogram of a stats type
78  * @hist: Frequency distribution
79  * @max: Max frequency
80  * @min: Minimum frequency
81  * @avg: Average frequency
82  */
83 struct cdp_hist_stats {
84 	struct cdp_hist_bucket hist;
85 	int max;
86 	int min;
87 	int avg;
88 };
89 #endif /* _CDP_TXRX_HIST_STRUCT_H_ */
90