cdp_txrx_tx_delay.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /**
  27. * @file cdp_txrx_tx_delay.h
  28. * @brief Define the host data path histogram API functions
  29. * called by the host control SW and the OS interface module
  30. */
  31. #ifndef _CDP_TXRX_COMPUTE_TX_DELAY_H_
  32. #define _CDP_TXRX_COMPUTE_TX_DELAY_H_
  33. #include "cdp_txrx_handle.h"
  34. /**
  35. * cdp_tx_delay() - get tx packet delay
  36. * @soc: data path soc handle
  37. * @pdev: physical device instance
  38. * @queue_delay_microsec: tx packet delay within queue, usec
  39. * @tx_delay_microsec: tx packet delay, usec
  40. * @category: packet catagory
  41. *
  42. * Return: NONE
  43. */
  44. static inline void
  45. cdp_tx_delay(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  46. uint32_t *queue_delay_microsec, uint32_t *tx_delay_microsec,
  47. int category)
  48. {
  49. if (!soc || !soc->ops || !soc->ops->delay_ops) {
  50. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  51. "%s invalid instance", __func__);
  52. return;
  53. }
  54. if (soc->ops->delay_ops->tx_delay)
  55. return soc->ops->delay_ops->tx_delay(pdev,
  56. queue_delay_microsec, tx_delay_microsec, category);
  57. return;
  58. }
  59. /**
  60. * cdp_tx_delay_hist() - get tx packet delay histogram
  61. * @soc: data path soc handle
  62. * @pdev: physical device instance
  63. * @bin_values: bin
  64. * @category: packet catagory
  65. *
  66. * Return: NONE
  67. */
  68. static inline void
  69. cdp_tx_delay_hist(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  70. uint16_t *bin_values, int category)
  71. {
  72. if (!soc || !soc->ops || !soc->ops->delay_ops) {
  73. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  74. "%s invalid instance", __func__);
  75. return;
  76. }
  77. if (soc->ops->delay_ops->tx_delay_hist)
  78. return soc->ops->delay_ops->tx_delay_hist(pdev,
  79. bin_values, category);
  80. return;
  81. }
  82. /**
  83. * cdp_tx_packet_count() - get tx packet count
  84. * @soc: data path soc handle
  85. * @pdev: physical device instance
  86. * @out_packet_loss_count: packet loss count
  87. * @category: packet catagory
  88. *
  89. * Return: NONE
  90. */
  91. static inline void
  92. cdp_tx_packet_count(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  93. uint16_t *out_packet_count, uint16_t *out_packet_loss_count,
  94. int category)
  95. {
  96. if (!soc || !soc->ops || !soc->ops->delay_ops) {
  97. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  98. "%s invalid instance", __func__);
  99. return;
  100. }
  101. if (soc->ops->delay_ops->tx_packet_count)
  102. return soc->ops->delay_ops->tx_packet_count(pdev,
  103. out_packet_count, out_packet_loss_count, category);
  104. return;
  105. }
  106. /**
  107. * cdp_tx_set_compute_interval() - set tx packet stat compute interval
  108. * @soc: data path soc handle
  109. * @pdev: physical device instance
  110. * @interval: compute interval
  111. *
  112. * Return: NONE
  113. */
  114. static inline void
  115. cdp_tx_set_compute_interval(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  116. uint32_t interval)
  117. {
  118. if (!soc || !soc->ops || !soc->ops->delay_ops) {
  119. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  120. "%s invalid instance", __func__);
  121. return;
  122. }
  123. if (soc->ops->delay_ops->tx_set_compute_interval)
  124. return soc->ops->delay_ops->tx_set_compute_interval(pdev,
  125. interval);
  126. return;
  127. }
  128. #endif /* _CDP_TXRX_COMPUTE_TX_DELAY_H_ */