xref: /wlan-driver/qca-wifi-host-cmn/hif/src/hif_irq_affinity.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 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 #ifndef __HIF_IRQ_AFFINITY_H__
21 #define __HIF_IRQ_AFFINITY_H__
22 
23 #ifdef HIF_IRQ_AFFINITY
24 #ifndef FEATURE_NAPI
25 #error /*HIF_IRQ_AFFINITY currently relies on FEATURE_NAPI*/
26 #endif
27 #endif
28 
29 /* CLD headers */
30 #include <hif.h> /* struct hif_opaque_softc; */
31 #include <hif_napi.h>
32 struct hif_opaque_softc;
33 enum qca_denylist_op;
34 
35 int hif_exec_cpu_migrate(struct qca_napi_data *napid, int cpu, int action);
36 
37 int hif_exec_cpu_denylist(struct qca_napi_data *napid,
38 			  enum qca_denylist_op op);
39 
40 #ifdef HIF_IRQ_AFFINITY
41 int hif_exec_event(struct hif_opaque_softc     *hif,
42 		   enum  qca_napi_event event,
43 		   void                *data);
44 
45 
46 /* hif_irq_affinity_remove() - remove affinity before freeing the irq
47  * @os_irq: irq number to remove affinity from
48  */
hif_irq_affinity_remove(int os_irq)49 static inline void hif_irq_affinity_remove(int os_irq)
50 {
51 	qdf_dev_set_irq_affinity(os_irq, NULL);
52 }
53 #else
hif_irq_affinity_remove(int os_irq)54 static inline void hif_irq_affinity_remove(int os_irq)
55 {
56 }
57 
hif_exec_event(struct hif_opaque_softc * hif,enum qca_napi_event event,void * data)58 static inline int hif_exec_event(struct hif_opaque_softc     *hif,
59 		   enum  qca_napi_event event,
60 		   void                *data)
61 {
62 	return 0;
63 }
64 #endif
65 
66 /**
67  * hif_napi_core_ctl_set_boost() - This API is used to move
68  * tasks to CPUs with higher capacity
69  * @boost: If set move tasks to higher capacity CPUs
70  *
71  * This function moves tasks to higher capacity CPUs than those
72  * where the tasks would have  normally ended up
73  *
74  * Return:  None
75  */
hif_napi_core_ctl_set_boost(bool boost)76 static inline int hif_napi_core_ctl_set_boost(bool boost)
77 {
78 	return qdf_core_ctl_set_boost(boost);
79 }
80 
81 #ifdef HIF_CPU_PERF_AFFINE_MASK
hif_core_ctl_set_boost(bool boost)82 static inline int hif_core_ctl_set_boost(bool boost)
83 {
84 	return hif_napi_core_ctl_set_boost(boost);
85 }
86 #else
hif_core_ctl_set_boost(bool boost)87 static inline int hif_core_ctl_set_boost(bool boost)
88 {
89 	return 0;
90 }
91 #endif
92 #endif
93