cdp_txrx_tx_delay.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2023 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. * DOC: cdp_txrx_tx_delay.h
  21. * Define the host data path histogram API functions
  22. * called by the host control SW and the OS interface module
  23. */
  24. #ifndef _CDP_TXRX_COMPUTE_TX_DELAY_H_
  25. #define _CDP_TXRX_COMPUTE_TX_DELAY_H_
  26. #include "cdp_txrx_handle.h"
  27. /**
  28. * cdp_tx_delay() - get tx packet delay
  29. * @soc: data path soc handle
  30. * @pdev_id: id of data path pdev handle
  31. * @queue_delay_microsec: tx packet delay within queue, usec
  32. * @tx_delay_microsec: tx packet delay, usec
  33. * @category: packet category
  34. *
  35. * Return: NONE
  36. */
  37. static inline void
  38. cdp_tx_delay(ol_txrx_soc_handle soc, uint8_t pdev_id,
  39. uint32_t *queue_delay_microsec, uint32_t *tx_delay_microsec,
  40. int category)
  41. {
  42. if (!soc || !soc->ops || !soc->ops->delay_ops) {
  43. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  44. "%s invalid instance", __func__);
  45. return;
  46. }
  47. if (soc->ops->delay_ops->tx_delay)
  48. return soc->ops->delay_ops->tx_delay(soc, pdev_id,
  49. queue_delay_microsec, tx_delay_microsec, category);
  50. return;
  51. }
  52. /**
  53. * cdp_tx_delay_hist() - get tx packet delay histogram
  54. * @soc: data path soc handle
  55. * @pdev_id: id of data path pdev handle
  56. * @bin_values: bin
  57. * @category: packet category
  58. *
  59. * Return: NONE
  60. */
  61. static inline void
  62. cdp_tx_delay_hist(ol_txrx_soc_handle soc, uint8_t pdev_id,
  63. uint16_t *bin_values, int category)
  64. {
  65. if (!soc || !soc->ops || !soc->ops->delay_ops) {
  66. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  67. "%s invalid instance", __func__);
  68. return;
  69. }
  70. if (soc->ops->delay_ops->tx_delay_hist)
  71. return soc->ops->delay_ops->tx_delay_hist(soc, pdev_id,
  72. bin_values, category);
  73. return;
  74. }
  75. /**
  76. * cdp_tx_packet_count() - get tx packet count
  77. * @soc: data path soc handle
  78. * @pdev_id: id of data path pdev handle
  79. * @out_packet_count: packet count
  80. * @out_packet_loss_count: packet loss count
  81. * @category: packet category
  82. *
  83. * Return: NONE
  84. */
  85. static inline void
  86. cdp_tx_packet_count(ol_txrx_soc_handle soc, uint8_t pdev_id,
  87. uint16_t *out_packet_count, uint16_t *out_packet_loss_count,
  88. int category)
  89. {
  90. if (!soc || !soc->ops || !soc->ops->delay_ops) {
  91. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  92. "%s invalid instance", __func__);
  93. return;
  94. }
  95. if (soc->ops->delay_ops->tx_packet_count)
  96. return soc->ops->delay_ops->tx_packet_count(soc, pdev_id,
  97. out_packet_count, out_packet_loss_count, category);
  98. return;
  99. }
  100. /**
  101. * cdp_tx_set_compute_interval() - set tx packet stat compute interval
  102. * @soc: data path soc handle
  103. * @pdev_id: id of data path pdev handle
  104. * @interval: compute interval
  105. *
  106. * Return: NONE
  107. */
  108. static inline void
  109. cdp_tx_set_compute_interval(ol_txrx_soc_handle soc, uint8_t pdev_id,
  110. uint32_t interval)
  111. {
  112. if (!soc || !soc->ops || !soc->ops->delay_ops) {
  113. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  114. "%s invalid instance", __func__);
  115. return;
  116. }
  117. if (soc->ops->delay_ops->tx_set_compute_interval)
  118. return soc->ops->delay_ops->tx_set_compute_interval(soc,
  119. pdev_id,
  120. interval);
  121. return;
  122. }
  123. #endif /* _CDP_TXRX_COMPUTE_TX_DELAY_H_ */