cdp_txrx_hist_struct.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright (c) 2020 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022 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. * @file cdp_txrx_hist_struct.h
  21. * @brief Define the host data path histogram data types
  22. */
  23. #ifndef _CDP_TXRX_HIST_STRUCT_H_
  24. #define _CDP_TXRX_HIST_STRUCT_H_
  25. /*
  26. * cdp_hist_bucket_index : Histogram Bucket
  27. * @CDP_HIST_BUCKET_0: Bucket Index 0
  28. * @CDP_HIST_BUCKET_1: Bucket Index 1
  29. * @CDP_HIST_BUCKET_2: Bucket Index 2
  30. * @CDP_HIST_BUCKET_3: Bucket Index 3
  31. * @CDP_HIST_BUCKET_4: Bucket Index 4
  32. * @CDP_HIST_BUCKET_5: Bucket Index 5
  33. * @CDP_HIST_BUCKET_6: Bucket Index 6
  34. * @CDP_HIST_BUCKET_7: Bucket Index 7
  35. * @CDP_HIST_BUCKET_8: Bucket Index 8
  36. * @CDP_HIST_BUCKET_9: Bucket Index 9
  37. * @CDP_HIST_BUCKET_10: Bucket Index 10
  38. * @CDP_HIST_BUCKET_11: Bucket Index 11
  39. * @CDP_HIST_BUCKET_12: Bucket Index 12
  40. */
  41. enum cdp_hist_bucket_index {
  42. CDP_HIST_BUCKET_0,
  43. CDP_HIST_BUCKET_1,
  44. CDP_HIST_BUCKET_2,
  45. CDP_HIST_BUCKET_3,
  46. CDP_HIST_BUCKET_4,
  47. CDP_HIST_BUCKET_5,
  48. CDP_HIST_BUCKET_6,
  49. CDP_HIST_BUCKET_7,
  50. CDP_HIST_BUCKET_8,
  51. CDP_HIST_BUCKET_9,
  52. CDP_HIST_BUCKET_10,
  53. CDP_HIST_BUCKET_11,
  54. CDP_HIST_BUCKET_12,
  55. CDP_HIST_BUCKET_MAX,
  56. };
  57. /*
  58. * cdp_hist_types: Histogram Types
  59. * @CDP_HIST_TYPE_SW_ENQEUE_DELAY: From stack to HW enqueue delay
  60. * @CDP_HIST_TYPE_HW_COMP_DELAY: From HW enqueue to completion delay
  61. * @CDP_HIST_TYPE_REAP_STACK: Rx HW reap to stack deliver delay
  62. * @CDP_HIST_TYPE_HW_TX_COMP_DELAY: Tx completion delay based on the timestamp
  63. * provided by HW
  64. */
  65. enum cdp_hist_types {
  66. CDP_HIST_TYPE_SW_ENQEUE_DELAY,
  67. CDP_HIST_TYPE_HW_COMP_DELAY,
  68. CDP_HIST_TYPE_REAP_STACK,
  69. CDP_HIST_TYPE_HW_TX_COMP_DELAY,
  70. CDP_HIST_TYPE_MAX,
  71. };
  72. /*
  73. * cdp_hist_bucket: Histogram Bucket
  74. * @hist_type: Histogram type
  75. * @freq: Frequency
  76. */
  77. struct cdp_hist_bucket {
  78. enum cdp_hist_types hist_type;
  79. uint64_t freq[CDP_HIST_BUCKET_MAX];
  80. };
  81. /*
  82. * cdp_hist_stats : Histogram of a stats type
  83. * @hist: Frequency distribution
  84. * @max: Max frequency
  85. * @min: Minimum frequency
  86. * @avg: Average frequency
  87. */
  88. struct cdp_hist_stats {
  89. struct cdp_hist_bucket hist;
  90. int max;
  91. int min;
  92. int avg;
  93. };
  94. #endif /* _CDP_TXRX_HIST_STRUCT_H_ */