dp_mon.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  7. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  8. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  9. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  10. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  11. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  12. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  13. */
  14. struct dp_mon_ops {
  15. QDF_STATUS (*mon_soc_cfg_init)(struct dp_soc *soc);
  16. QDF_STATUS (*mon_pdev_attach)(struct dp_pdev *pdev);
  17. QDF_STATUS (*mon_pdev_detach)(struct dp_pdev *pdev);
  18. QDF_STATUS (*mon_pdev_init)(struct dp_pdev *pdev);
  19. QDF_STATUS (*mon_pdev_deinit)(struct dp_pdev *pdev);
  20. };
  21. struct dp_mon_soc {
  22. /* Holds all monitor related fields extracted from dp_soc */
  23. /* Holds pointer to monitor ops */
  24. struct dp_mon_ops *mon_ops;
  25. };
  26. struct dp_mon_pdev {
  27. };
  28. struct dp_mon_vdev {
  29. };
  30. struct dp_mon_peer {
  31. };
  32. static inline QDF_STATUS monitor_pdev_attach(struct dp_pdev *pdev)
  33. {
  34. struct dp_mon_ops *monitor_ops;
  35. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  36. /*
  37. * mon_soc uninitialized modular support enabled
  38. * monitor related attach/detach/init/deinit
  39. * will be done while monitor insmod
  40. */
  41. if (!mon_soc)
  42. return QDF_STATUS_SUCCESS;
  43. monitor_ops = mon_soc->mon_ops;
  44. if (!monitor_ops || !monitor_ops->mon_pdev_attach) {
  45. qdf_err("callback not registered");
  46. return QDF_STATUS_E_FAILURE;
  47. }
  48. return monitor_ops->mon_pdev_attach(pdev);
  49. }
  50. static inline QDF_STATUS monitor_pdev_detach(struct dp_pdev *pdev)
  51. {
  52. struct dp_mon_ops *monitor_ops;
  53. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  54. /*
  55. * mon_soc uninitialized modular support enabled
  56. * monitor related attach/detach/init/deinit
  57. * will be done while monitor insmod
  58. */
  59. if (!mon_soc)
  60. return QDF_STATUS_SUCCESS;
  61. monitor_ops = mon_soc->mon_ops;
  62. if (!monitor_ops || !monitor_ops->mon_pdev_detach) {
  63. qdf_err("callback not registered");
  64. return QDF_STATUS_E_FAILURE;
  65. }
  66. return monitor_ops->mon_pdev_detach(pdev);
  67. }
  68. static inline QDF_STATUS monitor_pdev_init(struct dp_pdev *pdev)
  69. {
  70. struct dp_mon_ops *monitor_ops;
  71. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  72. /*
  73. * mon_soc uninitialized modular support enabled
  74. * monitor related attach/detach/init/deinit
  75. * will be done while monitor insmod
  76. */
  77. if (!mon_soc)
  78. return QDF_STATUS_SUCCESS;
  79. monitor_ops = mon_soc->mon_ops;
  80. if (!monitor_ops || !monitor_ops->mon_pdev_init) {
  81. qdf_err("callback not registered");
  82. return QDF_STATUS_E_FAILURE;
  83. }
  84. return monitor_ops->mon_pdev_init(pdev);
  85. }
  86. static inline QDF_STATUS monitor_pdev_deinit(struct dp_pdev *pdev)
  87. {
  88. struct dp_mon_ops *monitor_ops;
  89. struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
  90. /*
  91. * mon_soc uninitialized modular support enabled
  92. * monitor related attach/detach/init/deinit
  93. * will be done while monitor insmod
  94. */
  95. if (!mon_soc)
  96. return QDF_STATUS_SUCCESS;
  97. monitor_ops = mon_soc->mon_ops;
  98. if (!monitor_ops || !monitor_ops->mon_pdev_deinit) {
  99. qdf_err("callback not registered");
  100. return QDF_STATUS_E_FAILURE;
  101. }
  102. return monitor_ops->mon_pdev_deinit(pdev);
  103. }