1 /*
2  * Copyright (c) 2016 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  * DOC: i_qdf_perf
21  * This file provides OS dependent perf API's.
22  */
23 
24 #ifndef _I_QDF_PERF_H
25 #define _I_QDF_PERF_H
26 
27 #ifdef QCA_PERF_PROFILING
28 
29 #if (QCA_MIPS74K_PERF_PROFILING || QCA_MIPS24KK_PERF_PROFILING)
30 #include <qdf_mips_perf_pvt.h>
31 #endif
32 
33 /* #defines required for structures */
34 #define MAX_SAMPLES_SHIFT   5   /* change this only*/
35 #define MAX_SAMPLES         (1 << MAX_SAMPLES_SHIFT)
36 #define INC_SAMPLES(x)      ((x + 1) & (MAX_SAMPLES - 1))
37 #define MAX_SAMPLE_SZ       (sizeof(uint32_t) * MAX_SAMPLES)
38 #define PER_SAMPLE_SZ       sizeof(uint32_t)
39 
40 /**
41  * typedef qdf_perf_entry_t - performance entry
42  * @list: pointer to next
43  * @child: pointer tochild
44  * @parent: pointer to top
45  * @type: perf cntr
46  * @name: string
47  * @proc: pointer to proc entry
48  * @start_tsc: array at start tsc
49  * @end_tsc: array at ent tsc
50  * @samples: array of samples
51  * @sample_idx: sample index
52  * @lock_irq: lock irq
53  */
54 typedef struct qdf_os_perf_entry {
55 	struct list_head        list;
56 	struct list_head        child;
57 
58 	struct qdf_perf_entry   *parent;
59 
60 	qdf_perf_cntr_t type;
61 	uint8_t *name;
62 
63 	struct proc_dir_entry   *proc;
64 
65 	uint64_t        start_tsc[MAX_SAMPLES];
66 	uint64_t        end_tsc[MAX_SAMPLES];
67 
68 	uint32_t        samples[MAX_SAMPLES];
69 	uint32_t        sample_idx;
70 
71 	spinlock_t      lock_irq;
72 
73 } qdf_perf_entry_t;
74 
75 /* typedefs */
76 typedef void *__qdf_perf_id_t;
77 
78 #endif /* QCA_PERF_PROFILING */
79 #endif /* _I_QDF_PERF_H */
80