cdp_txrx_tx_delay.h 3.7 KB

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