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