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