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