hif_irq_affinity.h 2.5 KB

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